From 57b2ae80a4e6e496526f815f1e3fd1af56e0aa8c Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Fri, 23 Jul 2021 16:50:47 +0300 Subject: Add production build --- out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_buildManifest.js | 1 + out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_ssgManifest.js | 1 + out/_next/static/chunks/311-d9f67a58f4e62c329b1d.js | 1 + out/_next/static/chunks/4.2dee5d830195ddd06029.js | 1 + out/_next/static/chunks/d25bd147-65fcc4c92edba8b370fb.js | 1 + out/_next/static/chunks/fb7d5399-a8c606efbc9e7c0edf90.js | 1 + out/_next/static/chunks/framework-0441fae7fd130f37dee1.js | 1 + out/_next/static/chunks/main-a3a79aff3ff232b41814.js | 1 + out/_next/static/chunks/pages/_app-26a0a8d7e57be89456af.js | 1 + out/_next/static/chunks/pages/_error-a0e21b9b223f827fe1f2.js | 1 + out/_next/static/chunks/pages/index-47bf7c38896695ae452e.js | 1 + out/_next/static/chunks/polyfills-a54b4f32bdc1ef890ddd.js | 1 + out/_next/static/chunks/webpack-9fd4baabae353e783090.js | 1 + out/_next/static/css/120f2e2270820d49a21f.css | 1 + 14 files changed, 14 insertions(+) create mode 100644 out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_buildManifest.js create mode 100644 out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_ssgManifest.js create mode 100644 out/_next/static/chunks/311-d9f67a58f4e62c329b1d.js create mode 100644 out/_next/static/chunks/4.2dee5d830195ddd06029.js create mode 100644 out/_next/static/chunks/d25bd147-65fcc4c92edba8b370fb.js create mode 100644 out/_next/static/chunks/fb7d5399-a8c606efbc9e7c0edf90.js create mode 100644 out/_next/static/chunks/framework-0441fae7fd130f37dee1.js create mode 100644 out/_next/static/chunks/main-a3a79aff3ff232b41814.js create mode 100644 out/_next/static/chunks/pages/_app-26a0a8d7e57be89456af.js create mode 100644 out/_next/static/chunks/pages/_error-a0e21b9b223f827fe1f2.js create mode 100644 out/_next/static/chunks/pages/index-47bf7c38896695ae452e.js create mode 100644 out/_next/static/chunks/polyfills-a54b4f32bdc1ef890ddd.js create mode 100644 out/_next/static/chunks/webpack-9fd4baabae353e783090.js create mode 100644 out/_next/static/css/120f2e2270820d49a21f.css (limited to 'out/_next/static') diff --git a/out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_buildManifest.js b/out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_buildManifest.js new file mode 100644 index 0000000..425a9df --- /dev/null +++ b/out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/fb7d5399-a8c606efbc9e7c0edf90.js","static/chunks/d25bd147-65fcc4c92edba8b370fb.js","static/chunks/311-d9f67a58f4e62c329b1d.js","static/chunks/pages/index-47bf7c38896695ae452e.js"],"/_error":["static/chunks/pages/_error-a0e21b9b223f827fe1f2.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_ssgManifest.js b/out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_ssgManifest.js new file mode 100644 index 0000000..0511aa8 --- /dev/null +++ b/out/_next/static/_zxX10Oi6R9eWkh0k3W4E/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); \ No newline at end of file diff --git a/out/_next/static/chunks/311-d9f67a58f4e62c329b1d.js b/out/_next/static/chunks/311-d9f67a58f4e62c329b1d.js new file mode 100644 index 0000000..8c2a0e1 --- /dev/null +++ b/out/_next/static/chunks/311-d9f67a58f4e62c329b1d.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[311],{676:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}n.d(t,{Z:function(){return r}})},4699:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2961);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(l){i=!0,o=l}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}}(e,t)||(0,r.Z)(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},7329:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(676);var i=n(2961);function o(e){return function(e){if(Array.isArray(e))return(0,r.Z)(e)}(e)||function(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||(0,i.Z)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},2961:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(676);function i(e,t){if(e){if("string"===typeof e)return(0,r.Z)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?(0,r.Z)(e,t):void 0}}},6327:function(e,t,n){"use strict";n.d(t,{UQ:function(){return q},KF:function(){return $},XE:function(){return Y},Qd:function(){return Z},Hk:function(){return X}});var r=n(58),i=n(63),o=n(2326),a=n(5284),s=n(9676),l=n(5643),u=n(658),c=n(8554),d=n.n(c),f=n(4461),h=n(3808),p=n(3869),v=n(7554),m=n(7294);function g(){return(g=Object.assign||function(e){for(var t=1;tg({},e,{delay:(0,h.hj)(t)?t:null==t?void 0:t.enter}),w=(e,t)=>g({},e,{delay:(0,h.hj)(t)?t:null==t?void 0:t.exit});function x(){return(x=Object.assign||function(e){for(var t=1;t{var t,n,{animateOpacity:r,startingHeight:i,transition:o,transitionEnd:a,delay:s}=e;return x({},r&&{opacity:(n=i,null!=n&&parseInt(n.toString(),10)>0?1:0)},{overflow:"hidden",height:i,transitionEnd:null==a?void 0:a.exit,transition:null!=(t=null==o?void 0:o.exit)?t:w(E.exit,s)})},enter:e=>{var t,{animateOpacity:n,endingHeight:r,transition:i,transitionEnd:o,delay:a}=e;return x({},n&&{opacity:1},{height:r,transitionEnd:null==o?void 0:o.enter,transition:null!=(t=null==i?void 0:i.enter)?t:b(E.enter,a)})}},T=m.forwardRef(((e,t)=>{var{in:n,unmountOnExit:r,animateOpacity:i=!0,startingHeight:o=0,endingHeight:a="auto",style:s,className:l,transition:c,transitionEnd:h}=e,g=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["in","unmountOnExit","animateOpacity","startingHeight","endingHeight","style","className","transition","transitionEnd"]),[y,b]=m.useState(!1);m.useEffect((()=>{var e=setTimeout((()=>{b(!0)}));return()=>clearTimeout(e)}),[]),(0,u.ZK)({condition:Boolean(o>0&&r),message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});var w=parseFloat(o.toString())>0,E={startingHeight:o,endingHeight:a,animateOpacity:i,transition:y?c:{enter:{duration:0}},transitionEnd:d()(h,{enter:{overflow:"initial"},exit:r?void 0:{display:w?"block":"none"}})},T=!r||n,_=n||r?"enter":"exit";return m.createElement(p.M,{initial:!1,custom:E},T&&m.createElement(v.E.div,x({ref:t},g,{className:(0,f.cx)("chakra-collapse",l),style:x({overflow:"hidden",display:"block"},s),custom:E,variants:k,initial:!!r&&"exit",animate:_,exit:"exit"})))}));h.Ts&&(T.displayName="Collapse");var _=n(8500),O=n(1888),C=n(7581),A=n(1034),S=n(4577),P=n(2947),M=n(7277),R=n(7248);function j(){return(j=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}var[L,N,I,z]=(0,O.n)();function H(e){var{onChange:t,defaultIndex:n,index:r,allowMultiple:i,allowToggle:o}=e,a=D(e,["onChange","defaultIndex","index","allowMultiple","allowToggle"]);!function(e){var t=e.index||e.defaultIndex,n=!(0,h.o8)(t)&&!(0,h.kJ)(t)&&e.allowMultiple;(0,u.ZK)({condition:!!n,message:"If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: "+typeof t+","})}(e),function(e){(0,u.ZK)({condition:!(!e.allowMultiple||!e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}(e);var s=I(),[l,c]=(0,m.useState)(-1);(0,C.z)((()=>{c(-1)}));var[d,f]=(0,A.T)({value:r,defaultValue:()=>i?null!=n?n:[]:null!=n?n:-1,onChange:t});return{index:d,setIndex:f,htmlProps:a,getAccordionItemProps:e=>{var t=!1;null!==e&&(t=(0,h.kJ)(d)?d.includes(e):d===e);return{isOpen:t,onChange:t=>{if(null!==e)if(i&&(0,h.kJ)(d)){var n=t?(0,M.jX)(d,e):(0,M.cl)(d,e);f(n)}else t?f(e):o&&f(-1)}}},focusedIndex:l,setFocusedIndex:c,descendants:s}}var[B,F]=(0,_.k)({name:"AccordionContext",errorMessage:"useAccordionContext: `context` is undefined. Seems you forgot to wrap the accordion components in ``"});function V(e){var{isDisabled:t,isFocusable:n,id:r}=e,i=D(e,["isDisabled","isFocusable","id"]),{getAccordionItemProps:o,setFocusedIndex:a}=F(),s=(0,m.useRef)(null),[l,c]=(0,S.ZS)(r,"accordion-button","accordion-panel");!function(e){(0,u.ZK)({condition:!(!e.isFocusable||e.isDisabled),message:"Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well.\n "})}(e);var{register:d,index:h,descendants:p}=z({disabled:t&&!n}),{isOpen:v,onChange:g}=o(-1===h?null:h);!function(e){(0,u.ZK)({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}({isOpen:v,isDisabled:t});var y=(0,m.useCallback)((()=>{null==g||g(!v),a(h)}),[h,a,v,g]),b=(0,m.useCallback)((e=>{var t={ArrowDown:()=>{var e=p.nextEnabled(h);e&&(0,R.T)(e.node)},ArrowUp:()=>{var e=p.prevEnabled(h);e&&(0,R.T)(e.node)},Home:()=>{var e=p.firstEnabled();e&&(0,R.T)(e.node)},End:()=>{var e=p.lastEnabled();e&&(0,R.T)(e.node)}}[(0,f.uh)(e)];t&&(e.preventDefault(),t(e))}),[p,h]),w=(0,m.useCallback)((()=>{a(h)}),[a,h]),x=(0,m.useCallback)((function(e,n){return void 0===e&&(e={}),void 0===n&&(n=null),j({},e,{type:"button",ref:(0,P.l)(d,s,n),id:l,disabled:!!t,"aria-expanded":!!v,"aria-controls":c,onClick:(0,u.v0)(e.onClick,y),onFocus:(0,u.v0)(e.onFocus,w),onKeyDown:(0,u.v0)(e.onKeyDown,b)})}),[l,t,v,y,w,b,c,d]),E=(0,m.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),j({},e,{ref:t,role:"region",id:c,"aria-labelledby":l,hidden:!v})}),[l,v,c]);return{isOpen:v,isDisabled:t,isFocusable:n,onOpen:()=>{null==g||g(!0)},onClose:()=>{null==g||g(!1)},getButtonProps:x,getPanelProps:E,htmlProps:i}}function U(){return(U=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}var q=(0,i.G)(((e,t)=>{var{children:n,reduceMotion:r}=e,i=G(e,["children","reduceMotion"]),u=(0,o.j)("Accordion",i),c=H((0,a.Lr)(i)),{htmlProps:d,descendants:h}=c,p=G(c,["htmlProps","descendants"]),v=m.useMemo((()=>U({},p,{reduceMotion:!!r})),[p,r]);return m.createElement(L,{value:h},m.createElement(B,{value:v},m.createElement(s.Fo,{value:u},m.createElement(l.m$.div,U({ref:t},d,{className:(0,f.cx)("chakra-accordion",i.className)}),n))))}));h.Ts&&(q.displayName="Accordion");var[W,K]=(0,_.k)({name:"AccordionItemContext",errorMessage:"useAccordionItemContext: `context` is undefined. Seems you forgot to wrap the accordion item parts in `` "}),Z=(0,i.G)(((e,t)=>{var{children:n,className:r}=e,i=V(e),{htmlProps:o}=i,a=G(i,["htmlProps"]),c=U({},(0,s.yK)().container,{overflowAnchor:"none"}),d=m.useMemo((()=>a),[a]);return m.createElement(W,{value:d},m.createElement(l.m$.div,U({ref:t},o,{className:(0,f.cx)("chakra-accordion__item",r),__css:c}),(0,u.Pu)(n,{isExpanded:!!a.isOpen,isDisabled:!!a.isDisabled})))}));h.Ts&&(Z.displayName="AccordionItem");var $=(0,i.G)(((e,t)=>{var{getButtonProps:n}=K(),r=n(e,t),i=U({display:"flex",alignItems:"center",width:"100%",outline:0},(0,s.yK)().button);return m.createElement(l.m$.button,U({},r,{className:(0,f.cx)("chakra-accordion__button",e.className),__css:i}))}));h.Ts&&($.displayName="AccordionButton");var X=(0,i.G)(((e,t)=>{var{reduceMotion:n}=F(),{getPanelProps:r,isOpen:i}=K(),o=r(e,t),a=(0,f.cx)("chakra-accordion__panel",e.className),u=(0,s.yK)();n||delete o.hidden;var c=m.createElement(l.m$.div,U({},o,{__css:u.panel,className:a}));return n?c:m.createElement(T,{in:i},c)}));h.Ts&&(X.displayName="AccordionPanel");var Y=e=>{var{isOpen:t,isDisabled:n}=K(),{reduceMotion:i}=F(),o=(0,f.cx)("chakra-accordion__icon",e.className),a=U({opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:i?void 0:"transform 0.2s",transformOrigin:"center"},(0,s.yK)().icon);return m.createElement(r.J,U({viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:a},e),m.createElement("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}))};h.Ts&&(Y.displayName="AccordionIcon")},155:function(e,t,n){"use strict";n.d(t,{z:function(){return _}});var r=n(2947),i=n(917),o=n(63),a=n(2326),s=n(5284),l=n(5643),u=n(4461),c=n(3808),d=n(5415),f=n(7294);function h(){return(h=Object.assign||function(e){for(var t=1;t{var n=(0,a.m)("Spinner",e),r=(0,s.Lr)(e),{label:i="Loading...",thickness:o="2px",speed:c="0.45s",emptyColor:v="transparent",className:m}=r,g=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(r,["label","thickness","speed","emptyColor","className"]),y=(0,u.cx)("chakra-spinner",m),b=h({display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:o,borderBottomColor:v,borderLeftColor:v,animation:p+" "+c+" linear infinite"},n);return f.createElement(l.m$.div,h({ref:t,__css:b,className:y},g),i&&f.createElement(d.TX,null,i))}));c.Ts&&(v.displayName="Spinner");var m=n(8554),g=n.n(m),y=n(8500);function b(){return(b=Object.assign||function(e){for(var t=1;t{var{size:n,colorScheme:r,variant:i,className:o,spacing:a="0.5rem",isAttached:s,isDisabled:c}=e,d=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["size","colorScheme","variant","className","spacing","isAttached","isDisabled"]),h=(0,u.cx)("chakra-button__group",o),p=f.useMemo((()=>({size:n,colorScheme:r,variant:i,isDisabled:c})),[n,r,i,c]),v={display:"inline-flex"};return v=b({},v,s?{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}}:{"& > *:not(style) ~ *:not(style)":{marginStart:a}}),f.createElement(w,{value:p},f.createElement(l.m$.div,b({ref:t,role:"group",__css:v,className:h},d)))}));function k(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}function T(){return(T=Object.assign||function(e){for(var t=1;t{var n,i=x(),o=(0,a.m)("Button",T({},i,e)),c=(0,s.Lr)(e),{isDisabled:d=(null==i?void 0:i.isDisabled),isLoading:h,isActive:p,isFullWidth:v,children:m,leftIcon:y,rightIcon:b,loadingText:w,iconSpacing:E="0.5rem",type:_,spinner:A,spinnerPlacement:S="start",className:P,as:M}=c,R=k(c,["isDisabled","isLoading","isActive","isFullWidth","children","leftIcon","rightIcon","loadingText","iconSpacing","type","spinner","spinnerPlacement","className","as"]),j=g()({},null!=(n=null==o?void 0:o._focus)?n:{},{zIndex:1}),D=T({display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",width:v?"100%":"auto"},o,!!i&&{_focus:j}),{ref:L,type:N}=function(e){var[t,n]=f.useState(!e),r=f.useCallback((e=>{e&&n("BUTTON"===e.tagName)}),[]),i=t?"button":void 0;return{ref:r,type:i}}(M);return f.createElement(l.m$.button,T({disabled:d||h,ref:(0,r.l)(t,L),as:M,type:null!=_?_:N,"data-active":(0,u.PB)(p),"data-loading":(0,u.PB)(h),__css:D,className:(0,u.cx)("chakra-button",P)},R),y&&!h&&f.createElement(O,{marginEnd:E},y),h&&"start"===S&&f.createElement(C,{className:"chakra-button__spinner--start",label:w,placement:"start"},A),h?w||f.createElement(l.m$.span,{opacity:0},m):m,h&&"end"===S&&f.createElement(C,{className:"chakra-button__spinner--end",label:w,placement:"end"},A),b&&!h&&f.createElement(O,{marginStart:E},b))}));c.Ts&&(_.displayName="Button");var O=e=>{var{children:t,className:n}=e,r=k(e,["children","className"]),i=f.isValidElement(t)?f.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,o=(0,u.cx)("chakra-button__icon",n);return f.createElement(l.m$.span,T({display:"inline-flex",alignSelf:"center",flexShrink:0},r,{className:o}),i)};c.Ts&&(O.displayName="ButtonIcon");var C=e=>{var{label:t,placement:n,children:r=f.createElement(v,{color:"currentColor",width:"1em",height:"1em"}),className:i,__css:o}=e,a=k(e,["label","placement","spacing","children","className","__css"]),s=(0,u.cx)("chakra-button__spinner",i),c=T({display:"flex",alignItems:"center",position:t?"relative":"absolute",["start"===n?"marginEnd":"marginStart"]:t?"0.5rem":0,fontSize:"1em",lineHeight:"normal"},o);return f.createElement(l.m$.div,T({className:s},a,{__css:c}),r)};c.Ts&&(C.displayName="ButtonSpinner")},8420:function(e,t,n){"use strict";n.d(t,{h:function(){return l}});var r=n(63),i=n(3808),o=n(7294),a=n(155);function s(){return(s=Object.assign||function(e){for(var t=1;t{var{icon:n,children:r,isRound:i,"aria-label":l}=e,u=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["icon","children","isRound","aria-label"]),c=n||r,d=o.isValidElement(c)?o.cloneElement(c,{"aria-hidden":!0,focusable:!1}):null;return o.createElement(a.z,s({padding:"0",borderRadius:i?"full":void 0,ref:t,"aria-label":l},u),d)}));i.Ts&&(l.displayName="IconButton")},1033:function(e,t,n){"use strict";n.d(t,{P:function(){return f}});var r=n(58),i=n(63),o=n(2326),a=n(5284),s=n(5643),l=n(3808),u=n(7294);function c(){return(c=Object.assign||function(e){for(var t=1;tu.createElement(r.J,c({focusable:"false","aria-hidden":!0},e),u.createElement("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})),f=(0,i.G)(((e,t)=>{var n=(0,o.m)("CloseButton",e),r=(0,a.Lr)(e),{children:i,isDisabled:l,__css:f}=r,h=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(r,["children","isDisabled","__css"]);return u.createElement(s.m$.button,c({type:"button","aria-label":"Close",ref:t,disabled:l,__css:c({},{outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},n,f)},h),i||u.createElement(d,{width:"1em",height:"1em"}))}));l.Ts&&(f.displayName="CloseButton")},2300:function(e,t,n){"use strict";var r=n(5643),i=n(3808),o=n(7294);function a(){return(a=Object.assign||function(e){for(var t=1;t{var{type:t="checkbox",_hover:n,_invalid:i,_disabled:s,_focus:l,_checked:u,_child:c={opacity:0},_checkedAndChild:d={opacity:1},_checkedAndDisabled:f,_checkedAndFocus:h,_checkedAndHover:p,children:v}=e,m=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["type","_hover","_invalid","_disabled","_focus","_checked","_child","_checkedAndChild","_checkedAndDisabled","_checkedAndFocus","_checkedAndHover","children"]),g="input[type="+t+"]:checked:disabled + &",y="input[type="+t+"]:checked:hover:not(:disabled) + &",b="input[type="+t+"]:checked:focus + &",w="input[type="+t+"]:disabled + &",x="input[type="+t+"]:focus + &",E="input[type="+t+"]:hover:not(:disabled):not(:checked) + &",k="input[type="+t+"]:checked + &, input[type="+t+"][aria-checked=mixed] + &",T="input[type="+t+"][aria-invalid=true] + &",_="& > *";return o.createElement(r.m$.div,a({},m,{"aria-hidden":!0,__css:{display:"inline-flex",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"fast",flexShrink:0,[x]:l,[E]:n,[w]:s,[T]:i,[g]:f,[b]:h,[y]:p,[_]:c,[k]:a({},u,{[_]:d})}}),v)};i.Ts&&(s.displayName="ControlBox")},1888:function(e,t,n){"use strict";n.d(t,{n:function(){return v}});var r=n(8500),i=n(2947),o=n(7294);function a(e){return e.sort(((e,t)=>{var n=e.compareDocumentPosition(t);if(n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(n&Node.DOCUMENT_POSITION_DISCONNECTED||n&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0}))}function s(e,t,n){var r=e+1;return n&&r>=t&&(r=0),r}function l(e,t,n){var r=e-1;return n&&r<0&&(r=t),r}var u="undefined"!==typeof window?o.useLayoutEffect:o.useEffect;function c(){return(c=Object.assign||function(e){for(var t=1;t{var t;if(null!=e)return"object"==typeof(t=e)&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE?this.registerNode(e):t=>{this.registerNode(t,e)}})),d(this,"unregister",(e=>{this.descendants.delete(e);var t=a(Array.from(this.descendants.keys()));this.assignIndex(t)})),d(this,"destroy",(()=>{this.descendants.clear()})),d(this,"assignIndex",(e=>{this.descendants.forEach((t=>{var n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()}))})),d(this,"count",(()=>this.descendants.size)),d(this,"enabledCount",(()=>this.enabledValues().length)),d(this,"values",(()=>Array.from(this.descendants.values()).sort(((e,t)=>e.index-t.index)))),d(this,"enabledValues",(()=>this.values().filter((e=>!e.disabled)))),d(this,"item",(e=>{if(0!==this.count())return this.values()[e]})),d(this,"enabledItem",(e=>{if(0!==this.enabledCount())return this.enabledValues()[e]})),d(this,"first",(()=>this.item(0))),d(this,"firstEnabled",(()=>this.enabledItem(0))),d(this,"last",(()=>this.item(this.descendants.size-1))),d(this,"lastEnabled",(()=>{var e=this.enabledValues().length-1;return this.enabledItem(e)})),d(this,"indexOf",(e=>{var t,n;return e&&null!=(t=null==(n=this.descendants.get(e))?void 0:n.index)?t:-1})),d(this,"enabledIndexOf",(e=>null==e?-1:this.enabledValues().findIndex((t=>t.node.isSameNode(e))))),d(this,"next",(function(t,n){void 0===n&&(n=!0);var r=s(t,e.count(),n);return e.item(r)})),d(this,"nextEnabled",(function(t,n){void 0===n&&(n=!0);var r=e.item(t);if(r){var i=s(e.enabledIndexOf(r.node),e.enabledCount(),n);return e.enabledItem(i)}})),d(this,"prev",(function(t,n){void 0===n&&(n=!0);var r=l(t,e.count()-1,n);return e.item(r)})),d(this,"prevEnabled",(function(t,n){void 0===n&&(n=!0);var r=e.item(t);if(r){var i=l(e.enabledIndexOf(r.node),e.enabledCount()-1,n);return e.enabledItem(i)}})),d(this,"registerNode",((e,t)=>{if(e&&!this.descendants.has(e)){var n=a(Array.from(this.descendants.keys()).concat(e));null!=t&&t.disabled&&(t.disabled=!!t.disabled);var r=c({node:e,index:-1},t);this.descendants.set(e,r),this.assignIndex(n)}}))}}var[h,p]=(0,r.k)({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function v(){return[h,()=>p(),()=>function(){var[e]=(0,o.useState)((()=>new f));return u((()=>()=>e.destroy())),e}(),e=>function(e){var t=p(),[n,r]=(0,o.useState)(-1),a=(0,o.useRef)(null);u((()=>()=>{a.current&&t.unregister(a.current)}),[]),u((()=>{if(a.current){var e=Number(a.current.dataset.index);n==e||Number.isNaN(e)||r(e)}}));var s=e?t.register(e):t.register;return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(a.current),register:(0,i.l)(s,a)}}(e)]}},639:function(e,t,n){"use strict";n.d(t,{k:function(){return i}});var r=n(7294);function i(e){void 0===e&&(e=!1);var[t,n]=(0,r.useState)(e);return[t,{on:(0,r.useCallback)((()=>{n(!0)}),[]),off:(0,r.useCallback)((()=>{n(!1)}),[]),toggle:(0,r.useCallback)((()=>{n((e=>!e))}),[])}]}},762:function(e,t,n){"use strict";n.d(t,{W:function(){return o}});var r=n(7294),i=n(8327);function o(e,t){void 0===t&&(t=[]);var n=r.useRef(e);return(0,i.G)((()=>{n.current=e})),r.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;re!==t)}=e,l=(0,o.W)(a),u=(0,o.W)(s),[c,d]=i.useState(n),f=void 0!==t,h=f?t:c,p=i.useCallback((e=>{var t=(0,r.Pu)(e,h);u(h,t)&&(f||d(t),l(t))}),[f,l,h,u]);return[h,p]}},4860:function(e,t,n){"use strict";n.d(t,{q:function(){return l}});var r=n(658),i=n(7294),o=n(1034),a=n(4577);function s(){return(s=Object.assign||function(e){for(var t=1;t{f||d(!1),null==t||t()}),[f,t]),m=i.useCallback((()=>{f||d(!0),null==n||n()}),[f,n]),g=i.useCallback((()=>{(h?v:m)()}),[h,m,v]);return{isOpen:!!h,onOpen:m,onClose:v,onToggle:g,isControlled:f,getButtonProps:function(e){return void 0===e&&(e={}),s({},e,{"aria-expanded":"true","aria-controls":p,onClick:(0,r.v0)(e.onClick,g)})},getDisclosureProps:function(e){return void 0===e&&(e={}),s({},e,{hidden:!h,id:p})}}}},4941:function(e,t,n){"use strict";n.d(t,{O:function(){return a}});var r=n(658),i=n(7294),o=n(762);function a(e,t,n,a){var s=(0,o.W)(t);return i.useEffect((()=>{var t,i=null!=(t=(0,r.Pu)(n))?t:document;return i.addEventListener(e,s,a),()=>{i.removeEventListener(e,s,a)}}),[e,n,a,s]),()=>{var t;(null!=(t=(0,r.Pu)(n))?t:document).removeEventListener(e,s,a)}}},8327:function(e,t,n){"use strict";n.d(t,{G:function(){return i}});var r=n(7294),i=n(4461).jU?r.useLayoutEffect:r.useEffect},7581:function(e,t,n){"use strict";n.d(t,{z:function(){return i}});var r=n(7294);function i(e,t){return void 0===t&&(t=[]),r.useEffect((()=>()=>e()),t)}},2653:function(e,t,n){"use strict";n.d(t,{r:function(){return i}});var r=n(7294),i=(e,t)=>{var n=r.useRef(!1);return r.useEffect((()=>{if(n.current)return e();n.current=!0}),t),n.current}},9867:function(e,t,n){"use strict";n.d(t,{I:function(){return l}});var r=n(63),i=n(3808),o=n(7294),a=n(58);function s(){return(s=Object.assign||function(e){for(var t=1;to.createElement(a.J,s({ref:r,viewBox:t},c,e),null!=l?l:o.createElement("path",{fill:"currentColor",d:n}))));return i.Ts&&(d.displayName=u),d}},58:function(e,t,n){"use strict";n.d(t,{J:function(){return c}});var r=n(63),i=n(5643),o=n(4461),a=n(3808),s=n(7294);function l(){return(l=Object.assign||function(e){for(var t=1;t{var{as:n,viewBox:r,color:a="currentColor",focusable:c=!1,children:d,className:f,__css:h}=e,p=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["as","viewBox","color","focusable","children","className","__css"]),v={ref:t,focusable:c,className:(0,o.cx)("chakra-icon",f),__css:l({w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:a},h)},m=null!=r?r:u.viewBox;if(n&&"string"!==typeof n)return s.createElement(i.m$.svg,l({as:n},v,p));var g=null!=d?d:u.path;return s.createElement(i.m$.svg,l({verticalAlign:"middle",viewBox:m},v,p),g)}));a.Ts&&(c.displayName="Icon")},6569:function(e,t,n){"use strict";n.d(t,{v:function(){return r}});var r=(0,n(9867).I)({displayName:"ChevronDownIcon",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})},4189:function(e,t,n){"use strict";n.d(t,{h:function(){return o}});var r=n(9867),i=n(7294),o=(0,r.I)({displayName:"InfoOutlineIcon",path:i.createElement("g",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"square",strokeWidth:"2"},i.createElement("circle",{cx:"12",cy:"12",fill:"none",r:"11",stroke:"currentColor"}),i.createElement("line",{fill:"none",x1:"11.959",x2:"11.959",y1:"11",y2:"17"}),i.createElement("circle",{cx:"11.959",cy:"7",r:"1",stroke:"none"}))})},3986:function(e,t,n){"use strict";n.d(t,{A:function(){return o}});var r=n(9867),i=n(7294),o=(0,r.I)({displayName:"RepeatClockIcon",path:i.createElement("g",{fill:"currentColor"},i.createElement("path",{d:"M12.965,6a1,1,0,0,0-1,1v5.5a1,1,0,0,0,1,1h5a1,1,0,0,0,0-2h-3.75a.25.25,0,0,1-.25-.25V7A1,1,0,0,0,12.965,6Z"}),i.createElement("path",{d:"M12.567,1.258A10.822,10.822,0,0,0,2.818,8.4a.25.25,0,0,1-.271.163L.858,8.309a.514.514,0,0,0-.485.213.5.5,0,0,0-.021.53l2.679,4.7a.5.5,0,0,0,.786.107l3.77-3.746a.5.5,0,0,0-.279-.85L5.593,9.007a.25.25,0,0,1-.192-.35,8.259,8.259,0,1,1,7.866,11.59,1.25,1.25,0,0,0,.045,2.5h.047a10.751,10.751,0,1,0-.792-21.487Z"}))})},3924:function(e,t,n){"use strict";n.d(t,{e:function(){return r}});var r=(0,n(9867).I)({viewBox:"0 0 14 14",d:"M14,7.77 L14,6.17 L12.06,5.53 L11.61,4.44 L12.49,2.6 L11.36,1.47 L9.55,2.38 L8.46,1.93 L7.77,0.01 L6.17,0.01 L5.54,1.95 L4.43,2.4 L2.59,1.52 L1.46,2.65 L2.37,4.46 L1.92,5.55 L0,6.23 L0,7.82 L1.94,8.46 L2.39,9.55 L1.51,11.39 L2.64,12.52 L4.45,11.61 L5.54,12.06 L6.23,13.98 L7.82,13.98 L8.45,12.04 L9.56,11.59 L11.4,12.47 L12.53,11.34 L11.61,9.53 L12.08,8.44 L14,7.75 L14,7.77 Z M7,10 C5.34,10 4,8.66 4,7 C4,5.34 5.34,4 7,4 C8.66,4 10,5.34 10,7 C10,8.66 8.66,10 7,10 Z",displayName:"SettingsIcon"})},8017:function(e,t,n){"use strict";n.d(t,{xu:function(){return u}});var r=n(5643),i=n(63),o=n(3808),a=n(7294);function s(){return(s=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}var u=(0,r.m$)("div");o.Ts&&(u.displayName="Box");var c=(0,i.G)(((e,t)=>{var{size:n,centerContent:r=!0}=e,i=l(e,["size","centerContent"]),o=r?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return a.createElement(u,s({ref:t,boxSize:n,__css:s({},o,{flexShrink:0,flexGrow:0})},i))}));o.Ts&&(c.displayName="Square");var d=(0,i.G)(((e,t)=>{var{size:n}=e,r=l(e,["size"]);return a.createElement(c,s({size:n,ref:t,borderRadius:"9999px"},r))}));o.Ts&&(d.displayName="Circle")},4096:function(e,t,n){"use strict";n.d(t,{k:function(){return l}});var r=n(63),i=n(5643),o=n(3808),a=n(7294);function s(){return(s=Object.assign||function(e){for(var t=1;t{var{direction:n,align:r,justify:o,wrap:l,basis:u,grow:c,shrink:d}=e,f=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["direction","align","justify","wrap","basis","grow","shrink"]),h={display:"flex",flexDirection:n,alignItems:r,justifyContent:o,flexWrap:l,flexBasis:u,flexGrow:c,flexShrink:d};return a.createElement(i.m$.div,s({ref:t,__css:h},f))}));o.Ts&&(l.displayName="Flex")},2026:function(e,t,n){"use strict";n.d(t,{cX:function(){return h},gC:function(){return g}});var r=n(5643),i=n(63),o=n(4461),a=n(3808),s=n(4255),l=n(7294),u=n(5505);Object.freeze(["base","sm","md","lg","xl","2xl"]);function c(e,t){return(0,a.kJ)(e)?e.map((e=>null===e?null:t(e))):(0,a.Kn)(e)?(0,u.Yd)(e).reduce(((n,r)=>(n[r]=t(e[r]),n)),{}):null!=e?t(e):null}var d="& > *:not(style) ~ *:not(style)";function f(){return(f=Object.assign||function(e){for(var t=1;tl.createElement(r.m$.div,f({className:"chakra-stack__divider"},e,{__css:f({},e.__css,{borderWidth:0,alignSelf:"stretch",borderColor:"inherit",width:"auto",height:"auto"})})),p=e=>l.createElement(r.m$.div,f({className:"chakra-stack__item"},e,{__css:f({display:"inline-block",flex:"0 0 auto",minWidth:0},e.__css)})),v=(0,i.G)(((e,t)=>{var{isInline:n,direction:i,align:a,justify:u,spacing:h="0.5rem",wrap:v,children:m,divider:g,className:y,shouldWrapChildren:b}=e,w=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["isInline","direction","align","justify","spacing","wrap","children","divider","className","shouldWrapChildren"]),x=n?"row":null!=i?i:"column",E=l.useMemo((()=>function(e){var{spacing:t,direction:n}=e,r={column:{marginTop:t,marginEnd:0,marginBottom:0,marginStart:0},row:{marginTop:0,marginEnd:0,marginBottom:0,marginStart:t},"column-reverse":{marginTop:0,marginEnd:0,marginBottom:t,marginStart:0},"row-reverse":{marginTop:0,marginEnd:t,marginBottom:0,marginStart:0}};return{flexDirection:n,[d]:c(n,(e=>r[e]))}}({direction:x,spacing:h})),[x,h]),k=l.useMemo((()=>function(e){var{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":c(n,(e=>r[e]))}}({spacing:h,direction:x})),[h,x]),T=!!g,_=!b&&!T,O=(0,s.W)(m),C=_?O:O.map(((e,t)=>{var n=t+1===O.length,r=b?l.createElement(p,{key:t},e):e;if(!T)return r;var i=n?null:l.cloneElement(g,{__css:k});return l.createElement(l.Fragment,{key:t},r,i)})),A=(0,o.cx)("chakra-stack",y);return l.createElement(r.m$.div,f({ref:t,display:"flex",alignItems:a,justifyContent:u,flexDirection:E.flexDirection,flexWrap:v,className:A,__css:T?{}:{[d]:E[d]}},w),C)}));a.Ts&&(v.displayName="Stack");var m=(0,i.G)(((e,t)=>l.createElement(v,f({align:"center"},e,{direction:"row",ref:t}))));a.Ts&&(m.displayName="HStack");var g=(0,i.G)(((e,t)=>l.createElement(v,f({align:"center"},e,{direction:"column",ref:t}))));a.Ts&&(g.displayName="VStack")},4115:function(e,t,n){"use strict";n.d(t,{x:function(){return f}});var r=n(63),i=n(2326),o=n(5284),a=n(5643),s=n(5505),l=n(4461),u=n(3808),c=n(7294);function d(){return(d=Object.assign||function(e){for(var t=1;t{var n=(0,i.m)("Text",e),r=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}((0,o.Lr)(e),["className","align","decoration","casing"]),u=(0,s.YU)({textAlign:e.align,textDecoration:e.decoration,textTransform:e.casing});return c.createElement(a.m$.p,d({ref:t,className:(0,l.cx)("chakra-text",e.className)},u,r,{__css:n}))}));u.Ts&&(f.displayName="Text")},8235:function(e,t,n){"use strict";n.d(t,{v2:function(){return G},j2:function(){return W},sN:function(){return Y},qy:function(){return $}});var r=n(2326),i=n(5284),o=n(9676),a=n(63),s=n(5643),l=n(658),u=n(3808),c=n(4461),d=n(7554),f=n(7294),h=n(2947);function p(){return(p=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,["ref","isDisabled","isFocusable","clickOnEnter","clickOnSpace","onMouseDown","onMouseUp","onClick","onKeyDown","onKeyUp","tabIndex","onMouseOver","onMouseLeave"]),[w,x]=f.useState(!0),[E,k]=f.useState(!1),T=function(){var e=f.useRef(new Map),t=e.current,n=f.useCallback(((t,n,r,i)=>{e.current.set(r,{type:n,el:t,options:i}),t.addEventListener(n,r,i)}),[]),r=f.useCallback(((t,n,r,i)=>{t.removeEventListener(n,r,i),e.current.delete(r)}),[]);return f.useEffect((()=>()=>{t.forEach(((e,t)=>{r(e.el,e.type,t,e.options)}))}),[r,t]),{add:n,remove:r}}(),_=w?m:m||0,O=n&&!r,C=f.useCallback((e=>{if(n)return e.stopPropagation(),void e.preventDefault();e.currentTarget.focus(),null==l||l(e)}),[n,l]),A=f.useCallback((e=>{E&&v(e)&&(e.preventDefault(),e.stopPropagation(),k(!1),T.remove(document,"keyup",A,!1))}),[E,T]),S=f.useCallback((e=>{if(null==u||u(e),!(n||e.defaultPrevented||e.metaKey)&&v(e.nativeEvent)&&!w){var t=i&&"Enter"===e.key;if(o&&" "===e.key&&(e.preventDefault(),k(!0)),t)e.preventDefault(),e.currentTarget.click();T.add(document,"keyup",A,!1)}}),[n,w,u,i,o,T,A]),P=f.useCallback((e=>{(null==d||d(e),n||e.defaultPrevented||e.metaKey)||v(e.nativeEvent)&&!w&&o&&" "===e.key&&(e.preventDefault(),k(!1),e.currentTarget.click())}),[o,w,n,d]),M=f.useCallback((e=>{0===e.button&&(k(!1),T.remove(document,"mouseup",M,!1))}),[T]),R=f.useCallback((e=>{if(!(0,c.dO)(e)){if(n)return e.stopPropagation(),void e.preventDefault();w||k(!0),e.currentTarget.focus({preventScroll:!0}),T.add(document,"mouseup",M,!1),null==a||a(e)}}),[n,w,a,T,M]),j=f.useCallback((e=>{(0,c.dO)(e)||(w||k(!1),null==s||s(e))}),[s,w]),D=f.useCallback((e=>{n?e.preventDefault():null==g||g(e)}),[n,g]),L=f.useCallback((e=>{E&&(e.preventDefault(),k(!1)),null==y||y(e)}),[E,y]),N=(0,h.l)(t,(e=>{e&&"BUTTON"!==e.tagName&&x(!1)}));return p({},b,w?{ref:N,type:"button","aria-disabled":O?void 0:n,disabled:O,onClick:C,onMouseDown:a,onMouseUp:s,onKeyUp:d,onKeyDown:u,onMouseOver:g,onMouseLeave:y}:{ref:N,role:"button","data-active":(0,c.PB)(E),"aria-disabled":n?"true":void 0,tabIndex:O?void 0:_,onClick:C,onMouseDown:R,onMouseUp:j,onKeyUp:P,onKeyDown:S,onMouseOver:D,onMouseLeave:L})}var g=n(1888),y=n(4860),b=n(762);function w(e,t){var n,r=e.target;if(e.button>0)return!1;if(r&&!(0,c.lZ)(r).body.contains(r))return!1;return!(null!=(n=t.current)&&n.contains(r))}var x=n(2653),E=n(7768),k=n(7248);function T(e,t){var{shouldFocus:n,visible:r,focusRef:i}=t,o=n&&!r;(0,x.r)((()=>{if(o&&!function(e){var t=e.current;if(!t)return!1;var n=(0,c.vY)(t);return!!n&&!(0,c.r3)(t,n)&&!!(0,E.Wq)(n)}(e)){var t=(null==i?void 0:i.current)||e.current;t&&(0,k.T)(t,{nextTick:!0})}}),[o,e,i])}var _=n(4577),O=n(7581);function C(e){void 0===e&&(e={});var{timeout:t=300,preventDefault:n=(()=>!0)}=e,[r,i]=f.useState([]),o=f.useRef(),a=()=>{o.current&&(clearTimeout(o.current),o.current=null)};return f.useEffect((()=>a),[]),function(e){return s=>{if("Backspace"===s.key){var l=[...r];return l.pop(),void i(l)}if(function(e){var{key:t}=e;return 1===t.length||t.length>1&&/[^a-zA-Z0-9]/.test(t)}(s)){var u=r.concat(s.key);n(s)&&(s.preventDefault(),s.stopPropagation()),i(u),e(u.join("")),a(),o.current=setTimeout((()=>{i([]),o.current=null}),t)}}}}n(1034);var A=n(8931),S=n(8500),P=(n(4255),n(7277));function M(){return(M=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}var[j,D,L,N]=(0,g.n)(),[I,z]=(0,S.k)({strict:!1,name:"MenuContext"});function H(e){void 0===e&&(e={});var{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,autoSelect:i=!0,isLazy:o,isOpen:a,defaultIsOpen:s,onClose:l,onOpen:u,placement:d="bottom-start",lazyBehavior:h="unmount",computePositionOnMount:p}=e,v=R(e,["id","closeOnSelect","closeOnBlur","autoSelect","isLazy","isOpen","defaultIsOpen","onClose","onOpen","placement","lazyBehavior","computePositionOnMount"]),{isOpen:m,onOpen:g,onClose:E,onToggle:C}=(0,y.q)({isOpen:a,defaultIsOpen:s,onClose:l,onOpen:u}),S=f.useRef(null),P=f.useRef(null);!function(e){var{ref:t,handler:n}=e,r=(0,b.W)(n),i=(0,f.useRef)({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;(0,f.useEffect)((()=>{var e=e=>{w(e,t)&&(i.isPointerDown=!0)},o=e=>{i.ignoreEmulatedMouseEvents?i.ignoreEmulatedMouseEvents=!1:i.isPointerDown&&n&&w(e,t)&&(i.isPointerDown=!1,r(e))},a=e=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&w(e,t)&&(i.isPointerDown=!1,r(e))},s=(0,c.lZ)(t.current);return s.addEventListener("mousedown",e,!0),s.addEventListener("mouseup",o,!0),s.addEventListener("touchstart",e,!0),s.addEventListener("touchend",a,!0),()=>{s.removeEventListener("mousedown",e,!0),s.removeEventListener("mouseup",o,!0),s.removeEventListener("touchstart",e,!0),s.removeEventListener("touchend",a,!0)}}),[n,t,r,i])}({ref:S,handler:e=>{var t;!m||!r||null!=(t=P.current)&&t.contains(e.target)||E()}});var j=(0,A.D)(M({},v,{enabled:m||p,placement:d})),[D,N]=f.useState(-1),I=L();(0,x.r)((()=>{m||N(-1)}),[m]),T(S,{focusRef:P,visible:m,shouldFocus:!0});var[z,H]=(0,_.ZS)(t,"menu-button","menu-list"),B=f.useCallback((()=>{g(),(0,k.T)(S.current,{nextTick:!0,selectTextIfInput:!1})}),[g,S]),F=f.useRef(new Set([]));return(0,O.z)((()=>{F.current.forEach((e=>clearTimeout(e))),F.current.clear()})),{openAndFocusMenu:B,openAndFocusFirstItem:f.useCallback((()=>{g();var e=setTimeout((()=>{var e=I.firstEnabled();e&&N(e.index)}));F.current.add(e)}),[g,N,I]),openAndFocusLastItem:f.useCallback((()=>{g();var e=setTimeout((()=>{var e=I.lastEnabled();e&&N(e.index)}));F.current.add(e)}),[g,N,I]),onTransitionEnd:f.useCallback((()=>{var e,t,n=(0,c.lZ)(S.current),r=null==(e=S.current)?void 0:e.contains(n.activeElement);if(m&&!r){var i=null==(t=I.item(D))?void 0:t.node;i&&(0,k.T)(i,{selectTextIfInput:!1})}}),[m,D,I]),descendants:I,popper:j,buttonId:z,menuId:H,forceUpdate:j.forceUpdate,orientation:"vertical",isOpen:m,onToggle:C,onOpen:g,onClose:E,menuRef:S,buttonRef:P,focusedIndex:D,closeOnSelect:n,closeOnBlur:r,autoSelect:i,setFocusedIndex:N,isLazy:o,lazyBehavior:h}}function B(e){var t;return e instanceof HTMLElement&&!(null==(t=e.getAttribute("role"))||!t.startsWith("menuitem"))}function F(e,t){void 0===e&&(e={}),void 0===t&&(t=null);var{onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onClick:o,isDisabled:a,isFocusable:s,closeOnSelect:l}=e,u=R(e,["onMouseEnter","onMouseMove","onMouseLeave","onClick","isDisabled","isFocusable","closeOnSelect"]),c=z(),{setFocusedIndex:d,focusedIndex:p,closeOnSelect:v,onClose:g,menuRef:y,isOpen:b,menuId:w}=c,T=f.useRef(null),O=w+"-menuitem-"+(0,_.Me)(),{index:C,register:A}=N({disabled:a&&!s}),S=f.useCallback((e=>{null==n||n(e),a||d(C)}),[d,C,a,n]),P=f.useCallback((e=>{null==r||r(e),T.current&&!(0,E.H9)(T.current)&&S(e)}),[S,r]),j=f.useCallback((e=>{null==i||i(e),a||d(-1)}),[d,a,i]),D=f.useCallback((e=>{null==o||o(e),B(e.currentTarget)&&(null!=l?l:v)&&g()}),[g,o,v,l]),L=C===p,I=a&&!s;return(0,x.r)((()=>{b&&(L&&!I&&T.current?(0,k.T)(T.current,{nextTick:!0,selectTextIfInput:!1}):y.current&&!(0,E.H9)(y.current)&&(0,k.T)(y.current))}),[L,I,y,b]),M({},u,m({onClick:D,onMouseEnter:S,onMouseMove:P,onMouseLeave:j,ref:(0,h.l)(A,T,t),isDisabled:a,isFocusable:s}),{id:O,role:"menuitem",tabIndex:L?0:-1})}function V(){return(V=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}var G=e=>{var{children:t}=e,n=(0,r.j)("Menu",e),a=H((0,i.Lr)(e)),{descendants:s}=a,u=U(a,["descendants"]),c=f.useMemo((()=>u),[u]),{isOpen:d,onClose:h,forceUpdate:p}=c;return f.createElement(j,{value:s},f.createElement(I,{value:c},f.createElement(o.Fo,{value:n},(0,l.Pu)(t,{isOpen:d,onClose:h,forceUpdate:p}))))};u.Ts&&(G.displayName="Menu");var q=(0,a.G)(((e,t)=>{var n=(0,o.yK)();return f.createElement(s.m$.button,V({ref:t},e,{__css:V({display:"inline-flex",appearance:"none",alignItems:"center",outline:0},n.button)}))})),W=(0,a.G)(((e,t)=>{var{as:n}=e,r=function(e,t){void 0===e&&(e={}),void 0===t&&(t=null);var n=z(),{isOpen:r,onClose:i,autoSelect:o,popper:a,openAndFocusFirstItem:s,openAndFocusLastItem:u,openAndFocusMenu:d}=n,p=f.useCallback((()=>{r?i():(o?s:d)()}),[o,r,i,s,d]),v=f.useCallback((e=>{var t=(0,c.uh)(e),n={Enter:s,ArrowDown:s,ArrowUp:u}[t];n&&(e.preventDefault(),e.stopPropagation(),n(e))}),[s,u]);return M({},e,{ref:(0,h.l)(n.buttonRef,t,a.referenceRef),id:n.buttonId,"data-active":(0,c.PB)(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:(0,l.v0)(e.onClick,p),onKeyDown:(0,l.v0)(e.onKeyDown,v)})}(U(e,["children","as"]),t),i=n||q;return f.createElement(i,V({},r,{className:(0,c.cx)("chakra-menu__menu-button",e.className)}),f.createElement(s.m$.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0}},e.children))}));u.Ts&&(W.displayName="MenuButton");var K={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},Z="custom"in d.E?d.E.custom(s.m$.div):(0,d.E)(s.m$.div),$=(0,a.G)(((e,t)=>{var n,r,{rootProps:i}=e,a=U(e,["rootProps"]),{isOpen:u,onTransitionEnd:d}=z(),p=function(e,t){void 0===e&&(e={}),void 0===t&&(t=null);var n=z();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");var{focusedIndex:r,setFocusedIndex:i,menuRef:o,isOpen:a,onClose:s,menuId:u,isLazy:d,lazyBehavior:p}=n,v=D(),m=C({preventDefault:e=>" "!==e.key&&B(e.target)}),g=f.useCallback((e=>{var t=(0,c.uh)(e),n={Tab:e=>e.preventDefault(),Escape:s,ArrowDown:()=>{var e=v.nextEnabled(r);e&&i(e.index)},ArrowUp:()=>{var e=v.prevEnabled(r);e&&i(e.index)}}[t];if(n)return e.preventDefault(),void n(e);var o=m((e=>{var t=(0,P.LP)(v.values(),e,(e=>{var t,n;return null!=(t=null==e||null==(n=e.node)?void 0:n.textContent)?t:""}),v.item(r));if(t){var n=v.indexOf(t.node);i(n)}}));B(e.target)&&o(e)}),[v,r,m,s,i]),y=f.useRef(!1);a&&(y.current=!0);var b=function(e){var{hasBeenSelected:t,isLazy:n,isSelected:r,lazyBehavior:i="unmount"}=e;return!n||!!r||!("keepMounted"!==i||!t)}({hasBeenSelected:y.current,isLazy:d,lazyBehavior:p,isSelected:a});return M({},e,{ref:(0,h.l)(o,t),children:b?e.children:null,tabIndex:-1,role:"menu",id:u,style:M({},e.style,{transformOrigin:"var(--popper-transform-origin)"}),"aria-orientation":"vertical",onKeyDown:(0,l.v0)(e.onKeyDown,g)})}(a,t),v=function(e){void 0===e&&(e={});var{popper:t,isOpen:n}=z();return t.getPopperProps(M({},e,{style:M({visibility:n?"visible":"hidden"},e.style)}))}(i),m=(0,o.yK)();return f.createElement(s.m$.div,V({},v,{__css:{zIndex:null!=(n=e.zIndex)?n:null==(r=m.list)?void 0:r.zIndex}}),f.createElement(Z,V({},p,{onUpdate:d,className:(0,c.cx)("chakra-menu__menu-list",p.className),variants:K,initial:!1,animate:u?"enter":"exit",__css:V({outline:0},m.list)})))}));u.Ts&&($.displayName="MenuList");var X=(0,a.G)(((e,t)=>{var{type:n}=e,r=U(e,["type"]),i=(0,o.yK)(),a=r.as?null!=n?n:void 0:"button",l=V({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0},i.item);return f.createElement(s.m$.button,V({ref:t,type:a},r,{__css:l}))})),Y=(0,a.G)(((e,t)=>{var{icon:n,iconSpacing:r="0.75rem",command:i,commandSpacing:o="0.75rem",children:a}=e,s=F(U(e,["icon","iconSpacing","command","commandSpacing","children"]),t),l=n||i?f.createElement("span",{style:{pointerEvents:"none",flex:1}},a):a;return f.createElement(X,V({},s,{className:(0,c.cx)("chakra-menu__menuitem",s.className)}),n&&f.createElement(ne,{fontSize:"0.8em",marginEnd:r},n),l,i&&f.createElement(te,{marginStart:o},i))}));u.Ts&&(Y.displayName="MenuItem");var Q=e=>f.createElement("svg",V({viewBox:"0 0 14 14",width:"1em",height:"1em"},e),f.createElement("polygon",{fill:"currentColor",points:"5.5 11.9993304 14 3.49933039 12.5 2 5.5 8.99933039 1.5 4.9968652 0 6.49933039"})),J=(0,a.G)(((e,t)=>{var{icon:n,iconSpacing:r="0.75rem"}=e,i=U(e,["icon","iconSpacing"]),o=function(e,t){void 0===e&&(e={}),void 0===t&&(t=null);var{type:n="radio",isChecked:r}=e;return M({},F(R(e,["type","isChecked"]),t),{role:"menuitem"+n,"aria-checked":r})}(i,t);return f.createElement(X,V({},o,{className:(0,c.cx)("chakra-menu__menuitem-option",i.className)}),f.createElement(ne,{fontSize:"0.8em",marginEnd:r,opacity:e.isChecked?1:0},n||f.createElement(Q,null)),f.createElement("span",{style:{flex:1}},o.children))}));J.id="MenuItemOption",u.Ts&&(J.displayName="MenuItemOption");u.Ts;var ee=(0,a.G)(((e,t)=>{var{title:n,children:r,className:i}=e,a=U(e,["title","children","className"]),l=(0,c.cx)("chakra-menu__group__title",i),u=(0,o.yK)();return f.createElement("div",{ref:t,className:"chakra-menu__group",role:"group"},n&&f.createElement(s.m$.p,V({className:l},a,{__css:u.groupTitle}),n),r)}));u.Ts&&(ee.displayName="MenuGroup");var te=(0,a.G)(((e,t)=>{var n=(0,o.yK)();return f.createElement(s.m$.span,V({ref:t},e,{__css:n.command,className:"chakra-menu__command"}))}));u.Ts&&(te.displayName="MenuCommand");var ne=e=>{var{className:t,children:n}=e,r=U(e,["className","children"]),i=f.Children.only(n),o=f.isValidElement(i)?f.cloneElement(i,{focusable:"false","aria-hidden":!0,className:(0,c.cx)("chakra-menu__icon",i.props.className)}):null,a=(0,c.cx)("chakra-menu__icon-wrapper",t);return f.createElement(s.m$.span,V({className:a},r,{__css:{flexShrink:0}}),o)};u.Ts&&(ne.displayName="MenuIcon");u.Ts},8931:function(e,t,n){"use strict";n.d(t,{D:function(){return be}});var r=n(2947);function i(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function o(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t?t.defaultView:window}return e}function a(e){var t=o(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function s(e){return e instanceof o(e).Element||e instanceof Element}function l(e){return e instanceof o(e).HTMLElement||e instanceof HTMLElement}function u(e){return e?(e.nodeName||"").toLowerCase():null}function c(e){return(s(e)?e.ownerDocument:e.document).documentElement}function d(e){return i(c(e)).left+a(e).scrollLeft}function f(e){return o(e).getComputedStyle(e)}function h(e){var t=f(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function p(e,t,n){void 0===n&&(n=!1);var r=c(t),s=i(e),f=l(t),p={scrollLeft:0,scrollTop:0},v={x:0,y:0};return(f||!f&&!n)&&(("body"!==u(t)||h(r))&&(p=function(e){return e!==o(e)&&l(e)?{scrollLeft:(t=e).scrollLeft,scrollTop:t.scrollTop}:a(e);var t}(t)),l(t)?((v=i(t)).x+=t.clientLeft,v.y+=t.clientTop):r&&(v.x=d(r))),{x:s.left+p.scrollLeft-v.x,y:s.top+p.scrollTop-v.y,width:s.width,height:s.height}}function v(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function m(e){return"html"===u(e)?e:e.assignedSlot||e.parentNode||e.host||c(e)}function g(e){return["html","body","#document"].indexOf(u(e))>=0?e.ownerDocument.body:l(e)&&h(e)?e:g(m(e))}function y(e,t){void 0===t&&(t=[]);var n=g(e),r="body"===u(n),i=o(n),a=r?[i].concat(i.visualViewport||[],h(n)?n:[]):n,s=t.concat(a);return r?s:s.concat(y(m(a)))}function b(e){return["table","td","th"].indexOf(u(e))>=0}function w(e){if(!l(e)||"fixed"===f(e).position)return null;var t=e.offsetParent;if(t){var n=c(t);if("body"===u(t)&&"static"===f(t).position&&"static"!==f(n).position)return n}return t}function x(e){for(var t=o(e),n=w(e);n&&b(n)&&"static"===f(n).position;)n=w(n);return n&&"body"===u(n)&&"static"===f(n).position?t:n||function(e){for(var t=m(e);l(t)&&["html","body"].indexOf(u(t))<0;){var n=f(t);if("none"!==n.transform||"none"!==n.perspective||n.willChange&&"auto"!==n.willChange)return t;t=t.parentNode}return null}(e)||t}var E="top",k="bottom",T="right",_="left",O="auto",C=[E,k,T,_],A="start",S="end",P="viewport",M="popper",R=C.reduce((function(e,t){return e.concat([t+"-"+A,t+"-"+S])}),[]),j=[].concat(C,[O]).reduce((function(e,t){return e.concat([t,t+"-"+A,t+"-"+S])}),[]),D=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function L(e){var t=new Map,n=new Set,r=[];function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||i(e)})),r}function N(e){var t;return function(){return t||(t=new Promise((function(n){Promise.resolve().then((function(){t=void 0,n(e())}))}))),t}}var I={placement:"bottom",modifiers:[],strategy:"absolute"};function z(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function G(e){var t,n=e.reference,r=e.element,i=e.placement,o=i?F(i):null,a=i?V(i):null,s=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case E:t={x:s,y:n.y-r.height};break;case k:t={x:s,y:n.y+n.height};break;case T:t={x:n.x+n.width,y:l};break;case _:t={x:n.x-r.width,y:l};break;default:t={x:n.x,y:n.y}}var u=o?U(o):null;if(null!=u){var c="y"===u?"height":"width";switch(a){case A:t[u]=Math.floor(t[u])-Math.floor(n[c]/2-r[c]/2);break;case S:t[u]=Math.floor(t[u])+Math.ceil(n[c]/2-r[c]/2)}}return t}var q={top:"auto",right:"auto",bottom:"auto",left:"auto"};function W(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.offsets,s=e.position,l=e.gpuAcceleration,u=e.adaptive,d=function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Math.round(t*r)/r||0,y:Math.round(n*r)/r||0}}(a),f=d.x,h=d.y,p=a.hasOwnProperty("x"),v=a.hasOwnProperty("y"),m=_,g=E,y=window;if(u){var b=x(n);b===o(n)&&(b=c(n)),i===E&&(g=k,h-=b.clientHeight-r.height,h*=l?1:-1),i===_&&(m=T,f-=b.clientWidth-r.width,f*=l?1:-1)}var w,O=Object.assign({position:s},u&&q);return l?Object.assign(Object.assign({},O),{},((w={})[g]=v?"0":"",w[m]=p?"0":"",w.transform=(y.devicePixelRatio||1)<2?"translate("+f+"px, "+h+"px)":"translate3d("+f+"px, "+h+"px, 0)",w)):Object.assign(Object.assign({},O),{},((t={})[g]=v?h+"px":"",t[m]=p?f+"px":"",t.transform="",t))}var K={left:"right",right:"left",bottom:"top",top:"bottom"};function Z(e){return e.replace(/left|right|bottom|top/g,(function(e){return K[e]}))}var $={start:"end",end:"start"};function X(e){return e.replace(/start|end/g,(function(e){return $[e]}))}function Y(e,t){var n=Boolean(t.getRootNode&&t.getRootNode().host);if(e.contains(t))return!0;if(n){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Q(e){return Object.assign(Object.assign({},e),{},{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function J(e,t){return t===P?Q(function(e){var t=o(e),n=c(e),r=t.visualViewport,i=n.clientWidth,a=n.clientHeight,s=0,l=0;return r&&(i=r.width,a=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=r.offsetLeft,l=r.offsetTop)),{width:i,height:a,x:s+d(e),y:l}}(e)):l(t)?function(e){var t=i(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}(t):Q(function(e){var t=c(e),n=a(e),r=e.ownerDocument.body,i=Math.max(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),o=Math.max(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-n.scrollLeft+d(e),l=-n.scrollTop;return"rtl"===f(r||t).direction&&(s+=Math.max(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:o,x:s,y:l}}(c(e)))}function ee(e,t,n){var r="clippingParents"===t?function(e){var t=y(m(e)),n=["absolute","fixed"].indexOf(f(e).position)>=0&&l(e)?x(e):e;return s(n)?t.filter((function(e){return s(e)&&Y(e,n)&&"body"!==u(e)})):[]}(e):[].concat(t),i=[].concat(r,[n]),o=i[0],a=i.reduce((function(t,n){var r=J(e,n);return t.top=Math.max(r.top,t.top),t.right=Math.min(r.right,t.right),t.bottom=Math.min(r.bottom,t.bottom),t.left=Math.max(r.left,t.left),t}),J(e,o));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function te(e){return Object.assign(Object.assign({},{top:0,right:0,bottom:0,left:0}),e)}function ne(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function re(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=void 0===r?e.placement:r,a=n.boundary,l=void 0===a?"clippingParents":a,u=n.rootBoundary,d=void 0===u?P:u,f=n.elementContext,h=void 0===f?M:f,p=n.altBoundary,v=void 0!==p&&p,m=n.padding,g=void 0===m?0:m,y=te("number"!==typeof g?g:ne(g,C)),b=h===M?"reference":M,w=e.elements.reference,x=e.rects.popper,_=e.elements[v?b:h],O=ee(s(_)?_:_.contextElement||c(e.elements.popper),l,d),A=i(w),S=G({reference:A,element:x,strategy:"absolute",placement:o}),R=Q(Object.assign(Object.assign({},x),S)),j=h===M?R:A,D={top:O.top-j.top+y.top,bottom:j.bottom-O.bottom+y.bottom,left:O.left-j.left+y.left,right:j.right-O.right+y.right},L=e.modifiersData.offset;if(h===M&&L){var N=L[o];Object.keys(D).forEach((function(e){var t=[T,k].indexOf(e)>=0?1:-1,n=[E,k].indexOf(e)>=0?"y":"x";D[e]+=N[n]*t}))}return D}function ie(e,t,n){return Math.max(e,Math.min(t,n))}function oe(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function ae(e){return[E,T,k,_].some((function(t){return e[t]>=0}))}var se=H({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=void 0===i||i,s=r.resize,l=void 0===s||s,u=o(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&c.forEach((function(e){e.addEventListener("scroll",n.update,B)})),l&&u.addEventListener("resize",n.update,B),function(){a&&c.forEach((function(e){e.removeEventListener("scroll",n.update,B)})),l&&u.removeEventListener("resize",n.update,B)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=G({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=void 0===r||r,o=n.adaptive,a=void 0===o||o,s={placement:F(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign(Object.assign({},t.styles.popper),W(Object.assign(Object.assign({},s),{},{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign(Object.assign({},t.styles.arrow),W(Object.assign(Object.assign({},s),{},{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];l(i)&&u(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],i=t.attributes[e]||{},o=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});l(r)&&u(r)&&(Object.assign(r.style,o),Object.keys(i).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=void 0===i?[0,0]:i,a=j.reduce((function(e,n){return e[n]=function(e,t,n){var r=F(e),i=[_,E].indexOf(r)>=0?-1:1,o="function"===typeof n?n(Object.assign(Object.assign({},t),{},{placement:e})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*i,[_,T].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,o),e}),{}),s=a[t.placement],l=s.x,u=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,f=n.altBoundary,h=n.flipVariations,p=void 0===h||h,v=n.allowedAutoPlacements,m=t.options.placement,g=F(m),y=l||(g===m||!p?[Z(m)]:function(e){if(F(e)===O)return[];var t=Z(e);return[X(e),t,X(t)]}(m)),b=[m].concat(y).reduce((function(e,n){return e.concat(F(n)===O?function(e,t){void 0===t&&(t={});var n=t,r=n.placement,i=n.boundary,o=n.rootBoundary,a=n.padding,s=n.flipVariations,l=n.allowedAutoPlacements,u=void 0===l?j:l,c=V(r),d=c?s?R:R.filter((function(e){return V(e)===c})):C,f=d.filter((function(e){return u.indexOf(e)>=0}));0===f.length&&(f=d);var h=f.reduce((function(t,n){return t[n]=re(e,{placement:n,boundary:i,rootBoundary:o,padding:a})[F(n)],t}),{});return Object.keys(h).sort((function(e,t){return h[e]-h[t]}))}(t,{placement:n,boundary:c,rootBoundary:d,padding:u,flipVariations:p,allowedAutoPlacements:v}):n)}),[]),w=t.rects.reference,x=t.rects.popper,S=new Map,P=!0,M=b[0],D=0;D=0,H=z?"width":"height",B=re(t,{placement:L,boundary:c,rootBoundary:d,altBoundary:f,padding:u}),U=z?I?T:_:I?k:E;w[H]>x[H]&&(U=Z(U));var G=Z(U),q=[];if(o&&q.push(B[N]<=0),s&&q.push(B[U]<=0,B[G]<=0),q.every((function(e){return e}))){M=L,P=!1;break}S.set(L,q)}if(P)for(var W=function(e){var t=b.find((function(t){var n=S.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return M=t,"break"},K=p?3:1;K>0;K--){if("break"===W(K))break}t.placement!==M&&(t.modifiersData[r]._skip=!0,t.placement=M,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0!==a&&a,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,d=n.padding,f=n.tether,h=void 0===f||f,p=n.tetherOffset,m=void 0===p?0:p,g=re(t,{boundary:l,rootBoundary:u,padding:d,altBoundary:c}),y=F(t.placement),b=V(t.placement),w=!b,O=U(y),C="x"===O?"y":"x",S=t.modifiersData.popperOffsets,P=t.rects.reference,M=t.rects.popper,R="function"===typeof m?m(Object.assign(Object.assign({},t.rects),{},{placement:t.placement})):m,j={x:0,y:0};if(S){if(o){var D="y"===O?E:_,L="y"===O?k:T,N="y"===O?"height":"width",I=S[O],z=S[O]+g[D],H=S[O]-g[L],B=h?-M[N]/2:0,G=b===A?P[N]:M[N],q=b===A?-M[N]:-P[N],W=t.elements.arrow,K=h&&W?v(W):{width:0,height:0},Z=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},$=Z[D],X=Z[L],Y=ie(0,P[N],K[N]),Q=w?P[N]/2-B-Y-$-R:G-Y-$-R,J=w?-P[N]/2+B+Y+X+R:q+Y+X+R,ee=t.elements.arrow&&x(t.elements.arrow),te=ee?"y"===O?ee.clientTop||0:ee.clientLeft||0:0,ne=t.modifiersData.offset?t.modifiersData.offset[t.placement][O]:0,oe=S[O]+Q-ne-te,ae=S[O]+J-ne,se=ie(h?Math.min(z,oe):z,I,h?Math.max(H,ae):H);S[O]=se,j[O]=se-I}if(s){var le="x"===O?E:_,ue="x"===O?k:T,ce=S[C],de=ie(ce+g[le],ce,ce-g[ue]);S[C]=de,j[C]=de-ce}t.modifiersData[r]=j}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,i=n.elements.arrow,o=n.modifiersData.popperOffsets,a=F(n.placement),s=U(a),l=[_,T].indexOf(a)>=0?"height":"width";if(i&&o){var u=n.modifiersData[r+"#persistent"].padding,c=v(i),d="y"===s?E:_,f="y"===s?k:T,h=n.rects.reference[l]+n.rects.reference[s]-o[s]-n.rects.popper[l],p=o[s]-n.rects.reference[s],m=x(i),g=m?"y"===s?m.clientHeight||0:m.clientWidth||0:0,y=h/2-p/2,b=u[d],w=g-c[l]-u[f],O=g/2-c[l]/2+y,C=ie(b,O,w),A=s;n.modifiersData[r]=((t={})[A]=C,t.centerOffset=C-O,t)}},effect:function(e){var t=e.state,n=e.options,r=e.name,i=n.element,o=void 0===i?"[data-popper-arrow]":i,a=n.padding,s=void 0===a?0:a;null!=o&&("string"!==typeof o||(o=t.elements.popper.querySelector(o)))&&Y(t.elements.popper,o)&&(t.elements.arrow=o,t.modifiersData[r+"#persistent"]={padding:te("number"!==typeof s?s:ne(s,C))})},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=re(t,{elementContext:"reference"}),s=re(t,{altBoundary:!0}),l=oe(a,r),u=oe(s,i,o),c=ae(l),d=ae(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-reference-hidden":c,"data-popper-escaped":d})}}]}),le=n(7294),ue=n(3459),ce={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:e=>{var{state:t}=e;t.styles.popper.width=t.rects.reference.width+"px"},effect:e=>{var{state:t}=e;return()=>{var e=t.elements.reference;t.elements.popper.style.width=e.offsetWidth+"px"}}},de={name:"transformOrigin",enabled:!0,phase:"write",fn:e=>{var{state:t}=e;fe(t)},effect:e=>{var{state:t}=e;return()=>{fe(t)}}},fe=e=>{e.elements.popper.style.setProperty(ue.Dq.transformOrigin.var,(0,ue.mv)(e.placement))},he={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:e=>{var{state:t}=e;pe(t)}},pe=e=>{var t;if(e.placement){var n=ve(e.placement);if(null!=(t=e.elements)&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:ue.Dq.arrowSize.varRef,height:ue.Dq.arrowSize.varRef,zIndex:-1});var r={[ue.Dq.arrowSizeHalf.var]:"calc("+ue.Dq.arrowSize.varRef+" / 2)",[ue.Dq.arrowOffset.var]:"calc("+ue.Dq.arrowSizeHalf.varRef+" * -1)"};for(var i in r)e.elements.arrow.style.setProperty(i,r[i])}}},ve=e=>e.startsWith("top")?{property:"bottom",value:ue.Dq.arrowOffset.varRef}:e.startsWith("bottom")?{property:"top",value:ue.Dq.arrowOffset.varRef}:e.startsWith("left")?{property:"right",value:ue.Dq.arrowOffset.varRef}:e.startsWith("right")?{property:"left",value:ue.Dq.arrowOffset.varRef}:void 0,me={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:e=>{var{state:t}=e;ge(t)},effect:e=>{var{state:t}=e;return()=>{ge(t)}}},ge=e=>{if(e.elements.arrow){var t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");t&&Object.assign(t.style,{transform:"rotate(45deg)",background:ue.Dq.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:(0,ue.Ke)(e.placement)})}};function ye(){return(ye=Object.assign||function(e){for(var t=1;t{})),y=(0,le.useCallback)((()=>{t&&p.current&&v.current&&(null==g.current||g.current(),m.current=se(p.current,v.current,{placement:i,modifiers:[me,he,de,ye({},ce,{enabled:!!h}),ye({name:"eventListeners"},(0,ue.$B)(s)),{name:"arrow",options:{padding:a}},{name:"offset",options:{offset:null!=l?l:[0,u]}},{name:"flip",enabled:!!c,options:{padding:8}},{name:"preventOverflow",enabled:!!f,options:{boundary:d}},...n],strategy:o}),m.current.forceUpdate(),g.current=m.current.destroy)}),[t,i,n,h,s,a,l,u,c,f,d,o]);(0,le.useEffect)((()=>()=>{var e;p.current||v.current||(null==(e=m.current)||e.destroy(),m.current=null)}),[]);var b=(0,le.useCallback)((e=>{p.current=e,y()}),[y]),w=(0,le.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),ye({},e,{ref:(0,r.l)(b,t)})}),[b]),x=(0,le.useCallback)((e=>{v.current=e,y()}),[y]),E=(0,le.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),ye({},e,{ref:(0,r.l)(x,t),style:ye({},e.style,{position:o,minWidth:"max-content",inset:"0 auto auto 0"})})}),[o,x]),k=(0,le.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),ye({},function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["size","shadowColor","bg","style"]),{ref:t,"data-popper-arrow":"",style:we(e)})}),[]),T=(0,le.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),ye({},e,{ref:t,"data-popper-arrow-inner":""})}),[]);return{update(){var e;null==(e=m.current)||e.update()},forceUpdate(){var e;null==(e=m.current)||e.forceUpdate()},transformOrigin:ue.Dq.transformOrigin.varRef,referenceRef:b,popperRef:x,getPopperProps:E,getArrowProps:k,getArrowInnerProps:T,getReferenceProps:w}}function we(e){var{size:t,shadowColor:n,bg:r,style:i}=e,o=ye({},i,{position:"absolute"});return t&&(o["--popper-arrow-size"]=t),n&&(o["--popper-arrow-shadow-color"]=n),r&&(o["--popper-arrow-bg"]=r),o}},3459:function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t({var:e,varRef:t?"var("+e+", "+t+")":"var("+e+")"}),o={arrowShadowColor:i("--popper-arrow-shadow-color"),arrowSize:i("--popper-arrow-size","8px"),arrowSizeHalf:i("--popper-arrow-size-half"),arrowBg:i("--popper-arrow-bg"),transformOrigin:i("--popper-transform-origin"),arrowOffset:i("--popper-arrow-offset")};function a(e){return e.includes("top")?"1px 1px 1px 0 var(--popper-arrow-shadow-color)":e.includes("bottom")?"-1px -1px 1px 0 var(--popper-arrow-shadow-color)":e.includes("right")?"-1px 1px 1px 0 var(--popper-arrow-shadow-color)":e.includes("left")?"1px -1px 1px 0 var(--popper-arrow-shadow-color)":void 0}var s={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},l=e=>s[e],u={scroll:!0,resize:!0};function c(e){return"object"===typeof e?{enabled:!0,options:r({},u,e)}:{enabled:e,options:u}}},4255:function(e,t,n){"use strict";n.d(t,{W:function(){return i}});var r=n(7294);function i(e){return r.Children.toArray(e).filter((e=>r.isValidElement(e)))}},2947:function(e,t,n){"use strict";n.d(t,{l:function(){return o}});var r=n(3808);function i(e,t){if(null!=e)if((0,r.mf)(e))e(t);else try{e.current=t}catch(n){throw new Error("Cannot assign value '"+t+"' to ref '"+e+"'")}}function o(){for(var e=arguments.length,t=new Array(e),n=0;n{t.forEach((t=>i(t,e)))}}},980:function(e,t,n){"use strict";n.d(t,{useTheme:function(){return i.useTheme}});n(2300);var r=n(4806);n.o(r,"useTheme")&&n.d(t,{useTheme:function(){return r.useTheme}});var i=n(1180)},3014:function(e,t,n){"use strict";n.d(t,{iR:function(){return ue},Ms:function(){return fe},gs:function(){return ce},Uj:function(){return de}});var r=n(63),i=n(2326),o=n(5284),a=n(9676),s=n(5643),l=n(3808),u=n(4461),c=n(8500),d=n(7294),f=n(762),h=n(1034),p=n(639);var v=n(4577),m="Invariant failed";var g=function(e,t){if(!e)throw new Error(m)},y=function(e){var t=e.top,n=e.right,r=e.bottom,i=e.left;return{top:t,right:n,bottom:r,left:i,width:n-i,height:r-t,x:i,y:t,center:{x:(n+i)/2,y:(r+t)/2}}},b=function(e,t){return{top:e.top+t.top,left:e.left+t.left,bottom:e.bottom-t.bottom,right:e.right-t.right}},w={top:0,right:0,bottom:0,left:0},x=function(e){var t,n,r=e.borderBox,i=e.margin,o=void 0===i?w:i,a=e.border,s=void 0===a?w:a,l=e.padding,u=void 0===l?w:l,c=y((n=o,{top:(t=r).top-n.top,left:t.left-n.left,bottom:t.bottom+n.bottom,right:t.right+n.right})),d=y(b(r,s)),f=y(b(d,u));return{marginBox:c,borderBox:y(r),paddingBox:d,contentBox:f,margin:o,border:s,padding:u}},E=function(e){var t=e.slice(0,-2);if("px"!==e.slice(-2))return 0;var n=Number(t);return isNaN(n)&&g(!1),n},k=function(e){return function(e,t){var n={top:E(t.marginTop),right:E(t.marginRight),bottom:E(t.marginBottom),left:E(t.marginLeft)},r={top:E(t.paddingTop),right:E(t.paddingRight),bottom:E(t.paddingBottom),left:E(t.paddingLeft)},i={top:E(t.borderTopWidth),right:E(t.borderRightWidth),bottom:E(t.borderBottomWidth),left:E(t.borderLeftWidth)};return x({borderBox:e,margin:n,padding:r,border:i})}(e.getBoundingClientRect(),window.getComputedStyle(e))},T=n(8327);var _=n(2653),O=n(9839);function C(e){return!!e.touches}var A={pageX:0,pageY:0};function S(e,t){void 0===t&&(t="page");var n=e.touches[0]||e.changedTouches[0]||A;return{x:n[t+"X"],y:n[t+"Y"]}}function P(e,t){return void 0===t&&(t="page"),{x:e[t+"X"],y:e[t+"Y"]}}function M(e,t){return void 0===t&&(t="page"),{point:C(e)?S(e,t):P(e,t)}}var R=function(e,t){void 0===t&&(t=!1);var n,r=t=>e(t,M(t));return t?(n=r,e=>{var t=e instanceof MouseEvent;(!t||t&&0===e.button)&&n(e)}):r},j={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},D={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function L(e){return u.jU&&null===window.onpointerdown?e:u.jU&&null===window.ontouchstart?D[e]:u.jU&&null===window.onmousedown?j[e]:e}function N(e,t,n,r){return(0,u.EV)(e,L(t),R(n,"pointerdown"===t),r)}var I=n(658);function z(){return(z=Object.assign||function(e){for(var t=1;t{if(this.lastEvent&&this.lastEventInfo){var e=G(this.lastEventInfo,this.history),t=null!==this.startEvent,n=(0,I.TE)(e.offset,{x:0,y:0})>=this.threshold;if(t||n){var{timestamp:r}=(0,O.$B)();this.history.push(z({},e.point,{timestamp:r}));var{onStart:i,onMove:o}=this.handlers;t||(null==i||i(this.lastEvent,e),this.startEvent=this.lastEvent),null==o||o(this.lastEvent,e)}}})),H(this,"onPointerMove",((e,t)=>{this.lastEvent=e,this.lastEventInfo=t,function(e){return"undefined"!==typeof PointerEvent&&e instanceof PointerEvent?!("mouse"!==e.pointerType):e instanceof MouseEvent}(e)&&0===e.buttons?this.onPointerUp(e,t):O.ZP.update(this.updatePoint,!0)})),H(this,"onPointerUp",((e,t)=>{var n=G(t,this.history),{onEnd:r,onSessionEnd:i}=this.handlers;null==i||i(e,n),this.end(),r&&this.startEvent&&(null==r||r(e,n))})),!(C(r=e)&&r.touches.length>1)){var r;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();var i=M(e),{timestamp:o}=(0,O.$B)();this.history=[z({},i.point,{timestamp:o})];var{onSessionStart:a}=t;null==a||a(e,G(i,this.history)),this.removeListeners=(0,I.zG)(N(window,"pointermove",this.onPointerMove),N(window,"pointerup",this.onPointerUp),N(window,"pointercancel",this.onPointerUp))}}updateHandlers(e){this.handlers=e}end(){var e;null==(e=this.removeListeners)||e.call(this),O.qY.update(this.updatePoint)}}function F(e,t){return{x:e.x-t.x,y:e.y-t.y}}function V(e){return e[0]}function U(e){return e[e.length-1]}function G(e,t){return{point:e.point,delta:F(e.point,U(t)),offset:F(e.point,V(t)),velocity:q(t,.1)}}function q(e,t){if(e.length<2)return{x:0,y:0};for(var n=e.length-1,r=null,i=function(e){return e[e.length-1]}(e);n>=0&&(r=e[n],!(i.timestamp-r.timestamp>1e3*t));)n--;if(!r)return{x:0,y:0};var o=(i.timestamp-r.timestamp)/1e3;if(0===o)return{x:0,y:0};var a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}var W=n(4941);var K=n(7581);function Z(e,t){var n,r,i,o,{onPan:a,onPanStart:s,onPanEnd:l,onPanSessionStart:u,onPanSessionEnd:c}=t,f=Boolean(a||s||l||u||c),h=(0,d.useRef)(null),p={onSessionStart:u,onSessionEnd:c,onStart:s,onMove:a,onEnd(e,t){h.current=null,null==l||l(e,t)}};(0,d.useEffect)((()=>{var e;null==(e=h.current)||e.updateHandlers(p)})),n=()=>e.current,r="pointerdown",i=f?function(e){h.current=new B(e,p)}:I.ZT,(0,W.O)(L(r),R(i,"pointerdown"===r),n,o),(0,K.z)((()=>{var e;null==(e=h.current)||e.end(),h.current=null}))}var $=n(2947);Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER;function X(e,t){var n=function(e){var t=parseFloat(e);return(0,l.iy)(t)?0:t}(e),r=10**(null!=t?t:10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function Y(e,t,n){return 100*(e-t)/(n-t)}function Q(e,t,n){return X(Math.round((e-t)/n)*n+t,function(e){if(!Number.isFinite(e))return 0;for(var t=1,n=0;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}(n))}function J(e,t,n){return null==e?e:((0,I.ZK)({condition:n=0||(i[n]=e[n]);return i}(e,["min","max","onChange","value","defaultValue","isReversed","orientation","id","isDisabled","isReadOnly","onChangeStart","onChangeEnd","step","getAriaValueText","aria-valuetext","aria-label","aria-labelledby","name","focusThumbOnChange"]),M=(0,f.W)(y),R=(0,f.W)(b),j=(0,f.W)(x),[D,L]=(0,h.T)({value:o,defaultValue:null!=a?a:oe(n,r),onChange:i}),[N,z]=(0,p.k)(),H=function(e){var t=(0,d.useRef)();return(0,d.useEffect)((()=>{t.current=e}),[e]),t.current}(N),[B,F]=(0,p.k)(),V=(0,d.useRef)(null),U=!(m||g),G=J(D,n,r),q=function(e){var t=d.useRef(null);return t.current=e,t}(G),W=(0,d.useRef)(q.current),K=Y(s?r-G+n:G,n,r),X="vertical"===l,ie=(0,d.useRef)(null),ae=(0,d.useRef)(null),se=(0,d.useRef)(null),[le,ue]=(0,v.ZS)(c,"slider-thumb","slider-track"),ce=(0,d.useCallback)((e=>{var t,i;if(ie.current){V.current="pointer";var o=k(ie.current).borderBox,{clientX:a,clientY:l}=null!=(t=null==(i=e.touches)?void 0:i[0])?t:e,u=(X?o.bottom-l:a-o.left)/(X?o.height:o.width);s&&(u=1-u);var c=function(e,t,n){return(n-t)*e+t}(u,n,r);return w&&(c=parseFloat(Q(c,n,w))),c=J(c,n,r)}}),[X,s,r,n,w]),de=(r-n)/10,fe=w||(r-n)/100,he=(0,d.useCallback)((e=>{U&&(e=J(e=parseFloat(Q(e,n,fe)),n,r),L(e))}),[fe,r,n,L,U]),pe=(0,d.useMemo)((()=>({stepUp:function(e){void 0===e&&(e=fe),he(s?G-e:G+e)},stepDown:function(e){void 0===e&&(e=fe),he(s?G+e:G-e)},reset:()=>he(a||0),stepTo:e=>he(e)})),[he,s,G,fe,a]),ve=(0,d.useCallback)((e=>{var t={ArrowRight:()=>pe.stepUp(),ArrowUp:()=>pe.stepUp(),ArrowLeft:()=>pe.stepDown(),ArrowDown:()=>pe.stepDown(),PageUp:()=>pe.stepUp(de),PageDown:()=>pe.stepDown(de),Home:()=>he(n),End:()=>he(r)}[(0,u.uh)(e)];t&&(e.preventDefault(),e.stopPropagation(),t(e),V.current="keyboard")}),[pe,he,r,n,de]),me=null!=(t=null==j?void 0:j(G))?t:E,ge=function(e,t){var[n,r]=d.useState(null),i=d.useRef();return(0,T.G)((()=>{if(e.current){var n=e.current;return o(),t&&(window.addEventListener("resize",o),window.addEventListener("scroll",o)),()=>{t&&(window.removeEventListener("resize",o),window.removeEventListener("scroll",o)),i.current&&cancelAnimationFrame(i.current)}}function o(){i.current=requestAnimationFrame((()=>{var e=k(n);r(e)}))}}),[t]),n}(ae),{thumbStyle:ye,rootStyle:be,trackStyle:we,innerTrackStyle:xe}=(0,d.useMemo)((()=>{var e,t=null!=(e=null==ge?void 0:ge.borderBox)?e:{width:0,height:0};return function(e){var{orientation:t,trackPercent:n,thumbRect:r,isReversed:i}=e,o=te({position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none"},ne({orientation:t,vertical:{bottom:"calc("+n+"% - "+r.height/2+"px)"},horizontal:{left:"calc("+n+"% - "+r.width/2+"px)"}})),a=te({position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0},ne({orientation:t,vertical:{paddingLeft:r.width/2,paddingRight:r.width/2},horizontal:{paddingTop:r.height/2,paddingBottom:r.height/2}})),s=te({position:"absolute"},ne({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}}));return{trackStyle:s,innerTrackStyle:te({},s,ne({orientation:t,vertical:i?{height:100-n+"%",top:0}:{height:n+"%",bottom:0},horizontal:i?{width:100-n+"%",right:0}:{width:n+"%",left:0}})),rootStyle:a,thumbStyle:o}}({isReversed:s,orientation:l,thumbRect:t,trackPercent:K})}),[s,l,null==ge?void 0:ge.borderBox,K]),Ee=(0,d.useCallback)((()=>{ae.current&&S&&setTimeout((()=>(0,ee.T)(ae.current)))}),[S]);(0,_.r)((()=>{Ee(),"keyboard"===V.current&&(null==b||b(q.current))}),[G,b]);var ke=e=>{var t=ce(e);null!=t&&t!==q.current&&L(t)};Z(se,{onPanSessionStart(e){U&&ke(e)},onPanSessionEnd(){U&&(H||W.current===q.current||(null==R||R(q.current),W.current=q.current))},onPanStart(){U&&(z.on(),null==M||M(q.current))},onPan(e){U&&ke(e)},onPanEnd(){U&&(z.off(),null==R||R(q.current))}});var Te=(0,d.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),re({},e,P,{ref:(0,$.l)(t,se),tabIndex:-1,"aria-disabled":(0,u.Qm)(m),"data-focused":(0,u.PB)(B),style:re({},e.style,be)})}),[P,m,B,be]),_e=(0,d.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),re({},e,{ref:(0,$.l)(t,ie),id:ue,"data-disabled":(0,u.PB)(m),style:re({},e.style,we)})}),[m,ue,we]),Oe=(0,d.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),re({},e,{ref:t,style:re({},e.style,xe)})}),[xe]),Ce=(0,d.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),re({},e,{ref:(0,$.l)(t,ae),role:"slider",tabIndex:U?0:void 0,id:le,"data-active":(0,u.PB)(N),"aria-valuetext":me,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":G,"aria-orientation":l,"aria-disabled":(0,u.Qm)(m),"aria-readonly":(0,u.Qm)(g),"aria-label":O,"aria-labelledby":O?void 0:C,style:re({},e.style,ye),onKeyDown:(0,I.v0)(e.onKeyDown,ve),onFocus:(0,I.v0)(e.onFocus,F.on),onBlur:(0,I.v0)(e.onBlur,F.off)})}),[O,C,m,N,g,U,r,n,ve,l,F.off,F.on,le,ye,G,me]),Ae=(0,d.useCallback)((function(e,t){void 0===e&&(e={}),void 0===t&&(t=null);var i=!(e.valuer),o=G>=e.value,a=Y(e.value,n,r),c=re({position:"absolute",pointerEvents:"none"},function(e){var{orientation:t,vertical:n,horizontal:r}=e;return"vertical"===t?n:r}({orientation:l,vertical:{bottom:s?100-a+"%":a+"%"},horizontal:{left:s?100-a+"%":a+"%"}}));return re({},e,{ref:t,role:"presentation","aria-hidden":!0,"data-disabled":(0,u.PB)(m),"data-invalid":(0,u.PB)(!i),"data-highlighted":(0,u.PB)(o),style:re({},e.style,c)})}),[m,s,r,n,l,G]),Se=(0,d.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),re({},e,{ref:t,type:"hidden",value:G,name:A})}),[A,G]);return{state:{value:G,isFocused:B,isDragging:N},actions:pe,getRootProps:Te,getTrackProps:_e,getInnerTrackProps:Oe,getThumbProps:Ce,getMarkerProps:Ae,getInputProps:Se}}function oe(e,t){return t"}),ue=(0,r.G)(((e,t)=>{var n=(0,i.j)("Slider",e),r=ie((0,o.Lr)(e)),{getInputProps:l,getRootProps:u}=r,c=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(r,["getInputProps","getRootProps"]),f=u(),h=l({},t),p=ae({display:"inline-block",position:"relative",cursor:"pointer"},n.container);return d.createElement(se,{value:c},d.createElement(a.Fo,{value:n},d.createElement(s.m$.div,ae({},f,{className:"chakra-slider",__css:p}),e.children,d.createElement("input",h))))}));ue.defaultProps={orientation:"horizontal"},l.Ts&&(ue.displayName="Slider");var ce=(0,r.G)(((e,t)=>{var{getThumbProps:n}=le(),r=ae({display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0},(0,a.yK)().thumb),i=n(e,t);return d.createElement(s.m$.div,ae({},i,{className:(0,u.cx)("chakra-slider__thumb",e.className),__css:r}))}));l.Ts&&(ce.displayName="SliderThumb");var de=(0,r.G)(((e,t)=>{var{getTrackProps:n}=le(),r=ae({overflow:"hidden"},(0,a.yK)().track),i=n(e,t);return d.createElement(s.m$.div,ae({},i,{className:(0,u.cx)("chakra-slider__track",e.className),__css:r}))}));l.Ts&&(de.displayName="SliderTrack");var fe=(0,r.G)(((e,t)=>{var{getInnerTrackProps:n}=le(),r=ae({width:"inherit",height:"inherit"},(0,a.yK)().filledTrack),i=n(e,t);return d.createElement(s.m$.div,ae({},i,{className:"chakra-slider__filled-track",__css:r}))}));l.Ts&&(fe.displayName="SliderFilledTrack");var he=(0,r.G)(((e,t)=>{var{getMarkerProps:n}=le(),r=n(e,t);return d.createElement(s.m$.div,ae({},r,{className:(0,u.cx)("chakra-slider__marker",e.className)}))}));l.Ts&&(he.displayName="SliderMark")},8134:function(e,t,n){"use strict";n.d(t,{r:function(){return E}});var r=n(762),i=n(639),o=n(1034),a=n(8327),s=n(2947),l=n(658),u=n(4461),c=n(7248),d=n(5415),f=n(7294);function h(){return(h=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,["defaultIsChecked","defaultChecked","isChecked","isFocusable","isDisabled","isReadOnly","isRequired","onChange","isIndeterminate","isInvalid","name","value","id","onBlur","onFocus","aria-label","aria-labelledby","aria-invalid","aria-describedby"]),j=(0,r.W)(w),D=(0,r.W)(O),L=(0,r.W)(C),[N,I]=(0,i.k)(),[z,H]=(0,i.k)(),[B,F]=(0,i.k)(),V=(0,f.useRef)(null),[U,G]=(0,f.useState)(!0),[q,W]=(0,f.useState)(!!n),[K,Z]=(0,o.p)(p,q);(0,l.ZK)({condition:!!t,message:'The "defaultIsChecked" prop has been deprecated and will be removed in a future version. Please use the "defaultChecked" prop instead, which mirrors default React checkbox behavior.'});var $=(0,f.useCallback)((e=>{y||g?e.preventDefault():(K||W(Z?e.target.checked:!!x||e.target.checked),null==j||j(e))}),[y,g,Z,K,x,j]);(0,a.G)((()=>{V.current&&(V.current.indeterminate=Boolean(x))}),[x]);var X=g&&!m,Y=(0,f.useCallback)((e=>{" "===e.key&&F.on()}),[F]),Q=(0,f.useCallback)((e=>{" "===e.key&&F.off()}),[F]);(0,a.G)((()=>{V.current&&(V.current.checked!==Z&&W(V.current.checked))}),[V.current]);var J=(0,f.useCallback)((function(e,t){void 0===e&&(e={}),void 0===t&&(t=null);return h({},e,{ref:t,"data-active":(0,u.PB)(B),"data-hover":(0,u.PB)(z),"data-checked":(0,u.PB)(Z),"data-focus":(0,u.PB)(N),"data-indeterminate":(0,u.PB)(x),"data-disabled":(0,u.PB)(g),"data-invalid":(0,u.PB)(E),"data-readonly":(0,u.PB)(y),"aria-hidden":!0,onMouseDown:(0,l.v0)(e.onMouseDown,(e=>{e.preventDefault(),F.on()})),onMouseUp:(0,l.v0)(e.onMouseUp,F.off),onMouseEnter:(0,l.v0)(e.onMouseEnter,H.on),onMouseLeave:(0,l.v0)(e.onMouseLeave,H.off)})}),[B,Z,g,N,z,x,E,y,F,H.off,H.on]),ee=(0,f.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),h({},R,e,{ref:(0,s.l)(t,(e=>{e&&G("LABEL"===e.tagName)})),onClick:(0,l.v0)(e.onClick,(()=>{var e;U||(null==(e=V.current)||e.click(),(0,c.T)(V.current,{nextTick:!0}))})),"data-disabled":(0,u.PB)(g)})}),[R,g,U]),te=(0,f.useCallback)((function(e,t){void 0===e&&(e={}),void 0===t&&(t=null);return h({},e,{ref:(0,s.l)(V,t),type:"checkbox",name:k,value:T,id:_,onChange:(0,l.v0)(e.onChange,$),onBlur:(0,l.v0)(e.onBlur,D,I.off),onFocus:(0,l.v0)(e.onFocus,L,(()=>{(0,l.A4)(I.on)})),onKeyDown:(0,l.v0)(e.onKeyDown,Y),onKeyUp:(0,l.v0)(e.onKeyUp,Q),required:b,checked:Z,disabled:X,readOnly:y,"aria-label":A,"aria-labelledby":S,"aria-invalid":P?Boolean(P):E,"aria-describedby":M,"aria-disabled":g,style:d.NL})}),[k,T,_,$,I.off,I.on,D,L,Y,Q,b,Z,X,y,A,S,P,E,M,g]),ne=(0,f.useCallback)((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),h({},e,{ref:t,onMouseDown:(0,l.v0)(e.onMouseDown,v),onTouchStart:(0,l.v0)(e.onTouchStart,v),"data-disabled":(0,u.PB)(g),"data-checked":(0,u.PB)(Z),"data-invalid":(0,u.PB)(E)})}),[Z,g,E]);return{state:{isInvalid:E,isFocused:N,isChecked:Z,isActive:B,isHovered:z,isIndeterminate:x,isDisabled:g,isReadOnly:y,isRequired:b},getRootProps:ee,getCheckboxProps:J,getInputProps:te,getLabelProps:ne,htmlProps:R}}function v(e){e.preventDefault(),e.stopPropagation()}var m=n(63),g=n(2326),y=n(5284),b=n(5643),w=n(3808);function x(){return(x=Object.assign||function(e){for(var t=1;t{var n=(0,g.j)("Switch",e),r=(0,y.Lr)(e),{spacing:i="0.5rem",children:o}=r,a=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(r,["spacing","children"]),{state:s,getInputProps:l,getCheckboxProps:c,getRootProps:d,getLabelProps:h}=p(a),v=f.useMemo((()=>x({display:"inline-block",verticalAlign:"middle",lineHeight:"normal"},n.container)),[n.container]),m=f.useMemo((()=>x({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer"},n.track)),[n.track]),w=f.useMemo((()=>x({userSelect:"none",marginStart:i},n.label)),[i,n.label]);return f.createElement(b.m$.label,x({},d(),{className:(0,u.cx)("chakra-switch",e.className),__css:v}),f.createElement("input",x({className:"chakra-switch__input"},l({},t))),f.createElement(b.m$.span,x({},c(),{className:"chakra-switch__track",__css:m}),f.createElement(b.m$.span,{__css:n.thumb,className:"chakra-switch__thumb","data-checked":(0,u.PB)(s.isChecked),"data-hover":(0,u.PB)(s.isHovered)})),o&&f.createElement(b.m$.span,x({className:"chakra-switch__label"},h(),{__css:w}),o))}));w.Ts&&(E.displayName="Switch")},63:function(e,t,n){"use strict";n.d(t,{G:function(){return i}});var r=n(7294);function i(e){return r.forwardRef(e)}},1180:function(e,t,n){"use strict";n.d(t,{useTheme:function(){return o.Fg}});var r=n(9421);n.o(r,"useTheme")&&n.d(t,{useTheme:function(){return r.useTheme}});var i=n(5070);n.o(i,"useTheme")&&n.d(t,{useTheme:function(){return i.useTheme}});var o=n(9676)},5643:function(e,t,n){"use strict";n.d(t,{m$:function(){return _}});var r=n(9421),i=n(5505),o=n(658),a=n(7294);function s(){return(s=Object.assign||function(e){for(var t=1;t96?p:v},g=function(e,t,n){var r;if(t){var i=t.shouldForwardProp;r=e.__emotion_forwardProp&&i?function(t){return e.__emotion_forwardProp(t)&&i(t)}:i}return"function"!==typeof r&&n&&(r=e.__emotion_forwardProp),r},y=function e(t,n){var r,i,o=t.__emotion_real===t,l=o&&t.__emotion_base||t;void 0!==n&&(r=n.label,i=n.target);var u=g(t,n,o),c=u||m(l),p=!c("as");return function(){var v=arguments,y=o&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==r&&y.push("label:"+r+";"),null==v[0]||void 0===v[0].raw)y.push.apply(y,v);else{0,y.push(v[0][0]);for(var b=v.length,w=1;wx.has(e)||!w.has(e),k=n(5284);function T(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}var _=function(e,t){var n=null!=t?t:{},{baseStyle:a}=n,s=T(n,["baseStyle"]);s.shouldForwardProp||(s.shouldForwardProp=E);var l=(e=>{var{baseStyle:t}=e;return e=>{var{css:n,__css:a,sx:s}=e,l=T(e,["theme","css","__css","sx"]),u=(0,i.lw)(l,((e,t)=>(0,r.isStyleProp)(t))),c=(0,o.Pu)(t,e),d=Object.assign({},a,c,(0,i.YU)(u),s),f=(0,r.css)(d)(e.theme);return n?[f,n]:f}})({baseStyle:a});return b(e,s)(l)};k.t6.forEach((e=>{_[e]=_(e)}))},5070:function(){},5284:function(e,t,n){"use strict";n.d(t,{t6:function(){return i},Lr:function(){return o}});var r=n(5505),i=["a","b","article","aside","blockquote","button","caption","cite","circle","code","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","img","input","kbd","label","li","main","mark","nav","ol","p","path","pre","q","rect","s","svg","section","select","strong","small","span","sub","sup","table","tbody","td","textarea","tfoot","th","thead","tr","ul"];function o(e){return(0,r.CE)(e,["styleConfig","size","variant","colorScheme"])}},2326:function(e,t,n){"use strict";n.d(t,{j:function(){return v},m:function(){return p}});var r=n(5505),i=n(8554),o=n.n(i),a=n(658),s=n(7294),l=n(9590),u=n.n(l),c=n(4738),d=n(9676);function f(){return(f=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(t,["styleConfig"]),{theme:f,colorMode:p}=h(),v=(0,r.Wf)(f,"components."+e),m=c||v,g=o()({theme:f,colorMode:p},null!=(i=null==m?void 0:m.defaultProps)?i:{},(0,r.YU)((0,r.CE)(d,["children"]))),y=(0,s.useRef)({});return(0,s.useMemo)((()=>{if(m){var e,t,r,i,s,l,c=(0,a.Pu)(null!=(e=m.baseStyle)?e:{},g),d=(0,a.Pu)(null!=(t=null==(r=m.variants)?void 0:r[g.variant])?t:{},g),f=(0,a.Pu)(null!=(i=null==(s=m.sizes)?void 0:s[g.size])?i:{},g),h=o()({},c,f,d);null!=(l=n)&&l.isMultiPart&&m.parts&&m.parts.forEach((e=>{var t;h[e]=null!=(t=h[e])?t:{}})),u()(y.current,h)||(y.current=h)}return y.current}),[m,g,null==(l=n)?void 0:l.isMultiPart])}function v(e,t){return p(e,t,{isMultiPart:!0})}},5684:function(e,t,n){"use strict";n.d(t,{u:function(){return V}});var r=n(3459),i=n(7294),o=n(7581);function a(){var e=i.useRef(!1),[t,n]=i.useState(0);return(0,o.z)((()=>{e.current=!0})),i.useCallback((()=>{e.current||n(t+1)}),[t])}var s=n(8327),l=n(4461),u=n(3808),c=n(8500),d=n(3935),f=n(4288);function h(){return(h=Object.assign||function(e){for(var t=1;ti.createElement("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0}},e.children),y=e=>{var{appendToParentPortal:t,children:n}=e,r=i.useRef(null),o=i.useRef(null),l=a(),u=v(),c=(0,f.L)();(0,s.G)((()=>{if(r.current){var e=r.current.ownerDocument,n=t&&null!=u?u:e.body;if(n){o.current=e.createElement("div"),o.current.className=m,n.appendChild(o.current),l();var i=o.current;return()=>{n.contains(i)&&n.removeChild(i)}}}}),[]);var h=null!=c&&c.zIndex?i.createElement(g,{zIndex:null==c?void 0:c.zIndex},n):n;return o.current?(0,d.createPortal)(i.createElement(p,{value:o.current},h),o.current):i.createElement("span",{ref:r})},b=e=>{var{children:t,containerRef:n,appendToParentPortal:r}=e,o=n.current,u=null!=o?o:l.jU?document.body:void 0,c=i.useMemo((()=>{var e=null==o?void 0:o.ownerDocument.createElement("div");return e&&(e.className=m),e}),[o]),f=a();return(0,s.G)((()=>{f()}),[]),(0,s.G)((()=>{if(c&&u)return u.appendChild(c),()=>{u.removeChild(c)}}),[c,u]),u&&c?(0,d.createPortal)(i.createElement(p,{value:r?c:null},t),c):null};function w(e){var{containerRef:t}=e,n=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,["containerRef"]);return t?i.createElement(b,h({containerRef:t},n)):i.createElement(y,n)}w.defaultProps={appendToParentPortal:!0},w.className=m,w.selector=".chakra-portal",u.Ts&&(w.displayName="Portal");var x=n(5643),E=n(63),k=n(2326),T=n(5284),_=n(9676),O=n(5505),C=n(5415),A=n(7554),S=n(3869),P={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},M=n(4860),R=n(4577),j=n(4941),D=n(8931),L=n(658),N=n(8456),I=n(2947);function z(){return(z=Object.assign||function(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,["openDelay","closeDelay","closeOnClick","closeOnMouseDown","onOpen","onClose","placement","id","isOpen","defaultIsOpen","arrowSize","arrowShadowColor","arrowPadding","modifiers","isDisabled","gutter","offset"]),{isOpen:x,onOpen:E,onClose:k}=(0,M.q)({isOpen:d,defaultIsOpen:f,onOpen:s,onClose:l}),{referenceRef:T,getPopperProps:_,getArrowInnerProps:O,getArrowProps:C}=(0,D.D)({enabled:x,placement:u,arrowPadding:v,modifiers:m,gutter:y,offset:b}),A=(0,R.Me)(c,"tooltip"),S=i.useRef(null),P=i.useRef(),H=i.useRef(),B=i.useCallback((()=>{g||(P.current=window.setTimeout(E,t))}),[g,E,t]),F=i.useCallback((()=>{P.current&&clearTimeout(P.current),H.current=window.setTimeout(k,n)}),[n,k]),V=i.useCallback((()=>{o&&F()}),[o,F]),U=i.useCallback((()=>{a&&F()}),[a,F]);(0,j.O)("keydown",(e=>{x&&"Escape"===e.key&&F()})),i.useEffect((()=>()=>{clearTimeout(P.current),clearTimeout(H.current)}),[]),(0,j.O)("mouseleave",F,S.current);var G=i.useCallback((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),z({},e,{ref:(0,I.l)(S,t,T),onMouseEnter:(0,L.v0)(e.onMouseEnter,B),onClick:(0,L.v0)(e.onClick,V),onMouseDown:(0,L.v0)(e.onMouseDown,U),onFocus:(0,L.v0)(e.onFocus,B),onBlur:(0,L.v0)(e.onBlur,F),"aria-describedby":x?A:void 0})}),[B,F,U,x,A,V,T]),q=i.useCallback((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),_(z({},e,{style:z({},e.style,{[r.Dq.arrowSize.var]:h?(0,N.px)(h):void 0,[r.Dq.arrowShadowColor.var]:p})}),t)}),[_,h,p]),W=i.useCallback((function(e,t){return void 0===e&&(e={}),void 0===t&&(t=null),z({ref:t},w,e,{id:A,role:"tooltip",style:z({},e.style,{position:"relative",transformOrigin:r.Dq.transformOrigin.varRef})})}),[w,A]);return{isOpen:x,show:B,hide:F,getTriggerProps:G,getTooltipProps:W,getTooltipPositionerProps:q,getArrowProps:C,getArrowInnerProps:O}}function B(){return(B=Object.assign||function(e){for(var t=1;t{var n=(0,k.m)("Tooltip",e),o=(0,T.Lr)(e),a=(0,_.Fg)(),{children:s,label:l,shouldWrapChildren:c,"aria-label":d,hasArrow:f,bg:h,portalProps:p}=o,v=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(o,["children","label","shouldWrapChildren","aria-label","hasArrow","bg","portalProps"]);h&&(n.bg=h,n[r.Dq.arrowBg.var]=(0,O.K1)(a,"colors",h));var m,g=H(v);if((0,u.HD)(s)||c)m=i.createElement(x.m$.span,B({tabIndex:0},g.getTriggerProps()),s);else{var y=i.Children.only(s);m=i.cloneElement(y,g.getTriggerProps(y.props,y.ref))}var b=!!d,E=g.getTooltipProps({},t),A=b?(0,O.CE)(E,["role","id"]):E,M=(0,O.ei)(E,["role","id"]);return l?i.createElement(i.Fragment,null,m,i.createElement(S.M,null,g.isOpen&&i.createElement(w,p,i.createElement(x.m$.div,B({},g.getTooltipPositionerProps(),{__css:{zIndex:n.zIndex,pointerEvents:"none"}}),i.createElement(F,B({variants:P},A,{initial:"exit",animate:"enter",exit:"exit",__css:n}),l,b&&i.createElement(C.TX,M,d),f&&i.createElement(x.m$.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper"},i.createElement(x.m$.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:n.bg}}))))))):i.createElement(i.Fragment,null,s)}));u.Ts&&(V.displayName="Tooltip")},7248:function(e,t,n){"use strict";n.d(t,{T:function(){return a}});var r=n(4461),i=n(658),o=n(7768);function a(e,t){void 0===t&&(t={});var{isActive:n=o.H9,nextTick:a,preventScroll:l=!0,selectTextIfInput:u=!0}=t;if(!e||n(e))return-1;function c(){if(e){if(function(){if(null==s){s=!1;try{document.createElement("div").focus({get preventScroll(){return s=!0,!0}})}catch(e){}}return s}())e.focus({preventScroll:l});else if(e.focus(),l)!function(e){for(var{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(function(e){var t=(0,r.lZ)(e),n=e.parentNode,i=[],o=t.scrollingElement||t.documentElement;for(;n instanceof HTMLElement&&n!==o;)(n.offsetHeighte.hasAttribute("tabindex");function o(e){return s(e)&&"input"===e.tagName.toLowerCase()&&"select"in e}function a(e){return(e instanceof HTMLElement?(0,r.lZ)(e):document).activeElement===e}function s(e){return e instanceof HTMLElement}function l(e){return!(!e.parentElement||!l(e.parentElement))||e.hidden}function u(e){if(!s(e)||l(e)||function(e){return!0===Boolean(e.getAttribute("disabled"))||!0===Boolean(e.getAttribute("aria-disabled"))}(e))return!1;var{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;var n={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in n?n[t]():!!function(e){var t=e.getAttribute("contenteditable");return"false"!==t&&null!=t}(e)||i(e)}function c(e){return!!e&&(s(e)&&u(e)&&!(e=>i(e)&&-1===e.tabIndex)(e))}},5415:function(e,t,n){"use strict";n.d(t,{NL:function(){return o},TX:function(){return a}});var r=n(5643),i=n(3808),o={border:"0px",clip:"rect(0px, 0px, 0px, 0px)",height:"1px",width:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},a=(0,r.m$)("span",{baseStyle:o});i.Ts&&(a.displayName="VisuallyHidden");var s=(0,r.m$)("input",{baseStyle:o});i.Ts&&(s.displayName="VisuallyHiddenInput")},4309:function(e,t,n){"use strict";n.d(t,{iP:function(){return d}});var r=n(7294);var i=e=>{const t=r.useRef(e);return r.useEffect((()=>{t.current=e})),t};const o=(e,t=100,n=!1)=>{const o=i(e),a=r.useRef(),s=[t,n,o];function l(){a.current&&clearTimeout(a.current),a.current=void 0}function u(){a.current=void 0}return r.useEffect((()=>l),s),r.useCallback((function(){const e=arguments,{current:r}=a;if(void 0===r&&n)return a.current=setTimeout(u,t),o.current.apply(null,e);r&&clearTimeout(r),a.current=setTimeout((()=>{a.current=void 0,o.current.apply(null,e)}),t)}),s)};var a=r["undefined"!==typeof document&&void 0!==document.createElement?"useLayoutEffect":"useEffect"];var s=function(e,t,n,i){const o=r.useRef(n),s=r.useRef(i);a((()=>{o.current=n,s.current=i})),a((()=>{const n=e&&"current"in e?e.current:e;if(!n)return;let r=0;function i(...e){r||o.current.apply(this,e)}n.addEventListener(t,i);const a=s.current;return()=>{r=1,n.removeEventListener(t,i),a&&a()}}),[e,t])};const l={},u="undefined"===typeof window?null:window,c=()=>[document.documentElement.clientWidth,document.documentElement.clientHeight],d=(e=l)=>{const{wait:t,leading:n,initialWidth:i=0,initialHeight:a=0}=e,[d,f]=((e,t,n)=>{const i=r.useState(e);return[i[0],o(i[1],t,n)]})("undefined"===typeof document?[i,a]:c,t,n),h=()=>f(c);return s(u,"resize",h),s(u,"orientationchange",h),d}},2539:function(e,t,n){"use strict";n.r(t);t.default=function(e){return e instanceof Function?e:"string"===typeof e?function(t){return t[e]}:function(t){return e}}},3379:function(e){var t={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0};e.exports=function(e,n){return"number"!==typeof n||t[e]?n:n+"px"}},401:function(e,t,n){n(2406),n(9874),n(9236),n(2578),n(6699)},203:function(e){e.exports=THREE.ColladaLoader=function(e){this.manager=void 0!==e?e:THREE.DefaultLoadingManager},THREE.ColladaLoader.prototype={constructor:THREE.ColladaLoader,crossOrigin:"anonymous",load:function(e,t,n,r){var i=this,o=void 0===i.path?THREE.LoaderUtils.extractUrlBase(e):i.path,a=new THREE.FileLoader(i.manager);a.setPath(i.path),a.load(e,(function(e){t(i.parse(e,o))}),n,r)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},options:{set convertUpAxis(e){console.warn("THREE.ColladaLoader: options.convertUpAxis() has been removed. Up axis is converted automatically.")}},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){function n(e,t){for(var n=[],r=e.childNodes,i=0,o=r.length;i0&&t.push(new THREE.VectorKeyframeTrack(r+".position",i,o)),a.length>0&&t.push(new THREE.QuaternionKeyframeTrack(r+".quaternion",i,a)),s.length>0&&t.push(new THREE.VectorKeyframeTrack(r+".scale",i,s)),t}function E(e,t,n){var r,i,o,a=!0;for(i=0,o=e.length;i=0;){var r=e[t];if(null!==r.value[n])return r;t--}return null}function T(e,t,n){for(;t>>0));switch(n=n.toLowerCase()){case"tga":t=Be;break;default:t=Ve}return t}(n);if(void 0!==i){var o=i.load(n),a=e.extra;if(void 0!==a&&void 0!==a.technique&&!1===s(a.technique)){var l=a.technique;o.wrapS=l.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,o.wrapT=l.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,o.offset.set(l.offsetU||0,l.offsetV||0),o.repeat.set(l.repeatU||1,l.repeatV||1)}else o.wrapS=THREE.RepeatWrapping,o.wrapT=THREE.RepeatWrapping;return o}return console.warn("THREE.ColladaLoader: Loader for texture %s not found.",n),null}return console.warn("THREE.ColladaLoader: Couldn't create texture with ID:",e.id),null}n.name=e.name;var l=i.parameters;for(var u in l){var c=l[u];switch(u){case"diffuse":c.color&&n.color.fromArray(c.color),c.texture&&(n.map=a(c.texture));break;case"specular":c.color&&n.specular&&n.specular.fromArray(c.color),c.texture&&(n.specularMap=a(c.texture));break;case"bump":c.texture&&(n.normalMap=a(c.texture));break;case"ambient":c.texture&&(n.lightMap=a(c.texture));break;case"shininess":c.float&&n.shininess&&(n.shininess=c.float);break;case"emission":c.color&&n.emissive&&n.emissive.fromArray(c.color),c.texture&&(n.emissiveMap=a(c.texture))}}var d=l.transparent,h=l.transparency;if(void 0===h&&d&&(h={float:1}),void 0===d&&h&&(d={opaque:"A_ONE",data:{color:[1,1,1,1]}}),d&&h)if(d.data.texture)n.transparent=!0;else{var p=d.data.color;switch(d.opaque){case"A_ONE":n.opacity=p[3]*h.float;break;case"RGB_ZERO":n.opacity=1-p[0]*h.float;break;case"A_ZERO":n.opacity=1-p[3]*h.float;break;case"RGB_ONE":n.opacity=p[0]*h.float;break;default:console.warn('THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.',d.opaque)}n.opacity<1&&(n.transparent=!0)}return void 0!==o&&void 0!==o.technique&&1===o.technique.double_sided&&(n.side=THREE.DoubleSide),n}function Z(e){return f(We.materials[e],K)}function $(e){for(var t=0;t0?l+c:l;t.inputs[d]={id:s,offset:u},t.stride=Math.max(t.stride,u+1),"TEXCOORD"===l&&(t.hasUV=!0);break;case"vcount":t.vcount=o(i.textContent);break;case"p":t.p=o(i.textContent)}}return t}function se(e){for(var t=0,n=0,r=e.length;n0&&t0&&h.addAttribute("position",new THREE.Float32BufferAttribute(i.array,i.stride)),o.array.length>0&&h.addAttribute("normal",new THREE.Float32BufferAttribute(o.array,o.stride)),l.array.length>0&&h.addAttribute("color",new THREE.Float32BufferAttribute(l.array,l.stride)),a.array.length>0&&h.addAttribute("uv",new THREE.Float32BufferAttribute(a.array,a.stride)),s.array.length>0&&h.addAttribute("uv2",new THREE.Float32BufferAttribute(s.array,s.stride)),u.length>0&&h.addAttribute("skinIndex",new THREE.Float32BufferAttribute(u,c)),d.length>0&&h.addAttribute("skinWeight",new THREE.Float32BufferAttribute(d,f)),r.data=h,r.type=e[0].type,r.materialKeys=p,r}function ce(e,t,n,r){var i=e.p,o=e.stride,a=e.vcount;function s(e){for(var t=i[e+n]*u,o=t+u;t4)for(var g=1,y=h-2;g<=y;g++){p=c+o*g,v=c+o*(g+1);s(c+0*o),s(p),s(v)}c+=o*h}else for(d=0,f=i.length;d=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function me(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},n=0;nr.limits.max||t=t.length&&t===k(e,0,t.length)}(t))e=(new l).parse(t);else{var r=k(t);if(!function(e){var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0;function r(t){var r=e[t-1];return e=e.slice(n+t),n++,r}for(var i=0;i0,s="string"===typeof o.Content&&""!==o.Content;if(a||s){var l=this.parseImage(r[i]);n[o.RelativeFilename||o.Filename]=l}}}}for(var u in t){var c=t[u];void 0!==n[c]?t[u]=n[c]:t[u]=t[u].split("\\").pop()}return t},parseImage:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":if("function"!==typeof THREE.TGALoader)return void console.warn("FBXLoader: THREE.TGALoader is required to load TGA textures");null===THREE.Loader.Handlers.get(".tga")&&THREE.Loader.Handlers.add(/\.tga$/i,new THREE.TGALoader),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}if("string"===typeof n)return"data:"+t+";base64,"+n;var o=new Uint8Array(n);return window.URL.createObjectURL(new Blob([o],{type:t}))},parseTextures:function(t){var n=new Map;if("Texture"in e.Objects){var r=e.Objects.Texture;for(var i in r){var o=this.parseTexture(r[i],t);n.set(parseInt(i),o)}}return n},parseTexture:function(e,t){var n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;var r=e.WrapModeU,i=e.WrapModeV,o=void 0!==r?r.value:0,a=void 0!==i?i.value:0;if(n.wrapS=0===o?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,n.wrapT=0===a?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,"Scaling"in e){var s=e.Scaling.value;n.repeat.x=s[0],n.repeat.y=s[1]}return n},loadTexture:function(e,n){var r,i,o=this.textureLoader.path,a=t.get(e.id).children;void 0!==a&&a.length>0&&void 0!==n[a[0].ID]&&(0!==(r=n[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0));var s=e.FileName.slice(-3).toLowerCase();if("tga"===s){var l=THREE.Loader.Handlers.get(".tga");null===l?(console.warn("FBXLoader: TGALoader not found, creating empty placeholder texture for",r),i=new THREE.Texture):i=l.load(r)}else"psd"===s?(console.warn("FBXLoader: PSD textures are not supported, creating empty placeholder texture for",r),i=new THREE.Texture):i=this.textureLoader.load(r);return this.textureLoader.setPath(o),i},parseMaterials:function(t){var n=new Map;if("Material"in e.Objects){var r=e.Objects.Material;for(var i in r){var o=this.parseMaterial(r[i],t);null!==o&&n.set(parseInt(i),o)}}return n},parseMaterial:function(e,n){var r=e.id,i=e.attrName,o=e.ShadingModel;if("object"===typeof o&&(o=o.value),!t.has(r))return null;var a,s=this.parseParameters(e,n,r);switch(o.toLowerCase()){case"phong":a=new THREE.MeshPhongMaterial;break;case"lambert":a=new THREE.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),a=new THREE.MeshPhongMaterial({color:3342591})}return a.setValues(s),a.name=i,a},parseParameters:function(e,n,r){var i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new THREE.Color).fromArray(e.Diffuse.value):e.DiffuseColor&&"Color"===e.DiffuseColor.type&&(i.color=(new THREE.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new THREE.Color).fromArray(e.Emissive.value):e.EmissiveColor&&"Color"===e.EmissiveColor.type&&(i.emissive=(new THREE.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new THREE.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new THREE.Color).fromArray(e.SpecularColor.value));var o=this;return t.get(r).children.forEach((function(e){var t=e.relationship;switch(t){case"Bump":i.bumpMap=o.getTexture(n,e.ID);break;case"DiffuseColor":i.map=o.getTexture(n,e.ID);break;case"DisplacementColor":i.displacementMap=o.getTexture(n,e.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(n,e.ID);break;case"NormalMap":i.normalMap=o.getTexture(n,e.ID);break;case"ReflectionColor":i.envMap=o.getTexture(n,e.ID),i.envMap.mapping=THREE.EquirectangularReflectionMapping;break;case"SpecularColor":i.specularMap=o.getTexture(n,e.ID);break;case"TransparentColor":i.alphaMap=o.getTexture(n,e.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",t)}})),i},getTexture:function(n,r){return"LayeredTexture"in e.Objects&&r in e.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),r=t.get(r).children[0].ID),n.get(r)},parseDeformers:function(){var n={},r={};if("Deformer"in e.Objects){var i=e.Objects.Deformer;for(var o in i){var a=i[o],s=t.get(parseInt(o));if("Skin"===a.attrType){var l=this.parseSkeleton(s,i);l.ID=o,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),l.geometryID=s.parents[0].ID,n[o]=l}else if("BlendShape"===a.attrType){var u={id:o};u.rawTargets=this.parseMorphTargets(s,i),u.id=o,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),r[o]=u}}}return{skeletons:n,morphTargets:r}},parseSkeleton:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];if("Cluster"===r.attrType){var i={ID:e.ID,indices:[],weights:[],transform:(new THREE.Matrix4).fromArray(r.Transform.a),transformLink:(new THREE.Matrix4).fromArray(r.TransformLink.a),linkMode:r.Mode};"Indexes"in r&&(i.indices=r.Indexes.a,i.weights=r.Weights.a),n.push(i)}})),{rawBones:n,bones:[]}},parseMorphTargets:function(e,n){for(var r=[],i=0;i1?o=a:a.length>0?o=a[0]:(o=new THREE.MeshPhongMaterial({color:13421772}),a.push(o)),"color"in i.attributes&&a.forEach((function(e){e.vertexColors=THREE.VertexColors})),i.FBX_Deformer?(a.forEach((function(e){e.skinning=!0})),r=new THREE.SkinnedMesh(i,o)):r=new THREE.Mesh(i,o),r},createCurve:function(e,t){var n=e.children.reduce((function(e,n){return t.has(n.ID)&&(e=t.get(n.ID)),e}),null),r=new THREE.LineBasicMaterial({color:3342591,linewidth:1});return new THREE.Line(n,r)},setModelTransforms:function(e,t){var n={};"RotationOrder"in t&&(n.eulerOrder=parseInt(t.RotationOrder.value)),"Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value);var r=w(n);e.applyMatrix(r)},setLookAtProperties:function(r,i){"LookAtProperty"in i&&t.get(r.ID).children.forEach((function(t){if("LookAtProperty"===t.relationship){var i=e.Objects.Model[t.ID];if("Lcl_Translation"in i){var o=i.Lcl_Translation.value;void 0!==r.target?(r.target.position.fromArray(o),n.add(r.target)):r.lookAt((new THREE.Vector3).fromArray(o))}}}))},bindSkeleton:function(e,n,r){var i=this.parsePoseNodes();for(var o in e){var a=e[o];t.get(parseInt(a.ID)).parents.forEach((function(e){if(n.has(e.ID)){var o=e.ID;t.get(o).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new THREE.Skeleton(a.bones),i[e.ID])}))}}))}},parsePoseNodes:function(){var t={};if("Pose"in e.Objects){var n=e.Objects.Pose;for(var r in n)if("BindPose"===n[r].attrType){var i=n[r].PoseNode;Array.isArray(i)?i.forEach((function(e){t[e.Node]=(new THREE.Matrix4).fromArray(e.Matrix.a)})):t[i.Node]=(new THREE.Matrix4).fromArray(i.Matrix.a)}}return t},createAmbientLight:function(){if("GlobalSettings"in e&&"AmbientColor"in e.GlobalSettings){var t=e.GlobalSettings.AmbientColor.value,r=t[0],i=t[1],o=t[2];if(0!==r||0!==i||0!==o){var a=new THREE.Color(r,i,o);n.add(new THREE.AmbientLight(a,1))}}},setupMorphMaterials:function(){n.traverse((function(e){if(e.isMesh&&(e.geometry.morphAttributes.position||e.geometry.morphAttributes.normal)){var t=e.uuid,r=e.material.uuid,i=!1;n.traverse((function(e){e.isMesh&&e.material.uuid===r&&e.uuid!==t&&(i=!0)})),!0===i&&(e.material=e.material.clone()),e.material.morphTargets=!0}}))}},o.prototype={constructor:o,parse:function(n){var r=new Map;if("Geometry"in e.Objects){var i=e.Objects.Geometry;for(var o in i){var a=t.get(parseInt(o)),s=this.parseGeometry(a,i[o],n);r.set(parseInt(o),s)}}return r},parseGeometry:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}},parseMeshGeometry:function(t,n,r){var i=r.skeletons,o=r.morphTargets,a=t.parents.map((function(t){return e.Objects.Model[t.ID]}));if(0!==a.length){var s=t.children.reduce((function(e,t){return void 0!==i[t.ID]&&(e=i[t.ID]),e}),null),l=t.children.reduce((function(e,t){return void 0!==o[t.ID]&&(e=o[t.ID]),e}),null),u=a[0],c={};"RotationOrder"in u&&(c.eulerOrder=u.RotationOrder.value),"GeometricTranslation"in u&&(c.translation=u.GeometricTranslation.value),"GeometricRotation"in u&&(c.rotation=u.GeometricRotation.value),"GeometricScaling"in u&&(c.scale=u.GeometricScaling.value);var d=w(c);return this.genGeometry(n,s,l,d)}},genGeometry:function(e,t,n,r){var i=new THREE.BufferGeometry;e.attrName&&(i.name=e.attrName);var o=this.parseGeoNode(e,t),a=this.genBuffers(o),s=new THREE.Float32BufferAttribute(a.vertex,3);if(r.applyToBufferAttribute(s),i.addAttribute("position",s),a.colors.length>0&&i.addAttribute("color",new THREE.Float32BufferAttribute(a.colors,3)),t&&(i.addAttribute("skinIndex",new THREE.Uint16BufferAttribute(a.weightsIndices,4)),i.addAttribute("skinWeight",new THREE.Float32BufferAttribute(a.vertexWeights,4)),i.FBX_Deformer=t),a.normal.length>0){var l=new THREE.Float32BufferAttribute(a.normal,3);(new THREE.Matrix3).getNormalMatrix(r).applyToBufferAttribute(l),i.addAttribute("normal",l)}if(a.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();0===t&&(n="uv"),i.addAttribute(n,new THREE.Float32BufferAttribute(a.uvs[t],2))})),o.material&&"AllSame"!==o.material.mappingType){var u=a.materialIndex[0],c=0;if(a.materialIndex.forEach((function(e,t){e!==u&&(i.addGroup(c,t-c,u),u=e,c=t)})),i.groups.length>0){var d=i.groups[i.groups.length-1],f=d.start+d.count;f!==a.materialIndex.length&&i.addGroup(f,a.materialIndex.length-f,u)}0===i.groups.length&&i.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(i,e,n,r),i},parseGeoNode:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t,t.rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))}))),n},genBuffers:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,o=[],a=[],s=[],l=[],u=[],c=[],d=this;return e.vertexIndices.forEach((function(f,h){var v=!1;f<0&&(f^=-1,v=!0);var m=[],g=[];if(o.push(3*f,3*f+1,3*f+2),e.color){var y=p(h,n,f,e.color);s.push(y[0],y[1],y[2])}if(e.skeleton){if(void 0!==e.weightTable[f]&&e.weightTable[f].forEach((function(e){g.push(e.weight),m.push(e.id)})),g.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);var b=[0,0,0,0],w=[0,0,0,0];g.forEach((function(e,t){var n=e,r=m[t];w.forEach((function(e,t,i){if(n>e){i[t]=n,n=e;var o=b[t];b[t]=r,r=o}}))})),m=b,g=w}for(;g.length<4;)g.push(0),m.push(0);for(var x=0;x<4;++x)u.push(g[x]),c.push(m[x])}if(e.normal){y=p(h,n,f,e.normal);a.push(y[0],y[1],y[2])}if(e.material&&"AllSame"!==e.material.mappingType)var E=p(h,n,f,e.material)[0];e.uv&&e.uv.forEach((function(e,t){var r=p(h,n,f,e);void 0===l[t]&&(l[t]=[]),l[t].push(r[0]),l[t].push(r[1])})),r++,v&&(d.genFace(t,e,o,E,a,s,l,u,c,r),n++,r=0,o=[],a=[],s=[],l=[],u=[],c=[])})),t},genFace:function(e,t,n,r,i,o,a,s,l,u){for(var c=2;c1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");var s=n.get(a[0].ID);i[o]={name:r[o].attrName,layer:s}}return i},addClip:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new THREE.AnimationClip(e.name,-1,t)},generateTracks:function(e){var t=[],n=new THREE.Vector3,r=new THREE.Quaternion,i=new THREE.Vector3;if(e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new THREE.Euler).setFromQuaternion(r).toArray(),i=i.toArray(),void 0!==e.T&&Object.keys(e.T.curves).length>0){var o=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");void 0!==o&&t.push(o)}if(void 0!==e.R&&Object.keys(e.R.curves).length>0){var a=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotations,e.postRotations);void 0!==a&&t.push(a)}if(void 0!==e.S&&Object.keys(e.S.curves).length>0){var s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");void 0!==s&&t.push(s)}if(void 0!==e.DeformPercent){var l=this.generateMorphTrack(e);void 0!==l&&t.push(l)}return t},generateVectorTrack:function(e,t,n,r){var i=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(i,t,n);return new THREE.VectorKeyframeTrack(e+"."+r,i,o)},generateRotationTrack:function(e,t,n,r,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(THREE.Math.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(THREE.Math.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(THREE.Math.degToRad));var o=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(o,t,n);void 0!==r&&((r=r.map(THREE.Math.degToRad)).push("ZYX"),r=(new THREE.Euler).fromArray(r),r=(new THREE.Quaternion).setFromEuler(r)),void 0!==i&&((i=i.map(THREE.Math.degToRad)).push("ZYX"),i=(new THREE.Euler).fromArray(i),i=(new THREE.Quaternion).setFromEuler(i).inverse());for(var s=new THREE.Quaternion,l=new THREE.Euler,u=[],c=0;c=180){for(var o=i/180,a=r/o,s=n+a,l=e.times[t-1],u=(e.times[t]-l)/o,c=l+u,d=[],f=[];c1&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}},parseNodeProperty:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();"Content"===r&&","===i&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());var o=this.getCurrentNode();if("Properties70"!==o.name){if("C"===r){var a=i.split(",").slice(1),s=parseInt(a[0]),l=parseInt(a[1]),u=i.split(",").slice(3);r="connections",function(e,t){for(var n=0,r=e.length,i=t.length;n=e.size():e.getOffset()+160+16>=e.size()},parseNode:function(e,t){var n={},r=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32(),o=(t>=7500?e.getUint64():e.getUint32(),e.getUint8()),a=e.getString(o);if(0===r)return null;for(var s=[],l=0;l0?s[0]:"",c=s.length>1?s[1]:"",d=s.length>2?s[2]:"";for(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var f=this.parseNode(e,t);null!==f&&this.parseSubNode(a,n,f)}return n.propertyList=s,"number"===typeof u&&(n.id=u),""!==c&&(n.attrName=c),""!==d&&(n.attrType=d),""!==a&&(n.name=a),n},parseSubNode:function(e,t,n){if(!0===n.singleProperty){var r=n.propertyList[0];Array.isArray(r)?(t[n.name]=n,n.a=r):t[n.name]=r}else if("Connections"===e&&"C"===n.name){var i=[];n.propertyList.forEach((function(e,t){0!==t&&i.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(i)}else if("Properties70"===n.name){Object.keys(n).forEach((function(e){t[e]=n[e]}))}else if("Properties70"===e&&"P"===n.name){var o,a=n.propertyList[0],s=n.propertyList[1],l=n.propertyList[2],u=n.propertyList[3];0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),0===s.indexOf("Lcl ")&&(s=s.replace("Lcl ","Lcl_")),o="Color"===s||"ColorRGB"===s||"Vector"===s||"Vector3D"===s||0===s.indexOf("Lcl_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[a]={type:s,type2:l,flag:u,value:o}}else void 0===t[n.name]?"number"===typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)},parseProperty:function(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":var n=e.getUint32();return e.getArrayBuffer(n);case"S":n=e.getUint32();return e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}"undefined"===typeof Zlib&&console.error("THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var a=new u(new Zlib.Inflate(new Uint8Array(e.getArrayBuffer(o))).decompress().buffer);switch(t){case"b":case"c":return a.getBooleanArray(r);case"d":return a.getFloat64Array(r);case"f":return a.getFloat32Array(r);case"i":return a.getInt32Array(r);case"l":return a.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}},u.prototype={constructor:u,getOffset:function(){return this.offset},size:function(){return this.dv.buffer.byteLength},skip:function(e){this.offset+=e},getBoolean:function(){return 1===(1&this.getUint8())},getBooleanArray:function(e){for(var t=[],n=0;n=0&&(t=t.slice(0,r)),THREE.LoaderUtils.decodeText(new Uint8Array(t))}},c.prototype={constructor:c,add:function(e,t){this[e]=t}};var h=[];function p(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}"IndexToDirect"===r.referenceType&&(i=r.indices[i]);var o=i*r.dataSize,a=o+r.dataSize;return function(e,t,n,r){for(var i=n,o=0;it;t++)r.push(this._createVertex(t));for(this.cellShape=new THREE.Shape,this.cellShape.moveTo(r[0].x,r[0].y),t=1;6>t;t++)this.cellShape.lineTo(r[t].x,r[t].y);this.cellShape.lineTo(r[0].x,r[0].y),this.cellShape.autoClose=!0,this.cellGeo=new THREE.Geometry,this.cellGeo.vertices=r,this.cellGeo.verticesNeedUpdate=!0,this.cellShapeGeo=new THREE.ShapeGeometry(this.cellShape),this._cellWidth=2*this.cellSize,this._cellLength=.5*n.SQRT3*this._cellWidth,this._hashDelimeter=".",this._directions=[new n.Cell(1,-1,0),new n.Cell(1,0,-1),new n.Cell(0,1,-1),new n.Cell(-1,1,0),new n.Cell(-1,0,1),new n.Cell(0,-1,1)],this._diagonals=[new n.Cell(2,-1,-1),new n.Cell(1,1,-2),new n.Cell(-1,2,-1),new n.Cell(-2,1,1),new n.Cell(-1,-1,2),new n.Cell(1,-2,1)],this._list=[],this._vec3=new THREE.Vector3,this._cel=new n.Cell,this._conversionVec=new THREE.Vector3,this._geoCache=[],this._matCache=[]},n.HexGrid.TWO_THIRDS=2/3,n.HexGrid.prototype={cellToPixel:function(e){return this._vec3.x=e.q*this._cellWidth*.75,this._vec3.y=e.h,this._vec3.z=-(e.s-e.r)*this._cellLength*.5,this._vec3},pixelToCell:function(e){var t=e.x*(n.HexGrid.TWO_THIRDS/this.cellSize),r=(-e.x/3+n.SQRT3/3*e.z)/this.cellSize;return this._cel.set(t,r,-t-r),this._cubeRound(this._cel)},getCellAt:function(e){var t=e.x*(n.HexGrid.TWO_THIRDS/this.cellSize),r=(-e.x/3+n.SQRT3/3*e.z)/this.cellSize;return this._cel.set(t,r,-t-r),this._cubeRound(this._cel),this.cells[this.cellToHash(this._cel)]},getNeighbors:function(e,t,n){var r,i,o=this._directions.length;for(this._list.length=0,r=0;o>r;r++)this._cel.copy(e),this._cel.add(this._directions[r]),!(i=this.cells[this.cellToHash(this._cel)])||n&&!n(e,i)||this._list.push(i);if(t)for(r=0;o>r;r++)this._cel.copy(e),this._cel.add(this._diagonals[r]),!(i=this.cells[this.cellToHash(this._cel)])||n&&!n(e,i)||this._list.push(i);return this._list},getRandomCell:function(){var e,t=0,r=n.Tools.randomInt(0,this.numCells);for(e in this.cells){if(t===r)return this.cells[e];t++}return this.cells[e]},cellToHash:function(e){return e.q+this._hashDelimeter+e.r+this._hashDelimeter+e.s},distance:function(e,t){return Math.max(Math.abs(e.q-t.q),Math.abs(e.r-t.r),Math.abs(e.s-t.s))+(t.h-e.h)},clearPath:function(){var e,t;for(e in this.cells)(t=this.cells[e])._calcCost=0,t._priority=0,t._parent=null,t._visited=!1},traverse:function(e){var t;for(t in this.cells)e(this.cells[t])},generateTile:function(e,t,r){var i=Math.abs(e.h);1>i&&(i=1);var o=this._geoCache[i];o||(this.extrudeSettings.amount=i,o=new THREE.ExtrudeGeometry(this.cellShape,this.extrudeSettings),this._geoCache[i]=o);var a=new n.Tile({size:this.cellSize,scale:t,cell:e,geometry:o,material:r});return e.tile=a,a},generateTiles:function(e){e=e||{};var t,r,i,o=[],a={tileScale:.95,cellSize:this.cellSize,material:null,extrudeSettings:{amount:1,bevelEnabled:!0,bevelSegments:1,steps:1,bevelSize:.5,bevelThickness:.5}};for(t in a=n.Tools.merge(a,e),this.cellSize=a.cellSize,this._cellWidth=2*this.cellSize,this._cellLength=.5*n.SQRT3*this._cellWidth,this.autogenerated=!0,this.extrudeSettings=a.extrudeSettings,this.cells)i=this.cells[t],(r=this.generateTile(i,a.tileScale,a.material)).position.copy(this.cellToPixel(i)),r.position.y=0,o.push(r);return o},generateTilePoly:function(e){e||(e=new THREE.MeshBasicMaterial({color:2405631}));var t=new THREE.Mesh(this.cellShapeGeo,e);return this._vec3.set(1,0,0),t.rotateOnAxis(this._vec3,n.PI/2),t},generate:function(e){var t,r,i,o;for(e=e||{},this.size="undefined"==typeof e.size?this.size:e.size,t=-this.size;ti;i++)for(o=-e;e+1>o;o++)if(a=-i-o,Math.abs(i)<=e&&Math.abs(o)<=e&&Math.abs(a)<=e){this._cel.set(i,o,a);var l=new THREE.Line(s,r);l.position.copy(this.cellToPixel(this._cel)),l.rotation.x=90*n.DEG_TO_RAD,t.add(l)}},add:function(e){var t=this.cellToHash(e);if(!this.cells[t])return this.cells[t]=e,this.numCells++,e},remove:function(e){var t=this.cellToHash(e);this.cells[t]&&(delete this.cells[t],this.numCells--)},dispose:function(){this.cells=null,this.numCells=0,this.cellShape=null,this.cellGeo.dispose(),this.cellGeo=null,this.cellShapeGeo.dispose(),this.cellShapeGeo=null,this._list=null,this._vec3=null,this._conversionVec=null,this._geoCache=null,this._matCache=null},load:function(e,t,r){var i=this;n.Tools.getJSON({url:e,callback:function(e){i.fromJSON(e),t.call(r||null,e)},cache:!1,scope:i})},fromJSON:function(e){var t,r,i=e.cells;for(this.cells={},this.numCells=0,this.size=e.size,this.cellSize=e.cellSize,this._cellWidth=2*this.cellSize,this._cellLength=.5*n.SQRT3*this._cellWidth,this.extrudeSettings=e.extrudeSettings,this.autogenerated=e.autogenerated,t=0;to&&i>a?t=-n-r:o>a?n=-t-r:r=-t-n,this._cel.set(t,n,r)}},n.HexGrid.prototype.constructor=n.HexGrid,n.SqrGrid=function(e){e=e||{},this.type=n.SQR,this.size=5,this.cellSize="undefined"==typeof e.cellSize?10:e.cellSize,this.cells={},this.numCells=0,this.extrudeSettings=null,this.autogenerated=!1;var t=[];t.push(new THREE.Vector3),t.push(new THREE.Vector3(-this.cellSize,this.cellSize)),t.push(new THREE.Vector3(this.cellSize,this.cellSize)),t.push(new THREE.Vector3(this.cellSize,-this.cellSize)),this.cellShape=new THREE.Shape,this.cellShape.moveTo(-this.cellSize,-this.cellSize),this.cellShape.lineTo(-this.cellSize,this.cellSize),this.cellShape.lineTo(this.cellSize,this.cellSize),this.cellShape.lineTo(this.cellSize,-this.cellSize),this.cellShape.lineTo(-this.cellSize,-this.cellSize),this.cellGeo=new THREE.Geometry,this.cellGeo.vertices=t,this.cellGeo.verticesNeedUpdate=!0,this.cellShapeGeo=new THREE.ShapeGeometry(this.cellShape),this._fullCellSize=2*this.cellSize,this._hashDelimeter=".",this._directions=[new n.Cell(1,0,0),new n.Cell(0,-1,0),new n.Cell(-1,0,0),new n.Cell(0,1,0)],this._diagonals=[new n.Cell(-1,-1,0),new n.Cell(-1,1,0),new n.Cell(1,1,0),new n.Cell(1,-1,0)],this._list=[],this._vec3=new THREE.Vector3,this._cel=new n.Cell,this._conversionVec=new THREE.Vector3,this._geoCache=[],this._matCache=[]},n.SqrGrid.prototype={cellToPixel:function(e){return this._vec3.x=e.q*this._fullCellSize,this._vec3.y=e.h,this._vec3.z=e.r*this._fullCellSize,this._vec3},pixelToCell:function(e){var t=Math.round(e.x/this._fullCellSize),n=Math.round(e.z/this._fullCellSize);return this._cel.set(t,n,0)},getCellAt:function(e){var t=Math.round(e.x/this._fullCellSize),n=Math.round(e.z/this._fullCellSize);return this._cel.set(t,n),this.cells[this.cellToHash(this._cel)]},getNeighbors:function(e,t,n){var r,i,o=this._directions.length;for(this._list.length=0,r=0;o>r;r++)this._cel.copy(e),this._cel.add(this._directions[r]),!(i=this.cells[this.cellToHash(this._cel)])||n&&!n(e,i)||this._list.push(i);if(t)for(r=0;o>r;r++)this._cel.copy(e),this._cel.add(this._diagonals[r]),!(i=this.cells[this.cellToHash(this._cel)])||n&&!n(e,i)||this._list.push(i);return this._list},getRandomCell:function(){var e,t=0,r=n.Tools.randomInt(0,this.numCells);for(e in this.cells){if(t===r)return this.cells[e];t++}return this.cells[e]},cellToHash:function(e){return e.q+this._hashDelimeter+e.r},distance:function(e,t){return Math.max(Math.abs(e.q-t.q),Math.abs(e.r-t.r))+(t.h-e.h)},clearPath:function(){var e,t;for(e in this.cells)(t=this.cells[e])._calcCost=0,t._priority=0,t._parent=null,t._visited=!1},traverse:function(e){var t;for(t in this.cells)e(this.cells[t])},generateTile:function(e,t,r){var i=Math.abs(e.h);1>i&&(i=1);var o=this._geoCache[i];o||(this.extrudeSettings.amount=i,o=new THREE.ExtrudeGeometry(this.cellShape,this.extrudeSettings),this._geoCache[i]=o);var a=new n.Tile({size:this.cellSize,scale:t,cell:e,geometry:o,material:r});return e.tile=a,a},generateTiles:function(e){e=e||{};var t,r,i,o=[],a={tileScale:.95,cellSize:this.cellSize,material:null,extrudeSettings:{amount:1,bevelEnabled:!0,bevelSegments:1,steps:1,bevelSize:.5,bevelThickness:.5}};for(t in a=n.Tools.merge(a,e),this.cellSize=a.cellSize,this._fullCellSize=2*this.cellSize,this.autogenerated=!0,this.extrudeSettings=a.extrudeSettings,this.cells)i=this.cells[t],(r=this.generateTile(i,a.tileScale,a.material)).position.copy(this.cellToPixel(i)),r.position.y=0,o.push(r);return o},generateTilePoly:function(e){e||(e=new THREE.MeshBasicMaterial({color:2405631}));var t=new THREE.Mesh(this.cellShapeGeo,e);return this._vec3.set(1,0,0),t.rotateOnAxis(this._vec3,n.PI/2),t},generate:function(e){e=e||{},this.size="undefined"==typeof e.size?this.size:e.size;var t,r,i,o=Math.ceil(this.size/2);for(t=-o;o>t;t++)for(r=-o;o>r;r++)i=new n.Cell(t,r+1),this.add(i)},generateOverlay:function(e,t,r){var i,o,a=Math.ceil(e/2);for(i=-a;a>i;i++)for(o=-a;a>o;o++){this._cel.set(i,o);var s=new THREE.Line(this.cellGeo,r);s.position.copy(this.cellToPixel(this._cel)),s.rotation.x=90*n.DEG_TO_RAD,t.add(s)}},add:function(e){var t=this.cellToHash(e);if(!this.cells[t])return this.cells[t]=e,this.numCells++,e},remove:function(e){var t=this.cellToHash(e);this.cells[t]&&(delete this.cells[t],this.numCells--)},dispose:function(){this.cells=null,this.numCells=0,this.cellShape=null,this.cellGeo.dispose(),this.cellGeo=null,this.cellShapeGeo.dispose(),this.cellShapeGeo=null,this._list=null,this._vec3=null,this._conversionVec=null,this._geoCache=null,this._matCache=null},load:function(e,t,r){n.Tools.getJSON({url:e,callback:function(e){this.fromJSON(e),t.call(r||null,e)},cache:!1,scope:this})},fromJSON:function(e){var t,r,i=e.cells;for(this.cells={},this.numCells=0,this.size=e.size,this.cellSize=e.cellSize,this._fullCellSize=2*this.cellSize,this.extrudeSettings=e.extrudeSettings,this.autogenerated=e.autogenerated,t=0;tt;t++)this.add(r[t])},remove:function(e){var t=this.getNode(e);return!(!t||t.free)&&(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.prev||(this.first=t.next),t.next||(this.last=t.prev),t.free=!0,t.prev=null,t.next=null,this.length--,!0)},shift:function(){var e=this.first;return 0===this.length?null:(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),this.first=e.next,e.next||(this.last=null),e.free=!0,e.prev=null,e.next=null,this.length--,e.obj)},pop:function(){var e=this.last;return 0===this.length?null:(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),this.last=e.prev,e.prev||(this.first=null),e.free=!0,e.prev=null,e.next=null,this.length--,e.obj)},concat:function(e){for(var t=e.first;t;)this.add(t.obj),t=t.next},clear:function(){for(var e=this.first;e;)e.free=!0,e=e.next;this.first=null,this.length=0},dispose:function(){for(var e=this.first;e;)e.obj=null,e=e.next;this.first=null,this.objToNodeMap=null},dump:function(e){console.log("===================="+e+"=====================");for(var t=this.first;t;)console.log("{"+t.obj.toString()+"} previous="+(t.prev?t.prev.obj:"NULL")),t=t.next();console.log("==================================="),console.log("Last: {"+(this.last?this.last.obj:"NULL")+"} First: {"+(this.first?this.first.obj:"NULL")+"}")}}).constructor=t,n.LinkedList=t}(),function(){var e=function(e,t,n,r,i){this._listener=t,this.isOnce=n,this.context=r,this.signal=e,this._priority=i||0};(e.prototype={active:!0,params:null,execute:function(e){var t,n;return this.active&&this._listener&&(n=this.params?this.params.concat(e):e,t=this._listener.apply(this.context,n),this.isOnce&&this.detach()),t},detach:function(){return this.isBound()?this.signal.remove(this._listener,this.context):null},isBound:function(){return!!this.signal&&!!this._listener},_destroy:function(){delete this.signal,delete this._listener,delete this.context},toString:function(){return"[SignalBinding isOnce:"+this.isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}}).constructor=e;var t=function(){this._bindings=[],this._prevParams=null;var e=this;this.dispatch=function(){t.prototype.dispatch.apply(e,arguments)}};t.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(e,t){if("function"!=typeof e)throw new Error("Signal: listener is a required param of {fn}() and should be a Function.".replace("{fn}",t))},_registerListener:function(t,n,r,i){var o,a=this._indexOfListener(t,r);if(-1!==a){if((o=this._bindings[a]).isOnce!==n)throw new Error("You cannot add"+(n?"":"Once")+"() then add"+(n?"Once":"")+"() the same listener without removing the relationship first.")}else o=new e(this,t,n,r,i),this._addBinding(o);return this.memorize&&this._prevParams&&o.execute(this._prevParams),o},_addBinding:function(e){var t=this._bindings.length;do{t--}while(this._bindings[t]&&e._priority<=this._bindings[t]._priority);this._bindings.splice(t+1,0,e)},_indexOfListener:function(e,t){for(var n,r=this._bindings.length;r--;)if((n=this._bindings[r])._listener===e&&n.context===t)return r;return-1},has:function(e,t){return-1!==this._indexOfListener(e,t)},add:function(e,t,n){return this.validateListener(e,"add"),this._registerListener(e,!1,t,n)},addOnce:function(e,t,n){return this.validateListener(e,"addOnce"),this._registerListener(e,!0,t,n)},remove:function(e,t){this.validateListener(e,"remove");var n=this._indexOfListener(e,t);return-1!==n&&(this._bindings[n]._destroy(),this._bindings.splice(n,1)),e},removeAll:function(e){"undefined"==typeof e&&(e=null);for(var t=this._bindings.length;t--;)e?this._bindings[t].context===e&&(this._bindings[t]._destroy(),this._bindings.splice(t,1)):this._bindings[t]._destroy();e||(this._bindings.length=0)},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){var e,t=Array.prototype.slice.call(arguments),n=this._bindings.length;if(this.memorize&&(this._prevParams=t),n){e=this._bindings.slice(),this._shouldPropagate=!0;do{n--}while(e[n]&&this._shouldPropagate&&!1!==e[n].execute(t))}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},t.prototype.constructor=t,n.Signal=t}(),n.AStarFinder=function(e){e=e||{};var t={allowDiagonal:!1,heuristicFilter:null};t=n.Tools.merge(t,e),this.allowDiagonal=t.allowDiagonal,this.heuristicFilter=t.heuristicFilter,this.list=new n.LinkedList},n.AStarFinder.prototype={findPath:function(e,t,r,i){var o,a,s,l,u,c;for(r=r||this.heuristicFilter,i.clearPath(),this.list.clear(),this.list.add(e);this.list.length>0;){if(this.list.sort(this.compare),(o=this.list.shift())._visited=!0,o===t)return n.PathUtil.backtrace(t);for(u=0,c=(s=i.getNeighbors(o,this.allowDiagonal,r)).length;c>u;u++)if((l=s[u]).walkable&&(a=o._calcCost+i.distance(o,l),!l._visited||ae?1:-1,o=r>t?1:-1,l=(a=c(n-e))-(s=c(r-t));e!==n||t!==r;)d.push([e,t]),(u=2*l)>-s&&(l-=s,e+=i),a>u&&(l+=a,t+=o);return d},expandPath:function(e){var t,n,r,i,o,a,s=[],l=e.length;if(2>l)return s;for(o=0;l-1>o;++o)for(t=e[o],n=e[o+1],i=(r=this.interpolate(t[0],t[1],n[0],n[1])).length,a=0;i-1>a;++a)s.push(r[a]);return s.push(e[l-1]),s},smoothenPath:function(e,t){var n,r,i,o,a,s,l,u,c,d,f,h,p=t.length,v=t[0][0],m=t[0][1],g=t[p-1][0],y=t[p-1][1];for(a=[[n=v,r=m]],l=2;p>l;++l){for(i=(c=t[l])[0],o=c[1],d=this.interpolate(n,r,i,o),h=!1,u=1;u0?(t=(e=r[0]).object.userData.structure,this.pickedObject!=t&&(this.pickedObject&&this.signal.dispatch(n.MouseCaster.OUT,this.pickedObject),this.pickedObject=t,this.selectedObject=null,this.signal.dispatch(n.MouseCaster.OVER,this.pickedObject)),this.position.copy(e.point),this.screenPosition.z=e.distance):(this.pickedObject&&this.signal.dispatch(n.MouseCaster.OUT,this.pickedObject),this.pickedObject=null,this.selectedObject=null),this.allHits=r}},preventDefault:function(){this._preventDefault=!0},_onDocumentMouseDown:function(e){return(e=e||window.event).preventDefault(),this._preventDefault?(this._preventDefault=!1,!1):(this.pickedObject&&(this.selectedObject=this.pickedObject),this.shift=e.shiftKey,this.ctrl=e.ctrlKey,this.down=1===e.which,this.rightDown=3===e.which,void this.signal.dispatch(n.MouseCaster.DOWN,this.pickedObject))},_onDocumentMouseUp:function(e){return e.preventDefault(),this._preventDefault?(this._preventDefault=!1,!1):(this.shift=e.shiftKey,this.ctrl=e.ctrlKey,this.signal.dispatch(n.MouseCaster.UP,this.pickedObject),this.selectedObject&&this.pickedObject&&this.selectedObject.uniqueID===this.pickedObject.uniqueID&&this.signal.dispatch(n.MouseCaster.CLICK,this.pickedObject),this.down=1!==e.which&&this.down,void(this.rightDown=3!==e.which&&this.rightDown))},_onDocumentMouseMove:function(e){e.preventDefault(),this.screenPosition.x=e.clientX/window.innerWidth*2-1,this.screenPosition.y=-e.clientY/window.innerHeight*2+1},_onMouseWheel:function(e){if(this.active){e.preventDefault(),e.stopPropagation();var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?this.wheel++:this.wheel--,this.signal.dispatch(n.MouseCaster.WHEEL,this.wheel)}}},n.MouseCaster.prototype.constructor=n.MouseCaster,n.Scene=function(e,t){var r={element:document.body,alpha:!0,antialias:!0,clearColor:"#fff",sortObjects:!1,fog:null,light:new THREE.DirectionalLight(16777215),lightPosition:null,cameraType:"PerspectiveCamera",cameraPosition:null,orthoZoom:4},i={minDistance:100,maxDistance:1e3,zoomSpeed:2,noZoom:!1};if(r=n.Tools.merge(r,e),"boolean"!=typeof t&&(i=n.Tools.merge(i,t)),this.renderer=new THREE.WebGLRenderer({alpha:r.alpha,antialias:r.antialias}),this.renderer.setClearColor(r.clearColor,0),this.renderer.sortObjects=r.sortObjects,this.width=window.innerWidth,this.height=window.innerHeight,this.orthoZoom=r.orthoZoom,this.container=new THREE.Scene,this.container.fog=r.fog,this.container.add(new THREE.AmbientLight(14540253)),r.lightPosition||r.light.position.set(-1,1,-1).normalize(),this.container.add(r.light),"OrthographicCamera"===r.cameraType){var o=window.innerWidth/this.orthoZoom,a=window.innerHeight/this.orthoZoom;this.camera=new THREE.OrthographicCamera(o/-2,o/2,a/2,a/-2,1,5e3)}else this.camera=new THREE.PerspectiveCamera(50,this.width/this.height,1,5e3);this.contolled=!!t,this.contolled&&(this.controls=new THREE.OrbitControls(this.camera,this.renderer.domElement),this.controls.minDistance=i.minDistance,this.controls.maxDistance=i.maxDistance,this.controls.zoomSpeed=i.zoomSpeed,this.controls.noZoom=i.noZoom),r.cameraPosition&&this.camera.position.copy(r.cameraPosition),window.addEventListener("resize",function(){if(this.width=window.innerWidth,this.height=window.innerHeight,"OrthographicCamera"===this.camera.type){var e=this.width/this.orthoZoom,t=this.height/this.orthoZoom;this.camera.left=e/-2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=t/-2}else this.camera.aspect=this.width/this.height;this.camera.updateProjectionMatrix(),this.renderer.setSize(this.width,this.height)}.bind(this),!1),this.attachTo(r.element)},n.Scene.prototype={attachTo:function(e){e.style.width=this.width+"px",e.style.height=this.height+"px",this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.width,this.height),e.appendChild(this.renderer.domElement)},add:function(e){this.container.add(e)},remove:function(e){this.container.remove(e)},render:function(){this.contolled&&this.controls.update(),this.renderer.render(this.container,this.camera)},updateOrthoZoom:function(){if(this.orthoZoom<=0)this.orthoZoom=0;else{var e=this.width/this.orthoZoom,t=this.height/this.orthoZoom;this.camera.left=e/-2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=t/-2,this.camera.updateProjectionMatrix()}},focusOn:function(e){this.camera.lookAt(e.position)}},n.Scene.prototype.constructor=n.Scene,n.SelectionManager=function(e){this.mouse=e,this.onSelect=new n.Signal,this.onDeselect=new n.Signal,this.selected=null,this.toggleSelection=!1,this.mouse.signal.add(this.onMouse,this)},n.SelectionManager.prototype={select:function(e,t){e&&(t=t||!0,this.selected!==e&&this.clearSelection(t),e.selected?this.toggleSelection&&(t&&this.onDeselect.dispatch(e),e.deselect()):e.select(),this.selected=e,t&&this.onSelect.dispatch(e))},clearSelection:function(e){e=e||!0,this.selected&&(e&&this.onDeselect.dispatch(this.selected),this.selected.deselect()),this.selected=null},onMouse:function(e,t){switch(e){case n.MouseCaster.DOWN:t||this.clearSelection();break;case n.MouseCaster.CLICK:this.select(t)}}},n.SelectionManager.prototype.constructor=n.SelectionManager,n.Tools={clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},sign:function(e){return e&&e/Math.abs(e)},random:function(e,t){return 1===arguments.length?Math.random()*e-.5*e:Math.random()*(t-e)+e},randomInt:function(e,t){return 1===arguments.length?Math.random()*e-.5*e|0:Math.random()*(t-e+1)+e|0},normalize:function(e,t,n){return(e-t)/(n-t)},getShortRotation:function(e){return(e%=this.TAU)>this.PI?e-=this.TAU:e<-this.PI&&(e+=this.TAU),e},generateID:function(){return Math.random().toString(36).slice(2)+Date.now()},isPlainObject:function(e){if("object"!=typeof e||e.nodeType||e===e.window)return!1;try{if(e.constructor&&!Object.prototype.hasOwnProperty.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},merge:function(e,t){var n=this,r=Array.isArray(t),i=r&&[]||{};return r?(e=e||[],i=i.concat(e),t.forEach((function(t,r){"undefined"==typeof i[r]?i[r]=t:n.isPlainObject(t)?i[r]=n.merge(e[r],t):-1===e.indexOf(t)&&i.push(t)})),i):(e&&n.isPlainObject(e)&&Object.keys(e).forEach((function(t){i[t]=e[t]})),Object.keys(t).forEach((function(r){t[r]&&n.isPlainObject(t[r])&&e[r]?i[r]=n.merge(e[r],t[r]):i[r]=t[r]})),i)},now:function(){return window.nwf?window.nwf.system.Performance.elapsedTime:window.performance.now()},empty:function(e){for(;e.lastChild;)e.removeChild(e.lastChild)},radixSort:function(e,t,n,r){if(r=r||31,!((t=t||0)>=(n=n||e.length)-1||0>r)){for(var i=t,o=n,a=1<i;)if(e[i]&a){--o;var s=e[i];e[i]=e[o],e[o]=s}else++i;this.radixSort(e,t,o,r-1),this.radixSort(e,o,n,r-1)}},randomizeRGB:function(e,t){var n,r,i=e.split(","),o="rgb(";for(t=this.randomInt(t),n=0;3>n;n++)0>(r=parseInt(i[n])+t)?r=0:r>255&&(r=255),o+=r+",";return(o=o.substring(0,o.length-1))+")"},getJSON:function(e){var t=new XMLHttpRequest,n="undefined"!=typeof e.cache&&e.cache?e.url:e.url+"?t="+Math.floor(1e4*Math.random())+Date.now();t.onreadystatechange=function(){if(200!==this.status)0!==this.status&&console.warn("[Tools.getJSON] Error: "+this.status+" ("+this.statusText+") :: "+e.url);else{var t=null;try{t=JSON.parse(this.responseText)}catch(n){return}e.callback.call(e.scope||null,t)}},t.open("GET",n,!0),t.setRequestHeader("Accept","application/json"),t.setRequestHeader("Content-Type","application/json"),t.send("")}}},7454:function(){!function(e){var t="KeyboardEvent"in e;t||(e.KeyboardEvent=function(){throw TypeError("Illegal constructor")}),"DOM_KEY_LOCATION_STANDARD"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_STANDARD=0),"DOM_KEY_LOCATION_LEFT"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_LEFT=1),"DOM_KEY_LOCATION_RIGHT"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_RIGHT=2),"DOM_KEY_LOCATION_NUMPAD"in e.KeyboardEvent||(e.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD=3);var n=window.KeyboardEvent.DOM_KEY_LOCATION_STANDARD,r=window.KeyboardEvent.DOM_KEY_LOCATION_LEFT,i=window.KeyboardEvent.DOM_KEY_LOCATION_RIGHT,o=window.KeyboardEvent.DOM_KEY_LOCATION_NUMPAD;function a(e,t){return-1!==String(e).indexOf(t)}var s=a(navigator.platform,"Win")?"win":a(navigator.platform,"Mac")?"mac":a(navigator.platform,"CrOS")?"cros":a(navigator.platform,"Linux")?"linux":a(navigator.userAgent,"iPad")||a(navigator.platform,"iPod")||a(navigator.platform,"iPhone")?"ios":"",l=a(navigator.userAgent,"Chrome/")?"chrome":a(navigator.vendor,"Apple")?"safari":a(navigator.userAgent,"MSIE")?"ie":a(navigator.userAgent,"Gecko/")?"moz":a(navigator.userAgent,"Opera/")?"opera":"",u=l+"-"+s;function c(e,t,n){u!==t&&l!==t&&s!==t||Object.keys(n).forEach((function(t){e[t]=n[t]}))}var d={3:{code:"Cancel"},6:{code:"Help"},8:{code:"Backspace"},9:{code:"Tab"},12:{code:"Clear"},13:{code:"Enter"},16:{code:"Shift"},17:{code:"Control"},18:{code:"Alt"},19:{code:"Pause"},20:{code:"CapsLock"},21:{code:"KanaMode"},22:{code:"HangulMode"},23:{code:"JunjaMode"},24:{code:"FinalMode"},25:{code:"KanjiMode"},27:{code:"Escape"},28:{code:"Convert"},29:{code:"NonConvert"},30:{code:"Accept"},31:{code:"ModeChange"},32:{code:"Space"},33:{code:"PageUp"},34:{code:"PageDown"},35:{code:"End"},36:{code:"Home"},37:{code:"ArrowLeft"},38:{code:"ArrowUp"},39:{code:"ArrowRight"},40:{code:"ArrowDown"},41:{code:"Select"},42:{code:"Print"},43:{code:"Execute"},44:{code:"PrintScreen"},45:{code:"Insert"},46:{code:"Delete"},47:{code:"Help"},48:{code:"Digit0",keyCap:"0"},49:{code:"Digit1",keyCap:"1"},50:{code:"Digit2",keyCap:"2"},51:{code:"Digit3",keyCap:"3"},52:{code:"Digit4",keyCap:"4"},53:{code:"Digit5",keyCap:"5"},54:{code:"Digit6",keyCap:"6"},55:{code:"Digit7",keyCap:"7"},56:{code:"Digit8",keyCap:"8"},57:{code:"Digit9",keyCap:"9"},65:{code:"KeyA",keyCap:"a"},66:{code:"KeyB",keyCap:"b"},67:{code:"KeyC",keyCap:"c"},68:{code:"KeyD",keyCap:"d"},69:{code:"KeyE",keyCap:"e"},70:{code:"KeyF",keyCap:"f"},71:{code:"KeyG",keyCap:"g"},72:{code:"KeyH",keyCap:"h"},73:{code:"KeyI",keyCap:"i"},74:{code:"KeyJ",keyCap:"j"},75:{code:"KeyK",keyCap:"k"},76:{code:"KeyL",keyCap:"l"},77:{code:"KeyM",keyCap:"m"},78:{code:"KeyN",keyCap:"n"},79:{code:"KeyO",keyCap:"o"},80:{code:"KeyP",keyCap:"p"},81:{code:"KeyQ",keyCap:"q"},82:{code:"KeyR",keyCap:"r"},83:{code:"KeyS",keyCap:"s"},84:{code:"KeyT",keyCap:"t"},85:{code:"KeyU",keyCap:"u"},86:{code:"KeyV",keyCap:"v"},87:{code:"KeyW",keyCap:"w"},88:{code:"KeyX",keyCap:"x"},89:{code:"KeyY",keyCap:"y"},90:{code:"KeyZ",keyCap:"z"},91:{code:"OSLeft",location:r},92:{code:"OSRight",location:i},93:{code:"ContextMenu"},95:{code:"Standby"},96:{code:"Numpad0",keyCap:"0",location:o},97:{code:"Numpad1",keyCap:"1",location:o},98:{code:"Numpad2",keyCap:"2",location:o},99:{code:"Numpad3",keyCap:"3",location:o},100:{code:"Numpad4",keyCap:"4",location:o},101:{code:"Numpad5",keyCap:"5",location:o},102:{code:"Numpad6",keyCap:"6",location:o},103:{code:"Numpad7",keyCap:"7",location:o},104:{code:"Numpad8",keyCap:"8",location:o},105:{code:"Numpad9",keyCap:"9",location:o},106:{code:"NumpadMultiply",keyCap:"*",location:o},107:{code:"NumpadAdd",keyCap:"+",location:o},108:{code:"NumpadComma",keyCap:",",location:o},109:{code:"NumpadSubtract",keyCap:"-",location:o},110:{code:"NumpadDecimal",keyCap:".",location:o},111:{code:"NumpadDivide",keyCap:"/",location:o},112:{code:"F1"},113:{code:"F2"},114:{code:"F3"},115:{code:"F4"},116:{code:"F5"},117:{code:"F6"},118:{code:"F7"},119:{code:"F8"},120:{code:"F9"},121:{code:"F10"},122:{code:"F11"},123:{code:"F12"},124:{code:"F13"},125:{code:"F14"},126:{code:"F15"},127:{code:"F16"},128:{code:"F17"},129:{code:"F18"},130:{code:"F19"},131:{code:"F20"},132:{code:"F21"},133:{code:"F22"},134:{code:"F23"},135:{code:"F24"},144:{code:"NumLock",location:o},145:{code:"ScrollLock"},160:{code:"ShiftLeft",location:r},161:{code:"ShiftRight",location:i},162:{code:"ControlLeft",location:r},163:{code:"ControlRight",location:i},164:{code:"AltLeft",location:r},165:{code:"AltRight",location:i},166:{code:"BrowserBack"},167:{code:"BrowserForward"},168:{code:"BrowserRefresh"},169:{code:"BrowserStop"},170:{code:"BrowserSearch"},171:{code:"BrowserFavorites"},172:{code:"BrowserHome"},173:{code:"VolumeMute"},174:{code:"VolumeDown"},175:{code:"VolumeUp"},176:{code:"MediaTrackNext"},177:{code:"MediaTrackPrevious"},178:{code:"MediaStop"},179:{code:"MediaPlayPause"},180:{code:"LaunchMail"},181:{code:"MediaSelect"},182:{code:"LaunchApp1"},183:{code:"LaunchApp2"},186:{code:"Semicolon",keyCap:";"},187:{code:"Equal",keyCap:"="},188:{code:"Comma",keyCap:","},189:{code:"Minus",keyCap:"-"},190:{code:"Period",keyCap:"."},191:{code:"Slash",keyCap:"/"},192:{code:"Backquote",keyCap:"`"},219:{code:"BracketLeft",keyCap:"["},220:{code:"Backslash",keyCap:"\\"},221:{code:"BracketRight",keyCap:"]"},222:{code:"Quote",keyCap:"'"},226:{code:"IntlBackslash",keyCap:"\\"},229:{code:"Process"},246:{code:"Attn"},247:{code:"CrSel"},248:{code:"ExSel"},249:{code:"EraseEof"},250:{code:"Play"},251:{code:"ZoomToggle"},254:{code:"Clear"}};c(d,"moz",{59:{code:"Semicolon",keyCap:";"},61:{code:"Equal",keyCap:"="},107:{code:"Equal",keyCap:"="},109:{code:"Minus",keyCap:"-"},187:{code:"NumpadAdd",keyCap:"+",location:o},189:{code:"NumpadSubtract",keyCap:"-",location:o}}),c(d,"moz-mac",{12:{code:"NumLock",location:o},173:{code:"Minus",keyCap:"-"}}),c(d,"moz-win",{173:{code:"Minus",keyCap:"-"}}),c(d,"chrome-mac",{93:{code:"OSRight",location:i}}),c(d,"safari",{3:{code:"Enter"},25:{code:"Tab"}}),c(d,"ios",{10:{code:"Enter",location:n}}),c(d,"safari-mac",{91:{code:"OSLeft",location:r},93:{code:"OSRight",location:i},229:{code:"KeyQ",keyCap:"Q"}});var f={};"cros"===s&&(f["U+00A0"]={code:"ShiftLeft",location:r},f["U+00A1"]={code:"ShiftRight",location:i},f["U+00A2"]={code:"ControlLeft",location:r},f["U+00A3"]={code:"ControlRight",location:i},f["U+00A4"]={code:"AltLeft",location:r},f["U+00A5"]={code:"AltRight",location:i}),"chrome-mac"===u&&(f["U+0010"]={code:"ContextMenu"}),"safari-mac"===u&&(f["U+0010"]={code:"ContextMenu"}),"ios"===s&&(f["U+0010"]={code:"Function"},f["U+001C"]={code:"ArrowLeft"},f["U+001D"]={code:"ArrowRight"},f["U+001E"]={code:"ArrowUp"},f["U+001F"]={code:"ArrowDown"},f["U+0001"]={code:"Home"},f["U+0004"]={code:"End"},f["U+000B"]={code:"PageUp"},f["U+000C"]={code:"PageDown"});var h=[];h[r]={16:{code:"ShiftLeft",location:r},17:{code:"ControlLeft",location:r},18:{code:"AltLeft",location:r}},h[i]={16:{code:"ShiftRight",location:i},17:{code:"ControlRight",location:i},18:{code:"AltRight",location:i}},h[o]={13:{code:"NumpadEnter",location:o}},c(h[o],"moz",{109:{code:"NumpadSubtract",location:o},107:{code:"NumpadAdd",location:o}}),c(h[r],"moz-mac",{224:{code:"OSLeft",location:r}}),c(h[i],"moz-mac",{224:{code:"OSRight",location:i}}),c(h[i],"moz-win",{91:{code:"OSRight",location:i}}),c(h[i],"mac",{93:{code:"OSRight",location:i}}),c(h[o],"chrome-mac",{12:{code:"NumLock",location:o}}),c(h[o],"safari-mac",{12:{code:"NumLock",location:o},187:{code:"NumpadAdd",location:o},189:{code:"NumpadSubtract",location:o},190:{code:"NumpadDecimal",location:o},191:{code:"NumpadDivide",location:o}});var p={ShiftLeft:{key:"Shift"},ShiftRight:{key:"Shift"},ControlLeft:{key:"Control"},ControlRight:{key:"Control"},AltLeft:{key:"Alt"},AltRight:{key:"Alt"},OSLeft:{key:"OS"},OSRight:{key:"OS"},NumpadEnter:{key:"Enter"},Space:{key:" "},Digit0:{key:"0",shiftKey:")"},Digit1:{key:"1",shiftKey:"!"},Digit2:{key:"2",shiftKey:"@"},Digit3:{key:"3",shiftKey:"#"},Digit4:{key:"4",shiftKey:"$"},Digit5:{key:"5",shiftKey:"%"},Digit6:{key:"6",shiftKey:"^"},Digit7:{key:"7",shiftKey:"&"},Digit8:{key:"8",shiftKey:"*"},Digit9:{key:"9",shiftKey:"("},KeyA:{key:"a",shiftKey:"A"},KeyB:{key:"b",shiftKey:"B"},KeyC:{key:"c",shiftKey:"C"},KeyD:{key:"d",shiftKey:"D"},KeyE:{key:"e",shiftKey:"E"},KeyF:{key:"f",shiftKey:"F"},KeyG:{key:"g",shiftKey:"G"},KeyH:{key:"h",shiftKey:"H"},KeyI:{key:"i",shiftKey:"I"},KeyJ:{key:"j",shiftKey:"J"},KeyK:{key:"k",shiftKey:"K"},KeyL:{key:"l",shiftKey:"L"},KeyM:{key:"m",shiftKey:"M"},KeyN:{key:"n",shiftKey:"N"},KeyO:{key:"o",shiftKey:"O"},KeyP:{key:"p",shiftKey:"P"},KeyQ:{key:"q",shiftKey:"Q"},KeyR:{key:"r",shiftKey:"R"},KeyS:{key:"s",shiftKey:"S"},KeyT:{key:"t",shiftKey:"T"},KeyU:{key:"u",shiftKey:"U"},KeyV:{key:"v",shiftKey:"V"},KeyW:{key:"w",shiftKey:"W"},KeyX:{key:"x",shiftKey:"X"},KeyY:{key:"y",shiftKey:"Y"},KeyZ:{key:"z",shiftKey:"Z"},Numpad0:{key:"0"},Numpad1:{key:"1"},Numpad2:{key:"2"},Numpad3:{key:"3"},Numpad4:{key:"4"},Numpad5:{key:"5"},Numpad6:{key:"6"},Numpad7:{key:"7"},Numpad8:{key:"8"},Numpad9:{key:"9"},NumpadMultiply:{key:"*"},NumpadAdd:{key:"+"},NumpadComma:{key:","},NumpadSubtract:{key:"-"},NumpadDecimal:{key:"."},NumpadDivide:{key:"/"},Semicolon:{key:";",shiftKey:":"},Equal:{key:"=",shiftKey:"+"},Comma:{key:",",shiftKey:"<"},Minus:{key:"-",shiftKey:"_"},Period:{key:".",shiftKey:">"},Slash:{key:"/",shiftKey:"?"},Backquote:{key:"`",shiftKey:"~"},BracketLeft:{key:"[",shiftKey:"{"},Backslash:{key:"\\",shiftKey:"|"},BracketRight:{key:"]",shiftKey:"}"},Quote:{key:"'",shiftKey:'"'},IntlBackslash:{key:"\\",shiftKey:"|"}};c(p,"mac",{OSLeft:{key:"Meta"},OSRight:{key:"Meta"}});var v={Esc:"Escape",Nonconvert:"NonConvert",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Menu:"ContextMenu",MediaNextTrack:"MediaTrackNext",MediaPreviousTrack:"MediaTrackPrevious",SelectMedia:"MediaSelect",HalfWidth:"Hankaku",FullWidth:"Zenkaku",RomanCharacters:"Romaji",Crsel:"CrSel",Exsel:"ExSel",Zoom:"ZoomToggle"},m=function(e,t){var n={};return Object.keys(e).forEach((function(r){var i=e[r];t in i&&(n[i[t]]=i)})),n}(d,"code");try{var g=t&&"location"in new KeyboardEvent("")}catch(b){}function y(e){var t="keyCode"in e?e.keyCode:"which"in e?e.which:0,n=function(){if(g||"keyLocation"in e){var n=g?e.location:e.keyLocation;if(n&&t in h[n])return h[n][t]}return"keyIdentifier"in e&&e.keyIdentifier in f?f[e.keyIdentifier]:t in d?d[t]:null}();if(!n)return null;var r=function(){var t=p[n.code];return t?e.shiftKey&&"shiftKey"in t?t.shiftKey:t.key:n.code}();return{code:n.code,key:r,location:n.location,keyCap:n.keyCap}}"KeyboardEvent"in e&&"defineProperty"in Object&&function(){function e(e,t,n){t in e||Object.defineProperty(e,t,n)}if(e(KeyboardEvent.prototype,"code",{get:function(){var e=y(this);return e?e.code:""}}),"key"in KeyboardEvent.prototype){var t=Object.getOwnPropertyDescriptor(KeyboardEvent.prototype,"key");Object.defineProperty(KeyboardEvent.prototype,"key",{get:function(){var e=t.get.call(this);return v.hasOwnProperty(e)?v[e]:e}})}e(KeyboardEvent.prototype,"key",{get:function(){var e=y(this);return e&&"key"in e?e.key:"Unidentified"}}),e(KeyboardEvent.prototype,"location",{get:function(){var e=y(this);return e&&"location"in e?e.location:n}}),e(KeyboardEvent.prototype,"locale",{get:function(){return""}})}(),"queryKeyCap"in e.KeyboardEvent||(e.KeyboardEvent.queryKeyCap=function(e,t){if(e=String(e),!m.hasOwnProperty(e))return"Undefined";if(t&&"en-us"!==String(t).toLowerCase())throw Error("Unsupported locale");var n=m[e];return n.keyCap||n.code||"Undefined"}),e.identifyKey=function(e){if(!("code"in e)){var t=y(e);e.code=t?t.code:"",e.key=t&&"key"in t?t.key:"Unidentified",e.location="location"in e?e.location:"keyLocation"in e?e.keyLocation:t&&"location"in t?t.location:n,e.locale=""}}}(window)},3386:function(e){e.exports=AFRAME.registerComponent("checkpoint-controls",{schema:{enabled:{default:!0},mode:{default:"teleport",oneOf:["teleport","animate"]},animateSpeed:{default:3}},init:function(){this.active=!0,this.checkpoint=null,this.isNavMeshConstrained=!1,this.offset=new THREE.Vector3,this.position=new THREE.Vector3,this.targetPosition=new THREE.Vector3},play:function(){this.active=!0},pause:function(){this.active=!1},setCheckpoint:function(e){const t=this.el;this.active&&this.checkpoint!==e&&(this.checkpoint&&t.emit("navigation-end",{checkpoint:this.checkpoint}),this.checkpoint=e,this.sync(),this.position.distanceTo(this.targetPosition)<.1?this.checkpoint=null:(t.emit("navigation-start",{checkpoint:e}),"teleport"===this.data.mode&&(this.el.setAttribute("position",this.targetPosition),this.checkpoint=null,t.emit("navigation-end",{checkpoint:e}),t.components["movement-controls"].updateNavLocation())))},isVelocityActive:function(){return!(!this.active||!this.checkpoint)},getVelocity:function(){if(!this.active)return;const e=this.data,t=this.offset,n=this.position,r=this.targetPosition,i=this.checkpoint;return this.sync(),n.distanceTo(r)<.1?(this.checkpoint=null,this.el.emit("navigation-end",{checkpoint:i}),t.set(0,0,0)):(t.setLength(e.animateSpeed),t)},sync:function(){const e=this.offset,t=this.position,n=this.targetPosition;t.copy(this.el.getAttribute("position")),this.checkpoint.object3D.getWorldPosition(n),n.add(this.checkpoint.components.checkpoint.getOffset()),e.copy(n).sub(t)}})},5062:function(e,t,n){const r=n(6453),i=n(4379),o=.2,a="left",s="right",l=1,u=2;e.exports=AFRAME.registerComponent("gamepad-controls",{GamepadButton:r,schema:{enabled:{default:!0},camera:{default:"[camera]",type:"selector"},rotationSensitivity:{default:2}},init:function(){const e=this.el.sceneEl;this.system=e.systems["tracked-controls-webxr"]||{controllers:[]},this.prevTime=window.performance.now(),this.buttons={};const t=this.el.object3D.rotation;this.pitch=new THREE.Object3D,this.pitch.rotation.x=THREE.Math.degToRad(t.x),this.yaw=new THREE.Object3D,this.yaw.position.y=10,this.yaw.rotation.y=THREE.Math.degToRad(t.y),this.yaw.add(this.pitch),this._lookVector=new THREE.Vector2,this._moveVector=new THREE.Vector2,this._dpadVector=new THREE.Vector2,e.addBehavior(this)},update:function(){this.tick()},tick:function(e,t){this.updateButtonState(),this.updateRotation(t)},remove:function(){},isVelocityActive:function(){if(!this.data.enabled||!this.isConnected())return!1;const e=this._dpadVector,t=this._moveVector;this.getDpad(e),this.getJoystick(l,t);const n=e.x||t.x,r=e.y||t.y;return Math.abs(n)>o||Math.abs(r)>o},getVelocityDelta:function(){const e=this._dpadVector,t=this._moveVector;this.getDpad(e),this.getJoystick(l,t);const n=e.x||t.x,r=e.y||t.y,i=new THREE.Vector3;return Math.abs(n)>o&&(i.x+=n),Math.abs(r)>o&&(i.z+=r),i},isRotationActive:function(){if(!this.data.enabled||!this.isConnected())return!1;const e=this._lookVector;return this.getJoystick(u,e),Math.abs(e.x)>o||Math.abs(e.y)>o},updateRotation:function(e){if(!this.isRotationActive())return;const t=this.data,n=this.yaw,r=this.pitch,i=t.camera.components["look-controls"],a=i&&i.pitchObject&&i.yawObject;a&&(r.rotation.copy(i.pitchObject.rotation),n.rotation.copy(i.yawObject.rotation));const s=this._lookVector;this.getJoystick(u,s),Math.abs(s.x)<=o&&(s.x=0),Math.abs(s.y)<=o&&(s.y=0),s.multiplyScalar(t.rotationSensitivity*e/1e3),n.rotation.y-=s.x,r.rotation.x-=s.y,r.rotation.x=Math.max(-Math.PI/2,Math.min(Math.PI/2,r.rotation.x)),t.camera.object3D.rotation.set(r.rotation.x,n.rotation.y,0),a&&(i.pitchObject.rotation.copy(r.rotation),i.yawObject.rotation.copy(n.rotation))},updateButtonState:function(){const e=this.getGamepad(s);if(this.data.enabled&&e)for(var t=0;t1?s:a).axes[e]},getJoystick:function(e,t){const n=this.getGamepad(e===l?a:s);if("xr-standard"===n.mapping)switch(e){case l:return t.set(n.axes[2],n.axes[3]);case u:return t.set(n.axes[0],n.axes[1])}else switch(e){case l:return t.set(n.axes[0],n.axes[1]);case u:return t.set(n.axes[2],n.axes[3])}throw new Error('Unexpected joystick index "%d".',e)},getDpad:function(e){const t=this.getGamepad(a);return t.buttons[r.DPAD_RIGHT]?e.set((t.buttons[r.DPAD_RIGHT].pressed?1:0)+(t.buttons[r.DPAD_LEFT].pressed?-1:0),(t.buttons[r.DPAD_UP].pressed?-1:0)+(t.buttons[r.DPAD_DOWN].pressed?1:0)):e.set(0,0)},isConnected:function(){const e=this.getGamepad(a);return!(!e||!e.connected)},getID:function(){return this.getGamepad(a).id}})},2406:function(e,t,n){n(3386),n(5062),n(2250),n(9048),n(3819),n(9893)},2250:function(e,t,n){n(7454);const r=window.KeyboardEvent;e.exports=AFRAME.registerComponent("keyboard-controls",{schema:{enabled:{default:!0},debug:{default:!1}},init:function(){this.dVelocity=new THREE.Vector3,this.localKeys={},this.listeners={keydown:this.onKeyDown.bind(this),keyup:this.onKeyUp.bind(this),blur:this.onBlur.bind(this)},this.attachEventListeners()},isVelocityActive:function(){return this.data.enabled&&!!Object.keys(this.getKeys()).length},getVelocityDelta:function(){const e=this.data,t=this.getKeys();return this.dVelocity.set(0,0,0),e.enabled&&((t.KeyW||t.ArrowUp)&&(this.dVelocity.z-=1),(t.KeyA||t.ArrowLeft)&&(this.dVelocity.x-=1),(t.KeyS||t.ArrowDown)&&(this.dVelocity.z+=1),(t.KeyD||t.ArrowRight)&&(this.dVelocity.x+=1)),this.dVelocity.clone()},play:function(){this.attachEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.pause()},attachEventListeners:function(){window.addEventListener("keydown",this.listeners.keydown,!1),window.addEventListener("keyup",this.listeners.keyup,!1),window.addEventListener("blur",this.listeners.blur,!1)},removeEventListeners:function(){window.removeEventListener("keydown",this.listeners.keydown),window.removeEventListener("keyup",this.listeners.keyup),window.removeEventListener("blur",this.listeners.blur)},onKeyDown:function(e){AFRAME.utils.shouldCaptureKeyEvent(e)&&(this.localKeys[e.code]=!0,this.emit(e))},onKeyUp:function(e){AFRAME.utils.shouldCaptureKeyEvent(e)&&(delete this.localKeys[e.code],this.emit(e))},onBlur:function(){for(let e in this.localKeys)this.localKeys.hasOwnProperty(e)&&delete this.localKeys[e]},emit:function(e){"__keyboard-controls-proxy"in e&&this.el.emit(e.type,e),this.el.emit(e.type+":"+e.code,new r(e.type,e)),this.data.debug&&console.log(e.type+":"+e.code)},isPressed:function(e){return e in this.getKeys()},getKeys:function(){return this.isProxied()?this.el.sceneEl.components["proxy-controls"].getKeyboard():this.localKeys},isProxied:function(){const e=this.el.sceneEl.components["proxy-controls"];return e&&e.isConnected()}})},3819:function(e){const t="-controls";e.exports=AFRAME.registerComponent("movement-controls",{dependencies:["rotation"],schema:{enabled:{default:!0},controls:{default:["gamepad","trackpad","keyboard","touch"]},speed:{default:.3,min:0},fly:{default:!1},constrainToNavMesh:{default:!1},camera:{default:"[movement-controls] [camera]",type:"selector"}},init:function(){const e=this.el;this.velocityCtrl=null,this.velocity=new THREE.Vector3,this.heading=new THREE.Quaternion,this.navGroup=null,this.navNode=null,e.sceneEl.hasLoaded?this.injectControls():e.sceneEl.addEventListener("loaded",this.injectControls.bind(this))},update:function(e){const t=this.el,n=this.data,r=t.sceneEl.systems.nav;t.sceneEl.hasLoaded&&this.injectControls(),r&&n.constrainToNavMesh!==e.constrainToNavMesh&&(n.constrainToNavMesh?r.addAgent(this):r.removeAgent(this))},injectControls:function(){const e=this.data;var n;for(let r=0;r.2?l.set(0,0,0):this.updateVelocity(i),a.constrainToNavMesh&&!1!==s.isNavMeshConstrained){if(l.lengthSq()<1e-5)return;e.copy(o.object3D.position),t.copy(l).multiplyScalar(i/1e3).add(e);const r=o.sceneEl.systems.nav;this.navGroup=null===this.navGroup?r.getGroup(e):this.navGroup,this.navNode=this.navNode||r.getNode(e,this.navGroup),this.navNode=r.clampStep(e,t,this.navGroup,this.navNode,n),o.object3D.position.copy(n)}else o.hasAttribute("velocity")?o.setAttribute("velocity",l):(o.object3D.position.x+=l.x*i/1e3,o.object3D.position.y+=l.y*i/1e3,o.object3D.position.z+=l.z*i/1e3)}}(),updateVelocityCtrl:function(){const e=this.data;if(e.enabled){for(let n=0,r=e.controls.length;n0){let e=0,r=0;t.enableNegX&&n[0]this.startingAxisData[0]&&(e=1),t.enablePosZ&&n[1]>this.startingAxisData[1]&&(r=-1),t.enableNegZ&&n[1]i?(this.zVel=0,this.xVel=e,this.isMoving=!0):(this.xVel=0,this.zVel=r,this.isMoving=!0)}},handleTouchAxis:function(e){const t=this.data,n=e.detail.axis;let r=0,i=0;t.enableNegX&&n[0]<0&&(r=-1),t.enablePosX&&n[0]>0&&(r=1),t.enablePosZ&&n[1]>0&&(i=-1),t.enableNegZ&&n[1]<0&&(i=1),Math.abs(n[0])>Math.abs(n[1])?(this.zVel=0,this.xVel=r):(this.xVel=0,this.zVel=i)}})},6591:function(e){const t={once:THREE.LoopOnce,repeat:THREE.LoopRepeat,pingpong:THREE.LoopPingPong};function n(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")}e.exports=AFRAME.registerComponent("animation-mixer",{schema:{clip:{default:"*"},duration:{default:0},clampWhenFinished:{default:!1,type:"boolean"},crossFadeDuration:{default:0},loop:{default:"repeat",oneOf:Object.keys(t)},repetitions:{default:1/0,min:0},timeScale:{default:1}},init:function(){this.model=null,this.mixer=null,this.activeActions=[];const e=this.el.getObject3D("mesh");e?this.load(e):this.el.addEventListener("model-loaded",(e=>{this.load(e.detail.model)}))},load:function(e){const t=this.el;this.model=e,this.mixer=new THREE.AnimationMixer(e),this.mixer.addEventListener("loop",(e=>{t.emit("animation-loop",{action:e.action,loopDelta:e.loopDelta})})),this.mixer.addEventListener("finished",(e=>{t.emit("animation-finished",{action:e.action,direction:e.direction})})),this.data.clip&&this.update({})},remove:function(){this.mixer&&this.mixer.stopAllAction()},update:function(e){if(!e)return;const n=this.data,r=AFRAME.utils.diff(n,e);if("clip"in r)return this.stopAction(),void(n.clip&&this.playAction());this.activeActions.forEach((e=>{"duration"in r&&n.duration&&e.setDuration(n.duration),"clampWhenFinished"in r&&(e.clampWhenFinished=n.clampWhenFinished),("loop"in r||"repetitions"in r)&&e.setLoop(t[n.loop],n.repetitions),"timeScale"in r&&e.setEffectiveTimeScale(n.timeScale)}))},stopAction:function(){const e=this.data;for(let t=0;t{this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("Anonymous")}))},update:function(){const e=this,t=this.el,n=this.data;n&&(this.remove(),this.loaderPromise.then((()=>{this.loader.load(n,(function(n){e.model=n.scene,e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},9874:function(e,t,n){n(6591),n(2290),n(5310),n(8837),n(171)},171:function(e){e.exports=AFRAME.registerComponent("object-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){let e;const t=this.data;t.src&&(this.remove(),e=new THREE.ObjectLoader,t.crossorigin&&e.setCrossOrigin(t.crossorigin),e.load(t.src,(e=>{e.traverse((e=>{e instanceof THREE.SkinnedMesh&&e.material&&(e.material.skinning=!!(e.geometry&&e.geometry.bones||[]).length)})),this.load(e)})))},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"json",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},7642:function(e){e.exports=AFRAME.registerComponent("checkpoint",{schema:{offset:{default:{x:0,y:0,z:0},type:"vec3"}},init:function(){this.active=!1,this.targetEl=null,this.fire=this.fire.bind(this),this.offset=new THREE.Vector3},update:function(){this.offset.copy(this.data.offset)},play:function(){this.el.addEventListener("click",this.fire)},pause:function(){this.el.removeEventListener("click",this.fire)},remove:function(){this.pause()},fire:function(){const e=this.el.sceneEl.querySelector("[checkpoint-controls]");if(!e)throw new Error("No `checkpoint-controls` component found.");e.components["checkpoint-controls"].setCheckpoint(this.el)},getOffset:function(){return this.offset.copy(this.data.offset)}})},4795:function(e){function t(e,t,n,r){e&&(t=t||[],e.traverse((e=>{if(!e.isMesh)return;var i;((i=e.material)?Array.isArray(i)?i:i.materials?i.materials:[i]:[]).forEach((e=>{e&&!("envMap"in e)||t.length&&-1===t.indexOf(e.name)||(e.envMap=n,e.reflectivity=r,e.needsUpdate=!0)}))})))}e.exports=AFRAME.registerComponent("cube-env-map",{multiple:!0,schema:{path:{default:""},extension:{default:"jpg",oneOf:["jpg","png"]},format:{default:"RGBFormat",oneOf:["RGBFormat","RGBAFormat"]},enableBackground:{default:!1},reflectivity:{default:1,min:0,max:1},materials:{default:[]}},init:function(){const e=this.data;this.texture=(new THREE.CubeTextureLoader).load([e.path+"posx."+e.extension,e.path+"negx."+e.extension,e.path+"posy."+e.extension,e.path+"negy."+e.extension,e.path+"posz."+e.extension,e.path+"negz."+e.extension]),this.texture.format=THREE[e.format],this.object3dsetHandler=()=>{const e=this.el.getObject3D("mesh"),n=this.data;t(e,n.materials,this.texture,n.reflectivity)},this.el.addEventListener("object3dset",this.object3dsetHandler)},update:function(e){const n=this.data,r=this.el.getObject3D("mesh");let i=[],o=[];if(n.materials.length&&(e.materials?(i=n.materials.filter((t=>!e.materials.includes(t))),o=e.materials.filter((e=>!n.materials.includes(e)))):i=n.materials),i.length&&t(r,i,this.texture,n.reflectivity),o.length&&t(r,o,null,1),e.materials&&n.reflectivity!==e.reflectivity){const i=n.materials.filter((t=>e.materials.includes(t)));i.length&&t(r,i,this.texture,n.reflectivity)}this.data.enableBackground&&!e.enableBackground?this.setBackground(this.texture):!this.data.enableBackground&&e.enableBackground&&this.setBackground(null)},remove:function(){this.el.removeEventListener("object3dset",this.object3dsetHandler);const e=this.el.getObject3D("mesh"),n=this.data;t(e,n.materials,null,1),n.enableBackground&&this.setBackground(null)},setBackground:function(e){this.el.sceneEl.object3D.background=e}})},9511:function(e){e.exports=AFRAME.registerComponent("grab",{init:function(){this.system=this.el.sceneEl.systems.physics,this.GRABBED_STATE="grabbed",this.grabbing=!1,this.hitEl=null,this.physics=this.el.sceneEl.systems.physics,this.constraint=null,this.onHit=this.onHit.bind(this),this.onGripOpen=this.onGripOpen.bind(this),this.onGripClose=this.onGripClose.bind(this)},play:function(){const e=this.el;e.addEventListener("hit",this.onHit),e.addEventListener("gripdown",this.onGripClose),e.addEventListener("gripup",this.onGripOpen),e.addEventListener("trackpaddown",this.onGripClose),e.addEventListener("trackpadup",this.onGripOpen),e.addEventListener("triggerdown",this.onGripClose),e.addEventListener("triggerup",this.onGripOpen)},pause:function(){const e=this.el;e.removeEventListener("hit",this.onHit),e.removeEventListener("gripdown",this.onGripClose),e.removeEventListener("gripup",this.onGripOpen),e.removeEventListener("trackpaddown",this.onGripClose),e.removeEventListener("trackpadup",this.onGripOpen),e.removeEventListener("triggerdown",this.onGripClose),e.removeEventListener("triggerup",this.onGripOpen)},onGripClose:function(){this.grabbing=!0},onGripOpen:function(){const e=this.hitEl;this.grabbing=!1,e&&(e.removeState(this.GRABBED_STATE),this.hitEl=void 0,this.system.removeConstraint(this.constraint),this.constraint=null)},onHit:function(e){const t=e.detail.el;t&&!t.is(this.GRABBED_STATE)&&this.grabbing&&!this.hitEl&&(t.addState(this.GRABBED_STATE),this.hitEl=t,this.constraint=new CANNON.LockConstraint(this.el.body,t.body),this.system.addConstraint(this.constraint))}})},9236:function(e,t,n){n(7642),n(4795),n(9511),n(765),n(837),n(8310),n(8240),n(1790)},765:function(e){e.exports=AFRAME.registerComponent("jump-ability",{dependencies:["velocity"],schema:{on:{default:"keydown:Space gamepadbuttondown:0"},playerHeight:{default:1.764},maxJumps:{default:1},distance:{default:5},debug:{default:!1}},init:function(){this.velocity=0,this.numJumps=0;const e=this.beginJump.bind(this),t=this.data.on.split(" ");this.bindings={};for(let n=0;n0&&this.el.emit("jumpend"),this.numJumps=0}})},837:function(e){const t=1e-6;e.exports=AFRAME.registerComponent("kinematic-body",{dependencies:["velocity"],schema:{mass:{default:5},radius:{default:1.3},linearDamping:{default:.05},enableSlopes:{default:!0},enableJumps:{default:!1}},init:function(){this.system=this.el.sceneEl.systems.physics,this.system.addComponent(this);const e=this.el,t=this.data,n=(new CANNON.Vec3).copy(e.object3D.getWorldPosition(new THREE.Vector3));this.body=new CANNON.Body({material:this.system.getMaterial("staticMaterial"),position:n,mass:t.mass,linearDamping:t.linearDamping,fixedRotation:!0}),this.body.addShape(new CANNON.Sphere(t.radius),new CANNON.Vec3(0,t.radius,0)),this.body.el=this.el,this.el.body=this.body,this.system.addBody(this.body),e.hasAttribute("wasd-controls")&&console.warn("[kinematic-body] Not compatible with wasd-controls, use movement-controls.")},remove:function(){this.system.removeBody(this.body),this.system.removeComponent(this),delete this.el.body},beforeStep:function(e,t){if(!t)return;const n=this.el,r=this.data,i=this.body;r.enableJumps||i.velocity.set(0,0,0),i.position.copy(n.getAttribute("position"))},step:function(){const e=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,i=new THREE.Vector3;return function(o,a){if(!a)return;let s,l,u=this.body,c=this.data,d=!1,f=-1/0,h=this.system.getContacts();a=Math.min(a,1e3*this.system.data.maxInterval),i.set(0,0,0),e.copy(this.el.getAttribute("velocity")),u.velocity.copy(e);for(var p,v=0;p=h[v];v++)if(p.enabled){if(u.id===p.bi.id)p.ni.negate(r);else{if(u.id!==p.bj.id)continue;r.copy(p.ni)}d=u.velocity.dot(r)<-t,d&&r.y<=.5?e.projectOnPlane(r):r.y>.5&&(s=u.id===p.bi.id?Math.abs(p.rj.y+p.bj.position.y):Math.abs(p.ri.y+p.bi.position.y),s>f&&(f=s,i.copy(r),l=u.id===p.bi.id?p.bj:p.bi))}n.copy(e).normalize(),l&&(!c.enableJumps||n.y<.5)?(c.enableSlopes?i.y<1-t&&i.copy(this.raycastToGround(l,i)):i.set(0,1,0),e.projectOnPlane(i)):this.system.driver.world&&e.add(this.system.driver.world.gravity.scale(4*a/1e3)),u.velocity.copy(e),this.el.setAttribute("velocity",u.velocity),this.el.setAttribute("position",u.position)}}(),raycastToGround:function(e,t){let n,r,i=this.body.position,o=this.body.position.clone();return n=new CANNON.Ray(i,o),n._updateDirection(),n.intersectBody(e),n.hasHit?(r=n.result.hitNormalWorld,Math.abs(r.y)>Math.abs(t.y)?r:t):t}})},8310:function(e){e.exports=AFRAME.registerComponent("mesh-smooth",{init:function(){this.el.addEventListener("model-loaded",(e=>{e.detail.model.traverse((e=>{e.isMesh&&e.geometry.computeVertexNormals()}))}))}})},8240:function(e){e.exports=AFRAME.registerComponent("normal-material",{init:function(){this.material=new THREE.MeshNormalMaterial({flatShading:!0}),this.applyMaterial=this.applyMaterial.bind(this),this.el.addEventListener("object3dset",this.applyMaterial)},remove:function(){this.el.removeEventListener("object3dset",this.applyMaterial)},applyMaterial:function(){this.el.object3D.traverse((e=>{e.isMesh&&(e.material=this.material)}))}})},1790:function(e){e.exports=AFRAME.registerComponent("sphere-collider",{schema:{objects:{default:""},state:{default:"collided"},radius:{default:.05},watch:{default:!0}},init:function(){this.observer=null,this.els=[],this.collisions=[],this.handleHit=this.handleHit.bind(this),this.handleHitEnd=this.handleHitEnd.bind(this)},remove:function(){this.pause()},play:function(){const e=this.el.sceneEl;this.data.watch&&(this.observer=new MutationObserver(this.update.bind(this,null)),this.observer.observe(e,{childList:!0,subtree:!0}))},pause:function(){this.observer&&(this.observer.disconnect(),this.observer=null)},update:function(){const e=this.data;let t;t=e.objects?this.el.sceneEl.querySelectorAll(e.objects):this.el.sceneEl.children,this.els=Array.prototype.slice.call(t)},tick:function(){const e=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3,r=new THREE.Vector3,i=new THREE.Box3,o=new Map;return function(){const a=this.el,s=this.data,l=a.getObject3D("mesh"),u=[];let c;var d;l&&(o.clear(),a.object3D.getWorldPosition(e),a.object3D.getWorldScale(n),c=s.radius*(d=n,Math.max.apply(null,d.toArray())),this.els.forEach((function(n){let a,s,l,d;if(!n.isEntity)return;if(s=n.getObject3D("mesh"),!s)return;if(i.setFromObject(s).getSize(r),d=Math.max(r.x,r.y,r.z)/2,a=Math.sqrt(2*d*d),i.getCenter(t),!a)return;l=e.distanceTo(t),lo.get(e)>o.get(t)?1:-1)).forEach(this.handleHit),0===u.length&&a.emit("hit",{el:null}),this.collisions.filter((e=>!o.has(e))).forEach(this.handleHitEnd),this.collisions=u)}}(),handleHit:function(e){e.emit("hit"),e.addState(this.data.state),this.el.emit("hit",{el:e})},handleHitEnd:function(e){e.emit("hitend"),e.removeState(this.data.state),this.el.emit("hitend",{el:e})}})},2578:function(e,t,n){n(8453),n(1250),n(1465)},1250:function(e){e.exports=AFRAME.registerComponent("nav-agent",{schema:{destination:{type:"vec3"},active:{default:!1},speed:{default:2}},init:function(){this.system=this.el.sceneEl.systems.nav,this.system.addAgent(this),this.group=null,this.path=[],this.raycaster=new THREE.Raycaster},remove:function(){this.system.removeAgent(this)},update:function(){this.path.length=0},updateNavLocation:function(){this.group=null,this.path=[]},tick:function(){const e=new THREE.Vector3,t=new THREE.Vector3,n=new THREE.Vector3;return function(r,i){const o=this.el,a=this.data,s=this.raycaster,l=a.speed*i/1e3;if(!a.active)return;if(!this.path.length){const t=this.el.object3D.position;this.group=this.group||this.system.getGroup(t),this.path=this.system.getPath(t,e.copy(a.destination),this.group)||[],o.emit("navigation-start")}if(!this.path.length)return console.warn("[nav] Unable to find path to %o.",a.destination),this.el.setAttribute("nav-agent",{active:!1}),void o.emit("navigation-end");const u=o.object3D.position,c=this.path[0];t.subVectors(c,u);let d;if(t.length(){e.isMesh&&(n=e)})),!n)return;const r=n.geometry.isBufferGeometry?(new THREE.Geometry).fromBufferGeometry(n.geometry):n.geometry.clone();t.updateMatrixWorld(),r.applyMatrix(n.matrixWorld),this.system.setNavMeshGeometry(r),this.hasLoadedNavMesh=!0}})},1465:function(e,t,n){const{Pathfinding:r}=n(6594),i=new r,o="level";e.exports=AFRAME.registerSystem("nav",{init:function(){this.navMesh=null,this.agents=new Set},setNavMeshGeometry:function(e){this.navMesh=new THREE.Mesh(e),i.setZoneData(o,r.createZone(e)),Array.from(this.agents).forEach((e=>e.updateNavLocation()))},getNavMesh:function(){return this.navMesh},addAgent:function(e){this.agents.add(e)},removeAgent:function(e){this.agents.delete(e)},getPath:function(e,t,n){return this.navMesh?i.findPath(e,t,o,n):null},getGroup:function(e){return this.navMesh?i.getGroup(o,e):null},getNode:function(e,t){return this.navMesh?i.getClosestNode(e,o,t,!0):null},clampStep:function(e,t,n,r,a){return this.navMesh?r?i.clampStep(e,t,r,o,n,a):(a.copy(t),this.getNode(t,n)):(a.copy(t),null)}})},386:function(e){e.exports=AFRAME.registerPrimitive("a-grid",{defaultComponents:{geometry:{primitive:"plane",width:75,height:75},rotation:{x:-90,y:0,z:0},material:{src:"url(https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v1.16.3/assets/grid.png)",repeat:"75 75"}},mappings:{width:"geometry.width",height:"geometry.height",src:"material.src"}})},3535:function(e,t,n){const r=n(3471),i=n(2667);e.exports.Primitive=AFRAME.registerPrimitive("a-hexgrid",{defaultComponents:{hexgrid:{}},mappings:{src:"hexgrid.src"}}),e.exports.Component=AFRAME.registerComponent("hexgrid",{dependencies:["material"],schema:{src:{type:"asset"}},init:function(){const e=this.data;e.src?fetch(e.src).then((e=>e.json())).then((e=>this.addMesh(e))):this.addMesh(i)},addMesh:function(e){const t=new r.HexGrid;t.fromJSON(e);const n=new r.Board(t);n.generateTilemap(),this.el.setObject3D("mesh",n.group),this.addMaterial()},addMaterial:function(){const e=(this.el.components.material||{}).material;e&&this.el.object3D.traverse((t=>{t.isMesh&&(t.material=e)}))},remove:function(){this.el.removeObject3D("mesh")}})},9307:function(e){e.exports.Primitive=AFRAME.registerPrimitive("a-ocean",{defaultComponents:{ocean:{},rotation:{x:-90,y:0,z:0}},mappings:{width:"ocean.width",depth:"ocean.depth",density:"ocean.density",amplitude:"ocean.amplitude",amplitudeVariance:"ocean.amplitudeVariance",speed:"ocean.speed",speedVariance:"ocean.speedVariance",color:"ocean.color",opacity:"ocean.opacity"}}),e.exports.Component=AFRAME.registerComponent("ocean",{schema:{width:{default:10,min:0},depth:{default:10,min:0},density:{default:10},amplitude:{default:.1},amplitudeVariance:{default:.3},speed:{default:1},speedVariance:{default:2},color:{default:"#7AD2F7",type:"color"},opacity:{default:.8}},play:function(){const e=this.el,t=this.data;let n=e.components.material;const r=new THREE.PlaneGeometry(t.width,t.depth,t.density,t.density);r.mergeVertices(),this.waves=[];for(let i,o=0,a=r.vertices.length;o!0},onDagError:{parse:a,default:void 0},nodeRelSize:{type:"number",default:4},nodeId:{type:"string",default:"id"},nodeVal:{parse:s,default:"val"},nodeResolution:{type:"number",default:8},nodeVisibility:{parse:s,default:!0},nodeColor:{parse:s,default:"color"},nodeAutoColorBy:{parse:s,default:""},nodeOpacity:{type:"number",default:.75},nodeThreeObject:{parse:s,default:null},nodeThreeObjectExtend:{parse:s,default:!1},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},linkVisibility:{parse:s,default:!0},linkColor:{parse:s,default:"color"},linkAutoColorBy:{parse:s,default:""},linkOpacity:{type:"number",default:.2},linkWidth:{parse:s,default:0},linkResolution:{type:"number",default:6},linkCurvature:{parse:s,default:0},linkCurveRotation:{parse:s,default:0},linkMaterial:{parse:s,default:null},linkThreeObject:{parse:s,default:null},linkThreeObjectExtend:{parse:s,default:!1},linkPositionUpdate:{parse:a,default:null},linkDirectionalArrowLength:{parse:s,default:0},linkDirectionalArrowColor:{parse:s,default:null},linkDirectionalArrowRelPos:{parse:s,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:s,default:0},linkDirectionalParticleSpeed:{parse:s,default:.01},linkDirectionalParticleWidth:{parse:s,default:.5},linkDirectionalParticleColor:{parse:s,default:null},linkDirectionalParticleResolution:{type:"number",default:4},onNodeHover:{parse:a,default:()=>{}},onLinkHover:{parse:a,default:()=>{}},onNodeClick:{parse:a,default:()=>{}},onLinkClick:{parse:a,default:()=>{}},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:o,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:a,default:function(){}},onEngineStop:{parse:a,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new i),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new i);const e=this.forceGraph,t=e.emitParticle.apply(e,arguments);return t===e?this:t},d3Force:function(){this.forceGraph||(this.forceGraph=new i);const e=this.forceGraph,t=e.d3Force.apply(e,arguments);return t===e?this:t},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},init:function(){const e=this.state={};e.infoEl=document.createElement("a-text"),e.infoEl.setAttribute("position","0 -0.1 -1"),e.infoEl.setAttribute("width",1),e.infoEl.setAttribute("align","center"),e.infoEl.setAttribute("color","lavender");const t=document.querySelector("a-entity[camera], a-camera");t.appendChild(e.infoEl),e.cameraObj=t.object3D.children.filter((function(e){return"PerspectiveCamera"===e.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(t){e.cameraObj=t.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new i),this.forceGraph.onFinishUpdate((()=>this.el.setObject3D("forcegraphGroup",this.forceGraph))).onLoading((()=>e.infoEl.setAttribute("value","Loading..."))).onFinishLoading((()=>e.infoEl.setAttribute("value",""))),this.el.addEventListener("raycaster-intersected",(t=>e.hoverDetail=t.detail)),this.el.addEventListener("raycaster-intersected-cleared",(t=>e.hoverDetail=t.detail)),this.el.addEventListener("click",(()=>e.hoverObj&&this.data["on"+("node"===e.hoverObj.__graphObjType?"Node":"Link")+"Click"](e.hoverObj.__data)))},remove:function(){this.state.infoEl.remove(),this.el.removeObject3D("forcegraphGroup")},update:function(e){const t=this,n=this.data,r=AFRAME.utils.diff(n,e);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(e){return e in r})).forEach((function(e){t.forceGraph[e](""!==n[e]?n[e]:null)})),("nodes"in r||"links"in r)&&t.forceGraph.graphData({nodes:n.nodes,links:n.links})},tick:function(e,t){const n=this.state,r=this.data,i=n.hoverDetail?n.hoverDetail.getIntersection?n.hoverDetail.getIntersection(this.el):n.hoverDetail.intersection||void 0:void 0;let o=i?i.object:void 0;for(;o&&!o.hasOwnProperty("__graphObjType");)o=o.parent;if(o!==n.hoverObj){const e=n.hoverObj?n.hoverObj.__graphObjType:null,t=n.hoverObj?n.hoverObj.__data:null,i=o?o.__graphObjType:null,a=o?o.__data:null;e&&e!==i&&r["on"+("node"===e?"Node":"Link")+"Hover"](null,t),i&&r["on"+("node"===i?"Node":"Link")+"Hover"](a,e===i?t:null),n.hoverObj=o}this.forceGraph.tickFrame()}})},296:function(e){function t(e,t,n){var r,i,o,a,s;function l(){var u=Date.now()-a;u=0?r=setTimeout(l,t-u):(r=null,n||(s=e.apply(o,i),o=i=null))}null==t&&(t=100);var u=function(){o=this,i=arguments,a=Date.now();var u=n&&!r;return r||(r=setTimeout(l,t)),u&&(s=e.apply(o,i),o=i=null),s};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(s=e.apply(o,i),o=i=null,clearTimeout(r),r=null)},u}t.debounce=t,e.exports=t},3879:function(e,t,n){var r=n(7236),i=n(6189),o={float:"cssFloat"},a=n(3379);function s(e,t,n){var s=o[t];if("undefined"===typeof s&&(s=function(e){var t=i(e),n=r(t);return o[t]=o[e]=o[n]=n,n}(t)),s){if(void 0===n)return e.style[s];e.style[s]=a(s,n)}}function l(e,t){for(var n in t)t.hasOwnProperty(n)&&s(e,n,t[n])}function u(){2===arguments.length?"string"===typeof arguments[1]?arguments[0].style.cssText=arguments[1]:l(arguments[0],arguments[1]):s(arguments[0],arguments[1],arguments[2])}e.exports=u,e.exports.set=u,e.exports.get=function(e,t){return Array.isArray(t)?t.reduce((function(t,n){return t[n]=s(e,n||""),t}),{}):s(e,t||"")}},3869:function(e,t,n){"use strict";n.d(t,{M:function(){return p}});var r=n(1439),i=n(7294),o=n(6717);var a=n(8626),s=n(5930),l=0;function u(){var e=l;return l++,e}var c=function(e){var t=e.children,n=e.initial,r=e.isPresent,o=e.onExitComplete,l=e.custom,c=e.presenceAffectsLayout,f=(0,s.h)(d),h=(0,s.h)(u),p=(0,i.useMemo)((function(){return{id:h,initial:n,isPresent:r,custom:l,onExitComplete:function(e){f.set(e,!0);var t=!0;f.forEach((function(e){e||(t=!1)})),t&&(null===o||void 0===o||o())},register:function(e){return f.set(e,!1),function(){return f.delete(e)}}}}),c?void 0:[r]);return(0,i.useMemo)((function(){f.forEach((function(e,t){return f.set(t,!1)}))}),[r]),i.useEffect((function(){!r&&!f.size&&(null===o||void 0===o||o())}),[r]),i.createElement(a.O.Provider,{value:p},t)};function d(){return new Map}var f=n(9870);function h(e){return e.key||""}var p=function(e){var t=e.children,n=e.custom,a=e.initial,s=void 0===a||a,l=e.onExitComplete,u=e.exitBeforeEnter,d=e.presenceAffectsLayout,p=void 0===d||d,v=function(){var e=(0,i.useRef)(!1),t=(0,r.CR)((0,i.useState)(0),2),n=t[0],a=t[1];return(0,o.z)((function(){return e.current=!0})),(0,i.useCallback)((function(){!e.current&&a(n+1)}),[n])}(),m=(0,i.useContext)(f.WH);(0,f.Md)(m)&&(v=m.forceUpdate);var g=(0,i.useRef)(!0),y=function(e){var t=[];return i.Children.forEach(e,(function(e){(0,i.isValidElement)(e)&&t.push(e)})),t}(t),b=(0,i.useRef)(y),w=(0,i.useRef)(new Map).current,x=(0,i.useRef)(new Set).current;if(function(e,t){e.forEach((function(e){var n=h(e);t.set(n,e)}))}(y,w),g.current)return g.current=!1,i.createElement(i.Fragment,null,y.map((function(e){return i.createElement(c,{key:h(e),isPresent:!0,initial:!!s&&void 0,presenceAffectsLayout:p},e)})));for(var E=(0,r.ev)([],(0,r.CR)(y)),k=b.current.map(h),T=y.map(h),_=k.length,O=0;O<_;O++){var C=k[O];-1===T.indexOf(C)?x.add(C):x.delete(C)}return u&&x.size&&(E=[]),x.forEach((function(e){if(-1===T.indexOf(e)){var t=w.get(e);if(t){var r=k.indexOf(e);E.splice(r,0,i.createElement(c,{key:h(t),isPresent:!1,onExitComplete:function(){w.delete(e),x.delete(e);var t=b.current.findIndex((function(t){return t.key===e}));b.current.splice(t,1),x.size||(b.current=y,v(),l&&l())},custom:n,presenceAffectsLayout:p},t))}}})),E=E.map((function(e){var t=e.key;return x.has(t)?e:i.createElement(c,{key:h(e),isPresent:!0,presenceAffectsLayout:p},e)})),b.current=E,i.createElement(i.Fragment,null,x.size?E:E.map((function(e){return(0,i.cloneElement)(e)})))}},1053:function(e,t,n){"use strict";var r,i;n.d(t,{z:function(){return r},c:function(){return i}}),function(e){e[e.Entering=0]="Entering",e[e.Present=1]="Present",e[e.Exiting=2]="Exiting"}(r||(r={})),function(e){e[e.Hide=0]="Hide",e[e.Show=1]="Show"}(i||(i={}))},8626:function(e,t,n){"use strict";n.d(t,{O:function(){return r}});var r=(0,n(7294).createContext)(null)},9870:function(e,t,n){"use strict";n.d(t,{bg:function(){return p},WH:function(){return h},Md:function(){return v}});var r=n(7294),i=n(1439),o=n(9839),a=n(8839),s=n(7565),l=n(519),u=n(1053),c={layoutReady:function(e){return e.notifyLayoutReady()}};function d(){var e=new Set;return{add:function(t){return e.add(t)},flush:function(t){var n=void 0===t?c:t,r=n.layoutReady,d=n.parent;(0,s.U)((function(t,n){var s=Array.from(e).sort(l._),c=d?(0,a.kv)(d):[];n((function(){(0,i.ev)((0,i.ev)([],(0,i.CR)(c)),(0,i.CR)(s)).forEach((function(e){return e.resetTransform()}))})),t((function(){s.forEach(a.de)})),n((function(){c.forEach((function(e){return e.restoreTransform()})),s.forEach(r)})),t((function(){s.forEach((function(e){e.isPresent&&(e.presence=u.z.Present)}))})),n((function(){o.iW.preRender(),o.iW.render()})),t((function(){o.ZP.postRender((function(){return s.forEach(f)})),e.clear()}))})),(0,s.R)()}}}function f(e){e.prevViewportBox=e.projection.target}var h=(0,r.createContext)(d()),p=(0,r.createContext)(d());function v(e){return!!e.forceUpdate}},7554:function(e,t,n){"use strict";n.d(t,{E:function(){return Oo}});var r=n(1439),i=n(7294),o=function(e){return{isEnabled:function(t){return e.some((function(e){return!!t[e]}))}}},a={measureLayout:o(["layout","layoutId","drag","_layoutResetTransform"]),animation:o(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag"]),exit:o(["exit"]),drag:o(["drag","dragControls"]),focus:o(["whileFocus"]),hover:o(["whileHover","onHoverStart","onHoverEnd"]),tap:o(["whileTap","onTap","onTapStart","onTapCancel"]),pan:o(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),layoutAnimation:o(["layout","layoutId"])};var s=(0,i.createContext)({strict:!1}),l=Object.keys(a),u=l.length;var c=(0,i.createContext)({transformPagePoint:function(e){return e},isStatic:!1}),d=(0,i.createContext)({});var f=n(8626),h=n(5930);function p(){var e=(0,i.useContext)(f.O);if(null===e)return[!0,null];var t=e.isPresent,n=e.onExitComplete,r=e.register,o=y();(0,i.useEffect)((function(){return r(o)}),[]);return!t&&n?[!1,function(){return null===n||void 0===n?void 0:n(o)}]:[!0]}function v(e){return null===e||e.isPresent}var m=0,g=function(){return m++},y=function(){return(0,h.h)(g)},b=(0,i.createContext)(null),w="undefined"!==typeof window,x=w?i.useLayoutEffect:i.useEffect;function E(e,t,n,o){var a=(0,i.useContext)(c),l=(0,i.useContext)(s),u=(0,i.useContext)(d).visualElement,h=(0,i.useContext)(f.O),p=function(e){var t=e.layoutId,n=(0,i.useContext)(b);return n&&void 0!==t?n+"-"+t:t}(n),m=(0,i.useRef)(void 0);o||(o=l.renderer),!m.current&&o&&(m.current=o(e,{visualState:t,parent:u,props:(0,r.pi)((0,r.pi)({},n),{layoutId:p}),presenceId:null===h||void 0===h?void 0:h.id,blockInitialAnimation:!1===(null===h||void 0===h?void 0:h.initial)}));var g=m.current;return x((function(){g&&(g.setProps((0,r.pi)((0,r.pi)((0,r.pi)({},a),n),{layoutId:p})),g.isPresent=v(h),g.isPresenceRoot=!u||u.presenceId!==(null===h||void 0===h?void 0:h.id),g.syncRender())})),(0,i.useEffect)((function(){var e;g&&(null===(e=g.animationState)||void 0===e||e.animateChanges())})),x((function(){return function(){return null===g||void 0===g?void 0:g.notifyUnmount()}}),[]),g}function k(e){return"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function T(e){return Array.isArray(e)}function _(e){return"string"===typeof e||T(e)}function O(e,t,n,r,i){var o;return void 0===r&&(r={}),void 0===i&&(i={}),"string"===typeof t&&(t=null===(o=e.variants)||void 0===o?void 0:o[t]),"function"===typeof t?t(null!==n&&void 0!==n?n:e.custom,r,i):t}function C(e,t,n){var r=e.getProps();return O(r,t,null!==n&&void 0!==n?n:r.custom,function(e){var t={};return e.forEachValue((function(e,n){return t[n]=e.get()})),t}(e),function(e){var t={};return e.forEachValue((function(e,n){return t[n]=e.getVelocity()})),t}(e))}function A(e){var t;return"function"===typeof(null===(t=e.animate)||void 0===t?void 0:t.start)||_(e.initial)||_(e.animate)||_(e.whileHover)||_(e.whileDrag)||_(e.whileTap)||_(e.whileFocus)||_(e.exit)}function S(e){return Boolean(A(e)||e.variants)}function P(e,t){var n=function(e,t){if(A(e)){var n=e.initial,r=e.animate;return{initial:!1===n||_(n)?n:void 0,animate:_(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,i.useContext)(d)),r=n.initial,o=n.animate;return(0,i.useMemo)((function(){return{initial:r,animate:o}}),t?[M(r),M(o)]:[])}function M(e){return Array.isArray(e)?e.join(" "):e}function R(e){var t=e.preloadedFeatures,n=e.createVisualElement,o=e.useRender,f=e.useVisualState,h=e.Component;return t&&function(e){for(var t in e){var n=e[t];null!==n&&(a[t].Component=n)}}(t),(0,i.forwardRef)((function(e,t){var p=(0,i.useContext)(c).isStatic,v=null,m=P(e,p),g=f(e,p);return!p&&w&&(m.visualElement=E(h,g,e,n),v=function(e,t,n){var o=[];if((0,i.useContext)(s),!t)return null;for(var c=0;c-1||/[A-Z]/.test(e))}var N={};var I=["","X","Y","Z"],z=["transformPerspective","x","y","z"];function H(e,t){return z.indexOf(e)-z.indexOf(t)}["translate","scale","rotate","skew"].forEach((function(e){return I.forEach((function(t){return z.push(e+t)}))}));var B=new Set(z);function F(e){return B.has(e)}var V=new Set(["originX","originY","originZ"]);function U(e){return V.has(e)}function G(e,t){var n=t.layout,r=t.layoutId;return F(e)||U(e)||(n||void 0!==r)&&(!!N[e]||"opacity"===e)}var q=function(e){return null!==e&&"object"===typeof e&&e.getVelocity},W={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function K(e){return e.startsWith("--")}var Z=function(e,t){return t&&"number"===typeof e?t.transform(e):e};var $=function(){return($=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?-1:1)*((r-o)*a)/s}):(t=function(e){return Math.exp(-e*i)*((e-l)*i+1)-.001},n=function(e){return Math.exp(-e*i)*(i*i*(l-e))});var f=function(e,t,n){for(var r=n,i=1;i<12;i++)r-=e(r)/t(r);return r}(t,n,5/i);if(i*=1e3,isNaN(f))return{stiffness:100,damping:10,duration:i};var h=Math.pow(f,2)*c;return{stiffness:h,damping:2*d*Math.sqrt(c*h),duration:i}}function _t(e,t){return e*Math.sqrt(1-t*t)}var Ot=["duration","bounce"],Ct=["stiffness","damping","mass"];function At(e,t){return t.some((function(t){return void 0!==e[t]}))}function St(e){var t=e.from,n=void 0===t?0:t,r=e.to,i=void 0===r?1:r,o=e.restSpeed,a=void 0===o?2:o,s=e.restDelta,l=xt(e,["from","to","restSpeed","restDelta"]),u={done:!1,value:n},c=function(e){var t=wt({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},e);if(!At(e,Ct)&&At(e,Ot)){var n=Tt(e);(t=wt(wt(wt({},t),n),{velocity:0,mass:1})).isResolvedFromDuration=!0}return t}(l),d=c.stiffness,f=c.damping,h=c.mass,p=c.velocity,v=c.duration,m=c.isResolvedFromDuration,g=Pt,y=Pt;function b(){var e=p?-p/1e3:0,t=i-n,r=f/(2*Math.sqrt(d*h)),o=Math.sqrt(d/h)/1e3;if(null!==s&&void 0!==s||(s=Math.abs(i-n)<=1?.01:.4),r<1){var a=_t(o,r);g=function(n){var s=Math.exp(-r*o*n);return i-s*((e+r*o*t)/a*Math.sin(a*n)+t*Math.cos(a*n))},y=function(n){var i=Math.exp(-r*o*n);return r*o*i*(Math.sin(a*n)*(e+r*o*t)/a+t*Math.cos(a*n))-i*(Math.cos(a*n)*(e+r*o*t)-a*t*Math.sin(a*n))}}else if(1===r)g=function(n){return i-Math.exp(-o*n)*(t+(e+o*t)*n)};else{var l=o*Math.sqrt(r*r-1);g=function(n){var a=Math.exp(-r*o*n),s=Math.min(l*n,300);return i-a*((e+r*o*t)*Math.sinh(s)+l*t*Math.cosh(s))/l}}}return b(),{next:function(e){var t=g(e);if(m)u.done=e>=v;else{var n=1e3*y(e),r=Math.abs(n)<=a,o=Math.abs(i-t)<=s;u.done=r&&o}return u.value=u.done?i:t,u},flipTarget:function(){var e;p=-p,n=(e=[i,n])[0],i=e[1],b()}}}St.needsInterpolation=function(e,t){return"string"===typeof e||"string"===typeof t};var Pt=function(e){return 0},Mt=function(e,t,n){var r=t-e;return 0===r?1:(n-e)/r},Rt=function(e,t,n){return-n*e+n*t+e},jt=function(e,t){return function(n){return Boolean(te(n)&&ee.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t))}},Dt=function(e,t,n){return function(r){var i;if(!te(r))return r;var o=r.match(Q),a=o[0],s=o[1],l=o[2],u=o[3];return(i={})[e]=parseFloat(a),i[t]=parseFloat(s),i[n]=parseFloat(l),i.alpha=void 0!==u?parseFloat(u):1,i}},Lt=X(0,255),Nt=$($({},ue),{transform:function(e){return Math.round(Lt(e))}}),It={test:jt("rgb","red"),parse:Dt("red","green","blue"),transform:function(e){var t=e.red,n=e.green,r=e.blue,i=e.alpha,o=void 0===i?1:i;return"rgba("+Nt.transform(t)+", "+Nt.transform(n)+", "+Nt.transform(r)+", "+Y(ce.transform(o))+")"}};var zt={test:jt("#"),parse:function(e){var t="",n="",r="",i="";return e.length>5?(t=e.substr(1,2),n=e.substr(3,2),r=e.substr(5,2),i=e.substr(7,2)):(t=e.substr(1,1),n=e.substr(2,1),r=e.substr(3,1),i=e.substr(4,1),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}},transform:It.transform},Ht={test:jt("hsl","hue"),parse:Dt("hue","saturation","lightness"),transform:function(e){var t=e.hue,n=e.saturation,r=e.lightness,i=e.alpha,o=void 0===i?1:i;return"hsla("+Math.round(t)+", "+ie.transform(Y(n))+", "+ie.transform(Y(r))+", "+Y(ce.transform(o))+")"}},Bt=function(e,t,n){var r=e*e,i=t*t;return Math.sqrt(Math.max(0,n*(i-r)+r))},Ft=[zt,It,Ht],Vt=function(e){return Ft.find((function(t){return t.test(e)}))},Ut=function(e){return"'"+e+"' is not an animatable color. Use the equivalent color code instead."},Gt=function(e,t){var n=Vt(e),r=Vt(t);Ut(e),Ut(t),n.transform,r.transform;var i=n.parse(e),o=r.parse(t),a=wt({},i),s=n===Ht?Rt:Bt;return function(e){for(var t in a)"alpha"!==t&&(a[t]=s(i[t],o[t],e));return a.alpha=Rt(i.alpha,o.alpha,e),n.transform(a)}},qt={test:function(e){return It.test(e)||zt.test(e)||Ht.test(e)},parse:function(e){return It.test(e)?It.parse(e):Ht.test(e)?Ht.parse(e):zt.parse(e)},transform:function(e){return te(e)?e:e.hasOwnProperty("red")?It.transform(e):Ht.transform(e)}},Wt="${c}",Kt="${n}";function Zt(e){var t=[],n=0,r=e.match(J);r&&(n=r.length,e=e.replace(J,Wt),t.push.apply(t,r.map(qt.parse)));var i=e.match(Q);return i&&(e=e.replace(Q,Kt),t.push.apply(t,i.map(ue.parse))),{values:t,numColors:n,tokenised:e}}function $t(e){return Zt(e).values}function Xt(e){var t=Zt(e),n=t.values,r=t.numColors,i=t.tokenised,o=n.length;return function(e){for(var t=i,n=0;n0},parse:$t,createTransformer:Xt,getAnimatableNone:function(e){var t=$t(e);return Xt(e)(t.map(Yt))}},Jt=function(e){return"number"===typeof e};function en(e,t){return Jt(e)?function(n){return Rt(e,t,n)}:qt.test(e)?Gt(e,t):on(e,t)}var tn=function(e,t){var n=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;ie[l-1]&&(e=[].concat(e),t=[].concat(t),e.reverse(),t.reverse());var u=sn(t,a,s),c=2===l?function(e,t){var n=e[0],r=e[1],i=t[0];return function(e){return i(Mt(n,r,e))}}(e,u):function(e,t){var n=e.length,r=n-1;return function(i){var o=0,a=!1;if(i<=e[0]?a=!0:i>=e[r]&&(o=r-1,a=!0),!a){for(var s=1;si||s===r);s++);o=s-1}var l=Mt(e[o],e[o+1],i);return t[o](l)}}(e,u);return o?function(t){return c(Et(e[0],e[l-1],t))}:c}var un,cn=function(e){return function(t){return 1-e(1-t)}},dn=function(e){return function(t){return t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2}},fn=function(e){return function(t){return t*t*((e+1)*t-e)}},hn=function(e){return e},pn=(un=2,function(e){return Math.pow(e,un)}),vn=cn(pn),mn=dn(pn),gn=function(e){return 1-Math.sin(Math.acos(e))},yn=cn(gn),bn=dn(yn),wn=fn(1.525),xn=cn(wn),En=dn(wn),kn=function(e){var t=fn(e);return function(e){return(e*=2)<1?.5*t(e):.5*(2-Math.pow(2,-10*(e-1)))}}(1.525),Tn=function(e){if(1===e||0===e)return e;var t=e*e;return e<.36363636363636365?7.5625*t:e<.7272727272727273?9.075*t-9.9*e+3.4:e<.9?12.066481994459833*t-19.63545706371191*e+8.898060941828255:10.8*e*e-20.52*e+10.72},_n=cn(Tn);function On(e,t){return e.map((function(){return t||mn})).splice(0,e.length-1)}function Cn(e){var t=e.from,n=void 0===t?0:t,r=e.to,i=void 0===r?1:r,o=e.ease,a=e.offset,s=e.duration,l=void 0===s?300:s,u={done:!1,value:n},c=Array.isArray(i)?i:[n,i],d=function(e,t){return e.map((function(e){return e*t}))}(a&&a.length===c.length?a:function(e){var t=e.length;return e.map((function(e,n){return 0!==n?n/(t-1):0}))}(c),l);function f(){return ln(d,c,{ease:Array.isArray(o)?o:On(c,o)})}var h=f();return{next:function(e){return u.value=h(e),u.done=e>=l,u},flipTarget:function(){c.reverse(),h=f()}}}var An={keyframes:Cn,spring:St,decay:function(e){var t=e.velocity,n=void 0===t?0:t,r=e.from,i=void 0===r?0:r,o=e.power,a=void 0===o?.8:o,s=e.timeConstant,l=void 0===s?350:s,u=e.restDelta,c=void 0===u?.5:u,d=e.modifyTarget,f={done:!1,value:i},h=a*n,p=i+h,v=void 0===d?p:d(p);return v!==p&&(h=v-i),{next:function(e){var t=-h*Math.exp(-e/l);return f.done=!(t>c||t<-c),f.value=f.done?v:v+t,f},flipTarget:function(){}}}};var Sn=n(9839);function Pn(e,t,n){return void 0===n&&(n=0),e-t-n}var Mn=function(e){var t=function(t){var n=t.delta;return e(n)};return{start:function(){return Sn.ZP.update(t,!0)},stop:function(){return Sn.qY.update(t)}}};function Rn(e){var t,n,r,i,o,a=e.from,s=e.autoplay,l=void 0===s||s,u=e.driver,c=void 0===u?Mn:u,d=e.elapsed,f=void 0===d?0:d,h=e.repeat,p=void 0===h?0:h,v=e.repeatType,m=void 0===v?"loop":v,g=e.repeatDelay,y=void 0===g?0:g,b=e.onPlay,w=e.onStop,x=e.onComplete,E=e.onRepeat,k=e.onUpdate,T=xt(e,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]),_=T.to,O=0,C=T.duration,A=!1,S=!0,P=function(e){if(Array.isArray(e.to))return Cn;if(An[e.type])return An[e.type];var t=new Set(Object.keys(e));return t.has("ease")||t.has("duration")&&!t.has("dampingRatio")?Cn:t.has("dampingRatio")||t.has("stiffness")||t.has("mass")||t.has("damping")||t.has("restSpeed")||t.has("restDelta")?St:Cn}(T);(null===(n=(t=P).needsInterpolation)||void 0===n?void 0:n.call(t,a,_))&&(o=ln([0,100],[a,_],{clamp:!1}),a=0,_=100);var M=P(wt(wt({},T),{from:a,to:_}));function R(){O++,"reverse"===m?f=function(e,t,n,r){return void 0===n&&(n=0),void 0===r&&(r=!0),r?Pn(t+-e,t,n):t-(e-t)+n}(f,C,y,S=O%2===0):(f=Pn(f,C,y),"mirror"===m&&M.flipTarget()),A=!1,E&&E()}function j(e){if(S||(e=-e),f+=e,!A){var t=M.next(Math.max(0,f));i=t.value,o&&(i=o(i)),A=S?t.done:f<=0}null===k||void 0===k||k(i),A&&(0===O&&(null!==C&&void 0!==C||(C=f)),O=t+n:e<=-n}(f,C,y,S)&&R():(r.stop(),x&&x()))}return l&&(null===b||void 0===b||b(),(r=c(j)).start()),{stop:function(){null===w||void 0===w||w(),r.stop()}}}function jn(e,t){return t?e*(1e3/t):0}var Dn=function(e){return 1e3*e},Ln=function(e,t){return 1-3*t+3*e},Nn=function(e,t){return 3*t-6*e},In=function(e){return 3*e},zn=function(e,t,n){return((Ln(t,n)*e+Nn(t,n))*e+In(t))*e},Hn=function(e,t,n){return 3*Ln(t,n)*e*e+2*Nn(t,n)*e+In(t)};var Bn=.1;function Fn(e,t,n,r){if(e===t&&n===r)return hn;for(var i=new Float32Array(11),o=0;o<11;++o)i[o]=zn(o*Bn,e,n);function a(t){for(var r=0,o=1;10!==o&&i[o]<=t;++o)r+=Bn;--o;var a=r+(t-i[o])/(i[o+1]-i[o])*Bn,s=Hn(a,e,n);return s>=.001?function(e,t,n,r){for(var i=0;i<8;++i){var o=Hn(t,n,r);if(0===o)return t;t-=(zn(t,n,r)-e)/o}return t}(t,a,e,n):0===s?a:function(e,t,n,r,i){var o,a,s=0;do{(o=zn(a=t+(n-t)/2,r,i)-e)>0?n=a:t=a}while(Math.abs(o)>1e-7&&++s<10);return a}(t,r,r+Bn,e,n)}return function(e){return 0===e||1===e?e:zn(a(e),t,r)}}var Vn={linear:hn,easeIn:pn,easeInOut:mn,easeOut:vn,circIn:gn,circInOut:bn,circOut:yn,backIn:wn,backInOut:En,backOut:xn,anticipate:kn,bounceIn:_n,bounceInOut:function(e){return e<.5?.5*(1-Tn(1-2*e)):.5*Tn(2*e-1)+.5},bounceOut:Tn},Un=function(e){if(Array.isArray(e)){e.length;var t=(0,r.CR)(e,4);return Fn(t[0],t[1],t[2],t[3])}return"string"===typeof e?Vn[e]:e},Gn=function(e,t){return"zIndex"!==e&&(!("number"!==typeof t&&!Array.isArray(t))||!("string"!==typeof t||!Qt.test(t)||t.startsWith("url(")))},qn=function(){return{type:"spring",stiffness:500,damping:25,restDelta:.5,restSpeed:10}},Wn=function(e){return{type:"spring",stiffness:550,damping:0===e?2*Math.sqrt(550):30,restDelta:.01,restSpeed:10}},Kn=function(){return{type:"keyframes",ease:"linear",duration:.3}},Zn=function(e){return{type:"keyframes",duration:.8,values:e}},$n={x:qn,y:qn,z:qn,rotate:qn,rotateX:qn,rotateY:qn,rotateZ:qn,scaleX:Wn,scaleY:Wn,scale:Wn,opacity:Kn,backgroundColor:Kn,color:Kn,default:Wn},Xn=new Set(["brightness","contrast","saturate","opacity"]);function Yn(e){var t=e.slice(0,-1).split("("),n=t[0],r=t[1];if("drop-shadow"===n)return e;var i=(r.match(Q)||[])[0];if(!i)return e;var o=r.replace(i,""),a=Xn.has(n)?1:0;return i!==r&&(a*=100),n+"("+a+o+")"}var Qn=/([a-z-]*)\(.*?\)/g,Jn=$($({},Qt),{getAnimatableNone:function(e){var t=e.match(Qn);return t?t.map(Yn).join(" "):e}}),er=(0,r.pi)((0,r.pi)({},he),{color:qt,backgroundColor:qt,outlineColor:qt,fill:qt,stroke:qt,borderColor:qt,borderTopColor:qt,borderRightColor:qt,borderBottomColor:qt,borderLeftColor:qt,filter:Jn,WebkitFilter:Jn}),tr=function(e){return er[e]};function nr(e,t){var n,r=tr(e);return r!==Jn&&(r=Qt),null===(n=r.getAnimatableNone)||void 0===n?void 0:n.call(r,t)}function rr(e){var t=e.ease,n=e.times,i=e.yoyo,o=e.flip,a=e.loop,s=(0,r._T)(e,["ease","times","yoyo","flip","loop"]),l=(0,r.pi)({},s);return n&&(l.offset=n),s.duration&&(l.duration=Dn(s.duration)),s.repeatDelay&&(l.repeatDelay=Dn(s.repeatDelay)),t&&(l.ease=function(e){return Array.isArray(e)&&"number"!==typeof e[0]}(t)?t.map(Un):Un(t)),"tween"===s.type&&(l.type="keyframes"),(i||a||o)&&(!0,i?l.repeatType="reverse":a?l.repeatType="loop":o&&(l.repeatType="mirror"),l.repeat=a||i||o||s.repeat),"spring"!==s.type&&(l.type="keyframes"),l}function ir(e,t,n){var i;return Array.isArray(t.to)&&(null!==(i=e.duration)&&void 0!==i||(e.duration=.8)),function(e){Array.isArray(e.to)&&null===e.to[0]&&(e.to=(0,r.ev)([],(0,r.CR)(e.to)),e.to[0]=e.from)}(t),function(e){e.when,e.delay,e.delayChildren,e.staggerChildren,e.staggerDirection,e.repeat,e.repeatType,e.repeatDelay,e.from;var t=(0,r._T)(e,["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from"]);return!!Object.keys(t).length}(e)||(e=(0,r.pi)((0,r.pi)({},e),function(e,t){var n;return n=He(t)?Zn:$n[e]||$n.default,(0,r.pi)({to:t},n(t))}(n,t.to))),(0,r.pi)((0,r.pi)({},t),rr(e))}function or(e,t,n,i,o){var a,s=lr(i,e),l=null!==(a=s.from)&&void 0!==a?a:t.get(),u=Gn(e,n);"none"===l&&u&&"string"===typeof n?l=nr(e,n):ar(l)&&"string"===typeof n?l=sr(n):!Array.isArray(n)&&ar(n)&&"string"===typeof l&&(n=sr(l));var c=Gn(e,l);return c&&u&&!1!==s.type?function(){var i={from:l,to:n,velocity:t.getVelocity(),onComplete:o,onUpdate:function(e){return t.set(e)}};return"inertia"===s.type||"decay"===s.type?function(e){var t,n=e.from,r=void 0===n?0:n,i=e.velocity,o=void 0===i?0:i,a=e.min,s=e.max,l=e.power,u=void 0===l?.8:l,c=e.timeConstant,d=void 0===c?750:c,f=e.bounceStiffness,h=void 0===f?500:f,p=e.bounceDamping,v=void 0===p?10:p,m=e.restDelta,g=void 0===m?1:m,y=e.modifyTarget,b=e.driver,w=e.onUpdate,x=e.onComplete;function E(e){return void 0!==a&&es}function k(e){return void 0===a?s:void 0===s||Math.abs(a-e)S||-1===P&&e-1&&e.splice(n,1)}var fr=function(){function e(){this.subscriptions=[]}return e.prototype.add=function(e){var t=this;return cr(this.subscriptions,e),function(){return dr(t.subscriptions,e)}},e.prototype.notify=function(e,t,n){var r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(var i=0;iv&&y,E=Array.isArray(g)?g:[g],k=E.reduce(a,{});!1===b&&(k={});var O=m.prevResolvedValues,C=void 0===O?{}:O,A=(0,r.pi)((0,r.pi)({},C),k),S=function(e){x=!0,h.delete(e),m.needsAnimating[e]=!0};for(var P in A){var M=k[P],R=C[P];p.hasOwnProperty(P)||(M!==R?He(M)&&He(R)?bt(M,R)?m.protectedKeys[P]=!0:S(P):void 0!==M?S(P):h.add(P):void 0!==M&&h.has(P)?S(P):m.protectedKeys[P]=!0)}m.prevProp=g,m.prevResolvedValues=k,m.isActive&&(p=(0,r.pi)((0,r.pi)({},p),k)),o&&e.blockInitialAnimation&&(x=!1),x&&!w&&f.push.apply(f,(0,r.ev)([],(0,r.CR)(E.map((function(e){return{animation:e,options:(0,r.pi)({type:i},s)}})))))},g=0;g=3;if(t||n){var o=e.point,a=(0,Sn.$B)().timestamp;i.history.push((0,r.pi)((0,r.pi)({},o),{timestamp:a}));var s=i.handlers,l=s.onStart,u=s.onMove;t||(l&&l(i.lastMoveEvent,e),i.startEvent=i.lastMoveEvent),u&&u(i.lastMoveEvent,e)}}},this.handlePointerMove=function(e,t){i.lastMoveEvent=e,i.lastMoveEventInfo=Hr(t,i.transformPagePoint),$e(e)&&0===e.buttons?i.handlePointerUp(e,t):Sn.ZP.update(i.updatePoint,!0)},this.handlePointerUp=function(e,t){i.end();var n=i.handlers,r=n.onEnd,o=n.onSessionEnd,a=Fr(Hr(t,i.transformPagePoint),i.history);i.startEvent&&r&&r(e,a),o&&o(e,a)},!(Xe(e)&&e.touches.length>1)){this.handlers=t,this.transformPagePoint=o;var a=Hr(et(e),this.transformPagePoint),s=a.point,l=(0,Sn.$B)().timestamp;this.history=[(0,r.pi)((0,r.pi)({},s),{timestamp:l})];var u=t.onSessionStart;u&&u(e,Fr(a,this.history)),this.removeListeners=mt(ot(window,"pointermove",this.handlePointerMove),ot(window,"pointerup",this.handlePointerUp),ot(window,"pointercancel",this.handlePointerUp))}}return e.prototype.updateHandlers=function(e){this.handlers=e},e.prototype.end=function(){this.removeListeners&&this.removeListeners(),Sn.qY.update(this.updatePoint)},e}();function Hr(e,t){return t?{point:t(e.point)}:e}function Br(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Fr(e,t){var n=e.point;return{point:n,delta:Br(n,Ur(t)),offset:Br(n,Vr(t)),velocity:Gr(t,.1)}}function Vr(e){return e[0]}function Ur(e){return e[e.length-1]}function Gr(e,t){if(e.length<2)return{x:0,y:0};for(var n=e.length-1,r=null,i=Ur(e);n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Dn(t)));)n--;if(!r)return{x:0,y:0};var o=(i.timestamp-r.timestamp)/1e3;if(0===o)return{x:0,y:0};var a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}var qr=n(3327);function Wr(e){return[e("x"),e("y")]}function Kr(e,t,n){var r=t.min,i=t.max;return void 0!==r&&ei&&(e=n?Rt(i,e,n.max):Math.min(e,i)),e}function Zr(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function $r(e,t){var n,i=t.min-e.min,o=t.max-e.max;return t.max-t.minr?n=Mt(t.min,t.max-r,e.min):r>i&&(n=Mt(e.min,e.max-i,t.min)),Et(0,1,n)}function ni(e,t,n,r){void 0===r&&(r=.5),e.origin=r,e.originPoint=Rt(t.min,t.max,e.origin),e.scale=ei(n)/ei(t),Jr(e.scale,1,1e-4)&&(e.scale=1),e.translate=Rt(n.min,n.max,e.origin)-e.originPoint,Jr(e.translate)&&(e.translate=0)}function ri(e,t,n,r){ni(e.x,t.x,n.x,ii(r.originX)),ni(e.y,t.y,n.y,ii(r.originY))}function ii(e){return"number"===typeof e?e:.5}function oi(e,t,n){e.min=n.min+t.min,e.max=e.min+ei(t)}var ai=n(8839);function si(e,t){return{min:t.min-e.min,max:t.max-e.min}}function li(e,t){return{x:si(e.x,t.x),y:si(e.y,t.y)}}function ui(e,t){var n=e.getLayoutId(),r=t.getLayoutId();return n!==r||void 0===r&&e!==t}function ci(e){var t=e.getProps(),n=t.drag,r=t._dragX;return n&&!r}function di(e,t){e.min=t.min,e.max=t.max}function fi(e,t,n){return n+t*(e-n)}function hi(e,t,n,r,i){return void 0!==i&&(e=fi(e,i,r)),fi(e,n,r)+t}function pi(e,t,n,r,i){void 0===t&&(t=0),void 0===n&&(n=1),e.min=hi(e.min,t,n,r,i),e.max=hi(e.max,t,n,r,i)}function vi(e,t){var n=t.x,r=t.y;pi(e.x,n.translate,n.scale,n.originPoint),pi(e.y,r.translate,r.scale,r.originPoint)}function mi(e,t,n,i){var o=(0,r.CR)(i,3),a=o[0],s=o[1],l=o[2];e.min=t.min,e.max=t.max;var u=void 0!==n[l]?n[l]:.5,c=Rt(t.min,t.max,u);pi(e,n[a],n[s],c,n.scale)}var gi=["x","scaleX","originX"],yi=["y","scaleY","originY"];function bi(e,t,n){mi(e.x,t.x,n,gi),mi(e.y,t.y,n,yi)}function wi(e,t,n,r,i){return e=fi(e-=t,1/n,r),void 0!==i&&(e=fi(e,1/i,r)),e}function xi(e,t,n){var i=(0,r.CR)(n,3),o=i[0],a=i[1],s=i[2];!function(e,t,n,r,i){void 0===t&&(t=0),void 0===n&&(n=1),void 0===r&&(r=.5);var o=Rt(e.min,e.max,r)-t;e.min=wi(e.min,t,n,o,i),e.max=wi(e.max,t,n,o,i)}(e,t[o],t[a],t[s],t.scale)}function Ei(e,t){xi(e.x,t,gi),xi(e.y,t,yi)}var ki,Ti=n(7565),_i=new WeakMap,Oi=function(){function e(e){var t=e.visualElement;this.isDragging=!1,this.currentDirection=null,this.constraints=!1,this.elastic=(0,qr.VZ)(),this.props={},this.hasMutatedConstraints=!1,this.cursorProgress={x:.5,y:.5},this.originPoint={},this.openGlobalLock=null,this.panSession=null,this.visualElement=t,this.visualElement.enableLayoutProjection(),_i.set(t,this)}return e.prototype.start=function(e,t){var n=this,i=void 0===t?{}:t,o=i.snapToCursor,a=void 0!==o&&o,s=i.cursorProgress,l=this.props.transformPagePoint;this.panSession=new zr(e,{onSessionStart:function(e){var t;n.stopMotion();var i=function(e){return et(e,"client")}(e).point;null===(t=n.cancelLayout)||void 0===t||t.call(n),n.cancelLayout=(0,Ti.U)((function(e,t){var o=(0,ai.kv)(n.visualElement),l=(0,ai.e3)(n.visualElement),u=(0,r.ev)((0,r.ev)([],(0,r.CR)(o)),(0,r.CR)(l)),c=!1;n.isLayoutDrag()&&n.visualElement.lockProjectionTarget(),t((function(){u.forEach((function(e){return e.resetTransform()}))})),e((function(){(0,ai.de)(n.visualElement),l.forEach(ai.de)})),t((function(){u.forEach((function(e){return e.restoreTransform()})),a&&(c=n.snapToCursor(i))})),e((function(){Boolean(n.getAxisMotionValue("x")&&!n.isExternalDrag())||n.visualElement.rebaseProjectionTarget(!0,n.visualElement.measureViewportBox(!1)),n.visualElement.scheduleUpdateLayoutProjection();var e=n.visualElement.projection;Wr((function(t){if(!c){var r=e.target[t],o=r.min,a=r.max;n.cursorProgress[t]=s?s[t]:Mt(o,a,i[t])}var l=n.getAxisMotionValue(t);l&&(n.originPoint[t]=l.get())}))})),t((function(){Sn.iW.update(),Sn.iW.preRender(),Sn.iW.render(),Sn.iW.postRender()})),e((function(){return n.resolveDragConstraints()}))}))},onStart:function(e,t){var r,i,o,a=n.props,s=a.drag,l=a.dragPropagation;(!s||l||(n.openGlobalLock&&n.openGlobalLock(),n.openGlobalLock=ct(s),n.openGlobalLock))&&((0,Ti.R)(),n.isDragging=!0,n.currentDirection=null,null===(i=(r=n.props).onDragStart)||void 0===i||i.call(r,e,t),null===(o=n.visualElement.animationState)||void 0===o||o.setActive(qe.Drag,!0))},onMove:function(e,t){var r,i,o,a,s=n.props,l=s.dragPropagation,u=s.dragDirectionLock;if(l||n.openGlobalLock){var c=t.offset;if(u&&null===n.currentDirection)return n.currentDirection=function(e,t){void 0===t&&(t=10);var n=null;Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x");return n}(c),void(null!==n.currentDirection&&(null===(i=(r=n.props).onDirectionLock)||void 0===i||i.call(r,n.currentDirection)));n.updateAxis("x",t.point,c),n.updateAxis("y",t.point,c),null===(a=(o=n.props).onDrag)||void 0===a||a.call(o,e,t),ki=e}},onSessionEnd:function(e,t){return n.stop(e,t)}},{transformPagePoint:l})},e.prototype.resolveDragConstraints=function(){var e=this,t=this.props,n=t.dragConstraints,r=t.dragElastic,i=this.visualElement.getLayoutState().layoutCorrected;this.constraints=!!n&&(k(n)?this.resolveRefConstraints(i,n):function(e,t){var n=t.top,r=t.left,i=t.bottom,o=t.right;return{x:Zr(e.x,r,o),y:Zr(e.y,n,i)}}(i,n)),this.elastic=function(e){return!1===e?e=0:!0===e&&(e=.35),{x:Xr(e,"left","right"),y:Xr(e,"top","bottom")}}(r),this.constraints&&!this.hasMutatedConstraints&&Wr((function(t){e.getAxisMotionValue(t)&&(e.constraints[t]=function(e,t){var n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(i[t],e.constraints[t]))}))},e.prototype.resolveRefConstraints=function(e,t){var n=this.props,r=n.onMeasureDragConstraints,i=n.transformPagePoint,o=t.current;this.constraintsBox=Qr(o,i);var a=function(e,t){return{x:$r(e.x,t.x),y:$r(e.y,t.y)}}(e,this.constraintsBox);if(r){var s=r((0,qr._6)(a));this.hasMutatedConstraints=!!s,s&&(a=(0,qr.RX)(s))}return a},e.prototype.cancelDrag=function(){var e,t;this.visualElement.unlockProjectionTarget(),null===(e=this.cancelLayout)||void 0===e||e.call(this),this.isDragging=!1,this.panSession&&this.panSession.end(),this.panSession=null,!this.props.dragPropagation&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),null===(t=this.visualElement.animationState)||void 0===t||t.setActive(qe.Drag,!1)},e.prototype.stop=function(e,t){var n,r,i;null===(n=this.panSession)||void 0===n||n.end(),this.panSession=null;var o=this.isDragging;if(this.cancelDrag(),o){var a=t.velocity;this.animateDragEnd(a),null===(i=(r=this.props).onDragEnd)||void 0===i||i.call(r,e,t)}},e.prototype.snapToCursor=function(e){var t=this;return Wr((function(n){if(Ci(n,t.props.drag,t.currentDirection)){var r=t.getAxisMotionValue(n);if(!r)return t.cursorProgress[n]=.5,!0;var i=t.visualElement.getLayoutState().layout,o=i[n].max-i[n].min,a=i[n].min+o/2,s=e[n]-a;t.originPoint[n]=e[n],r.set(s)}})).includes(!0)},e.prototype.updateAxis=function(e,t,n){if(Ci(e,this.props.drag,this.currentDirection))return this.getAxisMotionValue(e)?this.updateAxisMotionValue(e,n):this.updateVisualElementAxis(e,t)},e.prototype.updateAxisMotionValue=function(e,t){var n=this.getAxisMotionValue(e);if(t&&n){var r=this.originPoint[e]+t[e],i=this.constraints?Kr(r,this.constraints[e],this.elastic[e]):r;n.set(i)}},e.prototype.updateVisualElementAxis=function(e,t){var n,r=this.visualElement.getLayoutState().layout[e],i=r.max-r.min,o=this.cursorProgress[e],a=function(e,t,n,r,i){var o=e-t*n;return r?Kr(o,r,i):o}(t[e],i,o,null===(n=this.constraints)||void 0===n?void 0:n[e],this.elastic[e]);this.visualElement.setProjectionTargetAxis(e,a,a+i)},e.prototype.setProps=function(e){var t=e.drag,n=void 0!==t&&t,i=e.dragDirectionLock,o=void 0!==i&&i,a=e.dragPropagation,s=void 0!==a&&a,l=e.dragConstraints,u=void 0!==l&&l,c=e.dragElastic,d=void 0===c?.35:c,f=e.dragMomentum,h=void 0===f||f,p=(0,r._T)(e,["drag","dragDirectionLock","dragPropagation","dragConstraints","dragElastic","dragMomentum"]);this.props=(0,r.pi)({drag:n,dragDirectionLock:o,dragPropagation:s,dragConstraints:u,dragElastic:d,dragMomentum:h},p)},e.prototype.getAxisMotionValue=function(e){var t=this.props,n=t.layout,r=t.layoutId,i="_drag"+e.toUpperCase();return this.props[i]?this.props[i]:n||void 0!==r?void 0:this.visualElement.getValue(e,0)},e.prototype.isLayoutDrag=function(){return!this.getAxisMotionValue("x")},e.prototype.isExternalDrag=function(){var e=this.props,t=e._dragX,n=e._dragY;return t||n},e.prototype.animateDragEnd=function(e){var t=this,n=this.props,i=n.drag,o=n.dragMomentum,a=n.dragElastic,s=n.dragTransition,l=function(e,t){void 0===t&&(t=!0);var n,r=e.getProjectionParent();return!!r&&(t?Ei(n=li(r.projection.target,e.projection.target),r.getLatestValues()):n=li(r.getLayoutState().layout,e.getLayoutState().layout),Wr((function(t){return e.setProjectionTargetAxis(t,n[t].min,n[t].max,!0)})),!0)}(this.visualElement,this.isLayoutDrag()&&!this.isExternalDrag()),u=this.constraints||{};if(l&&Object.keys(u).length&&this.isLayoutDrag()){var c=this.visualElement.getProjectionParent();if(c){var d=li(c.projection.targetFinal,u);Wr((function(e){var t=d[e],n=t.min,r=t.max;u[e]={min:isNaN(n)?void 0:n,max:isNaN(r)?void 0:r}}))}}var f=Wr((function(n){var c;if(Ci(n,i,t.currentDirection)){var d=null!==(c=null===u||void 0===u?void 0:u[n])&&void 0!==c?c:{},f=a?200:1e6,h=a?40:1e7,p=(0,r.pi)((0,r.pi)({type:"inertia",velocity:o?e[n]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10},s),d);return t.getAxisMotionValue(n)?t.startAxisValueAnimation(n,p):t.visualElement.startLayoutAnimation(n,p,l)}}));return Promise.all(f).then((function(){var e,n;null===(n=(e=t.props).onDragTransitionEnd)||void 0===n||n.call(e)}))},e.prototype.stopMotion=function(){var e=this;Wr((function(t){var n=e.getAxisMotionValue(t);n?n.stop():e.visualElement.stopLayoutAnimation()}))},e.prototype.startAxisValueAnimation=function(e,t){var n=this.getAxisMotionValue(e);if(n){var r=n.get();return n.set(r),n.set(r),ur(e,n,0,t)}},e.prototype.scalePoint=function(){var e=this,t=this.props,n=t.drag;if(k(t.dragConstraints)&&this.constraintsBox){this.stopMotion();var r={x:0,y:0};Wr((function(t){r[t]=ti(e.visualElement.projection.target[t],e.constraintsBox[t])})),this.updateConstraints((function(){Wr((function(t){if(Ci(t,n,null)){var i=function(e,t,n){var r=e.max-e.min,i=Rt(t.min,t.max-r,n);return{min:i,max:i+r}}(e.visualElement.projection.target[t],e.constraintsBox[t],r[t]),o=i.min,a=i.max;e.visualElement.setProjectionTargetAxis(t,o,a)}}))})),setTimeout(Ti.R,1)}},e.prototype.updateConstraints=function(e){var t=this;this.cancelLayout=(0,Ti.U)((function(n,r){var i=(0,ai.kv)(t.visualElement);r((function(){return i.forEach((function(e){return e.resetTransform()}))})),n((function(){return(0,ai.de)(t.visualElement)})),r((function(){return i.forEach((function(e){return e.restoreTransform()}))})),n((function(){t.resolveDragConstraints()})),e&&r(e)}))},e.prototype.mount=function(e){var t=this,n=ot(e.getInstance(),"pointerdown",(function(e){var n=t.props,r=n.drag,i=n.dragListener;r&&(void 0===i||i)&&t.start(e)})),r=Ke(window,"resize",(function(){t.scalePoint()})),i=e.onLayoutUpdate((function(){t.isDragging&&t.resolveDragConstraints()})),o=e.prevDragCursor;return o&&this.start(ki,{cursorProgress:o}),function(){null===n||void 0===n||n(),null===r||void 0===r||r(),null===i||void 0===i||i(),t.cancelDrag()}},e}();function Ci(e,t,n){return(!0===t||t===e)&&(null===n||n===e)}var Ai={pan:gt((function(e){var t=e.onPan,n=e.onPanStart,r=e.onPanEnd,o=e.onPanSessionStart,a=e.visualElement,s=t||n||r||o,l=(0,i.useRef)(null),u=(0,i.useContext)(c).transformPagePoint,d={onSessionStart:o,onStart:n,onMove:t,onEnd:function(e,t){l.current=null,r&&r(e,t)}};(0,i.useEffect)((function(){null!==l.current&&l.current.updateHandlers(d)})),at(a,"pointerdown",s&&function(e){l.current=new zr(e,d,{transformPagePoint:u})}),(0,pt.z)((function(){return l.current&&l.current.end()}))})),drag:gt((function(e){var t=e.dragControls,n=e.visualElement,o=(0,i.useContext)(c).transformPagePoint,a=(0,h.h)((function(){return new Oi({visualElement:n})}));a.setProps((0,r.pi)((0,r.pi)({},e),{transformPagePoint:o})),(0,i.useEffect)((function(){return t&&t.subscribe(a)}),[a]),(0,i.useEffect)((function(){return a.mount(n)}),[])}))},Si=n(1053);function Pi(e){return"string"===typeof e&&e.startsWith("var(--")}var Mi=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ri(e,t,n){void 0===n&&(n=1);var i=(0,r.CR)(function(e){var t=Mi.exec(e);if(!t)return[,];var n=(0,r.CR)(t,3);return[n[1],n[2]]}(e),2),o=i[0],a=i[1];if(o){var s=window.getComputedStyle(t).getPropertyValue(o);return s?s.trim():Pi(a)?Ri(a,t,n+1):a}}function ji(e,t){return e/(t.max-t.min)*100}var Di="_$css";var Li={process:function(e,t,n){var r=n.target;if("string"===typeof e){if(!oe.test(e))return e;e=parseFloat(e)}return ji(e,r.x)+"% "+ji(e,r.y)+"%"}},Ni={borderRadius:(0,r.pi)((0,r.pi)({},Li),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:Li,borderTopRightRadius:Li,borderBottomLeftRadius:Li,borderBottomRightRadius:Li,boxShadow:{process:function(e,t){var n=t.delta,r=t.treeScale,i=e,o=e.includes("var("),a=[];o&&(e=e.replace(Mi,(function(e){return a.push(e),Di})));var s=Qt.parse(e);if(s.length>5)return i;var l=Qt.createTransformer(e),u="number"!==typeof s[0]?1:0,c=n.x.scale*r.x,d=n.y.scale*r.y;s[0+u]/=c,s[1+u]/=d;var f=Rt(c,d,.5);"number"===typeof s[2+u]&&(s[2+u]/=f),"number"===typeof s[3+u]&&(s[3+u]/=f);var h=l(s);if(o){var p=0;h=h.replace(Di,(function(){var e=a[p];return p++,e}))}return h}}},Ii=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.frameTarget=(0,qr.VZ)(),t.currentAnimationTarget=(0,qr.VZ)(),t.isAnimating={x:!1,y:!1},t.stopAxisAnimation={x:void 0,y:void 0},t.isAnimatingTree=!1,t.animate=function(e,n,i){void 0===i&&(i={});var o=i.originBox,a=i.targetBox,s=i.visibilityAction,l=i.shouldStackAnimate,u=i.onComplete,c=i.prevParent,d=(0,r._T)(i,["originBox","targetBox","visibilityAction","shouldStackAnimate","onComplete","prevParent"]),f=t.props,h=f.visualElement,p=f.layout;if(!1===l)return t.isAnimatingTree=!1,t.safeToRemove();if(!t.isAnimatingTree||!0===l){l&&(t.isAnimatingTree=!0),n=o||n,e=a||e;var v=!1,m=h.getProjectionParent();if(m){var g=m.prevViewportBox,y=m.getLayoutState().layout;c&&(a&&(y=c.getLayoutState().layout),o&&!ui(c,m)&&c.prevViewportBox&&(g=c.prevViewportBox)),g&&Ui(c,o,a)&&(v=!0,n=li(g,n),e=li(y,e))}var b=zi(n,e),w=Wr((function(i){var o,a;if("position"===p){var l=e[i].max-e[i].min;n[i].max=n[i].min+l}if(!h.projection.isTargetLocked)return void 0===s?b?t.animateAxis(i,e[i],n[i],(0,r.pi)((0,r.pi)({},d),{isRelative:v})):(null===(a=(o=t.stopAxisAnimation)[i])||void 0===a||a.call(o),h.setProjectionTargetAxis(i,e[i].min,e[i].max,v)):void h.setVisibility(s===Si.c.Show)}));return h.syncRender(),Promise.all(w).then((function(){t.isAnimatingTree=!1,u&&u(),h.notifyLayoutAnimationComplete()}))}},t}return(0,r.ZT)(t,e),t.prototype.componentDidMount=function(){var e=this,t=this.props.visualElement;t.animateMotionValue=ur,t.enableLayoutProjection(),this.unsubLayoutReady=t.onLayoutUpdate(this.animate),t.layoutSafeToRemove=function(){return e.safeToRemove()},function(e){for(var t in e)N[t]=e[t]}(Ni)},t.prototype.componentWillUnmount=function(){var e=this;this.unsubLayoutReady(),Wr((function(t){var n,r;return null===(r=(n=e.stopAxisAnimation)[t])||void 0===r?void 0:r.call(n)}))},t.prototype.animateAxis=function(e,t,n,r){var i,o,a=this,s=void 0===r?{}:r,l=s.transition,u=s.isRelative;if(!this.isAnimating[e]||!Fi(t,this.currentAnimationTarget[e])){null===(o=(i=this.stopAxisAnimation)[e])||void 0===o||o.call(i),this.isAnimating[e]=!0;var c=this.props.visualElement,d=this.frameTarget[e],f=c.getProjectionAnimationProgress()[e];f.clearListeners(),f.set(0),f.set(0);var h=function(){var r=f.get()/1e3;!function(e,t,n,r){e.min=Rt(t.min,n.min,r),e.max=Rt(t.max,n.max,r)}(d,n,t,r),c.setProjectionTargetAxis(e,d.min,d.max,u)};h();var p=f.onChange(h);this.stopAxisAnimation[e]=function(){a.isAnimating[e]=!1,f.stop(),p()},this.currentAnimationTarget[e]=t;var v=l||c.getDefaultTransition()||Vi;return ur("x"===e?"layoutX":"layoutY",f,1e3,v&&lr(v,"layout")).then(this.stopAxisAnimation[e])}},t.prototype.safeToRemove=function(){var e,t;null===(t=(e=this.props).safeToRemove)||void 0===t||t.call(e)},t.prototype.render=function(){return null},t}(i.Component);function zi(e,t){return!Bi(e)&&!Bi(t)&&(!Fi(e.x,t.x)||!Fi(e.y,t.y))}var Hi={min:0,max:0};function Bi(e){return Fi(e.x,Hi)&&Fi(e.y,Hi)}function Fi(e,t){return e.min===t.min&&e.max===t.max}var Vi={duration:.45,ease:[.4,0,.1,1]};function Ui(e,t,n){return e||!e&&!(t||n)}var Gi=n(9870),qi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,r.ZT)(t,e),t.prototype.componentDidMount=function(){var e=this.props,t=e.syncLayout,n=e.framerSyncLayout,r=e.visualElement;(0,Gi.Md)(t)&&t.register(r),(0,Gi.Md)(n)&&n.register(r),r.onUnmount((function(){(0,Gi.Md)(t)&&t.remove(r),(0,Gi.Md)(n)&&n.remove(r)}))},t.prototype.getSnapshotBeforeUpdate=function(){var e=this.props,t=e.syncLayout,n=e.visualElement;return(0,Gi.Md)(t)?t.syncUpdate():((0,ai.x7)(n),t.add(n)),null},t.prototype.componentDidUpdate=function(){var e=this.props.syncLayout;(0,Gi.Md)(e)||e.flush()},t.prototype.render=function(){return null},t}(i.Component);var Wi={measureLayout:function(e){var t=(0,i.useContext)(Gi.WH),n=(0,i.useContext)(Gi.bg);return i.createElement(qi,(0,r.pi)({},e,{syncLayout:t,framerSyncLayout:n}))},layoutAnimation:function(e){var t=(0,r.CR)(p(),2)[1];return i.createElement(Ii,(0,r.pi)({},e,{safeToRemove:t}))}};function Ki(){return{isHydrated:!1,layout:(0,qr.VZ)(),layoutCorrected:(0,qr.VZ)(),treeScale:{x:1,y:1},delta:(0,qr.pY)(),deltaFinal:(0,qr.pY)(),deltaTransform:""}}var Zi=Ki();function $i(e,t,n){var r=e.x,i=e.y,o="translate3d("+r.translate/t.x+"px, "+i.translate/t.y+"px, 0) ";if(n){var a=n.rotate,s=n.rotateX,l=n.rotateY;a&&(o+="rotate("+a+") "),s&&(o+="rotateX("+s+") "),l&&(o+="rotateY("+l+") ")}return o+="scale("+r.scale+", "+i.scale+")",n||o!==Yi?o:""}function Xi(e){var t=e.deltaFinal;return 100*t.x.origin+"% "+100*t.y.origin+"% 0"}var Yi=$i(Zi.delta,Zi.treeScale,{x:1,y:1}),Qi=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","SetAxisTarget","Unmount"];function Ji(e,t,n,r){var i,o,a=e.delta,s=e.layout,l=e.layoutCorrected,u=e.treeScale,c=t.target;o=s,di((i=l).x,o.x),di(i.y,o.y),function(e,t,n){var r=n.length;if(r){var i,o;t.x=t.y=1;for(var a=0;a=0;t--){var n=Y.path[t];if(n.projection.isEnabled){e=n;break}}x=e}return x},resolveRelativeTargetBox:function(){var e=Y.getProjectionParent();if(R.relativeTarget&&e&&(function(e,t){oi(e.target.x,e.relativeTarget.x,t.target.x),oi(e.target.y,e.relativeTarget.y,t.target.y)}(R,e.projection),ci(e))){var t=R.target;bi(t,t,e.getLatestValues())}},shouldResetTransform:function(){return Boolean(m._layoutResetTransform)},pointTo:function(e){j=e.projection,D=e.getLatestValues(),null===E||void 0===E||E(),E=mt(e.onSetAxisTarget(Y.scheduleUpdateLayoutProjection),e.onLayoutAnimationComplete((function(){var e;Y.isPresent?Y.presence=Si.z.Present:null===(e=Y.layoutSafeToRemove)||void 0===e||e.call(Y)})))},isPresent:!0,presence:Si.z.Entering});return Y}};function ro(e){e.resolveRelativeTargetBox()}function io(e){e.updateLayoutProjection()}var oo,ao=(0,r.ev)(["initial"],(0,r.CR)(Cr)),so=ao.length,lo=new Set(["width","height","top","left","right","bottom","x","y"]),uo=function(e){return lo.has(e)},co=function(e,t){e.set(t,!1),e.set(t)},fo=function(e){return e===ue||e===oe};!function(e){e.width="width",e.height="height",e.left="left",e.right="right",e.top="top",e.bottom="bottom"}(oo||(oo={}));var ho=function(e,t){return parseFloat(e.split(", ")[t])},po=function(e,t){return function(n,r){var i=r.transform;if("none"===i||!i)return 0;var o=i.match(/^matrix3d\((.+)\)$/);if(o)return ho(o[1],t);var a=i.match(/^matrix\((.+)\)$/);return a?ho(a[1],e):0}},vo=new Set(["x","y","z"]),mo=z.filter((function(e){return!vo.has(e)}));var go={width:function(e){var t=e.x;return t.max-t.min},height:function(e){var t=e.y;return t.max-t.min},top:function(e,t){var n=t.top;return parseFloat(n)},left:function(e,t){var n=t.left;return parseFloat(n)},bottom:function(e,t){var n=e.y,r=t.top;return parseFloat(r)+(n.max-n.min)},right:function(e,t){var n=e.x,r=t.left;return parseFloat(r)+(n.max-n.min)},x:po(4,13),y:po(5,14)},yo=function(e,t,n,i){void 0===n&&(n={}),void 0===i&&(i={}),t=(0,r.pi)({},t),i=(0,r.pi)({},i);var o=Object.keys(t).filter(uo),a=[],s=!1,l=[];if(o.forEach((function(r){var o=e.getValue(r);if(e.hasValue(r)){var u,c=n[r],d=t[r],f=gr(c);if(He(d))for(var h=d.length,p=null===d[0]?1:0;p0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i(e[t]=n,e)),{})}},1527:function(e,t){"use strict";function n(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"===typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=(t instanceof Array?t.length?t:[void 0]:[t]).map((function(e){return{keyAccessor:e,isProp:!(e instanceof Function)}})),u=e.reduce((function(e,t){var r=e,i=t;return l.forEach((function(e,t){var a,u=e.keyAccessor;if(e.isProp){var c=i,d=c[u],f=n(c,[u].map(s));a=d,i=f}else a=u(i,t);t+11&&void 0!==arguments[1]?arguments[1]:1;n===l.length?Object.keys(t).forEach((function(e){return t[e]=o(t[e])})):Object.values(t).forEach((function(t){return e(t,n+1)}))}(u);var c=u;return a&&(c=[],function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n.length===l.length?c.push({keys:n,vals:t}):Object.entries(t).forEach((function(t){var o=r(t,2),a=o[0],s=o[1];return e(s,[].concat(i(n),[a]))}))}(u),t instanceof Array&&0===t.length&&1===c.length&&(c[0].keys=[])),c}},4858:function(e,t,n){"use strict";var r=n(296),i=n.n(r);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},n instanceof Function?n(e):n,{initialised:!1}),r={};function a(t){return s(t,e),l(),a}var s=function(e,n){h.call(a,e,t,n),t.initialised=!0},l=i()((function(){t.initialised&&(v.call(a,t,r),r={})}),1);return m.forEach((function(e){a[e.name]=function(e){var n=e.name,i=e.triggerUpdate,o=void 0!==i&&i,s=e.onChange,u=void 0===s?function(e,t){}:s,c=e.defaultVal,d=void 0===c?null:c;return function(e){var i=t[n];if(!arguments.length)return i;var s=void 0===e?d:e;return t[n]=s,u.call(a,s,t,i),!r.hasOwnProperty(n)&&(r[n]=i),o&&l(),a}}(e)})),Object.keys(u).forEach((function(e){a[e]=function(){for(var n,r=arguments.length,i=new Array(r),o=0;o=t||n<0||f&&e-c>=a}function E(){var e=v();if(x(e))return k(e);l=setTimeout(E,function(e){var n=t-(e-u);return f?p(n,a-(e-c)):n}(e))}function k(e){return l=void 0,m&&i?b(e):(i=o=void 0,s)}function T(){var e=v(),n=x(e);if(i=arguments,o=this,u=e,n){if(void 0===l)return w(u);if(f)return l=setTimeout(E,t),b(u)}return void 0===l&&(l=setTimeout(E,t)),s}return t=y(t)||0,g(n)&&(d=!!n.leading,a=(f="maxWait"in n)?h(y(n.maxWait)||0,t):a,m="trailing"in n?!!n.trailing:m),T.cancel=function(){void 0!==l&&clearTimeout(l),c=0,i=u=o=l=void 0},T.flush=function(){return void 0===l?s:k(v())},T}function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function y(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==f.call(e)}(e))return NaN;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=a.test(e);return n||s.test(e)?l(e.slice(2),n?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError(r);return g(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),m(e,t,{leading:i,maxWait:t,trailing:o})}},3752:function(e,t,n){"use strict";function r(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=a)&&(n=a)}}catch(d){o.e(d)}finally{o.f()}}else{var s,l=-1,u=r(e);try{for(u.s();!(s=u.n()).done;){var c=s.value;null!=(c=t(c,++l,e))&&(n=c)&&(n=c)}}catch(d){u.e(d)}finally{u.f()}}return n}n.d(t,{Z:function(){return o}})},6701:function(e,t,n){"use strict";function r(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);na||void 0===n&&a>=a)&&(n=a)}}catch(d){o.e(d)}finally{o.f()}}else{var s,l=-1,u=r(e);try{for(u.s();!(s=u.n()).done;){var c=s.value;null!=(c=t(c,++l,e))&&(n>c||void 0===n&&c>=c)&&(n=c)}}catch(d){u.e(d)}finally{u.f()}}return n}n.d(t,{Z:function(){return o}})},4275:function(e,t,n){"use strict";function r(e,t,n){if(isNaN(t))return e;var r,i,o,a,s,l,u=e._root,c={data:n},d=e._x0,f=e._x1;if(!u)return e._root=c,e;for(;u.length;)if((a=t>=(i=(d+f)/2))?d=i:f=i,r=u,!(u=u[s=+a]))return r[s]=c,e;if(t===(o=+e._x.call(null,u.data)))return c.next=u,r?r[s]=c:e._root=c,e;do{r=r?r[s]=new Array(2):e._root=new Array(2),(a=t>=(i=(d+f)/2))?d=i:f=i}while((s=+a)===(l=+(o>=i)));return r[l]=u,r[s]=c,e}function i(e,t,n){this.node=e,this.x0=t,this.x1=n}function o(e){return e[0]}function a(e,t){var n=new s(null==t?o:t,NaN,NaN);return null==e?n:n.addAll(e)}function s(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function l(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}n.d(t,{Z:function(){return a}});var u=a.prototype=s.prototype;u.copy=function(){var e,t,n=new s(this._x,this._x0,this._x1),r=this._root;if(!r)return n;if(!r.length)return n._root=l(r),n;for(e=[{source:r,target:n._root=new Array(2)}];r=e.pop();)for(var i=0;i<2;++i)(t=r.source[i])&&(t.length?e.push({source:t,target:r.target[i]=new Array(2)}):r.target[i]=l(t));return n},u.add=function(e){var t=+this._x.call(null,e);return r(this.cover(t),t,e)},u.addAll=function(e){var t,n,i=e.length,o=new Array(i),a=1/0,s=-1/0;for(t=0;ts&&(s=n));if(a>s)return this;for(this.cover(a).cover(s),t=0;te||e>=n;)switch(i=+(eu||(o=a.x1)=f))&&(a=c[c.length-1],c[c.length-1]=c[c.length-1-s],c[c.length-1-s]=a)}else{var h=Math.abs(e-+this._x.call(null,d.data));h=(a=(d+f)/2))?d=a:f=a,t=c,!(c=c[l=+s]))return this;if(!c.length)break;t[l+1&1]&&(n=t,u=l)}for(;c.data!==e;)if(r=c,!(c=c.next))return this;return(i=c.next)&&delete c.next,r?(i?r.next=i:delete r.next,this):t?(i?t[l]=i:delete t[l],(c=t[0]||t[1])&&c===(t[1]||t[0])&&!c.length&&(n?n[u]=c:this._root=c),this):(this._root=i,this)},u.removeAll=function(e){for(var t=0,n=e.length;t=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function a(e,t){for(var n,r=0,i=e.length;r0)for(var n,r,i=new Array(n),o=0;o1&&(y=f.y+f.vy-u.y-u.vy||(0,i.Z)(d)),l>2&&(b=f.z+f.vz-u.z-u.vz||(0,i.Z)(d)),g*=h=((h=Math.sqrt(g*g+y*y+b*b))-n[m])/h*r*t[m],y*=h,b*=h,f.vx-=g*(p=c[m]),l>1&&(f.vy-=y*p),l>2&&(f.vz-=b*p),u.vx+=g*(p=1-p),l>1&&(u.vy+=y*p),l>2&&(u.vz+=b*p)}function g(){if(s){var r,i,o=s.length,l=e.length,d=new Map(s.map((function(e,t){return[f(e,t,s),e]})));for(r=0,u=new Array(o);r1?t-1:0),r=1;r1&&(e.y=o/u),t>2&&(e.z=a/u)}else{(n=e).x=n.data.x,t>1&&(n.y=n.data.y),t>2&&(n.z=n.data.z);do{l+=d[n.data.index]}while(n=n.next)}e.value=l}function b(e,r,i,o,a){if(!e.value)return!0;var l=[i,o,a][t-1],f=e.x-n.x,m=t>1?e.y-n.y:0,g=t>2?e.z-n.z:0,y=l-r,b=f*f+m*m+g*g;if(y*y/v1&&0===m&&(b+=(m=(0,s.Z)(u))*m),t>2&&0===g&&(b+=(g=(0,s.Z)(u))*g),b1&&(n.vy+=m*e.value*c/b),t>2&&(n.vz+=g*e.value*c/b)),!0;if(!(e.length||b>=p)){(e.data!==n||e.next)&&(0===f&&(b+=(f=(0,s.Z)(u))*f),t>1&&0===m&&(b+=(m=(0,s.Z)(u))*m),t>2&&0===g&&(b+=(g=(0,s.Z)(u))*g),b1&&(n.vy+=m*y),t>2&&(n.vz+=g*y))}while(e=e.next)}}return m.initialize=function(n){e=n;for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o1&&(c.vy+=f*v),a>2&&(c.vz+=h*v)}}function d(){if(o){var t,n=o.length;for(s=new Array(n),l=new Array(n),t=0;t1?t-1:0),r=1;r1&&(null==i.fy?i.y+=i.vy*=h:(i.y=i.fy,i.vy=0)),a>2&&(null==i.fz?i.z+=i.vz*=h:(i.z=i.fz,i.vz=0));return n}function w(){for(var t,n=0,r=e.length;n1&&isNaN(t.y)||a>2&&isNaN(t.z)){var i=10*(a>2?Math.cbrt(.5+n):a>1?Math.sqrt(.5+n):n),o=n*u,s=n*c;1===a?t.x=i:2===a?(t.x=i*Math.cos(o),t.y=i*Math.sin(o)):(t.x=i*Math.sin(o)*Math.cos(s),t.y=i*Math.cos(o),t.z=i*Math.sin(o)*Math.sin(s))}(isNaN(t.vx)||a>1&&isNaN(t.vy)||a>2&&isNaN(t.vz))&&(t.vx=0,a>1&&(t.vy=0),a>2&&(t.vz=0))}}function x(t){return t.initialize&&t.initialize(e,g,a),t}return null==e&&(e=[]),w(),n={tick:b,restart:function(){return v.restart(y),n},stop:function(){return v.stop(),n},numDimensions:function(e){return arguments.length?(a=Math.min(3,Math.max(1,Math.round(e))),p.forEach(x),n):a},nodes:function(t){return arguments.length?(e=t,w(),p.forEach(x),n):e},alpha:function(e){return arguments.length?(s=+e,n):s},alphaMin:function(e){return arguments.length?(l=+e,n):l},alphaDecay:function(e){return arguments.length?(d=+e,n):+d},alphaTarget:function(e){return arguments.length?(f=+e,n):f},velocityDecay:function(e){return arguments.length?(h=1-e,n):1-h},randomSource:function(e){return arguments.length?(g=e,p.forEach(x),n):g},force:function(e,t){return arguments.length>1?(null==t?p.delete(e):p.set(e,x(t)),n):p.get(e)},find:function(){var t,n,r,i,o,s,l=Array.prototype.slice.call(arguments),u=l.shift()||0,c=(a>1?l.shift():null)||0,d=(a>2?l.shift():null)||0,f=l.shift()||1/0,h=0,p=e.length;for(f*=f,h=0;h1?(m.on(e,t),n):m.on(e)}}}},8357:function(e,t,n){"use strict";function r(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var o,a,s,l,u,c,d,f,h,p,v,m,g=e._root,y={data:i},b=e._x0,w=e._y0,x=e._z0,E=e._x1,k=e._y1,T=e._z1;if(!g)return e._root=y,e;for(;g.length;)if((f=t>=(a=(b+E)/2))?b=a:E=a,(h=n>=(s=(w+k)/2))?w=s:k=s,(p=r>=(l=(x+T)/2))?x=l:T=l,o=g,!(g=g[v=p<<2|h<<1|f]))return o[v]=y,e;if(u=+e._x.call(null,g.data),c=+e._y.call(null,g.data),d=+e._z.call(null,g.data),t===u&&n===c&&r===d)return y.next=g,o?o[v]=y:e._root=y,e;do{o=o?o[v]=new Array(8):e._root=new Array(8),(f=t>=(a=(b+E)/2))?b=a:E=a,(h=n>=(s=(w+k)/2))?w=s:k=s,(p=r>=(l=(x+T)/2))?x=l:T=l}while((v=p<<2|h<<1|f)===(m=(d>=l)<<2|(c>=s)<<1|u>=a));return o[m]=g,o[v]=y,e}function i(e,t,n,r,i,o,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function o(e){return e[0]}function a(e){return e[1]}function s(e){return e[2]}function l(e,t,n,r){var i=new u(null==t?o:t,null==n?a:n,null==r?s:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function u(e,t,n,r,i,o,a,s,l){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function c(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}n.d(t,{Z:function(){return l}});var d=l.prototype=u.prototype;d.copy=function(){var e,t,n=new u(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(!r)return n;if(!r.length)return n._root=c(r),n;for(e=[{source:r,target:n._root=new Array(8)}];r=e.pop();)for(var i=0;i<8;++i)(t=r.source[i])&&(t.length?e.push({source:t,target:r.target[i]=new Array(8)}):r.target[i]=c(t));return n},d.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e),i=+this._z.call(null,e);return r(this.cover(t,n,i),t,n,i,e)},d.addAll=function(e){var t,n,i,o,a,s=e.length,l=new Array(s),u=new Array(s),c=new Array(s),d=1/0,f=1/0,h=1/0,p=-1/0,v=-1/0,m=-1/0;for(n=0;np&&(p=i),ov&&(v=o),am&&(m=a));if(d>p||f>v||h>m)return this;for(this.cover(d,f,h).cover(p,v,m),n=0;ne||e>=a||i>t||t>=s||o>n||n>=l;)switch(c=(ng||(s=f.y0)>y||(l=f.z0)>b||(u=f.x1)=T)<<2|(t>=k)<<1|e>=E)&&(f=w[w.length-1],w[w.length-1]=w[w.length-1-h],w[w.length-1-h]=f)}else{var _=e-+this._x.call(null,x.data),O=t-+this._y.call(null,x.data),C=n-+this._z.call(null,x.data),A=_*_+O*O+C*C;if(A=(l=(g+w)/2))?g=l:w=l,(f=a>=(u=(y+x)/2))?y=u:x=u,(h=s>=(c=(b+E)/2))?b=c:E=c,t=m,!(m=m[p=h<<2|f<<1|d]))return this;if(!m.length)break;(t[p+1&7]||t[p+2&7]||t[p+3&7]||t[p+4&7]||t[p+5&7]||t[p+6&7]||t[p+7&7])&&(n=t,v=p)}for(;m.data!==e;)if(r=m,!(m=m.next))return this;return(i=m.next)&&delete m.next,r?(i?r.next=i:delete r.next,this):t?(i?t[p]=i:delete t[p],(m=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&m===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!m.length&&(n?n[v]=m:this._root=m),this):(this._root=i,this)},d.removeAll=function(e){for(var t=0,n=e.length;t=(o=(v+g)/2))?v=o:g=o,(c=n>=(a=(m+y)/2))?m=a:y=a,i=h,!(h=h[d=c<<1|u]))return i[d]=p,e;if(s=+e._x.call(null,h.data),l=+e._y.call(null,h.data),t===s&&n===l)return p.next=h,i?i[d]=p:e._root=p,e;do{i=i?i[d]=new Array(4):e._root=new Array(4),(u=t>=(o=(v+g)/2))?v=o:g=o,(c=n>=(a=(m+y)/2))?m=a:y=a}while((d=c<<1|u)===(f=(l>=a)<<1|s>=o));return i[f]=h,i[d]=p,e}function i(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function o(e){return e[0]}function a(e){return e[1]}function s(e,t,n){var r=new l(null==t?o:t,null==n?a:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}function l(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function u(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}n.d(t,{Z:function(){return s}});var c=s.prototype=l.prototype;c.copy=function(){var e,t,n=new l(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=u(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var i=0;i<4;++i)(t=r.source[i])&&(t.length?e.push({source:t,target:r.target[i]=new Array(4)}):r.target[i]=u(t));return n},c.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return r(this.cover(t,n),t,n,e)},c.addAll=function(e){var t,n,i,o,a=e.length,s=new Array(a),l=new Array(a),u=1/0,c=1/0,d=-1/0,f=-1/0;for(n=0;nd&&(d=i),of&&(f=o));if(u>d||c>f)return this;for(this.cover(u,c).cover(d,f),n=0;ne||e>=i||r>t||t>=o;)switch(s=(th||(a=u.y0)>p||(s=u.x1)=y)<<1|e>=g)&&(u=v[v.length-1],v[v.length-1]=v[v.length-1-c],v[v.length-1-c]=u)}else{var b=e-+this._x.call(null,m.data),w=t-+this._y.call(null,m.data),x=b*b+w*w;if(x=(s=(p+m)/2))?p=s:m=s,(c=a>=(l=(v+g)/2))?v=l:g=l,t=h,!(h=h[d=c<<1|u]))return this;if(!h.length)break;(t[d+1&3]||t[d+2&3]||t[d+3&3])&&(n=t,f=d)}for(;h.data!==e;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):t?(i?t[d]=i:delete t[d],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[f]=h:this._root=h),this):(this._root=i,this)},c.removeAll=function(e){for(var t=0,n=e.length;t=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&t._call.call(void 0,e),t=t._next;--o}()}finally{o=0,function(){var e,t,n=r,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:r=t);i=e,b(o)}(),u=0}}function y(){var e=d.now(),t=e-l;t>1e3&&(c-=t,l=e)}function b(e){o||(a&&(a=clearTimeout(a)),e-u>24?(e<1/0&&(a=setTimeout(g,e-d.now()-c)),s&&(s=clearInterval(s))):(s||(l=d.now(),s=setInterval(y,1e3)),o=1,f(g)))}v.prototype=m.prototype={constructor:v,restart:function(e,t,n){if("function"!==typeof e)throw new TypeError("callback is not a function");n=(null==n?h():+n)+(null==t?0:+t),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=e,this._time=n,b()},stop:function(){this._call&&(this._call=null,this._time=1/0,b())}}},4245:function(e){e.exports=function(e){!function(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");for(var t=["on","fire","off"],n=0;n1&&(r=Array.prototype.splice.call(arguments,1));for(var o=0;o max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${t("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${t("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${t("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},6410:function(e,t,n){const r=n(5189);function i(e,t){return`\n${a(e,t)}\n${o(e)}\nreturn {Body: Body, Vector: Vector};\n`}function o(e){let t=r(e),n=t("{var}",{join:", "});return`\nfunction Body(${n}) {\n this.isPinned = false;\n this.pos = new Vector(${n});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${n}) {\n ${t("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function a(e,t){let n=r(e),i="";return t&&(i=`${n("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")}`),`function Vector(${n("{var}",{join:", "})}) {\n ${i}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${n('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${n("this.{var} = v.{var};",{indent:4})}\n } else {\n ${n('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${n("this.{var} = ",{join:""})}0;\n };`}e.exports=function(e,t){let n=i(e,t),{Body:r}=new Function(n)();return r},e.exports.generateCreateBodyFunctionBody=i,e.exports.getVectorCode=a,e.exports.getBodyCode=o},6647:function(e,t,n){const r=n(5189);function i(e){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${r(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}e.exports=function(e){let t=i(e);return new Function("options",t)},e.exports.generateCreateDragForceFunctionBody=i},4079:function(e,t,n){const r=n(5189);function i(e){let t=r(e);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${t("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${t("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${t("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${t("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}e.exports=function(e){let t=i(e);return new Function("options","random",t)},e.exports.generateCreateSpringForceFunctionBody=i},1763:function(e,t,n){const r=n(5189);function i(e){let t=r(e);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${t("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${t("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${t("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${t("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${t("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${t("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${t("body.pos.{var} += d{var};",{indent:4})}\n\n ${t("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${t("t{var} * t{var}",{join:" + "})})/length;\n`}e.exports=function(e){let t=i(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)},e.exports.generateIntegratorFunctionBody=i},1584:function(e,t,n){const r=n(5189),i=n(6422);function o(e){let t=r(e),n=Math.pow(2,e);return`\n${c()}\n${u(e)}\n${a(e)}\n${l(e)}\n${s(e)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(e){let t=[];for(let r=0;r {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${t("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${t("root.min_{var} = {var}min;",{indent:4})}\n ${t("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${t("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${t("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${t("var min_{var} = node.min_{var};",{indent:8})}\n ${t("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(t){let n=[],r=Array(t+1).join(" ");for(let o=0;o max_${i(o)}) {`),n.push(r+` quadIdx = quadIdx + ${Math.pow(2,o)};`),n.push(r+` min_${i(o)} = max_${i(o)};`),n.push(r+` max_${i(o)} = node.max_${i(o)};`),n.push(r+"}");return n.join("\n")}(8)}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${t("child.min_{var} = min_{var};",{indent:10})}\n ${t("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${t("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${t("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function a(e){let t=r(e);return`\n function isSamePosition(point1, point2) {\n ${t("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${t("d{var} < 1e-8",{join:" && "})};\n } \n`}function s(e){var t=Math.pow(2,e);return`\nfunction setChild(node, idx, child) {\n ${function(){let e=[];for(let n=0;n 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}e.exports=function(e){let t=o(e);return new Function(t)()},e.exports.generateQuadTreeFunctionBody=o,e.exports.getInsertStackCode=c,e.exports.getQuadNodeCode=u,e.exports.isSamePosition=a,e.exports.getChildBodyCode=l,e.exports.setChildBodyCode=s},6422:function(e){e.exports=function(e){return 0===e?"x":1===e?"y":2===e?"z":"c"+(e+1)}},5818:function(e,t,n){e.exports=function(e){var t=n(8403),d=n(5510),f=n(4245);if(e){if(void 0!==e.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==e.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}e=d(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var h=u[e.dimensions];if(!h){var p=e.dimensions;h={Body:r(p,e.debug),createQuadTree:i(p),createBounds:o(p),createDragForce:a(p),createSpringForce:s(p),integrate:l(p)},u[p]=h}var v=h.Body,m=h.createQuadTree,g=h.createBounds,y=h.createDragForce,b=h.createSpringForce,w=h.integrate,x=n(8712).random(42),E=[],k=[],T=m(e,x),_=g(E,e,x),O=b(e,x),C=y(e),A=[],S=new Map,P=0;j("nbody",(function(){if(0===E.length)return;T.insertBodies(E);var e=E.length;for(;e--;){var t=E[e];t.isPinned||(t.reset(),T.updateBodyForce(t),C.update(t))}})),j("spring",(function(){var e=k.length;for(;e--;)O.update(k[e])}));var M={bodies:E,quadTree:T,springs:k,settings:e,addForce:j,removeForce:function(e){var t=A.indexOf(S.get(e));if(t<0)return;A.splice(t,1),S.delete(e)},getForces:function(){return S},step:function(){for(var t=0;tnew v(e))(e);return E.push(t),t},removeBody:function(e){if(e){var t=E.indexOf(e);if(!(t<0))return E.splice(t,1),0===E.length&&_.reset(),!0}},addSpring:function(e,n,r,i){if(!e||!n)throw new Error("Cannot add null spring to force simulator");"number"!==typeof r&&(r=-1);var o=new t(e,n,r,i>=0?i:-1);return k.push(o),o},getTotalMovement:function(){return 0},removeSpring:function(e){if(e){var t=k.indexOf(e);return t>-1?(k.splice(t,1),!0):void 0}},getBestNewBodyPosition:function(e){return _.getBestNewPosition(e)},getBBox:R,getBoundingBox:R,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(t){return void 0!==t?(e.gravity=t,T.options({gravity:t}),this):e.gravity},theta:function(t){return void 0!==t?(e.theta=t,T.options({theta:t}),this):e.theta},random:x};return function(e,t){for(var n in e)c(e,t,n)}(e,M),f(M),M;function R(){return _.update(),_.box}function j(e,t){if(S.has(e))throw new Error("Force "+e+" is already added");S.set(e,t),A.push(t)}};var r=n(6410),i=n(1584),o=n(891),a=n(6647),s=n(4079),l=n(1763),u={};function c(e,t,n){if(e.hasOwnProperty(n)&&"function"!==typeof t[n]){var r=Number.isFinite(e[n]);t[n]=r?function(r){if(void 0!==r){if(!Number.isFinite(r))throw new Error("Value of "+n+" should be a valid number.");return e[n]=r,t}return e[n]}:function(r){return void 0!==r?(e[n]=r,t):e[n]}}}},8403:function(e){e.exports=function(e,t,n,r){this.from=e,this.to=t,this.length=n,this.coefficient=r}},4736:function(e,t,n){e.exports=function(e){"uniqueLinkId"in(e=e||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),e.multigraph=e.uniqueLinkId);void 0===e.multigraph&&(e.multigraph=!1);if("function"!==typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=[],u={},c=0,d=e.multigraph?function(e,t,n){var r=l(e,t),i=u.hasOwnProperty(r);if(i||O(e,t)){i||(u[r]=0);var o="@"+ ++u[r];r=l(e+o,t+o)}return new s(e,t,n,r)}:function(e,t,n){var r=l(e,t);return new s(e,t,n,r)},f=[],h=C,p=C,v=C,m=C,g={addNode:w,addLink:function(e,t,r){v();var i=x(e)||w(e),o=x(t)||w(t),s=d(e,t,r);n.push(s),a(i,s),e!==t&&a(o,s);return h(s,"add"),m(),s},removeLink:_,removeNode:E,getNode:x,getNodeCount:k,getLinkCount:T,getLinksCount:T,getNodesCount:k,getLinks:function(e){var t=x(e);return t?t.links:null},forEachNode:P,forEachLinkedNode:function(e,n,r){var i=x(e);if(i&&i.links&&"function"===typeof n)return r?function(e,n,r){for(var i=0;i=0&&r.links.splice(t,1),o&&(t=i(e,o.links))>=0&&o.links.splice(t,1),h(e,"remove"),m(),!0}function O(e,t){var n,r=x(e);if(!r||!r.links)return null;for(n=0;n0&&(g.fire("changed",f),f.length=0)}function P(e){if("function"!==typeof e)throw new Error("Function is expected to iterate over graph nodes. You passed "+e);for(var n=t.values(),r=n.next();!r.done;){if(e(r.value))return!0;r=n.next()}}};var r=n(4245);function i(e,t){if(!t)return-1;if(t.indexOf)return t.indexOf(e);var n,r=t.length;for(n=0;n>>19))+374761393+(e<<5)&4294967295)+3550635116^e<<9))+4251993797+(e<<3)&4294967295)^e>>>16),this.seed=e,(268435455&e)/268435456}e.exports=t,e.exports.random=t,e.exports.randomIterator=function(e,n){var r=n||t();if("function"!==typeof r.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(t){var n,i,o;for(n=e.length-1;n>0;--n)i=r.next(n+1),o=e[i],e[i]=e[n],e[n]=o,t(o);e.length&&t(e[0])},shuffle:function(){var t,n,i;for(t=e.length-1;t>0;--t)n=r.next(t+1),i=e[n],e[n]=e[t],e[t]=i;return e}}},n.prototype.next=function(e){return Math.floor(this.nextDouble()*e)},n.prototype.nextDouble=i,n.prototype.uniform=i,n.prototype.gaussian=function(){var e,t,n;do{t=2*this.nextDouble()-1,n=2*this.nextDouble()-1,e=t*t+n*n}while(e>=1||0===e);return t*Math.sqrt(-2*Math.log(e)/e)},n.prototype.levy=function(){var e=1.5,t=Math.pow(r(2.5)*Math.sin(Math.PI*e/2)/(r(1.25)*e*Math.pow(2,.25)),1/e);return this.gaussian()*t/Math.pow(Math.abs(this.gaussian()),1/e)}},75:function(e,t,n){var r=n(4155);(function(){var t,n,i,o,a,s;"undefined"!==typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!==typeof r&&null!==r&&r.hrtime?(e.exports=function(){return(t()-a)/1e6},n=r.hrtime,o=(t=function(){var e;return 1e9*(e=n())[0]+e[1]})(),s=1e9*r.uptime(),a=o-s):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)},7236:function(e){var t=null,n=["Webkit","Moz","O","ms"];e.exports=function(e){t||(t=document.createElement("div"));var r=t.style;if(e in r)return e;for(var i=e.charAt(0).toUpperCase()+e.slice(1),o=n.length;o>=0;o--){var a=n[o]+i;if(a in r)return a}return!1}},4155:function(e){var t,n,r=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}!function(){try{t="function"===typeof setTimeout?setTimeout:i}catch(e){t=i}try{n="function"===typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var s,l=[],u=!1,c=-1;function d(){u&&s&&(u=!1,s.length?l=s.concat(l):c=-1,l.length&&f())}function f(){if(!u){var e=a(d);u=!0;for(var t=l.length;t;){for(s=l,l=[];++c1)for(var n=1;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},6164:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t1?r-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:0;this.view&&(this.view.scrollLeft=e)}},{key:"scrollTop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.view&&(this.view.scrollTop=e)}},{key:"scrollToLeft",value:function(){this.view&&(this.view.scrollLeft=0)}},{key:"scrollToTop",value:function(){this.view&&(this.view.scrollTop=0)}},{key:"scrollToRight",value:function(){this.view&&(this.view.scrollLeft=this.view.scrollWidth)}},{key:"scrollToBottom",value:function(){this.view&&(this.view.scrollTop=this.view.scrollHeight)}},{key:"addListeners",value:function(){if("undefined"!==typeof document&&this.view){var e=this.view,t=this.trackHorizontal,n=this.trackVertical,r=this.thumbHorizontal,i=this.thumbVertical;e.addEventListener("scroll",this.handleScroll),(0,d.default)()&&(t.addEventListener("mouseenter",this.handleTrackMouseEnter),t.addEventListener("mouseleave",this.handleTrackMouseLeave),t.addEventListener("mousedown",this.handleHorizontalTrackMouseDown),n.addEventListener("mouseenter",this.handleTrackMouseEnter),n.addEventListener("mouseleave",this.handleTrackMouseLeave),n.addEventListener("mousedown",this.handleVerticalTrackMouseDown),r.addEventListener("mousedown",this.handleHorizontalThumbMouseDown),i.addEventListener("mousedown",this.handleVerticalThumbMouseDown),window.addEventListener("resize",this.handleWindowResize))}}},{key:"removeListeners",value:function(){if("undefined"!==typeof document&&this.view){var e=this.view,t=this.trackHorizontal,n=this.trackVertical,r=this.thumbHorizontal,i=this.thumbVertical;e.removeEventListener("scroll",this.handleScroll),(0,d.default)()&&(t.removeEventListener("mouseenter",this.handleTrackMouseEnter),t.removeEventListener("mouseleave",this.handleTrackMouseLeave),t.removeEventListener("mousedown",this.handleHorizontalTrackMouseDown),n.removeEventListener("mouseenter",this.handleTrackMouseEnter),n.removeEventListener("mouseleave",this.handleTrackMouseLeave),n.removeEventListener("mousedown",this.handleVerticalTrackMouseDown),r.removeEventListener("mousedown",this.handleHorizontalThumbMouseDown),i.removeEventListener("mousedown",this.handleVerticalThumbMouseDown),window.removeEventListener("resize",this.handleWindowResize),this.teardownDragging())}}},{key:"handleScroll",value:function(e){var t=this,n=this.props,r=n.onScroll,i=n.onScrollFrame;r&&r(e),this.update((function(e){var n=e.scrollLeft,r=e.scrollTop;t.viewScrollLeft=n,t.viewScrollTop=r,i&&i(e)})),this.detectScrolling()}},{key:"handleScrollStart",value:function(){var e=this.props.onScrollStart;e&&e(),this.handleScrollStartAutoHide()}},{key:"handleScrollStartAutoHide",value:function(){this.props.autoHide&&this.showTracks()}},{key:"handleScrollStop",value:function(){var e=this.props.onScrollStop;e&&e(),this.handleScrollStopAutoHide()}},{key:"handleScrollStopAutoHide",value:function(){this.props.autoHide&&this.hideTracks()}},{key:"handleWindowResize",value:function(){(0,d.default)(!1),this.forceUpdate()}},{key:"handleHorizontalTrackMouseDown",value:function(e){e.preventDefault();var t=e.target,n=e.clientX,r=t.getBoundingClientRect().left,i=this.getThumbHorizontalWidth(),o=Math.abs(r-n)-i/2;this.view.scrollLeft=this.getScrollLeftForOffset(o)}},{key:"handleVerticalTrackMouseDown",value:function(e){e.preventDefault();var t=e.target,n=e.clientY,r=t.getBoundingClientRect().top,i=this.getThumbVerticalHeight(),o=Math.abs(r-n)-i/2;this.view.scrollTop=this.getScrollTopForOffset(o)}},{key:"handleHorizontalThumbMouseDown",value:function(e){e.preventDefault(),this.handleDragStart(e);var t=e.target,n=e.clientX,r=t.offsetWidth,i=t.getBoundingClientRect().left;this.prevPageX=r-(n-i)}},{key:"handleVerticalThumbMouseDown",value:function(e){e.preventDefault(),this.handleDragStart(e);var t=e.target,n=e.clientY,r=t.offsetHeight,i=t.getBoundingClientRect().top;this.prevPageY=r-(n-i)}},{key:"setupDragging",value:function(){(0,s.default)(document.body,v.disableSelectStyle),document.addEventListener("mousemove",this.handleDrag),document.addEventListener("mouseup",this.handleDragEnd),document.onselectstart=f.default}},{key:"teardownDragging",value:function(){(0,s.default)(document.body,v.disableSelectStyleReset),document.removeEventListener("mousemove",this.handleDrag),document.removeEventListener("mouseup",this.handleDragEnd),document.onselectstart=void 0}},{key:"handleDragStart",value:function(e){this.dragging=!0,e.stopImmediatePropagation(),this.setupDragging()}},{key:"handleDrag",value:function(e){if(this.prevPageX){var t=e.clientX,n=-this.trackHorizontal.getBoundingClientRect().left+t-(this.getThumbHorizontalWidth()-this.prevPageX);this.view.scrollLeft=this.getScrollLeftForOffset(n)}if(this.prevPageY){var r=e.clientY,i=-this.trackVertical.getBoundingClientRect().top+r-(this.getThumbVerticalHeight()-this.prevPageY);this.view.scrollTop=this.getScrollTopForOffset(i)}return!1}},{key:"handleDragEnd",value:function(){this.dragging=!1,this.prevPageX=this.prevPageY=0,this.teardownDragging(),this.handleDragEndAutoHide()}},{key:"handleDragEndAutoHide",value:function(){this.props.autoHide&&this.hideTracks()}},{key:"handleTrackMouseEnter",value:function(){this.trackMouseOver=!0,this.handleTrackMouseEnterAutoHide()}},{key:"handleTrackMouseEnterAutoHide",value:function(){this.props.autoHide&&this.showTracks()}},{key:"handleTrackMouseLeave",value:function(){this.trackMouseOver=!1,this.handleTrackMouseLeaveAutoHide()}},{key:"handleTrackMouseLeaveAutoHide",value:function(){this.props.autoHide&&this.hideTracks()}},{key:"showTracks",value:function(){clearTimeout(this.hideTracksTimeout),(0,s.default)(this.trackHorizontal,{opacity:1}),(0,s.default)(this.trackVertical,{opacity:1})}},{key:"hideTracks",value:function(){var e=this;if(!this.dragging&&!this.scrolling&&!this.trackMouseOver){var t=this.props.autoHideTimeout;clearTimeout(this.hideTracksTimeout),this.hideTracksTimeout=setTimeout((function(){(0,s.default)(e.trackHorizontal,{opacity:0}),(0,s.default)(e.trackVertical,{opacity:0})}),t)}}},{key:"detectScrolling",value:function(){var e=this;this.scrolling||(this.scrolling=!0,this.handleScrollStart(),this.detectScrollingInterval=setInterval((function(){e.lastViewScrollLeft===e.viewScrollLeft&&e.lastViewScrollTop===e.viewScrollTop&&(clearInterval(e.detectScrollingInterval),e.scrolling=!1,e.handleScrollStop()),e.lastViewScrollLeft=e.viewScrollLeft,e.lastViewScrollTop=e.viewScrollTop}),100))}},{key:"raf",value:function(e){var t=this;this.requestFrame&&a.default.cancel(this.requestFrame),this.requestFrame=(0,a.default)((function(){t.requestFrame=void 0,e()}))}},{key:"update",value:function(e){var t=this;this.raf((function(){return t._update(e)}))}},{key:"_update",value:function(e){var t=this.props,n=t.onUpdate,r=t.hideTracksWhenNotNeeded,i=this.getValues();if((0,d.default)()){var o=i.scrollLeft,a=i.clientWidth,l=i.scrollWidth,u=(0,h.default)(this.trackHorizontal),c=this.getThumbHorizontalWidth(),f={width:c,transform:"translateX("+o/(l-a)*(u-c)+"px)"},v=i.scrollTop,m=i.clientHeight,g=i.scrollHeight,y=(0,p.default)(this.trackVertical),b=this.getThumbVerticalHeight(),w={height:b,transform:"translateY("+v/(g-m)*(y-b)+"px)"};if(r){var x={visibility:l>a?"visible":"hidden"},E={visibility:g>m?"visible":"hidden"};(0,s.default)(this.trackHorizontal,x),(0,s.default)(this.trackVertical,E)}(0,s.default)(this.thumbHorizontal,f),(0,s.default)(this.thumbVertical,w)}n&&n(i),"function"===typeof e&&e(i)}},{key:"render",value:function(){var e=this,t=(0,d.default)(),n=this.props,i=(n.onScroll,n.onScrollFrame,n.onScrollStart,n.onScrollStop,n.onUpdate,n.renderView),o=n.renderTrackHorizontal,a=n.renderTrackVertical,s=n.renderThumbHorizontal,u=n.renderThumbVertical,f=n.tagName,h=(n.hideTracksWhenNotNeeded,n.autoHide),p=(n.autoHideTimeout,n.autoHideDuration),m=(n.thumbSize,n.thumbMinSize,n.universal),g=n.autoHeight,y=n.autoHeightMin,b=n.autoHeightMax,w=n.style,x=n.children,E=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(n,["onScroll","onScrollFrame","onScrollStart","onScrollStop","onUpdate","renderView","renderTrackHorizontal","renderTrackVertical","renderThumbHorizontal","renderThumbVertical","tagName","hideTracksWhenNotNeeded","autoHide","autoHideTimeout","autoHideDuration","thumbSize","thumbMinSize","universal","autoHeight","autoHeightMin","autoHeightMax","style","children"]),k=this.state.didMountUniversal,T=r({},v.containerStyleDefault,g&&r({},v.containerStyleAutoHeight,{minHeight:y,maxHeight:b}),w),_=r({},v.viewStyleDefault,{marginRight:t?-t:0,marginBottom:t?-t:0},g&&r({},v.viewStyleAutoHeight,{minHeight:(0,c.default)(y)?"calc("+y+" + "+t+"px)":y+t,maxHeight:(0,c.default)(b)?"calc("+b+" + "+t+"px)":b+t}),g&&m&&!k&&{minHeight:y,maxHeight:b},m&&!k&&v.viewStyleUniversalInitial),O={transition:"opacity "+p+"ms",opacity:0},C=r({},v.trackHorizontalStyleDefault,h&&O,(!t||m&&!k)&&{display:"none"}),A=r({},v.trackVerticalStyleDefault,h&&O,(!t||m&&!k)&&{display:"none"});return(0,l.createElement)(f,r({},E,{style:T,ref:function(t){e.container=t}}),[(0,l.cloneElement)(i({style:_}),{key:"view",ref:function(t){e.view=t}},x),(0,l.cloneElement)(o({style:C}),{key:"trackHorizontal",ref:function(t){e.trackHorizontal=t}},(0,l.cloneElement)(s({style:v.thumbHorizontalStyleDefault}),{ref:function(t){e.thumbHorizontal=t}})),(0,l.cloneElement)(a({style:A}),{key:"trackVertical",ref:function(t){e.trackVertical=t}},(0,l.cloneElement)(u({style:v.thumbVerticalStyleDefault}),{ref:function(t){e.thumbVertical=t}}))])}}]),t}(l.Component);t.default=w,w.propTypes={onScroll:u.default.func,onScrollFrame:u.default.func,onScrollStart:u.default.func,onScrollStop:u.default.func,onUpdate:u.default.func,renderView:u.default.func,renderTrackHorizontal:u.default.func,renderTrackVertical:u.default.func,renderThumbHorizontal:u.default.func,renderThumbVertical:u.default.func,tagName:u.default.string,thumbSize:u.default.number,thumbMinSize:u.default.number,hideTracksWhenNotNeeded:u.default.bool,autoHide:u.default.bool,autoHideTimeout:u.default.number,autoHideDuration:u.default.number,autoHeight:u.default.bool,autoHeightMin:u.default.oneOfType([u.default.number,u.default.string]),autoHeightMax:u.default.oneOfType([u.default.number,u.default.string]),universal:u.default.bool,style:u.default.object,children:u.default.node},w.defaultProps={renderView:m.renderViewDefault,renderTrackHorizontal:m.renderTrackHorizontalDefault,renderTrackVertical:m.renderTrackVerticalDefault,renderThumbHorizontal:m.renderThumbHorizontalDefault,renderThumbVertical:m.renderThumbVerticalDefault,tagName:"div",thumbMinSize:30,hideTracksWhenNotNeeded:!1,autoHide:!1,autoHideTimeout:1e3,autoHideDuration:200,autoHeight:!1,autoHeightMin:0,autoHeightMax:200,universal:!1}},8285:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.containerStyleDefault={position:"relative",overflow:"hidden",width:"100%",height:"100%"},t.containerStyleAutoHeight={height:"auto"},t.viewStyleDefault={position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"scroll",WebkitOverflowScrolling:"touch"},t.viewStyleAutoHeight={position:"relative",top:void 0,left:void 0,right:void 0,bottom:void 0},t.viewStyleUniversalInitial={overflow:"hidden",marginRight:0,marginBottom:0},t.trackHorizontalStyleDefault={position:"absolute",height:6},t.trackVerticalStyleDefault={position:"absolute",width:6},t.thumbHorizontalStyleDefault={position:"relative",display:"block",height:"100%"},t.thumbVerticalStyleDefault={position:"relative",display:"block",width:"100%"},t.disableSelectStyle={userSelect:"none"},t.disableSelectStyleReset={userSelect:""}},6658:function(e,t,n){"use strict";t.$B=void 0;var r,i=n(6164),o=(r=i)&&r.__esModule?r:{default:r};o.default,t.$B=o.default},7114:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.clientHeight,n=getComputedStyle(e),r=n.paddingTop,i=n.paddingBottom;return t-parseFloat(r)-parseFloat(i)}},1608:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.clientWidth,n=getComputedStyle(e),r=n.paddingLeft,i=n.paddingRight;return t-parseFloat(r)-parseFloat(i)}},6445:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(e&&!1!==a)return a;if("undefined"!==typeof document){var t=document.createElement("div");(0,o.default)(t,{width:100,height:100,position:"absolute",top:-9999,overflow:"scroll",MsOverflowStyle:"scrollbar"}),document.body.appendChild(t),a=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}else a=0;return a||0};var r,i=n(3879),o=(r=i)&&r.__esModule?r:{default:r};var a=!1},7928:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"string"===typeof e}},8309:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return!1}},9590:function(e){var t="undefined"!==typeof Element,n="function"===typeof Map,r="function"===typeof Set,i="function"===typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,a){if(e===a)return!0;if(e&&a&&"object"==typeof e&&"object"==typeof a){if(e.constructor!==a.constructor)return!1;var s,l,u,c;if(Array.isArray(e)){if((s=e.length)!=a.length)return!1;for(l=s;0!==l--;)if(!o(e[l],a[l]))return!1;return!0}if(n&&e instanceof Map&&a instanceof Map){if(e.size!==a.size)return!1;for(c=e.entries();!(l=c.next()).done;)if(!a.has(l.value[0]))return!1;for(c=e.entries();!(l=c.next()).done;)if(!o(l.value[1],a.get(l.value[0])))return!1;return!0}if(r&&e instanceof Set&&a instanceof Set){if(e.size!==a.size)return!1;for(c=e.entries();!(l=c.next()).done;)if(!a.has(l.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(a)){if((s=e.length)!=a.length)return!1;for(l=s;0!==l--;)if(e[l]!==a[l])return!1;return!0}if(e.constructor===RegExp)return e.source===a.source&&e.flags===a.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===a.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===a.toString();if((s=(u=Object.keys(e)).length)!==Object.keys(a).length)return!1;for(l=s;0!==l--;)if(!Object.prototype.hasOwnProperty.call(a,u[l]))return!1;if(t&&e instanceof Element)return!1;for(l=s;0!==l--;)if(("_owner"!==u[l]&&"__v"!==u[l]&&"__o"!==u[l]||!e.$$typeof)&&!o(e[u[l]],a[u[l]]))return!1;return!0}return e!==e&&a!==a}e.exports=function(e,t){try{return o(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},6923:function(e,n,r){"use strict";r.d(n,{f$:function(){return Ha},s6:function(){return za}});var i=r(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"===typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?t-1:0),r=1;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?r-1:0),o=1;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?r-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.markerAttrs,i=void 0===r?{preset:"hiro"}:r;e.innerHTML="",t.container=document.createElement("div"),e.appendChild(t.container);var o=document.createElement("a-scene");o.setAttribute("embedded",""),o.setAttribute("arjs","debugUIEnabled: false;");var a,s=document.createElement("a-marker");Object.entries(i).forEach((function(e){var t=D(e,2),n=t[0],r=t[1];return s.setAttribute(n,r)})),o.appendChild(s),o.appendChild(a=document.createElement("a-entity")),a.setAttribute("cursor"),a.setAttribute("raycaster","objects: [forcegraph]"),t.forcegraph=document.createElement("a-entity"),t.forcegraph.setAttribute("forcegraph",null),s.appendChild(t.forcegraph);var l=document.createElement("a-entity");l.setAttribute("camera",""),o.appendChild(l),t.container.appendChild(o)},update:function(e,t){t.hasOwnProperty("width")&&e.width&&(e.container.style.width=e.width),t.hasOwnProperty("height")&&e.height&&(e.container.style.height=e.height),t.hasOwnProperty("glScale")&&e.forcegraph.setAttribute("scale",L(new Array(3)).map((function(){return 1/e.glScale})).join(" ")),t.hasOwnProperty("yOffset")&&e.forcegraph.setAttribute("position","0 ".concat(e.yOffset," 0"));var n=["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","onNodeHover","onNodeClick","onLinkHover","onLinkClick","forceEngine","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],r=Object.assign.apply(Object,[{}].concat(L(Object.entries(e).filter((function(e){var r=D(e,2),i=r[0],o=r[1];return t.hasOwnProperty(i)&&-1!==n.indexOf(i)&&void 0!==o&&null!==o})).map((function(e){var t=D(e,2);return j({},t[0],t[1])}))),L(Object.entries(e.graphData).map((function(e){var t=D(e,2);return j({},t[0],t[1])})))));e.forcegraph.setAttribute("forcegraph",r)}}),H=r(2212);const B=new H.JOQ,F=new H.iMs,V=new H.FM8,U=new H.Pa4,G=new H.Pa4,q=new H.Pa4,W=new H.yGw;class K extends H.pBf{constructor(e,t,n){super(),n.style.touchAction="none";let r=null,i=null;const o=[],a=this;function s(){n.addEventListener("pointermove",u),n.addEventListener("pointerdown",c),n.addEventListener("pointerup",d),n.addEventListener("pointerleave",d)}function l(){n.removeEventListener("pointermove",u),n.removeEventListener("pointerdown",c),n.removeEventListener("pointerup",d),n.removeEventListener("pointerleave",d),n.style.cursor=""}function u(s){if(!1!==a.enabled){if(f(s),F.setFromCamera(V,t),r)return F.ray.intersectPlane(B,G)&&r.position.copy(G.sub(U).applyMatrix4(W)),void a.dispatchEvent({type:"drag",object:r});if("mouse"===s.pointerType||"pen"===s.pointerType)if(o.length=0,F.setFromCamera(V,t),F.intersectObjects(e,!0,o),o.length>0){const e=o[0].object;B.setFromNormalAndCoplanarPoint(t.getWorldDirection(B.normal),q.setFromMatrixPosition(e.matrixWorld)),i!==e&&null!==i&&(a.dispatchEvent({type:"hoveroff",object:i}),n.style.cursor="auto",i=null),i!==e&&(a.dispatchEvent({type:"hoveron",object:e}),n.style.cursor="pointer",i=e)}else null!==i&&(a.dispatchEvent({type:"hoveroff",object:i}),n.style.cursor="auto",i=null)}}function c(i){!1!==a.enabled&&(f(i),o.length=0,F.setFromCamera(V,t),F.intersectObjects(e,!0,o),o.length>0&&(r=!0===a.transformGroup?e[0]:o[0].object,B.setFromNormalAndCoplanarPoint(t.getWorldDirection(B.normal),q.setFromMatrixPosition(r.matrixWorld)),F.ray.intersectPlane(B,G)&&(W.copy(r.parent.matrixWorld).invert(),U.copy(G).sub(q.setFromMatrixPosition(r.matrixWorld))),n.style.cursor="move",a.dispatchEvent({type:"dragstart",object:r})))}function d(){!1!==a.enabled&&(r&&(a.dispatchEvent({type:"dragend",object:r}),r=null),n.style.cursor=i?"pointer":"auto")}function f(e){const t=n.getBoundingClientRect();V.x=(e.clientX-t.left)/t.width*2-1,V.y=-(e.clientY-t.top)/t.height*2+1}s(),this.enabled=!0,this.transformGroup=!1,this.activate=s,this.deactivate=l,this.dispose=function(){l()},this.getObjects=function(){return e}}}var Z=r(1398);const $={type:"change"},X={type:"start"},Y={type:"end"};class Q extends H.pBf{constructor(e,t){super(),void 0===t&&console.warn('THREE.TrackballControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.TrackballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');const n=this,r=-1,i=0,o=1,a=2,s=3,l=4;this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.rotateSpeed=1,this.zoomSpeed=1.2,this.panSpeed=.3,this.noRotate=!1,this.noZoom=!1,this.noPan=!1,this.staticMoving=!1,this.dynamicDampingFactor=.2,this.minDistance=0,this.maxDistance=1/0,this.keys=["KeyA","KeyS","KeyD"],this.mouseButtons={LEFT:H.RsA.ROTATE,MIDDLE:H.RsA.DOLLY,RIGHT:H.RsA.PAN},this.target=new H.Pa4;const u=1e-6,c=new H.Pa4;let d=1,f=r,h=r,p=0,v=0,m=0;const g=new H.Pa4,y=new H.FM8,b=new H.FM8,w=new H.Pa4,x=new H.FM8,E=new H.FM8,k=new H.FM8,T=new H.FM8,_=[],O={};this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.up0=this.object.up.clone(),this.zoom0=this.object.zoom,this.handleResize=function(){const e=n.domElement.getBoundingClientRect(),t=n.domElement.ownerDocument.documentElement;n.screen.left=e.left+window.pageXOffset-t.clientLeft,n.screen.top=e.top+window.pageYOffset-t.clientTop,n.screen.width=e.width,n.screen.height=e.height};const C=function(){const e=new H.FM8;return function(t,r){return e.set((t-n.screen.left)/n.screen.width,(r-n.screen.top)/n.screen.height),e}}(),A=function(){const e=new H.FM8;return function(t,r){return e.set((t-.5*n.screen.width-n.screen.left)/(.5*n.screen.width),(n.screen.height+2*(n.screen.top-r))/n.screen.width),e}}();function S(e){!1!==n.enabled&&(0===_.length&&(n.domElement.ownerDocument.addEventListener("pointermove",P),n.domElement.ownerDocument.addEventListener("pointerup",M)),function(e){_.push(e)}(e),"touch"===e.pointerType?function(e){switch(z(e),_.length){case 1:f=s,b.copy(A(_[0].pageX,_[0].pageY)),y.copy(b);break;default:f=l;const e=_[0].pageX-_[1].pageX,t=_[0].pageY-_[1].pageY;v=p=Math.sqrt(e*e+t*t);const n=(_[0].pageX+_[1].pageX)/2,r=(_[0].pageY+_[1].pageY)/2;k.copy(C(n,r)),T.copy(k)}n.dispatchEvent(X)}(e):function(e){if(f===r)switch(e.button){case n.mouseButtons.LEFT:f=i;break;case n.mouseButtons.MIDDLE:f=o;break;case n.mouseButtons.RIGHT:f=a;break;default:f=r}const t=h!==r?h:f;t!==i||n.noRotate?t!==o||n.noZoom?t!==a||n.noPan||(k.copy(C(e.pageX,e.pageY)),T.copy(k)):(x.copy(C(e.pageX,e.pageY)),E.copy(x)):(b.copy(A(e.pageX,e.pageY)),y.copy(b));n.domElement.ownerDocument.addEventListener("pointermove",P),n.domElement.ownerDocument.addEventListener("pointerup",M),n.dispatchEvent(X)}(e))}function P(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(z(e),_.length){case 1:y.copy(b),b.copy(A(e.pageX,e.pageY));break;default:const t=function(e){const t=e.pointerId===_[0].pointerId?_[1]:_[0];return O[t.pointerId]}(e),n=e.pageX-t.x,r=e.pageY-t.y;v=Math.sqrt(n*n+r*r);const i=(e.pageX+t.x)/2,o=(e.pageY+t.y)/2;T.copy(C(i,o))}}(e):function(e){const t=h!==r?h:f;t!==i||n.noRotate?t!==o||n.noZoom?t!==a||n.noPan||T.copy(C(e.pageX,e.pageY)):E.copy(C(e.pageX,e.pageY)):(y.copy(b),b.copy(A(e.pageX,e.pageY)))}(e))}function M(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(_.length){case 0:f=r;break;case 1:f=s,b.copy(A(e.pageX,e.pageY)),y.copy(b)}n.dispatchEvent(Y)}(e):(f=r,n.domElement.ownerDocument.removeEventListener("pointermove",P),n.domElement.ownerDocument.removeEventListener("pointerup",M),n.dispatchEvent(Y)),I(e),0===_.length&&(n.domElement.ownerDocument.removeEventListener("pointermove",P),n.domElement.ownerDocument.removeEventListener("pointerup",M)))}function R(e){I(e)}function j(e){!1!==n.enabled&&(window.removeEventListener("keydown",j),h===r&&(e.code!==n.keys[i]||n.noRotate?e.code!==n.keys[o]||n.noZoom?e.code!==n.keys[a]||n.noPan||(h=a):h=o:h=i))}function D(){!1!==n.enabled&&(h=r,window.addEventListener("keydown",j))}function L(e){if(!1!==n.enabled&&!0!==n.noZoom){switch(e.preventDefault(),e.deltaMode){case 2:x.y-=.025*e.deltaY;break;case 1:x.y-=.01*e.deltaY;break;default:x.y-=25e-5*e.deltaY}n.dispatchEvent(X),n.dispatchEvent(Y)}}function N(e){!1!==n.enabled&&e.preventDefault()}function I(e){delete O[e.pointerId];for(let t=0;t<_.length;t++)if(_[t].pointerId==e.pointerId)return void _.splice(t,1)}function z(e){let t=O[e.pointerId];void 0===t&&(t=new H.FM8,O[e.pointerId]=t),t.set(e.pageX,e.pageY)}this.rotateCamera=function(){const e=new H.Pa4,t=new H._fP,r=new H.Pa4,i=new H.Pa4,o=new H.Pa4,a=new H.Pa4;return function(){a.set(b.x-y.x,b.y-y.y,0);let s=a.length();s?(g.copy(n.object.position).sub(n.target),r.copy(g).normalize(),i.copy(n.object.up).normalize(),o.crossVectors(i,r).normalize(),i.setLength(b.y-y.y),o.setLength(b.x-y.x),a.copy(i.add(o)),e.crossVectors(a,g).normalize(),s*=n.rotateSpeed,t.setFromAxisAngle(e,s),g.applyQuaternion(t),n.object.up.applyQuaternion(t),w.copy(e),m=s):!n.staticMoving&&m&&(m*=Math.sqrt(1-n.dynamicDampingFactor),g.copy(n.object.position).sub(n.target),t.setFromAxisAngle(w,m),g.applyQuaternion(t),n.object.up.applyQuaternion(t)),y.copy(b)}}(),this.zoomCamera=function(){let e;f===l?(e=p/v,p=v,n.object.isPerspectiveCamera?g.multiplyScalar(e):n.object.isOrthographicCamera?(n.object.zoom*=e,n.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")):(e=1+(E.y-x.y)*n.zoomSpeed,1!==e&&e>0&&(n.object.isPerspectiveCamera?g.multiplyScalar(e):n.object.isOrthographicCamera?(n.object.zoom/=e,n.object.updateProjectionMatrix()):console.warn("THREE.TrackballControls: Unsupported camera type")),n.staticMoving?x.copy(E):x.y+=(E.y-x.y)*this.dynamicDampingFactor)},this.panCamera=function(){const e=new H.FM8,t=new H.Pa4,r=new H.Pa4;return function(){if(e.copy(T).sub(k),e.lengthSq()){if(n.object.isOrthographicCamera){const t=(n.object.right-n.object.left)/n.object.zoom/n.domElement.clientWidth,r=(n.object.top-n.object.bottom)/n.object.zoom/n.domElement.clientWidth;e.x*=t,e.y*=r}e.multiplyScalar(g.length()*n.panSpeed),r.copy(g).cross(n.object.up).setLength(e.x),r.add(t.copy(n.object.up).setLength(e.y)),n.object.position.add(r),n.target.add(r),n.staticMoving?k.copy(T):k.add(e.subVectors(T,k).multiplyScalar(n.dynamicDampingFactor))}}}(),this.checkDistances=function(){n.noZoom&&n.noPan||(g.lengthSq()>n.maxDistance*n.maxDistance&&(n.object.position.addVectors(n.target,g.setLength(n.maxDistance)),x.copy(E)),g.lengthSq()u&&(n.dispatchEvent($),c.copy(n.object.position))):n.object.isOrthographicCamera?(n.object.lookAt(n.target),(c.distanceToSquared(n.object.position)>u||d!==n.object.zoom)&&(n.dispatchEvent($),c.copy(n.object.position),d=n.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type")},this.reset=function(){f=r,h=r,n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.up.copy(n.up0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),g.subVectors(n.object.position,n.target),n.object.lookAt(n.target),n.dispatchEvent($),c.copy(n.object.position),d=n.object.zoom},this.dispose=function(){n.domElement.removeEventListener("contextmenu",N),n.domElement.removeEventListener("pointerdown",S),n.domElement.removeEventListener("pointercancel",R),n.domElement.removeEventListener("wheel",L),window.removeEventListener("keydown",j),window.removeEventListener("keyup",D)},this.domElement.addEventListener("contextmenu",N),this.domElement.addEventListener("pointerdown",S),this.domElement.addEventListener("pointercancel",R),this.domElement.addEventListener("wheel",L,{passive:!1}),window.addEventListener("keydown",j),window.addEventListener("keyup",D),this.handleResize(),this.update()}}const J={type:"change"},ee={type:"start"},te={type:"end"};class ne extends H.pBf{constructor(e,t){super(),void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new H.Pa4,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:H.RsA.ROTATE,MIDDLE:H.RsA.DOLLY,RIGHT:H.RsA.PAN},this.touches={ONE:H.QmN.ROTATE,TWO:H.QmN.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.listenToKeyEvents=function(e){e.addEventListener("keydown",G),this._domElementKeyEvents=e},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(J),n.update(),i=r.NONE},this.update=function(){const t=new H.Pa4,d=(new H._fP).setFromUnitVectors(e.up,new H.Pa4(0,1,0)),f=d.clone().invert(),h=new H.Pa4,p=new H._fP,v=2*Math.PI;return function(){const e=n.object.position;t.copy(e).sub(n.target),t.applyQuaternion(d),a.setFromVector3(t),n.autoRotate&&i===r.NONE&&k(2*Math.PI/60/60*n.autoRotateSpeed),n.enableDamping?(a.theta+=s.theta*n.dampingFactor,a.phi+=s.phi*n.dampingFactor):(a.theta+=s.theta,a.phi+=s.phi);let m=n.minAzimuthAngle,g=n.maxAzimuthAngle;return isFinite(m)&&isFinite(g)&&(m<-Math.PI?m+=v:m>Math.PI&&(m-=v),g<-Math.PI?g+=v:g>Math.PI&&(g-=v),a.theta=m<=g?Math.max(m,Math.min(g,a.theta)):a.theta>(m+g)/2?Math.max(m,a.theta):Math.min(g,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=l,a.radius=Math.max(n.minDistance,Math.min(n.maxDistance,a.radius)),!0===n.enableDamping?n.target.addScaledVector(u,n.dampingFactor):n.target.add(u),t.setFromSpherical(a),t.applyQuaternion(f),e.copy(n.target).add(t),n.object.lookAt(n.target),!0===n.enableDamping?(s.theta*=1-n.dampingFactor,s.phi*=1-n.dampingFactor,u.multiplyScalar(1-n.dampingFactor)):(s.set(0,0,0),u.set(0,0,0)),l=1,!!(c||h.distanceToSquared(n.object.position)>o||8*(1-p.dot(n.object.quaternion))>o)&&(n.dispatchEvent(J),h.copy(n.object.position),p.copy(n.object.quaternion),c=!1,!0)}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",q),n.domElement.removeEventListener("pointerdown",z),n.domElement.removeEventListener("pointercancel",V),n.domElement.removeEventListener("wheel",U),n.domElement.ownerDocument.removeEventListener("pointermove",B),n.domElement.ownerDocument.removeEventListener("pointerup",F),null!==n._domElementKeyEvents&&n._domElementKeyEvents.removeEventListener("keydown",G)};const n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let i=r.NONE;const o=1e-6,a=new H.$V,s=new H.$V;let l=1;const u=new H.Pa4;let c=!1;const d=new H.FM8,f=new H.FM8,h=new H.FM8,p=new H.FM8,v=new H.FM8,m=new H.FM8,g=new H.FM8,y=new H.FM8,b=new H.FM8,w=[],x={};function E(){return Math.pow(.95,n.zoomSpeed)}function k(e){s.theta-=e}function T(e){s.phi-=e}const _=function(){const e=new H.Pa4;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),u.add(e)}}(),O=function(){const e=new H.Pa4;return function(t,r){!0===n.screenSpacePanning?e.setFromMatrixColumn(r,1):(e.setFromMatrixColumn(r,0),e.crossVectors(n.object.up,e)),e.multiplyScalar(t),u.add(e)}}(),C=function(){const e=new H.Pa4;return function(t,r){const i=n.domElement;if(n.object.isPerspectiveCamera){const o=n.object.position;e.copy(o).sub(n.target);let a=e.length();a*=Math.tan(n.object.fov/2*Math.PI/180),_(2*t*a/i.clientHeight,n.object.matrix),O(2*r*a/i.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(_(t*(n.object.right-n.object.left)/n.object.zoom/i.clientWidth,n.object.matrix),O(r*(n.object.top-n.object.bottom)/n.object.zoom/i.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function A(e){n.object.isPerspectiveCamera?l/=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*e)),n.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function S(e){n.object.isPerspectiveCamera?l*=e:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/e)),n.object.updateProjectionMatrix(),c=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function P(e){d.set(e.clientX,e.clientY)}function M(e){p.set(e.clientX,e.clientY)}function R(){if(1===w.length)d.set(w[0].pageX,w[0].pageY);else{const e=.5*(w[0].pageX+w[1].pageX),t=.5*(w[0].pageY+w[1].pageY);d.set(e,t)}}function j(){if(1===w.length)p.set(w[0].pageX,w[0].pageY);else{const e=.5*(w[0].pageX+w[1].pageX),t=.5*(w[0].pageY+w[1].pageY);p.set(e,t)}}function D(){const e=w[0].pageX-w[1].pageX,t=w[0].pageY-w[1].pageY,n=Math.sqrt(e*e+t*t);g.set(0,n)}function L(e){if(1==w.length)f.set(e.pageX,e.pageY);else{const t=Z(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);f.set(n,r)}h.subVectors(f,d).multiplyScalar(n.rotateSpeed);const t=n.domElement;k(2*Math.PI*h.x/t.clientHeight),T(2*Math.PI*h.y/t.clientHeight),d.copy(f)}function N(e){if(1===w.length)v.set(e.pageX,e.pageY);else{const t=Z(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);v.set(n,r)}m.subVectors(v,p).multiplyScalar(n.panSpeed),C(m.x,m.y),p.copy(v)}function I(e){const t=Z(e),r=e.pageX-t.x,i=e.pageY-t.y,o=Math.sqrt(r*r+i*i);y.set(0,o),b.set(0,Math.pow(y.y/g.y,n.zoomSpeed)),A(b.y),g.copy(y)}function z(e){!1!==n.enabled&&(0===w.length&&(n.domElement.ownerDocument.addEventListener("pointermove",B),n.domElement.ownerDocument.addEventListener("pointerup",F)),function(e){w.push(e)}(e),"touch"===e.pointerType?function(e){switch(K(e),w.length){case 1:switch(n.touches.ONE){case H.QmN.ROTATE:if(!1===n.enableRotate)return;R(),i=r.TOUCH_ROTATE;break;case H.QmN.PAN:if(!1===n.enablePan)return;j(),i=r.TOUCH_PAN;break;default:i=r.NONE}break;case 2:switch(n.touches.TWO){case H.QmN.DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;n.enableZoom&&D(),n.enablePan&&j(),i=r.TOUCH_DOLLY_PAN;break;case H.QmN.DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;n.enableZoom&&D(),n.enableRotate&&R(),i=r.TOUCH_DOLLY_ROTATE;break;default:i=r.NONE}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(ee)}(e):function(e){let t;switch(e.button){case 0:t=n.mouseButtons.LEFT;break;case 1:t=n.mouseButtons.MIDDLE;break;case 2:t=n.mouseButtons.RIGHT;break;default:t=-1}switch(t){case H.RsA.DOLLY:if(!1===n.enableZoom)return;!function(e){g.set(e.clientX,e.clientY)}(e),i=r.DOLLY;break;case H.RsA.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enablePan)return;M(e),i=r.PAN}else{if(!1===n.enableRotate)return;P(e),i=r.ROTATE}break;case H.RsA.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===n.enableRotate)return;P(e),i=r.ROTATE}else{if(!1===n.enablePan)return;M(e),i=r.PAN}break;default:i=r.NONE}i!==r.NONE&&n.dispatchEvent(ee)}(e))}function B(e){!1!==n.enabled&&("touch"===e.pointerType?function(e){switch(K(e),i){case r.TOUCH_ROTATE:if(!1===n.enableRotate)return;L(e),n.update();break;case r.TOUCH_PAN:if(!1===n.enablePan)return;N(e),n.update();break;case r.TOUCH_DOLLY_PAN:if(!1===n.enableZoom&&!1===n.enablePan)return;!function(e){n.enableZoom&&I(e),n.enablePan&&N(e)}(e),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(!1===n.enableZoom&&!1===n.enableRotate)return;!function(e){n.enableZoom&&I(e),n.enableRotate&&L(e)}(e),n.update();break;default:i=r.NONE}}(e):function(e){if(!1===n.enabled)return;switch(i){case r.ROTATE:if(!1===n.enableRotate)return;!function(e){f.set(e.clientX,e.clientY),h.subVectors(f,d).multiplyScalar(n.rotateSpeed);const t=n.domElement;k(2*Math.PI*h.x/t.clientHeight),T(2*Math.PI*h.y/t.clientHeight),d.copy(f),n.update()}(e);break;case r.DOLLY:if(!1===n.enableZoom)return;!function(e){y.set(e.clientX,e.clientY),b.subVectors(y,g),b.y>0?A(E()):b.y<0&&S(E()),g.copy(y),n.update()}(e);break;case r.PAN:if(!1===n.enablePan)return;!function(e){v.set(e.clientX,e.clientY),m.subVectors(v,p).multiplyScalar(n.panSpeed),C(m.x,m.y),p.copy(v),n.update()}(e)}}(e))}function F(e){!1!==n.enabled&&(e.pointerType,n.dispatchEvent(te),i=r.NONE,W(e),0===w.length&&(n.domElement.ownerDocument.removeEventListener("pointermove",B),n.domElement.ownerDocument.removeEventListener("pointerup",F)))}function V(e){W(e)}function U(e){!1===n.enabled||!1===n.enableZoom||i!==r.NONE&&i!==r.ROTATE||(e.preventDefault(),n.dispatchEvent(ee),function(e){e.deltaY<0?S(E()):e.deltaY>0&&A(E()),n.update()}(e),n.dispatchEvent(te))}function G(e){!1!==n.enabled&&!1!==n.enablePan&&function(e){let t=!1;switch(e.code){case n.keys.UP:C(0,n.keyPanSpeed),t=!0;break;case n.keys.BOTTOM:C(0,-n.keyPanSpeed),t=!0;break;case n.keys.LEFT:C(n.keyPanSpeed,0),t=!0;break;case n.keys.RIGHT:C(-n.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),n.update())}(e)}function q(e){!1!==n.enabled&&e.preventDefault()}function W(e){delete x[e.pointerId];for(let t=0;t0){const t=this.getContainerDimensions(),n=t.size[0]/2,r=t.size[1]/2;this.moveState.yawLeft=-(e.pageX-t.offset[0]-n)/n,this.moveState.pitchDown=(e.pageY-t.offset[1]-r)/r,this.updateRotationVector()}},this.mouseup=function(e){if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else{switch(e.button){case 0:this.moveState.forward=0;break;case 2:this.moveState.back=0}this.updateMovementVector()}this.updateRotationVector()},this.update=function(e){const t=e*n.movementSpeed,a=e*n.rollSpeed;n.object.translateX(n.moveVector.x*t),n.object.translateY(n.moveVector.y*t),n.object.translateZ(n.moveVector.z*t),n.tmpQuaternion.set(n.rotationVector.x*a,n.rotationVector.y*a,n.rotationVector.z*a,1).normalize(),n.object.quaternion.multiply(n.tmpQuaternion),(o.distanceToSquared(n.object.position)>r||8*(1-i.dot(n.object.quaternion))>r)&&(n.dispatchEvent(re),i.copy(n.object.quaternion),o.copy(n.object.position))},this.updateMovementVector=function(){const e=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right,this.moveVector.y=-this.moveState.down+this.moveState.up,this.moveVector.z=-e+this.moveState.back},this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp,this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft,this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft},this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}},this.dispose=function(){this.domElement.removeEventListener("contextmenu",oe),this.domElement.removeEventListener("mousedown",s),this.domElement.removeEventListener("mousemove",a),this.domElement.removeEventListener("mouseup",l),window.removeEventListener("keydown",u),window.removeEventListener("keyup",c)};const a=this.mousemove.bind(this),s=this.mousedown.bind(this),l=this.mouseup.bind(this),u=this.keydown.bind(this),c=this.keyup.bind(this);this.domElement.addEventListener("contextmenu",oe),this.domElement.addEventListener("mousemove",a),this.domElement.addEventListener("mousedown",s),this.domElement.addEventListener("mouseup",l),window.addEventListener("keydown",u),window.addEventListener("keyup",c),this.updateMovementVector(),this.updateRotationVector()}}function oe(e){e.preventDefault()}var ae={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor = opacity * texel;\n\n\t\t}"};class se{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}const le=new H.iKG(-1,1,1,-1,0,1),ue=new H.u9r;ue.setAttribute("position",new H.a$l([-1,3,0,-1,-1,0,3,-1,0],3)),ue.setAttribute("uv",new H.a$l([0,2,0,0,2,0],2));class ce{constructor(e){this._mesh=new H.Kj0(ue,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,le)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class de extends se{constructor(e,t){super(),this.textureID=void 0!==t?t:"tDiffuse",e instanceof H.jyz?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=H.rDY.clone(e.uniforms),this.material=new H.jyz({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new ce(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class fe extends se{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const r=e.getContext(),i=e.state;let o,a;i.buffers.color.setMask(!1),i.buffers.depth.setMask(!1),i.buffers.color.setLocked(!0),i.buffers.depth.setLocked(!0),this.inverse?(o=0,a=1):(o=1,a=0),i.buffers.stencil.setTest(!0),i.buffers.stencil.setOp(r.REPLACE,r.REPLACE,r.REPLACE),i.buffers.stencil.setFunc(r.ALWAYS,o,4294967295),i.buffers.stencil.setClear(a),i.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),i.buffers.color.setLocked(!1),i.buffers.depth.setLocked(!1),i.buffers.stencil.setLocked(!1),i.buffers.stencil.setFunc(r.EQUAL,1,4294967295),i.buffers.stencil.setOp(r.KEEP,r.KEEP,r.KEEP),i.buffers.stencil.setLocked(!0)}}class he extends se{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class pe{constructor(e,t){if(this.renderer=e,void 0===t){const n={minFilter:H.wem,magFilter:H.wem,format:H.wk1},r=e.getSize(new H.FM8);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,(t=new H.dd2(this._width*this._pixelRatio,this._height*this._pixelRatio,n)).texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===ae&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===de&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new de(ae),this.clock=new H.SUY}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);var c=n-o/2;return r(s+c,l+c,u+c)}var Ce={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};var Ae=/^#[a-fA-F0-9]{6}$/,Se=/^#[a-fA-F0-9]{8}$/,Pe=/^#[a-fA-F0-9]{3}$/,Me=/^#[a-fA-F0-9]{4}$/,Re=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,je=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i,De=/^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Le=/^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;function Ne(e){if("string"!==typeof e)throw new ke(3);var t=function(e){if("string"!==typeof e)return e;var t=e.toLowerCase();return Ce[t]?"#"+Ce[t]:e}(e);if(t.match(Ae))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(Se)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(Pe))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(Me)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=Re.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var o=je.exec(t.substring(0,50));if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10),alpha:parseFloat(""+o[4])};var a=De.exec(t);if(a){var s="rgb("+Oe(parseInt(""+a[1],10),parseInt(""+a[2],10)/100,parseInt(""+a[3],10)/100)+")",l=Re.exec(s);if(!l)throw new ke(4,t,s);return{red:parseInt(""+l[1],10),green:parseInt(""+l[2],10),blue:parseInt(""+l[3],10)}}var u=Le.exec(t.substring(0,50));if(u){var c="rgb("+Oe(parseInt(""+u[1],10),parseInt(""+u[2],10)/100,parseInt(""+u[3],10)/100)+")",d=Re.exec(c);if(!d)throw new ke(4,t,c);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+u[4])}}throw new ke(5)}var Ie=function(e){return 7===e.length&&e[1]===e[2]&&e[3]===e[4]&&e[5]===e[6]?"#"+e[1]+e[3]+e[5]:e};function ze(e){var t=e.toString(16);return 1===t.length?"0"+t:t}function He(e,t,n){if("number"===typeof e&&"number"===typeof t&&"number"===typeof n)return Ie("#"+ze(e)+ze(t)+ze(n));if("object"===typeof e&&void 0===t&&void 0===n)return Ie("#"+ze(e.red)+ze(e.green)+ze(e.blue));throw new ke(6)}function Be(e,t,n,r){if("string"===typeof e&&"number"===typeof t){var i=Ne(e);return"rgba("+i.red+","+i.green+","+i.blue+","+t+")"}if("number"===typeof e&&"number"===typeof t&&"number"===typeof n&&"number"===typeof r)return r>=1?He(e,t,n):"rgba("+e+","+t+","+n+","+r+")";if("object"===typeof e&&void 0===t&&void 0===n&&void 0===r)return e.alpha>=1?He(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new ke(7)}function Fe(e,t,n){return function(){var r=n.concat(Array.prototype.slice.call(arguments));return r.length>=t?e.apply(this,r):Fe(e,t,r)}}function Ve(e){return Fe(e,e.length,[])}function Ue(e,t,n){return Math.max(e,Math.min(t,n))}function Ge(e,t){if("transparent"===t)return t;var n=Ne(t);return Be(ge({},n,{alpha:Ue(0,1,(100*("number"===typeof n.alpha?n.alpha:1)+100*parseFloat(e))/100)}))}var qe=Ve(Ge);var We=r(4155),Ke={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Ke.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Ke.Bounce.In(2*e):.5*Ke.Bounce.Out(2*e-1)+.5}}},Ze="undefined"===typeof self&&"undefined"!==typeof We&&We.hrtime?function(){var e=We.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!==typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},$e=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=Ze()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r1?o(e[n],e[n-1],n-r):o(e[i],e[i+1>n?n:i+1],r-i)},Bezier:function(e,t){for(var n=0,r=e.length-1,i=Math.pow,o=Xe.Utils.Bernstein,a=0;a<=r;a++)n+=i(1-t,r-a)*i(t,a)*e[a]*o(r,a);return n},CatmullRom:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Xe.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(i=Math.floor(r=n*(1+t))),o(e[(i-1+n)%n],e[i],e[(i+1)%n],e[(i+2)%n],r-i)):t<0?e[0]-(o(e[0],e[0],e[1],e[1],-r)-e[0]):t>1?e[n]-(o(e[n],e[n],e[n-1],e[n-1],r-n)-e[n]):o(e[i?i-1:0],e[i],e[n1;r--)n*=r;return e[t]=n,n}}(),CatmullRom:function(e,t,n,r,i){var o=.5*(n-e),a=.5*(r-t),s=i*i;return(2*t-2*n+o+a)*(i*s)+(-3*t+3*n-2*o-a)*s+o*i+t}}},Ye=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Qe=new $e,Je=function(){function e(e,t){void 0===t&&(t=Qe),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ke.Linear.None,this._interpolationFunction=Xe.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Ye.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"===typeof e?Ze()+parseFloat(e):e:Ze(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,r){for(var i in n){var o=e[i],a=Array.isArray(o),s=a?"array":typeof o,l=!a&&Array.isArray(n[i]);if("undefined"!==s&&"function"!==s){if(l){var u=n[i];if(0===u.length)continue;u=u.map(this._handleRelativeValue.bind(this,o)),n[i]=[o].concat(u)}if("object"!==s&&!a||!o||l)"undefined"===typeof t[i]&&(t[i]=o),a||(t[i]*=1),r[i]=l?n[i].slice().reverse():t[i]||0;else{for(var c in t[i]=a?[]:{},o)t[i][c]=o[c];r[i]=a?[]:{},this._setupProperties(o,t[i],n[i],r[i])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=Ze()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=Ze()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;ei)return!1;t&&this.start(e)}if(this._goToEnd=!1,e1?1:r;var o=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!==typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,s=this._chainedTweens.length;ae.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length,i=new Array(r>3?r-3:0),o=3;o2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,i=e.camera;if(t){var o=new ht.Vector3(0,0,0),a=2*Math.max.apply(Math,ct(Object.entries(t).map((function(e){var t=ut(e,2),n=t[0],r=t[1];return Math.max.apply(Math,ct(r.map((function(e){return Math.abs(o[n]-e)}))))})))),s=(1-2*r/e.height)*i.fov,l=a/Math.atan(s*Math.PI/180),u=l/i.aspect,c=Math.max(l,u);if(c>0){var d=o.clone().sub(i.position).normalize().multiplyScalar(-c);this.cameraPosition(d,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0},n=new ht.Box3(new ht.Vector3(0,0,0),new ht.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach((function(e){return n.expandByObject(e)})),Object.assign.apply(Object,ct(["x","y","z"].map((function(e){return lt({},e,[n.min[e],n.max[e]])}))))):null},getScreenCoords:function(e,t,n,r){var i=new ht.Vector3(t,n,r);return i.project(this.camera()),{x:(i.x+1)*e.width/2,y:-(i.y-1)*e.height/2}},getSceneCoords:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=new ht.Vector2(t/e.width*2-1,-n/e.height*2+1),o=new ht.Raycaster;return o.setFromCamera(i,e.camera),Object.assign({},o.ray.at(r,new ht.Vector3))},intersectingObjects:function(e,t,n){var r=new ht.Vector2(t/e.width*2-1,-n/e.height*2+1),i=new ht.Raycaster;return i.params.Line.threshold=e.lineHoverPrecision,i.setFromCamera(r,e.camera),i.intersectObjects(e.objects,!0)},renderer:function(e){return e.renderer},scene:function(e){return e.scene},camera:function(e){return e.camera},postProcessingComposer:function(e){return e.postProcessingComposer},controls:function(e){return e.controls},tbControls:function(e){return e.controls}},stateInit:function(){return{scene:new ht.Scene,camera:new ht.PerspectiveCamera,clock:new ht.Clock}},init:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.controlType,i=void 0===r?"trackball":r,o=n.rendererConfig,a=void 0===o?{}:o,s=n.extraRenderers,l=void 0===s?[]:s,u=n.waitForLoadComplete,c=void 0===u||u;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.toolTipElem=document.createElement("div"),t.toolTipElem.classList.add("scene-tooltip"),t.container.appendChild(t.toolTipElem),t.pointerPos=new ht.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach((function(e){return t.container.addEventListener(e,(function(n){if("pointerdown"===e&&(t.isPointerPressed=!0),!t.isPointerDragging&&"pointermove"===n.type&&(n.pressure>0||t.isPointerPressed)&&("touch"!==n.pointerType||void 0===n.movementX||[n.movementX,n.movementY].some((function(e){return Math.abs(e)>1})))&&(t.isPointerDragging=!0),t.enablePointerInteraction){var r=function(e){var t=e.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+r,left:t.left+n}}(t.container);t.pointerPos.x=n.pageX-r.left,t.pointerPos.y=n.pageY-r.top,t.toolTipElem.style.top="".concat(t.pointerPos.y,"px"),t.toolTipElem.style.left="".concat(t.pointerPos.x,"px"),t.toolTipElem.style.transform="translate(-".concat(t.pointerPos.x/t.width*100,"%, 21px)")}}),{passive:!0})})),t.container.addEventListener("pointerup",(function(e){t.isPointerPressed=!1,t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag)||requestAnimationFrame((function(){0===e.button&&t.onClick(t.hoverObj||null,e,t.intersectionPoint),2===e.button&&t.onRightClick&&t.onRightClick(t.hoverObj||null,e,t.intersectionPoint)}))}),{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",(function(e){t.onRightClick&&e.preventDefault()})),t.renderer=new ht.WebGLRenderer(Object.assign({antialias:!0,alpha:!0},a)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=l,t.extraRenderers.forEach((function(e){e.domElement.style.position="absolute",e.domElement.style.top="0px",e.domElement.style.pointerEvents="none",t.container.appendChild(e.domElement)})),t.postProcessingComposer=new pe(t.renderer),t.postProcessingComposer.addPass(new me(t.scene,t.camera)),t.controls=new{trackball:Q,orbit:ne,fly:ie}[i](t.camera,t.renderer.domElement),"fly"===i&&(t.controls.movementSpeed=300,t.controls.rollSpeed=Math.PI/6,t.controls.dragToLook=!0),"trackball"!==i&&"orbit"!==i||(t.controls.minDistance=.1,t.controls.maxDistance=t.skyRadius,t.controls.addEventListener("start",(function(){t.controlsEngaged=!0})),t.controls.addEventListener("change",(function(){t.controlsEngaged&&(t.controlsDragging=!0)})),t.controls.addEventListener("end",(function(){t.controlsEngaged=!1,t.controlsDragging=!1}))),[t.renderer,t.postProcessingComposer].concat(ct(t.extraRenderers)).forEach((function(e){return e.setSize(t.width,t.height)})),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new ht.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!c,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))&&(e.container.style.width=e.width,e.container.style.height=e.height,[e.renderer,e.postProcessingComposer].concat(ct(e.extraRenderers)).forEach((function(t){return t.setSize(e.width,e.height)})),e.camera.aspect=e.width/e.height,e.camera.updateProjectionMatrix()),t.hasOwnProperty("skyRadius")&&e.skyRadius&&(e.controls.hasOwnProperty("maxDistance")&&t.skyRadius&&(e.controls.maxDistance=e.skyRadius),e.camera.far=2.5*e.skyRadius,e.camera.updateProjectionMatrix(),e.skysphere.geometry=new ht.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var n=Ne(e.backgroundColor).alpha;void 0===n&&(n=1),e.renderer.setClearColor(new ht.Color(qe(1,e.backgroundColor)),n)}function r(){e.loadComplete=e.scene.visible=!0}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?(new ht.TextureLoader).load(e.backgroundImageUrl,(function(t){e.skysphere.material=new ht.MeshBasicMaterial({map:t,side:ht.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&r()})):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&r())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("objects")&&((t.objects||[]).forEach((function(t){return e.scene.remove(t)})),e.objects.forEach((function(t){return e.scene.add(t)})))}});function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mt(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?i-1:0),a=1;a3?i-3:0),a=3;at?1:e>=t?0:NaN}function Xt(e,t){var n;if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"===typeof e)return Yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yt(e,t)}(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Jt.hasOwnProperty(t)?{space:Jt[t],local:e}:e}function tn(e){return function(){this.removeAttribute(e)}}function nn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rn(e,t){return function(){this.setAttribute(e,t)}}function on(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function an(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function sn(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ln(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function un(e){return function(){this.style.removeProperty(e)}}function cn(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dn(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function fn(e,t){return e.style.getPropertyValue(t)||ln(e).getComputedStyle(e,null).getPropertyValue(t)}function hn(e){return function(){delete this[e]}}function pn(e,t){return function(){this[e]=t}}function vn(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function mn(e){return e.trim().split(/^|\s+/)}function gn(e){return e.classList||new yn(e)}function yn(e){this._node=e,this._names=mn(e.getAttribute("class")||"")}function bn(e,t){for(var n=gn(e),r=-1,i=t.length;++r=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}function Bn(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,o=t.length;r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var qn=r(7757),Wn=r.n(qn),Kn=Wn().mark(Zn);function Zn(){var e,t,n,r,i,o,a;return Wn().wrap((function(s){for(;;)switch(s.prev=s.next){case 0:e=this._groups,t=0,n=e.length;case 1:if(!(t=x&&(x=w+1);!(b=m[x])&&++x=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=$t);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?un:"function"===typeof t?dn:cn)(e,t,null==n?"":n)):fn(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?hn:"function"===typeof t?vn:pn)(e,t)):this.node()[e]},classed:function(e,t){var n=mn(e+"");if(arguments.length<2){for(var r=gn(this.node()),i=-1,o=n.length;++i0)throw new Error("too late; already scheduled");return n}function mr(e,t){var n=gr(e,t);if(n.state>3)throw new Error("too late; already running");return n}function gr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function yr(e,t){var n,r,i,o=e.__transition,a=!0;if(o){for(i in t=null==t?null:t+"",o)(n=o[i]).name===t?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete e.__transition}}function br(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var wr,xr=180/Math.PI,Er={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kr(e,t,n,r,i,o){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),e*r180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:br(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,a.rotate,s,l),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:br(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,a.skewX,s,l),function(e,t,n,r,o,a){if(e!==n||t!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:br(e,n)},{i:s-2,x:br(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(e){for(var t,n=-1,r=l.length;++n>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Xr(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Xr(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Hr.exec(e))?new Jr(t[1],t[2],t[3],1):(t=Br.exec(e))?new Jr(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Fr.exec(e))?Xr(t[1],t[2],t[3],t[4]):(t=Vr.exec(e))?Xr(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Ur.exec(e))?ri(t[1],t[2]/100,t[3]/100,1):(t=Gr.exec(e))?ri(t[1],t[2]/100,t[3]/100,t[4]):qr.hasOwnProperty(e)?$r(qr[e]):"transparent"===e?new Jr(NaN,NaN,NaN,0):null}function $r(e){return new Jr(e>>16&255,e>>8&255,255&e,1)}function Xr(e,t,n,r){return r<=0&&(e=t=n=NaN),new Jr(e,t,n,r)}function Yr(e){return e instanceof Rr||(e=Zr(e)),e?new Jr((e=e.rgb()).r,e.g,e.b,e.opacity):new Jr}function Qr(e,t,n,r){return 1===arguments.length?Yr(e):new Jr(e,t,n,null==r?1:r)}function Jr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function ei(){return"#"+ni(this.r)+ni(this.g)+ni(this.b)}function ti(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function ni(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function ri(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new oi(e,t,n,r)}function ii(e){if(e instanceof oi)return new oi(e.h,e.s,e.l,e.opacity);if(e instanceof Rr||(e=Zr(e)),!e)return new oi;if(e instanceof oi)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=t===o?(n-r)/s+6*(n0&&l<1?0:a,new oi(a,s,l,e.opacity)}function oi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function ai(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function si(e,t,n,r,i){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*r+a*i)/6}Pr(Rr,Zr,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:Wr,formatHex:Wr,formatHsl:function(){return ii(this).formatHsl()},formatRgb:Kr,toString:Kr}),Pr(Jr,Qr,Mr(Rr,{brighter:function(e){return e=null==e?Dr:Math.pow(Dr,e),new Jr(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?jr:Math.pow(jr,e),new Jr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ei,formatHex:ei,formatRgb:ti,toString:ti})),Pr(oi,(function(e,t,n,r){return 1===arguments.length?ii(e):new oi(e,t,n,null==r?1:r)}),Mr(Rr,{brighter:function(e){return e=null==e?Dr:Math.pow(Dr,e),new oi(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?jr:Math.pow(jr,e),new oi(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Jr(ai(e>=240?e-240:e+120,i,r),ai(e,i,r),ai(e<120?e+240:e-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var li=function(e){return function(){return e}};function ui(e,t){return function(n){return e+n*t}}function ci(e){return 1===(e=+e)?di:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):li(isNaN(t)?n:t)}}function di(e,t){var n=t-e;return n?ui(e,n):li(isNaN(e)?t:e)}var fi=function e(t){var n=ci(t);function r(e,t){var r=n((e=Qr(e)).r,(t=Qr(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),a=di(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1);function hi(e){return function(t){var n,r,i=t.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],a=r>0?e[r-1]:2*i-o,s=ro&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:br(n,r)})),o=vi.lastIndex;return o=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?vr:mr;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}var Di=Qn.prototype.constructor;function Li(e){return function(){this.style.removeProperty(e)}}function Ni(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ii(e,t,n){var r,i;function o(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&Ni(e,o,n)),r}return o._value=t,o}function zi(e){return function(t){this.textContent=e.call(this,t)}}function Hi(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&zi(r)),t}return r._value=e,r}var Bi=0;function Fi(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Vi(){return++Bi}var Ui=Qn.prototype;Fi.prototype=function(e){return Qn().transition(e)}.prototype=(0,Pt.Z)({constructor:Fi,select:function(e){var t=this._name,n=this._id;"function"!==typeof e&&(e=Rt(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;ar?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function oo(){var e,t,n,r=Ji,i=eo,o=io,a=no,s=ro,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,d=lr,f=(0,er.Z)("start","zoom","end"),h=500,p=0,v=10;function m(e){e.property("__zoom",to).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",_).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Zi(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Zi(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,r){e.on("start.zoom",(function(){x(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){x(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,o=arguments,a=x(e,o).event(r),s=i.apply(e,o),l=null==n?b(s):"function"===typeof n?n.apply(e,o):n,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),c=e.__zoom,f="function"===typeof t?t.apply(e,o):t,h=d(c.invert(l).concat(u/c.k),f.invert(l).concat(u/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=u/t[2];e=new Zi(n,l[0]-t[0]*n,l[1]-t[1]*n)}a.zoom(null,e)}}))}function x(e,t,n){return!n&&e.__zooming||new E(e,t)}function E(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function k(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i1?t-1:0),a=1;ap}l.event(e).zoom("mouse",o(y(l.that.__zoom,l.mouse[0]=ur(e,s),l.mouse[1]),l.extent,u))}function m(e){c.on("mousemove.zoom mouseup.zoom",null),ar(e.view,l.moved),Qi(e),l.event(e).end()}}function _(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a0?Jn(this).transition().duration(c).call(w,h,l,e):Jn(this).call(m.transform,h,l,e)}}function O(n){for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a1?t-1:0),r=1;r1?r-1:0),o=1;oe.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:6;bo(this,e),this.csBits=t,this.registry=["__reserved for background__"]}var t,n,r;return t=e,(n=[{key:"register",value:function(e){if(this.registry.length>=Math.pow(2,24-this.csBits))return null;var t,n=this.registry.length,r=To(n,this.csBits),i=(t=n+(r<<24-this.csBits),"#".concat(Math.min(t,Math.pow(2,24)).toString(16).padStart(6,"0")));return this.registry.push(e),i}},{key:"lookup",value:function(e){var t="string"===typeof e?function(e){var t=yo()(e).toRgb(),n=t.r,r=t.g,i=t.b;return ko(n,r,i)}(e):ko.apply(void 0,xo(e));if(!t)return null;var n=t&Math.pow(2,24-this.csBits)-1,r=t>>24-this.csBits&Math.pow(2,this.csBits)-1;return To(n,this.csBits)!==r||n>=this.registry.length?null:this.registry[n]}}])&&wo(t.prototype,n),r&&wo(t,r),e}(),Oo=r(4505),Co=r(5560),Ao=r(2405),So=r(216),Po=r(6917);const{abs:Mo,cos:Ro,sin:jo,acos:Do,atan2:Lo,sqrt:No,pow:Io}=Math;function zo(e){return e<0?-Io(-e,1/3):Io(e,1/3)}const Ho=Math.PI,Bo=2*Ho,Fo=Ho/2,Vo=Number.MAX_SAFE_INTEGER||9007199254740991,Uo=Number.MIN_SAFE_INTEGER||-9007199254740991,Go={x:0,y:0,z:0},qo={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,t){const n=t(e);let r=n.x*n.x+n.y*n.y;return"undefined"!==typeof n.z&&(r+=n.z*n.z),No(r)},compute:function(e,t,n){if(0===e)return t[0].t=0,t[0];const r=t.length-1;if(1===e)return t[r].t=1,t[r];const i=1-e;let o=t;if(0===r)return t[0].t=e,t[0];if(1===r){const t={x:i*o[0].x+e*o[1].x,y:i*o[0].y+e*o[1].y,t:e};return n&&(t.z=i*o[0].z+e*o[1].z),t}if(r<4){let t,a,s,l=i*i,u=e*e,c=0;2===r?(o=[o[0],o[1],o[2],Go],t=l,a=i*e*2,s=u):3===r&&(t=l*i,a=l*e*3,s=i*u*3,c=e*u);const d={x:t*o[0].x+a*o[1].x+s*o[2].x+c*o[3].x,y:t*o[0].y+a*o[1].y+s*o[2].y+c*o[3].y,t:e};return n&&(d.z=t*o[0].z+a*o[1].z+s*o[2].z+c*o[3].z),d}const a=JSON.parse(JSON.stringify(t));for(;a.length>1;){for(let t=0;t1;i--,o--){const e=[];for(let n,i=0;io.x.min&&(t=o.x.min),n>o.y.min&&(n=o.y.min),r0&&(a.c1=t,a.c2=r,a.s1=e,a.s2=n,o.push(a))}))})),o},makeshape:function(e,t,n){const r=t.points.length,i=e.points.length,o=qo.makeline(t.points[r-1],e.points[0]),a=qo.makeline(e.points[i-1],t.points[0]),s={startcap:o,forward:e,back:t,endcap:a,bbox:qo.findbbox([o,e,t,a]),intersections:function(e){return qo.shapeintersections(s,s.bbox,e,e.bbox,n)}};return s},getminmax:function(e,t,n){if(!n)return{min:0,max:0};let r,i,o=Vo,a=Uo;-1===n.indexOf(0)&&(n=[0].concat(n)),-1===n.indexOf(1)&&n.push(1);for(let s=0,l=n.length;sa&&(a=i[t]);return{min:o,mid:(o+a)/2,max:a,size:a-o}},align:function(e,t){const n=t.p1.x,r=t.p1.y,i=-Lo(t.p2.y-r,t.p2.x-n);return e.map((function(e){return{x:(e.x-n)*Ro(i)-(e.y-r)*jo(i),y:(e.x-n)*jo(i)+(e.y-r)*Ro(i)}}))},roots:function(e,t){t=t||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,r=qo.align(e,t),i=function(e){return 0<=e&&e<=1};if(2===n){const e=r[0].y,t=r[1].y,n=r[2].y,o=e-2*t+n;if(0!==o){const r=-No(t*t-e*n),a=-e+t;return[-(r+a)/o,-(-r+a)/o].filter(i)}return t!==n&&0===o?[(2*t-n)/(2*t-2*n)].filter(i):[]}const o=r[0].y,a=r[1].y,s=r[2].y;let l=3*a-o-3*s+r[3].y,u=3*o-6*a+3*s,c=-3*o+3*a,d=o;if(qo.approximately(l,0)){if(qo.approximately(u,0))return qo.approximately(c,0)?[]:[-d/c].filter(i);const e=No(c*c-4*u*d),t=2*u;return[(e-c)/t,(-c-e)/t].filter(i)}u/=l,c/=l,d/=l;const f=(3*c-u*u)/3,h=f/3,p=(2*u*u*u-9*u*c+27*d)/27,v=p/2,m=v*v+h*h*h;let g,y,b,w,x;if(m<0){const e=-f/3,t=No(e*e*e),n=-p/(2*t),r=Do(n<-1?-1:n>1?1:n),o=2*zo(t);return b=o*Ro(r/3)-u/3,w=o*Ro((r+Bo)/3)-u/3,x=o*Ro((r+2*Bo)/3)-u/3,[b,w,x].filter(i)}if(0===m)return g=v<0?zo(-v):-zo(v),b=2*g-u/3,w=-g-u/3,[b,w].filter(i);{const e=No(m);return g=zo(-v+e),y=zo(v+e),[g-y-u/3].filter(i)}},droots:function(e){if(3===e.length){const t=e[0],n=e[1],r=e[2],i=t-2*n+r;if(0!==i){const e=-No(n*n-t*r),o=-t+n;return[-(e+o)/i,-(-e+o)/i]}return n!==r&&0===i?[(2*n-r)/(2*(n-r))]:[]}if(2===e.length){const t=e[0],n=e[1];return t!==n?[t/(t-n)]:[]}return[]},curvature:function(e,t,n,r,i){let o,a,s,l,u=0,c=0;const d=qo.compute(e,t),f=qo.compute(e,n),h=d.x*d.x+d.y*d.y;if(r?(o=No(Io(d.y*f.z-f.y*d.z,2)+Io(d.z*f.x-f.z*d.x,2)+Io(d.x*f.y-f.x*d.y,2)),a=Io(h+d.z*d.z,1.5)):(o=d.x*f.y-d.y*f.x,a=Io(h,1.5)),0===o||0===a)return{k:0,r:0};if(u=o/a,c=a/o,!i){const i=qo.curvature(e-.001,t,n,r,!0).k,o=qo.curvature(e+.001,t,n,r,!0).k;l=(o-u+(u-i))/2,s=(Mo(o-u)+Mo(u-i))/2}return{k:u,r:c,dk:l,adk:s}},inflections:function(e){if(e.length<4)return[];const t=qo.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=t[2].x*t[1].y,r=t[3].x*t[1].y,i=t[1].x*t[2].y,o=18*(-3*n+2*r+3*i-t[3].x*t[2].y),a=18*(3*n-r-3*i),s=18*(i-n);if(qo.approximately(o,0)){if(!qo.approximately(a,0)){let e=-s/a;if(0<=e&&e<=1)return[e]}return[]}const l=a*a-4*o*s,u=Math.sqrt(l),c=2*o;return qo.approximately(c,0)?[]:[(u-a)/c,-(a+u)/c].filter((function(e){return 0<=e&&e<=1}))},bboxoverlap:function(e,t){const n=["x","y"],r=n.length;for(let i,o,a,s,l=0;l=s)return!1;return!0},expandbox:function(e,t){t.x.mine.x.max&&(e.x.max=t.x.max),t.y.max>e.y.max&&(e.y.max=t.y.max),t.z&&t.z.max>e.z.max&&(e.z.max=t.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,t,n){const r=e.bbox(),i=t.bbox(),o=1e5,a=n||.5;if(r.x.size+r.y.sizek||k>T)&&(E+=Bo),E>T&&(x=T,T=E,E=x)):T4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");r=!0}}else if(6!==i&&8!==i&&9!==i&&12!==i&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!r&&(9===i||12===i)||e&&e[0]&&"undefined"!==typeof e[0].z,a=this.points=[];for(let d=0,f=o?3:2;dKo(e.y)>1e-4)),this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(e,t,n,r){if("undefined"===typeof r&&(r=.5),0===r)return new ta(t,t,n);if(1===r)return new ta(e,t,t);const i=ta.getABC(2,e,t,n,r);return new ta(e,i.A,n)}static cubicFromPoints(e,t,n,r,i){"undefined"===typeof r&&(r=.5);const o=ta.getABC(3,e,t,n,r);"undefined"===typeof i&&(i=qo.dist(t,o.C));const a=i*(1-r)/r,s=qo.dist(e,n),l=(n.x-e.x)/s,u=(n.y-e.y)/s,c=i*l,d=i*u,f=a*l,h=a*u,p=t.x-c,v=t.y-d,m=t.x+f,g=t.y+h,y=o.A,b=y.x+(p-y.x)/(1-r),w=y.y+(v-y.y)/(1-r),x=y.x+(m-y.x)/r,E=y.y+(g-y.y)/r,k={x:e.x+(b-e.x)/r,y:e.y+(w-e.y)/r},T={x:n.x+(x-n.x)/(1-r),y:n.y+(E-n.y)/(1-r)};return new ta(e,k,T,n)}static getUtils(){return qo}getUtils(){return ta.getUtils()}static get PolyBezier(){return Wo}valueOf(){return this.toString()}toString(){return qo.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const e=this.points,t=["M",e[0].x,e[0].y,2===this.order?"Q":"C"];for(let n=1,r=e.length;n0}length(){return qo.length(this.derivative.bind(this))}static getABC(e=2,t,n,r,i=.5){const o=qo.projectionratio(i,e),a=1-o,s={x:o*t.x+a*r.x,y:o*t.y+a*r.y},l=qo.abcratio(i,e);return{A:{x:n.x+(n.x-s.x)/l,y:n.y+(n.y-s.y)/l},B:n,C:s,S:t,E:r}}getABC(e,t){t=t||this.get(e);let n=this.points[0],r=this.points[this.order];return ta.getABC(this.order,n,t,r,e)}getLUT(e){if(this.verify(),e=e||100,this._lut.length===e)return this._lut;this._lut=[],e--;for(let t,n,r=0;r1?1:f,l=this.compute(f),l.t=f,l.d=c,l}get(e){return this.compute(e)}point(e){return this.points[e]}compute(e){return this.ratios?qo.computeWithRatios(e,this.points,this.ratios,this._3d):qo.compute(e,this.points,this._3d,this.ratios)}raise(){const e=this.points,t=[e[0]],n=e.length;for(let r,i,o=1;o1;){n=[];for(let o,a=0,s=t.length-1;a=0&&e<=1})),t=t.concat(e[n].sort(qo.numberSort))}.bind(this)),e.values=t.sort(qo.numberSort).filter((function(e,n){return t.indexOf(e)===n})),e}bbox(){const e=this.extrema(),t={};return this.dims.forEach(function(n){t[n]=qo.getminmax(this,n,e[n])}.bind(this)),t}overlaps(e){const t=this.bbox(),n=e.bbox();return qo.bboxoverlap(t,n)}offset(e,t){if("undefined"!==typeof t){const n=this.get(e),r=this.normal(e),i={c:n,n:r,x:n.x+r.x*t,y:n.y+r.y*t};return this._3d&&(i.z=n.z+r.z*t),i}if(this._linear){const t=this.normal(0),n=this.points.map((function(n){const r={x:n.x+e*t.x,y:n.y+e*t.y};return n.z&&t.z&&(r.z=n.z+e*t.z),r}));return[new ta(n)]}return this.reduce().map((function(t){return t._linear?t.offset(e)[0]:t.scale(e)}))}simple(){if(3===this.order){const e=qo.angle(this.points[0],this.points[3],this.points[1]),t=qo.angle(this.points[0],this.points[3],this.points[2]);if(e>0&&t<0||e<0&&t>0)return!1}const e=this.normal(0),t=this.normal(1);let n=e.x*t.x+e.y*t.y;return this._3d&&(n+=e.z*t.z),Ko(Qo(n)){if(2===t&&e)return;const n=l[e*t],r=this.derivative(e),i={x:n.x+r.x,y:n.y+r.y};l[e+1]=qo.lli4(n,i,u,s[e+1])})),new ta(l))}outline(e,t,n,r){t="undefined"===typeof t?e:t;const i=this.reduce(),o=i.length,a=[];let s,l=[],u=0,c=this.length();const d="undefined"!==typeof n&&"undefined"!==typeof r;function f(e,t,n,r,i){return function(o){const a=r/n,s=(r+i)/n,l=t-e;return qo.map(o,0,1,e+a*l,e+s*l)}}i.forEach((function(i){const o=i.length();d?(a.push(i.scale(f(e,n,c,u,o))),l.push(i.scale(f(-t,-r,c,u,o)))):(a.push(i.scale(e)),l.push(i.scale(-t))),u+=o})),l=l.map((function(e){return s=e.points,s[3]?e.points=[s[3],s[2],s[1],s[0]]:e.points=[s[2],s[1],s[0]],e})).reverse();const h=a[0].points[0],p=a[o-1].points[a[o-1].points.length-1],v=l[o-1].points[l[o-1].points.length-1],m=l[0].points[0],g=qo.makeline(v,h),y=qo.makeline(p,m),b=[g].concat(a).concat([y]).concat(l);b.length;return new Wo(b)}outlineshapes(e,t,n){t=t||e;const r=this.outline(e,t).curves,i=[];for(let o=1,a=r.length;o1,e.endcap.virtual=o{var o=this.get(e);return qo.between(o.x,t,r)&&qo.between(o.y,n,i)}))}selfintersects(e){const t=this.reduce(),n=t.length-2,r=[];for(let i,o,a,s=0;s0&&(i=i.concat(t))})),i}arcs(e){return e=e||.5,this._iterate(e,[])}_error(e,t,n,r){const i=(r-n)/4,o=this.get(n+i),a=this.get(r-i),s=qo.dist(e,t),l=qo.dist(e,o),u=qo.dist(e,a);return Ko(l-s)+Ko(u-s)}_iterate(e,t){let n,r=0,i=1;do{n=0,i=1;let o,a,s,l,u,c=this.get(r),d=!1,f=!1,h=i,p=1,v=0;do{if(f=d,l=s,h=(r+i)/2,v++,o=this.get(h),a=this.get(i),s=qo.getccenter(c,o,a),s.interval={start:r,end:i},d=this._error(s,c,r,i)<=e,u=f&&!d,u||(p=i),d){if(i>=1){if(s.interval.end=p=1,l=s,i>1){let e={x:s.x+s.r*Xo(s.e),y:s.y+s.r*Yo(s.e)};s.e+=qo.angle({x:s.x,y:s.y},e,this.get(1))}break}i+=(i-r)/2}else i=h}while(!u&&n++<100);if(n>=100)break;l=l||s,t.push(l),r=p}while(i<1);return t}}var na=r(1527),ra=r(2462),ia=r(7646);function oa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function aa(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.cooldownTicks||new Date-e.startTickTime>e.cooldownTime||e.d3AlphaMin>0&&e.forceLayout.alpha()0){var a=Math.atan2(r.y-n.y,r.x-n.x),s=i*t,l={x:(n.x+r.x)/2+s*Math.cos(a-Math.PI/2),y:(n.y+r.y)/2+s*Math.sin(a-Math.PI/2)};e.__controlPoints=[l.x,l.y]}else{var u=70*t;e.__controlPoints=[r.x,r.y-u,r.x+u,r.y]}}));var c=[],d=[],f=u;if(e.linkCanvasObject){var h=[],p=[];u.forEach((function(e){return({before:c,after:d,replace:h}[a(e)]||p).push(e)})),f=[].concat(ha(c),d,p),c=c.concat(h)}s.save(),c.forEach((function(t){return e.linkCanvasObject(t,s,e.globalScale)})),s.restore();var v=(0,na.Z)(f,[n,r,i]);s.save(),Object.entries(v).forEach((function(t){var n=fa(t,2),r=n[0],o=n[1],a=r&&"undefined"!==r?r:"rgba(0,0,0,0.15)";Object.entries(o).forEach((function(t){var n=fa(t,2),r=n[0],o=n[1],u=(r||1)/e.globalScale+l;Object.entries(o).forEach((function(e){var t=fa(e,2);t[0];var n=t[1],r=i(n[0]);s.beginPath(),n.forEach((function(e){var t=e.source,n=e.target;if(t&&n&&t.hasOwnProperty("x")&&n.hasOwnProperty("x")){s.moveTo(t.x,t.y);var r=e.__controlPoints;r?s[2===r.length?"quadraticCurveTo":"bezierCurveTo"].apply(s,ha(r).concat([n.x,n.y])):s.lineTo(n.x,n.y)}})),s.strokeStyle=a,s.lineWidth=u,s.setLineDash(r||[]),s.stroke()}))}))})),s.restore(),s.save(),d.forEach((function(t){return e.linkCanvasObject(t,s,e.globalScale)})),s.restore()}(),!e.isShadow&&function(){var t=(0,w.default)(e.linkDirectionalArrowLength),n=(0,w.default)(e.linkDirectionalArrowRelPos),r=(0,w.default)(e.linkVisibility),i=(0,w.default)(e.linkDirectionalArrowColor||e.linkColor),o=(0,w.default)(e.nodeVal),a=e.ctx;a.save(),e.graphData.links.filter(r).forEach((function(r){var s=t(r);if(s&&!(s<0)){var l=r.source,u=r.target;if(l&&u&&l.hasOwnProperty("x")&&u.hasOwnProperty("x")){var c=Math.sqrt(Math.max(0,o(l)||1))*e.nodeRelSize,d=Math.sqrt(Math.max(0,o(u)||1))*e.nodeRelSize,f=Math.min(1,Math.max(0,n(r))),h=i(r)||"rgba(0,0,0,0.28)",p=s/1.6/2,v=r.__controlPoints&&da(ta,[l.x,l.y].concat(ha(r.__controlPoints),[u.x,u.y])),m=v?function(e){return v.get(e)}:function(e){return{x:l.x+(u.x-l.x)*e||0,y:l.y+(u.y-l.y)*e||0}},g=v?v.length():Math.sqrt(Math.pow(u.x-l.x,2)+Math.pow(u.y-l.y,2)),y=c+s+(g-c-d-s)*f,b=m(y/g),w=m((y-s)/g),x=m((y-.8*s)/g),E=Math.atan2(b.y-w.y,b.x-w.x)-Math.PI/2;a.beginPath(),a.moveTo(b.x,b.y),a.lineTo(w.x+p*Math.cos(E),w.y+p*Math.sin(E)),a.lineTo(x.x,x.y),a.lineTo(w.x-p*Math.cos(E),w.y-p*Math.sin(E)),a.fillStyle=h,a.fill()}}})),a.restore()}(),!e.isShadow&&function(){var t=(0,w.default)(e.linkDirectionalParticles),n=(0,w.default)(e.linkDirectionalParticleSpeed),r=(0,w.default)(e.linkDirectionalParticleWidth),i=(0,w.default)(e.linkVisibility),o=(0,w.default)(e.linkDirectionalParticleColor||e.linkColor),a=e.ctx;a.save(),e.graphData.links.filter(i).forEach((function(i){var s=t(i);if(i.hasOwnProperty("__photons")&&i.__photons.length){var l=i.source,u=i.target;if(l&&u&&l.hasOwnProperty("x")&&u.hasOwnProperty("x")){var c=n(i),d=i.__photons||[],f=Math.max(0,r(i)/2)/Math.sqrt(e.globalScale),h=o(i)||"rgba(0,0,0,0.28)";a.fillStyle=h;var p=i.__controlPoints?da(ta,[l.x,l.y].concat(ha(i.__controlPoints),[u.x,u.y])):null,v=0,m=!1;d.forEach((function(e){var t=!!e.__singleHop;if(e.hasOwnProperty("__progressRatio")||(e.__progressRatio=t?0:v/s),!t&&v++,e.__progressRatio+=c,e.__progressRatio>=1){if(t)return void(m=!0);e.__progressRatio=e.__progressRatio%1}var n=e.__progressRatio,r=p?p.get(n):{x:l.x+(u.x-l.x)*n||0,y:l.y+(u.y-l.y)*n||0};a.beginPath(),a.arc(r.x,r.y,f,0,2*Math.PI,!1),a.fill()})),m&&(i.__photons=i.__photons.filter((function(e){return!e.__singleHop||e.__progressRatio<=1})))}}})),a.restore()}(),function(){var t=(0,w.default)(e.nodeVisibility),n=(0,w.default)(e.nodeVal),r=(0,w.default)(e.nodeColor),i=(0,w.default)(e.nodeCanvasObjectMode),o=e.ctx,a=e.isShadow/e.globalScale,s=e.graphData.nodes.filter(t);o.save(),s.forEach((function(t){var s=i(t);if(!e.nodeCanvasObject||"before"!==s&&"replace"!==s||(e.nodeCanvasObject(t,o,e.globalScale),"replace"!==s)){var l=Math.sqrt(Math.max(0,n(t)||1))*e.nodeRelSize+a;o.beginPath(),o.arc(t.x,t.y,l,0,2*Math.PI,!1),o.fillStyle=r(t)||"rgba(31, 120, 180, 0.92)",o.fill(),e.nodeCanvasObject&&"after"===s&&e.nodeCanvasObject(t,e.ctx,e.globalScale)}else o.restore()})),o.restore()}(),this},emitParticle:function(e,t){return t&&(!t.__photons&&(t.__photons=[]),t.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:(0,Oo.Z)().force("link",(0,Co.Z)()).force("charge",(0,Ao.Z)()).force("center",(0,So.Z)()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(e,t){t.ctx=e},update:function(e){if(e.engineRunning=!1,e.onUpdate(),null!==e.nodeAutoColorBy&&ga(e.graphData.nodes,(0,w.default)(e.nodeAutoColorBy),e.nodeColor),null!==e.linkAutoColorBy&&ga(e.graphData.links,(0,w.default)(e.linkAutoColorBy),e.linkColor),e.graphData.links.forEach((function(t){t.source=t[e.linkSource],t.target=t[e.linkTarget]})),!e.isShadow){var t=(0,w.default)(e.linkDirectionalParticles);e.graphData.links.forEach((function(e){var n=Math.round(Math.abs(t(e)));n?e.__photons=ha(Array(n)).map((function(){return{}})):delete e.__photons}))}e.forceLayout.stop().alpha(1).nodes(e.graphData.nodes);var n=e.forceLayout.force("link");n&&n.id((function(t){return t[e.nodeId]})).links(e.graphData.links);var r=e.dagMode&&function(e,t){var n=e.nodes,r=e.links,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.nodeFilter,a=void 0===o?function(){return!0}:o,s=i.onLoopError,l=void 0===s?function(e){throw"Invalid DAG structure! Found cycle in node path: ".concat(e.join(" -> "),".")}:s,u={};n.forEach((function(e){return u[t(e)]={data:e,out:[],depth:-1,skip:!a(e)}})),r.forEach((function(e){var n=e.source,r=e.target,i=l(n),o=l(r);if(!u.hasOwnProperty(i))throw"Missing source node with id: ".concat(i);if(!u.hasOwnProperty(o))throw"Missing target node with id: ".concat(o);var a=u[i],s=u[o];function l(e){return"object"===sa(e)?t(e):e}a.out.push(s)}));var c=[];return d(Object.values(u)),Object.assign.apply(Object,[{}].concat(ha(Object.entries(u).filter((function(e){return!fa(e,2)[1].skip})).map((function(e){var t=fa(e,2);return la({},t[0],t[1].depth)})))));function d(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=0,o=e.length;ia.depth&&(a.depth=r,d(a.out,[].concat(ha(n),[a]),r+(a.skip?0:1)))}}}(e.graphData,(function(t){return t[e.nodeId]}),{nodeFilter:e.dagNodeFilter,onLoopError:e.onDagError||void 0}),i=Math.max.apply(Math,ha(Object.values(r||[]))),o=e.dagLevelDistance||e.graphData.nodes.length/(i||1)*2*(-1!==["radialin","radialout"].indexOf(e.dagMode)?.7:1);if(e.dagMode){var a=function(t,n){return function(a){return t?(r[a[e.nodeId]]-i/2)*o*(n?-1:1):void 0}},s=a(-1!==["lr","rl"].indexOf(e.dagMode),"rl"===e.dagMode),l=a(-1!==["td","bu"].indexOf(e.dagMode),"bu"===e.dagMode);e.graphData.nodes.filter(e.dagNodeFilter).forEach((function(e){e.fx=s(e),e.fy=l(e)}))}e.forceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(e.dagMode)?(0,Po.Z)((function(t){var n=r[t[e.nodeId]]||-1;return("radialin"===e.dagMode?i-n:n)*o})).strength((function(t){return e.dagNodeFilter(t)?1:0})):null);for(var u=0;u0&&e.forceLayout.alpha()1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,r=arguments.length,i=new Array(r>3?r-3:0),o=3;o1&&void 0!==arguments[1]?arguments[1]:function(){return!0},n=(0,w.default)(e.nodeVal),r=function(t){return Math.sqrt(Math.max(0,n(t)||1))*e.nodeRelSize},i=e.graphData.nodes.filter(t).map((function(e){return{x:e.x,y:e.y,r:r(e)}}));return i.length?{x:[(0,ho.Z)(i,(function(e){return e.x-e.r})),(0,po.Z)(i,(function(e){return e.x+e.r}))],y:[(0,ho.Z)(i,(function(e){return e.y-e.r})),(0,po.Z)(i,(function(e){return e.y+e.r}))]}:null},pauseAnimation:function(e){return e.animationFrameRequestId&&(cancelAnimationFrame(e.animationFrameRequestId),e.animationFrameRequestId=null),this},resumeAnimation:function(e){return e.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},Ta),stateInit:function(){return{lastSetZoom:1,zoom:oo(),forceGraph:new ba,shadowGraph:(new ba).cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new _o}},init:function(e,t){e.innerHTML="";var n=document.createElement("div");n.classList.add("force-graph-container"),n.style.position="relative",e.appendChild(n),t.canvas=document.createElement("canvas"),t.backgroundColor&&(t.canvas.style.background=t.backgroundColor),n.appendChild(t.canvas),t.shadowCanvas=document.createElement("canvas");var r=t.canvas.getContext("2d"),i=t.shadowCanvas.getContext("2d"),o={x:-1e12,y:-1e12},a=function(){var e=null,n=window.devicePixelRatio,r=o.x>0&&o.y>0?i.getImageData(o.x*n,o.y*n,1,1):null;return r&&(e=t.colorTracker.lookup(r.data)),e};Jn(t.canvas).call(function(){var e,t,n,r,i=lo,o=uo,a=co,s=fo,l={},u=(0,er.Z)("start","drag","end"),c=0,d=0;function f(e){e.on("mousedown.drag",h).filter(s).on("touchstart.drag",m).on("touchmove.drag",g,tr).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,s){if(!r&&i.call(this,a,s)){var l=b(this,o.call(this,a,s),a,s,"mouse");l&&(Jn(a.view).on("mousemove.drag",p,nr).on("mouseup.drag",v,nr),or(a.view),rr(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function p(r){if(ir(r),!n){var i=r.clientX-e,o=r.clientY-t;n=i*i+o*o>d}l.mouse("drag",r)}function v(e){Jn(e.view).on("mousemove.drag mouseup.drag",null),ar(e.view,n),ir(e),l.mouse("end",e)}function m(e,t){if(i.call(this,e,t)){var n,r,a=e.changedTouches,s=o.call(this,e,t),l=a.length;for(n=0;n0||t.isPointerPressed)&&("touch"!==r.pointerType||void 0===r.movementX||[r.movementX,r.movementY].some((function(e){return Math.abs(e)>1})))&&(t.isPointerDragging=!0);var i=function(e){var t=e.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+r,left:t.left+n}}(n);o.x=r.pageX-i.left,o.y=r.pageY-i.top,s.style.top="".concat(o.y,"px"),s.style.left="".concat(o.x,"px")}),{passive:!0})})),n.addEventListener("pointerup",(function(e){if(t.isPointerPressed=!1,t.isPointerDragging)t.isPointerDragging=!1;else{var n=[e,t.pointerDownEvent];requestAnimationFrame((function(){if(0===e.button)if(t.hoverObj){var r=t["on".concat(t.hoverObj.type,"Click")];r&&r.apply(void 0,[t.hoverObj.d].concat(n))}else t.onBackgroundClick&&t.onBackgroundClick.apply(t,n);if(2===e.button)if(t.hoverObj){var i=t["on".concat(t.hoverObj.type,"RightClick")];i&&i.apply(void 0,[t.hoverObj.d].concat(n))}else t.onBackgroundRightClick&&t.onBackgroundRightClick.apply(t,n)}))}}),{passive:!0}),n.addEventListener("contextmenu",(function(e){return!(t.onBackgroundRightClick||t.onNodeRightClick||t.onLinkRightClick)||(e.preventDefault(),!1)})),t.forceGraph(r),t.shadowGraph(i);var l=mo()((function(){Ca(i,t.width,t.height),t.shadowGraph.linkWidth((function(e){return(0,w.default)(t.linkWidth)(e)+t.linkHoverPrecision}));var e=Xi(t.canvas);t.shadowGraph.globalScale(e.k).tickFrame()}),800);(this._animationCycle=function e(){var n=!t.autoPauseRedraw||!!t.needsRedraw||t.forceGraph.isEngineRunning()||t.graphData.links.some((function(e){return e.__photons&&e.__photons.length}));if(t.needsRedraw=!1,t.enablePointerInteraction){var i=t.isPointerDragging?null:a();if(i!==t.hoverObj){var o=t.hoverObj,u=o?o.type:null,c=i?i.type:null;if(u&&u!==c){var d=t["on".concat(u,"Hover")];d&&d(null,o.d)}if(c){var f=t["on".concat(c,"Hover")];f&&f(i.d,u===c?o.d:null)}var h=i&&(0,w.default)(t["".concat(i.type.toLowerCase(),"Label")])(i.d)||"";s.style.visibility=h?"visible":"hidden",s.innerHTML=h,t.canvas.classList[i&&t["on".concat(c,"Click")]||!i&&t.onBackgroundClick?"add":"remove"]("clickable"),t.hoverObj=i}n&&l()}if(n){Ca(r,t.width,t.height);var p=Xi(t.canvas).k;t.onRenderFramePre&&t.onRenderFramePre(r,p),t.forceGraph.globalScale(p).tickFrame(),t.onRenderFramePost&&t.onRenderFramePost(r,p)}st.update(),t.animationFrameRequestId=requestAnimationFrame(e)})()},update:function(e){}}),Sa={width:P().number,height:P().number,graphData:P().shape({nodes:P().arrayOf(P().object).isRequired,links:P().arrayOf(P().object).isRequired}),backgroundColor:P().string,nodeRelSize:P().number,nodeId:P().string,nodeLabel:P().oneOfType([P().string,P().func]),nodeVal:P().oneOfType([P().number,P().string,P().func]),nodeVisibility:P().oneOfType([P().bool,P().string,P().func]),nodeColor:P().oneOfType([P().string,P().func]),nodeAutoColorBy:P().oneOfType([P().string,P().func]),onNodeHover:P().func,onNodeClick:P().func,linkSource:P().string,linkTarget:P().string,linkLabel:P().oneOfType([P().string,P().func]),linkVisibility:P().oneOfType([P().bool,P().string,P().func]),linkColor:P().oneOfType([P().string,P().func]),linkAutoColorBy:P().oneOfType([P().string,P().func]),linkWidth:P().oneOfType([P().number,P().string,P().func]),linkCurvature:P().oneOfType([P().number,P().string,P().func]),linkDirectionalArrowLength:P().oneOfType([P().number,P().string,P().func]),linkDirectionalArrowColor:P().oneOfType([P().string,P().func]),linkDirectionalArrowRelPos:P().oneOfType([P().number,P().string,P().func]),linkDirectionalParticles:P().oneOfType([P().number,P().string,P().func]),linkDirectionalParticleSpeed:P().oneOfType([P().number,P().string,P().func]),linkDirectionalParticleWidth:P().oneOfType([P().number,P().string,P().func]),linkDirectionalParticleColor:P().oneOfType([P().string,P().func]),onLinkHover:P().func,onLinkClick:P().func,dagMode:P().oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:P().number,dagNodeFilter:P().func,onDagError:P().func,d3AlphaMin:P().number,d3AlphaDecay:P().number,d3VelocityDecay:P().number,warmupTicks:P().number,cooldownTicks:P().number,cooldownTime:P().number,onEngineTick:P().func,onEngineStop:P().func,getGraphBbox:P().func},Pa={zoomToFit:P().func,onNodeRightClick:P().func,onNodeDrag:P().func,onNodeDragEnd:P().func,onLinkRightClick:P().func,linkHoverPrecision:P().number,onBackgroundClick:P().func,onBackgroundRightClick:P().func,enablePointerInteraction:P().bool,enableNodeDrag:P().bool},Ma={showNavInfo:P().bool,nodeOpacity:P().number,nodeResolution:P().number,nodeThreeObject:P().oneOfType([P().object,P().string,P().func]),nodeThreeObjectExtend:P().oneOfType([P().bool,P().string,P().func]),linkOpacity:P().number,linkResolution:P().number,linkCurveRotation:P().oneOfType([P().number,P().string,P().func]),linkMaterial:P().oneOfType([P().object,P().string,P().func]),linkThreeObject:P().oneOfType([P().object,P().string,P().func]),linkThreeObjectExtend:P().oneOfType([P().bool,P().string,P().func]),linkPositionUpdate:P().func,linkDirectionalArrowResolution:P().number,linkDirectionalParticleResolution:P().number,forceEngine:P().oneOf(["d3","ngraph"]),ngraphPhysics:P().object,numDimensions:P().oneOf([1,2,3])},Ra=Object.assign({},Sa,Pa,{linkLineDash:P().oneOfType([P().arrayOf(P().number),P().string,P().func]),nodeCanvasObjectMode:P().oneOfType([P().string,P().func]),nodeCanvasObject:P().func,nodePointerAreaPaint:P().func,linkCanvasObjectMode:P().oneOfType([P().string,P().func]),linkCanvasObject:P().func,linkPointerAreaPaint:P().func,autoPauseRedraw:P().bool,minZoom:P().number,maxZoom:P().number,enableZoomInteraction:P().bool,enablePanInteraction:P().bool,onZoom:P().func,onZoomEnd:P().func,onRenderFramePre:P().func,onRenderFramePost:P().func}),ja=Object.assign({},Sa,Pa,Ma,{enableNavigationControls:P().bool,controlType:P().oneOf(["trackball","orbit","fly"]),rendererConfig:P().object,extraRenderers:P().arrayOf(P().shape({render:P().func.isRequired}))}),Da=Object.assign({},Sa,Ma,{nodeDesc:P().oneOfType([P().string,P().func]),linkDesc:P().oneOfType([P().string,P().func])}),La=Object.assign({},Sa,Ma,{markerAttrs:P().object,yOffset:P().number,glScale:P().number});const Na=y(A,{methodNames:["getGraphBbox","emitParticle","d3Force","d3ReheatSimulation","refresh"]});Na.displayName="ForceGraphVR",Na.propTypes=Da;const Ia=y(z,{methodNames:["getGraphBbox","emitParticle","d3Force","d3ReheatSimulation","refresh"],initPropNames:["markerAttrs"]});Ia.displayName="ForceGraphAR",Ia.propTypes=La;const za=y(St,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","cameraPosition","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords","postProcessingComposer","scene","camera","renderer","controls","refresh"],initPropNames:["controlType","rendererConfig","extraRenderers"]});za.displayName="ForceGraph3D",za.propTypes=ja;const Ha=y(Aa,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Ha.displayName="ForceGraph2D",Ha.propTypes=Ra},1398:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return le}});var r=n(2212),i=n(4505),o=n(5560),a=n(2405),s=n(216),l=n(6917),u=n(4736),c=n.n(u),d=n(6505),f=n.n(d),h=n(4858),p=n(2539),v=n(6701),m=n(3752),g=n(1527);function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||k(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e){return function(e){if(Array.isArray(e))return T(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){if(e){if("string"===typeof e)return T(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function U(e,t){return!t||"object"!==typeof t&&"function"!==typeof t?V(e):t}function G(e){var t=H();return function(){var n,r=I(e);if(t){var i=I(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return U(this,n)}}function q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(l){s=!0,i=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(e,t)||K(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function W(e){return function(e){if(Array.isArray(e))return Z(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||K(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(e,t){if(e){if("string"===typeof e)return Z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z(e,t):void 0}}function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:{},r=n.objFilter,i=void 0===r?function(){return!0}:r,o=F(n,Q);return O(e,t.children.filter(i),(function(e){return t.add(e)}),(function(e){t.remove(e),Y(e)}),R({objBindAttr:"__threeObj"},o))}var ee=function(e){return isNaN(e)?parseInt(P()(e).toHex(),16):e},te=function(e){return isNaN(e)?P()(e).getAlpha():1},ne=(0,C.Z)(A.Z);function re(e,t,n){t&&"string"===typeof n&&e.filter((function(e){return!e[n]})).forEach((function(e){e[n]=ne(t(e))}))}var ie=window.THREE?window.THREE:{Group:r.ZAu,Mesh:r.Kj0,MeshLambertMaterial:r.YBo,Color:r.Ilk,BufferGeometry:r.u9r,BufferAttribute:r.TlE,Matrix4:r.yGw,Vector3:r.Pa4,SphereBufferGeometry:r.Aip,CylinderBufferGeometry:r.m_w,TubeBufferGeometry:r.Lcc,ConeBufferGeometry:r._3,Line:r.x12,LineBasicMaterial:r.nls,QuadraticBezierCurve3:r.mXe,CubicBezierCurve3:r.yj7,Box3:r.ZzF},oe={graph:c(),forcelayout:f()},ae=(new ie.BufferGeometry).setAttribute?"setAttribute":"addAttribute",se=(new ie.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix";var le=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=function(t){N(i,t);var r=G(i);function i(){var t;D(this,i);for(var o=arguments.length,a=new Array(o),s=0;s2?-60:-30),e<3&&r(t.graphData.nodes,"z"),e<2&&r(t.graphData.nodes,"y")}},dagMode:{onChange:function(e,t){!e&&"d3"===t.forceEngine&&(t.graphData.nodes||[]).forEach((function(e){return e.fx=e.fy=e.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(e){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaDecay(e)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.alphaTarget(e)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(e,t){t.d3ForceLayout.velocityDecay(e)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(e){return e._flushObjects=!0,e._rerender(),this},d3Force:function(e,t,n){return void 0===n?e.d3ForceLayout.force(t):(e.d3ForceLayout.force(t,n),this)},d3ReheatSimulation:function(e){return e.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(e){return e.cntTicks=0,e.startTickTime=new Date,e.engineRunning=!0,this},tickFrame:function(e){var t="ngraph"!==e.forceEngine;return e.engineRunning&&function(){++e.cntTicks>e.cooldownTicks||new Date-e.startTickTime>e.cooldownTime||t&&e.d3AlphaMin>0&&e.d3ForceLayout.alpha()0){var p=s.x-a.x,v=s.y-a.y||0,m=(new ie.Vector3).subVectors(d,c),g=m.clone().multiplyScalar(l).cross(0!==p||0!==v?new ie.Vector3(0,0,1):new ie.Vector3(0,1,0)).applyAxisAngle(m.normalize(),h).add((new ie.Vector3).addVectors(c,d).divideScalar(2));u=new ie.QuadraticBezierCurve3(c,g,d)}else{var y=70*l,b=-h,w=b+Math.PI/2;u=new ie.CubicBezierCurve3(c,new ie.Vector3(y*Math.cos(w),y*Math.sin(w),0).add(c),new ie.Vector3(y*Math.cos(b),y*Math.sin(b),0).add(c),d)}n.__curve=u}else n.__curve=null}}e.graphData.links.forEach((function(r){var i=r.__lineObj;if(i){var s=t?r:e.layout.getLinkPosition(e.layout.graph.getLink(r.source,r.target).id),l=s[t?"source":"from"],u=s[t?"target":"to"];if(l&&u&&l.hasOwnProperty("x")&&u.hasOwnProperty("x")){a(r);var c=o(r);if(!e.linkPositionUpdate||!e.linkPositionUpdate(c?i.children[1]:i,{start:{x:l.x,y:l.y,z:l.z},end:{x:u.x,y:u.y,z:u.z}},r)||c){var d=30,f=r.__curve,h=i.children.length?i.children[0]:i;if("Line"===h.type){if(f)h.geometry.setFromPoints(f.getPoints(d));else{var p=h.geometry.getAttribute("position");p&&p.array&&6===p.array.length||h.geometry[ae]("position",p=new ie.BufferAttribute(new Float32Array(6),3)),p.array[0]=l.x,p.array[1]=l.y||0,p.array[2]=l.z||0,p.array[3]=u.x,p.array[4]=u.y||0,p.array[5]=u.z||0,p.needsUpdate=!0}h.geometry.computeBoundingSphere()}else if("Mesh"===h.type)if(f){h.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(h.position.set(0,0,0),h.rotation.set(0,0,0),h.scale.set(1,1,1));var v=Math.ceil(10*n(r))/10/2,m=new ie.TubeBufferGeometry(f,d,v,e.linkResolution,!1);h.geometry.dispose(),h.geometry=m}else{if(!h.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var g=Math.ceil(10*n(r))/10/2,y=new ie.CylinderBufferGeometry(g,g,1,e.linkResolution,1,!1);y[se]((new ie.Matrix4).makeTranslation(0,.5,0)),y[se]((new ie.Matrix4).makeRotationX(Math.PI/2)),h.geometry.dispose(),h.geometry=y}var b=new ie.Vector3(l.x,l.y||0,l.z||0),w=new ie.Vector3(u.x,u.y||0,u.z||0),x=b.distanceTo(w);h.position.x=b.x,h.position.y=b.y,h.position.z=b.z,h.scale.z=x,h.parent.localToWorld(w),h.lookAt(w)}}}}}))}(),function(){var n=(0,p.default)(e.linkDirectionalArrowRelPos),r=(0,p.default)(e.linkDirectionalArrowLength),i=(0,p.default)(e.nodeVal);e.graphData.links.forEach((function(o){var a=o.__arrowObj;if(a){var s=t?o:e.layout.getLinkPosition(e.layout.graph.getLink(o.source,o.target).id),l=s[t?"source":"from"],u=s[t?"target":"to"];if(l&&u&&l.hasOwnProperty("x")&&u.hasOwnProperty("x")){var c=Math.sqrt(Math.max(0,i(l)||1))*e.nodeRelSize,d=Math.sqrt(Math.max(0,i(u)||1))*e.nodeRelSize,f=r(o),h=n(o),p=o.__curve?function(e){return o.__curve.getPoint(e)}:function(e){var t=function(e,t,n,r){return t[e]+(n[e]-t[e])*r||0};return{x:t("x",l,u,e),y:t("y",l,u,e),z:t("z",l,u,e)}},v=o.__curve?o.__curve.getLength():Math.sqrt(["x","y","z"].map((function(e){return Math.pow((u[e]||0)-(l[e]||0),2)})).reduce((function(e,t){return e+t}),0)),m=c+f+(v-c-d-f)*h,g=p(m/v),y=p((m-f)/v);["x","y","z"].forEach((function(e){return a.position[e]=y[e]}));var b=B(ie.Vector3,W(["x","y","z"].map((function(e){return g[e]}))));a.parent.localToWorld(b),a.lookAt(b)}}}))}(),function(){var n=(0,p.default)(e.linkDirectionalParticleSpeed);e.graphData.links.forEach((function(r){var i=r.__photonsObj&&r.__photonsObj.children,o=r.__singleHopPhotonsObj&&r.__singleHopPhotonsObj.children;if(o&&o.length||i&&i.length){var a=t?r:e.layout.getLinkPosition(e.layout.graph.getLink(r.source,r.target).id),s=a[t?"source":"from"],l=a[t?"target":"to"];if(s&&l&&s.hasOwnProperty("x")&&l.hasOwnProperty("x")){var u=n(r),c=r.__curve?function(e){return r.__curve.getPoint(e)}:function(e){var t=function(e,t,n,r){return t[e]+(n[e]-t[e])*r||0};return{x:t("x",s,l,e),y:t("y",s,l,e),z:t("z",s,l,e)}};[].concat(W(i||[]),W(o||[])).forEach((function(e,t){var n="singleHopPhotons"===e.parent.__linkThreeObjType;if(e.hasOwnProperty("__progressRatio")||(e.__progressRatio=n?0:t/i.length),e.__progressRatio+=u,e.__progressRatio>=1){if(n)return e.parent.remove(e),void Y(e);e.__progressRatio=e.__progressRatio%1}var r=e.__progressRatio,o=c(r);["x","y","z"].forEach((function(t){return e.position[t]=o[t]}))}))}}}))}(),this},emitParticle:function(e,t){if(t){if(!t.__singleHopPhotonsObj){var n=new ie.Group;n.__linkThreeObjType="singleHopPhotons",t.__singleHopPhotonsObj=n,e.graphScene.add(n)}var r=(0,p.default)(e.linkDirectionalParticleWidth),i=Math.ceil(10*r(t))/10/2,o=e.linkDirectionalParticleResolution,a=new ie.SphereBufferGeometry(i,o,o),s=(0,p.default)(e.linkColor),l=(0,p.default)(e.linkDirectionalParticleColor)(t)||s(t)||"#f0f0f0",u=new ie.Color(ee(l)),c=3*e.linkOpacity,d=new ie.MeshLambertMaterial({color:u,transparent:!0,opacity:c});t.__singleHopPhotonsObj.add(new ie.Mesh(a,d))}return this},getGraphBbox:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!e.initialised)return null;var n=function e(n){var r=[];if(n.geometry){n.geometry.computeBoundingBox();var i=new ie.Box3;i.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld),r.push(i)}return r.concat.apply(r,W((n.children||[]).filter((function(e){return!e.hasOwnProperty("__graphObjType")||"node"===e.__graphObjType&&t(e.__data)})).map(e)))}(e.graphScene);return n.length?Object.assign.apply(Object,W(["x","y","z"].map((function(e){return L({},e,[(0,v.Z)(n,(function(t){return t.min[e]})),(0,m.Z)(n,(function(t){return t.max[e]}))])})))):null}},stateInit:function(){return{d3ForceLayout:(0,i.Z)().force("link",(0,o.Z)()).force("charge",(0,a.Z)()).force("center",(0,s.Z)()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(e,t){t.graphScene=e},update:function(e,t){var n=function(e){return e.some((function(e){return t.hasOwnProperty(e)}))};if(e.engineRunning=!1,e.onUpdate(),null!==e.nodeAutoColorBy&&n(["nodeAutoColorBy","graphData","nodeColor"])&&re(e.graphData.nodes,(0,p.default)(e.nodeAutoColorBy),e.nodeColor),null!==e.linkAutoColorBy&&n(["linkAutoColorBy","graphData","linkColor"])&&re(e.graphData.links,(0,p.default)(e.linkAutoColorBy),e.linkColor),e._flushObjects||n(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var r=(0,p.default)(e.nodeThreeObject),i=(0,p.default)(e.nodeThreeObjectExtend),o=(0,p.default)(e.nodeVal),a=(0,p.default)(e.nodeColor),s=(0,p.default)(e.nodeVisibility),u={},c={};J(e.graphData.nodes.filter(s),e.graphScene,{purge:e._flushObjects||n(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(e){return"node"===e.__graphObjType},createObj:function(t){var n,o=r(t),a=i(t);return o&&e.nodeThreeObject===o&&(o=o.clone()),o&&!a?n=o:((n=new ie.Mesh).__graphDefaultObj=!0,o&&a&&n.add(o)),n.__graphObjType="node",n},updateObj:function(t,n){if(t.__graphDefaultObj){var r=o(n)||1,i=Math.cbrt(r)*e.nodeRelSize,s=e.nodeResolution;t.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&t.geometry.parameters.radius===i&&t.geometry.parameters.widthSegments===s||(u.hasOwnProperty(r)||(u[r]=new ie.SphereBufferGeometry(i,s,s)),t.geometry.dispose(),t.geometry=u[r]);var l=a(n),d=new ie.Color(ee(l||"#ffffaa")),f=e.nodeOpacity*te(l);"MeshLambertMaterial"===t.material.type&&t.material.color.equals(d)&&t.material.opacity===f||(c.hasOwnProperty(l)||(c[l]=new ie.MeshLambertMaterial({color:d,transparent:!0,opacity:f})),t.material.dispose(),t.material=c[l])}}})}if(e._flushObjects||n(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var d=(0,p.default)(e.linkThreeObject),f=(0,p.default)(e.linkThreeObjectExtend),h=(0,p.default)(e.linkMaterial),v=(0,p.default)(e.linkVisibility),m=(0,p.default)(e.linkColor),g=(0,p.default)(e.linkWidth),y={},b={},w={},x=e.graphData.links.filter(v);if(J(x,e.graphScene,{objBindAttr:"__lineObj",purge:e._flushObjects||n(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(e){return"link"===e.__graphObjType},createObj:function(t){var n,r,i=d(t),o=f(t);if(i&&e.linkThreeObject===i&&(i=i.clone()),!i||o)if(!!g(t))n=new ie.Mesh;else{var a=new ie.BufferGeometry;a[ae]("position",new ie.BufferAttribute(new Float32Array(6),3)),n=new ie.Line(a)}return i?o?((r=new ie.Group).__graphDefaultObj=!0,r.add(n),r.add(i)):r=i:(r=n).__graphDefaultObj=!0,r.renderOrder=10,r.__graphObjType="link",r},updateObj:function(t,n){if(t.__graphDefaultObj){var r=t.children.length?t.children[0]:t,i=Math.ceil(10*g(n))/10,o=!!i;if(o){var a=i/2,s=e.linkResolution;if(!r.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||r.geometry.parameters.radiusTop!==a||r.geometry.parameters.radialSegments!==s){if(!y.hasOwnProperty(i)){var l=new ie.CylinderBufferGeometry(a,a,1,s,1,!1);l[se]((new ie.Matrix4).makeTranslation(0,.5,0)),l[se]((new ie.Matrix4).makeRotationX(Math.PI/2)),y[i]=l}r.geometry.dispose(),r.geometry=y[i]}}var u=h(n);if(u)r.material=u;else{var c=m(n),d=new ie.Color(ee(c||"#f0f0f0")),f=e.linkOpacity*te(c),p=o?"MeshLambertMaterial":"LineBasicMaterial";if(r.material.type!==p||!r.material.color.equals(d)||r.material.opacity!==f){var v=o?b:w;v.hasOwnProperty(c)||(v[c]=new ie[p]({color:d,transparent:f<1,opacity:f,depthWrite:f>=1})),r.material.dispose(),r.material=v[c]}}}}}),e.linkDirectionalArrowLength||t.hasOwnProperty("linkDirectionalArrowLength")){var E=(0,p.default)(e.linkDirectionalArrowLength),k=(0,p.default)(e.linkDirectionalArrowColor);J(x.filter(E),e.graphScene,{objBindAttr:"__arrowObj",objFilter:function(e){return"arrow"===e.__linkThreeObjType},createObj:function(){var e=new ie.Mesh(void 0,new ie.MeshLambertMaterial({transparent:!0}));return e.__linkThreeObjType="arrow",e},updateObj:function(t,n){var r=E(n),i=e.linkDirectionalArrowResolution;if(!t.geometry.type.match(/^Cone(Buffer)?Geometry$/)||t.geometry.parameters.height!==r||t.geometry.parameters.radialSegments!==i){var o=new ie.ConeBufferGeometry(.25*r,r,i);o.translate(0,r/2,0),o.rotateX(Math.PI/2),t.geometry.dispose(),t.geometry=o}t.material.color=new ie.Color(k(n)||m(n)||"#f0f0f0"),t.material.opacity=3*e.linkOpacity}})}if(e.linkDirectionalParticles||t.hasOwnProperty("linkDirectionalParticles")){var T=(0,p.default)(e.linkDirectionalParticles),_=(0,p.default)(e.linkDirectionalParticleWidth),O=(0,p.default)(e.linkDirectionalParticleColor),C={},A={};J(x.filter(T),e.graphScene,{objBindAttr:"__photonsObj",objFilter:function(e){return"photons"===e.__linkThreeObjType},createObj:function(){var e=new ie.Group;return e.__linkThreeObjType="photons",e},updateObj:function(t,n){var r,i=Math.round(Math.abs(T(n))),o=!!t.children.length&&t.children[0],a=Math.ceil(10*_(n))/10/2,s=e.linkDirectionalParticleResolution;o&&o.geometry.parameters.radius===a&&o.geometry.parameters.widthSegments===s?r=o.geometry:(A.hasOwnProperty(a)||(A[a]=new ie.SphereBufferGeometry(a,s,s)),r=A[a],o&&o.geometry.dispose());var l,u=O(n)||m(n)||"#f0f0f0",c=new ie.Color(ee(u)),d=3*e.linkOpacity;o&&o.material.color.equals(c)&&o.material.opacity===d?l=o.material:(C.hasOwnProperty(u)||(C[u]=new ie.MeshLambertMaterial({color:c,transparent:!0,opacity:d})),l=C[u],o&&o.material.dispose()),J(W(new Array(i)).map((function(e,t){return{idx:t}})),t,{idAccessor:function(e){return e.idx},createObj:function(){return new ie.Mesh(r,l)},updateObj:function(e){e.geometry=r,e.material=l}})}})}}if(e._flushObjects=!1,n(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){e.engineRunning=!1,e.graphData.links.forEach((function(t){t.source=t[e.linkSource],t.target=t[e.linkTarget]}));var S,P="ngraph"!==e.forceEngine;if(P){(S=e.d3ForceLayout).stop().alpha(1).numDimensions(e.numDimensions).nodes(e.graphData.nodes);var M=e.d3ForceLayout.force("link");M&&M.id((function(t){return t[e.nodeId]})).links(e.graphData.links);var D=e.dagMode&&function(e,t){var n=e.nodes,r=e.links,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.nodeFilter,a=void 0===o?function(){return!0}:o,s=i.onLoopError,l=void 0===s?function(e){throw"Invalid DAG structure! Found cycle in node path: ".concat(e.join(" -> "),".")}:s,u={};n.forEach((function(e){return u[t(e)]={data:e,out:[],depth:-1,skip:!a(e)}})),r.forEach((function(e){var n=e.source,r=e.target,i=l(n),o=l(r);if(!u.hasOwnProperty(i))throw"Missing source node with id: ".concat(i);if(!u.hasOwnProperty(o))throw"Missing target node with id: ".concat(o);var a=u[i],s=u[o];function l(e){return"object"===j(e)?t(e):e}a.out.push(s)}));var c=[];return d(Object.values(u)),Object.assign.apply(Object,[{}].concat(W(Object.entries(u).filter((function(e){return!q(e,2)[1].skip})).map((function(e){var t=q(e,2);return L({},t[0],t[1].depth)})))));function d(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=0,o=e.length;ia.depth&&(a.depth=r,d(a.out,[].concat(W(n),[a]),r+(a.skip?0:1)))}}}(e.graphData,(function(t){return t[e.nodeId]}),{nodeFilter:e.dagNodeFilter,onLoopError:e.onDagError||void 0}),N=Math.max.apply(Math,W(Object.values(D||[]))),I=e.dagLevelDistance||e.graphData.nodes.length/(N||1)*2*(-1!==["radialin","radialout"].indexOf(e.dagMode)?.7:1);if(e.dagMode){var z=function(t,n){return function(r){return t?(D[r[e.nodeId]]-N/2)*I*(n?-1:1):void 0}},H=z(-1!==["lr","rl"].indexOf(e.dagMode),"rl"===e.dagMode),B=z(-1!==["td","bu"].indexOf(e.dagMode),"td"===e.dagMode),F=z(-1!==["zin","zout"].indexOf(e.dagMode),"zout"===e.dagMode);e.graphData.nodes.filter(e.dagNodeFilter).forEach((function(e){e.fx=H(e),e.fy=B(e),e.fz=F(e)}))}e.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(e.dagMode)?(0,l.Z)((function(t){var n=D[t[e.nodeId]]||-1;return("radialin"===e.dagMode?N-n:n)*I})).strength((function(t){return e.dagNodeFilter(t)?1:0})):null)}else{var V=oe.graph();e.graphData.nodes.forEach((function(t){V.addNode(t[e.nodeId])})),e.graphData.links.forEach((function(e){V.addLink(e.source,e.target)})),(S=oe.forcelayout(V,R({dimensions:e.numDimensions},e.ngraphPhysics))).graph=V}for(var U=0;U0&&e.d3ForceLayout.alpha()=0&&n.push(e)})),n.length<2)return[];n.includes(e[0])&&n.includes(e[e.length-1])&&e.push(e.shift()),n.includes(t[0])&&n.includes(t[t.length-1])&&t.push(t.shift()),n=[],e.forEach((function(e){t.includes(e)&&n.push(e)}));for(var r=n[1],i=n[0],o=e.slice();o[0]!==r;)o.push(o.shift());for(var a=0,s=t.slice();s[0]!==i;)if(s.push(s.shift()),a++>10)throw new Error("Unexpected state");return s.shift(),s.pop(),o.concat(s)},r.setPolygonCentroid=function(e,t){var n=new THREE.Vector3,r=t.vertices;e.vertexIds.forEach((function(e){n.add(r[e])})),n.divideScalar(e.vertexIds.length),e.centroid.copy(n)},r.cleanPolygon=function(e,t){for(var n=[],r=t.vertices,i=0;iMath.PI-.01&&d0?function(e){e<0&&(r=!1)}:function(e){e>0&&(r=!1)}),r},r.distanceToSquared=function(e,t){var n=e.x-t.x,r=e.y-t.y,i=e.z-t.z;return n*n+r*r+i*i},r.isPointInPoly=function(e,t){for(var n=!1,r=-1,i=e.length,o=i-1;++rr-.5&&this.isPointInPoly(o,e))},r.triarea2=function(e,t,n){return(n.x-e.x)*(t.z-e.z)-(t.x-e.x)*(n.z-e.z)},r.vequal=function(e,t){return this.distanceToSquared(e,t)<1e-5};var i=function(e){this.content=[],this.scoreFunction=e};i.prototype.push=function(e){this.content.push(e),this.sinkDown(this.content.length-1)},i.prototype.pop=function(){var e=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),e},i.prototype.remove=function(e){var t=this.content.indexOf(e),n=this.content.pop();t!==this.content.length-1&&(this.content[t]=n,this.scoreFunction(n)0;){var n=(e+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(t)0;){var i=r.pop();if(i===n){for(var o=i,a=[];o.parent;)a.push(o),o=o.parent;return this.cleanUp(a),a.reverse()}i.closed=!0;for(var s=this.neighbours(e,i),l=0,u=s.length;l0)){o.push(t),t=e=t,n=e,s=a=s,l=a,u=a;continue}n=d,l=u}if(r.triarea2(e,t,c)>=0){if(!(r.vequal(e,t)||r.triarea2(e,n,c)<0)){o.push(n),t=e=n,n=e,s=a=l,l=a,u=a;continue}t=c,s=u}}return 0!==o.length&&r.vequal(o[o.length-1],i[i.length-1].left)||o.push(i[i.length-1].left),this.path=o,o};var u,c,d,f,h,p,v=function(){this.zones={}};v.createZone=function(e){return s.buildZone(e)},v.prototype.setZoneData=function(e,t){this.zones[e]=t},v.prototype.getGroup=function(e,t){if(!this.zones[e])return null;var n=null,i=Math.pow(50,2);return this.zones[e].groups.forEach((function(e,o){e.forEach((function(e){var a=r.distanceToSquared(e.centroid,t);a2))for(var y=0;y1&&(p=g.y+g.vy),r>2&&(x=g.z+g.vz),o.visit(k);function k(n,t,i,e,f,u,o){var a=[t,i,e,f,u,o],l=a[0],v=a[1],Z=a[2],s=a[r],A=a[r+1],N=a[r+2],k=n.data,C=n.r,M=z+C;if(!k)return l>d+M||s1&&(v>p+M||A2&&(Z>x+M||Ng.index){var _=d-k.x-k.vx,b=r>1?p-k.y-k.vy:0,m=r>2?x-k.z-k.vz:0,E=_*_+b*b+m*m;E1&&0===b&&(E+=(b=(0,c.Z)(y))*b),r>2&&0===m&&(E+=(m=(0,c.Z)(y))*m),E=(M-(E=Math.sqrt(E)))/E*h,g.vx+=(_*=E)*(M=(C*=C)/(w+C)),r>1&&(g.vy+=(b*=E)*M),r>2&&(g.vz+=(m*=E)*M),k.vx-=_*(M=1-M),r>1&&(k.vy-=b*M),r>2&&(k.vz-=m*M))}}}function s(n){if(n.data)return n.r=i[n.data.index];for(var t=n.r=0;tn.r&&(n.r=n[t].r)}function d(){if(t){var r,e,f=t.length;for(i=new Array(f),r=0;r1?i-1:0),f=1;f0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r}function h(e,t,n){return 3*(t+n)/4-n}function d(e){for(var t,n=c(e),r=n[0],a=n[1],s=new o(h(e,r,a)),l=0,u=a>0?r-4:r,d=0;d>16&255,s[l++]=t>>8&255,s[l++]=255&t;return 2===a&&(t=i[e.charCodeAt(d)]<<2|i[e.charCodeAt(d+1)]>>4,s[l++]=255&t),1===a&&(t=i[e.charCodeAt(d)]<<10|i[e.charCodeAt(d+1)]<<4|i[e.charCodeAt(d+2)]>>2,s[l++]=t>>8&255,s[l++]=255&t),s}function p(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function f(e,t,n){for(var r,i=[],o=t;ol?l:s+a));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],4:[function(e,t,n){"use strict";t.exports={createLink:function(e,t){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("link");for(var i in r.href=e,r.rel="stylesheet",t)if(t.hasOwnProperty(i)){var o=t[i];r.setAttribute("data-"+i,o)}n.appendChild(r)},createStyle:function(e,t){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");for(var i in r.type="text/css",t)if(t.hasOwnProperty(i)){var o=t[i];r.setAttribute("data-"+i,o)}r.sheet?(r.innerHTML=e,r.sheet.cssText=e,n.appendChild(r)):r.styleSheet?(n.appendChild(r),r.styleSheet.cssText=e):(r.appendChild(document.createTextNode(e)),n.appendChild(r))}}},{}],5:[function(e,t,n){var r=e("buffer").Buffer;t.exports=function(e,t){if(r.isBuffer(e)&&r.isBuffer(t)){if("function"===typeof e.equals)return e.equals(t);if(e.length!==t.length)return!1;for(var n=0;n=c())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c().toString(16)+" bytes");return 0|e}function A(e){return+e!=e&&(e=0),r.alloc(+e)}function w(e,t){if(r.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ee(e).length;default:if(i)return K(e).length;t=(""+t).toLowerCase(),i=!0}}function x(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return F(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return D(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function E(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function M(e,t,n,i,o){if(0===e.length)return-1;if("string"===typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"===typeof t&&(t=r.from(t,i)),r.isBuffer(t))return 0===t.length?-1:_(e,t,n,i,o);if("number"===typeof t)return t&=255,r.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):_(e,[t],n,i,o);throw new TypeError("val must be string, number or Buffer")}function _(e,t,n,r,i){var o,a=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var u=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(u=c);break;case 2:128===(192&(o=e[i+1]))&&(l=(31&c)<<6|63&o)>127&&(u=l);break;case 3:o=e[i+1],a=e[i+2],128===(192&o)&&128===(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128===(192&o)&&128===(192&a)&&128===(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return B(r)}i.Buffer=r,i.SlowBuffer=A,i.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:l(),i.kMaxLength=c(),r.poolSize=8192,r._augment=function(e){return e.__proto__=r.prototype,e},r.from=function(e,t,n){return h(null,e,t,n)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(e,t,n){return p(null,e,t,n)},r.allocUnsafe=function(e){return f(null,e)},r.allocUnsafeSlow=function(e){return f(null,e)},r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,o=0,a=Math.min(n,i);o0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),""},r.prototype.compare=function(e,t,n,i,o){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),t<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=n)return 0;if(i>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(i>>>=0),s=(n>>>=0)-(t>>>=0),l=Math.min(a,s),c=this.slice(i,o),u=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return T(this,e,t,n);case"utf8":case"utf-8":return S(this,e,t,n);case"ascii":return C(this,e,t,n);case"latin1":case"binary":return L(this,e,t,n);case"base64":return R(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function B(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function G(e,t,n,i,o,a){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function z(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function j(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function V(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function W(e,t,n,r,i){return i||V(e,t,n,4,34028234663852886e22,-34028234663852886e22),a.write(e,t,n,r,23,4),n+4}function q(e,t,n,r,i){return i||V(e,t,n,8,17976931348623157e292,-17976931348623157e292),a.write(e,t,n,r,52,8),n+8}r.prototype.slice=function(e,t){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t0&&(i*=256);)r+=this[e+--t]*i;return r},r.prototype.readUInt8=function(e,t){return t||H(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||H(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||H(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||H(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||H(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||H(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},r.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||H(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},r.prototype.readInt8=function(e,t){return t||H(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||H(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt16BE=function(e,t){t||H(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt32LE=function(e,t){return t||H(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||H(e,4,this.length),a.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||H(e,4,this.length),a.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||H(e,8,this.length),a.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||H(e,8,this.length),a.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||G(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},r.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},r.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):z(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):z(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);G(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},r.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);G(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},r.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):z(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):z(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||G(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,n){return W(this,e,t,!0,n)},r.prototype.writeFloatBE=function(e,t,n){return W(this,e,t,!1,n)},r.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},r.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},r.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(a<1e3||!r.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(a=t;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function J(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function ee(e){return o.toByteArray(Y(e))}function te(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ne(e){return e!==e}}).call(this,"undefined"!==typeof r.g?r.g:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{},t("buffer").Buffer)},{"base64-js":3,buffer:6,ieee754:29,isarray:35}],7:[function(t,n,r){!function(){if("undefined"!==typeof window)try{var t=new window.CustomEvent("test",{cancelable:!0});if(t.preventDefault(),!0!==t.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var n=function(e,n){var r,i;return(n=n||{}).bubbles=!!n.bubbles,n.cancelable=!!n.cancelable,(r=document.createEvent("CustomEvent")).initCustomEvent(e,n.bubbles,n.cancelable,n.detail),i=r.preventDefault,r.preventDefault=function(){i.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},r};n.prototype=window.Event.prototype,window.CustomEvent=n}}()},{}],8:[function(t,n,r){function i(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" "),!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var r=0,i=0;return e[0].replace(/%[a-z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(i=r))})),e.splice(i,0,n),e}function a(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(t){try{null==t?r.storage.removeItem("debug"):r.storage.debug=t}catch(e){}}function l(){var t;try{t=r.storage.debug}catch(e){}return t}function c(){try{return window.localStorage}catch(e){}}(r=n.exports=t("./debug")).log=a,r.formatArgs=o,r.save=s,r.load=l,r.useColors=i,r.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){return JSON.stringify(e)},r.enable(l())},{"./debug":9}],9:[function(e,t,n){(n=t.exports=o).coerce=c,n.disable=s,n.enable=a,n.enabled=l,n.names=[],n.skips=[],n.formatters={};var r=0;function i(){return n.colors[r++%n.colors.length]}function o(e){function t(){}function r(){var e=r;null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=i());var t=Array.prototype.slice.call(arguments);t[0]=n.coerce(t[0]),"string"!==typeof t[0]&&(t=["%o"].concat(t));var o=0;t[0]=t[0].replace(/%([a-z%])/g,(function(r,i){if("%%"===r)return r;o++;var a=n.formatters[i];if("function"===typeof a){var s=t[o];r=a.call(e,s),t.splice(o,1),o--}return r})),"function"===typeof n.formatArgs&&(t=n.formatArgs.apply(e,t)),(r.log||n.log||console.log.bind(console)).apply(e,t)}t.enabled=!1,r.enabled=!0;var o=n.enabled(e)?r:t;return o.namespace=e,o}function a(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;i2?arguments[2]:{},r=i(t);o&&(r=s.call(r,Object.getOwnPropertySymbols(t)));for(var a=0;a>0),T="attached",S="detached",C="extends",L="ADDITION",R="MODIFICATION",P="REMOVAL",D="DOMAttrModified",O="DOMContentLoaded",I="DOMSubtreeModified",B="<",F="=",k=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/,N=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],U=[],H=[],G="",z=n.documentElement,j=U.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},V=r.prototype,W=V.hasOwnProperty,q=V.isPrototypeOf,X=r.defineProperty,Y=r.getOwnPropertyDescriptor,Q=r.getOwnPropertyNames,Z=r.getPrototypeOf,K=r.setPrototypeOf,J=!!r.__proto__,$=r.create||function e(t){return t?(e.prototype=t,new e):this},ee=K||(J?function(e,t){return e.__proto__=t,e}:Q&&Y?function(){function e(e,t){for(var n,r=Q(t),i=0,o=r.length;i1&&"boolean"!==typeof t)throw new TypeError('"allowMissing" argument must be a boolean');var n="$ "+e;if(!(n in m))throw new SyntaxError("intrinsic "+e+" does not exist!");if("undefined"===typeof m[n]&&!t)throw new TypeError("intrinsic "+e+" exists, but is not available. Please file an issue!");return m[n]}},{}],15:[function(e,t,n){"use strict";var r=e("./GetIntrinsic"),i=r("%Object%"),o=r("%TypeError%"),a=r("%String%"),s=e("./helpers/assertRecord"),l=e("./helpers/isNaN"),c=e("./helpers/isFinite"),u=e("./helpers/sign"),h=e("./helpers/mod"),d=e("is-callable"),p=e("es-to-primitive/es5"),f=e("has"),m={ToPrimitive:p,ToBoolean:function(e){return!!e},ToNumber:function(e){return+e},ToInteger:function(e){var t=this.ToNumber(e);return l(t)?0:0!==t&&c(t)?u(t)*Math.floor(Math.abs(t)):t},ToInt32:function(e){return this.ToNumber(e)>>0},ToUint32:function(e){return this.ToNumber(e)>>>0},ToUint16:function(e){var t=this.ToNumber(e);if(l(t)||0===t||!c(t))return 0;var n=u(t)*Math.floor(Math.abs(t));return h(n,65536)},ToString:function(e){return a(e)},ToObject:function(e){return this.CheckObjectCoercible(e),i(e)},CheckObjectCoercible:function(e,t){if(null==e)throw new o(t||"Cannot call method on "+e);return e},IsCallable:d,SameValue:function(e,t){return e===t?0!==e||1/e===1/t:l(e)&&l(t)},Type:function(e){return null===e?"Null":"undefined"===typeof e?"Undefined":"function"===typeof e||"object"===typeof e?"Object":"number"===typeof e?"Number":"boolean"===typeof e?"Boolean":"string"===typeof e?"String":void 0},IsPropertyDescriptor:function(e){if("Object"!==this.Type(e))return!1;var t={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var n in e)if(f(e,n)&&!t[n])return!1;var r=f(e,"[[Value]]"),i=f(e,"[[Get]]")||f(e,"[[Set]]");if(r&&i)throw new o("Property Descriptors may not be both accessor and data descriptors");return!0},IsAccessorDescriptor:function(e){return"undefined"!==typeof e&&(s(this,"Property Descriptor","Desc",e),!(!f(e,"[[Get]]")&&!f(e,"[[Set]]")))},IsDataDescriptor:function(e){return"undefined"!==typeof e&&(s(this,"Property Descriptor","Desc",e),!(!f(e,"[[Value]]")&&!f(e,"[[Writable]]")))},IsGenericDescriptor:function(e){return"undefined"!==typeof e&&(s(this,"Property Descriptor","Desc",e),!this.IsAccessorDescriptor(e)&&!this.IsDataDescriptor(e))},FromPropertyDescriptor:function(e){if("undefined"===typeof e)return e;if(s(this,"Property Descriptor","Desc",e),this.IsDataDescriptor(e))return{value:e["[[Value]]"],writable:!!e["[[Writable]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};if(this.IsAccessorDescriptor(e))return{get:e["[[Get]]"],set:e["[[Set]]"],enumerable:!!e["[[Enumerable]]"],configurable:!!e["[[Configurable]]"]};throw new o("FromPropertyDescriptor must be called with a fully populated Property Descriptor")},ToPropertyDescriptor:function(e){if("Object"!==this.Type(e))throw new o("ToPropertyDescriptor requires an object");var t={};if(f(e,"enumerable")&&(t["[[Enumerable]]"]=this.ToBoolean(e.enumerable)),f(e,"configurable")&&(t["[[Configurable]]"]=this.ToBoolean(e.configurable)),f(e,"value")&&(t["[[Value]]"]=e.value),f(e,"writable")&&(t["[[Writable]]"]=this.ToBoolean(e.writable)),f(e,"get")){var n=e.get;if("undefined"!==typeof n&&!this.IsCallable(n))throw new TypeError("getter must be a function");t["[[Get]]"]=n}if(f(e,"set")){var r=e.set;if("undefined"!==typeof r&&!this.IsCallable(r))throw new o("setter must be a function");t["[[Set]]"]=r}if((f(t,"[[Get]]")||f(t,"[[Set]]"))&&(f(t,"[[Value]]")||f(t,"[[Writable]]")))throw new o("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");return t}};t.exports=m},{"./GetIntrinsic":14,"./helpers/assertRecord":16,"./helpers/isFinite":17,"./helpers/isNaN":18,"./helpers/mod":19,"./helpers/sign":20,"es-to-primitive/es5":21,has:28,"is-callable":32}],16:[function(e,t,n){"use strict";var r=e("../GetIntrinsic"),i=r("%TypeError%"),o=r("%SyntaxError%"),a=e("has"),s={"Property Descriptor":function(e,t){if("Object"!==e.Type(t))return!1;var n={"[[Configurable]]":!0,"[[Enumerable]]":!0,"[[Get]]":!0,"[[Set]]":!0,"[[Value]]":!0,"[[Writable]]":!0};for(var r in t)if(a(t,r)&&!n[r])return!1;var o=a(t,"[[Value]]"),s=a(t,"[[Get]]")||a(t,"[[Set]]");if(o&&s)throw new i("Property Descriptors may not be both accessor and data descriptors");return!0}};t.exports=function(e,t,n,r){var a=s[t];if("function"!==typeof a)throw new o("unknown record type: "+t);if(!a(e,r))throw new i(n+" must be a "+t);console.log(a(e,r),r)}},{"../GetIntrinsic":14,has:28}],17:[function(e,t,n){var r=Number.isNaN||function(e){return e!==e};t.exports=Number.isFinite||function(e){return"number"===typeof e&&!r(e)&&e!==1/0&&e!==-1/0}},{}],18:[function(e,t,n){t.exports=Number.isNaN||function(e){return e!==e}},{}],19:[function(e,t,n){t.exports=function(e,t){var n=e%t;return Math.floor(n>=0?n:n+t)}},{}],20:[function(e,t,n){t.exports=function(e){return e>=0?1:-1}},{}],21:[function(e,t,n){"use strict";var r=Object.prototype.toString,i=e("./helpers/isPrimitive"),o=e("is-callable"),a={"[[DefaultValue]]":function(e){var t;if((t=arguments.length>1?arguments[1]:"[object Date]"===r.call(e)?String:Number)===String||t===Number){var n,a,s=t===String?["toString","valueOf"]:["valueOf","toString"];for(a=0;a1?a["[[DefaultValue]]"](e,arguments[1]):a["[[DefaultValue]]"](e)}},{"./helpers/isPrimitive":22,"is-callable":32}],22:[function(e,t,n){t.exports=function(e){return null===e||"function"!==typeof e&&"object"!==typeof e}},{}],23:[function(e,t,n){var r=e("dtype");function i(e,t,n){if(!e)throw new TypeError("must specify data as first parameter");if(n=0|+(n||0),Array.isArray(e)&&e[0]&&"number"===typeof e[0][0]){var i,o,a,s,l=e[0].length,c=e.length*l;t&&"string"!==typeof t||(t=new(r(t||"float32"))(c+n));var u=t.length-n;if(c!==u)throw new Error("source length "+c+" ("+l+"x"+e.length+") does not match destination length "+u);for(i=0,a=n;i=3&&(o=n),"[object Array]"===i.call(e)?a(e,t,o):"string"===typeof e?s(e,t,o):l(e,t,o)};t.exports=c},{"is-callable":32}],25:[function(e,t,n){"use strict";var r="Function.prototype.bind called on incompatible ",i=Array.prototype.slice,o=Object.prototype.toString,a="[object Function]";t.exports=function(e){var t=this;if("function"!==typeof t||o.call(t)!==a)throw new TypeError(r+t);for(var n,s=i.call(arguments,1),l=function(){if(this instanceof n){var r=t.apply(this,s.concat(i.call(arguments)));return Object(r)===r?r:this}return t.apply(e,s.concat(i.call(arguments)))},c=Math.max(0,t.length-s.length),u=[],h=0;h>1,u=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+e[t+h],h+=d,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+h],h+=d,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?d/l:d*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=u?(s=0,a=u):a+h>=1?(s=(t*l-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=f,s/=256,i-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*m}},{}],30:[function(e,t,n){"function"===typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],31:[function(e,t,n){function r(e){return!!e.constructor&&"function"===typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function i(e){return"function"===typeof e.readFloatLE&&"function"===typeof e.slice&&r(e.slice(0,0))}t.exports=function(e){return null!=e&&(r(e)||i(e)||!!e._isBuffer)}},{}],32:[function(t,n,r){"use strict";var i=Function.prototype.toString,o=/^\s*class\b/,a=function(t){try{var n=i.call(t);return o.test(n)}catch(e){return!1}},s=function(t){try{return!a(t)&&(i.call(t),!0)}catch(e){return!1}},l=Object.prototype.toString,c="[object Function]",u="[object GeneratorFunction]",h="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag;n.exports=function(e){if(!e)return!1;if("function"!==typeof e&&"object"!==typeof e)return!1;if("function"===typeof e&&!e.prototype)return!0;if(h)return s(e);if(a(e))return!1;var t=l.call(e);return t===c||t===u}},{}],33:[function(e,t,n){t.exports=i;var r=Object.prototype.toString;function i(e){var t=r.call(e);return"[object Function]"===t||"function"===typeof e&&"[object RegExp]"!==t||"undefined"!==typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}},{}],34:[function(e,t,n){"use strict";t.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},{}],35:[function(e,t,n){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],36:[function(e,t,n){var r=e("word-wrapper"),i=e("xtend"),o=e("as-number"),a=["x","e","a","o","n","s","r","c","u","m","v","w","z"],s=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),u=" ".charCodeAt(0),h=0,d=1,p=2;function f(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function m(e){Object.defineProperty(f.prototype,e,{get:v(e),configurable:!0})}function v(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function g(e,t){if(!e.chars||0===e.chars.length)return null;var n=E(e.chars,t);return n>=0?e.chars[n]:null}function y(e){for(var t=0;t=0)return e.chars[r].height}return 0}function b(e){for(var t=0;t=0)return e.chars[r]}return 0}function A(e){for(var t=0;t=0)return e.chars[r].height}return 0}function w(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var r=e.kernings,i=0;i=r||p>=r)break;s=p,l=f,i=h}c++}return i&&(l+=i.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach(m)},{"as-number":2,"word-wrapper":69,xtend:72}],37:[function(t,n,r){(function(r){var i=t("xhr"),o=function(){},a=t("parse-bmfont-ascii"),s=t("parse-bmfont-xml"),l=t("parse-bmfont-binary"),c=t("./lib/is-binary"),u=t("xtend"),h=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;function d(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)}function p(e){if(h)return u(e,{responseType:"arraybuffer"});if("undefined"===typeof self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),u({xhr:t},e)}n.exports=function(t,n){n="function"===typeof n?n:o,"string"===typeof t?t={uri:t}:t||(t={}),t.binary&&(t=p(t)),i(t,(function(i,u,h){if(i)return n(i);if(!/^2/.test(u.statusCode))return n(new Error("http status code: "+u.statusCode));if(!h)return n(new Error("no body result"));var p,f=!1;if(d(h)){var m=new Uint8Array(h);h=new r(m,"binary")}c(h)&&(f=!0,"string"===typeof h&&(h=new r(h,"binary"))),f||(r.isBuffer(h)&&(h=h.toString(t.encoding)),h=h.trim());try{var v=u.headers["content-type"];p=f?l(h):/json/.test(v)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(v)||"<"===h.charAt(0)?s(h):a(h)}catch(e){n(new Error("error parsing font "+e.message)),n=o}n(null,p)}))}}).call(this,t("buffer").Buffer)},{"./lib/is-binary":38,buffer:6,"parse-bmfont-ascii":43,"parse-bmfont-binary":44,"parse-bmfont-xml":45,xhr:70,xtend:72}],38:[function(e,t,n){(function(n){var r=e("buffer-equal"),i=new n([66,77,70,3]);t.exports=function(e){return"string"===typeof e?"BMF"===e.substring(0,3):e.length>4&&r(e.slice(0,4),i)}}).call(this,e("buffer").Buffer)},{buffer:6,"buffer-equal":5}],39:[function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function s(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}t.exports=s()?Object.assign:function(e,t){for(var n,s,l=a(e),c=1;c0&&!o.call(e,0))for(var p=0;p0)for(var f=0;f=0&&"[object Function]"===r.call(e.callee)),n}},{}],43:[function(e,t,n){function r(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var n=e.indexOf(" ");if(-1===n)throw new Error("no named row at line "+t);var r=e.substring(0,n);e=(e=(e=(e=e.substring(n+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var o=[],a=0;at.length-1)return 0;var r=t.readUInt8(n++),i=t.readInt32LE(n);switch(n+=4,r){case 1:e.info=o(t,n);break;case 2:e.common=a(t,n);break;case 3:e.pages=s(t,n,i);break;case 4:e.chars=l(t,n,i);break;case 5:e.kernings=c(t,n,i)}return 5+i}function o(e,t){var n={};n.size=e.readInt16LE(t);var r=e.readUInt8(t+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=e.readUInt8(t+3)||"",n.stretchH=e.readUInt16LE(t+4),n.aa=e.readUInt8(t+6),n.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],n.spacing=[e.readInt8(t+11),e.readInt8(t+12)],n.outline=e.readUInt8(t+13),n.face=h(e,t+14),n}function a(e,t){var n={};return n.lineHeight=e.readUInt16LE(t),n.base=e.readUInt16LE(t+2),n.scaleW=e.readUInt16LE(t+4),n.scaleH=e.readUInt16LE(t+6),n.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),n.packed=0,n.alphaChnl=e.readUInt8(t+11),n.redChnl=e.readUInt8(t+12),n.greenChnl=e.readUInt8(t+13),n.blueChnl=e.readUInt8(t+14),n}function s(e,t,n){for(var r=[],i=u(e,t),o=i.length+1,a=n/o,s=0;s3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var n={kernings:[],chars:[]},o=0;o<5;o++)t+=i(n,e,t);return n}},{}],45:[function(e,t,n){var r=e("./parse-attribs"),i=e("xml-parse-from-string"),o={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function a(e){return s(e).reduce((function(e,t){return e[l(t.nodeName)]=t.nodeValue,e}),{})}function s(e){for(var t=[],n=0;n element");for(var s=o.getElementsByTagName("page"),l=0;l1)for(var n=1;n-1}function u(e,t){return e.apply(null,t)}var h=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,d=/^rgb/,p=/^hsl/,f={arr:function(e){return Array.isArray(e)},obj:function(e){return c(Object.prototype.toString.call(e),"Object")},pth:function(e){return f.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||f.svg(e)},str:function(e){return"string"===typeof e},fnc:function(e){return"function"===typeof e},und:function(e){return"undefined"===typeof e},hex:function(e){return h.test(e)},rgb:function(e){return d.test(e)},hsl:function(e){return p.test(e)},col:function(e){return f.hex(e)||f.rgb(e)||f.hsl(e)},key:function(e){return!i.hasOwnProperty(e)&&!o.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}},m=/\(([^)]+)\)/;function v(e){var t=m.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function g(e,t){var n=v(e),r=l(f.und(n[0])?1:n[0],.1,100),i=l(f.und(n[1])?100:n[1],.1,100),o=l(f.und(n[2])?10:n[2],.1,100),a=l(f.und(n[3])?0:n[3],.1,100),c=Math.sqrt(i/r),u=o/(2*Math.sqrt(i*r)),h=u<1?c*Math.sqrt(1-u*u):0,d=1,p=u<1?(u*c-a)/h:-a+c;function m(e){var n=t?t*e/1e3:e;return n=u<1?Math.exp(-n*u*c)*(d*Math.cos(h*n)+p*Math.sin(h*n)):(d+p*n)*Math.exp(-n*c),0===e||1===e?e:1-n}function g(){var t=s.springs[e];if(t)return t;for(var n=1/6,r=0,i=0;;)if(1===m(r+=n)){if(++i>=16)break}else i=0;var o=r*n*1e3;return s.springs[e]=o,o}return t?m:g}function y(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=l(e,1,10),r=l(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)}}function b(e){return void 0===e&&(e=10),function(t){return Math.round(t*e)*(1/e)}}var A=function(){var e=11,t=1/(e-1);function n(e,t){return 1-3*t+3*e}function r(e,t){return 3*t-6*e}function i(e){return 3*e}function o(e,t,o){return((n(t,o)*e+r(t,o))*e+i(t))*e}function a(e,t,o){return 3*n(t,o)*e*e+2*r(t,o)*e+i(t)}function s(e,t,n,r,i){var a,s,l=0;do{(a=o(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(a)>1e-7&&++l<10);return s}function l(e,t,n,r){for(var i=0;i<4;++i){var s=a(t,n,r);if(0===s)return t;t-=(o(t,n,r)-e)/s}return t}function c(n,r,i,c){if(0<=n&&n<=1&&0<=i&&i<=1){var u=new Float32Array(e);if(n!==r||i!==c)for(var h=0;h=.001?l(r,d,n,i):0===p?d:s(r,o,o+t,n,i)}}return c}(),w=function(){var e=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],y],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(e,t){return function(n){return 1-y(e,t)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(e,t){return function(n){return n<.5?y(e,t)(2*n)/2:1-y(e,t)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var r in t)for(var i=0,o=t[r].length;i=2?arguments[1]:void 0,o=0;o1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==a)t=n=r=s;else{var u=s<.5?s*(1+a):s+a-s*a,h=2*s-u;t=c(h,u,o+1/3),n=c(h,u,o),r=c(h,u,o-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}function H(e){return f.rgb(e)?O(e):f.hex(e)?F(e):f.hsl(e)?U(e):void 0}var G=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function z(e){var t=G.exec(e);if(t)return t[2]}function j(e){return c(e,"translate")||"perspective"===e?"px":c(e,"rotate")||c(e,"skew")?"deg":void 0}function V(e,t){return f.fnc(e)?e(t.target,t.id,t.total):e}function W(e,t){return e.getAttribute(t)}function q(e,t,n){if(C([n,"deg","rad","turn"],z(t)))return t;var r=s.CSS[t+n];if(!f.und(r))return r;var i=100,o=document.createElement(e.tagName),a=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=i+n;var l=i/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(t);return s.CSS[t+n]=c,c}function X(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?q(e,i,n):i}}function Y(e,t){return f.dom(e)&&!f.inp(e)&&(W(e,t)||f.svg(e)&&e[t])?"attribute":f.dom(e)&&C(a,t)?"transform":f.dom(e)&&"transform"!==t&&X(e,t)?"css":null!=e[t]?"object":void 0}var Q=/(\w+)\(([^)]*)\)/g;function Z(e){if(f.dom(e)){for(var t,n=e.style.transform||"",r=new Map;t=Q.exec(n);)r.set(t[1],t[2]);return r}}function K(e,t,n,r){var i=c(t,"scale")?1:0+j(t),o=Z(e).get(t)||i;return n&&(n.transforms.list.set(t,o),n.transforms.last=t),r?q(e,o,r):o}function J(e,t,n,r){switch(Y(e,t)){case"transform":return K(e,t,r,n);case"css":return X(e,t,n);case"attribute":return W(e,t);default:return e[t]||0}}var $=/^(\*=|\+=|-=)/;function ee(e,t){var n=$.exec(e);if(!n)return e;var r=z(e)||0,i=parseFloat(t),o=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return i+o+r;case"-":return i-o+r;case"*":return i*o+r}}var te=/\s/g;function ne(e,t){if(f.col(e))return H(e);var n=z(e),r=n?e.substr(0,e.length-n.length):e;return t&&!te.test(e)?r+t:r}function re(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ie(e){return 2*Math.PI*W(e,"r")}function oe(e){return 2*W(e,"width")+2*W(e,"height")}function ae(e){return re({x:W(e,"x1"),y:W(e,"y1")},{x:W(e,"x2"),y:W(e,"y2")})}function se(e){for(var t,n=e.points,r=0,i=0;i0&&(r+=re(t,o)),t=o}return r}function le(e){var t=e.points;return se(e)+re(t.getItem(t.numberOfItems-1),t.getItem(0))}function ce(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return ie(e);case"rect":return oe(e);case"line":return ae(e);case"polyline":return se(e);case"polygon":return le(e)}}function ue(e){var t=ce(e);return e.setAttribute("stroke-dasharray",t),t}function he(e){for(var t=e.parentNode;f.svg(t)&&(t=t.parentNode,f.svg(t.parentNode)););return t}function de(e,t){var n=t||{},r=n.el||he(e),i=r.getBoundingClientRect(),o=W(r,"viewBox"),a=i.width,s=i.height,l=n.viewBox||(o?o.split(" "):[0,0,a,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:a/l[2],h:s/l[3]}}function pe(e,t){var n=f.str(e)?E(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:de(n),totalLength:ce(n)*(r/100)}}}function fe(e,t){function n(n){void 0===n&&(n=0);var r=t+n>=1?t+n:0;return e.el.getPointAtLength(r)}var r=de(e.el,e.svg),i=n(),o=n(-1),a=n(1);switch(e.property){case"x":return(i.x-r.x)*r.w;case"y":return(i.y-r.y)*r.h;case"angle":return 180*Math.atan2(a.y-o.y,a.x-o.x)/Math.PI}}var me=/-?\d*\.?\d+/g;function ve(e,t){var n=ne(f.pth(e)?e.totalLength:e,t)+"";return{original:n,numbers:n.match(me)?n.match(me).map(Number):[0],strings:f.str(e)||t?n.split(me):[]}}function ge(e){return _(e?T(f.arr(e)?e.map(S):S(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function ye(e){var t=ge(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Z(e)}}}))}var be=/^spring/;function Ae(e,t){var n=L(t);if(be.test(n.easing)&&(n.duration=g(n.easing)),f.arr(e)){var r=e.length;2!==r||f.obj(e[0])?f.fnc(t.duration)||(n.duration=t.duration/r):e={value:e}}var i=f.arr(e)?e:[e];return i.map((function(e,n){var r=f.obj(e)&&!f.pth(e)?e:{value:e};return f.und(r.delay)&&(r.delay=n?0:t.delay),f.und(r.endDelay)&&(r.endDelay=n===i.length-1?t.endDelay:0),r})).map((function(e){return P(e,n)}))}function we(e){for(var t=_(T(e.map((function(e){return Object.keys(e)}))),(function(e){return f.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var i=t[r];n[i]=e.map((function(e){var t={};for(var n in e)f.key(n)?n==i&&(t.value=e[n]):t[n]=e[n];return t}))},i=0;i-1&&(Oe.splice(o,1),n=Oe.length)}else i.tick(t);r++}e()}else De=cancelAnimationFrame(De)}return e}();function Fe(){if(document.hidden){for(var e=0,t=Oe.length;e2||(b=Math.round(b*f)/f)),m.push(b)}var x=p.length;if(x){g=p[0];for(var E=0;E0&&(u.began=!0,g("begin"),g("loopBegin")),b<=p&&0!==u.currentTime&&v(0),(b>=f&&u.currentTime!==o||!o)&&v(o),b>p&&b=o&&(r=0,y(),u.remaining?(n=i,g("loopComplete"),g("loopBegin"),"alternate"===u.direction&&h()):(u.paused=!0,u.completed||(u.completed=!0,g("loopComplete"),g("complete"),"Promise"in window&&(a(),c=s()))))}return u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversePlayback=!1,u.reversed="reverse"===e,u.remaining=u.loop,t=u.children;for(var n=o=t.length;n--;)u.children[n].reset();(u.reversed&&!0!==u.loop||"alternate"===e&&1===u.loop)&&u.remaining++,v(0)},u.set=function(e,t){return Te(e,t),u},u.tick=function(e){i=e,n||(n=i),b((i+(r-n))*ke.speed)},u.seek=function(e){b(d(e))},u.pause=function(){u.paused=!0,p()},u.play=function(){u.paused&&(u.paused=!1,Oe.push(u),p(),De||Be())},u.reverse=function(){h(),p()},u.restart=function(){u.reset(),u.play()},u.finished=c,u.reset(),u.autoplay&&u.play(),u}function Ne(e,t){for(var n=t.length;n--;)C(e,t[n].animatable.target)&&t.splice(n,1)}function Ue(e){for(var t=ge(e),n=Oe.length;n--;){var r=Oe[n],i=r.animations,o=r.children;Ne(t,i);for(var a=o.length;a--;){var s=o[a],l=s.animations;Ne(t,l),l.length||s.children.length||o.splice(a,1)}i.length||o.length||r.pause()}}function He(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?x(t.easing):null,i=t.grid,o=t.axis,a=t.from||0,s="first"===a,l="center"===a,c="last"===a,u=f.arr(e),h=u?parseFloat(e[0]):parseFloat(e),d=u?parseFloat(e[1]):0,p=z(u?e[1]:e)||0,m=t.start||0+(u?h:0),v=[],g=0;return function(e,t,f){if(s&&(a=0),l&&(a=(f-1)/2),c&&(a=f-1),!v.length){for(var y=0;y-1&&Oe.splice(i,1);for(var l=0;l0?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(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(l&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:R(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}("object"===typeof r?r.exports:{});try{regeneratorRuntime=n}catch(ym){Function("r","regeneratorRuntime = r")(n)}var i="125",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},s=0,l=1,c=2,u=3,h=0,d=1,p=2,f=3,m=0,v=1,g=2,y=1,b=2,A=0,w=1,x=2,E=3,M=4,_=5,T=100,S=101,C=102,L=103,R=104,P=200,D=201,O=202,I=203,B=204,F=205,k=206,N=207,U=208,H=209,G=210,z=0,j=1,V=2,W=3,q=4,X=5,Y=6,Q=7,Z=0,K=1,J=2,$=0,ee=1,te=2,ne=3,re=4,ie=5,oe=300,ae=301,se=302,le=303,ce=304,ue=306,he=307,de=1e3,pe=1001,fe=1002,me=1003,ve=1004,ge=1004,ye=1005,be=1005,Ae=1006,we=1007,xe=1007,Ee=1008,Me=1008,_e=1009,Te=1010,Se=1011,Ce=1012,Le=1013,Re=1014,Pe=1015,De=1016,Oe=1017,Ie=1018,Be=1019,Fe=1020,ke=1021,Ne=1022,Ue=1023,He=1024,Ge=1025,ze=Ue,je=1026,Ve=1027,We=1028,qe=1029,Xe=1030,Ye=1031,Qe=1032,Ze=1033,Ke=33776,Je=33777,$e=33778,et=33779,tt=35840,nt=35841,rt=35842,it=35843,ot=36196,at=37492,st=37496,lt=37808,ct=37809,ut=37810,ht=37811,dt=37812,pt=37813,ft=37814,mt=37815,vt=37816,gt=37817,yt=37818,bt=37819,At=37820,wt=37821,xt=36492,Et=37840,Mt=37841,_t=37842,Tt=37843,St=37844,Ct=37845,Lt=37846,Rt=37847,Pt=37848,Dt=37849,Ot=37850,It=37851,Bt=37852,Ft=37853,kt=2200,Nt=2201,Ut=2202,Ht=2300,Gt=2301,zt=2302,jt=2400,Vt=2401,Wt=2402,qt=2500,Xt=2501,Yt=0,Qt=1,Zt=2,Kt=3e3,Jt=3001,$t=3007,en=3002,tn=3003,nn=3004,rn=3005,on=3006,an=3200,sn=3201,ln=0,cn=1,un=0,hn=7680,dn=7681,pn=7682,fn=7683,mn=34055,vn=34056,gn=5386,yn=512,bn=513,An=514,wn=515,xn=516,En=517,Mn=518,_n=519,Tn=35044,Sn=35048,Cn=35040,Ln=35045,Rn=35049,Pn=35041,Dn=35046,On=35050,In=35042,Bn="100",Fn="300 es";function kn(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void n(c)}s.done?t(l):Promise.resolve(l).then(r,i)}function Nn(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){kn(o,r,i,a,s,"next",e)}function s(e){kn(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Un(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function qn(){}Object.assign(qn.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),r=0,i=n.length;r>8&255]+Xn[e>>16&255]+Xn[e>>24&255]+"-"+Xn[255&t]+Xn[t>>8&255]+"-"+Xn[t>>16&15|64]+Xn[t>>24&255]+"-"+Xn[63&n|128]+Xn[n>>8&255]+"-"+Xn[n>>16&255]+Xn[n>>24&255]+Xn[255&r]+Xn[r>>8&255]+Xn[r>>16&255]+Xn[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,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},damp:function(e,t,n,r){return Kn.lerp(e,t,1-Math.exp(-n*r))},pingpong:function(e,t){return void 0===t&&(t=1),t-Math.abs(Kn.euclideanModulo(e,2*t)-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())},seededRandom:function(e){return void 0!==e&&(Zn=e%2147483647),((Zn=16807*Zn%2147483647)-1)/2147483646},degToRad:function(e){return e*Kn.DEG2RAD},radToDeg:function(e){return e*Kn.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))},setQuaternionFromProperEuler:function(e,t,n,r,i){var o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((t+r)/2),u=a((t+r)/2),h=o((t-r)/2),d=a((t-r)/2),p=o((r-t)/2),f=a((r-t)/2);switch(i){case"XYX":e.set(s*u,l*h,l*d,s*c);break;case"YZY":e.set(l*d,s*u,l*h,s*c);break;case"ZXZ":e.set(l*h,l*d,s*u,s*c);break;case"XZX":e.set(s*u,l*f,l*p,s*c);break;case"YXY":e.set(l*p,s*u,l*f,s*c);break;case"ZYZ":e.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}},Jn=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),Object.defineProperty(this,"isVector2",{value:!0}),this.x=e,this.y=t}var t=e.prototype;return t.set=function(e,t){return this.x=e,this.y=t,this},t.setScalar=function(e){return this.x=e,this.y=e,this},t.setX=function(e){return this.x=e,this},t.setY=function(e){return this.y=e,this},t.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},t.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)}},t.clone=function(){return new this.constructor(this.x,this.y)},t.copy=function(e){return this.x=e.x,this.y=e.y,this},t.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)},t.addScalar=function(e){return this.x+=e,this.y+=e,this},t.addVectors=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},t.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},t.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)},t.subScalar=function(e){return this.x-=e,this.y-=e,this},t.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},t.multiply=function(e){return this.x*=e.x,this.y*=e.y,this},t.multiplyScalar=function(e){return this.x*=e,this.y*=e,this},t.divide=function(e){return this.x/=e.x,this.y/=e.y,this},t.divideScalar=function(e){return this.multiplyScalar(1/e)},t.applyMatrix3=function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},t.min=function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},t.max=function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},t.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},t.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},t.clampLength=function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},t.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.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},t.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.dot=function(e){return this.x*e.x+this.y*e.y},t.cross=function(e){return this.x*e.y-this.y*e.x},t.lengthSq=function(){return this.x*this.x+this.y*this.y},t.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},t.normalize=function(){return this.divideScalar(this.length()||1)},t.angle=function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},t.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},t.distanceToSquared=function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},t.manhattanDistanceTo=function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},t.setLength=function(e){return this.normalize().multiplyScalar(e)},t.lerp=function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},t.lerpVectors=function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},t.equals=function(e){return e.x===this.x&&e.y===this.y},t.fromArray=function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},t.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.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},t.rotateAround=function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*r+e.x,this.y=i*r+o*n+e.y,this},t.random=function(){return this.x=Math.random(),this.y=Math.random(),this},Hn(e,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}}]),e}(),$n=function(){function e(){Object.defineProperty(this,"isMatrix3",{value:!0}),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.")}var t=e.prototype;return t.set=function(e,t,n,r,i,o,a,s,l){var c=this.elements;return c[0]=e,c[1]=r,c[2]=a,c[3]=t,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=l,this},t.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},t.clone=function(){return(new this.constructor).fromArray(this.elements)},t.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},t.extractBasis=function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},t.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},t.multiply=function(e){return this.multiplyMatrices(this,e)},t.premultiply=function(e){return this.multiplyMatrices(e,this)},t.multiplyMatrices=function(e,t){var n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],b=r[7],A=r[2],w=r[5],x=r[8];return i[0]=o*f+a*g+s*A,i[3]=o*m+a*y+s*w,i[6]=o*v+a*b+s*x,i[1]=l*f+c*g+u*A,i[4]=l*m+c*y+u*w,i[7]=l*v+c*b+u*x,i[2]=h*f+d*g+p*A,i[5]=h*m+d*y+p*w,i[8]=h*v+d*b+p*x,this},t.multiplyScalar=function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},t.determinant=function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8];return t*o*c-t*a*l-n*i*c+n*a*s+r*i*l-r*o*s},t.invert=function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=c*o-a*l,h=a*s-c*i,d=l*i-o*s,p=t*u+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return e[0]=u*f,e[1]=(r*l-c*n)*f,e[2]=(a*n-r*o)*f,e[3]=h*f,e[4]=(c*t-r*s)*f,e[5]=(r*i-a*t)*f,e[6]=d*f,e[7]=(n*s-l*t)*f,e[8]=(o*t-n*i)*f,this},t.transpose=function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},t.getNormalMatrix=function(e){return this.setFromMatrix4(e).copy(this).invert().transpose()},t.transposeIntoArray=function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},t.setUvTransform=function(e,t,n,r,i,o,a){var s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*o+l*a)+o+e,-r*l,r*s,-r*(-l*o+s*a)+a+t,0,0,1),this},t.scale=function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},t.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],o=r[3],a=r[6],s=r[1],l=r[4],c=r[7];return r[0]=t*i+n*s,r[3]=t*o+n*l,r[6]=t*a+n*c,r[1]=-n*i+t*s,r[4]=-n*o+t*l,r[7]=-n*a+t*c,this},t.translate=function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},t.equals=function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},t.fromArray=function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},t.toArray=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e},e}(),er={getDataURL:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Qn&&(Qn=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Qn.width=e.width,Qn.height=e.height;var n=Qn.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Qn}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},tr=0;function nr(e,t,n,r,i,o,a,s,l,c){void 0===e&&(e=nr.DEFAULT_IMAGE),void 0===t&&(t=nr.DEFAULT_MAPPING),void 0===n&&(n=pe),void 0===r&&(r=pe),void 0===i&&(i=Ae),void 0===o&&(o=Ee),void 0===a&&(a=Ue),void 0===s&&(s=_e),void 0===l&&(l=1),void 0===c&&(c=Kt),Object.defineProperty(this,"id",{value:tr++}),this.uuid=Kn.generateUUID(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=n,this.wrapT=r,this.magFilter=i,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=s,this.offset=new Jn(0,0),this.repeat=new Jn(1,1),this.center=new Jn(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=c,this.version=0,this.onUpdate=null}function rr(e){return"undefined"!==typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&e instanceof ImageBitmap?er.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}nr.DEFAULT_IMAGE=void 0,nr.DEFAULT_MAPPING=oe,nr.prototype=Object.assign(Object.create(qn.prototype),{constructor:nr,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.internalFormat=e.internalFormat,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 r=this.image;if(void 0===r.uuid&&(r.uuid=Kn.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var o=0,a=r.length;o1)switch(this.wrapS){case de:e.x=e.x-Math.floor(e.x);break;case pe:e.x=e.x<0?0:1;break;case fe: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 de:e.y=e.y-Math.floor(e.y);break;case pe:e.y=e.y<0?0:1;break;case fe: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(nr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});var ir=function(){function e(e,t,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=1),Object.defineProperty(this,"isVector4",{value:!0}),this.x=e,this.y=t,this.z=n,this.w=r}var t=e.prototype;return t.set=function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},t.setScalar=function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},t.setX=function(e){return this.x=e,this},t.setY=function(e){return this.y=e,this},t.setZ=function(e){return this.z=e,this},t.setW=function(e){return this.w=e,this},t.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},t.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)}},t.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)},t.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},t.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)},t.addScalar=function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},t.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},t.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},t.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)},t.subScalar=function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},t.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},t.multiply=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},t.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},t.applyMatrix4=function(e){var t=this.x,n=this.y,r=this.z,i=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*i,this},t.divideScalar=function(e){return this.multiplyScalar(1/e)},t.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},t.setAxisAngleFromRotationMatrix=function(e){var t,n,r,i,o=.01,a=.1,s=e.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-h)y&&g>b?gb?y=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),A=Math.atan2(b,v*g);m=Math.sin(m*A)/b,a=Math.sin(a*A)/b}var w=a*g;if(s=s*m+h*w,l=l*m+d*w,c=c*m+p*w,u=u*m+f*w,m===1-a){var x=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=x,l*=x,c*=x,u*=x}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u},e.multiplyQuaternionsFlat=function(e,t,n,r,i,o){var a=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[o],h=i[o+1],d=i[o+2],p=i[o+3];return e[t]=a*p+c*u+s*d-l*h,e[t+1]=s*p+c*h+l*u-a*d,e[t+2]=l*p+c*d+a*h-s*u,e[t+3]=c*p-a*u-s*h-l*d,e};var t=e.prototype;return t.set=function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},t.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},t.copy=function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},t.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,r=e._y,i=e._z,o=e._order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(o){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this},t.setFromAxisAngle=function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},t.setFromRotationMatrix=function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],o=t[1],a=t[5],s=t[9],l=t[2],c=t[6],u=t[10],h=n+a+u;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(c-s)*d,this._y=(i-l)*d,this._z=(o-r)*d}else if(n>a&&n>u){var p=2*Math.sqrt(1+n-a-u);this._w=(c-s)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(i+l)/p}else if(a>u){var f=2*Math.sqrt(1+a-n-u);this._w=(i-l)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(s+c)/f}else{var m=2*Math.sqrt(1+u-n-a);this._w=(o-r)/m,this._x=(i+l)/m,this._y=(s+c)/m,this._z=.25*m}return this._onChangeCallback(),this},t.setFromUnitVectors=function(e,t){var n=1e-6,r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()},t.angleTo=function(e){return 2*Math.acos(Math.abs(Kn.clamp(this.dot(e),-1,1)))},t.rotateTowards=function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},t.identity=function(){return this.set(0,0,0,1)},t.invert=function(){return this.conjugate()},t.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},t.dot=function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},t.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},t.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},t.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},t.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)},t.premultiply=function(e){return this.multiplyQuaternions(e,this)},t.multiplyQuaternions=function(e,t){var n=e._x,r=e._y,i=e._z,o=e._w,a=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this._onChangeCallback(),this},t.slerp=function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*e._w+n*e._x+r*e._y+i*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=r,this._z=i,this;var s=1-a*a;if(s<=Number.EPSILON){var l=1-t;return this._w=l*o+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},t.equals=function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},t.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},t.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},t.fromBufferAttribute=function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},t._onChange=function(e){return this._onChangeCallback=e,this},t._onChangeCallback=function(){},Hn(e,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}]),e}(),lr=function(){function e(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),Object.defineProperty(this,"isVector3",{value:!0}),this.x=e,this.y=t,this.z=n}var t=e.prototype;return t.set=function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this},t.setScalar=function(e){return this.x=e,this.y=e,this.z=e,this},t.setX=function(e){return this.x=e,this},t.setY=function(e){return this.y=e,this},t.setZ=function(e){return this.z=e,this},t.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},t.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)}},t.clone=function(){return new this.constructor(this.x,this.y,this.z)},t.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},t.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)},t.addScalar=function(e){return this.x+=e,this.y+=e,this.z+=e,this},t.addVectors=function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},t.addScaledVector=function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},t.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)},t.subScalar=function(e){return this.x-=e,this.y-=e,this.z-=e,this},t.subVectors=function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},t.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)},t.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},t.multiplyVectors=function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},t.applyEuler=function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ur.setFromEuler(e))},t.applyAxisAngle=function(e,t){return this.applyQuaternion(ur.setFromAxisAngle(e,t))},t.applyMatrix3=function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},t.applyNormalMatrix=function(e){return this.applyMatrix3(e).normalize()},t.applyMatrix4=function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,o=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*o,this},t.applyQuaternion=function(e){var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=e.w,l=s*t+o*r-a*n,c=s*n+a*t-i*r,u=s*r+i*n-o*t,h=-i*t-o*n-a*r;return this.x=l*s+h*-i+c*-a-u*-o,this.y=c*s+h*-o+u*-i-l*-a,this.z=u*s+h*-a+l*-o-c*-i,this},t.project=function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},t.unproject=function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},t.transformDirection=function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},t.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},t.divideScalar=function(e){return this.multiplyScalar(1/e)},t.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},t.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},t.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},t.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},t.clampLength=function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},t.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},t.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},t.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},t.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},t.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},t.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},t.normalize=function(){return this.divideScalar(this.length()||1)},t.setLength=function(e){return this.normalize().multiplyScalar(e)},t.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},t.lerpVectors=function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},t.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)},t.crossVectors=function(e,t){var n=e.x,r=e.y,i=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},t.projectOnVector=function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},t.projectOnPlane=function(e){return cr.copy(this).projectOnVector(e),this.sub(cr)},t.reflect=function(e){return this.sub(cr.copy(e).multiplyScalar(2*this.dot(e)))},t.angleTo=function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Kn.clamp(n,-1,1))},t.distanceTo=function(e){return Math.sqrt(this.distanceToSquared(e))},t.distanceToSquared=function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},t.manhattanDistanceTo=function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},t.setFromSpherical=function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},t.setFromSphericalCoords=function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},t.setFromCylindrical=function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},t.setFromCylindricalCoords=function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},t.setFromMatrixPosition=function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},t.setFromMatrixScale=function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},t.setFromMatrixColumn=function(e,t){return this.fromArray(e.elements,4*t)},t.setFromMatrix3Column=function(e,t){return this.fromArray(e.elements,3*t)},t.equals=function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},t.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},t.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.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},t.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e}(),cr=new lr,ur=new sr,hr=function(){function e(e,t){Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==e?e:new lr(1/0,1/0,1/0),this.max=void 0!==t?t:new lr(-1/0,-1/0,-1/0)}var t=e.prototype;return t.set=function(e,t){return this.min.copy(e),this.max.copy(t),this},t.setFromArray=function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=e.length;si&&(i=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,n,r),this.max.set(i,o,a),this},t.setFromBufferAttribute=function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=e.count;si&&(i=c),u>o&&(o=u),h>a&&(a=h)}return this.min.set(t,n,r),this.max.set(i,o,a),this},t.setFromPoints=function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},t.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},t.getParameter=function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new lr),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))},t.intersectsBox=function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},t.intersectsSphere=function(e){return this.clampPoint(e.center,fr),fr.distanceToSquared(e.center)<=e.radius*e.radius},t.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},t.intersectsTriangle=function(e){if(this.isEmpty())return!1;this.getCenter(xr),Er.subVectors(this.max,xr),vr.subVectors(e.a,xr),gr.subVectors(e.b,xr),yr.subVectors(e.c,xr),br.subVectors(gr,vr),Ar.subVectors(yr,gr),wr.subVectors(vr,yr);var t=[0,-br.z,br.y,0,-Ar.z,Ar.y,0,-wr.z,wr.y,br.z,0,-br.x,Ar.z,0,-Ar.x,wr.z,0,-wr.x,-br.y,br.x,0,-Ar.y,Ar.x,0,-wr.y,wr.x,0];return!!dr(t,vr,gr,yr,Er)&&!!dr(t=[1,0,0,0,1,0,0,0,1],vr,gr,yr,Er)&&(Mr.crossVectors(br,Ar),dr(t=[Mr.x,Mr.y,Mr.z],vr,gr,yr,Er))},t.clampPoint=function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new lr),t.copy(e).clamp(this.min,this.max)},t.distanceToPoint=function(e){return fr.copy(e).clamp(this.min,this.max).sub(e).length()},t.getBoundingSphere=function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(fr).length(),e},t.intersect=function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},t.union=function(e){return this.min.min(e.min),this.max.max(e.max),this},t.applyMatrix4=function(e){return this.isEmpty()||(pr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),pr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),pr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),pr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),pr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),pr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),pr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),pr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(pr)),this},t.translate=function(e){return this.min.add(e),this.max.add(e),this},t.equals=function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},e}();function dr(e,t,n,r,i){for(var o=0,a=e.length-3;o<=a;o+=3){_r.fromArray(e,o);var s=i.x*Math.abs(_r.x)+i.y*Math.abs(_r.y)+i.z*Math.abs(_r.z),l=t.dot(_r),c=n.dot(_r),u=r.dot(_r);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}var pr=[new lr,new lr,new lr,new lr,new lr,new lr,new lr,new lr],fr=new lr,mr=new hr,vr=new lr,gr=new lr,yr=new lr,br=new lr,Ar=new lr,wr=new lr,xr=new lr,Er=new lr,Mr=new lr,_r=new lr,Tr=new hr,Sr=function(){function e(e,t){this.center=void 0!==e?e:new lr,this.radius=void 0!==t?t:-1}var t=e.prototype;return t.set=function(e,t){return this.center.copy(e),this.radius=t,this},t.setFromPoints=function(e,t){var n=this.center;void 0!==t?n.copy(t):Tr.setFromPoints(e).getCenter(n);for(var r=0,i=0,o=e.length;ithis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},t.getBoundingBox=function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new hr),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},t.applyMatrix4=function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},t.translate=function(e){return this.center.add(e),this},t.equals=function(e){return e.center.equals(this.center)&&e.radius===this.radius},e}(),Cr=new lr,Lr=new lr,Rr=new lr,Pr=new lr,Dr=new lr,Or=new lr,Ir=new lr,Br=function(){function e(e,t){this.origin=void 0!==e?e:new lr,this.direction=void 0!==t?t:new lr(0,0,-1)}var t=e.prototype;return t.set=function(e,t){return this.origin.copy(e),this.direction.copy(t),this},t.clone=function(){return(new this.constructor).copy(this)},t.copy=function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},t.at=function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new lr),t.copy(this.direction).multiplyScalar(e).add(this.origin)},t.lookAt=function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},t.recast=function(e){return this.origin.copy(this.at(e,Cr)),this},t.closestPointToPoint=function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new lr),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)},t.distanceToPoint=function(e){return Math.sqrt(this.distanceSqToPoint(e))},t.distanceSqToPoint=function(e){var t=Cr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Cr.copy(this.direction).multiplyScalar(t).add(this.origin),Cr.distanceToSquared(e))},t.distanceSqToSegment=function(e,t,n,r){Lr.copy(e).add(t).multiplyScalar(.5),Rr.copy(t).sub(e).normalize(),Pr.copy(this.origin).sub(Lr);var i,o,a,s,l=.5*e.distanceTo(t),c=-this.direction.dot(Rr),u=Pr.dot(this.direction),h=-Pr.dot(Rr),d=Pr.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(o=c*u-h,s=l*p,(i=c*h-u)>=0)if(o>=-s)if(o<=s){var f=1/p;a=(i*=f)*(i+c*(o*=f)+2*u)+o*(c*i+o+2*h)+d}else o=l,a=-(i=Math.max(0,-(c*o+u)))*i+o*(o+2*h)+d;else o=-l,a=-(i=Math.max(0,-(c*o+u)))*i+o*(o+2*h)+d;else o<=-s?a=-(i=Math.max(0,-(-c*l+u)))*i+(o=i>0?-l:Math.min(Math.max(-l,-h),l))*(o+2*h)+d:o<=s?(i=0,a=(o=Math.min(Math.max(-l,-h),l))*(o+2*h)+d):a=-(i=Math.max(0,-(c*l+u)))*i+(o=i>0?l:Math.min(Math.max(-l,-h),l))*(o+2*h)+d;else o=c>0?-l:l,a=-(i=Math.max(0,-(c*o+u)))*i+o*(o+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Rr).multiplyScalar(o).add(Lr),a},t.intersectSphere=function(e,t){Cr.subVectors(e.center,this.origin);var n=Cr.dot(this.direction),r=Cr.dot(Cr)-n*n,i=e.radius*e.radius;if(r>i)return null;var o=Math.sqrt(i-r),a=n-o,s=n+o;return a<0&&s<0?null:a<0?this.at(s,t):this.at(a,t)},t.intersectsSphere=function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},t.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},t.intersectPlane=function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},t.intersectsPlane=function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},t.intersectBox=function(e,t){var n,r,i,o,a,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),c>=0?(i=(e.min.y-h.y)*c,o=(e.max.y-h.y)*c):(i=(e.max.y-h.y)*c,o=(e.min.y-h.y)*c),n>o||i>r?null:((i>n||n!==n)&&(n=i),(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>r?null:((a>n||n!==n)&&(n=a),(s=0?n:r,t)))},t.intersectsBox=function(e){return null!==this.intersectBox(e,Cr)},t.intersectTriangle=function(e,t,n,r,i){Dr.subVectors(t,e),Or.subVectors(n,e),Ir.crossVectors(Dr,Or);var o,a=this.direction.dot(Ir);if(a>0){if(r)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}Pr.subVectors(this.origin,e);var s=o*this.direction.dot(Or.crossVectors(Pr,Or));if(s<0)return null;var l=o*this.direction.dot(Dr.cross(Pr));if(l<0)return null;if(s+l>a)return null;var c=-o*Pr.dot(Ir);return c<0?null:this.at(c/a,i)},t.applyMatrix4=function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},t.equals=function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},e}(),Fr=function(){function e(){Object.defineProperty(this,"isMatrix4",{value:!0}),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.")}var t=e.prototype;return t.set=function(e,t,n,r,i,o,a,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=o,v[9]=a,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},t.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},t.clone=function(){return(new e).fromArray(this.elements)},t.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},t.copyPosition=function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},t.setFromMatrix3=function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this},t.extractBasis=function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},t.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},t.extractRotation=function(e){var t=this.elements,n=e.elements,r=1/kr.setFromMatrixColumn(e,0).length(),i=1/kr.setFromMatrixColumn(e,1).length(),o=1/kr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},t.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,r=e.y,i=e.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),l=Math.sin(r),c=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=o*c,d=o*u,p=a*c,f=a*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-a*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=o*s}else if("YXZ"===e.order){var m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*l,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){var b=s*c,A=s*u,w=l*c,x=l*u;t[0]=b-x*a,t[4]=-o*u,t[8]=w+A*a,t[1]=A+w*a,t[5]=o*c,t[9]=x-b*a,t[2]=-o*l,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){var E=o*c,M=o*u,_=a*c,T=a*u;t[0]=s*c,t[4]=_*l-M,t[8]=E*l+T,t[1]=s*u,t[5]=T*l+E,t[9]=M*l-_,t[2]=-l,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var S=o*s,C=o*l,L=a*s,R=a*l;t[0]=s*c,t[4]=R-S*u,t[8]=L*u+C,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-l*c,t[6]=C*u+L,t[10]=S-R*u}else if("XZY"===e.order){var P=o*s,D=o*l,O=a*s,I=a*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=P*u+I,t[5]=o*c,t[9]=D*u-O,t[2]=O*u-D,t[6]=a*c,t[10]=I*u+P}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},t.makeRotationFromQuaternion=function(e){return this.compose(Ur,e,Hr)},t.lookAt=function(e,t,n){var r=this.elements;return jr.subVectors(e,t),0===jr.lengthSq()&&(jr.z=1),jr.normalize(),Gr.crossVectors(n,jr),0===Gr.lengthSq()&&(1===Math.abs(n.z)?jr.x+=1e-4:jr.z+=1e-4,jr.normalize(),Gr.crossVectors(n,jr)),Gr.normalize(),zr.crossVectors(jr,Gr),r[0]=Gr.x,r[4]=zr.x,r[8]=jr.x,r[1]=Gr.y,r[5]=zr.y,r[9]=jr.y,r[2]=Gr.z,r[6]=zr.z,r[10]=jr.z,this},t.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)},t.premultiply=function(e){return this.multiplyMatrices(e,this)},t.multiplyMatrices=function(e,t){var n=e.elements,r=t.elements,i=this.elements,o=n[0],a=n[4],s=n[8],l=n[12],c=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],A=n[15],w=r[0],x=r[4],E=r[8],M=r[12],_=r[1],T=r[5],S=r[9],C=r[13],L=r[2],R=r[6],P=r[10],D=r[14],O=r[3],I=r[7],B=r[11],F=r[15];return i[0]=o*w+a*_+s*L+l*O,i[4]=o*x+a*T+s*R+l*I,i[8]=o*E+a*S+s*P+l*B,i[12]=o*M+a*C+s*D+l*F,i[1]=c*w+u*_+h*L+d*O,i[5]=c*x+u*T+h*R+d*I,i[9]=c*E+u*S+h*P+d*B,i[13]=c*M+u*C+h*D+d*F,i[2]=p*w+f*_+m*L+v*O,i[6]=p*x+f*T+m*R+v*I,i[10]=p*E+f*S+m*P+v*B,i[14]=p*M+f*C+m*D+v*F,i[3]=g*w+y*_+b*L+A*O,i[7]=g*x+y*T+b*R+A*I,i[11]=g*E+y*S+b*P+A*B,i[15]=g*M+y*C+b*D+A*F,this},t.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},t.determinant=function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],o=e[1],a=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+i*s*u-r*l*u-i*a*h+n*l*h+r*a*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*o*h-r*o*d+r*l*c-i*s*c)+e[11]*(+t*l*u-t*a*d-i*o*u+n*o*d+i*a*c-n*l*c)+e[15]*(-r*a*c-t*s*u+t*a*h+r*o*u-n*o*h+n*s*c)},t.transpose=function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},t.setPosition=function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},t.invert=function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],v=e[15],g=u*m*l-f*h*l+f*s*d-a*m*d-u*s*v+a*h*v,y=p*h*l-c*m*l-p*s*d+o*m*d+c*s*v-o*h*v,b=c*f*l-p*u*l+p*a*d-o*f*d-c*a*v+o*u*v,A=p*u*s-c*f*s-p*a*h+o*f*h+c*a*m-o*u*m,w=t*g+n*y+r*b+i*A;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var x=1/w;return e[0]=g*x,e[1]=(f*h*i-u*m*i-f*r*d+n*m*d+u*r*v-n*h*v)*x,e[2]=(a*m*i-f*s*i+f*r*l-n*m*l-a*r*v+n*s*v)*x,e[3]=(u*s*i-a*h*i-u*r*l+n*h*l+a*r*d-n*s*d)*x,e[4]=y*x,e[5]=(c*m*i-p*h*i+p*r*d-t*m*d-c*r*v+t*h*v)*x,e[6]=(p*s*i-o*m*i-p*r*l+t*m*l+o*r*v-t*s*v)*x,e[7]=(o*h*i-c*s*i+c*r*l-t*h*l-o*r*d+t*s*d)*x,e[8]=b*x,e[9]=(p*u*i-c*f*i-p*n*d+t*f*d+c*n*v-t*u*v)*x,e[10]=(o*f*i-p*a*i+p*n*l-t*f*l-o*n*v+t*a*v)*x,e[11]=(c*a*i-o*u*i-c*n*l+t*u*l+o*n*d-t*a*d)*x,e[12]=A*x,e[13]=(c*f*r-p*u*r+p*n*h-t*f*h-c*n*m+t*u*m)*x,e[14]=(p*a*r-o*f*r-p*n*s+t*f*s+o*n*m-t*a*m)*x,e[15]=(o*u*r-c*a*r+c*n*s-t*u*s-o*n*h+t*a*h)*x,this},t.scale=function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},t.getMaxScaleOnAxis=function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},t.makeTranslation=function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},t.makeRotationX=function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},t.makeRotationY=function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},t.makeRotationZ=function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},t.makeRotationAxis=function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,o=e.x,a=e.y,s=e.z,l=i*o,c=i*a;return this.set(l*o+n,l*a-r*s,l*s+r*a,0,l*a+r*s,c*a+n,c*s-r*o,0,l*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this},t.makeScale=function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},t.makeShear=function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},t.compose=function(e,t,n){var r=this.elements,i=t._x,o=t._y,a=t._z,s=t._w,l=i+i,c=o+o,u=a+a,h=i*l,d=i*c,p=i*u,f=o*c,m=o*u,v=a*u,g=s*l,y=s*c,b=s*u,A=n.x,w=n.y,x=n.z;return r[0]=(1-(f+v))*A,r[1]=(d+b)*A,r[2]=(p-y)*A,r[3]=0,r[4]=(d-b)*w,r[5]=(1-(h+v))*w,r[6]=(m+g)*w,r[7]=0,r[8]=(p+y)*x,r[9]=(m-g)*x,r[10]=(1-(h+f))*x,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},t.decompose=function(e,t,n){var r=this.elements,i=kr.set(r[0],r[1],r[2]).length(),o=kr.set(r[4],r[5],r[6]).length(),a=kr.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Nr.copy(this);var s=1/i,l=1/o,c=1/a;return Nr.elements[0]*=s,Nr.elements[1]*=s,Nr.elements[2]*=s,Nr.elements[4]*=l,Nr.elements[5]*=l,Nr.elements[6]*=l,Nr.elements[8]*=c,Nr.elements[9]*=c,Nr.elements[10]*=c,t.setFromRotationMatrix(Nr),n.x=i,n.y=o,n.z=a,this},t.makePerspective=function(e,t,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*i/(t-e),l=2*i/(n-r),c=(t+e)/(t-e),u=(n+r)/(n-r),h=-(o+i)/(o-i),d=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},t.makeOrthographic=function(e,t,n,r,i,o){var a=this.elements,s=1/(t-e),l=1/(n-r),c=1/(o-i),u=(t+e)*s,h=(n+r)*l,d=(o+i)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},t.equals=function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},t.fromArray=function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},t.toArray=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e},e}(),kr=new lr,Nr=new Fr,Ur=new lr(0,0,0),Hr=new lr(1,1,1),Gr=new lr,zr=new lr,jr=new lr,Vr=function(){function e(t,n,r,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=e.DefaultOrder),Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=n,this._z=r,this._order=i}var t=e.prototype;return t.set=function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},t.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)},t.copy=function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},t.setFromRotationMatrix=function(e,t,n){var r=Kn.clamp,i=e.elements,o=i[0],a=i[4],s=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],p=i[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,o),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},t.setFromQuaternion=function(e,t,n){return Wr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Wr,t,n)},t.setFromVector3=function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},t.reorder=function(e){return qr.setFromEuler(this),this.setFromQuaternion(qr,e)},t.equals=function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},t.fromArray=function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},t.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._order,e},t.toVector3=function(e){return e?e.set(this._x,this._y,this._z):new lr(this._x,this._y,this._z)},t._onChange=function(e){return this._onChangeCallback=e,this},t._onChangeCallback=function(){},Hn(e,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}]),e}();Vr.DefaultOrder="XYZ",Vr.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Wr=new Fr,qr=new sr,Xr=function(){function e(){this.mask=1}var t=e.prototype;return t.set=function(e){this.mask=1<1){for(var t=0;t1){for(var t=0;t0){r.children=[];for(var p=0;p0){r.animations=[];for(var f=0;f0&&(n.geometries=v),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),b.length>0&&(n.images=b),A.length>0&&(n.shapes=A),w.length>0&&(n.skeletons=w),x.length>0&&(n.animations=x)}return n.object=r,n;function E(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}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.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.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;n1?void 0:t.copy(n).multiplyScalar(i).add(e.start)},t.intersectsLine=function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},t.intersectsBox=function(e){return e.intersectsPlane(this)},t.intersectsSphere=function(e){return e.intersectsPlane(this)},t.coplanarPoint=function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new lr),e.copy(this.normal).multiplyScalar(-this.constant)},t.applyMatrix4=function(e,t){var n=t||ui.getNormalMatrix(e),r=this.coplanarPoint(li).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},t.translate=function(e){return this.constant-=e.dot(this.normal),this},t.equals=function(e){return e.normal.equals(this.normal)&&e.constant===this.constant},e}(),di=new lr,pi=new lr,fi=new lr,mi=new lr,vi=new lr,gi=new lr,yi=new lr,bi=new lr,Ai=new lr,wi=new lr,xi=function(){function e(e,t,n){this.a=void 0!==e?e:new lr,this.b=void 0!==t?t:new lr,this.c=void 0!==n?n:new lr}e.getNormal=function(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new lr),r.subVectors(n,t),di.subVectors(e,t),r.cross(di);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},e.getBarycoord=function(e,t,n,r,i){di.subVectors(r,t),pi.subVectors(n,t),fi.subVectors(e,t);var o=di.dot(di),a=di.dot(pi),s=di.dot(fi),l=pi.dot(pi),c=pi.dot(fi),u=o*l-a*a;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new lr),0===u)return i.set(-2,-1,-1);var h=1/u,d=(l*s-a*c)*h,p=(o*c-a*s)*h;return i.set(1-d-p,p,d)},e.containsPoint=function(e,t,n,r){return this.getBarycoord(e,t,n,r,mi),mi.x>=0&&mi.y>=0&&mi.x+mi.y<=1},e.getUV=function(e,t,n,r,i,o,a,s){return this.getBarycoord(e,t,n,r,mi),s.set(0,0),s.addScaledVector(i,mi.x),s.addScaledVector(o,mi.y),s.addScaledVector(a,mi.z),s},e.isFrontFacing=function(e,t,n,r){return di.subVectors(n,t),pi.subVectors(e,t),di.cross(pi).dot(r)<0};var t=e.prototype;return t.set=function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},t.setFromPointsAndIndices=function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},t.clone=function(){return(new this.constructor).copy(this)},t.copy=function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},t.getArea=function(){return di.subVectors(this.c,this.b),pi.subVectors(this.a,this.b),.5*di.cross(pi).length()},t.getMidpoint=function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new lr),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},t.getNormal=function(t){return e.getNormal(this.a,this.b,this.c,t)},t.getPlane=function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new hi),e.setFromCoplanarPoints(this.a,this.b,this.c)},t.getBarycoord=function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)},t.getUV=function(t,n,r,i,o){return e.getUV(t,this.a,this.b,this.c,n,r,i,o)},t.containsPoint=function(t){return e.containsPoint(t,this.a,this.b,this.c)},t.isFrontFacing=function(t){return e.isFrontFacing(this.a,this.b,this.c,t)},t.intersectsBox=function(e){return e.intersectsTriangle(this)},t.closestPointToPoint=function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new lr);var n,r,i=this.a,o=this.b,a=this.c;vi.subVectors(o,i),gi.subVectors(a,i),bi.subVectors(e,i);var s=vi.dot(bi),l=gi.dot(bi);if(s<=0&&l<=0)return t.copy(i);Ai.subVectors(e,o);var c=vi.dot(Ai),u=gi.dot(Ai);if(c>=0&&u<=c)return t.copy(o);var h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(i).addScaledVector(vi,n);wi.subVectors(e,a);var d=vi.dot(wi),p=gi.dot(wi);if(p>=0&&d<=p)return t.copy(a);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(gi,r);var m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return yi.subVectors(a,o),r=(u-c)/(u-c+(d-p)),t.copy(o).addScaledVector(yi,r);var v=1/(m+f+h);return n=f*v,r=h*v,t.copy(i).addScaledVector(vi,n).addScaledVector(gi,r)},t.equals=function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},e}(),Ei={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},Mi={h:0,s:0,l:0},_i={h:0,s:0,l:0};function Ti(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 Si(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Ci(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Li=function(){function e(e,t,n){return Object.defineProperty(this,"isColor",{value:!0}),void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}var t=e.prototype;return t.set=function(e){return e&&e.isColor?this.copy(e):"number"===typeof e?this.setHex(e):"string"===typeof e&&this.setStyle(e),this},t.setScalar=function(e){return this.r=e,this.g=e,this.b=e,this},t.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},t.setRGB=function(e,t,n){return this.r=e,this.g=t,this.b=n,this},t.setHSL=function(e,t,n){if(e=Kn.euclideanModulo(e,1),t=Kn.clamp(t,0,1),n=Kn.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Ti(i,r,e+1/3),this.g=Ti(i,r,e),this.b=Ti(i,r,e-1/3)}return this},t.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?)\(([^\)]*)\)/.exec(e)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return t(r[4]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=n[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},t.setColorName=function(e){var t=Ei[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},t.clone=function(){return new this.constructor(this.r,this.g,this.b)},t.copy=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},t.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},t.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},t.convertGammaToLinear=function(e){return this.copyGammaToLinear(this,e),this},t.convertLinearToGamma=function(e){return this.copyLinearToGamma(this,e),this},t.copySRGBToLinear=function(e){return this.r=Si(e.r),this.g=Si(e.g),this.b=Si(e.b),this},t.copyLinearToSRGB=function(e){return this.r=Ci(e.r),this.g=Ci(e.g),this.b=Ci(e.b),this},t.convertSRGBToLinear=function(){return this.copySRGBToLinear(this),this},t.convertLinearToSRGB=function(){return this.copyLinearToSRGB(this),this},t.getHex=function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},t.getHexString=function(){return("000000"+this.getHex().toString(16)).slice(-6)},t.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,r=this.r,i=this.g,o=this.b,a=Math.max(r,i,o),s=Math.min(r,i,o),l=(s+a)/2;if(s===a)t=0,n=0;else{var c=a-s;switch(n=l<=.5?c/(a+s):c/(2-a-s),a){case r:t=(i-o)/c+(i0&&(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),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),o=r(e.images);i.length>0&&(n.textures=i),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.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.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Di.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Oi.prototype=Object.create(Di.prototype),Oi.prototype.constructor=Oi,Oi.prototype.isMeshBasicMaterial=!0,Oi.prototype.copy=function(e){return Di.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};var Ii=new lr,Bi=new Jn;function Fi(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=Tn,this.updateRange={offset:0,count:-1},this.version=0}function ki(e,t,n){Fi.call(this,new Int8Array(e),t,n)}function Ni(e,t,n){Fi.call(this,new Uint8Array(e),t,n)}function Ui(e,t,n){Fi.call(this,new Uint8ClampedArray(e),t,n)}function Hi(e,t,n){Fi.call(this,new Int16Array(e),t,n)}function Gi(e,t,n){Fi.call(this,new Uint16Array(e),t,n)}function zi(e,t,n){Fi.call(this,new Int32Array(e),t,n)}function ji(e,t,n){Fi.call(this,new Uint32Array(e),t,n)}function Vi(e,t,n){Fi.call(this,new Uint16Array(e),t,n)}function Wi(e,t,n){Fi.call(this,new Float32Array(e),t,n)}function qi(e,t,n){Fi.call(this,new Float64Array(e),t,n)}function Xi(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,r=e.length;nt&&(t=e[n]);return t}Object.defineProperty(Fi.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Fi.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=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.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r65535?ji:Gi)(e,1):this.index=e,this},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},hasAttribute:function(e){return void 0!==this.attributes[e]},addGroup:function(e,t,n){void 0===n&&(n=0),this.groups.push({start:e,count:t,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new $n).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Ki.makeRotationX(e),this.applyMatrix4(Ki),this},rotateY:function(e){return Ki.makeRotationY(e),this.applyMatrix4(Ki),this},rotateZ:function(e){return Ki.makeRotationZ(e),this.applyMatrix4(Ki),this},translate:function(e,t,n){return Ki.makeTranslation(e,t,n),this.applyMatrix4(Ki),this},scale:function(e,t,n){return Ki.makeScale(e,t,n),this.applyMatrix4(Ki),this},lookAt:function(e){return Ji.lookAt(e),Ji.updateMatrix(),this.applyMatrix4(Ji.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($i).negate(),this.translate($i.x,$i.y,$i.z),this},setFromPoints:function(e){for(var t=[],n=0,r=e.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 r=this.index;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var o in i){var a=i[o],s=a.toJSON(e.data);""!==a.name&&(s.name=a.name),e.data.attributes[o]=s}var l={},c=!1;for(var u in this.morphAttributes){for(var h=this.morphAttributes[u],d=[],p=0,f=h.length;p0&&(l[u]=d,c=!0)}c&&(e.data.morphAttributes=l,e.data.morphTargetsRelative=this.morphTargetsRelative);var g=this.groups;g.length>0&&(e.data.groups=JSON.parse(JSON.stringify(g)));var y=this.boundingSphere;return null!==y&&(e.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),e},clone:function(){return(new ro).copy(this)},copy:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var o=r[i];this.setAttribute(i,o.clone(t))}var a=e.morphAttributes;for(var s in a){for(var l=[],c=a[s],u=0,h=c.length;un.far?null:{distance:l,point:wo.clone(),object:e}}function Mo(e,t,n,r,i,o,a,s,l,c,u,h){so.fromBufferAttribute(i,c),lo.fromBufferAttribute(i,u),co.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(t.morphTargets&&o&&d){fo.set(0,0,0),mo.set(0,0,0),vo.set(0,0,0);for(var p=0,f=o.length;p0){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,o=r.length;i0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,r=this.geometry,i=this.material,o=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),ao.copy(r.boundingSphere),ao.applyMatrix4(o),!1!==e.ray.intersectsSphere(ao)&&(io.copy(o).invert(),oo.copy(e.ray).applyMatrix4(io),null===r.boundingBox||!1!==oo.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var a=r.index,s=r.attributes.position,l=r.morphAttributes.position,c=r.morphTargetsRelative,u=r.attributes.uv,h=r.attributes.uv2,d=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(i))for(var f=0,m=d.length;f0?1:-1,h.push(S.x,S.y,S.z),d.push(R/m),d.push(1-C/v),_+=1}for(var D=0;D0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var o in this.extensions)!0===this.extensions[o]&&(i[o]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},Do.prototype=Object.assign(Object.create(si.prototype),{constructor:Do,isCamera:!0,copy:function(e,t){return si.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 lr),this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){si.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(e,t){si.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Oo.prototype=Object.assign(Object.create(Do.prototype),{constructor:Oo,isPerspectiveCamera:!0,copy:function(e,t){return Do.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*Kn.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Kn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Kn.RAD2DEG*Math.atan(Math.tan(.5*Kn.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,r,i,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=r,this.view.width=i,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*Kn.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,o=this.view;if(null!==this.view&&this.view.enabled){var a=o.fullWidth,s=o.fullHeight;i+=o.offsetX*r/a,t-=o.offsetY*n/s,r*=o.width/a,n*=o.height/s}var l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(e){var t=si.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 Io=90,Bo=1;function Fo(e,t,n){if(si.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var r=new Oo(Io,Bo,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new lr(1,0,0)),this.add(r);var i=new Oo(Io,Bo,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new lr(-1,0,0)),this.add(i);var o=new Oo(Io,Bo,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new lr(0,1,0)),this.add(o);var a=new Oo(Io,Bo,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new lr(0,-1,0)),this.add(a);var s=new Oo(Io,Bo,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new lr(0,0,1)),this.add(s);var l=new Oo(Io,Bo,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new lr(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var c=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,r),e.setRenderTarget(n,1),e.render(t,i),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.xr.enabled=c}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function ko(e,t,n,r,i,o,a,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:ae,a=void 0!==a?a:Ne,nr.call(this,e,t,n,r,i,o,a,s,l,c),this.flipY=!1,this._needsFlipEnvMap=!0}Fo.prototype=Object.create(si.prototype),Fo.prototype.constructor=Fo,ko.prototype=Object.create(nr.prototype),ko.prototype.constructor=ko,ko.prototype.isCubeTexture=!0,Object.defineProperty(ko.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var No=function(e){function t(t,n,r){var i;return Number.isInteger(n)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),n=r),i=e.call(this,t,t,n)||this,Object.defineProperty(zn(i),"isWebGLCubeRenderTarget",{value:!0}),n=n||{},i.texture=new ko(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),i.texture._needsFlipEnvMap=!1,i}Gn(t,e);var n=t.prototype;return n.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=Ue,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},r=new _o(5,5,5),i=new Po({name:"CubemapFromEquirect",uniforms:To(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:v,blending:A});i.uniforms.tEquirect.value=t;var o=new xo(r,i),a=t.minFilter;return t.minFilter===Ee&&(t.minFilter=Ae),new Fo(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this},n.clear=function(e,t,n,r){for(var i=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,r);e.setRenderTarget(i)},t}(or);function Uo(e,t,n,r,i,o,a,s,l,c,u,h){nr.call(this,null,o,a,s,l,c,r,i,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:me,this.minFilter=void 0!==c?c:me,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Uo.prototype=Object.create(nr.prototype),Uo.prototype.constructor=Uo,Uo.prototype.isDataTexture=!0;var Ho=new Sr,Go=new lr,zo=function(){function e(e,t,n,r,i,o){this.planes=[void 0!==e?e:new hi,void 0!==t?t:new hi,void 0!==n?n:new hi,void 0!==r?r:new hi,void 0!==i?i:new hi,void 0!==o?o:new hi]}var t=e.prototype;return t.set=function(e,t,n,r,i,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},t.clone=function(){return(new this.constructor).copy(this)},t.copy=function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},t.setFromProjectionMatrix=function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=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-r,u-s,f-h,y-m).normalize(),t[1].setComponents(a+r,u+s,f+h,y+m).normalize(),t[2].setComponents(a+i,u+l,f+d,y+v).normalize(),t[3].setComponents(a-i,u-l,f-d,y-v).normalize(),t[4].setComponents(a-o,u-c,f-p,y-g).normalize(),t[5].setComponents(a+o,u+c,f+p,y+g).normalize(),this},t.intersectsObject=function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ho.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ho)},t.intersectsSprite=function(e){return Ho.center.set(0,0,0),Ho.radius=.7071067811865476,Ho.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ho)},t.intersectsSphere=function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++)if(t[i].distanceToPoint(n)0?e.max.x:e.min.x,Go.y=r.normal.y>0?e.max.y:e.min.y,Go.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Go)<0)return!1}return!0},t.containsPoint=function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0},e}();function jo(){var e=null,t=!1,n=null,r=null;function i(t,o){n(t,o),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Vo(e,t){var n=t.isWebGL2,r=new WeakMap;function i(t,r){var i=t.array,o=t.usage,a=e.createBuffer();e.bindBuffer(r,a),e.bufferData(r,i,o),t.onUploadCallback();var s=5126;return i instanceof Float32Array?s=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?t.isFloat16BufferAttribute?n?s=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):s=5123:i instanceof Int16Array?s=5122:i instanceof Uint32Array?s=5125:i instanceof Int32Array?s=5124:i instanceof Int8Array?s=5120:i instanceof Uint8Array&&(s=5121),{buffer:a,type:s,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}function o(t,r,i){var o=r.array,a=r.updateRange;e.bindBuffer(i,t),-1===a.count?e.bufferSubData(i,0,o):(n?e.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o,a.offset,a.count):e.bufferSubData(i,a.offset*o.BYTES_PER_ELEMENT,o.subarray(a.offset,a.offset+a.count)),a.count=-1)}function a(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)}function s(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))}function l(e,t){if(e.isGLBufferAttribute){var n=r.get(e);(!n||n.version 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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( 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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, 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}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\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_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\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}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\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 = clamp( floor( D ) / 255.0, 0.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#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\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\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, 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\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\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 = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\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 USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * 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 = ( isOrthographic ) ? vec3( 0, 0, 1 ) : 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;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in 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};\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};\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};\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_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",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 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\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 );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#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(\t\t0, 1,\t\t0 ),\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#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * 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( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, 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, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 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:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * 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\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\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#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\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 dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\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_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\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#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_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:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\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 \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",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 = equirectUv( direction );\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 \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * 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\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 \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#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 \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\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\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 \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#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}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\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 \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}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \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 STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\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 \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#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\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\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#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\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 STANDARD\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( TANGENTSPACE_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( TANGENTSPACE_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 \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( TANGENTSPACE_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 = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#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}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\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 = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Xo={common:{diffuse:{value:new Li(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new $n},uv2Transform:{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 Jn(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 Li(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Li(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new $n}},sprite:{diffuse:{value:new Li(15658734)},opacity:{value:1},center:{value:new Jn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new $n}}},Yo={basic:{uniforms:So([Xo.common,Xo.specularmap,Xo.envmap,Xo.aomap,Xo.lightmap,Xo.fog]),vertexShader:qo.meshbasic_vert,fragmentShader:qo.meshbasic_frag},lambert:{uniforms:So([Xo.common,Xo.specularmap,Xo.envmap,Xo.aomap,Xo.lightmap,Xo.emissivemap,Xo.fog,Xo.lights,{emissive:{value:new Li(0)}}]),vertexShader:qo.meshlambert_vert,fragmentShader:qo.meshlambert_frag},phong:{uniforms:So([Xo.common,Xo.specularmap,Xo.envmap,Xo.aomap,Xo.lightmap,Xo.emissivemap,Xo.bumpmap,Xo.normalmap,Xo.displacementmap,Xo.fog,Xo.lights,{emissive:{value:new Li(0)},specular:{value:new Li(1118481)},shininess:{value:30}}]),vertexShader:qo.meshphong_vert,fragmentShader:qo.meshphong_frag},standard:{uniforms:So([Xo.common,Xo.envmap,Xo.aomap,Xo.lightmap,Xo.emissivemap,Xo.bumpmap,Xo.normalmap,Xo.displacementmap,Xo.roughnessmap,Xo.metalnessmap,Xo.fog,Xo.lights,{emissive:{value:new Li(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qo.meshphysical_vert,fragmentShader:qo.meshphysical_frag},toon:{uniforms:So([Xo.common,Xo.aomap,Xo.lightmap,Xo.emissivemap,Xo.bumpmap,Xo.normalmap,Xo.displacementmap,Xo.gradientmap,Xo.fog,Xo.lights,{emissive:{value:new Li(0)}}]),vertexShader:qo.meshtoon_vert,fragmentShader:qo.meshtoon_frag},matcap:{uniforms:So([Xo.common,Xo.bumpmap,Xo.normalmap,Xo.displacementmap,Xo.fog,{matcap:{value:null}}]),vertexShader:qo.meshmatcap_vert,fragmentShader:qo.meshmatcap_frag},points:{uniforms:So([Xo.points,Xo.fog]),vertexShader:qo.points_vert,fragmentShader:qo.points_frag},dashed:{uniforms:So([Xo.common,Xo.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qo.linedashed_vert,fragmentShader:qo.linedashed_frag},depth:{uniforms:So([Xo.common,Xo.displacementmap]),vertexShader:qo.depth_vert,fragmentShader:qo.depth_frag},normal:{uniforms:So([Xo.common,Xo.bumpmap,Xo.normalmap,Xo.displacementmap,{opacity:{value:1}}]),vertexShader:qo.normal_vert,fragmentShader:qo.normal_frag},sprite:{uniforms:So([Xo.sprite,Xo.fog]),vertexShader:qo.sprite_vert,fragmentShader:qo.sprite_frag},background:{uniforms:{uvTransform:{value:new $n},t2D:{value:null}},vertexShader:qo.background_vert,fragmentShader:qo.background_frag},cube:{uniforms:So([Xo.envmap,{opacity:{value:1}}]),vertexShader:qo.cube_vert,fragmentShader:qo.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qo.equirect_vert,fragmentShader:qo.equirect_frag},distanceRGBA:{uniforms:So([Xo.common,Xo.displacementmap,{referencePosition:{value:new lr},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qo.distanceRGBA_vert,fragmentShader:qo.distanceRGBA_frag},shadow:{uniforms:So([Xo.lights,Xo.fog,{color:{value:new Li(0)},opacity:{value:1}}]),vertexShader:qo.shadow_vert,fragmentShader:qo.shadow_frag}};function Qo(e,t,n,r,i){var o,a,s=new Li(0),l=0,c=null,u=0,h=null;function d(n,i,d,f){var g=!0===i.isScene?i.background:null;g&&g.isTexture&&(g=t.get(g));var y=e.xr,b=y.getSession&&y.getSession();b&&"additive"===b.environmentBlendMode&&(g=null),null===g?p(s,l):g&&g.isColor&&(p(g,1),f=!0),(e.autoClear||f)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),g&&(g.isCubeTexture||g.isWebGLCubeRenderTarget||g.mapping===ue)?(void 0===a&&((a=new xo(new _o(1,1,1),new Po({name:"BackgroundCubeMaterial",uniforms:To(Yo.cube.uniforms),vertexShader:Yo.cube.vertexShader,fragmentShader:Yo.cube.fragmentShader,side:v,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(a)),g.isWebGLCubeRenderTarget&&(g=g.texture),a.material.uniforms.envMap.value=g,a.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g._needsFlipEnvMap?-1:1,c===g&&u===g.version&&h===e.toneMapping||(a.material.needsUpdate=!0,c=g,u=g.version,h=e.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null)):g&&g.isTexture&&(void 0===o&&((o=new xo(new Wo(2,2),new Po({name:"BackgroundMaterial",uniforms:To(Yo.background.uniforms),vertexShader:Yo.background.vertexShader,fragmentShader:Yo.background.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),o.material.uniforms.uvTransform.value.copy(g.matrix),c===g&&u===g.version&&h===e.toneMapping||(o.material.needsUpdate=!0,c=g,u=g.version,h=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return s},setClearColor:function(e,t){void 0===t&&(t=1),s.set(e),p(s,l=t)},getClearAlpha:function(){return l},setClearAlpha:function(e){p(s,l=e)},render:d}}function Zo(e,t,n,r){var i=e.getParameter(34921),o=r.isWebGL2?null:t.get("OES_vertex_array_object"),a=r.isWebGL2||null!==o,s={},l=m(null),c=l;function u(t,r,i,o,s){var l=!1;if(a){var u=f(o,i,r);c!==u&&d((c=u).object),(l=v(o,s))&&g(o,s)}else{var h=!0===r.wireframe;c.geometry===o.id&&c.program===i.id&&c.wireframe===h||(c.geometry=o.id,c.program=i.id,c.wireframe=h,l=!0)}!0===t.isInstancedMesh&&(l=!0),null!==s&&n.update(s,34963),l&&(E(t,r,i,o),null!==s&&e.bindBuffer(34963,n.get(s).buffer))}function h(){return r.isWebGL2?e.createVertexArray():o.createVertexArrayOES()}function d(t){return r.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function p(t){return r.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function f(e,t,n){var r=!0===n.wireframe,i=s[e.id];void 0===i&&(i={},s[e.id]=i);var o=i[t.id];void 0===o&&(o={},i[t.id]=o);var a=o[r];return void 0===a&&(a=m(h()),o[r]=a),a}function m(e){for(var t=[],n=[],r=[],o=0;o=0){var p=l[h];if(void 0!==p){var f=p.normalized,m=p.itemSize,v=n.get(p);if(void 0===v)continue;var g=v.buffer,E=v.type,M=v.bytesPerElement;if(p.isInterleavedBufferAttribute){var _=p.data,T=_.stride,S=p.offset;_&&_.isInstancedInterleavedBuffer?(A(d,_.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=_.meshPerAttribute*_.count)):b(d),e.bindBuffer(34962,g),x(d,m,E,f,T*M,S*M)}else p.isInstancedBufferAttribute?(A(d,p.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=p.meshPerAttribute*p.count)):b(d),e.bindBuffer(34962,g),x(d,m,E,f,0,0)}else if("instanceMatrix"===h){var C=n.get(i.instanceMatrix);if(void 0===C)continue;var L=C.buffer,R=C.type;A(d+0,1),A(d+1,1),A(d+2,1),A(d+3,1),e.bindBuffer(34962,L),e.vertexAttribPointer(d+0,4,R,!1,64,0),e.vertexAttribPointer(d+1,4,R,!1,64,16),e.vertexAttribPointer(d+2,4,R,!1,64,32),e.vertexAttribPointer(d+3,4,R,!1,64,48)}else if("instanceColor"===h){var P=n.get(i.instanceColor);if(void 0===P)continue;var D=P.buffer,O=P.type;A(d,1),e.bindBuffer(34962,D),e.vertexAttribPointer(d,3,O,!1,12,0)}else if(void 0!==u){var I=u[h];if(void 0!==I)switch(I.length){case 2:e.vertexAttrib2fv(d,I);break;case 3:e.vertexAttrib3fv(d,I);break;case 4:e.vertexAttrib4fv(d,I);break;default:e.vertexAttrib1fv(d,I)}}}}w()}}function M(){for(var e in S(),s){var t=s[e];for(var n in t){var r=t[n];for(var i in r)p(r[i].object),delete r[i];delete t[n]}delete s[e]}}function _(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var r=t[n];for(var i in r)p(r[i].object),delete r[i];delete t[n]}delete s[e.id]}}function T(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var r=n[e.id];for(var i in r)p(r[i].object),delete r[i];delete n[e.id]}}}function S(){C(),c!==l&&d((c=l).object)}function C(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:S,resetDefaultState:C,dispose:M,releaseStatesOfGeometry:_,releaseStatesOfProgram:T,initAttributes:y,enableAttribute:b,disableUnusedAttributes:w}}function Ko(e,t,n,r){var i,o=r.isWebGL2;function a(e){i=e}function s(t,r){e.drawArrays(i,t,r),n.update(r,i,1)}function l(r,a,s){if(0!==s){var l,c;if(o)l=e,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](i,r,a,s),n.update(a,i,s)}}this.setMode=a,this.render=s,this.renderInstances=l}function Jo(e,t,n){var r;function i(){if(void 0!==r)return r;var n=t.get("EXT_texture_filter_anisotropic");return r=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function o(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&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 a="undefined"!==typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!==typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,s=void 0!==n.precision?n.precision:"highp",l=o(s);l!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);var c=!0===n.logarithmicDepthBuffer,u=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),m=e.getParameter(36347),v=e.getParameter(36348),g=e.getParameter(36349),y=h>0,b=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:i,getMaxPrecision:o,precision:s,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:a?e.getParameter(36183):0}}function $o(e){var t=this,n=null,r=0,i=!1,o=!1,a=new hi,s=new $n,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){var o=null!==e?e.length:0,c=null;if(0!==o){if(c=l.value,!0!==i||null===c){var u=r+4*o,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===c||c.length0){var s=e.getRenderList(),l=e.getRenderTarget(),c=new No(a.height/2);return c.fromEquirectangularTexture(e,r),t.set(r,c),e.setRenderTarget(l),e.setRenderList(s),r.addEventListener("dispose",i),n(c.texture,r.mapping)}return null}}return r}function i(e){var n=e.target;n.removeEventListener("dispose",i);var r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}function o(){t=new WeakMap}return{get:r,dispose:o}}function ta(e){var t={};function n(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function na(e,t,n,r){var i={},o=new WeakMap;function a(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);s.removeEventListener("dispose",a),delete i[s.id];var c=o.get(s);c&&(t.remove(c),o.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return!0===i[t.id]||(t.addEventListener("dispose",a),i[t.id]=!0,n.memory.geometries++),t}function l(e){var n=e.attributes;for(var r in n)t.update(n[r],34962);var i=e.morphAttributes;for(var o in i)for(var a=i[o],s=0,l=a.length;s65535?ji:Gi)(n,1);b.version=a;var A=o.get(e);A&&t.remove(A),o.set(e,b)}function u(e){var t=o.get(e);if(t){var n=e.index;null!==n&&t.version0)return e;var i=t*n,o=ma[i];if(void 0===o&&(o=new Float32Array(i),ma[i]=o),0!==t){r.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=n,e[a].toArray(o,s)}return o}function wa(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n/gm;function Es(e){return e.replace(xs,Ms)}function Ms(e,t){var n=qo[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Es(n)}var _s=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ts=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ss(e){return e.replace(Ts,Ls).replace(_s,Cs)}function Cs(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ls(e,t,n,r)}function Ls(e,t,n,r){for(var i="",o=parseInt(t);o0?e.gammaFactor:1,m=n.isWebGL2?"":vs(n),v=gs(s),g=a.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=[v].filter(bs).join("\n")).length>0&&(i+="\n"),(o=[m,v].filter(bs).join("\n")).length>0&&(o+="\n")):(i=[Rs(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+f,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#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(bs).join("\n"),o=[m,Rs(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==$?"#define TONE_MAPPING":"",n.toneMapping!==$?qo.tonemapping_pars_fragment:"",n.toneMapping!==$?ms("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",qo.encodings_pars_fragment,n.map?ps("mapTexelToLinear",n.mapEncoding):"",n.matcap?ps("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?ps("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?ps("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?ps("lightMapTexelToLinear",n.lightMapEncoding):"",fs("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(bs).join("\n")),l=ws(l=As(l=Es(l),n),n),c=ws(c=As(c=Es(c),n),n),l=Ss(l),c=Ss(c),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,o=["#define varying in",n.glslVersion===Fn?"":"out highp vec4 pc_fragColor;",n.glslVersion===Fn?"":"#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"+o);var b,A,w=y+o+c,x=ls(a,35633,y+i+l),E=ls(a,35632,w);if(a.attachShader(g,x),a.attachShader(g,E),void 0!==n.index0AttributeName?a.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&a.bindAttribLocation(g,0,"position"),a.linkProgram(g),e.debug.checkShaderErrors){var M=a.getProgramInfoLog(g).trim(),_=a.getShaderInfoLog(x).trim(),T=a.getShaderInfoLog(E).trim(),S=!0,C=!0;if(!1===a.getProgramParameter(g,35714)){S=!1;var L=ds(a,x,"vertex"),R=ds(a,E,"fragment");console.error("THREE.WebGLProgram: shader error: ",a.getError(),"35715",a.getProgramParameter(g,35715),"gl.getProgramInfoLog",M,L,R)}else""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==_&&""!==T||(C=!1);C&&(this.diagnostics={runnable:S,programLog:M,vertexShader:{log:_,prefix:i},fragmentShader:{log:T,prefix:o}})}return a.deleteShader(x),a.deleteShader(E),this.getUniforms=function(){return void 0===b&&(b=new ss(a,g)),b},this.getAttributes=function(){return void 0===A&&(A=ys(a,g)),A},this.destroy=function(){r.releaseStatesOfProgram(this),a.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=cs++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=x,this.fragmentShader=E,this}function Fs(e,t,n,r,i,o){var a=[],s=r.isWebGL2,l=r.logarithmicDepthBuffer,c=r.floatVertexTextures,u=r.maxVertexUniforms,h=r.vertexTextures,d=r.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function m(e){var t=e.skeleton.bones;if(c)return 1024;var n=u,r=Math.floor((n-20)/4),i=Math.min(r,t.length);return i0,maxBones:T,useVertexTexture:c,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:$,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===g,flipSided:i.side===v,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}}function A(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);if(!1===t.isRawShaderMaterial){for(var i=0;i1&&r.sort(e||Ns),i.length>1&&i.sort(t||Us)}function h(){for(var e=n,r=t.length;e0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=Xo.LTC_FLOAT_1,i.rectAreaLTC2=Xo.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(i.rectAreaLTC1=Xo.LTC_HALF_1,i.rectAreaLTC2=Xo.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=l;var k=i.hash;k.directionalLength===u&&k.pointLength===h&&k.spotLength===d&&k.rectAreaLength===p&&k.hemiLength===f&&k.numDirectionalShadows===m&&k.numPointShadows===v&&k.numSpotShadows===g||(i.directional.length=u,i.spot.length=d,i.rectArea.length=p,i.point.length=h,i.hemi.length=f,i.directionalShadow.length=m,i.directionalShadowMap.length=m,i.pointShadow.length=v,i.pointShadowMap.length=v,i.spotShadow.length=g,i.spotShadowMap.length=g,i.directionalShadowMatrix.length=m,i.pointShadowMatrix.length=v,i.spotShadowMatrix.length=g,k.directionalLength=u,k.pointLength=h,k.spotLength=d,k.rectAreaLength=p,k.hemiLength=f,k.numDirectionalShadows=m,k.numPointShadows=v,k.numSpotShadows=g,i.version=Vs++)}function u(e,t){for(var n=0,r=0,o=0,c=0,u=0,h=t.matrixWorldInverse,d=0,p=e.length;d=n.get(r).length?(o=new Xs(e,t),n.get(r).push(o)):o=n.get(r)[i],o}function i(){n=new WeakMap}return{get:r,dispose:i}}function Qs(e){Di.call(this),this.type="MeshDepthMaterial",this.depthPacking=an,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function Zs(e){Di.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new lr,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}Qs.prototype=Object.create(Di.prototype),Qs.prototype.constructor=Qs,Qs.prototype.isMeshDepthMaterial=!0,Qs.prototype.copy=function(e){return Di.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},Zs.prototype=Object.create(Di.prototype),Zs.prototype.constructor=Zs,Zs.prototype.isMeshDistanceMaterial=!0,Zs.prototype.copy=function(e){return Di.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};var Ks="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",Js="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function $s(e,t,n){var r=new zo,i=new Jn,o=new Jn,a=new ir,s=[],l=[],c={},u={0:v,1:m,2:g},h=new Po({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Jn},radius:{value:4}},vertexShader:Js,fragmentShader:Ks}),p=h.clone();p.defines.HORIZONTAL_PASS=1;var y=new ro;y.setAttribute("position",new Fi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var b=new xo(y,h),w=this;function x(n,r){var i=t.update(b);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,h,b,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,p,b,null)}function E(e,t,n){var r=e<<0|t<<1|n<<2,i=s[r];return void 0===i&&(i=new Qs({depthPacking:sn,morphTargets:e,skinning:t}),s[r]=i),i}function M(e,t,n){var r=e<<0|t<<1|n<<2,i=l[r];return void 0===i&&(i=new Zs({morphTargets:e,skinning:t}),l[r]=i),i}function _(t,n,r,i,o,a,s){var l=null,h=E,d=t.customDepthMaterial;if(!0===i.isPointLight&&(h=M,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var m=!1;!0===t.isSkinnedMesh&&(!0===r.skinning?m=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=h(p,m,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var v=l.uuid,g=r.uuid,y=c[v];void 0===y&&(y={},c[v]=y);var b=y[g];void 0===b&&(b=l.clone(),y[g]=b),l=b}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=s===f?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:u[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=o,l.farDistance=a),l}function T(n,i,o,a,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===f)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var u=l.groups,h=0,d=u.length;hn||i.y>n)&&(i.x>n&&(o.x=Math.floor(n/y.x),i.x=o.x*y.x,g.mapSize.x=o.x),i.y>n&&(o.y=Math.floor(n/y.y),i.y=o.y*y.y,g.mapSize.y=o.y)),null===g.map&&!g.isPointLightShadow&&this.type===f){var b={minFilter:Ae,magFilter:Ae,format:Ue};g.map=new or(i.x,i.y,b),g.map.texture.name=v.name+".shadowMap",g.mapPass=new or(i.x,i.y,b),g.camera.updateProjectionMatrix()}if(null===g.map){var E={minFilter:me,magFilter:me,format:Ue};g.map=new or(i.x,i.y,E),g.map.texture.name=v.name+".shadowMap",g.camera.updateProjectionMatrix()}e.setRenderTarget(g.map),e.clear();for(var M=g.getViewportCount(),_=0;_=1):-1!==de.indexOf("OpenGL ES")&&(he=parseFloat(/^OpenGL ES (\d)/.exec(de)[1]),ue=he>=2);var pe=null,fe={},me=new ir,ve=new ir;function ge(t,n,r){var i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var a=0;ar||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<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?Kn.floorPowerOfTwo:Math.floor,a=o(i*e.width),s=o(i*e.height);void 0===c&&(c=g(a,s));var l=n?g(a,s):c;return l.width=a,l.height=s,l.getContext("2d").drawImage(e,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a+"x"+s+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function b(e){return Kn.isPowerOfTwo(e.width)&&Kn.isPowerOfTwo(e.height)}function A(e){return!u&&(e.wrapS!==pe||e.wrapT!==pe||e.minFilter!==me&&e.minFilter!==Ae)}function w(e,t){return e.generateMipmaps&&t&&e.minFilter!==me&&e.minFilter!==Ae}function x(t,n,i,o){e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log(Math.max(i,o))*Math.LOG2E}function E(n,r,i){if(!1===u)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325!==o&&33326!==o&&34842!==o&&34836!==o||t.get("EXT_color_buffer_float"),o}function M(e){return e===me||e===ve||e===ye?9728:9729}function _(e){var t=e.target;t.removeEventListener("dispose",_),S(t),t.isVideoTexture&&m.delete(t),a.memory.textures--}function T(e){var t=e.target;t.removeEventListener("dispose",T),C(t),a.memory.textures--}function S(t){var n=r.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),r.remove(t))}function C(t){var n=r.get(t),i=r.get(t.texture);if(t){if(void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)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),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);r.remove(t.texture),r.remove(t)}}var L=0;function R(){L=0}function P(){var e=L;return e>=h&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+h),L+=1,e}function D(e,t){var i=r.get(e);if(e.isVideoTexture&&Z(e),e.version>0&&i.__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 H(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function O(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?H(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))}function I(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?H(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))}function B(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?G(i,e,t):(n.activeTexture(33984+t),n.bindTexture(34067,i.__webglTexture))}var F=((s={})[de]=10497,s[pe]=33071,s[fe]=33648,s),k=((l={})[me]=9728,l[ve]=9984,l[ye]=9986,l[Ae]=9729,l[we]=9985,l[Ee]=9987,l);function N(n,o,a){a?(e.texParameteri(n,10242,F[o.wrapS]),e.texParameteri(n,10243,F[o.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,F[o.wrapR]),e.texParameteri(n,10240,k[o.magFilter]),e.texParameteri(n,10241,k[o.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),o.wrapS===pe&&o.wrapT===pe||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,M(o.magFilter)),e.texParameteri(n,10241,M(o.minFilter)),o.minFilter!==me&&o.minFilter!==Ae&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(o.type===Pe&&null===t.get("OES_texture_float_linear"))return;if(o.type===De&&null===(u||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function U(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),a.memory.textures++)}function H(t,r,i){var a=3553;r.isDataTexture2DArray&&(a=35866),r.isDataTexture3D&&(a=32879),U(t,r),n.activeTexture(33984+i),n.bindTexture(a,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var s,l=A(r)&&!1===b(r.image),c=y(r.image,l,!1,p),h=b(c)||u,d=o.convert(r.format),f=o.convert(r.type),m=E(r.internalFormat,d,f);N(a,r,h);var v=r.mipmaps;if(r.isDepthTexture)m=6402,u?m=r.type===Pe?36012:r.type===Re?33190:r.type===Fe?35056:33189:r.type===Pe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===je&&6402===m&&r.type!==Ce&&r.type!==Re&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Ce,f=o.convert(r.type)),r.format===Ve&&6402===m&&(m=34041,r.type!==Fe&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Fe,f=o.convert(r.type))),n.texImage2D(3553,0,m,c.width,c.height,0,d,f,null);else if(r.isDataTexture)if(v.length>0&&h){for(var g=0,M=v.length;g0&&h){for(var S=0,C=v.length;S0&&Se(o,e,t),a.length>0&&Se(a,e,t),!0===e.isScene&&e.onAfterRender(f,e,t),null!==b&&(q.updateRenderTargetMipmap(b),q.updateMultisampleRenderTarget(b)),j.buffers.depth.setTest(!0),j.buffers.depth.setMask(!0),j.buffers.color.setMask(!0),j.setPolygonOffset(!1),fe.enabled&&fe.submitFrame&&fe.submitFrame(),p.pop(),d=p.length>0?p[p.length-1]:null,h=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setTexture2D=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTarget&&(e||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),q.setTexture2D(t,n)}}(),this.setFramebuffer=function(e){v!==e&&null===b&&ce.bindFramebuffer(36160,e),v=e},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return y},this.getRenderList=function(){return h},this.setRenderList=function(e){h=e},this.getRenderTarget=function(){return b},this.setRenderTarget=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0),b=e,g=t,y=n,e&&void 0===W.get(e).__webglFramebuffer&&q.setupRenderTarget(e);var r=v,i=!1;if(e){var o=W.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=o[t],i=!0):r=e.isWebGLMultisampleRenderTarget?W.get(e).__webglMultisampledFramebuffer:o,E.copy(e.viewport),M.copy(e.scissor),_=e.scissorTest}else E.copy(P).multiplyScalar(C).floor(),M.copy(D).multiplyScalar(C).floor(),_=O;if(A!==r&&(ce.bindFramebuffer(36160,r),A=r),j.viewport(E),j.scissor(M),j.setScissorTest(_),i){var a=W.get(e.texture);ce.framebufferTexture2D(36160,36064,34069+t,a.__webglTexture,n)}},this.readRenderTargetPixels=function(e,t,n,r,i,o,a){if(e&&e.isWebGLRenderTarget){var s=W.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==a&&(s=s[a]),s){var l=!1;s!==A&&(ce.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,u=c.format,h=c.type;if(u!==Ue&&se.convert(u)!==ce.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var d=h===De&&(G.has("EXT_color_buffer_half_float")||z.isWebGL2&&G.has("EXT_color_buffer_float"));if(h!==_e&&se.convert(h)!==ce.getParameter(35738)&&(h!==Pe||!(z.isWebGL2||G.has("OES_texture_float")||G.has("WEBGL_color_buffer_float")))&&!d)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ce.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&ce.readPixels(t,n,r,i,se.convert(u),se.convert(h),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&ce.bindFramebuffer(36160,A)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),o=Math.floor(t.image.height*r),a=se.convert(t.format);q.setTexture2D(t,0),ce.copyTexImage2D(3553,n,a,e.x,e.y,i,o,0),j.unbindTexture()},this.copyTextureToTexture=function(e,t,n,r){void 0===r&&(r=0);var i=t.image.width,o=t.image.height,a=se.convert(n.format),s=se.convert(n.type);q.setTexture2D(n,0),ce.pixelStorei(37440,n.flipY),ce.pixelStorei(37441,n.premultiplyAlpha),ce.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?ce.texSubImage2D(3553,r,e.x,e.y,i,o,a,s,t.image.data):t.isCompressedTexture?ce.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,a,t.mipmaps[0].data):ce.texSubImage2D(3553,r,e.x,e.y,a,s,t.image),0===r&&n.generateMipmaps&&ce.generateMipmap(3553),j.unbindTexture()},this.initTexture=function(e){q.setTexture2D(e,0),j.unbindTexture()},this.resetState=function(){j.reset(),le.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function fl(e){pl.call(this,e)}Object.assign(ll.prototype,qn.prototype),Object.assign(cl.prototype,{constructor:cl,getHandSpace:function(){return null===this._hand&&(this._hand=new rl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new rl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new rl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(e,t,n){var r=null,i=null,o=null,a=this._targetRay,s=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(l&&e.hand){o=!0;for(var c,u=Wn(e.hand.values());!(c=u()).done;){var h=c.value,d=t.getJointPose(h,n);if(void 0===l.joints[h.jointName]){var p=new rl;p.matrixAutoUpdate=!1,p.visible=!1,l.joints[h.jointName]=p,l.add(p)}var f=l.joints[h.jointName];null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=d.radius),f.visible=null!==d}var m=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],g=m.position.distanceTo(v.position),y=.02,b=.005;l.inputState.pinching&&g>y+b?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&g<=y-b&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&null!==(r=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)),null!==s&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale));return null!==a&&(a.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==o),this}}),Object.assign(ul.prototype,qn.prototype),fl.prototype=Object.assign(Object.create(pl.prototype),{constructor:fl,isWebGL1Renderer:!0});var ml=function(){function e(e,t){Object.defineProperty(this,"isFogExp2",{value:!0}),this.name="",this.color=new Li(e),this.density=void 0!==t?t:25e-5}var t=e.prototype;return t.clone=function(){return new e(this.color,this.density)},t.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},e}(),vl=function(){function e(e,t,n){Object.defineProperty(this,"isFog",{value:!0}),this.name="",this.color=new Li(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}var t=e.prototype;return t.clone=function(){return new e(this.color,this.near,this.far)},t.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},e}(),gl=function(e){function t(){var t;return t=e.call(this)||this,Object.defineProperty(zn(t),"isScene",{value:!0}),t.type="Scene",t.background=null,t.environment=null,t.fog=null,t.overrideMaterial=null,t.autoUpdate=!0,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:zn(t)})),t}Gn(t,e);var n=t.prototype;return n.copy=function(t,n){return e.prototype.copy.call(this,t,n),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},n.toJSON=function(t){var n=e.prototype.toJSON.call(this,t);return null!==this.background&&(n.object.background=this.background.toJSON(t)),null!==this.environment&&(n.object.environment=this.environment.toJSON(t)),null!==this.fog&&(n.object.fog=this.fog.toJSON()),n},t}(si);function yl(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Tn,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Kn.generateUUID()}Object.defineProperty(yl.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(yl.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;re.far||t.push({distance:s,point:El.clone(),uv:xi.getUV(El,Ll,Rl,Pl,Dl,Ol,Il,new Jn),face:null,object:this})}},copy:function(e){return si.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});var kl=new lr,Nl=new lr;function Ul(){si.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}Ul.prototype=Object.assign(Object.create(si.prototype),{constructor:Ul,isLOD:!0,copy:function(e){si.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n0){var n,r;for(n=1,r=t.length;n0){kl.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(kl);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){kl.setFromMatrixPosition(e.matrixWorld),Nl.setFromMatrixPosition(this.matrixWorld);var n,r,i=kl.distanceTo(Nl)/e.zoom;for(t[0].object.visible=!0,n=1,r=t.length;n=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;na)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);be.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var A=0,w=p.count-1;Aa)){u.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(u);xe.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,o=r.length;i0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var lc=new lr,cc=new lr;function uc(e,t){sc.call(this,e,t),this.type="LineSegments"}function hc(e,t){sc.call(this,e,t),this.type="LineLoop"}function dc(e){Di.call(this),this.type="PointsMaterial",this.color=new Li(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}uc.prototype=Object.assign(Object.create(sc.prototype),{constructor:uc,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;ri.far)return;o.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:a})}}function bc(e,t,n,r,i,o,a,s,l){nr.call(this,e,t,n,r,i,o,a,s,l),this.format=void 0!==a?a:Ne,this.minFilter=void 0!==o?o:Ae,this.magFilter=void 0!==i?i:Ae,this.generateMipmaps=!1;var c=this;function u(){c.needsUpdate=!0,e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(u)}function Ac(e,t,n,r,i,o,a,s,l,c,u,h){nr.call(this,null,o,a,s,l,c,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function wc(e,t,n,r,i,o,a,s,l){nr.call(this,e,t,n,r,i,o,a,s,l),this.needsUpdate=!0}function xc(e,t,n,r,i,o,a,s,l,c){if((c=void 0!==c?c:je)!==je&&c!==Ve)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===je&&(n=Ce),void 0===n&&c===Ve&&(n=Fe),nr.call(this,null,r,i,o,a,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==a?a:me,this.minFilter=void 0!==s?s:me,this.flipY=!1,this.generateMipmaps=!1}gc.prototype=Object.assign(Object.create(si.prototype),{constructor:gc,isPoints:!0,copy:function(e){return si.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),mc.copy(n.boundingSphere),mc.applyMatrix4(r),mc.radius+=i,!1!==e.ray.intersectsSphere(mc)){pc.copy(r).invert(),fc.copy(e.ray).applyMatrix4(pc);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position;if(null!==s)for(var c=s.array,u=0,h=c.length;u0){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,o=r.length;i0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}),bc.prototype=Object.assign(Object.create(nr.prototype),{constructor:bc,clone:function(){return new this.constructor(this.image).copy(this)},isVideoTexture:!0,update:function(){var e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Ac.prototype=Object.create(nr.prototype),Ac.prototype.constructor=Ac,Ac.prototype.isCompressedTexture=!0,wc.prototype=Object.create(nr.prototype),wc.prototype.constructor=wc,wc.prototype.isCanvasTexture=!0,xc.prototype=Object.create(nr.prototype),xc.prototype.constructor=xc,xc.prototype.isDepthTexture=!0;var Ec=function(e){function t(t,n,r,i){var o;void 0===t&&(t=1),void 0===n&&(n=8),void 0===r&&(r=0),void 0===i&&(i=2*Math.PI),(o=e.call(this)||this).type="CircleGeometry",o.parameters={radius:t,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);var a=[],s=[],l=[],c=[],u=new lr,h=new Jn;s.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(var d=0,p=3;d<=n;d++,p+=3){var f=r+d/n*i;u.x=t*Math.cos(f),u.y=t*Math.sin(f),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[p]/t+1)/2,h.y=(s[p+1]/t+1)/2,c.push(h.x,h.y)}for(var m=1;m<=n;m++)a.push(m,m+1,0);return o.setIndex(a),o.setAttribute("position",new Wi(s,3)),o.setAttribute("normal",new Wi(l,3)),o.setAttribute("uv",new Wi(c,2)),o}return Gn(t,e),t}(ro),Mc=function(e){function t(t,n,r,i,o,a,s,l){var c;void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=8),void 0===o&&(o=1),void 0===a&&(a=!1),void 0===s&&(s=0),void 0===l&&(l=2*Math.PI),(c=e.call(this)||this).type="CylinderGeometry",c.parameters={radiusTop:t,radiusBottom:n,height:r,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:l};var u=zn(c);i=Math.floor(i),o=Math.floor(o);var h=[],d=[],p=[],f=[],m=0,v=[],g=r/2,y=0;function b(){for(var e=new lr,a=new lr,c=0,b=(n-t)/r,A=0;A<=o;A++){for(var w=[],x=A/o,E=x*(n-t)+t,M=0;M<=i;M++){var _=M/i,T=_*l+s,S=Math.sin(T),C=Math.cos(T);a.x=E*S,a.y=-x*r+g,a.z=E*C,d.push(a.x,a.y,a.z),e.set(S,b,C).normalize(),p.push(e.x,e.y,e.z),f.push(_,1-x),w.push(m++)}v.push(w)}for(var L=0;L0&&A(!0),n>0&&A(!1)),c.setIndex(h),c.setAttribute("position",new Wi(d,3)),c.setAttribute("normal",new Wi(p,3)),c.setAttribute("uv",new Wi(f,2)),c}return Gn(t,e),t}(ro),_c=function(e){function t(t,n,r,i,o,a,s){var l;return void 0===t&&(t=1),void 0===n&&(n=1),void 0===r&&(r=8),void 0===i&&(i=1),void 0===o&&(o=!1),void 0===a&&(a=0),void 0===s&&(s=2*Math.PI),(l=e.call(this,0,t,n,r,i,o,a,s)||this).type="ConeGeometry",l.parameters={radius:t,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},l}return Gn(t,e),t}(Mc),Tc=function(e){function t(t,n,r,i){var o;void 0===r&&(r=1),void 0===i&&(i=0),(o=e.call(this)||this).type="PolyhedronGeometry",o.parameters={vertices:t,indices:n,radius:r,detail:i};var a=[],s=[];function l(e){for(var t=new lr,r=new lr,i=new lr,o=0;o.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),r<.2&&(s[e+4]+=1))}}function p(e){a.push(e.x,e.y,e.z)}function f(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function m(){for(var e=new lr,t=new lr,n=new lr,r=new lr,i=new Jn,o=new Jn,l=new Jn,c=0,u=0;c80*n){r=o=e[0],i=a=e[1];for(var f=n;fo&&(o=s),l>a&&(a=l);c=0!==(c=Math.max(o-r,a-i))?1/c:0}return Fc(d,p,n,r,i,c),p}};function Ic(e,t,n,r,i){var o,a;if(i===uu(e,t,n,r)>0)for(o=t;o=t;o-=r)a=su(o,e[o],e[o+1],a);return a&&$c(a,a.next)&&(lu(a),a=a.next),a}function Bc(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!$c(r,r.next)&&0!==Jc(r.prev,r,r.next))r=r.next;else{if(lu(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function Fc(e,t,n,r,i,o,a){if(e){!a&&o&&qc(e,r,i,o);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,o?Nc(e,r,i,o):kc(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),lu(e),e=l.next,c=l.next;else if((e=l)===c){a?1===a?Fc(e=Uc(Bc(e),t,n),t,n,r,i,o,2):2===a&&Hc(e,t,n,r,i,o):Fc(Bc(e),t,n,r,i,o,1);break}}}function kc(e){var t=e.prev,n=e,r=e.next;if(Jc(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(Zc(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Jc(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Nc(e,t,n,r){var i=e.prev,o=e,a=e.next;if(Jc(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Yc(s,l,t,n,r),d=Yc(c,u,t,n,r),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Zc(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Jc(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Zc(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Jc(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&Zc(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Jc(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Zc(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Jc(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Uc(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;!$c(i,o)&&eu(i,r,r.next,o)&&iu(i,o)&&iu(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),lu(r),lu(r.next),r=e=o),r=r.next}while(r!==e);return Bc(r)}function Hc(e,t,n,r,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Kc(a,s)){var l=au(a,s);return a=Bc(a,a.next),l=Bc(l,l.next),Fc(a,t,n,r,i,o),void Fc(l,t,n,r,i,o)}s=s.next}a=a.next}while(a!==e)}function Gc(e,t,n,r){var i,o,a,s=[];for(i=0,o=t.length;i=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>a){if(a=s,s===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x=r.x&&r.x>=u&&i!==r.x&&Zc(on.x||r.x===n.x&&Wc(n,r)))&&(n=r,d=l)),r=r.next}while(r!==c);return n}function Wc(e,t){return Jc(e.prev,e,t.prev)<0&&Jc(t.next,e,e.next)<0}function qc(e,t,n,r){var i=e;do{null===i.z&&(i.z=Yc(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Xc(i)}function Xc(e){var t,n,r,i,o,a,s,l,c=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;t0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,c*=2}while(a>1);return e}function Yc(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Qc(e){var t=e,n=e;do{(t.x=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function Kc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ru(e,t)&&(iu(e,t)&&iu(t,e)&&ou(e,t)&&(Jc(e.prev,e,t.prev)||Jc(e,t.prev,t))||$c(e,t)&&Jc(e.prev,e,e.next)>0&&Jc(t.prev,t,t.next)>0)}function Jc(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function $c(e,t){return e.x===t.x&&e.y===t.y}function eu(e,t,n,r){var i=nu(Jc(e,t,n)),o=nu(Jc(e,t,r)),a=nu(Jc(n,r,e)),s=nu(Jc(n,r,t));return i!==o&&a!==s||!(0!==i||!tu(e,n,t))||!(0!==o||!tu(e,r,t))||!(0!==a||!tu(n,e,r))||!(0!==s||!tu(n,t,r))}function tu(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function nu(e){return e>0?1:e<0?-1:0}function ru(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&&eu(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function iu(e,t){return Jc(e.prev,e,e.next)<0?Jc(e,t,e.next)>=0&&Jc(e,e.prev,t)>=0:Jc(e,t,e.prev)<0||Jc(e,e.next,t)<0}function ou(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do{n.y>o!==n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}function au(e,t){var n=new cu(e.i,e.x,e.y),r=new cu(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function su(e,t,n,r){var i=new cu(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function lu(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 cu(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}function uu(e,t,n,r){for(var i=0,o=t,a=n-r;o2&&e[t-1].equals(e[0])&&e.pop()}function pu(e,t){for(var n=0;nNumber.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+a/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(a*c-s*l),g=(r=f+a*v-e.x)*r+(i=m+s*v-e.y)*i;if(g<=2)return new Jn(r,i);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?l>Number.EPSILON&&(y=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(r=-s,i=a,o=Math.sqrt(u)):(r=a,i=s,o=Math.sqrt(u/2))}return new Jn(r/o,i/o)}for(var k=[],N=0,U=L.length,H=U-1,G=N+1;N=0;ge--){for(var ye=ge/p,be=u*Math.cos(ye*Math.PI/2),Ae=h*Math.sin(ye*Math.PI/2)+d,we=0,xe=L.length;we=0;){var r=n,i=n-1;i<0&&(i=e.length-1);for(var o=0,a=s+2*p;o=0?(e(g-s,m,u),h.subVectors(c,u)):(e(g+s,m,u),h.subVectors(u,c)),m-s>=0?(e(g,m-s,u),d.subVectors(c,u)):(e(g,m+s,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),o.push(l.x,l.y,l.z),a.push(g,m)}for(var y=0;y0)&&f.push(T,S,L),(M!==r-1||c=r)){u.push(l.times[d]);for(var f=0;fo.tracks[v].times[0]&&(m=o.tracks[v].times[0]);for(var g=0;g=r.times[h]){var m=h*l+s,v=m+l-s;d=ju.arraySlice(r.values,m,v)}else{var g=r.createInterpolant(),y=s,b=l-s;g.evaluate(o),d=ju.arraySlice(g.resultBuffer,y,b)}"quaternion"===i&&(new sr).fromArray(d).normalize().conjugate().toArray(d);for(var A=a.times.length,w=0;w=i)break e;var s=t[1];e=(i=t[--n-1]))break t}o=n,n=0}for(;n>>1;et;)--o;if(++o,0!==i||o!==r){i>=o&&(i=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=ju.arraySlice(n,i,o),this.values=ju.arraySlice(this.values,i*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,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==i;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!==r&&ju.isTypedArray(r))for(var l=0,c=r.length;l!==c;++l){var u=r[l];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,u),e=!1;break}}return e},optimize:function(){for(var e=ju.arraySlice(this.times),t=ju.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===zt,i=e.length-1,o=1,a=1;a0){e[o]=e[i];for(var g=i*n,y=o*n,b=0;b!==n;++b)t[y+b]=t[g+b];++o}return o!==e.length?(this.times=ju.arraySlice(e,0,o),this.values=ju.arraySlice(t,0,o*n)):(this.times=e,this.values=t),this},clone:function(){var e=ju.arraySlice(this.times,0),t=ju.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Qu.prototype=Object.assign(Object.create(Yu.prototype),{constructor:Qu,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Ht,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Zu.prototype=Object.assign(Object.create(Yu.prototype),{constructor:Zu,ValueTypeName:"color"}),Ku.prototype=Object.assign(Object.create(Yu.prototype),{constructor:Ku,ValueTypeName:"number"}),Ju.prototype=Object.assign(Object.create(Vu.prototype),{constructor:Ju,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=(n-t)/(r-t),l=e*a,c=l+a;l!==c;l+=4)sr.slerpFlat(i,0,o,l-a,o,l,s);return i}}),$u.prototype=Object.assign(Object.create(Yu.prototype),{constructor:$u,ValueTypeName:"quaternion",DefaultInterpolation:Gt,InterpolantFactoryMethodLinear:function(e){return new Ju(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),eh.prototype=Object.assign(Object.create(Yu.prototype),{constructor:eh,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Ht,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),th.prototype=Object.assign(Object.create(Yu.prototype),{constructor:th,ValueTypeName:"vector"}),Object.assign(nh,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,o=n.length;i!==o;++i)t.push(ih(n[i]).scale(r));var a=new nh(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,o=n.length;i!==o;++i)t.push(Yu.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,o=[],a=0;a1){var c=l[1],u=r[c];u||(r[c]=u=[]),u.push(s)}}var h=[];for(var d in r)h.push(nh.CreateFromMorphTargetSequence(d,r[d],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var o=[],a=[];ju.flattenJSON(n,o,a,r),0!==o.length&&i.push(new e(t,o,a))}},r=[],i=e.name||"default",o=e.fps||30,a=e.blendMode,s=e.length||-1,l=e.hierarchy||[],c=0;c0||0===e.search(/^data\:image\/jpeg/);i.format=r?Ne:Ue,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}),Object.assign(gh.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=[],r=this.getPoint(0),i=0;n.push(0);for(var o=1;o<=e;o++)i+=(t=this.getPoint(o/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,o=r.length;n=t||e*r[o-1];for(var a,s=0,l=o-1;s<=l;)if((a=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(o-1);var c=r[i];return(i+(n-c)/(r[i+1]-c))/(o-1)},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var o=this.getPoint(r),a=this.getPoint(i),s=t||(o.isVector2?new Jn:new lr);return s.copy(a).sub(o).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){for(var n=new lr,r=[],i=[],o=[],a=new lr,s=new Fr,l=0;l<=e;l++){var c=l/e;r[l]=this.getTangentAt(c,new lr),r[l].normalize()}i[0]=new lr,o[0]=new lr;var u=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=u&&(u=h,n.set(1,0,0)),d<=u&&(u=d,n.set(0,1,0)),p<=u&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],a),o[0].crossVectors(r[0],i[0]);for(var f=1;f<=e;f++){if(i[f]=i[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(r[f-1],r[f]),a.length()>Number.EPSILON){a.normalize();var m=Math.acos(Kn.clamp(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(a,m))}o[f].crossVectors(r[f],i[f])}if(!0===t){var v=Math.acos(Kn.clamp(i[0].dot(i[e]),-1,1));v/=e,r[0].dot(a.crossVectors(i[0],i[e]))>0&&(v=-v);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],v*g)),o[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:o}},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}}),yh.prototype=Object.create(gh.prototype),yh.prototype.constructor=yh,yh.prototype.isEllipseCurve=!0,yh.prototype.getPoint=function(e,t){for(var n=t||new Jn,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,o=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/a)+1)*a:0===c&&l===a-1&&(l=a-2,c=1),this.closed||l>0?n=o[(l-1)%a]:(wh.subVectors(o[0],o[1]).add(o[0]),n=wh);var u=o[l%a],h=o[(l+1)%a];if(this.closed||l+2r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(Th(a,s.x,l.x,c.x,u.x),Th(a,s.y,l.y,c.y,u.y)),n},zh.prototype.copy=function(e){gh.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var i=n[r]-t,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}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,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){gh.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return Vh.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Vh.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Vh.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),qh.prototype=Object.assign(Object.create(Wh.prototype),{constructor:qh,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n0:r.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var i in e.uniforms){var o=e.uniforms[i];switch(r.uniforms[i]={},o.type){case"t":r.uniforms[i].value=n(o.value);break;case"c":r.uniforms[i].value=(new Li).setHex(o.value);break;case"v2":r.uniforms[i].value=(new Jn).fromArray(o.value);break;case"v3":r.uniforms[i].value=(new lr).fromArray(o.value);break;case"v4":r.uniforms[i].value=(new ir).fromArray(o.value);break;case"m3":r.uniforms[i].value=(new $n).fromArray(o.value);break;case"m4":r.uniforms[i].value=(new Fr).fromArray(o.value);break;default:r.uniforms[i].value=o.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var a in e.extensions)r.extensions[a]=e.extensions[a];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.matcap&&(r.matcap=n(e.matcap)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new Jn).fromArray(s)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(r.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(r.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(r.clearcoatNormalScale=(new Jn).fromArray(e.clearcoatNormalScale)),void 0!==e.transmission&&(r.transmission=e.transmission),void 0!==e.transmissionMap&&(r.transmissionMap=n(e.transmissionMap)),r},setTextures:function(e){return this.textures=e,this}});var ld={decodeText:function(t){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(t);for(var n="",r=0,i=t.length;r0){var s=new ah(t);(n=new ph(s)).setCrossOrigin(this.crossOrigin);for(var l=0,c=e.length;lNumber.EPSILON){if(c<0&&(a=t[o],l=-l,s=t[i],c=-c),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var u=c*(e.x-a.x)-l*(e.y-a.y);if(0===u)return!0;if(u<0)continue;r=!r}}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 r}var i,o,a,s=hu.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===t)return n(l);var c=[];if(1===l.length)return o=l[0],(a=new qh).curves=o.curves,c.push(a),c;var u=!s(l[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=l.length;g1){for(var b=!1,A=[],w=0,x=f.length;w0&&(b||(m=p))}for(var R=0,P=f.length;R0){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;e0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,o=r;i!==o;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n=.5)for(var o=0;o!==i;++o)e[t+o]=e[n+o]},_slerp:function(e,t,n,r){sr.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var o=this._workIndex*i;sr.multiplyQuaternionsFlat(e,o,e,t,e,n),sr.slerpFlat(e,t,e,t,e,o,r)},_lerp:function(e,t,n,r,i){for(var o=1-r,a=0;a!==i;++a){var s=t+a;e[s]=e[s]*o+e[n+a]*r}},_lerpAdditive:function(e,t,n,r,i){for(var o=0;o!==i;++o){var a=t+o;e[a]=e[a]+e[n+o]*r}}});var Wd="\\[\\]\\.:\\/",qd=new RegExp("["+Wd+"]","g"),Xd="[^"+Wd+"]",Yd="[^"+Wd.replace("\\.","")+"]",Qd=/((?:WC+[\/:])*)/.source.replace("WC",Xd),Zd=/(WCOD+)?/.source.replace("WCOD",Yd),Kd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Xd),Jd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Xd),$d=new RegExp("^"+Qd+Zd+Kd+Jd+"$"),ep=["material","materials","bones"];function tp(e,t,n){var r=n||np.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function np(e,t,n){this.path=t,this.parsedPath=n||np.parseTrackName(t),this.node=np.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function rp(){this.uuid=Kn.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 r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}Object.assign(tp.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(np,{Composite:tp,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new np.Composite(e,t,n):new np(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(qd,"")},parseTrackName:function(e){var t=$d.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==ep.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var r=function e(n){for(var r=0;r=i){var u=i++,h=e[u];t[h.uuid]=c,e[c]=h,t[l]=u,e[u]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=i},uncache:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,o=e.length,a=0,s=arguments.length;a!==s;++a){var l=arguments[a].uuid,c=t[l];if(void 0!==c)if(delete t[l],c0&&(t[A.uuid]=c),e[c]=A,e.pop();for(var w=0,x=r;w!==x;++w){var E=n[w];E[c]=E[b],E.pop()}}}this.nCachedObjects_=i},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var o=this._paths,a=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[e]=r,o.push(e),a.push(t),i.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new np(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];t[e[a]]=n,o[n]=s,o.pop(),i[n]=i[a],i.pop(),r[n]=r[a],r.pop()}}});var ip=function(){function e(e,t,n,r){void 0===n&&(n=null),void 0===r&&(r=t.blendMode),this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;for(var i=t.tracks,o=i.length,a=new Array(o),s={endingStart:jt,endingEnd:jt},l=0;l!==o;++l){var c=i[l].createInterpolant(null);a[l]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Nt,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}var t=e.prototype;return t.play=function(){return this._mixer._activateAction(this),this},t.stop=function(){return this._mixer._deactivateAction(this),this.reset()},t.reset=function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},t.isRunning=function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},t.isScheduled=function(){return this._mixer._isActiveAction(this)},t.startAt=function(e){return this._startTime=e,this},t.setLoop=function(e,t){return this.loop=e,this.repetitions=t,this},t.setEffectiveWeight=function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},t.getEffectiveWeight=function(){return this._effectiveWeight},t.fadeIn=function(e){return this._scheduleFading(e,0,1)},t.fadeOut=function(e){return this._scheduleFading(e,1,0)},t.crossFadeFrom=function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,o=i/r,a=r/i;e.warp(1,o,t),this.warp(a,1,t)}return this},t.crossFadeTo=function(e,t,n){return e.crossFadeFrom(this,t,n)},t.stopFading=function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},t.setEffectiveTimeScale=function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},t.getEffectiveTimeScale=function(){return this._effectiveTimeScale},t.setDuration=function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},t.syncWith=function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},t.halt=function(e){return this.warp(this._effectiveTimeScale,0,e)},t.warp=function(e,t,n){var r=this._mixer,i=r.time,o=this.timeScale,a=this._timeScaleInterpolant;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/o,l[1]=t/o,this},t.stopWarping=function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},t.getMixer=function(){return this._mixer},t.getClip=function(){return this._clip},t.getRoot=function(){return this._localRoot||this._mixer._root},t._update=function(e,t,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var o=(e-i)*n;if(o<0||0===n)return;this._startTime=null,t=n*o}t*=this._updateTimeScale(e);var a=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Xt:for(var u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulateAdditive(s);break;case qt:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(a),c[d].accumulate(r,s)}}}else this._updateWeight(e)},t._updateWeight=function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},t._updateTimeScale=function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;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},t._updateTime=function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,o=n===Ut;if(0===e)return-1===i?r:o&&1===(1&i)?t-r:r;if(n===kt){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),r>=t||r<0){var a=Math.floor(r/t);r-=t*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&1===(1&i))return t-r}return r},t._setEndings=function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Vt,r.endingEnd=Vt):(r.endingStart=e?this.zeroSlopeAtStart?Vt:jt:Wt,r.endingEnd=t?this.zeroSlopeAtEnd?Vt:jt:Wt)},t._scheduleFading=function(e,t,n){var r=this._mixer,i=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=i,s[0]=t,a[1]=i+e,s[1]=n,this},e}();function op(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}op.prototype=Object.assign(Object.create(qn.prototype),{constructor:op,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,o=e._propertyBindings,a=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=c[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 Vd(np.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,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,o=0,a=i.length;o!==a;++o){var s=i[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,r=t.length;n!==r;++n){var i=t[n];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}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&&t=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),o=this._accuIndex^=1,a=0;a!==n;++a)t[a]._update(r,e,i,o);for(var s=this._bindings,l=this._nActiveBindings,c=0;c!==l;++c)s[c].apply(o);return this},setTime:function(e){this.time=0;for(var t=0;tthis.max.x||e.ythis.max.y)},t.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},t.getParameter=function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Jn),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},t.intersectsBox=function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},t.clampPoint=function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Jn),t.copy(e).clamp(this.min,this.max)},t.distanceToPoint=function(e){return fp.copy(e).clamp(this.min,this.max).sub(e).length()},t.intersect=function(e){return this.min.max(e.min),this.max.min(e.max),this},t.union=function(e){return this.min.min(e.min),this.max.max(e.max),this},t.translate=function(e){return this.min.add(e),this.max.add(e),this},t.equals=function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},e}(),vp=new lr,gp=new lr,yp=function(){function e(e,t){this.start=void 0!==e?e:new lr,this.end=void 0!==t?t:new lr}var t=e.prototype;return t.set=function(e,t){return this.start.copy(e),this.end.copy(t),this},t.clone=function(){return(new this.constructor).copy(this)},t.copy=function(e){return this.start.copy(e.start),this.end.copy(e.end),this},t.getCenter=function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new lr),e.addVectors(this.start,this.end).multiplyScalar(.5)},t.delta=function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new lr),e.subVectors(this.end,this.start)},t.distanceSq=function(){return this.start.distanceToSquared(this.end)},t.distance=function(){return this.start.distanceTo(this.end)},t.at=function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new lr),this.delta(t).multiplyScalar(e).add(this.start)},t.closestPointToPointParameter=function(e,t){vp.subVectors(e,this.start),gp.subVectors(this.end,this.start);var n=gp.dot(gp),r=gp.dot(vp)/n;return t&&(r=Kn.clamp(r,0,1)),r},t.closestPointToPoint=function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new lr),this.delta(n).multiplyScalar(r).add(this.start)},t.applyMatrix4=function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},t.equals=function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},e}();function bp(e){si.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}bp.prototype=Object.create(si.prototype),bp.prototype.constructor=bp,bp.prototype.isImmediateRenderObject=!0;var Ap=new lr,wp=function(e){function t(t,n){var r;(r=e.call(this)||this).light=t,r.light.updateMatrixWorld(),r.matrix=t.matrixWorld,r.matrixAutoUpdate=!1,r.color=n;for(var i=new ro,o=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],a=0,s=1,l=32;a.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Qp.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Qp,t)}},n.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},n.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},n.copy=function(t){return e.prototype.copy.call(this,t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this},t}(si),Kp=function(e){function t(t){var n;void 0===t&&(t=1);var r=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],o=new ro;o.setAttribute("position",new Wi(r,3)),o.setAttribute("color",new Wi(i,3));var a=new tc({vertexColors:!0,toneMapped:!1});return(n=e.call(this,o,a)||this).type="AxesHelper",n}return Gn(t,e),t}(uc),Jp=new Float32Array(1),$p=new Int32Array(Jp.buffer),ef={toHalfFloat:function(e){Jp[0]=e;var t=$p[0],n=t>>16&32768,r=t>>12&2047,i=t>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&t):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}},tf=4,nf=8,rf=Math.pow(2,nf),of=[.125,.215,.35,.446,.526,.582],af=nf-tf+1+of.length,sf=20,lf=((Vp={})[Kt]=0,Vp[Jt]=1,Vp[en]=2,Vp[nn]=3,Vp[rn]=4,Vp[on]=5,Vp[$t]=6,Vp),cf=new Oi({side:v,depthWrite:!1,depthTest:!1}),uf=new xo(new _o,cf),hf=new ed,df=Mf(),pf=df._lodPlanes,ff=df._sizeLods,mf=df._sigmas,vf=new Li,gf=null,yf=(1+Math.sqrt(5))/2,bf=1/yf,Af=[new lr(1,1,1),new lr(-1,1,1),new lr(1,1,-1),new lr(-1,1,-1),new lr(0,yf,bf),new lr(0,yf,-bf),new lr(bf,0,yf),new lr(-bf,0,yf),new lr(yf,bf,0),new lr(-yf,bf,0)];function wf(e){var t=Math.max(e.r,e.g,e.b),n=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return e.multiplyScalar(Math.pow(2,-n)),(n+128)/255}var xf=function(){function e(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=Sf(sf),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}var t=e.prototype;return t.fromScene=function(e,t,n,r){void 0===t&&(t=0),void 0===n&&(n=.1),void 0===r&&(r=100),gf=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},t.fromEquirectangular=function(e){return this._fromTexture(e)},t.fromCubemap=function(e){return this._fromTexture(e)},t.compileCubemapShader=function(){null===this._cubemapShader&&(this._cubemapShader=Lf(),this._compileMaterial(this._cubemapShader))},t.compileEquirectangularShader=function(){null===this._equirectShader&&(this._equirectShader=Cf(),this._compileMaterial(this._equirectShader))},t.dispose=function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e2?rf:0,rf,rf),s.setRenderTarget(r),h&&s.render(uf,i),s.render(e,i)}s.toneMapping=u,s.outputEncoding=c,s.autoClear=l},t._textureToCubeUV=function(e,t){var n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Lf()):null==this._equirectShader&&(this._equirectShader=Cf());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new xo(pf[0],r),o=r.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=lf[e.encoding],o.outputEncoding.value=lf[t.texture.encoding],Tf(t,0,0,3*rf,2*rf),n.setRenderTarget(t),n.render(i,hf)},t._applyPMREM=function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;rsf&&console.warn("sigmaRadians, "+i+", is too large and will clip, as it requested "+m+" samples when the maximum is set to "+sf);for(var v=[],g=0,y=0;ynf-tf?r-nf+tf:0),3*x,2*x),s.setRenderTarget(t),s.render(u,hf)},e}();function Ef(e){return void 0!==e&&e.type===_e&&(e.encoding===Kt||e.encoding===Jt||e.encoding===$t)}function Mf(){for(var e=[],t=[],n=[],r=nf,i=0;inf-tf?a=of[i-nf+tf-1]:0==i&&(a=0),n.push(a);for(var s=1/(o-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=6,d=6,p=3,f=2,m=1,v=new Float32Array(p*d*h),g=new Float32Array(f*d*h),y=new Float32Array(m*d*h),b=0;b2?0:-1,x=[A,w,0,A+2/3,w,0,A+2/3,w+1,0,A,w,0,A+2/3,w+1,0,A,w+1,0];v.set(x,p*d*b),g.set(u,f*d*b);var E=[b,b,b,b,b,b];y.set(E,m*d*b)}var M=new ro;M.setAttribute("position",new Fi(v,p)),M.setAttribute("uv",new Fi(g,f)),M.setAttribute("faceIndex",new Fi(y,m)),e.push(M),r>tf&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function _f(e){var t=new or(3*rf,3*rf,e);return t.texture.mapping=ue,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Tf(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function Sf(e){return new Ou({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(e)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new lr(0,1,0)},inputEncoding:{value:lf[Kt]},outputEncoding:{value:lf[Kt]}},vertexShader:Rf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t"+Pf()+"\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:A,depthTest:!1,depthWrite:!1})}function Cf(){return new Ou({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new Jn(1,1)},inputEncoding:{value:lf[Kt]},outputEncoding:{value:lf[Kt]}},vertexShader:Rf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t"+Pf()+"\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:A,depthTest:!1,depthWrite:!1})}function Lf(){return new Ou({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:lf[Kt]},outputEncoding:{value:lf[Kt]}},vertexShader:Rf(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t"+Pf()+"\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:A,depthTest:!1,depthWrite:!1})}function Rf(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Pf(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Df(e,t,n,r,i,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Ri(e,t,n,i,o,a)}var Of=0,If=1,Bf=0,Ff=1,kf=2;function Nf(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function Uf(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 Hf(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new gc(e,t)}function Gf(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Bl(e)}function zf(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new gc(e,t)}function jf(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new dc(e)}function Vf(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new dc(e)}function Wf(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new dc(e)}function qf(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new lr(e,t,n)}function Xf(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Fi(e,t).setUsage(Sn)}function Yf(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new ki(e,t)}function Qf(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Ni(e,t)}function Zf(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Ui(e,t)}function Kf(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Hi(e,t)}function Jf(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Gi(e,t)}function $f(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new zi(e,t)}function em(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new ji(e,t)}function tm(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Wi(e,t)}function nm(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new qi(e,t)}function rm(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),_h.call(this,e),this.type="catmullrom",this.closed=!0}function im(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),_h.call(this,e),this.type="catmullrom"}function om(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),_h.call(this,e),this.type="catmullrom"}function am(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Kp(e)}function sm(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new qp(e,t)}function lm(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new uc(new Dc(e.geometry),new tc({color:void 0!==t?t:16777215}))}function cm(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new uc(new Ru(e.geometry),new tc({color:void 0!==t?t:16777215}))}function um(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new uh(e)}function hm(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new mh(e)}function dm(e,t,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new No(e,n)}gh.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(gh.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(Wh.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),rm.prototype=Object.create(_h.prototype),im.prototype=Object.create(_h.prototype),om.prototype=Object.create(_h.prototype),Object.assign(om.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Dp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},_p.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(lh.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ld.extractUrlBase(e)}}),lh.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(mp.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(hr.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Sr.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),zo.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},yp.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(Kn,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Kn.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Kn.ceilPowerOfTwo(e)}}),Object.assign($n.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},getInverse:function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()}}),Object.assign(Fr.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new lr).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,o)},getInverse:function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()}}),hi.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},Object.assign(sr.prototype,{multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},inverse:function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()}}),Object.assign(Br.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(xi.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(xi,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),xi.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),xi.getNormal(e,t,n,r)}}),Object.assign(qh.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new fu(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new xu(this,e)}}),Object.assign(Jn.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(lr.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(ir.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(si.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(si.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(xo.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(xo.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Yt},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Ul.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ql.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Wl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(gh.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),Oo.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Xh.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Fi.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Sn},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Sn)}}}),Object.assign(Fi.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Sn:Tn),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(ro.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Fi(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(ro.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(cd.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(cp.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(yl.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===Sn},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(yl.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Sn:Tn),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(fu.prototype,{getArrays:function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")}}),Object.assign(gl.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}}),Object.defineProperties(ap.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Di.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Li}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(Fu.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Bu.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(e){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=e}}}),Object.defineProperties(Po.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(pl.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(pl.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?Jt:Kt}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties($s.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(or.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(kd.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Md).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),jd.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Fo.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Fo.prototype.clear=function(e,t,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,r)};var pm={merge:function(e,t,n){var r;console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),r=t.matrix,t=t.geometry),e.merge(t,r,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};function fm(){console.error("THREE.CanvasRenderer has been removed")}function mm(){console.error("THREE.JSONLoader has been removed.")}er.crossOrigin=void 0,er.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new vh;i.setCrossOrigin(this.crossOrigin);var o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},er.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new fh;i.setCrossOrigin(this.crossOrigin);var o=i.load(e,n,void 0,r);return t&&(o.mapping=t),o},er.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},er.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var vm={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function gm(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:i}})),"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=i),t.ACESFilmicToneMapping=re,t.AddEquation=T,t.AddOperation=J,t.AdditiveAnimationBlendMode=Xt,t.AdditiveBlending=x,t.AlphaFormat=ke,t.AlwaysDepth=j,t.AlwaysStencilFunc=_n,t.AmbientLight=rd,t.AmbientLightProbe=Td,t.AnimationClip=nh,t.AnimationLoader=hh,t.AnimationMixer=op,t.AnimationObjectGroup=rp,t.AnimationUtils=ju,t.ArcCurve=bh,t.ArrayCamera=il,t.ArrowHelper=Zp,t.Audio=kd,t.AudioAnalyser=jd,t.AudioContext=Ed,t.AudioListener=Fd,t.AudioLoader=Md,t.AxesHelper=Kp,t.AxisHelper=am,t.BackSide=v,t.BasicDepthPacking=an,t.BasicShadowMap=h,t.BinaryTextureLoader=hm,t.Bone=ql,t.BooleanKeyframeTrack=Qu,t.BoundingBoxHelper=sm,t.Box2=mp,t.Box3=hr,t.Box3Helper=Xp,t.BoxBufferGeometry=_o,t.BoxGeometry=_o,t.BoxHelper=qp,t.BufferAttribute=Fi,t.BufferGeometry=ro,t.BufferGeometryLoader=hd,t.ByteType=Te,t.Cache=oh,t.Camera=Do,t.CameraHelper=Hp,t.CanvasRenderer=fm,t.CanvasTexture=wc,t.CatmullRomCurve3=_h,t.CineonToneMapping=ne,t.CircleBufferGeometry=Ec,t.CircleGeometry=Ec,t.ClampToEdgeWrapping=pe,t.Clock=Rd,t.ClosedSplineCurve3=rm,t.Color=Li,t.ColorKeyframeTrack=Zu,t.CompressedTexture=Ac,t.CompressedTextureLoader=dh,t.ConeBufferGeometry=_c,t.ConeGeometry=_c,t.CubeCamera=Fo,t.CubeReflectionMapping=ae,t.CubeRefractionMapping=se,t.CubeTexture=ko,t.CubeTextureLoader=fh,t.CubeUVReflectionMapping=ue,t.CubeUVRefractionMapping=he,t.CubicBezierCurve=Fh,t.CubicBezierCurve3=kh,t.CubicInterpolant=Wu,t.CullFaceBack=l,t.CullFaceFront=c,t.CullFaceFrontBack=u,t.CullFaceNone=s,t.Curve=gh,t.CurvePath=Vh,t.CustomBlending=_,t.CustomToneMapping=ie,t.CylinderBufferGeometry=Mc,t.CylinderGeometry=Mc,t.Cylindrical=pp,t.DataTexture=Uo,t.DataTexture2DArray=ca,t.DataTexture3D=ua,t.DataTextureLoader=mh,t.DataUtils=ef,t.DecrementStencilOp=fn,t.DecrementWrapStencilOp=vn,t.DefaultLoadingManager=sh,t.DepthFormat=je,t.DepthStencilFormat=Ve,t.DepthTexture=xc,t.DirectionalLight=nd,t.DirectionalLightHelper=kp,t.DiscreteInterpolant=Xu,t.DodecahedronBufferGeometry=Sc,t.DodecahedronGeometry=Sc,t.DoubleSide=g,t.DstAlphaFactor=k,t.DstColorFactor=U,t.DynamicBufferAttribute=Xf,t.DynamicCopyUsage=On,t.DynamicDrawUsage=Sn,t.DynamicReadUsage=Rn,t.EdgesGeometry=Dc,t.EdgesHelper=lm,t.EllipseCurve=yh,t.EqualDepth=q,t.EqualStencilFunc=An,t.EquirectangularReflectionMapping=le,t.EquirectangularRefractionMapping=ce,t.Euler=Vr,t.EventDispatcher=qn,t.ExtrudeBufferGeometry=fu,t.ExtrudeGeometry=fu,t.Face3=Ri,t.Face4=Df,t.FaceColors=Ff,t.FileLoader=uh,t.FlatShading=y,t.Float16BufferAttribute=Vi,t.Float32Attribute=tm,t.Float32BufferAttribute=Wi,t.Float64Attribute=nm,t.Float64BufferAttribute=qi,t.FloatType=Pe,t.Fog=vl,t.FogExp2=ml,t.Font=bd,t.FontLoader=xd,t.FrontSide=m,t.Frustum=zo,t.GLBufferAttribute=lp,t.GLSL1=Bn,t.GLSL3=Fn,t.GammaEncoding=$t,t.GeometryUtils=pm,t.GreaterDepth=Y,t.GreaterEqualDepth=X,t.GreaterEqualStencilFunc=Mn,t.GreaterStencilFunc=xn,t.GridHelper=Dp,t.Group=rl,t.HalfFloatType=De,t.HemisphereLight=Yh,t.HemisphereLightHelper=Pp,t.HemisphereLightProbe=_d,t.IcosahedronBufferGeometry=gu,t.IcosahedronGeometry=gu,t.ImageBitmapLoader=vd,t.ImageLoader=ph,t.ImageUtils=er,t.ImmediateRenderObject=bp,t.IncrementStencilOp=pn,t.IncrementWrapStencilOp=mn,t.InstancedBufferAttribute=ud,t.InstancedBufferGeometry=cd,t.InstancedInterleavedBuffer=sp,t.InstancedMesh=ec,t.Int16Attribute=Kf,t.Int16BufferAttribute=Hi,t.Int32Attribute=$f,t.Int32BufferAttribute=zi,t.Int8Attribute=Yf,t.Int8BufferAttribute=ki,t.IntType=Le,t.InterleavedBuffer=yl,t.InterleavedBufferAttribute=wl,t.Interpolant=Vu,t.InterpolateDiscrete=Ht,t.InterpolateLinear=Gt,t.InterpolateSmooth=zt,t.InvertStencilOp=gn,t.JSONLoader=mm,t.KeepStencilOp=hn,t.KeyframeTrack=Yu,t.LOD=Ul,t.LatheBufferGeometry=yu,t.LatheGeometry=yu,t.Layers=Xr,t.LensFlare=gm,t.LessDepth=V,t.LessEqualDepth=W,t.LessEqualStencilFunc=wn,t.LessStencilFunc=bn,t.Light=Xh,t.LightProbe=ad,t.Line=sc,t.Line3=yp,t.LineBasicMaterial=tc,t.LineCurve=Nh,t.LineCurve3=Uh,t.LineDashedMaterial=Gu,t.LineLoop=hc,t.LinePieces=If,t.LineSegments=uc,t.LineStrip=Of,t.LinearEncoding=Kt,t.LinearFilter=Ae,t.LinearInterpolant=qu,t.LinearMipMapLinearFilter=Me,t.LinearMipMapNearestFilter=xe,t.LinearMipmapLinearFilter=Ee,t.LinearMipmapNearestFilter=we,t.LinearToneMapping=ee,t.Loader=lh,t.LoaderUtils=ld,t.LoadingManager=ah,t.LogLuvEncoding=tn,t.LoopOnce=kt,t.LoopPingPong=Ut,t.LoopRepeat=Nt,t.LuminanceAlphaFormat=Ge,t.LuminanceFormat=He,t.MOUSE=o,t.Material=Di,t.MaterialLoader=sd,t.Math=Kn,t.MathUtils=Kn,t.Matrix3=$n,t.Matrix4=Fr,t.MaxEquation=R,t.Mesh=xo,t.MeshBasicMaterial=Oi,t.MeshDepthMaterial=Qs,t.MeshDistanceMaterial=Zs,t.MeshFaceMaterial=Nf,t.MeshLambertMaterial=Uu,t.MeshMatcapMaterial=Hu,t.MeshNormalMaterial=Nu,t.MeshPhongMaterial=Fu,t.MeshPhysicalMaterial=Bu,t.MeshStandardMaterial=Iu,t.MeshToonMaterial=ku,t.MinEquation=L,t.MirroredRepeatWrapping=fe,t.MixOperation=K,t.MultiMaterial=Uf,t.MultiplyBlending=M,t.MultiplyOperation=Z,t.NearestFilter=me,t.NearestMipMapLinearFilter=be,t.NearestMipMapNearestFilter=ge,t.NearestMipmapLinearFilter=ye,t.NearestMipmapNearestFilter=ve,t.NeverDepth=z,t.NeverStencilFunc=yn,t.NoBlending=A,t.NoColors=Bf,t.NoToneMapping=$,t.NormalAnimationBlendMode=qt,t.NormalBlending=w,t.NotEqualDepth=Q,t.NotEqualStencilFunc=En,t.NumberKeyframeTrack=Ku,t.Object3D=si,t.ObjectLoader=dd,t.ObjectSpaceNormalMap=cn,t.OctahedronBufferGeometry=bu,t.OctahedronGeometry=bu,t.OneFactor=D,t.OneMinusDstAlphaFactor=N,t.OneMinusDstColorFactor=H,t.OneMinusSrcAlphaFactor=F,t.OneMinusSrcColorFactor=I,t.OrthographicCamera=ed,t.PCFShadowMap=d,t.PCFSoftShadowMap=p,t.PMREMGenerator=xf,t.ParametricBufferGeometry=Au,t.ParametricGeometry=Au,t.Particle=Gf,t.ParticleBasicMaterial=Vf,t.ParticleSystem=zf,t.ParticleSystemMaterial=Wf,t.Path=Wh,t.PerspectiveCamera=Oo,t.Plane=hi,t.PlaneBufferGeometry=Wo,t.PlaneGeometry=Wo,t.PlaneHelper=Yp,t.PointCloud=Hf,t.PointCloudMaterial=jf,t.PointLight=$h,t.PointLightHelper=Sp,t.Points=gc,t.PointsMaterial=dc,t.PolarGridHelper=Op,t.PolyhedronBufferGeometry=Tc,t.PolyhedronGeometry=Tc,t.PositionalAudio=zd,t.PropertyBinding=np,t.PropertyMixer=Vd,t.QuadraticBezierCurve=Hh,t.QuadraticBezierCurve3=Gh,t.Quaternion=sr,t.QuaternionKeyframeTrack=$u,t.QuaternionLinearInterpolant=Ju,t.REVISION=i,t.RGBADepthPacking=sn,t.RGBAFormat=Ue,t.RGBAIntegerFormat=Ze,t.RGBA_ASTC_10x10_Format=bt,t.RGBA_ASTC_10x5_Format=vt,t.RGBA_ASTC_10x6_Format=gt,t.RGBA_ASTC_10x8_Format=yt,t.RGBA_ASTC_12x10_Format=At,t.RGBA_ASTC_12x12_Format=wt,t.RGBA_ASTC_4x4_Format=lt,t.RGBA_ASTC_5x4_Format=ct,t.RGBA_ASTC_5x5_Format=ut,t.RGBA_ASTC_6x5_Format=ht,t.RGBA_ASTC_6x6_Format=dt,t.RGBA_ASTC_8x5_Format=pt,t.RGBA_ASTC_8x6_Format=ft,t.RGBA_ASTC_8x8_Format=mt,t.RGBA_BPTC_Format=xt,t.RGBA_ETC2_EAC_Format=st,t.RGBA_PVRTC_2BPPV1_Format=it,t.RGBA_PVRTC_4BPPV1_Format=rt,t.RGBA_S3TC_DXT1_Format=Je,t.RGBA_S3TC_DXT3_Format=$e,t.RGBA_S3TC_DXT5_Format=et,t.RGBDEncoding=on,t.RGBEEncoding=en,t.RGBEFormat=ze,t.RGBFormat=Ne,t.RGBIntegerFormat=Qe,t.RGBM16Encoding=rn,t.RGBM7Encoding=nn,t.RGB_ETC1_Format=ot,t.RGB_ETC2_Format=at,t.RGB_PVRTC_2BPPV1_Format=nt,t.RGB_PVRTC_4BPPV1_Format=tt,t.RGB_S3TC_DXT1_Format=Ke,t.RGFormat=Xe,t.RGIntegerFormat=Ye,t.RawShaderMaterial=Ou,t.Ray=Br,t.Raycaster=cp,t.RectAreaLight=id,t.RedFormat=We,t.RedIntegerFormat=qe,t.ReinhardToneMapping=te,t.RepeatWrapping=de,t.ReplaceStencilOp=dn,t.ReverseSubtractEquation=C,t.RingBufferGeometry=wu,t.RingGeometry=wu,t.SRGB8_ALPHA8_ASTC_10x10_Format=It,t.SRGB8_ALPHA8_ASTC_10x5_Format=Pt,t.SRGB8_ALPHA8_ASTC_10x6_Format=Dt,t.SRGB8_ALPHA8_ASTC_10x8_Format=Ot,t.SRGB8_ALPHA8_ASTC_12x10_Format=Bt,t.SRGB8_ALPHA8_ASTC_12x12_Format=Ft,t.SRGB8_ALPHA8_ASTC_4x4_Format=Et,t.SRGB8_ALPHA8_ASTC_5x4_Format=Mt,t.SRGB8_ALPHA8_ASTC_5x5_Format=_t,t.SRGB8_ALPHA8_ASTC_6x5_Format=Tt,t.SRGB8_ALPHA8_ASTC_6x6_Format=St,t.SRGB8_ALPHA8_ASTC_8x5_Format=Ct,t.SRGB8_ALPHA8_ASTC_8x6_Format=Lt,t.SRGB8_ALPHA8_ASTC_8x8_Format=Rt,t.Scene=gl,t.SceneUtils=vm,t.ShaderChunk=qo,t.ShaderLib=Yo,t.ShaderMaterial=Po,t.ShadowMaterial=Du,t.Shape=qh,t.ShapeBufferGeometry=xu,t.ShapeGeometry=xu,t.ShapePath=gd,t.ShapeUtils=hu,t.ShortType=Se,t.Skeleton=Ql,t.SkeletonHelper=_p,t.SkinnedMesh=Wl,t.SmoothShading=b,t.Sphere=Sr,t.SphereBufferGeometry=Mu,t.SphereGeometry=Mu,t.Spherical=dp,t.SphericalHarmonics3=od,t.Spline=om,t.SplineCurve=zh,t.SplineCurve3=im,t.SpotLight=Kh,t.SpotLightHelper=wp,t.Sprite=Bl,t.SpriteMaterial=xl,t.SrcAlphaFactor=B,t.SrcAlphaSaturateFactor=G,t.SrcColorFactor=O,t.StaticCopyUsage=Dn,t.StaticDrawUsage=Tn,t.StaticReadUsage=Ln,t.StereoCamera=Ld,t.StreamCopyUsage=In,t.StreamDrawUsage=Cn,t.StreamReadUsage=Pn,t.StringKeyframeTrack=eh,t.SubtractEquation=S,t.SubtractiveBlending=E,t.TOUCH=a,t.TangentSpaceNormalMap=ln,t.TetrahedronBufferGeometry=_u,t.TetrahedronGeometry=_u,t.TextBufferGeometry=Tu,t.TextGeometry=Tu,t.Texture=nr,t.TextureLoader=vh,t.TorusBufferGeometry=Su,t.TorusGeometry=Su,t.TorusKnotBufferGeometry=Cu,t.TorusKnotGeometry=Cu,t.Triangle=xi,t.TriangleFanDrawMode=Zt,t.TriangleStripDrawMode=Qt,t.TrianglesDrawMode=Yt,t.TubeBufferGeometry=Lu,t.TubeGeometry=Lu,t.UVMapping=oe,t.Uint16Attribute=Jf,t.Uint16BufferAttribute=Gi,t.Uint32Attribute=em,t.Uint32BufferAttribute=ji,t.Uint8Attribute=Qf,t.Uint8BufferAttribute=Ni,t.Uint8ClampedAttribute=Zf,t.Uint8ClampedBufferAttribute=Ui,t.Uniform=ap,t.UniformsLib=Xo,t.UniformsUtils=Co,t.UnsignedByteType=_e,t.UnsignedInt248Type=Fe,t.UnsignedIntType=Re,t.UnsignedShort4444Type=Oe,t.UnsignedShort5551Type=Ie,t.UnsignedShort565Type=Be,t.UnsignedShortType=Ce,t.VSMShadowMap=f,t.Vector2=Jn,t.Vector3=lr,t.Vector4=ir,t.VectorKeyframeTrack=th,t.Vertex=qf,t.VertexColors=kf,t.VideoTexture=bc,t.WebGL1Renderer=fl,t.WebGLCubeRenderTarget=No,t.WebGLMultisampleRenderTarget=ar,t.WebGLRenderTarget=or,t.WebGLRenderTargetCube=dm,t.WebGLRenderer=pl,t.WebGLUtils=nl,t.WireframeGeometry=Ru,t.WireframeHelper=cm,t.WrapAroundEnding=Wt,t.XHRLoader=um,t.ZeroCurvatureEnding=jt,t.ZeroFactor=P,t.ZeroSlopeEnding=Vt,t.ZeroStencilOp=un,t.sRGBEncoding=Jt,Object.defineProperty(t,"__esModule",{value:!0})},"object"===typeof i&&"undefined"!==typeof r?a(i):"function"===typeof t&&t.amd?t(["exports"],a):a((o="undefined"!==typeof globalThis?globalThis:o||self).THREE={})},{}],58:[function(e,t,n){THREE.DRACOLoader=function(e){THREE.Loader.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}},THREE.DRACOLoader.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:THREE.DRACOLoader,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,n,r){var i=new THREE.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(e=>{var n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(r)}),n,r)},decodeDracoFile:function(e,t,n,r){var i={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)},decodeGeometry:function(e,t){for(var n in t.attributeTypes){var r=t.attributeTypes[n];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=r.name)}var i,o=JSON.stringify(t);if(THREE.DRACOLoader.taskCache.has(e)){var a=THREE.DRACOLoader.taskCache.get(e);if(a.key===o)return a.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(s,l).then((n=>(i=n,new Promise(((n,r)=>{i._callbacks[s]={resolve:n,reject:r},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{i&&s&&this._releaseTask(i,s)})),THREE.DRACOLoader.taskCache.set(e,{key:o,promise:c}),c},_createGeometry:function(e){var t=new THREE.BufferGeometry;e.index&&t.setIndex(new THREE.BufferAttribute(e.index.array,1));for(var n=0;n{n.load(e,t,void 0,r)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!==typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var r=THREE.DRACOLoader.DRACOWorker.toString(),i=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))})),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then((()=>{var n;return this.workerPool.lengtht._taskLoad?-1:1})),(n=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))},dispose:function(){for(var e=0;e{var t=e.draco,r=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(o),o.byteLength);try{var l=n(t,r,s,a),c=l.attributes.map((e=>e.array.buffer));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:l},c)}catch(u){console.error(u),self.postMessage({type:"error",id:i.id,error:u.message})}finally{t.destroy(s),t.destroy(r)}}))}}},THREE.DRACOLoader.taskCache=new WeakMap,THREE.DRACOLoader.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},THREE.DRACOLoader.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},THREE.DRACOLoader.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},THREE.DRACOLoader.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")}},{}],59:[function(t,n,r){THREE.GLTFLoader=function(){function t(e){THREE.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new s(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new l(e)})),this.register((function(e){return new o(e)})),this.register((function(e){return new h(e)}))}function n(){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={}}}}t.prototype=Object.assign(Object.create(THREE.Loader.prototype),{constructor:t,load:function(t,n,r,i){var o,a=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:THREE.LoaderUtils.extractUrlBase(t),this.manager.itemStart(t);var s=function(e){i?i(e):console.error(e),a.manager.itemError(t),a.manager.itemEnd(t)},l=new THREE.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(t,(function(r){try{a.parse(r,o,(function(e){n(e),a.manager.itemEnd(t)}),s)}catch(e){s(e)}}),r,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(e,t,n,o){var s,l={},c={};if("string"===typeof e)s=e;else if(THREE.LoaderUtils.decodeText(new Uint8Array(e,0,4))===d){try{l[r.KHR_BINARY_GLTF]=new m(e)}catch(x){return void(o&&o(x))}s=l[r.KHR_BINARY_GLTF].content}else s=THREE.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(s);if(void 0===u.asset||u.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var h=new U(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(var p=0;p=0&&void 0===c[y]&&console.warn('THREE.GLTFLoader: Unknown extension "'+y+'".')}}h.setExtensions(l),h.setPlugins(c),h.parse(n,o)}}});var r={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader");this.name=r.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.parser=e,this.name=r.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function a(){this.name=r.KHR_MATERIALS_UNLIT}function s(e){this.parser=e,this.name=r.KHR_MATERIALS_CLEARCOAT}function l(e){this.parser=e,this.name=r.KHR_MATERIALS_TRANSMISSION}function c(e){this.parser=e,this.name=r.KHR_TEXTURE_BASISU}function u(e){this.parser=e,this.name=r.EXT_TEXTURE_WEBP,this.isSupported=null}function h(e){this.name=r.EXT_MESHOPT_COMPRESSION,this.parser=e}o.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o,a)},u.prototype.loadTexture=function(e){var t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;var o=i.extensions[t],a=r.images[o.source],s=a.uri?n.options.manager.getHandler(a.uri):n.textureLoader;return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a,s);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))},u.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported},h.prototype.loadBufferView=function(e){var t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,o.ready]).then((function(e){var t=r.byteOffset||0,n=r.byteLength||0,i=r.count,a=r.byteStride,s=new ArrayBuffer(i*a),l=new Uint8Array(e[0],t,n);return o.decodeGltfBuffer(new Uint8Array(s),i,a,l,r.mode,r.filter),s}))}return null};var d="glTF",p=12,f={JSON:1313821514,BIN:5130562};function m(e){this.name=r.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,p);if(this.header={magic:THREE.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==d)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var n=this.header.length-p,i=new DataView(e,p),o=0;o",t).replace("#include ",n).replace("#include ",r).replace("#include ",i).replace("#include ",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(e){a.specular.value=e}},specularMap:{get:function(){return a.specularMap.value},set:function(e){a.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(e){a.glossiness.value=e}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(e){a.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function b(){return{name:r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return y},extendParams:function(e,t,n){var r=t.extensions[this.name];e.color=new THREE.Color(1,1,1),e.opacity=1;var i=[];if(Array.isArray(r.diffuseFactor)){var o=r.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(void 0!==r.diffuseTexture&&i.push(n.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new THREE.Color(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new THREE.Color(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var a=r.specularGlossinessTexture;i.push(n.assignTexture(e,"glossinessMap",a)),i.push(n.assignTexture(e,"specularMap",a))}return Promise.all(i)},createMaterial:function(e){var t=new y(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=THREE.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function A(){this.name=r.KHR_MESH_QUANTIZATION}function w(e,t,n,r){THREE.Interpolant.call(this,e,t,n,r)}v.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},s={},l={};for(var c in o){var u=S[c]||c.toLowerCase();a[u]=o[c]}for(c in e.attributes)if(u=S[c]||c.toLowerCase(),void 0!==o[c]){var h=n.accessors[e.attributes[c]],d=E[h.componentType];l[u]=d,s[u]=!0===h.normalized}return t.getDependency("bufferView",i).then((function(e){return new Promise((function(t){r.decodeDracoFile(e,(function(e){for(var n in e.attributes){var r=e.attributes[n],i=s[n];void 0!==i&&(r.normalized=i)}t(e)}),a,l)}))}))},g.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},y.prototype=Object.create(THREE.MeshStandardMaterial.prototype),y.prototype.constructor=y,y.prototype.copy=function(e){return THREE.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},w.prototype=Object.create(THREE.Interpolant.prototype),w.prototype.constructor=w,w.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,o=0;o!==r;o++)t[o]=n[i+o];return t},w.prototype.beforeStart_=w.prototype.copySampleValue_,w.prototype.afterEnd_=w.prototype.copySampleValue_,w.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,c=r-t,u=(n-t)/c,h=u*u,d=h*u,p=e*l,f=p-l,m=-2*d+3*h,v=d-h,g=1-m,y=v-h+u,b=0;b!==a;b++){var A=o[f+b+a],w=o[f+b+s]*c,x=o[p+b+a],E=o[p+b]*c;i[b]=g*A+y*w+m*x+v*E}return i};var x={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},E={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:THREE.NearestFilter,9729:THREE.LinearFilter,9984:THREE.NearestMipmapNearestFilter,9985:THREE.LinearMipmapNearestFilter,9986:THREE.NearestMipmapLinearFilter,9987:THREE.LinearMipmapLinearFilter},_={33071:THREE.ClampToEdgeWrapping,33648:THREE.MirroredRepeatWrapping,10497:THREE.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},S={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},L={CUBICSPLINE:void 0,LINEAR:THREE.InterpolateLinear,STEP:THREE.InterpolateDiscrete},R={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function P(e,t){return"string"!==typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function D(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new THREE.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:THREE.FrontSide})),e.DefaultMaterial}function O(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function I(e,t){void 0!==t.extras&&("object"===typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function B(e,t,n){for(var r=!1,i=!1,o=0,a=t.length;o=2&&o.setY(S,x[M*s+1]),s>=3&&o.setZ(S,x[M*s+2]),s>=4&&o.setW(S,x[M*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return o}))},U.prototype.loadTexture=function(e){var t,n,i=this,o=this.json,a=this.options,s=o.textures[e],l=s.extensions||{};return(t=l[r.MSFT_TEXTURE_DDS]?o.images[l[r.MSFT_TEXTURE_DDS].source]:o.images[s.source]).uri&&(n=a.manager.getHandler(t.uri)),n||(n=l[r.MSFT_TEXTURE_DDS]?i.extensions[r.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,n)},U.prototype.loadTextureImage=function(e,t,n){var r=this,i=this.json,o=this.options,a=i.textures[e],s=self.URL||self.webkitURL,l=t.uri,c=!1,u=!0;return"image/jpeg"===t.mimeType&&(u=!1),void 0!==t.bufferView&&(l=r.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var n=new DataView(e,25,1).getUint8(0,!1);u=6===n||4===n||3===n}c=!0;var r=new Blob([e],{type:t.mimeType});return l=s.createObjectURL(r)}))),Promise.resolve(l).then((function(e){return new Promise((function(t,r){var i=t;!0===n.isImageBitmapLoader&&(i=function(e){t(new THREE.CanvasTexture(e))}),n.load(P(e,o.path),i,void 0,r)}))})).then((function(t){!0===c&&s.revokeObjectURL(l),t.flipY=!1,a.name&&(t.name=a.name),u||(t.format=THREE.RGBFormat);var n=(i.samplers||{})[a.sampler]||{};return t.magFilter=M[n.magFilter]||THREE.LinearFilter,t.minFilter=M[n.minFilter]||THREE.LinearMipmapLinearFilter,t.wrapS=_[n.wrapS]||THREE.RepeatWrapping,t.wrapT=_[n.wrapT]||THREE.RepeatWrapping,r.associations.set(t,{type:"textures",index:e}),t}))},U.prototype.assignTexture=function(e,t,n){var i=this;return this.getDependency("texture",n.index).then((function(o){if(void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),i.extensions[r.KHR_TEXTURE_TRANSFORM]){var a=void 0!==n.extensions?n.extensions[r.KHR_TEXTURE_TRANSFORM]:void 0;if(a){var s=i.associations.get(o);o=i.extensions[r.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),i.associations.set(o,s)}}e[t]=o}))},U.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,r=void 0!==t.attributes.tangent,i=void 0!==t.attributes.color,o=void 0===t.attributes.normal,a=!0===e.isSkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&void 0!==t.morphAttributes.normal;if(e.isPoints){var c="PointsMaterial:"+n.uuid,u=this.cache.get(c);u||(u=new THREE.PointsMaterial,THREE.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(c,u)),n=u}else if(e.isLine){c="LineBasicMaterial:"+n.uuid;var h=this.cache.get(c);h||(h=new THREE.LineBasicMaterial,THREE.Material.prototype.copy.call(h,n),h.color.copy(n.color),this.cache.add(c,h)),n=h}if(r||i||o||a||s){c="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),a&&(c+="skinning:"),r&&(c+="vertex-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:"),s&&(c+="morph-targets:"),l&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=n.clone(),a&&(d.skinning=!0),i&&(d.vertexColors=!0),o&&(d.flatShading=!0),s&&(d.morphTargets=!0),l&&(d.morphNormals=!0),r&&(d.vertexTangents=!0,n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.add(c,d),this.associations.set(d,this.associations.get(n))),n=d}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=n},U.prototype.getMaterialType=function(){return THREE.MeshStandardMaterial},U.prototype.loadMaterial=function(e){var t,n=this,i=this.json,o=this.extensions,a=i.materials[e],s={},l=a.extensions||{},c=[];if(l[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=o[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),c.push(u.extendParams(s,a,n))}else if(l[r.KHR_MATERIALS_UNLIT]){var h=o[r.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),c.push(h.extendParams(s,a,n))}else{var d=a.pbrMetallicRoughness||{};if(s.color=new THREE.Color(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var p=d.baseColorFactor;s.color.fromArray(p),s.opacity=p[3]}void 0!==d.baseColorTexture&&c.push(n.assignTexture(s,"map",d.baseColorTexture)),s.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,s.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(n.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),c.push(n.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))}!0===a.doubleSided&&(s.side=THREE.DoubleSide);var f=a.alphaMode||R.OPAQUE;return f===R.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,f===R.MASK&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==THREE.MeshBasicMaterial&&(c.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new THREE.Vector2(1,-1),void 0!==a.normalTexture.scale&&s.normalScale.set(a.normalTexture.scale,-a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==THREE.MeshBasicMaterial&&(c.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==THREE.MeshBasicMaterial&&(s.emissive=(new THREE.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==THREE.MeshBasicMaterial&&c.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture)),Promise.all(c).then((function(){var i;return i=t===y?o[r.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s),a.name&&(i.name=a.name),i.map&&(i.map.encoding=THREE.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=THREE.sRGBEncoding),I(i,a),n.associations.set(i,{type:"materials",index:e}),a.extensions&&O(o,i,a),i}))},U.prototype.createUniqueName=function(e){for(var t=THREE.PropertyBinding.sanitizeNodeName(e||""),n=t,r=1;this.nodeNamesUsed[n];++r)n=t+"_"+r;return this.nodeNamesUsed[n]=!0,n},U.prototype.loadGeometries=function(e){var t=this,n=this.extensions,i=this.primitiveCache;function o(e){return n[r.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return G(n,e,t)}))}for(var a=[],s=0,l=e.length;s0&&F(h,i),h.name=t.createUniqueName(i.name||"mesh_"+e),I(h,i),p.extensions&&O(r,h,p),t.assignFinalMaterial(h),l.push(h)}if(1===l.length)return l[0];var m=new THREE.Group;for(c=0,u=l.length;c1?new THREE.Group:1===t.length?t[0]:new THREE.Object3D)!==t[0])for(var s=0,l=t.length;s=0?s.substring(0,l):s;c=c.toLowerCase();var u=l>=0?s.substring(l+1):"";if(u=u.trim(),"newmtl"===c)r={name:u},o[u]=r;else if("ka"===c||"kd"===c||"ks"===c||"ke"===c){var h=u.split(i,3);r[c]=[parseFloat(h[0]),parseFloat(h[1]),parseFloat(h[2])]}else r[c]=u}}var d=new THREE.MTLLoader.MaterialCreator(this.resourcePath||t,this.materialOptions);return d.setCrossOrigin(this.crossOrigin),d.setManager(this.manager),d.setMaterials(o),d}}),THREE.MTLLoader.MaterialCreator=function(e,t){this.baseUrl=e||"",this.options=t,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.side=this.options&&this.options.side?this.options.side:THREE.FrontSide,this.wrap=this.options&&this.options.wrap?this.options.wrap:THREE.RepeatWrapping},THREE.MTLLoader.MaterialCreator.prototype={constructor:THREE.MTLLoader.MaterialCreator,crossOrigin:"anonymous",setCrossOrigin:function(e){return this.crossOrigin=e,this},setManager:function(e){this.manager=e},setMaterials:function(e){this.materialsInfo=this.convert(e),this.materials={},this.materialsArray=[],this.nameLookup={}},convert:function(e){if(!this.options)return e;var t={};for(var n in e){var r=e[n],i={};for(var o in t[n]=i,r){var a=!0,s=r[o],l=o.toLowerCase();switch(l){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(s=[s[0]/255,s[1]/255,s[2]/255]),this.options&&this.options.ignoreZeroRGBs&&0===s[0]&&0===s[1]&&0===s[2]&&(a=!1)}a&&(i[l]=s)}}return t},preload:function(){for(var e in this.materialsInfo)this.create(e)},getIndex:function(e){return this.nameLookup[e]},getAsArray:function(){var e=0;for(var t in this.materialsInfo)this.materialsArray[e]=this.create(t),this.nameLookup[t]=e,e++;return this.materialsArray},create:function(e){return void 0===this.materials[e]&&this.createMaterial_(e),this.materials[e]},createMaterial_:function(e){var t=this,n=this.materialsInfo[e],r={name:e,side:this.side};function i(e,t){return"string"!==typeof t||""===t?"":/^https?:\/\//i.test(t)?t:e+t}function o(e,n){if(!r[e]){var o=t.getTextureParams(n,r),a=t.loadTexture(i(t.baseUrl,o.url));a.repeat.copy(o.scale),a.offset.copy(o.offset),a.wrapS=t.wrap,a.wrapT=t.wrap,r[e]=a}}for(var a in n){var s,l=n[a];if(""!==l)switch(a.toLowerCase()){case"kd":r.color=(new THREE.Color).fromArray(l);break;case"ks":r.specular=(new THREE.Color).fromArray(l);break;case"ke":r.emissive=(new THREE.Color).fromArray(l);break;case"map_kd":o("map",l);break;case"map_ks":o("specularMap",l);break;case"map_ke":o("emissiveMap",l);break;case"norm":o("normalMap",l);break;case"map_bump":case"bump":o("bumpMap",l);break;case"map_d":o("alphaMap",l),r.transparent=!0;break;case"ns":r.shininess=parseFloat(l);break;case"d":(s=parseFloat(l))<1&&(r.opacity=s,r.transparent=!0);break;case"tr":s=parseFloat(l),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(r.opacity=1-s,r.transparent=!0)}}return this.materials[e]=new THREE.MeshPhongMaterial(r),this.materials[e]},getTextureParams:function(e,t){var n,r={scale:new THREE.Vector2(1,1),offset:new THREE.Vector2(0,0)},i=e.split(/\s+/);return(n=i.indexOf("-bm"))>=0&&(t.bumpScale=parseFloat(i[n+1]),i.splice(n,2)),(n=i.indexOf("-s"))>=0&&(r.scale.set(parseFloat(i[n+1]),parseFloat(i[n+2])),i.splice(n,4)),(n=i.indexOf("-o"))>=0&&(r.offset.set(parseFloat(i[n+1]),parseFloat(i[n+2])),i.splice(n,4)),r.url=i.join(" ").trim(),r},loadTexture:function(e,t,n,r,i){var o,a=void 0!==this.manager?this.manager:THREE.DefaultLoadingManager,s=a.getHandler(e);return null===s&&(s=new THREE.TextureLoader(a)),s.setCrossOrigin&&s.setCrossOrigin(this.crossOrigin),o=s.load(e,n,r,i),void 0!==t&&(o.mapping=t),o}}},{}],61:[function(t,n,r){THREE.OBJLoader=function(){var t=/^[og]\s*(.+)?/,n=/^mtllib /,r=/^usemtl /,i=/^usemap /,o=new THREE.Vector3,a=new THREE.Vector3,s=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;function u(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var n=this.object&&"function"===typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"===typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);var r={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"===typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(var n=this.materials.length-1;n>=0;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"===typeof n.clone){var r=n.clone(0);r.inherited=!0,this.object.materials.push(r)}this.objects.push(this.object)},finalize:function(){this.object&&"function"===typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){var n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){var n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){var r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){var r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){var r=this.vertices,i=this.object.geometry.normals;o.fromArray(r,e),a.fromArray(r,t),s.fromArray(r,n),c.subVectors(s,a),l.subVectors(o,a),c.cross(l),c.normalize(),i.push(c.x,c.y,c.z),i.push(c.x,c.y,c.z),i.push(c.x,c.y,c.z)},addColor:function(e,t,n){var r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){var r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,o,a,s,l){var c=this.vertices.length,u=this.parseVertexIndex(e,c),h=this.parseVertexIndex(t,c),d=this.parseVertexIndex(n,c);if(this.addVertex(u,h,d),this.addColor(u,h,d),void 0!==a&&""!==a){var p=this.normals.length;u=this.parseNormalIndex(a,p),h=this.parseNormalIndex(s,p),d=this.parseNormalIndex(l,p),this.addNormal(u,h,d)}else this.addFaceNormal(u,h,d);if(void 0!==r&&""!==r){var f=this.uvs.length;u=this.parseUVIndex(r,f),h=this.parseUVIndex(i,f),d=this.parseUVIndex(o,f),this.addUV(u,h,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,n=0,r=e.length;n=7?o.colors.push(parseFloat(f[4]),parseFloat(f[5]),parseFloat(f[6])):o.colors.push(void 0,void 0,void 0);break;case"vn":o.normals.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));break;case"vt":o.uvs.push(parseFloat(f[1]),parseFloat(f[2]))}}else if("f"===l){for(var m=s.substr(1).trim().split(/\s+/),v=[],g=0,y=m.length;g0){var A=b.split("/");v.push(A)}}var w=v[0];for(g=1,y=v.length-1;g1){var D=c[1].trim().toLowerCase();o.object.smooth="0"!==D&&"off"!==D}else o.object.smooth=!0;(W=o.object.currentMaterial())&&(W.smooth=o.object.smooth)}else{if("\0"===s)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"')}o.finalize();var O=new THREE.Group;if(O.materialLibraries=[].concat(o.materialLibraries),!0===!(1===o.objects.length&&0===o.objects[0].geometry.vertices.length))for(d=0,p=o.objects.length;d0&&Q.setAttribute("normal",new THREE.Float32BufferAttribute(B.normals,3)),B.colors.length>0&&(U=!0,Q.setAttribute("color",new THREE.Float32BufferAttribute(B.colors,3))),!0===B.hasUVIndices&&Q.setAttribute("uv",new THREE.Float32BufferAttribute(B.uvs,2));for(var H,G=[],z=0,j=F.length;z1){for(z=0,j=F.length;z0){var Q;W=new THREE.PointsMaterial({size:1,sizeAttenuation:!1}),(Q=new THREE.BufferGeometry).setAttribute("position",new THREE.Float32BufferAttribute(o.vertices,3)),o.colors.length>0&&void 0!==o.colors[0]&&(Q.setAttribute("color",new THREE.Float32BufferAttribute(o.colors,3)),W.vertexColors=!0);var Z=new THREE.Points(Q,W);O.add(Z)}return O}}),h}()},{}],62:[function(e,t,n){THREE.BufferGeometryUtils={computeTangents:function(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")},mergeBufferGeometries:function(e,t){for(var n=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),o={},a={},s=e[0].morphTargetsRelative,l=new THREE.BufferGeometry,c=0,u=0;u[])));var f=Math.log10(1/t),m=Math.pow(10,f);for(d=0;d0}));this.visibleGlyphs=u;var h=l.positions(u),d=l.uvs(u,i,c,t),p=o({clockwise:!0,type:"uint16",count:u.length});if(a.index(this,p,1,"uint16"),a.attr(this,"position",h,2),a.attr(this,"uv",d,2),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var f=l.pages(u);a.attr(this,"page",f,1)}},h.prototype.computeBoundingSphere=function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);c.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')},h.prototype.computeBoundingBox=function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():c.computeBox(t,e)}},{"./lib/utils":64,"./lib/vertices":65,inherits:30,"layout-bmfont-text":36,"object-assign":39,"quad-indices":51,"three-buffer-vertex-data":66}],64:[function(e,t,n){var r=2,i={min:[0,0],max:[0,0]};function o(e){var t=e.length/r;i.min[0]=e[0],i.min[1]=e[1],i.max[0]=e[0],i.max[1]=e[1];for(var n=0;n=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n.setImmediate="function"===typeof t?t:function(e){var t=l++,r=!(arguments.length<2)&&a.call(arguments,1);return s[t]=!0,i((function(){s[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))})),t},n.clearImmediate="function"===typeof r?r:function(e){delete s[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":49,timers:67}],68:[function(e,n,i){(function(e){!function(e,r){"object"===typeof i&&"undefined"!==typeof n?n.exports=r():"function"===typeof t&&t.amd?t(r):e.WebVRPolyfill=r()}(this,(function(){"use strict";var t="undefined"!==typeof window?window:"undefined"!==typeof e?e:"undefined"!==typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t){return e(t={exports:{}},t.exports),t.exports}var i=function(){return/Android/i.test(navigator.userAgent)||/iPhone|iPad|iPod/i.test(navigator.userAgent)},o=function(e,t){for(var n=0,r=e.length;no)},y=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},b=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},A=function(e){if(c())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},w=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},x=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},E=function(e,t,n,r){var i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t),e.compileShader(i);var o=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(o,n),e.compileShader(o);var a=e.createProgram();for(var s in e.attachShader(a,i),e.attachShader(a,o),r)e.bindAttribLocation(a,r[s],s);return e.linkProgram(a),e.deleteShader(i),e.deleteShader(o),a},M=function(e,t){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),i="",o=0;o1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(e.w)},O=function(){var e={};return function(t,n){void 0===e[t]&&(console.warn("webvr-polyfill: "+n),e[t]=!0)}}(),I=function(e,t){O(e,e+" has been deprecated. This may not work on native WebVR displays. "+(t?"Please use "+t+" instead.":""))};function B(e,t,n){if(t){for(var r=[],i=null,o=0;oe.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),r.push(null,null);break}i||(i=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(l),r.push(e.getParameter(a),null);break;case e.ACTIVE_TEXTURE:i=e.getParameter(e.ACTIVE_TEXTURE),r.push(null);break;default:r.push(e.getParameter(a))}for(n(e),o=0;oe.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_2D,s);break;case e.TEXTURE_BINDING_CUBE_MAP:var l;if((l=t[++o])e.TEXTURE31)break;e.activeTexture(l),e.bindTexture(e.TEXTURE_CUBE_MAP,s);break;case e.VIEWPORT:e.viewport(s[0],s[1],s[2],s[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:s?e.enable(a):e.disable(a);break;default:console.log("No GL restore behavior for 0x"+a.toString(16))}i&&e.activeTexture(i)}}else n(e)}var F=B,k=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),N=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function U(e,t,n,r){this.gl=e,this.cardboardUI=t,this.bufferScale=n,this.dirtySubmitFrameBindings=r,this.ctxAttribs=e.getContextAttributes(),this.instanceExt=e.getExtension("ANGLE_instanced_arrays"),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,l()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=E(e,k,N,this.attribs),this.uniforms=M(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}U.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},U.prototype.onResize=function(){var e=this.gl,t=this,n=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];F(e,n,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)})),this.cardboardUI&&this.cardboardUI.onResize()},U.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,n=this.gl;l()||(t.width=y()*this.bufferScale,t.height=b()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(n){e.bufferWidth=n,e.realCanvasWidth.set.call(t,n),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(n){e.bufferHeight=n,e.realCanvasHeight.set.call(t,n),e.onResize()}})),this.lastBoundFramebuffer=n.getParameter(n.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(n.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,r){e.lastBoundFramebuffer=r||e.framebuffer,e.realBindFramebuffer.call(n,t,e.lastBoundFramebuffer)},this.cullFace=n.getParameter(n.CULL_FACE),this.depthTest=n.getParameter(n.DEPTH_TEST),this.blend=n.getParameter(n.BLEND),this.scissorTest=n.getParameter(n.SCISSOR_TEST),this.stencilTest=n.getParameter(n.STENCIL_TEST),n.enable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!0;break;case n.DEPTH_TEST:e.depthTest=!0;break;case n.BLEND:e.blend=!0;break;case n.SCISSOR_TEST:e.scissorTest=!0;break;case n.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(n,t)},n.disable=function(t){switch(t){case n.CULL_FACE:e.cullFace=!1;break;case n.DEPTH_TEST:e.depthTest=!1;break;case n.BLEND:e.blend=!1;break;case n.SCISSOR_TEST:e.scissorTest=!1;break;case n.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(n,t)},this.colorMask=n.getParameter(n.COLOR_WRITEMASK),n.colorMask=function(t,r,i,o){e.colorMask[0]=t,e.colorMask[1]=r,e.colorMask[2]=i,e.colorMask[3]=o,e.realColorMask.call(n,t,r,i,o)},this.clearColor=n.getParameter(n.COLOR_CLEAR_VALUE),n.clearColor=function(t,r,i,o){e.clearColor[0]=t,e.clearColor[1]=r,e.clearColor[2]=i,e.clearColor[3]=o,e.realClearColor.call(n,t,r,i,o)},this.viewport=n.getParameter(n.VIEWPORT),n.viewport=function(t,r,i,o){e.viewport[0]=t,e.viewport[1]=r,e.viewport[2]=i,e.viewport[3]=o,e.realViewport.call(n,t,r,i,o)},this.isPatched=!0,C(t)}},U.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;l()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout((function(){C(t)}),1)}},U.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},U.prototype.submitFrame=function(){var e=this.gl,t=this,n=[];if(this.dirtySubmitFrameBindings||n.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),F(e,n,(function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null);var n=0,r=0;t.instanceExt&&(n=e.getVertexAttrib(t.attribs.position,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),r=e.getVertexAttrib(t.attribs.texCoord,t.instanceExt.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||l())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),t.instanceExt&&(0!=n&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,0),0!=r&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,0)),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor),t.instanceExt&&(0!=n&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.position,n),0!=r&&t.instanceExt.vertexAttribDivisorANGLE(t.attribs.texCoord,r))})),l()){var r=e.canvas;r.width==t.bufferWidth&&r.height==t.bufferHeight||(t.bufferWidth=r.width,t.bufferHeight=r.height,t.onResize())}},U.prototype.updateDeviceInfo=function(e){var t=this.gl,n=this,r=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];F(t,r,(function(t){var r=n.computeMeshVertices_(n.meshWidth,n.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,n.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW),!n.indexCount){var i=n.computeMeshIndices_(n.meshWidth,n.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i,t.STATIC_DRAW),n.indexCount=i.length}}))},U.prototype.computeMeshVertices_=function(e,t,n){for(var r=new Float32Array(2*e*t*5),i=n.getLeftEyeVisibleTanAngles(),o=n.getLeftEyeNoLensTanAngles(),a=n.getLeftEyeVisibleScreenRect(o),l=0,c=0;c<2;c++){for(var u=0;ui-o&&r.clientXn.clientHeight-o?e(r):r.clientX1e-4;){var i=e-this.distort(n),o=n-i*((n-t)/(i-r));t=n,n=o,r=i}return n},$.prototype.distort=function(e){for(var t=e*e,n=0,r=0;r=1)return this.w=o,this.x=n,this.y=r,this.z=i,this;var s=Math.acos(a),l=Math.sqrt(1-a*a);if(Math.abs(l)<.001)return this.w=.5*(o+this.w),this.x=.5*(n+this.x),this.y=.5*(r+this.y),this.z=.5*(i+this.z),this;var c=Math.sin((1-t)*s)/l,u=Math.sin(t*s)/l;return this.w=o*c+this.w*u,this.x=n*c+this.x*u,this.y=r*c+this.y*u,this.z=i*c+this.z*u,this},setFromUnitVectors:function(){var e,t,n=1e-6;return function(r,i){return void 0===e&&(e=new ne),(t=r.dot(i)+1)Math.abs(r.z)?e.set(-r.y,r.x,0):e.set(0,-r.z,r.y)):e.crossVectors(r,i),this.x=e.x,this.y=e.y,this.z=e.z,this.w=t,this.normalize(),this}}()};var oe=new ie({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),ae=new ie({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),se={CardboardV1:new ce({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new ce({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};function le(e,t){this.viewer=se.CardboardV2,this.updateDeviceParams(e),this.distortion=new $(this.viewer.distortionCoefficients);for(var n=0;n=200&&n.status<=299?(r.dpdb=JSON.parse(n.response),r.recalculateDeviceParams_()):console.error("Error loading online DPDB!")})),n.send()}}function de(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function pe(e,t){this.set(e,t)}function fe(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new pe,this.currentGyroMeasurement=new pe,this.previousGyroMeasurement=new pe,l()?this.filterQ=new re(-1,0,0,1):this.filterQ=new re(1,0,0,1),this.previousFilterQ=new re,this.previousFilterQ.copy(this.filterQ),this.accelQ=new re,this.isOrientationInitialized=!1,this.estimatedGravity=new ne,this.measuredGravity=new ne,this.gyroIntegralQ=new re}function me(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new re,this.previousTimestampS=null,this.deltaQ=new re,this.outQ=new re}function ve(e,t,n,r){this.yawOnly=n,this.accelerometer=new ne,this.gyroscope=new ne,this.filter=new fe(e,r),this.posePredictor=new me(t,r),this.isFirefoxAndroid=h(),this.isIOS=l();var i=d();this.isDeviceMotionInRadians=!this.isIOS&&i&&i<66,this.isWithoutDeviceMotion=f()||p(),this.filterToWorldQ=new re,l()?this.filterToWorldQ.setFromAxisAngle(new ne(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new ne(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new re,this.worldToScreenQ=new re,this.originalPoseAdjustQ=new re,this.originalPoseAdjustQ.setFromAxisAngle(new ne(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),v()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new re,this.orientationOut_=new Float32Array(4),this.start()}he.prototype.getDeviceParams=function(){return this.deviceParams},he.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},he.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,n=y(),r=b();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var i=0;io?(O("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=r)):(this.accelerometer.set(-t.x,-t.y,-t.z),n&&(m()?this.gyroscope.set(-n.beta,n.alpha,n.gamma):this.gyroscope.set(n.alpha,n.beta,n.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addGyroMeasurement(this.gyroscope,r)),this.filter.addAccelMeasurement(this.accelerometer,r),void(this.previousTimestampS=r))},ve.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},ve.prototype.onMessage_=function(e){var t=e.data;t&&t.type&&"devicemotion"===t.type.toLowerCase()&&this.updateDeviceMotion_(t.deviceMotionEvent)},ve.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new ne(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new ne(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},ve.prototype.start=function(){this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),l()&&R()&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},ve.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var ge=60,ye=new ne(1,0,0),be=new ne(0,0,1),Ae=new re;Ae.setFromAxisAngle(ye,-Math.PI/2),Ae.multiply((new re).setFromAxisAngle(be,Math.PI/2));var we=function(){function t(n){e(this,t),this.config=n,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new re,this._outQ=new re,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this.init()}return n(t,[{key:"init",value:function(){var e=null;try{(e=new RelativeOrientationSensor({frequency:ge,referenceFrame:"screen"})).addEventListener("error",this._onSensorError)}catch(t){this.errors.push(t),"SecurityError"===t.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===t.name?this.useDeviceMotion():console.error(t)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start())}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new ve(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG),this.sensor&&(this.sensor.removeEventListener("reading",this._onSensorRead),this.sensor.removeEventListener("error",this._onSensorError),this.sensor=null)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(Ae),t.multiply(this._sensorQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error),this.useDeviceMotion()}},{key:"_onSensorRead",value:function(){}}]),t}(),xe="";function Ee(){this.loadIcon_();var e=document.createElement("div");(o=e.style).position="fixed",o.top=0,o.right=0,o.bottom=0,o.left=0,o.backgroundColor="gray",o.fontFamily="sans-serif",o.zIndex=1e6;var t=document.createElement("img");t.src=this.icon,(o=t.style).marginLeft="25%",o.marginTop="25%",o.width="50%",e.appendChild(t);var n=document.createElement("div");(o=n.style).textAlign="center",o.fontSize="16px",o.lineHeight="24px",o.margin="24px 25%",o.width="50%",n.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(n);var r=document.createElement("div");(o=r.style).backgroundColor="#CFD8DC",o.position="fixed",o.bottom=0,o.width="100%",o.height="48px",o.padding="14px 24px",o.boxSizing="border-box",o.color="#656A6B",e.appendChild(r);var i=document.createElement("div");i.style.float="left",i.innerHTML="No Cardboard viewer?";var o,a=document.createElement("a");a.href="https://www.google.com/get/cardboard/get-cardboard/",a.innerHTML="get one",a.target="_blank",(o=a.style).float="right",o.fontWeight=600,o.textTransform="uppercase",o.borderLeft="1px solid gray",o.paddingLeft="24px",o.textDecoration="none",o.color="#656A6B",r.appendChild(i),r.appendChild(a),this.overlay=e,this.text=n,this.hide()}Ee.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img").style;v()?(t.width="20%",t.marginLeft="40%",t.marginTop="3%"):(t.width="50%",t.marginLeft="25%",t.marginTop="25%")},Ee.prototype.hide=function(){this.overlay.style.display="none"},Ee.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},Ee.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},Ee.prototype.update=function(){this.disableShowTemporarily(),!v()&&T()?this.show():this.hide()},Ee.prototype.loadIcon_=function(){this.icon=a("image/svg+xml",xe)};var Me="CardboardV1",_e="WEBVR_CARDBOARD_VIEWER",Te="webvr-polyfill-viewer-selector";function Se(e){try{this.selectedKey=localStorage.getItem(_e)}catch(t){console.error("Failed to load viewer profile: %s",t)}this.selectedKey||(this.selectedKey=e||Me),this.dialog=this.createDialog_(le.Viewers),this.root=null,this.onChangeCallbacks_=[]}function Ce(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Le(e,t){return e(t={exports:{}},t.exports),t.exports}Se.prototype.show=function(e){this.root=e,e.appendChild(this.dialog),this.dialog.querySelector("#"+this.selectedKey).checked=!0,this.dialog.style.display="block"},Se.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},Se.prototype.getCurrentViewer=function(){return le.Viewers[this.selectedKey]},Se.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},Se.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},Se.prototype.fireOnChange_=function(e){for(var t=0;t.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return r(e,[{key:"enable",value:function(){a?(this.disable(),this.noSleepTimer=window.setInterval((function(){window.location.href="/",window.setTimeout(window.stop,0)}),15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){a?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=s},function(e,t,n){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])},e.exports=n()}))),Pe=1e3,De=[0,0,.5,1],Oe=[.5,0,.5,1],Ie=window.requestAnimationFrame,Be=window.cancelAnimationFrame;function Fe(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null}function ke(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return I("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function Ne(e){var t=!("wakelock"in(e=e||{}))||e.wakelock;this.isPolyfilled=!0,this.displayId=Pe++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return I("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new ke({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&T()&&(this.wakelock_=new Re)}Ne.prototype.getFrameData=function(e){return L(e,this._getPose(),this)},Ne.prototype.getPose=function(){return I("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},Ne.prototype.resetPose=function(){return I("VRDisplay.prototype.resetPose"),this._resetPose()},Ne.prototype.getImmediatePose=function(){return I("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},Ne.prototype.requestAnimationFrame=function(e){return Ie(e)},Ne.prototype.cancelAnimationFrame=function(e){return Be(e)},Ne.prototype.wrapForFullscreen=function(e){if(l())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var n=this.fullscreenElement_.parentElement;n.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),n.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var r=this;function i(){if(r.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];r.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}return i(),this.fullscreenWrapper_},Ne.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},Ne.prototype.requestPresent=function(e){var t=this.isPresenting,n=this;return e instanceof Array||(I("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise((function(r,i){if(n.capabilities.canPresent)if(0==e.length||e.length>n.capabilities.maxLayers)i(new Error("Invalid number of layers."));else{var o=e[0];if(o.source){var a=o.leftBounds||De,s=o.rightBounds||Oe;if(t){var u=n.layer_;u.source!==o.source&&(u.source=o.source);for(var h=0;h<4;h++)u.leftBounds[h]=a[h],u.rightBounds[h]=s[h];return n.wrapForFullscreen(n.layer_.source),n.updatePresent_(),void r()}if(n.layer_={predistorted:o.predistorted,source:o.source,leftBounds:a.slice(0),rightBounds:s.slice(0)},n.waitingForPresent_=!1,n.layer_&&n.layer_.source){var d=n.wrapForFullscreen(n.layer_.source),p=function(){var e=x();n.isPresenting=d===e,n.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch((function(e){console.error("screen.orientation.lock() failed due to",e.message)})),n.waitingForPresent_=!1,n.beginPresent_(),r()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),n.removeFullscreenWrapper(),n.disableWakeLock(),n.endPresent_(),n.removeFullscreenListeners_()),n.fireVRDisplayPresentChange_()},f=function(){n.waitingForPresent_&&(n.removeFullscreenWrapper(),n.removeFullscreenListeners_(),n.disableWakeLock(),n.waitingForPresent_=!1,n.isPresenting=!1,i(new Error("Unable to present.")))};n.addFullscreenListeners_(d,p,f),A(d)?(n.enableWakeLock(),n.waitingForPresent_=!0):(l()||c())&&(n.enableWakeLock(),n.isPresenting=!0,n.beginPresent_(),n.fireVRDisplayPresentChange_(),r())}n.waitingForPresent_||l()||(w(),i(new Error("Unable to present.")))}else r()}else i(new Error("VRDisplay is not capable of presenting."))}))},Ne.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise((function(n,r){e?(!w()&&l()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),c()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),n()):r(new Error("Was not presenting to VRDisplay."))}))},Ne.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},Ne.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},Ne.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},Ne.prototype.addFullscreenListeners_=function(e,t,n){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=n,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),n&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",n,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",n,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",n,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",n,!1))},Ne.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var n=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",n,!1),e.removeEventListener("webkitfullscreenerror",n,!1),document.removeEventListener("mozfullscreenerror",n,!1),e.removeEventListener("msfullscreenerror",n,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},Ne.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},Ne.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},Ne.prototype.beginPresent_=function(){},Ne.prototype.endPresent_=function(){},Ne.prototype.submitFrame=function(e){},Ne.prototype.getEyeParameters=function(e){return null};var Ue={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},He={LEFT:"left",RIGHT:"right"};function Ge(e){var t=S({},Ue);e=S(t,e||{}),Ne.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new ke({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new we(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new he(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new le(this.dpdb_.getDeviceParams(),e.ADDITIONAL_VIEWERS),this.viewerSelector_=new Se(e.DEFAULT_VIEWER),this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new Ee),l()&&window.addEventListener("resize",this.onResize_.bind(this))}return Ge.prototype=Object.create(Ne.prototype),Ge.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},Ge.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},Ge.prototype._getFieldOfView=function(e){var t;if(e==He.LEFT)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=He.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},Ge.prototype._getEyeOffset=function(e){var t;if(e==He.LEFT)t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=He.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0]}return t},Ge.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),n=this._getFieldOfView(e),r={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(r,"fieldOfView",{enumerable:!0,get:function(){return I("VRFieldOfView","VRFrameData's projection matrices"),n}}),r},Ge.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},Ge.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},Ge.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=y()*this.bufferScale_,e.canvas.height=b()*this.bufferScale_,this.cardboardUI_=new J(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new J(e)),this.distorter_=new U(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(v()&&T()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},Ge.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},Ge.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},Ge.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var n=t.canvas;n.width==this.lastWidth&&n.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=n.width,this.lastHeight=n.height,this.cardboardUI_.render()}},Ge.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},Ge.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t||(t=this.layer_.source.getContext("experimental-webgl")),t||(t=this.layer_.source.getContext("webgl2"));var n=["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"];t.canvas.setAttribute("style",n.join("; ")+";"),C(t.canvas)}},Ge.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},Ge.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},Ge.VRFrameData=Fe,Ge.VRDisplay=Ne,Ge},e.exports=r()}))),l="0.10.12",c={ADDITIONAL_VIEWERS:[],DEFAULT_VIEWER:"",PROVIDE_MOBILE_VRDISPLAY:!0,MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1};function u(e){this.config=a(a({},c),e),this.polyfillDisplays=[],this.enabled=!1,this.hasNative="getVRDisplays"in navigator,this.native={},this.native.getVRDisplays=navigator.getVRDisplays,this.native.VRFrameData=window.VRFrameData,this.native.VRDisplay=window.VRDisplay,(!this.hasNative||this.config.PROVIDE_MOBILE_VRDISPLAY&&i())&&(this.enable(),this.getVRDisplays().then((function(e){e&&e[0]&&e[0].fireVRDisplayConnect_&&e[0].fireVRDisplayConnect_()})))}u.prototype.getPolyfillDisplays=function(){if(this._polyfillDisplaysPopulated)return this.polyfillDisplays;if(i()){var e=new s({ADDITIONAL_VIEWERS:this.config.ADDITIONAL_VIEWERS,DEFAULT_VIEWER:this.config.DEFAULT_VIEWER,MOBILE_WAKE_LOCK:this.config.MOBILE_WAKE_LOCK,DEBUG:this.config.DEBUG,DPDB_URL:this.config.DPDB_URL,CARDBOARD_UI_DISABLED:this.config.CARDBOARD_UI_DISABLED,K_FILTER:this.config.K_FILTER,PREDICTION_TIME_S:this.config.PREDICTION_TIME_S,ROTATE_INSTRUCTIONS_DISABLED:this.config.ROTATE_INSTRUCTIONS_DISABLED,YAW_ONLY:this.config.YAW_ONLY,BUFFER_SCALE:this.config.BUFFER_SCALE,DIRTY_SUBMIT_FRAME_BINDINGS:this.config.DIRTY_SUBMIT_FRAME_BINDINGS});this.polyfillDisplays.push(e)}return this._polyfillDisplaysPopulated=!0,this.polyfillDisplays},u.prototype.enable=function(){if(this.enabled=!0,this.hasNative&&this.native.VRFrameData){var e=this.native.VRFrameData,t=new this.native.VRFrameData,n=this.native.VRDisplay.prototype.getFrameData;window.VRDisplay.prototype.getFrameData=function(r){r instanceof e?n.call(this,r):(n.call(this,t),r.pose=t.pose,o(t.leftProjectionMatrix,r.leftProjectionMatrix),o(t.rightProjectionMatrix,r.rightProjectionMatrix),o(t.leftViewMatrix,r.leftViewMatrix),o(t.rightViewMatrix,r.rightViewMatrix))}}navigator.getVRDisplays=this.getVRDisplays.bind(this),window.VRDisplay=s.VRDisplay,window.VRFrameData=s.VRFrameData},u.prototype.getVRDisplays=function(){var e=this;return this.config,this.hasNative?this.native.getVRDisplays.call(navigator).then((function(t){return t.length>0?t:e.getPolyfillDisplays()})):Promise.resolve(this.getPolyfillDisplays())},u.version=l,u.VRFrameData=s.VRFrameData,u.VRDisplay=s.VRDisplay;var h=Object.freeze({default:u}),d=h&&u||h;return"undefined"!==typeof t&&t.window&&(t.document||(t.document=t.window.document),t.navigator||(t.navigator=t.window.navigator)),d}))}).call(this,"undefined"!==typeof r.g?r.g:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],69:[function(e,t,n){var r=/\n/,i="\n",o=/\s/;function a(e,t,n,r){var i=e.indexOf(t,n);return-1===i||i>r?r:i}function s(e){return o.test(e)}function l(e,t,n,i,o){for(var a=[],s=n,l=n;ln&&!s(t.charAt(p));)p--;if(p===n)f>n+i.length&&f--,p=f;else for(f=p;p>n&&s(t.charAt(p-i.length));)p--}if(p>=n){var m=e(t,n,p,u);c.push(m)}n=f}return c}function u(e,t,n,r){return{start:t,end:t+Math.min(r,n-t)}}t.exports=function(e,n){return t.exports.lines(e,n).map((function(t){return e.substring(t.start,t.end)})).join("\n")},t.exports.lines=function(e,t){if(0===(t=t||{}).width&&"nowrap"!==t.mode)return[];e=e||"";var n="number"===typeof t.width?t.width:Number.MAX_VALUE,r=Math.max(0,t.start||0),i="number"===typeof t.end?t.end:e.length,o=t.mode,a=t.measure||u;return"pre"===o?l(a,e,r,i,n):c(a,e,r,i,n,o)}},{}],70:[function(t,n,r){"use strict";var i=t("global/window"),o=t("is-function"),a=t("parse-headers"),s=t("xtend");function l(e,t){for(var n=0;n0&&(m=setTimeout((function(){if(!d){d=!0,f.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",s(e)}}),t.timeout)),f.setRequestHeader)for(u in b)b.hasOwnProperty(u)&&f.setRequestHeader(u,b[u]);else if(t.headers&&!c(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(f.responseType=t.responseType),"beforeSend"in t&&"function"===typeof t.beforeSend&&t.beforeSend(f),f.send(y||null),f}function p(t){try{if("document"===t.responseType)return t.responseXML;var n=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!n)return t.responseXML}catch(e){}return null}function f(){}n.exports=h,n.exports.default=h,h.XMLHttpRequest=i.XMLHttpRequest||f,h.XDomainRequest="withCredentials"in new h.XMLHttpRequest?h.XMLHttpRequest:i.XDomainRequest,l(["get","put","post","patch","head","delete"],(function(e){h["delete"===e?"del":e]=function(t,n,r){return(n=u(t,n,r)).method=e.toUpperCase(),d(n)}}))},{"global/window":27,"is-function":33,"parse-headers":47,xtend:72}],71:[function(e,t,n){t.exports="undefined"!==typeof self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:"undefined"!==typeof self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},{}],72:[function(e,t,n){t.exports=i;var r=Object.prototype.hasOwnProperty;function i(){for(var e={},t=0;t dist/aframe-master.js","dist:min":"npm run browserify -s -- --debug -p [ minifyify --map aframe-master.min.js.map --output dist/aframe-master.min.js.map ] -o dist/aframe-master.min.js",docs:"markserv --dir docs --port 9001",preghpages:"node ./scripts/preghpages.js",ghpages:"ghpages -p gh-pages/",lint:"semistandard -v | snazzy","lint:fix":"semistandard --fix",precommit:"npm run lint",prepush:"node scripts/testOnlyCheck.js",prerelease:"node scripts/release.js 1.0.4 1.1.0",start:"npm run dev","start:https":"cross-env SSL=true npm run dev",test:"karma start ./tests/karma.conf.js","test:docs":"node scripts/docsLint.js","test:firefox":"npm test -- --browsers Firefox","test:chrome":"npm test -- --browsers Chrome","test:nobrowser":"NO_BROWSER=true npm test","test:node":"mocha --ui tdd tests/node"},repository:"aframevr/aframe",license:"MIT",files:["dist/*","docs/**/*","src/**/*","vendor/**/*"],dependencies:{"custom-event-polyfill":"^1.0.6",debug:"ngokevin/debug#noTimestamp","deep-assign":"^2.0.0","document-register-element":"dmarcos/document-register-element#8ccc532b7f3744be954574caf3072a5fd260ca90","load-bmfont":"^1.2.3","object-assign":"^4.0.1",present:"0.0.6","promise-polyfill":"^3.1.0","super-animejs":"^3.1.0","super-three":"^0.125.1","three-bmfont-text":"dmarcos/three-bmfont-text#1babdf8507c731a18f8af3b807292e2b9740955e","webvr-polyfill":"^0.10.12"},devDependencies:{browserify:"^13.1.0","browserify-css":"^0.8.4","browserify-derequire":"^0.9.4","browserify-istanbul":"^2.0.0",budo:"^9.2.0",chai:"^3.5.0","chai-shallow-deep-equal":"^1.4.0",chalk:"^1.1.3",codecov:"^1.0.1","cross-env":"^5.0.1",envify:"^3.4.1",exorcist:"^0.4.0",ghpages:"0.0.8","git-rev":"^0.2.1",glob:"^7.1.1",husky:"^0.11.7",istanbul:"^0.4.5",jsdom:"^9.11.0",karma:"1.4.1","karma-browserify":"^5.1.0","karma-chai-shallow-deep-equal":"0.0.4","karma-chrome-launcher":"^2.0.0","karma-coverage":"^1.1.1","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^1.2.0","karma-mocha":"^1.1.1","karma-mocha-reporter":"^2.1.0","karma-sinon-chai":"1.2.4",lolex:"^1.5.1",markserv:"github:sukima/markserv#feature/fix-broken-websoketio-link",minifyify:"^7.3.3",mocha:"^3.0.2","mozilla-download":"^1.1.1","replace-in-file":"^2.5.3",semistandard:"^9.0.0",shelljs:"^0.7.7",shx:"^0.2.2",sinon:"^1.17.5","sinon-chai":"2.8.0",snazzy:"^5.0.0","too-wordy":"ngokevin/too-wordy",uglifyjs:"^2.4.10","write-good":"^0.9.1"},link:!0,browserify:{transform:["browserify-css","envify"]},semistandard:{ignore:["build/**","dist/**","examples/**/shaders/*.js","**/vendor/**"]},keywords:["3d","aframe","cardboard","components","oculus","three","three.js","rift","vive","vr","web-components","webvr"],"browserify-css":{minify:!0},engines:{node:">= 4.6.0",npm:"^2.15.9"}}},{}],74:[function(e,t,n){var r=e("super-animejs"),i=e("../core/component").components,o=e("../core/component").registerComponent,a=e("../lib/three"),s=e("../utils"),l=new a.Color,c=new a.Color,u=s.entity.getComponentProperty,h=s.entity.setComponentProperty,d={},p="color",f="position",m="rotation",v="scale",g="components",y="object3D";function b(e,t){var n,r,o,a;return r=(o=t.split("."))[0],a=o[1],(n=e.components[r]||i[r])?a&&!n.schema[a]?null:a?n.schema[a].type:n.schema.type:null}function A(e){e.x=a.Math.degToRad(e.x),e.y=a.Math.degToRad(e.y),e.z=a.Math.degToRad(e.z)}function w(e,t,n){var r;for(r=0;r=1),T(i)?M(o,i.property,r,i.type):h(o,i.property,r))}}())},updateConfigForVector:function(){var e,t,n,r=this.config,i=this.data,o=this.el;for(e in t=""!==i.from?s.coordinates.parse(i.from):u(o,i.property),n=s.coordinates.parse(i.to),i.property===m&&(A(t),A(n)),this.targetsArray.length=0,this.targetsArray.push(t),r.targets=this.targetsArray,n)r[e]=n[e];i.property!==f&&i.property!==m&&i.property!==v?r.update=function(){var e={};return function(t){var n=t.animatables[0].target;n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,h(o,i.property,n))}}():r.update=function(){var e={};return function(t){var n=t.animatables[0].target;i.property===v&&(n.x=Math.max(1e-4,n.x),n.y=Math.max(1e-4,n.y),n.z=Math.max(1e-4,n.z)),n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,o.object3D[i.property].set(n.x,n.y,n.z))}}()},updateConfig:function(){var e;e=b(this.el,this.data.property),T(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===e||"vec3"===e||"vec4"===e?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(e){var t,n=this.data,i=this.el,o=this;return""===n.from&&!!n.property.startsWith(g)&&(t=_(n.property)[1],!i.components[t]&&(i.addEventListener("componentinitialized",(function n(a){a.detail.name===t&&(e(),o.animation=r(o.config),i.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var e,t;for(t in this.el.components)e=this.el.components[t],t!==this.attrName&&"animation"===e.name&&e.animationIsPlaying&&e.data.property===this.data.property&&(e.animationIsPlaying=!1)},addEventListeners:function(){var e=this.data,t=this.el;w(t,e.startEvents,this.onStartEvent),w(t,e.pauseEvents,this.pauseAnimation),w(t,e.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var e=this.data,t=this.el;x(t,e.startEvents,this.onStartEvent),x(t,e.pauseEvents,this.pauseAnimation),x(t,e.resumeEvents,this.resumeAnimation)},setColorConfig:function(e,t){l.set(e),c.set(t),e=this.fromColor,t=this.toColor,e.r=l.r,e.g=l.g,e.b=l.b,t.r=c.r,t.g=c.g,t.b=c.b}})},{"../core/component":131,"../lib/three":179,"../utils":205,"super-animejs":56}],75:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../lib/three");t.exports.Component=r("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new i.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,n=this.camera;n.aspect=t.aspect||window.innerWidth/window.innerHeight,n.far=t.far,n.fov=t.fov,n.near=t.near,n.zoom=t.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,n=this.el,r=this.system;e&&e.active===t.active||t.spectator||(t.active&&r.activeCameraEl!==n?r.setActiveCamera(n):t.active||r.activeCameraEl!==n||r.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,n=this.el,r=this.system;e&&e.spectator===t.spectator||(t.spectator&&r.spectatorCameraEl!==n?r.setSpectatorCamera(n):t.spectator||r.spectatorCameraEl!==n||r.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},{"../core/component":131,"../lib/three":179}],76:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../utils/"),o=i.bind,a={CLICK:"click",FUSING:"fusing",MOUSEENTER:"mouseenter",MOUSEDOWN:"mousedown",MOUSELEAVE:"mouseleave",MOUSEUP:"mouseup"},s={FUSING:"cursor-fusing",HOVERING:"cursor-hovering",HOVERED:"cursor-hovered"},l={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},c={DOWN:["selectstart"],UP:["selectend"]},u="a-mouse-cursor-hover";t.exports.Component=r("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:i.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity"]}},init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.updateCanvasBounds=i.debounce((function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=o(this.onCursorDown,this),this.onCursorUp=o(this.onCursorUp,this),this.onIntersection=o(this.onIntersection,this),this.onIntersectionCleared=o(this.onIntersectionCleared,this),this.onMouseMove=o(this.onMouseMove,this),this.onEnterVR=o(this.onEnterVR,this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&this.updateMouseEventListeners()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(s.HOVERING),e.removeState(s.FUSING),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(s.HOVERED),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,r=this;function i(){e=n.sceneEl.canvas,t.downEvents.length||t.upEvents.length||(l.DOWN.forEach((function(t){e.addEventListener(t,r.onCursorDown)})),l.UP.forEach((function(t){e.addEventListener(t,r.onCursorUp)})))}(e=n.sceneEl.canvas)?i():n.sceneEl.addEventListener("render-target-loaded",i),t.downEvents.forEach((function(e){n.addEventListener(e,r.onCursorDown)})),t.upEvents.forEach((function(e){n.addEventListener(e,r.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,r=this;!(e=n.sceneEl.canvas)||t.downEvents.length||t.upEvents.length||(l.DOWN.forEach((function(t){e.removeEventListener(t,r.onCursorDown)})),l.UP.forEach((function(t){e.removeEventListener(t,r.onCursorUp)}))),t.downEvents.forEach((function(e){n.removeEventListener(e,r.onCursorDown)})),t.upEvents.forEach((function(e){n.removeEventListener(e,r.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds)},updateMouseEventListeners:function(){var e,t=this.el;(e=t.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove,!1),e.addEventListener("touchmove",this.onMouseMove,!1),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},onMouseMove:function(){var e=new THREE.Vector3,t=new THREE.Vector2,n=new THREE.Vector3,r={origin:n,direction:e};return function(i){var o,a,s,l=this.canvasBounds,c=this.el.sceneEl.camera;c.parent.updateMatrixWorld(),o=(a="touchmove"===i.type||"touchstart"===i.type?i.touches.item(0):i).clientX-l.left,s=a.clientY-l.top,t.x=o/l.width*2-1,t.y=-s/l.height*2+1,n.setFromMatrixPosition(c.matrixWorld),e.set(t.x,t.y,.5).unproject(c).sub(n).normalize(),this.el.setAttribute("raycaster",r),"touchmove"===i.type&&i.preventDefault()}}(),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),this.twoWayEmit(a.MOUSEDOWN),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(a.MOUSEUP),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(a.MOUSEUP,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(a.CLICK),this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,r,i,o=this.el;n=e.detail.els[0]===o?1:0,i=e.detail.intersections[n],(r=e.detail.els[n])&&this.intersectedEl!==r&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=i.distance||(this.clearCurrentIntersection(!0),this.setIntersection(r,i)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0);var e=this.el.sceneEl.xrSession,t=this;e&&"mouse"!==this.data.rayOrigin&&(c.DOWN.forEach((function(n){e.addEventListener(n,t.onCursorDown)})),c.UP.forEach((function(n){e.addEventListener(n,t.onCursorUp)})))},setIntersection:function(e,t){var n=this.el,r=this.data,i=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(s.HOVERING),e.addState(s.HOVERED),this.twoWayEmit(a.MOUSEENTER),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(u),0!==r.fuseTimeout&&r.fuse&&(n.addState(s.FUSING),this.twoWayEmit(a.FUSING),this.fuseTimeout=setTimeout((function(){n.removeState(s.FUSING),i.twoWayEmit(a.CLICK)}),r.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,r=this.el;this.intersectedEl&&(this.intersectedEl.removeState(s.HOVERED),r.removeState(s.HOVERING),r.removeState(s.FUSING),this.twoWayEmit(a.MOUSELEAVE),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(u),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&0!==(n=this.el.components.raycaster.intersections).length&&(t=n[n[0].object.el===r?1:0])&&this.setIntersection(t.object.el,t))},twoWayEmit:function(e){var t,n=this.el,r=this.intersectedEl;t=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=t,n.emit(e,this.eventDetail),r&&(this.intersectedEventDetail.intersection=t,r.emit(e,this.intersectedEventDetail))}})},{"../core/component":131,"../utils/":205}],77:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../utils/bind"),o=e("../utils/tracked-controls"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c="https://cdn.aframe.io/controllers/google/",u=c+"vr_controller_daydream.obj",h=c+"vr_controller_daydream.mtl",d=e("../utils/").device.isWebXRAvailable,p=d?"google-daydream":"Daydream Controller",f=d?{axes:{touchpad:[0,1]},buttons:["none","none","touchpad","menu","system"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","menu","system"]};t.exports.Component=r("daydream-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#000000"},buttonTouchedColor:{type:"color",default:"#777777"},buttonHighlightColor:{type:"color",default:"#FFFFFF"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:f,bindMethods:function(){this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){a(this,p,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,hand:t.hand,idPrefix:p,id:p,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:u,mtl:h})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;this.data.model&&((t=this.buttonMeshes={}).menu=n.getObjectByName("AppButton_AppButton_Cylinder.004"),t.system=n.getObjectByName("HomeButton_HomeButton_Cylinder.005"),t.trackpad=n.getObjectByName("TouchPad_TouchPad_Cylinder.003"),t.touchpad=n.getObjectByName("TouchPad_TouchPad_Cylinder.003"),n.position.set(0,0,-.04))},onAxisMoved:function(e){s(this,this.mapping.axes,e)},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor;break;default:r=this.data.buttonColor}n[e].material.color.set(r)}}})},{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],78:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../utils/bind"),o=e("../utils/tracked-controls"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c=e("../utils/").device.isWebXRAvailable,u="https://cdn.aframe.io/controllers/samsung/",h=u+"gear_vr_controller.obj",d=u+"gear_vr_controller.mtl",p=c?"samsung-gearvr":"Gear VR",f=c?{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]};t.exports.Component=r("gearvr-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#000000"},buttonTouchedColor:{type:"color",default:"#777777"},buttonHighlightColor:{type:"color",default:"#FFFFFF"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:f,bindMethods:function(){this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){a(this,p,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,hand:t.hand,idPrefix:p,id:p,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("obj-model",{obj:h,mtl:d})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;this.data.model&&((t=this.buttonMeshes={}).trigger=n.children[2],t.trackpad=n.children[1],t.touchpad=n.children[1])},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){s(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor;break;default:r=this.data.buttonColor}n[e].material.color.set(r)}}})},{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],79:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../utils/bind"),o=e("../utils/tracked-controls"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c="generic",u={axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]};t.exports.Component=r("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},orientationOffset:{type:"vec3"},disabled:{default:!1}},mapping:u,bindMethods:function(){this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.lastControllerCheck=0,this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(t){t.detail.name!==e.name&&(e.wasControllerConnected=!0,e.removeEventListeners(),e.removeControllersUpdateListener())}))},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;a(this,c,{hand:t,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:c,orientationOffset:t.orientationOffset,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){s(this,this.mapping.axes,e)},initDefaultModel:function(){var e=this.modelEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:.03}),e.setAttribute("material",{color:this.data.color}),this.el.appendChild(e)}})},{"../core/component":131,"../utils/bind":199,"../utils/tracked-controls":214}],80:[function(e,t,n){var r=e("../core/geometry").geometries,i=e("../core/geometry").geometryNames,o=e("../core/component").registerComponent,a=e("../lib/three"),s=new a.BufferGeometry;t.exports.Component=o("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:i,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,n=this.data,r=this.el,i=this.system;this.geometry&&(i.unuseGeometry(e),this.geometry=null),this.geometry=i.getOrCreateGeometry(n),(t=r.getObject3D("mesh"))?t.geometry=this.geometry:((t=new a.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(t.material=new a.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),r.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=s,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,n=e.primitive,i=r[n]&&r[n].schema;if(!i)throw new Error("Unknown geometry schema `"+n+"`");t&&t===n||this.extendSchema(i)}})},{"../core/component":131,"../core/geometry":132,"../lib/three":179}],81:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../lib/three"),o=e("../utils/").debug("components:gltf-model:warn");t.exports.Component=r("gltf-model",{schema:{type:"model"},init:function(){var e=this.system.getDRACOLoader();this.model=null,this.loader=new i.GLTFLoader,e&&this.loader.setDRACOLoader(e)},update:function(){var e=this,t=this.el,n=this.data;n&&(this.remove(),this.loader.load(n,(function(n){e.model=n.scene||n.scenes[0],e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}),void 0,(function(e){var r=e&&e.message?e.message:"Failed to load glTF model";o(r),t.emit("model-error",{format:"gltf",src:n})})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{"../core/component":131,"../lib/three":179,"../utils/":205}],82:[function(e,t,n){var r=e("../core/component").registerComponent,i={toonLeft:"https://cdn.aframe.io/controllers/hands/leftHand.glb",toonRight:"https://cdn.aframe.io/controllers/hands/rightHand.glb",lowPolyLeft:"https://cdn.aframe.io/controllers/hands/leftHandLow.glb",lowPolyRight:"https://cdn.aframe.io/controllers/hands/rightHandLow.glb",highPolyLeft:"https://cdn.aframe.io/controllers/hands/leftHandHigh.glb",highPolyRight:"https://cdn.aframe.io/controllers/hands/rightHandHigh.glb"},o={open:"Open",point:"Point",pointThumb:"Point + Thumb",fist:"Fist",hold:"Hold",thumbUp:"Thumb Up"},a={};function s(e,t){var n;if(e)return"grip"===(n=a[e])?n+(t?"close":"open"):"point"===n?n+(t?"up":"down"):"pointing"===n||"pistol"===n?n+(t?"start":"end"):void 0}function l(e){var t=e&&e.controller;return t&&(t.id&&0===t.id.indexOf("OpenVR ")||t.profiles&&t.profiles[0]&&"htc-vive-controller-mv"===t.profiles[0])}a[o.fist]="grip",a[o.thumbUp]="pistol",a[o.point]="pointing",t.exports.Component=r("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},init:function(){var e=this,t=this.el;this.gesture=o.open,this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){e.handleButton("grip","down")},this.onGripUp=function(){e.handleButton("grip","up")},this.onTrackpadDown=function(){e.handleButton("trackpad","down")},this.onTrackpadUp=function(){e.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){e.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){e.handleButton("trackpad","touchend")},this.onTriggerDown=function(){e.handleButton("trigger","down")},this.onTriggerUp=function(){e.handleButton("trigger","up")},this.onTriggerTouchStart=function(){e.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){e.handleButton("trigger","touchend")},this.onGripTouchStart=function(){e.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){e.handleButton("grip","touchend")},this.onThumbstickDown=function(){e.handleButton("thumbstick","down")},this.onThumbstickUp=function(){e.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){e.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){e.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){e.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){e.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){e.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){e.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected),t.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(t/1e3)},onControllerConnected:function(){this.el.object3D.visible=!0},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var e=this.el;e.addEventListener("gripdown",this.onGripDown),e.addEventListener("gripup",this.onGripUp),e.addEventListener("trackpaddown",this.onTrackpadDown),e.addEventListener("trackpadup",this.onTrackpadUp),e.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.addEventListener("triggerdown",this.onTriggerDown),e.addEventListener("triggerup",this.onTriggerUp),e.addEventListener("triggertouchstart",this.onTriggerTouchStart),e.addEventListener("triggertouchend",this.onTriggerTouchEnd),e.addEventListener("griptouchstart",this.onGripTouchStart),e.addEventListener("griptouchend",this.onGripTouchEnd),e.addEventListener("thumbstickdown",this.onThumbstickDown),e.addEventListener("thumbstickup",this.onThumbstickUp),e.addEventListener("abuttontouchstart",this.onAorXTouchStart),e.addEventListener("abuttontouchend",this.onAorXTouchEnd),e.addEventListener("bbuttontouchstart",this.onBorYTouchStart),e.addEventListener("bbuttontouchend",this.onBorYTouchEnd),e.addEventListener("xbuttontouchstart",this.onAorXTouchStart),e.addEventListener("xbuttontouchend",this.onAorXTouchEnd),e.addEventListener("ybuttontouchstart",this.onBorYTouchStart),e.addEventListener("ybuttontouchend",this.onBorYTouchEnd),e.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var e=this.el;e.removeEventListener("gripdown",this.onGripDown),e.removeEventListener("gripup",this.onGripUp),e.removeEventListener("trackpaddown",this.onTrackpadDown),e.removeEventListener("trackpadup",this.onTrackpadUp),e.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.removeEventListener("triggerdown",this.onTriggerDown),e.removeEventListener("triggerup",this.onTriggerUp),e.removeEventListener("triggertouchstart",this.onTriggerTouchStart),e.removeEventListener("triggertouchend",this.onTriggerTouchEnd),e.removeEventListener("griptouchstart",this.onGripTouchStart),e.removeEventListener("griptouchend",this.onGripTouchEnd),e.removeEventListener("thumbstickdown",this.onThumbstickDown),e.removeEventListener("thumbstickup",this.onThumbstickUp),e.removeEventListener("abuttontouchstart",this.onAorXTouchStart),e.removeEventListener("abuttontouchend",this.onAorXTouchEnd),e.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),e.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),e.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),e.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),e.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),e.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),e.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(e){var t,n=this.el,r=this.data.hand,o=this.data.handModelStyle,a=this.data.color,s=this;if(t={hand:r,model:!1},r!==e){var l=i[o+r.charAt(0).toUpperCase()+r.slice(1)];this.loader.load(l,(function(e){var i=e.scene.children[0],o="left"===r?Math.PI/2:-Math.PI/2;i.mixer=new THREE.AnimationMixer(i),s.clips=e.animations,n.setObject3D("mesh",i),i.children[1].material.color=new THREE.Color(a),i.position.set(0,0,0),i.rotation.set(0,0,o),n.setAttribute("magicleap-controls",t),n.setAttribute("vive-controls",t),n.setAttribute("oculus-touch-controls",t),n.setAttribute("windows-motion-controls",t)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(e,t){var n,r="down"===t,i="touchstart"===t;if(0===t.indexOf("touch")){if(i===this.touchedButtons[e])return;this.touchedButtons[e]=i}else{if(r===this.pressedButtons[e])return;this.pressedButtons[e]=r}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var e,t=this.pressedButtons.grip,n=this.pressedButtons.surface||this.touchedButtons.surface,r=this.pressedButtons.trackpad||this.touchedButtons.trackpad,i=this.pressedButtons.trigger||this.touchedButtons.trigger,a=this.touchedButtons.AorX||this.touchedButtons.BorY;return l(this.el.components["tracked-controls"])?t||i?e=o.fist:r&&(e=o.point):t?e=n||a||r?i?o.fist:o.point:i?o.thumbUp:o.pointThumb:i&&(e=o.hold),e},getClip:function(e){var t,n;for(n=0;nd&&!0===this.isPinched&&(this.isPinched=!1,this.pinchEventDetail.position.copy(n).lerp(e,p),this.pinchEventDetail.position.y+=1.5,this.el.emit("pinchended",this.pinchEventDetail)),this.isPinched&&(this.pinchEventDetail.position.copy(n).lerp(e,p),this.pinchEventDetail.position.y+=1.5,this.el.emit("pinchmoved",this.pinchEventDetail)),n.y+=1.5}}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{hand:t.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var e;this.checkIfControllerPresent(),e=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,this.el.getObject3D("mesh")&&(e&&e.hand&&e.hand[0]||(this.el.getObject3D("mesh").visible=!1))},initDefaultModel:function(){this.el.getObject3D("mesh")||("dots"===this.data.modelStyle&&this.initDotsModel(),"mesh"===this.data.modelStyle&&this.initMeshHandModel())},initDotsModel:function(){if(0===this.jointEls.length)for(var e=0;e20)this.previousQuaternion||(this.quaternionClone.copy(n),this.previousQuaternion=this.quaternionClone),s.lookAt(e);else{if(i=this.calculateCameraPortalOrientation(),o<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;c.setAttribute("text","width",1.5),i<=0?(c.setAttribute("position","0 0 0.75"),c.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(c.setAttribute("position","0 0 -0.75"),c.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),a.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=i}else i<=0?c.setAttribute("rotation","0 180 0"):c.setAttribute("rotation","0 0 0"),c.setAttribute("text","width",5),c.setAttribute("position","0 1.5 0"),a.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(s.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var e=this.el,t=this.hiddenEls,n=this;t.length>0||e.sceneEl.object3D.traverse((function(r){r&&r.el&&r.el.hasAttribute("link-controls")||r.el&&r!==e.sceneEl.object3D&&r.el!==e&&r.el!==n.sphereEl&&r.el!==e.sceneEl.cameraEl&&!1!==r.el.getAttribute("visible")&&r.el!==n.textEl&&r.el!==n.semiSphereEl&&(r.el.setAttribute("visible",!1),t.push(r.el))}))},showAll:function(){this.hiddenEls.forEach((function(e){e.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:function(){var e=new o.Matrix4,t=new o.Vector3,n=new o.Vector3(0,0,1),r=new o.Vector3(0,0,0);return function(){var i=this.el,o=i.sceneEl.camera;return t.set(0,0,0),n.set(0,0,1),r.set(0,0,0),i.object3D.matrixWorld.extractRotation(e),n.applyMatrix4(e),i.object3D.updateMatrixWorld(),i.object3D.localToWorld(r),o.parent.parent.updateMatrixWorld(),o.parent.updateMatrixWorld(),o.updateMatrixWorld(),o.localToWorld(t),t.sub(r).normalize(),n.normalize(),Math.sign(n.dot(t))}}(),remove:function(){this.removeEventListener()}}),i("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / 15.0), 2.0), 0.0, 1.0));","}","}"].join("\n")})},{"../core/component":131,"../core/shader":141,"../lib/three":179}],90:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../lib/three"),o=e("../utils/"),a=o.bind,s=Math.PI/2;t.exports.Component=r("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new i.Vector3,this.hmdQuaternion=new i.Quaternion,this.magicWindowAbsoluteEuler=new i.Euler,this.magicWindowDeltaEuler=new i.Euler,this.position=new i.Vector3,this.magicWindowObject=new i.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new i.Vector3,rotation:new i.Euler},this.el.sceneEl.is("vr-mode")&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;o.device.isMobile()&&(e=this.magicWindowControls=new i.DeviceOrientationControls(this.magicWindowObject),"undefined"!==typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){e.enabled=t.magicWindowTrackingEnabled}))))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=a(this.onMouseDown,this),this.onMouseMove=a(this.onMouseMove,this),this.onMouseUp=a(this.onMouseUp,this),this.onTouchStart=a(this.onTouchStart,this),this.onTouchMove=a(this.onTouchMove,this),this.onTouchEnd=a(this.onTouchEnd,this),this.onEnterVR=a(this.onEnterVR,this),this.onExitVR=a(this.onExitVR,this),this.onPointerLockChange=a(this.onPointerLockChange,this),this.onPointerLockError=a(this.onPointerLockError,this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new i.Object3D,this.yawObject=new i.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart),window.addEventListener("touchmove",this.onTouchMove),window.addEventListener("touchend",this.onTouchEnd),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):e.addEventListener("render-target-loaded",a(this.addEventListeners,this))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=new i.Matrix4;return function(){var t,n=this.el.object3D,r=this.pitchObject,i=this.yawObject,o=this.el.sceneEl;o.is("vr-mode")&&o.checkHeadsetConnected()?o.hasWebXR&&(t=o.renderer.xr.getCameraPose())&&(e.elements=t.transform.matrix,e.decompose(n.position,n.rotation,n.scale)):(this.updateMagicWindowOrientation(),n.rotation.x=this.magicWindowDeltaEuler.x+r.rotation.x,n.rotation.y=this.magicWindowDeltaEuler.y+i.rotation.y,n.rotation.z=this.magicWindowDeltaEuler.z)}}(),updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,n,r,i=this.pitchObject,o=this.previousMouseEvent,a=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=e.movementX||e.mozMovementX||0,r=e.movementY||e.mozMovementY||0):(n=e.screenX-o.screenX,r=e.screenY-o.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,a.rotation.y+=.002*n*t,i.rotation.x+=.002*r*t,i.rotation.x=Math.max(-s,Math.min(s,i.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")||!t.checkHeadsetConnected())&&0===e.button){var n=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1===e.touches.length&&this.data.touchEnabled&&!this.el.sceneEl.is("vr-mode")&&(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,n,r=this.el.sceneEl.canvas,i=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/r.clientWidth,t=this.data.reverseTouchDrag?1:-1,i.rotation.y-=.5*n*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){var t=this.el.sceneEl;function n(){t.canvas.classList.add("a-grab-cursor")}function r(){t.canvas.classList.remove("a-grab-cursor")}t.canvas?e?n():r():e?t.addEventListener("render-target-loaded",n):t.addEventListener("render-target-loaded",r)},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}})},{"../core/component":131,"../lib/three":179,"../utils/":205}],91:[function(e,t,n){var r=e("../utils/bind"),i=e("../core/component").registerComponent,o=e("../utils/tracked-controls"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c="magicleap-one",u="https://cdn.aframe.io/controllers/magicleap/magicleap-one-controller.glb",h={axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]};t.exports.Component=i("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:h,init:function(){var e=this;this.controllerPresent=!1,this.lastControllerCheck=0,this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=r(this.onModelLoaded,this),this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=r(this.removeControllersUpdateListener,this),this.onAxisMoved=r(this.onAxisMoved,this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;a(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",u)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(e){s(this,this.mapping.axes,e)},updateModel:function(e,t){},setButtonColor:function(e,t){}})},{"../core/component":131,"../utils/bind":199,"../utils/tracked-controls":214}],92:[function(e,t,n){var r=e("../utils/"),i=e("../core/component"),o=e("../lib/three"),a=e("../core/shader"),s=r.debug("components:material:error"),l=i.registerComponent,c=a.shaders,u=a.shaderNames;function h(e){switch(e){case"back":return o.BackSide;case"double":return o.DoubleSide;default:return o.FrontSide}}function d(e){switch(e){case"face":return o.FaceColors;case"vertex":return o.VertexColors;default:return o.NoColors}}function p(e){switch(e){case"none":return o.NoBlending;case"additive":return o.AdditiveBlending;case"subtractive":return o.SubtractiveBlending;case"multiply":return o.MultiplyBlending;default:return o.NormalBlending}}function f(e,t){e.dispose(),t.unregisterMaterial(e)}t.exports.Component=l("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:u,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColors:{type:"string",default:"none",oneOf:["face","vertex"]},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,n,r,i;n=e&&e.shader,t=this.oldData&&this.oldData.shader,(r=c[i=n||t]&&c[i].schema)||s("Unknown shader schema "+i),t&&n===t||(this.extendSchema(r),this.updateBehavior())},updateBehavior:function(){var e,t,n=this.el.sceneEl,r=this.schema,i=this;function o(e,n){var r;for(r in t)t[r]=e;i.shader.update(t)}for(e in this.tick=void 0,t={},r)"time"===r[e].type&&(this.tick=o,t[e]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(e){var t,n=this.data,r=c[e]&&c[e].Shader;if(!r)throw new Error("Unknown shader "+e);(t=this.shader=new r).el=this.el,t.init(n),this.setMaterial(t.material),this.updateSchema(n)},updateMaterial:function(e){var t,n=this.data,r=this.material;for(t in r.alphaTest=n.alphaTest,r.depthTest=!1!==n.depthTest,r.depthWrite=!1!==n.depthWrite,r.opacity=n.opacity,r.flatShading=n.flatShading,r.side=h(n.side),r.transparent=!1!==n.transparent||n.opacity<1,r.vertexColors=d(n.vertexColors),r.visible=n.visible,r.blending=p(n.blending),r.dithering=n.dithering,e)break;!t||e.alphaTest===n.alphaTest&&e.side===n.side&&e.vertexColors===n.vertexColors||(r.needsUpdate=!0)},remove:function(){var e=new o.MeshBasicMaterial,t=this.material,n=this.el.getObject3D("mesh");n&&(n.material=e),f(t,this.system)},setMaterial:function(e){var t,n=this.el,r=this.system;this.material&&f(this.material,r),this.material=e,r.registerMaterial(e),(t=n.getObject3D("mesh"))?t.material=e:n.addEventListener("object3dset",(function t(r){"mesh"===r.detail.type&&r.target===n&&(n.getObject3D("mesh").material=e,n.removeEventListener("object3dset",t))}))}})},{"../core/component":131,"../core/shader":141,"../lib/three":179,"../utils/":205}],93:[function(e,t,n){var r=e("../utils/debug"),i=e("../core/component").registerComponent,o=e("../lib/three"),a=r("components:obj-model:warn");t.exports.Component=i("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new o.OBJLoader,this.mtlLoader=new o.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(t){e.model&&"material"===t.detail.name&&e.applyMaterial()}))},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.model&&this.resetMesh()},resetMesh:function(){this.el.removeObject3D("mesh")},loadObj:function(e,t){var n=this,r=this.el,i=this.mtlLoader,o=this.objLoader,s=this.el.sceneEl.systems.renderer,l=t.substr(0,t.lastIndexOf("/")+1);if(t)return r.hasAttribute("material")&&a("Material component properties are ignored when a .MTL is provided"),i.setResourcePath(l),void i.load(t,(function(t){t.preload(),o.setMaterials(t),o.load(e,(function(e){n.model=e,n.model.traverse((function(e){if(e.isMesh){var t=e.material;t.color&&s.applyColorCorrection(t.color),t.map&&s.applyColorCorrection(t.map),t.emissive&&s.applyColorCorrection(t.emissive),t.emissiveMap&&s.applyColorCorrection(t.emissiveMap)}})),r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})}))}));o.load(e,(function(e){n.model=e,n.applyMaterial(),r.setObject3D("mesh",e),r.emit("model-loaded",{format:"obj",model:e})}))},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse((function(t){t instanceof o.Mesh&&(t.material=e.material)}))}})},{"../core/component":131,"../lib/three":179,"../utils/debug":201}],94:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../utils/bind"),o=e("../utils/tracked-controls"),a=o.checkControllerPresentAndSetup,s=o.emitIfAxesChanged,l=o.onButtonEvent,c=e("../utils/").device.isWebXRAvailable,u="https://cdn.aframe.io/controllers/oculus/go/oculus-go-controller.gltf",h=c?"oculus-go":"Oculus Go",d=c?{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]}:{axes:{trackpad:[0,1]},buttons:["trackpad","trigger"]};t.exports.Component=r("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0},orientationOffset:{type:"vec3"},armModel:{default:!0}},mapping:d,bindMethods:function(){this.onModelLoaded=i(this.onModelLoaded,this),this.onControllersUpdate=i(this.onControllersUpdate,this),this.checkIfControllerPresent=i(this.checkIfControllerPresent,this),this.removeControllersUpdateListener=i(this.removeControllersUpdateListener,this),this.onAxisMoved=i(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=i(this.onButtonChanged,this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.lastControllerCheck=0,this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){a(this,h,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{armModel:t.armModel,hand:t.hand,idPrefix:h,orientationOffset:t.orientationOffset}),this.data.model&&this.el.setAttribute("gltf-model",u)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),t.trackpad=n.getObjectByName("oculus_go_touchpad"),t.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){s(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var r,i;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor;break;default:r=this.data.buttonColor}(i=n[e]).material.color.set(r),this.rendererSystem.applyColorCorrection(i.material.color)}}})},{"../core/component":131,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],95:[function(e,t,n){var r=e("../utils/bind"),i=e("../core/component").registerComponent,o=e("../lib/three"),a=e("../utils/tracked-controls"),s=a.checkControllerPresentAndSetup,l=a.emitIfAxesChanged,c=a.onButtonEvent,u=e("../utils/").device.isWebXRAvailable,h="oculus-touch",d=u?h:"Oculus Touch",p="https://cdn.aframe.io/controllers/oculus/oculus-touch-controller-",f={left:{modelUrl:p+"left.gltf",rayOrigin:{origin:{x:.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new o.Vector3(-.005,.003,-.055),modelPivotRotation:new o.Euler(0,0,0)},right:{modelUrl:p+"right.gltf",rayOrigin:{origin:{x:-.008,y:-.01,z:0},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new o.Vector3(.005,.003,-.055),modelPivotRotation:new o.Euler(0,0,0)}},m={left:{modelUrl:p+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new o.Vector3(-.005,.036,-.037),modelPivotRotation:new o.Euler(Math.PI/4.5,0,0)},right:{modelUrl:p+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new o.Vector3(.005,.036,-.037),modelPivotRotation:new o.Euler(Math.PI/4.5,0,0)}},v="oculus-touch",g={"oculus-touch":u?m:f,"oculus-touch-v2":{left:{modelUrl:p+"gen2-left.gltf",rayOrigin:{origin:{x:-.01,y:0,z:-.02},direction:{x:0,y:-.5,z:-1}},modelPivotOffset:new o.Vector3(0,0,0),modelPivotRotation:new o.Euler(0,0,0)},right:{modelUrl:p+"gen2-right.gltf",rayOrigin:{origin:{x:.01,y:0,z:-.02},direction:{x:0,y:-.5,z:-1}},modelPivotOffset:new o.Vector3(0,0,0),modelPivotRotation:new o.Euler(0,0,0)}},"oculus-touch-v3":{left:{modelUrl:p+"v3-left.glb",rayOrigin:{origin:{x:.015,y:.005,z:0},direction:{x:0,y:0,z:-1}},modelPivotOffset:new o.Vector3(.01,-.01,.05),modelPivotRotation:new o.Euler(Math.PI/4,0,0)},right:{modelUrl:p+"v3-right.glb",rayOrigin:{origin:{x:-.015,y:.005,z:0},direction:{x:0,y:0,z:-1}},modelPivotOffset:new o.Vector3(-.01,-.01,.05),modelPivotRotation:new o.Euler(Math.PI/4,0,0)}}},y=u?{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}}:{left:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[0,1]},buttons:["thumbstick","trigger","grip","abutton","bbutton","surface"]}};t.exports.Component=i("oculus-touch-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]},orientationOffset:{type:"vec3",default:{x:43,y:0,z:0}}},mapping:y,bindMethods:function(){this.onModelLoaded=r(this.onModelLoaded,this),this.onControllersUpdate=r(this.onControllersUpdate,this),this.checkIfControllerPresent=r(this.checkIfControllerPresent,this),this.onAxisMoved=r(this.onAxisMoved,this)},init:function(){var e=this;this.onButtonChanged=r(this.onButtonChanged,this),this.onButtonDown=function(t){c(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){c(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchStart=function(t){c(t.detail.id,"touchstart",e,e.data.hand)},this.onButtonTouchEnd=function(t){c(t.detail.id,"touchend",e,e.data.hand)},this.controllerPresent=!1,this.lastControllerCheck=0,this.previousButtonValues={},this.rendererSystem=this.el.sceneEl.systems.renderer,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){s(this,d,{hand:this.data.hand})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(e){var t,n=this.data;if(n.model){if(this.displayModel=g[n.controllerType]||g[v],"auto"===n.controllerType){var r=this.el.sceneEl.systems["tracked-controls-webvr"];if(r&&r.vrDisplay){var i=r.vrDisplay.displayName;/^Oculus Quest$/.test(i)&&(this.displayModel=g["oculus-touch-v2"])}else t=v,t=-1!==e.profiles.indexOf("oculus-touch-v2")?"oculus-touch-v2":t,t=-1!==e.profiles.indexOf("oculus-touch-v3")?"oculus-touch-v3":t,this.displayModel=g[t]}var o=this.displayModel[n.hand].modelUrl;this.el.setAttribute("gltf-model",o)}},injectTrackedControls:function(e){var t=this.data,n=h,r="right"===t.hand?"Oculus Touch (Right)":"Oculus Touch (Left)",i=u?n:r;this.el.setAttribute("tracked-controls",{id:i,hand:t.hand,orientationOffset:t.orientationOffset,handTrackingEnabled:!1}),this.loadModel(e)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id],r=this.buttonMeshes;n&&("trigger"!==n&&"grip"!==n||(t=e.detail.state.value),r&&("trigger"===n&&r.trigger&&(r.trigger.rotation.x=this.originalXRotationTrigger-t*(Math.PI/26)),"grip"===n&&r.grip&&(r.grip.position.x=this.originalXPositionGrip+("left"===this.data.hand?-1:1)*t*.004)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=this.controllerObject3D=e.detail.model;this.data.model&&((t=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=t.grip&&t.grip.position.x,t.thumbstick=n.getObjectByName("stick"),t.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=t.trigger&&t.trigger.rotation.x,t.xbutton=n.getObjectByName("buttonX"),t.abutton=n.getObjectByName("buttonA"),t.ybutton=n.getObjectByName("buttonY"),t.bbutton=n.getObjectByName("buttonB"),n.position.copy(this.displayModel[this.data.hand].modelPivotOffset),n.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation),this.el.emit("controllermodelready",{name:"oculus-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin}))},onAxisMoved:function(e){l(this,this.mapping[this.data.hand].axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n,r="up"===t||"touchend"===t?this.data.buttonColor:"touchstart"===t?this.data.buttonTouchColor:this.data.buttonHighlightColor,i=this.buttonMeshes;this.data.model&&i&&i[e]&&((n=i[e]).material.color.set(r),this.rendererSystem.applyColorCorrection(n.material.color))}})},{"../core/component":131,"../lib/three":179,"../utils/":205,"../utils/bind":199,"../utils/tracked-controls":214}],96:[function(e,t,n){var r=e("../core/component").registerComponent;t.exports.Component=r("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},{"../core/component":131}],97:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../lib/three"),o=e("../utils/").debug("components:raycaster:warn"),a=/^[\w\s-.,[\]#]*$/,s={childList:!0,attributes:!0,subtree:!0},l={INTERSECT:"raycaster-intersected",INTERSECTION:"raycaster-intersection",INTERSECT_CLEAR:"raycaster-intersected-cleared",INTERSECTION_CLEAR:"raycaster-intersection-cleared"};function c(e,t){var n;for(e.length=t.length,n=0;n")},remove:function(){var e=this.el.object3D.fog;e&&(e.far=0,e.near=.1)}})},{"../../core/component":131,"../../lib/three":179,"../../utils/debug":201}],105:[function(e,t,n){(function(n){var r=e("../../constants").AFRAME_INJECTED,i=e("../../../package"),o=e("../../core/component").registerComponent,a=e("../../utils/");function s(e){var t=e.split(".");return t[2]="x",t.join(".")}var l="https://aframe.io/aframe-inspector/dist/aframe-inspector.js",c="https://unpkg.com/aframe-inspector@"+s(i.version)+"/dist/aframe-inspector.min.js",u="dev"===n.env.INSPECTOR_VERSION?l:c,h="Loading Inspector",d="Error loading Inspector";t.exports.Component=o("inspector",{schema:{url:{default:u}},init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=a.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){var e='...';this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML=h+e},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var t,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(e):(this.showLoader(),(t=document.createElement("script")).src=this.data.url,t.setAttribute("data-name","aframe-inspector"),t.setAttribute(r,""),t.onload=function(){AFRAME.INSPECTOR.open(e),n.hideLoader(),n.removeEventListeners()},t.onerror=function(){n.loadingMessageEl.innerHTML=d},document.head.appendChild(t),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})}).call(this,e("_process"))},{"../../../package":73,"../../constants":123,"../../core/component":131,"../../utils/":205,_process:49}],106:[function(e,t,n){var r=e("../../core/component").registerComponent,i=e("../../utils/").shouldCaptureKeyEvent;t.exports.Component=r("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},init:function(){this.onKeyup=this.onKeyup.bind(this)},update:function(e){var t=this.data;this.enterVREnabled=t.enterVR},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;i(e)&&(this.enterVREnabled&&70===e.keyCode&&t.enterVR(),this.enterVREnabled&&27===e.keyCode&&t.exitVR())}})},{"../../core/component":131,"../../utils/":205}],107:[function(e,t,n){var r=e("../../utils/debug"),i=e("../../core/component").registerComponent,o=r("components:pool:warn");t.exports.Component=i("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},multiple:!0,initPool:function(){var e;for(this.availableEls=[],this.usedEls=[],this.data.mixin||o("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||o("Container "+this.data.container+" not found.")),this.container=this.container||this.el,e=0;e0&&(this.stopSound(),n.removeObject3D("sound"));var o=this.listener=r.audioListener||new a.AudioListener;for(r.audioListener=o,r.camera&&r.camera.add(o),r.addEventListener("camera-set-active",(function(e){e.detail.cameraEl.getObject3D("camera").add(o)})),this.pool=new a.Group,e=0;e=0&&(t=30),t&&o.chars.map((function(e){e.yoffset+=t})),n(o)}))}))}function M(e){return new Promise((function(t,n){(new s.ImageLoader).load(e,(function(e){t(e)}),void 0,(function(){c("Error loading font image",e),n(null)}))}))}function _(e,t,n){var r,i;return(i=new u[t].Shader).el=e,i.init(n),i.update(n),(r=i.material).transparent=n.transparent,{material:r,shader:i}}function T(e,t,n){return e||(.5+t)*n}function S(e){var t=0,n=0,r=0;return e.chars.map((function(e){t+=e.xadvance,e.id>=48&&e.id<=57&&(r++,n+=e.xadvance)})),r?n/r:t/e.chars.length}function C(){var e=this.cache={};this.get=function(t,n){return t in e||(e[t]=n()),e[t]}}t.exports.Component=o("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:g},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:u},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=r(),this.createOrUpdateMaterial()},update:function(e){var t=this.data,n=this.currentFont;A[t.font]?this.texture=A[t.font]:(this.texture=A[t.font]=new s.Texture,this.texture.anisotropy=p),this.createOrUpdateMaterial(),e.font===t.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var e,t,n,r=this.data,i=this.material,o=this.shaderData;if(n=r.shader,-1!==v.indexOf(r.font)||r.font.indexOf("-msdf.")>=0?n="msdf":r.font in m&&-1===v.indexOf(r.font)&&(n="sdf"),e=(this.shaderObject&&this.shaderObject.name)!==n,o.alphaTest=r.alphaTest,o.color=r.color,o.map=this.texture,o.opacity=r.opacity,o.side=x(r.side),o.transparent=r.transparent,o.negate=r.negate,!e)return this.shaderObject.update(o),i.transparent=o.transparent,void(i.side=o.side);t=_(this.el,n,o),this.material=t.material,this.shaderObject=t.shader,this.material.side=o.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var e,t=this.data,n=this.el,r=this.geometry,i=this;t.font||h("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),e=this.lookupFont(t.font||g)||t.font,y.get(e,(function(){return E(e,t.yOffset)})).then((function(o){var a;if(1!==o.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");b[e]||(o.widthFactor=b[o]=S(o)),i.currentFont=o,a=i.getFontImageSrc(),y.get(a,(function(){return M(a)})).then((function(e){var a=i.texture;a.image=e,a.needsUpdate=!0,A[t.font]=a,i.texture=a,i.initMesh(),i.currentFont=o,i.updateGeometry(r,o),i.updateLayout(),i.mesh.visible=!0,n.emit("textfontset",{font:t.font,fontObj:o})})).catch((function(e){c(e.message),c(e.stack)}))})).catch((function(e){c(e.message),c(e.stack)}))},initMesh:function(){this.mesh||(this.mesh=new s.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var e=this.lookupFont(this.data.font||g)||this.data.font,t=this.currentFont.pages[0];return t.match(w)&&0!==t.indexOf("http")?e.replace(/(\.fnt)|(\.json)/,".png"):s.LoaderUtils.extractUrlBase(e)+t},updateLayout:function(){var e,t,n,r,i,o,a,s,l,c=this.el,u=this.data,h=this.geometry,p=this.mesh;if(p&&h.layout){if(n=c.getAttribute("geometry"),r=(o=(a=u.width||n&&n.width||d)/T(u.wrapPixels,u.wrapCount,this.currentFont.widthFactor))*((i=h.layout).height+i.descender),n&&"plane"===n.primitive&&(n.width||c.setAttribute("geometry","width",a),n.height||c.setAttribute("geometry","height",r)),"left"===(e="align"===u.anchor?u.align:u.anchor))s=0;else if("right"===e)s=-1*i.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);s=-1*i.width/2}if("bottom"===(t=u.baseline))l=0;else if("top"===t)l=-1*i.height+i.ascender;else{if("center"!==t)throw new TypeError("Invalid text.baseline property value",t);l=-1*i.height/2}p.position.x=s*o+u.xOffset,p.position.y=l*o,p.position.z=u.zOffset,p.scale.set(o,-1*o,o)}},lookupFont:function(e){return m[e]},updateGeometry:function(){var e={},t={},n=/\\n/g,r=/\\t/g;return function(i,o){var a=this.data;t.font=o,t.lineHeight=a.lineHeight&&isFinite(a.lineHeight)?a.lineHeight:o.common.lineHeight,t.text=a.value.toString().replace(n,"\n").replace(r,"\t"),t.width=T(a.wrapPixels,a.wrapCount,o.widthFactor),i.update(l.extend(e,a,t))}}()})},{"../core/component":131,"../core/shader":141,"../lib/three":179,"../utils/":205,"load-bmfont":37,"three-bmfont-text":63}],114:[function(e,t,n){var r=e("../core/component").registerComponent,i=e("../utils/tracked-controls"),o=e("../constants").DEFAULT_CAMERA_HEIGHT,a=e("../lib/three"),s=e("../constants").DEFAULT_HANDEDNESS,l={x:.175,y:-.3,z:-.03},c={x:0,y:0,z:-.175},u={touches:[]},h={AXISMOVE:"axismove",BUTTONCHANGED:"buttonchanged",BUTTONDOWN:"buttondown",BUTTONUP:"buttonup",TOUCHSTART:"touchstart",TOUCHEND:"touchend"};t.exports.Component=r("tracked-controls-webvr",{schema:{autoHide:{default:!0},controller:{default:0},id:{type:"string",default:""},hand:{type:"string",default:""},idPrefix:{type:"string",default:""},orientationOffset:{type:"vec3"},armModel:{default:!1},headElement:{type:"selector"}},init:function(){this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.changedAxes=[],this.targetControllerNumber=this.data.controller,this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.deltaControllerPosition=new a.Vector3,this.controllerQuaternion=new a.Quaternion,this.controllerEuler=new a.Euler,this.updateGamepad(),this.buttonEventDetails={}},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.update&&n.update(t/1e3),this.updateGamepad(),this.updatePose(),this.updateButtons()},defaultUserHeight:function(){return o},getHeadElement:function(){return this.data.headElement||this.el.sceneEl.camera.el},updateGamepad:function(){var e=this.data,t=i.findMatchingControllerWebVR(this.system.controllers,e.id,e.idPrefix,e.hand,e.controller);this.controller=t,this.el.components["tracked-controls"].controller=t,this.data.autoHide&&(this.el.object3D.visible=!!this.controller)},applyArmModel:function(e){var t,n,r,i,o=this.controller,a=this.controllerEuler,u=this.controllerQuaternion,h=this.deltaControllerPosition;n=this.getHeadElement().object3D,i=this.defaultUserHeight(),r=o.pose,t=(o?o.hand:void 0)||s,e.copy(n.position),h.set(l.x*("left"===t?-1:"right"===t?1:0),l.y,l.z),h.multiplyScalar(i),h.applyAxisAngle(n.up,n.rotation.y),e.add(h),h.set(c.x,c.y,c.z),h.multiplyScalar(i),r.orientation?u.fromArray(r.orientation):u.copy(n.quaternion),a.setFromQuaternion(u),a.set(a.x,a.y,0),h.applyEuler(a),e.add(h)},updatePose:function(){var e,t,n=this.controller,r=this.data,i=this.el.object3D,o=this.system.vrDisplay;n&&((e=n.pose).position?i.position.fromArray(e.position):r.armModel&&this.applyArmModel(i.position),e.orientation&&i.quaternion.fromArray(e.orientation),o&&e.position&&(t=this.el.sceneEl.renderer.xr.getStandingMatrix(),i.matrix.compose(i.position,i.quaternion,i.scale),i.matrix.multiplyMatrices(t,i.matrix),i.matrix.decompose(i.position,i.quaternion,i.scale)),i.rotateX(this.data.orientationOffset.x*a.Math.DEG2RAD),i.rotateY(this.data.orientationOffset.y*a.Math.DEG2RAD),i.rotateZ(this.data.orientationOffset.z*a.Math.DEG2RAD))},updateButtons:function(){var e,t,n=this.controller;if(n){for(t=0;tu)return l[n]=0,void(l[i]=0);var h=Math.pow(1/this.easing,60*e);0!==l[n]&&(l[n]=l[n]*h),0!==l[i]&&(l[i]=l[i]*h),Math.abs(l[n])=e.duration&&("VIDEO"===e.tagName&&(s.Cache.files[e.getAttribute("src")]=e),t())}e.addEventListener("loadeddata",r,!1),e.addEventListener("progress",r,!1),e.addEventListener("error",n,!1)}))}function h(e){var t=d(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function d(e){var t;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if(p(t)===window.location.host)return e}return c('Cross-origin element (e.g., ) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., )',t),e.crossOrigin="anonymous",e.cloneNode(!0)}function p(e){var t=e.indexOf("://")>-1?e.split("/")[2]:e.split("/")[0];return t.substring(0,t.indexOf(":"))}function f(e){var t=m(e),n=t.lastIndexOf(".");return n>=0&&".glb"===t.slice(n,e.search(/\?|#|$/))?"arraybuffer":"text"}function m(e){var t=document.createElement("a");t.href=e;var n=t.search.replace(/^\?/,""),r=e.replace(n,"").replace("?","");return r.substring(r.lastIndexOf("/")+1)}t.exports=a("a-assets",{prototype:Object.create(r.prototype,{createdCallback:{value:function(){this.isAssets=!0,this.fileLoader=l,this.timeout=null}},attachedCallback:{value:function(){var e,t,n,r,o,a,l=this,d=[];if(!this.parentNode.isScene)throw new Error(" must be a child of a .");for(o=this.querySelectorAll("img"),e=0;e did not contain exactly six elements each with a `src` attribute.")},writable:window.debug}})})},{"../utils/debug":201,"./a-register-element":130}],127:[function(e,t,n){var r,i=e("./a-node"),o=e("./component").components,a=e("./a-register-element").registerElement,s=e("../lib/three"),l=e("../utils/"),c=l.debug("core:a-entity:debug"),u=l.debug("core:a-entity:warn"),h="__",d=["position","rotation","scale","visible"],p={once:!0},f=Object.create(i.prototype,{createdCallback:{value:function(){this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new s.Group,this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}},attributeChangedCallback:{value:function(e,t,n){var r=this.components[e];r&&r.justInitialized&&""===n?delete r.justInitialized:(r||null!==n)&&this.setEntityAttribute(e,t,n)}},attachedCallback:{value:function(){var e,t=this.sceneEl,n=this;this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",(function(){n.load()})):this.load())}},detachedCallback:{value:function(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),i.prototype.detachedCallback.call(this),this.object3D.el=null)}}},getObject3D:{value:function(e){return this.object3DMap[e]}},setObject3D:{value:function(e,t){var n,r=this;if(!(t instanceof s.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(e))&&this.object3D.remove(n),t.el=this,t.children.length&&t.traverse((function(e){e.el=r})),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}},removeObject3D:{value:function(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):u("Tried to remove `Object3D` of type:",e,"which was not defined.")}},getOrCreateObject3D:{value:function(e,t){var n=this.getObject3D(e);return!n&&t&&(n=new t,this.setObject3D(e,n)),u("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}},add:{value:function(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}},addToParent:{value:function(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}},removeFromParent:{value:function(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}},load:{value:function(){var e=this;!this.hasLoaded&&this.parentEl&&i.prototype.load.call(this,(function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())}))},writable:window.debug},remove:{value:function(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}},getChildEntities:{value:function(){for(var e=this.children,t=[],n=0;n2?a.slice(1).join("__"):a[1],o[s]&&(m(this,e)||void 0!==t||n)&&!(e in this.components)){if(this.initComponentDependencies(s),i&&!o[s].multiple)throw new Error("Trying to initialize multiple components of type `"+s+"`. There can only be one component of this type per entity.");r=new o[s].Component(this,t,i),this.isPlaying&&r.play(),this.hasAttribute(e)||(r.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),c("Component initialized: %s",e)}},writable:window.debug},initComponentDependencies:{value:function(e){var t,n,r=this;if(o[e]&&(t=o[e].dependencies))for(n=0;n0?t.substring(0,u):t,!o[c])return"mixin"===t&&this.mixinUpdate(n),void i.prototype.setAttribute.call(this,t,n);if(!this.components[t]&&this.hasAttribute(t)&&this.updateComponent(t,window.HTMLElement.prototype.getAttribute.call(this,t)),"undefined"!==typeof r&&"string"===typeof n&&n.length>0&&"string"===typeof l.styleParser.parse(n)){for(d in e)delete e[d];(a=e)[n]=r,s=!1}else a=n,s=!0===r;this.updateComponent(t,a,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[t].flushToDOM()}}(),writable:window.debug},flushToDOM:{value:function(e){var t,n,r,i=this.components,o=this.children;for(r in i)i[r].flushToDOM();if(e)for(n=0;n outside of an A-Frame scene. Append this element to `` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)},writable:window.debug},attributeChangedCallback:{value:function(e,t,n){n!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(n,t))}},closestScene:{value:function(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}},closest:{value:function(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!t.call(n,e);)n=n.parentElement;return n}},detachedCallback:{value:function(){this.hasLoaded=!1}},load:{value:function(e,t){var n,r=this;this.hasLoaded||(t=t||i,n=this.getChildren().filter(t).map((function(e){return new Promise((function(t){if(e.hasLoaded)return t();e.addEventListener("loaded",t)}))})),Promise.all(n).then((function(){r.hasLoaded=!0,e&&e(),r.emit("loaded",void 0,!1)})).catch((function(e){s("Failure loading node: ",e)})))},writable:!0},getChildren:{value:function(){return Array.prototype.slice.call(this.children,0)}},updateMixins:{value:function(){var e=[],t=[],n={};return function(r,i){var a,s,l;for(e.length=0,t.length=0,s=r?o.split(r.trim(),/\s+/):e,l=i?o.split(i.trim(),/\s+/):t,n.newMixinIds=s,n.oldMixinIds=l,a=0;a tag after the scene. Component