@openmockup-studio/player 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -5
- package/dist/{device-laptop-abUqnCPB.js → device-laptop-DlKLhrO9.js} +1 -1
- package/dist/{device-monitor-DRfsMb1A.js → device-monitor-BkXp8a-n.js} +1 -1
- package/dist/{device-phone-D__ngcPt.js → device-phone-DxWL5LkW.js} +337 -328
- package/dist/{device-tablet-C89f1GUw.js → device-tablet-B1JOR7Rf.js} +1 -1
- package/dist/{device-watch-PwEcwA3q.js → device-watch-9Y7wuyPn.js} +1 -1
- package/dist/embed.iife.js +56 -56
- package/dist/embed.js +7 -4
- package/dist/{runtime-D-Di0bkW.js → runtime-RiyRiexX.js} +224 -215
- package/package.json +1 -1
package/dist/embed.iife.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i=(e,t)=>e===null?t:e!==`false`&&e!==`0`,a=e=>e===null||e===``||Number.isNaN(Number(e))?void 0:Number(e);function o(e){let t=t=>e.getAttribute(t),n={},r={},o=t(`trigger`);if(o&&o!==`scene`){let e={load:`load`,click:`click`,hover:`hover`,scroll:`scroll`,inview:`in-view`,"in-view":`in-view`,mousemove:`cursor-move`,"cursor-move":`cursor-move`,none:`none`}[o];e&&(n.trigger=e)}let s=t(`trigger-loop`);s!==null&&(n.loop=s===`pingpong`?`pingpong`:i(s,!0)?`loop`:`none`);let c=a(t(`trigger-delay`));c!==void 0&&(n.delay=c/1e3);let l=a(t(`trigger-speed`));l!==void 0&&(n.speed=l),i(t(`cursor-enabled`),!0)||(r.follow=0);let u=a(t(`cursor-amount`));u!==void 0&&(r.follow=u/100);let d=t(`cursor-mode`);(d===`device`||d===`camera`)&&(r.mode=d);let f=a(t(`zoom-amount`));f!==void 0&&i(t(`zoom-enabled`),!0)&&(t(`zoom-mode`)===`dolly`?r.dolly=f/100:r.zoom=f/100);let p=a(t(`shake-intensity`));p!==void 0&&i(t(`shake-enabled`),!0)&&(r.shake=p/100),Object.keys(r).length&&(n.cursor=r);let m=navigator.connection,h=!!m?.saveData||/(^|-)2g$/.test(m?.effectiveType??``);return{src:t(`src`),mockupId:t(`mockup-id`)??t(`uid`),base:t(`base`)??``,poster:t(`poster`),loader:i(t(`loader`),!1),progressive:i(t(`progressive`),!0),lowBandwidth:t(`low-bandwidth`)===null?h:i(t(`low-bandwidth`),h),theme:t(`theme`)===`dark`?`dark`:`light`,overrides:n}}function s(e){return e.src?e.src:e.mockupId?`${e.base.replace(/\/$/,``)}/${e.mockupId}/project.json`:null}var c=n((()=>{}));function l(e,t,n=`cover`,r=[.5,.5]){if(n===`stretch`)return{repeat:[1,1],offset:[0,0]};let i=e>t;if(n===`cover`?i:!i){let n=t/e;return{repeat:[n,1],offset:[(1-n)*r[0],0]}}let a=e/t;return{repeat:[1,a],offset:[0,(1-a)*r[1]]}}function u(e){if(!e)return[.5,.5];let t=e=>Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5;return[t(e[0]),t(e[1])]}var d=n((()=>{})),f=n((()=>{}));function p(e=``){let t=typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return e?`${e}_${t.slice(0,8)}`:t}var m=n((()=>{}));function h(e,t,n,r){if(e===t&&n===r)return y.linear;let i=new Float64Array(b);for(let t=0;t<b;t++)i[t]=T(t*x,e,n);let a=t=>{let r=0,a=1;for(;a<10&&(i[a]??1)<=t;a++)r+=x;a--;let o=i[a]??0,s=i[a+1]??1,c=(t-o)/(s-o||1),l=r+c*x,u=E(l,e,n);if(u>=.001){for(let r=0;r<4;r++){let r=E(l,e,n);if(r===0)return l;l-=(T(l,e,n)-t)/r}return l}if(u===0)return l;let d=r,f=r+x;for(let r=0;r<10;r++){l=d+(f-d)/2;let r=T(l,e,n)-t;if(Math.abs(r)<1e-7)break;r>0?f=l:d=l}return l};return e=>e<=0?0:e>=1?1:T(a(e),t,r)}function g(e){if(typeof e==`string`)return y[e]??y.linear;let t=e.bezier.join(`,`),n=D.get(t);return n||(n=h(...e.bezier),D.set(t,n)),n}var _,v,y,b,x,S,C,w,T,E,D,O=n((()=>{_=1.70158,v=2.70158,y={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInOutCubic:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,easeOutExpo:e=>e>=1?1:1-2**(-10*e),easeOutBack:e=>1+v*(e-1)**3+_*(e-1)**2,easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2},Object.keys(y),b=11,x=1/10,S=(e,t)=>1-3*t+3*e,C=(e,t)=>3*t-6*e,w=e=>3*e,T=(e,t,n)=>((S(t,n)*e+C(t,n))*e+w(t))*e,E=(e,t,n)=>3*S(t,n)*e*e+2*C(t,n)*e+w(t),D=new Map}));function k(e){return{duration:e.duration,fps:e.fps,tracks:e.tracks.filter(e=>e.keys.length>0).map(A)}}function A(e){let t=[...e.keys].sort((e,t)=>e.t-t.t);return{target:e.target,type:e.type,times:Float64Array.from(t,e=>e.t),values:t.map(e=>e.value),easings:t.map(e=>g(e.easing)),holds:t.map(e=>e.interpolation===`hold`)}}function j(e,t){let n=0,r=e.length-1;if(t<(e[0]??0))return-1;for(;n<r;){let i=n+r+1>>1;(e[i]??1/0)<=t?n=i:r=i-1}return n}function M(e,t){let{times:n,values:r}=e,i=n.length-1,a=j(n,t);if(a<0)return r[0];if(a>=i)return r[i];let o=r[a];if(e.holds[a])return o;let s=r[a+1],c=n[a]??0,l=(n[a+1]??c)-c;return P(o,s,l>0?(e.easings[a]??(e=>e))((t-c)/l):1,e.type)}function N(e,t){let n=new Map;for(let r of e.tracks)n.set(r.target,{value:M(r,t)});return n}function P(e,t,n,r){return r===`number`&&typeof e==`number`&&typeof t==`number`?e+(t-e)*n:r===`vec3`&&Array.isArray(e)&&Array.isArray(t)?F(e,t,n):r===`color`&&typeof e==`string`&&typeof t==`string`?I(e,t,n):n<1?e:t}function F(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function I(e,t,n){let r=ee(e),i=ee(t);if(!r||!i)return n<1?e:t;let a=e=>Math.round((r[e]??0)+((i[e]??0)-(r[e]??0))*n);return`#${[a(0),a(1),a(2)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function ee(e){let t=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!t||!t[1])return null;let n=parseInt(t[1],16);return[n>>16&255,n>>8&255,n&255]}var te=n((()=>{O()}));function ne(e,t){let{scene:n}=e,r={};for(let e of n.devices)r[e.id]={position:ie(e.transform.position),rotation:ie(e.transform.rotation),scale:e.transform.scale,params:{...e.params},screenFinish:e.screenFinish,glare:e.glare,visible:!0};let i={};for(let e of n.screens){let n=e.video,r=0;if(n){r=Math.max(0,(t-n.start)*n.playbackRate);let i=e.media&&`duration`in e.media?e.media.duration:void 0;n.loop&&i&&i>0&&(r%=i)}i[e.id]={mediaTime:r,opacity:1}}return{time:t,camera:{position:ie(n.camera.position),target:ie(n.camera.target),fov:n.camera.fov,roll:n.camera.roll,lens:{...n.camera.lens}},devices:r,screens:i,environment:{preset:n.environment.preset,intensity:n.environment.intensity,rotation:n.environment.rotation,glow:n.environment.glow},backdrop:{...n.backdrop},floor:{y:n.floor.mode===`fixed`?n.floor.y??0:null,shadow:n.floor.shadow},set:{...n.set}}}function re(e,t){for(let[n,r]of t){let t=n.split(`.`),[i]=t;if(i===`camera`)L(e.camera,t.slice(1),r.value,r.add);else if(i===`environment`)L(e.environment,t.slice(1),r.value,r.add);else if(i===`backdrop`)L(e.backdrop,t.slice(1),r.value,r.add);else if(i===`set`)L(e.set,t.slice(1),r.value,r.add);else if(i===`devices`||i===`screens`){let n=t[1],a=i===`devices`?e.devices:e.screens,o=n?a[n]:void 0;o&&L(o,t.slice(2),r.value,r.add)}}return e}function L(e,t,n,r){let i=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(!n)return;let r=i[n];typeof r==`object`&&r||(r={},i[n]=r),i=r}let a=t[t.length-1];if(!a)return;let o=i[a];r?typeof o==`number`&&typeof n==`number`?i[a]=o+n:Array.isArray(o)&&Array.isArray(n)&&(i[a]=o.map((e,t)=>typeof e==`number`?e+(n[t]??0):e)):i[a]=Array.isArray(n)?[...n]:n}function R(e,t,n=[],r=k(e.timeline)){let i=ne(e,t);re(i,N(r,t));for(let e of n)re(i,e);return i}var ie,ae=n((()=>{te(),ie=e=>[e[0],e[1],e[2]]}));function oe(e,t,n){let r=new Map;if(t<=0)return r;let i=Math.sin(e*.9)*.3*t,a=Math.sin(e*.6)*1.7*t,o=Math.sin(e*.45+1)*2.9*t;for(let e of n)r.set(`devices.${e}.position`,{value:[0,i,0],add:!0}),r.set(`devices.${e}.rotation`,{value:[a,o,0],add:!0});return r}var se=n((()=>{}));function ce(e,t,n){let r=new Set(n),i=e.timeline.tracks.filter(e=>{let t=e.target.split(`.`)[1];return!(e.target.startsWith(`devices.`)&&t&&r.has(t))&&!e.target.startsWith(`camera.`)}),a=[];for(let e of t.timeline.tracks){let t=le.exec(e.target),r=e.target;if(t&&t[1]!==void 0){let i=n[Number(t[1])];if(!i)continue;r=e.target.replace(le,`devices.${i}.`)}a.push({...e,id:p(`trk`),target:r,keys:e.keys.map(e=>({...e}))})}return{...e,scene:{...e.scene,camera:t.camera?{...e.scene.camera,...t.camera}:e.scene.camera},timeline:{...e.timeline,duration:t.timeline.duration,tracks:[...i,...a]},interaction:t.interaction?{...e.interaction,...t.interaction}:e.interaction}}var le,ue=n((()=>{m(),le=/^devices\.\$(\d+)\./}));function de(e){return!e&&!Le?Re:{lang:e?.lang??Le?.lang,message:e?.message,abortEarly:e?.abortEarly??Le?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Le?.abortPipeEarly}}function fe(e){return ze?.get(e)}function pe(e){return Be?.get(e)}function me(e,t){return Ve?.get(e)?.get(t)}function he(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function ge(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??he(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??me(e.reference,c.lang)??(l?pe(c.lang):null)??r.message??fe(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function _e(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ve(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function z(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}function ye(e){return e[`~standard`]={version:1,vendor:`valibot`,validate:t=>e[`~run`]({value:t},de())},e}function be(e,t){return{kind:`validation`,type:`max_value`,reference:be,async:!1,expects:`<=${e instanceof Date?e.toJSON():he(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value<=this.requirement)&&ge(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():he(e.value)}),e}}}function xe(e,t){return{kind:`validation`,type:`min_value`,reference:xe,async:!1,expects:`>=${e instanceof Date?e.toJSON():he(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value>=this.requirement)&&ge(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():he(e.value)}),e}}}function B(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Se(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function V(e,t){return ye({kind:`schema`,type:`array`,reference:V,expects:`Array`,async:!1,item:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else ge(this,`type`,e,t);return e}})}function Ce(e){return ye({kind:`schema`,type:`boolean`,reference:Ce,expects:`boolean`,async:!1,message:e,"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:ge(this,`type`,e,t),e}})}function we(e,t){return ye({kind:`schema`,type:`literal`,reference:we,expects:he(e),async:!1,literal:e,message:t,"~run"(e,t){return _e(e.value,this.literal)?e.typed=!0:ge(this,`type`,e,t),e}})}function Te(e,t){return ye({kind:`schema`,type:`loose_object`,reference:Te,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Se(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=B(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(ge(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(let t in n)ve(n,t)&&!Object.prototype.hasOwnProperty.call(this.entries,t)&&(e.value[t]=n[t])}else ge(this,`type`,e,t);return e}})}function Ee(e,t){return ye({kind:`schema`,type:`nullable`,reference:Ee,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===null&&(this.default!==void 0&&(e.value=Se(this,e,t)),e.value===null)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}function H(e){return ye({kind:`schema`,type:`number`,reference:H,expects:`number`,async:!1,message:e,"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:ge(this,`type`,e,t),e}})}function De(e,t){return ye({kind:`schema`,type:`object`,reference:De,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Se(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=B(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(ge(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else ge(this,`type`,e,t);return e}})}function U(e,t){return ye({kind:`schema`,type:`optional`,reference:U,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Se(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}function Oe(e,t){return ye({kind:`schema`,type:`picklist`,reference:Oe,expects:z(e.map(he),`|`),async:!1,options:e,message:t,"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:ge(this,`type`,e,t),e}})}function ke(e,t,n){return ye({kind:`schema`,type:`record`,reference:ke,expects:`Object`,async:!1,key:e,value:t,message:n,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(ve(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}a.typed&&o.typed||(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else ge(this,`type`,e,t);return e}})}function W(e){return ye({kind:`schema`,type:`string`,reference:W,expects:`string`,async:!1,message:e,"~run"(e,t){return typeof e.value==`string`?e.typed=!0:ge(this,`type`,e,t),e}})}function Ae(e,t){return ye({kind:`schema`,type:`tuple`,reference:Ae,expects:`Array`,async:!1,items:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<this.items.length;r++){let i=n[r],a=this.items[r][`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else ge(this,`type`,e,t);return e}})}function je(e){let t;if(e)for(let n of e)if(t)for(let e of n.issues)t.push(e);else t=n.issues;return t}function Me(e,t){return ye({kind:`schema`,type:`union`,reference:Me,expects:z(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed){if(o.issues)r?r.push(o):r=[o];else{n=o;break}}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];ge(this,`type`,e,t,{issues:je(r)}),e.typed=!0}else if(i?.length===1)return i[0];else ge(this,`type`,e,t,{issues:je(i)});return e}})}function Ne(){return ye({kind:`schema`,type:`unknown`,reference:Ne,expects:`unknown`,async:!1,"~run"(e){return e.typed=!0,e}})}function Pe(e,t,n){return ye({kind:`schema`,type:`variant`,reference:Pe,expects:`Object`,async:!1,key:e,options:t,message:n,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},Ue).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;ge(this,`type`,e,t,{input:n[a],expected:z(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else ge(this,`type`,e,t);return e}})}function Fe(e,t,n){let r=e[`~run`]({value:t},de(n));if(r.issues)throw new He(r.issues);return r.value}function Ie(...e){return ye({...e[0],pipe:e,"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=r[`~run`](t,n))}return t}})}var Le,Re,ze,Be,Ve,He,Ue,We=n((()=>{Re={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0},He=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}},Ue={abortEarly:!0}}));function Ge(e){return Fe(mt,e)}var Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht=n((()=>{We(),f(),m(),Ke=Ae([H(),H()]),qe=Ae([H(),H(),H()]),Je=Ie(H(),xe(0),be(1)),Ye=De({label:W(),frame:W(),back:W(),frameRoughness:Je,backMaterial:U(Oe([`glass`,`metal`,`ceramic`])),accent:U(W())}),Xe=Pe(`source`,[De({kind:Oe([`image`,`video`]),source:we(`idb`),id:W(),hash:W(),mime:W(),width:H(),height:H(),duration:U(H())}),De({kind:Oe([`image`,`video`]),source:we(`url`),url:W(),width:U(H()),height:U(H()),duration:U(H())}),De({kind:we(`image`),source:we(`data`),dataUrl:W(),width:H(),height:H()})]),Ze=De({position:U(qe,()=>[0,0,0]),rotation:U(qe,()=>[0,0,0]),scale:U(H(),1)}),Qe=Te({id:W(),type:Oe([`phone`,`tablet`,`laptop`,`monitor`,`watch`]),spec:W(),finish:Me([W(),Ye]),params:U(ke(W(),H()),()=>({})),transform:U(Ze,()=>({position:[0,0,0],rotation:[0,0,0],scale:1})),screenFinish:U(Oe([`clean`,`glossy`,`matte`]),`matte`),glare:U(Je,1),screens:U(V(W()),()=>[])}),$e=Te({id:W(),media:U(Ee(Xe),null),fit:U(Oe([`cover`,`contain`,`stretch`]),`cover`),offset:U(Ke),video:U(De({start:U(H(),0),loop:U(Ce(),!0),muted:U(we(!0),!0),playbackRate:U(H(),1)})),poster:U(W())}),et=De({fisheye:U(H(),0),chromatic:U(H(),0),vignette:U(H(),0),bloom:U(H(),0),grain:U(H(),0),blur:U(H(),0),focus:U(H(),0),fade:U(H(),0)}),tt=Te({position:U(qe,()=>[0,1.5,48]),target:U(qe,()=>[0,0,0]),fov:U(H(),28),roll:U(H(),0),lens:U(et,()=>Fe(et,{}))}),nt=Te({preset:U(Oe([`studio`,`soft`,`contrast`,`night`]),`studio`),intensity:U(H(),1),rotation:U(H(),0),glow:U(H(),0)}),rt=Te({kind:U(Oe([`none`,`crevice`,`block`]),`none`),seed:U(H(),1),color:U(W(),`#3a3b40`)}),it=Te({kind:U(Oe([`transparent`,`solid`,`gradient`,`image`]),`gradient`),color:U(W()),inner:U(W()),outer:U(W()),angle:U(H()),image:U(Xe),tone:U(Oe([`light`,`dark`]),`light`)}),at=Te({mode:U(Oe([`auto`,`fixed`]),`auto`),y:U(H()),shadow:U(Je,.22)}),ot=Oe([`linear`,`easeInQuad`,`easeOutQuad`,`easeInOutQuad`,`easeInOutCubic`,`easeOutExpo`,`easeOutBack`,`easeInOutSine`]),st=Me([ot,De({bezier:Ae([H(),H(),H(),H()])})]),ct=De({id:U(W()),t:H(),value:Me([H(),qe,W()]),easing:U(st,`easeInOutCubic`),interpolation:U(Oe([`smooth`,`hold`]))}),lt=Te({id:W(),target:W(),type:Oe([`number`,`vec3`,`color`]),keys:U(V(ct),()=>[])}),ut=Te({duration:U(Ie(H(),xe(.1)),4),fps:U(H(),30),tracks:U(V(lt),()=>[]),markers:U(V(De({t:H(),label:W()})))}),dt=Te({trigger:U(Oe([`none`,`load`,`click`,`hover`,`scroll`,`in-view`,`cursor-move`]),`load`),loop:U(Oe([`none`,`loop`,`pingpong`]),`loop`),delay:U(H(),0),speed:U(H(),1),scroll:U(De({start:U(Oe([`enter`,`top`]),`enter`),end:U(Oe([`leave`,`bottom`]),`leave`),smoothing:U(H(),6)})),hover:U(De({reverseOnLeave:U(Ce(),!0)})),cursor:U(De({mode:U(Oe([`device`,`camera`]),`device`),follow:U(H(),0),zoom:U(H(),0),dolly:U(H(),0),shake:U(H(),0),smoothing:U(H(),5)}),()=>({mode:`device`,follow:0,zoom:0,dolly:0,shake:0,smoothing:5})),idle:U(De({float:U(H(),1)}),()=>({float:1}))}),ft=Te({width:U(H(),1920),height:U(H(),1080),fps:U(Oe([24,30,60]),30),range:U(Ae([H(),H()]),()=>[0,4]),format:U(Oe([`png`,`mp4`,`webm`,`webm-alpha`,`png-sequence`]),`mp4`),codec:U(Oe([`auto`,`avc`,`hevc`,`vp9`,`av1`]),`auto`),quality:U(Oe([`draft`,`standard`,`high`]),`standard`),transparent:U(Ce(),!1),includeIdleMotion:U(Ce(),!0)}),pt=Te({devices:U(V(Qe),()=>[]),screens:U(V($e),()=>[]),camera:U(tt,()=>Fe(tt,{})),environment:U(nt,()=>Fe(nt,{})),backdrop:U(it,()=>Fe(it,{})),floor:U(at,()=>Fe(at,{})),set:U(rt,()=>Fe(rt,{}))}),mt=Te({schemaVersion:U(we(1),1),id:U(W(),()=>p()),name:U(W(),`Untitled`),createdAt:U(W(),()=>new Date().toISOString()),updatedAt:U(W(),()=>new Date().toISOString()),scene:U(pt,()=>Fe(pt,{})),timeline:U(ut,()=>Fe(ut,{})),interaction:U(dt,()=>Fe(dt,{})),export:U(ft,()=>Fe(ft,{})),meta:U(ke(W(),Ne()))})}));function gt({name:e=`Untitled`,device:t}={}){let n=[],r=[];if(t){let e=p(`scr`);r.push({id:e}),n.push({id:p(`dev`),type:t.type,spec:t.spec,finish:t.finish,transform:{position:[0,0,0],rotation:[...vt],scale:1},..._t,screens:[e]})}return Ge({name:e,scene:{devices:n,screens:r}})}var _t,vt,yt=n((()=>{m(),ht(),_t={screenFinish:`glossy`,glare:.5},vt=[3.4,-24.1,2.3]}));function bt(e){let t=[];return e.rotation&&t.push({id:`${e.id}.rotation`,target:`devices.$0.rotation`,type:`vec3`,keys:e.rotation}),e.position&&t.push({id:`${e.id}.position`,target:`devices.$0.position`,type:`vec3`,keys:e.position}),e.scale&&t.push({id:`${e.id}.scale`,target:`devices.$0.scale`,type:`number`,keys:e.scale}),e.fov&&t.push({id:`${e.id}.fov`,target:`camera.fov`,type:`number`,keys:e.fov}),e.id===`preset.lid-open`&&t.push({id:`${e.id}.lid`,target:`devices.$0.params.lidAngle`,type:`number`,keys:[xt(0,2,`easeInOutCubic`),xt(2.2,110,St),xt(3.5,110,`linear`)]}),{id:e.id,name:e.name,tags:e.tags,slots:1,timeline:{duration:e.duration,fps:30,tracks:t}}}var xt,St,Ct,wt,Tt=n((()=>{yt(),xt=(e,t,n=`easeInOutCubic`)=>({t:e,value:t,easing:n}),St={bezier:[.4,0,.2,1]},Ct=[{id:`preset.turn`,name:`Turn`,tags:[`phone`,`tablet`,`watch`],duration:4,rotation:[xt(0,[3.4,-24.1,2.3]),xt(2,[-8,28,-4]),xt(4,[3.4,-24.1,2.3],`linear`)]},{id:`preset.push-in`,name:`Camera push-in`,tags:[`phone`,`tablet`,`watch`,`laptop`,`monitor`],duration:4,fov:[xt(0,28,St),xt(2.4,20,St),xt(4,28,`linear`)]},{id:`preset.rise`,name:`Rise`,tags:[`phone`,`tablet`,`watch`],duration:3,position:[xt(0,[0,-6,0],`easeOutExpo`),xt(1.4,[0,0,0],St),xt(3,[0,0,0],`linear`)],rotation:[xt(0,[-30,-40,0],`easeOutExpo`),xt(1.4,vt,St),xt(3,vt,`linear`)]},{id:`preset.flip`,name:`Spin`,tags:[`phone`,`tablet`,`watch`],duration:4,rotation:[xt(0,[0,-20,0]),xt(2,[0,160,0]),xt(4,[0,340,0],`linear`)]},{id:`preset.sway`,name:`Sway`,tags:[`phone`,`tablet`,`watch`],duration:5,rotation:[xt(0,[2,-18,1],`easeInOutSine`),xt(2.5,[-2,18,-1],`easeInOutSine`),xt(5,[2,-18,1],`linear`)],position:[xt(0,[-.6,0,0],`easeInOutSine`),xt(2.5,[.6,0,0],`easeInOutSine`),xt(5,[-.6,0,0],`linear`)]},{id:`preset.zoom-out`,name:`Reveal`,tags:[`phone`,`tablet`,`watch`,`laptop`,`monitor`],duration:3,scale:[xt(0,1.35,`easeOutExpo`),xt(1.6,1,St),xt(3,1,`linear`)],fov:[xt(0,22,`easeOutExpo`),xt(1.6,28,St),xt(3,28,`linear`)]},{id:`preset.lid-open`,name:`Lid opens`,tags:[`laptop`],duration:3.5,position:[xt(0,[0,0,0])]},{id:`preset.orbit`,name:`Swing`,tags:[`laptop`,`monitor`],duration:5,rotation:[xt(0,[0,-28,0],`easeInOutSine`),xt(2.5,[0,28,0],`easeInOutSine`),xt(5,[0,-28,0],`linear`)]}],wt=Ct.map(bt)}));function Et(e,t){return Math.sin(e*13.1+t)*.5+Math.sin(e*7.3+t*1.7)*.3+Math.sin(e*23.7+t*.4)*.2}function Dt(e,t,n,r,i){let a=new Map,{follow:o,zoom:s,dolly:c,shake:l,mode:u}=t;if(o<=0&&s<=0&&c<=0&&l<=0)return a;let d=Ft(jt(i.target,i.position)),f=Ft(It(d,[0,1,0])),p=It(f,d),m=[0,0,0],h=0;if(o>0){if(u===`device`)for(let t of r)a.set(`devices.${t}.rotation`,{value:[-e.y*o*10,e.x*o*16,0],add:!0});else{let t=Pt(jt(i.target,i.position))*.12*o;Ot(m,Nt(f,e.x*t)),Ot(m,Nt(p,e.y*t*.6))}}if(s>0){let t=1-Math.min(1,Math.hypot(e.x,e.y));h-=s*10*t}if(c>0){let t=Pt(jt(i.target,i.position));Ot(m,Nt(d,e.y*c*t*.15))}if(l>0){let t=l*Math.min(1,e.speed);for(let e of r){let r=a.get(`devices.${e}.rotation`)?.value,i=[Et(n,1)*2*t,Et(n,2)*2*t,Et(n,3)*1*t];a.set(`devices.${e}.rotation`,{value:r?Mt(r,i):i,add:!0})}Ot(m,[Et(n,4)*.2*t,Et(n,5)*.2*t,0])}return(m[0]||m[1]||m[2])&&a.set(`camera.position`,{value:m,add:!0}),h&&a.set(`camera.fov`,{value:h,add:!0}),a}function Ot(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function kt(e,t,n,r){let i=1-Math.exp(-n*r);return{x:e.x+(t.x-e.x)*i,y:e.y+(t.y-e.y)*i,speed:e.speed+(t.speed-e.speed)*Math.min(1,i*2)}}var At,jt,Mt,Nt,Pt,Ft,It,Lt=n((()=>{At={x:0,y:0,speed:0},jt=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],Mt=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],Nt=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],Pt=e=>Math.hypot(e[0],e[1],e[2]),Ft=e=>{let t=Pt(e)||1;return[e[0]/t,e[1]/t,e[2]/t]},It=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}));function Rt(e){let t=gt({name:e.name,device:e.device}),n=t.scene.devices[0];n&&(e.device.type===`laptop`||e.device.type===`monitor`?(n.transform.rotation=e.rotation??[0,0,0],t.interaction.idle.float=0):e.rotation&&(n.transform.rotation=e.rotation)),t.scene.backdrop={...e.backdrop},e.shadow!==void 0&&(t.scene.floor.shadow=e.shadow),e.camera&&(t.scene.camera={...t.scene.camera,...e.camera});let[r,i]=qt[e.aspect];t.export.width=r,t.export.height=i,e.environment&&(t.scene.environment={...t.scene.environment,...e.environment}),e.lens&&(t.scene.camera.lens={...t.scene.camera.lens,...e.lens}),e.set&&(t.scene.set={...e.set}),e.float!==void 0&&(t.interaction.idle.float=e.float),e.timeline&&n&&(t.timeline={...t.timeline,duration:e.timeline.duration,tracks:e.timeline.tracks.map(e=>({...e,target:e.target.replace(`$0`,n.id),keys:e.keys.map(e=>({...e}))}))}),e.cursor&&(t.interaction.cursor={...t.interaction.cursor,...e.cursor}),e.trigger&&(t.interaction.trigger=e.trigger);let a=e.preset?wt.find(t=>t.id===e.preset):void 0;if(a&&n){let e=t.scene.camera;t=ce(t,a,[n.id]),t.scene.camera={...e,lens:e.lens}}return t.export.range=[0,t.timeline.duration],{id:e.id,name:e.name,description:e.description,tags:[e.device.type],aspect:e.aspect,doc:t}}var G,zt,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt=n((()=>{ue(),Tt(),yt(),G=(e,t,n=`easeInOutCubic`)=>({t:e,value:t,easing:n}),zt={bezier:[.45,0,.85,.6]},Bt={bezier:[.15,.4,.3,1]},Vt={bezier:[.4,0,.2,1]},Ht={duration:10,tracks:[{id:`crevice.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[-26,8,74],Vt),G(1.6,[1,1.5,46],zt),G(2.5,[5.5,-4.5,21],Bt),G(5.4,[3,-2.5,18.5],Vt),G(6.5,[-4.5,3.5,24],`linear`),G(8.3,[-4.5,-3.5,24],Vt),G(9.5,[0,.5,46],`linear`),G(10,[0,.5,47],`linear`)]},{id:`crevice.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[0,1.5,0],Vt),G(1.6,[0,1,0],zt),G(2.5,[0,5,0],Bt),G(5.4,[0,4.5,0],Vt),G(6.5,[0,2.5,0],`linear`),G(8.3,[0,-3.5,0],Vt),G(9.5,[0,.5,0],`linear`),G(10,[0,.5,0],`linear`)]},{id:`crevice.camera.fov`,target:`camera.fov`,type:`number`,keys:[G(0,26,Vt),G(1.6,28,zt),G(2.5,36,Bt),G(5.4,35,Vt),G(6.5,32,`linear`),G(8.3,32,Vt),G(9.5,28,`linear`),G(10,28,`linear`)]},{id:`crevice.camera.roll`,target:`camera.roll`,type:`number`,keys:[G(0,3,Vt),G(1.6,0,zt),G(2.5,-7,Bt),G(5.4,-5,Vt),G(6.5,2,`linear`),G(8.3,2,Vt),G(9.5,0,`linear`),G(10,0,`linear`)]},{id:`crevice.camera.fade`,target:`camera.lens.fade`,type:`number`,keys:[G(0,1,`easeOutQuad`),G(.8,0,`linear`),G(9.6,0,`easeInQuad`),G(10,1,`linear`)]}]},Ut={bezier:[.3,0,.12,1]},Wt={duration:6,tracks:[{id:`block.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[-11,-.6,30],Ut),G(3.2,[-31,-7.3,62],`easeInOutSine`),G(6,[-30,-7,60],`linear`)]},{id:`block.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[3,.8,4],Ut),G(3.2,[3,7.8,2],`easeInOutSine`),G(6,[3,8,2],`linear`)]},{id:`block.lid`,target:`devices.$0.params.lidAngle`,type:`number`,keys:[G(0,2,`linear`),G(.35,2,Vt),G(2.7,100,`linear`),G(6,100,`linear`)]}]},Gt={duration:7,tracks:[{id:`push.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[-4,2,41],`linear`),G(.4,[-4,2,41],Vt),G(2.8,[9.4,-9.6,13.3],Bt),G(6.4,[8.8,-9.8,12.4],`linear`),G(7,[8.8,-9.8,12.4],`linear`)]},{id:`push.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[0,0,0],`linear`),G(.4,[0,0,0],Vt),G(2.8,[0,-3,0],Bt),G(6.4,[0,-3.4,0],`linear`),G(7,[0,-3.4,0],`linear`)]},{id:`push.camera.fov`,target:`camera.fov`,type:`number`,keys:[G(0,28,`linear`),G(.4,28,Vt),G(2.8,34,Bt),G(7,34,`linear`)]},{id:`push.camera.roll`,target:`camera.roll`,type:`number`,keys:[G(0,0,`linear`),G(.4,0,Vt),G(2.8,-9,Bt),G(6.4,-10,`linear`),G(7,-10,`linear`)]},{id:`push.camera.fade`,target:`camera.lens.fade`,type:`number`,keys:[G(0,0,`linear`),G(6.4,0,`easeInQuad`),G(6.95,1,`linear`),G(7,1,`linear`)]}]},Kt={duration:10,tracks:[{id:`sweep.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[4.5,.5,11],`linear`),G(.6,[4.5,.5,11],Vt),G(4,[3,1.5,10.5],Vt),G(5.4,[-1.5,-7.5,12.5],Bt),G(7.4,[-2,-8,12],`linear`),G(10,[-2,-8,12],`linear`)]},{id:`sweep.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[0,5.2,0],`linear`),G(.6,[0,5.2,0],Vt),G(4,[.3,4.6,0],Vt),G(5.4,[0,-3.8,0],Bt),G(7.4,[0,-4.2,0],`linear`),G(10,[0,-4.2,0],`linear`)]},{id:`sweep.camera.fov`,target:`camera.fov`,type:`number`,keys:[G(0,36,`linear`),G(10,36,`linear`)]},{id:`sweep.camera.roll`,target:`camera.roll`,type:`number`,keys:[G(0,14,`linear`),G(.6,14,Vt),G(4,10,Vt),G(5.4,-6,Bt),G(7.4,-8,`linear`),G(10,-8,`linear`)]},{id:`sweep.camera.fade`,target:`camera.lens.fade`,type:`number`,keys:[G(0,1,`easeOutQuad`),G(.9,0,`linear`),G(7.4,0,`easeInQuad`),G(8.2,1,`linear`),G(10,1,`linear`)]}]},qt={"16:9":[1920,1080],"9:16":[1080,1920],"1:1":[1080,1080],"4:3":[1440,1080]},Jt=[{id:`tpl.iphone-crevice`,name:`Stone crevice`,description:`An iPhone wedged between dark rocks, lit by its own screen. Push-in, close pass, pull back.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},backdrop:{kind:`solid`,color:`#030304`,tone:`dark`},shadow:0,aspect:`16:9`,rotation:[0,-6,0],float:0,cursor:{mode:`camera`,follow:.25},environment:{preset:`night`,intensity:1,glow:1.6},lens:{vignette:.45,bloom:.3,grain:.2,blur:.08},set:{kind:`crevice`,seed:3,color:`#3d3d40`},timeline:Ht},{id:`tpl.iphone-push`,name:`Grey push-in`,description:`An iPhone standing on grey. The camera swings round and closes in on the lower screen, then fades through black.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},backdrop:{kind:`solid`,color:`#cccccc`,tone:`light`},shadow:0,aspect:`4:3`,rotation:[0,0,0],float:0,cursor:{mode:`camera`,follow:.25},environment:{preset:`studio`,intensity:1},timeline:Gt},{id:`tpl.iphone-night-sweep`,name:`Night sweep`,description:`An iPhone in the dark, lit along its rim. The camera rises out of black, sweeps down the screen and fades away.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},backdrop:{kind:`solid`,color:`#000000`,tone:`dark`},shadow:0,aspect:`4:3`,rotation:[0,0,0],float:0,cursor:{mode:`camera`,follow:.25},environment:{preset:`night`,intensity:1,glow:1.2},lens:{vignette:.3,grain:.1},timeline:Kt},{id:`tpl.iphone-turn`,name:`iPhone turn`,description:`A slow turn with a camera push-in. The classic hero shot.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},preset:`preset.turn`,backdrop:{kind:`gradient`,inner:`#f6f6f4`,outer:`#d5d5d1`,tone:`light`},aspect:`16:9`,cursor:{follow:.6}},{id:`tpl.iphone-reel`,name:`iPhone reel`,description:`Vertical, dark, rises into frame. Made for Reels and Shorts.`,device:{type:`phone`,spec:`phone.iphone-18-pro-max`,finish:`burgundy`},preset:`preset.rise`,backdrop:{kind:`gradient`,inner:`#2c2f39`,outer:`#0b0c10`,tone:`dark`},shadow:.5,aspect:`9:16`,camera:{position:[0,1.5,62],fov:26}},{id:`tpl.ipad-sway`,name:`iPad sway`,description:`A gentle sway on a warm backdrop for app showcases.`,device:{type:`tablet`,spec:`tablet.ipad-pro-13`,finish:`silver`},preset:`preset.sway`,backdrop:{kind:`gradient`,inner:`#fbf0e6`,outer:`#dfc2a8`,tone:`light`},aspect:`16:9`,camera:{position:[0,2,78],fov:28}},{id:`tpl.macbook-block`,name:`Concrete block`,description:`A MacBook on the corner of a concrete block. The lid opens as the camera cranes down, then holds.`,device:{type:`laptop`,spec:`laptop.macbook-pro-14`,finish:`space-black`},backdrop:{kind:`solid`,color:`#d1d1d1`,tone:`light`},shadow:0,aspect:`4:3`,camera:{position:[-30,-7,60],target:[3,8,2],fov:30},cursor:{mode:`camera`,follow:.2},environment:{preset:`studio`,intensity:1},lens:{grain:.08},set:{kind:`block`,seed:1,color:`#8a8a88`},timeline:Wt},{id:`tpl.macbook-open`,name:`MacBook lid opens`,description:`The lid lifts to reveal your site. Ends on a resting shot.`,device:{type:`laptop`,spec:`laptop.macbook-pro-14`,finish:`space-black`},preset:`preset.lid-open`,backdrop:{kind:`gradient`,inner:`#e4ecf3`,outer:`#b7c6d6`,tone:`light`},aspect:`16:9`,camera:{position:[0,14,70],target:[0,9,0],fov:30},rotation:[0,-14,0],cursor:{follow:.3,mode:`camera`}},{id:`tpl.macbook-orbit`,name:`MacBook orbit`,description:`A slow orbit around an open laptop on a dark set.`,device:{type:`laptop`,spec:`laptop.macbook-pro-16`,finish:`silver`},preset:`preset.orbit`,backdrop:{kind:`solid`,color:`#101114`,tone:`dark`},shadow:.55,aspect:`16:9`,camera:{position:[0,16,82],target:[0,10,0],fov:30}},{id:`tpl.studio-display`,name:`Studio Display push-in`,description:`Desktop software on a 27-inch display, slow push-in.`,device:{type:`monitor`,spec:`monitor.studio-display`,finish:`silver`},preset:`preset.push-in`,backdrop:{kind:`gradient`,inner:`#f6f6f4`,outer:`#d5d5d1`,tone:`light`},aspect:`16:9`,camera:{position:[0,32,150],target:[0,29,0],fov:28}},{id:`tpl.watch-square`,name:`Watch square`,description:`Square crop of a floating Apple Watch, turning. For feeds.`,device:{type:`watch`,spec:`watch.series-12-46`,finish:`jet-black`},preset:`preset.turn`,backdrop:{kind:`gradient`,inner:`#e4ecf3`,outer:`#b7c6d6`,tone:`light`},aspect:`1:1`,camera:{position:[0,.5,16],fov:26}},{id:`tpl.ultra-reveal`,name:`Ultra reveal`,description:`Apple Watch Ultra scales down into frame on a dark set.`,device:{type:`watch`,spec:`watch.ultra-4`,finish:`natural-titanium`},preset:`preset.zoom-out`,backdrop:{kind:`gradient`,inner:`#2c2f39`,outer:`#0b0c10`,tone:`dark`},shadow:.5,aspect:`9:16`,camera:{position:[0,.5,18],fov:26}}],Jt.map(Rt)}));function Xt(e){if(typeof e!=`object`||!e)throw TypeError(`Project must be an object`);let t={...e},n=typeof t.schemaVersion==`number`?t.schemaVersion:1;if(n>1)throw new Qt(n);for(;n<1;){let e=Zt[n];if(!e)throw Error(`No migration from schema version ${n}`);t=e(t),n++,t.schemaVersion=n}return Ge(t)}var Zt,Qt,$t=n((()=>{f(),ht(),Zt={},Qt=class extends Error{found;constructor(e){super(`Project schema version ${e} is newer than this build supports (1). Update the app.`),this.found=e,this.name=`UnsupportedSchemaError`}}})),en=n((()=>{c(),d(),f(),m(),O(),te(),ae(),se(),ue(),Tt(),Lt(),Yt(),ht(),$t(),yt()}));function tn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function nn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function rn(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function an(){let e=rn(`canvas`);return e.style.display=`block`,e}function on(...e){let t=`THREE.`+e.shift();Ta?Ta(`log`,t,...e):console.log(t,...e)}function sn(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function K(...e){e=sn(e);let t=`THREE.`+e.shift();if(Ta)Ta(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function q(...e){e=sn(e);let t=`THREE.`+e.shift();if(Ta)Ta(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function cn(...e){let t=e.join(` `);t in wa||(wa[t]=!0,K(...e))}function ln(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function un(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(Oa[e&255]+Oa[e>>8&255]+Oa[e>>16&255]+Oa[e>>24&255]+`-`+Oa[t&255]+Oa[t>>8&255]+`-`+Oa[t>>16&15|64]+Oa[t>>24&255]+`-`+Oa[n&63|128]+Oa[n>>8&255]+`-`+Oa[n>>16&255]+Oa[n>>24&255]+Oa[r&255]+Oa[r>>8&255]+Oa[r>>16&255]+Oa[r>>24&255]).toLowerCase()}function dn(e,t,n){return Math.max(t,Math.min(n,e))}function fn(e,t){return(e%t+t)%t}function pn(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function mn(e,t,n){return e===t?0:(n-e)/(t-e)}function hn(e,t,n){return(1-n)*e+n*t}function gn(e,t,n,r){return hn(e,t,1-Math.exp(-n*r))}function _n(e,t=1){return t-Math.abs(fn(e,t*2)-t)}function vn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function yn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function bn(e,t){return e+Math.floor(Math.random()*(t-e+1))}function xn(e,t){return e+Math.random()*(t-e)}function Sn(e){return e*(.5-Math.random())}function Cn(e){e!==void 0&&(ka=e);let t=ka+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function wn(e){return e*Aa}function Tn(e){return e*ja}function En(e){return e>0&&Number.isInteger(e)&&2**Math.round(Math.log2(e))===e}function Dn(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function On(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function kn(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:K(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function An(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:case Uint8ClampedArray:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function jn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function Mn(){let e={enabled:!0,workingColorSpace:_a,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n||(this.spaces[t].transfer===`srgb`&&(e.r=Nn(e.r),e.g=Nn(e.g),e.b=Nn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Pn(e.r),e.g=Pn(e.g),e.b=Pn(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?va:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return cn(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return cn(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[_a]:{primaries:t,whitePoint:r,transfer:va,toXYZ:La,fromXYZ:Ra,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:ga},outputColorSpaceConfig:{drawingBufferColorSpace:ga}},[ga]:{primaries:t,whitePoint:r,transfer:ya,toXYZ:La,fromXYZ:Ra,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:ga}}}),e}function Nn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Pn(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}function Fn(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Va.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(K(`Texture: Unable to serialize Texture.`),{})}function In(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function Ln(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){ls.fromArray(e,a);let o=i.x*Math.abs(ls.x)+i.y*Math.abs(ls.y)+i.z*Math.abs(ls.z),s=t.dot(ls),c=n.dot(ls),l=r.dot(ls);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}function Rn(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;Zs.copy(s),Zs.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(Zs);return l<n.near||l>n.far?null:{distance:l,point:Zs.clone(),object:e}}function zn(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Gs),e.getVertexPosition(c,Ks),e.getVertexPosition(l,qs);let u=Rn(e,t,n,r,Gs,Ks,qs,Xs);if(u){let e=new Y;Yo.getBarycoord(Xs,Gs,Ks,qs,e),i&&(u.uv=Yo.getInterpolatedAttribute(i,s,c,l,e,new J)),a&&(u.uv1=Yo.getInterpolatedAttribute(a,s,c,l,e,new J)),o&&(u.normal=Yo.getInterpolatedAttribute(o,s,c,l,e,new Y),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new Y,materialIndex:0};Yo.getNormal(Gs,Ks,qs,t.normal),u.face=t,u.barycoord=e}return u}function Bn(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Vn(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Hn(e,t){let n=1-e;return n*n*t}function Un(e,t){return 2*(1-e)*e*t}function Wn(e,t){return e*e*t}function Gn(e,t,n,r){return Hn(e,t)+Un(e,n)+Wn(e,r)}function Kn(e,t){let n=1-e;return n*n*n*t}function qn(e,t){let n=1-e;return 3*n*n*e*t}function Jn(e,t){return 3*(1-e)*e*e*t}function Yn(e,t){return e*e*e*t}function Xn(e,t,n,r,i){return Kn(e,t)+qn(e,n)+Jn(e,r)+Yn(e,i)}function Zn(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Qn(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=ar(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return er(a,o,n,s,c,l,0),o}function Qn(e,t,n,r,i){let a;if(i===kr(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Er(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Er(i/r|0,e[i],e[i+1],a);return a&&vr(a,a.next)&&(Dr(a),a=a.next),a}function $n(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(vr(n,n.next)||_r(n.prev,n,n.next)===0)){if(Dr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function er(e,t,n,r,i,a,o){if(!e)return;!o&&a&&ur(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?nr(e,r,i,a):tr(e))t.push(c.i,e.i,l.i),Dr(e),e=l.next,s=l.next;else if(e=l,e===s){o?o===1?(e=rr($n(e),t),er(e,t,n,r,i,a,2)):o===2&&ir(e,t,n,r,i,a):er($n(e),t,n,r,i,a,1);break}}}function tr(e){let t=e.prev,n=e,r=e.next;if(_r(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&hr(i,s,a,c,o,l,m.x,m.y)&&_r(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function nr(e,t,n,r){let i=e.prev,a=e,o=e.next;if(_r(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=fr(p,m,t,n,r),v=fr(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&hr(s,u,c,d,l,f,y.x,y.y)&&_r(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hr(s,u,c,d,l,f,b.x,b.y)&&_r(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&hr(s,u,c,d,l,f,y.x,y.y)&&_r(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&hr(s,u,c,d,l,f,b.x,b.y)&&_r(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function rr(e,t){let n=e;do{let r=n.prev,i=n.next.next;!vr(r,i)&&yr(r,n,n.next,i)&&Cr(r,i)&&Cr(i,r)&&(t.push(r.i,n.i,i.i),Dr(n),Dr(n.next),n=e=i),n=n.next}while(n!==e);return $n(n)}function ir(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&gr(o,e)){let s=Tr(o,e);o=$n(o,o.next),s=$n(s,s.next),er(o,t,n,r,i,a,0),er(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function ar(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Qn(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(pr(o))}i.sort(or);for(let e=0;e<i.length;e++)n=sr(i[e],n);return n}function or(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function sr(e,t){let n=cr(e,t);if(!n)return t;let r=Tr(n,e);return $n(r,r.next),$n(n,n.next)}function cr(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(vr(e,n))return n;do{if(vr(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&mr(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Cr(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&lr(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function lr(e,t){return _r(e.prev,e,t.prev)<0&&_r(t.next,e,e.next)<0}function ur(e,t,n,r){let i=e;do i.z===0&&(i.z=fr(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,dr(i)}function dr(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function fr(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function pr(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function mr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function hr(e,t,n,r,i,a,o,s){return(e!==o||t!==s)&&mr(e,t,n,r,i,a,o,s)}function gr(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Sr(e,t)&&(Cr(e,t)&&Cr(t,e)&&wr(e,t)&&(_r(e.prev,e,t.prev)||_r(e,t.prev,t))||vr(e,t)&&_r(e.prev,e,e.next)>0&&_r(t.prev,t,t.next)>0)}function _r(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function vr(e,t){return e.x===t.x&&e.y===t.y}function yr(e,t,n,r){let i=xr(_r(e,t,n)),a=xr(_r(e,t,r)),o=xr(_r(n,r,e)),s=xr(_r(n,r,t));return!!(i!==a&&o!==s||i===0&&br(e,n,t)||a===0&&br(e,r,t)||o===0&&br(n,e,r)||s===0&&br(n,t,r))}function br(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 xr(e){return e>0?1:e<0?-1:0}function Sr(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&yr(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Cr(e,t){return _r(e.prev,e,e.next)<0?_r(e,t,e.next)>=0&&_r(e,e.prev,t)>=0:_r(e,t,e.prev)<0||_r(e,e.next,t)<0}function wr(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Tr(e,t){let n=Or(e.i,e.x,e.y),r=Or(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Er(e,t,n,r){let i=Or(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 Dr(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 Or(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kr(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Ar(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function jr(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Mr(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Nr(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Pr(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(Ir(i))i.isRenderTargetTexture?(K(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i)){if(Ir(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice()}else t[n][r]=i}}return t}function Fr(e){let t={};for(let n=0;n<e.length;n++){let r=Pr(e[n]);for(let e in r)t[e]=r[e]}return t}function Ir(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Lr(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Rr(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:za.workingColorSpace}function zr(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function Br(e){return e!==void 0&&e.inTangents!==void 0&&e.outTangents!==void 0}function Vr(e,t,n,r,i){let a=1-e;return a*a*a*t+3*a*a*e*n+3*a*e*e*r+e*e*e*i}function Hr(e,t,n,r,i){let a=1-e;return 3*a*a*(n-t)+6*a*e*(r-n)+3*e*e*(i-r)}function Ur(e,t,n,r,i){let a=(e-t)/(i-t);for(let o=0;o<8;o++){let o=Vr(a,t,n,r,i)-e;if(Math.abs(o)<1e-10)break;let s=Hr(a,t,n,r,i);if(Math.abs(s)<1e-10)break;a=Math.max(0,Math.min(1,a-o/s))}return a}function Wr(e,t){for(let n=0,r=e.length;n!==r;n+=2)e[n]*=t}function Gr(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}function Kr(e,t,n,r){let i=qr(r);switch(n){case gi:return e*t;case xi:return e*t/i.components*i.byteLength;case Si:return e*t/i.components*i.byteLength;case Ci:return e*t*2/i.components*i.byteLength;case wi:return e*t*2/i.components*i.byteLength;case _i:return e*t*3/i.components*i.byteLength;case vi:return e*t*4/i.components*i.byteLength;case Ti:return e*t*4/i.components*i.byteLength;case Ei:case Di:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Oi:case ki:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ji:case Ni:return Math.max(e,16)*Math.max(t,8)/4;case Ai:case Mi:return Math.max(e,8)*Math.max(t,8)/2;case Pi:case Fi:case Li:case Ri:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Ii:case zi:case Bi:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Vi:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Hi:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Ui:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Wi:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Gi:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Ki:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case qi:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Ji:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Yi:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Xi:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Zi:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case Qi:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case $i:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case ea:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case ta:case na:case ra:return Math.ceil(e/4)*Math.ceil(t/4)*16;case ia:case aa:return Math.ceil(e/4)*Math.ceil(t/4)*8;case oa:case sa:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function qr(e){switch(e){case ri:case ii:return{byteLength:1,components:1};case oi:case ai:case ui:return{byteLength:2,components:1};case di:case fi:return{byteLength:2,components:4};case ci:case si:case li:return{byteLength:4,components:1};case mi:case hi:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}var Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,J,Na,Y,Pa,Fa,X,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu=n((()=>{Jr=1e3,Yr=1001,Xr=1002,Zr=1003,Qr=1004,$r=1005,ei=1006,ti=1007,ni=1008,ri=1009,ii=1010,ai=1011,oi=1012,si=1013,ci=1014,li=1015,ui=1016,di=1017,fi=1018,pi=1020,mi=35902,hi=35899,gi=1021,_i=1022,vi=1023,yi=1026,bi=1027,xi=1028,Si=1029,Ci=1030,wi=1031,Ti=1033,Ei=33776,Di=33777,Oi=33778,ki=33779,Ai=35840,ji=35841,Mi=35842,Ni=35843,Pi=36196,Fi=37492,Ii=37496,Li=37488,Ri=37489,zi=37490,Bi=37491,Vi=37808,Hi=37809,Ui=37810,Wi=37811,Gi=37812,Ki=37813,qi=37814,Ji=37815,Yi=37816,Xi=37817,Zi=37818,Qi=37819,$i=37820,ea=37821,ta=36492,na=36494,ra=36495,ia=36283,aa=36284,oa=36285,sa=36286,ca=2300,la=2301,ua=2302,da=2303,fa=2400,pa=2401,ma=2402,ha=3200,ga=`srgb`,_a=`srgb-linear`,va=`linear`,ya=`srgb`,ba=7680,xa=35044,Sa=`300 es`,Ca=2e3,wa={},Ta=null,Ea={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},Da=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},Oa=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),ka=1234567,Aa=Math.PI/180,ja=180/Math.PI,Ma={DEG2RAD:Aa,RAD2DEG:ja,generateUUID:un,clamp:dn,euclideanModulo:fn,mapLinear:pn,inverseLerp:mn,lerp:hn,damp:gn,pingpong:_n,smoothstep:vn,smootherstep:yn,randInt:bn,randFloat:xn,randFloatSpread:Sn,seededRandom:Cn,degToRad:wn,radToDeg:Tn,isPowerOfTwo:En,ceilPowerOfTwo:Dn,floorPowerOfTwo:On,setQuaternionFromProperEuler:kn,normalize:jn,denormalize:An},J=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,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}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=dn(this.x,e.x,t.x),this.y=dn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=dn(this.x,e,t),this.y=dn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(dn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(dn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Na=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:K(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Y=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Fa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Fa.setFromAxisAngle(e,t))}applyMatrix3(e){let 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}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=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])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,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()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=dn(this.x,e.x,t.x),this.y=dn(this.y,e.y,t.y),this.z=dn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=dn(this.x,e,t),this.y=dn(this.y,e,t),this.z=dn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(dn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Pa.copy(this).projectOnVector(e),this.sub(Pa)}reflect(e){return this.sub(Pa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(dn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let 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}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Pa=new Y,Fa=new Na,X=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return cn(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Ia.makeScale(e,t)),this}rotate(e){return cn(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Ia.makeRotation(-e)),this}translate(e,t){return cn(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Ia.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let 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}clone(){return new this.constructor().fromArray(this.elements)}},Ia=new X,La=new X().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ra=new X().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),za=Mn(),Va=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ba===void 0&&(Ba=rn(`canvas`)),Ba.width=e.width,Ba.height=e.height;let t=Ba.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Ba}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=rn(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=Nn(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(Nn(t[e]/255)*255):t[e]=Nn(t[e]);return{data:t,width:e.width,height:e.height}}return K(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Ha=0,Ua=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Ha++}),this.uuid=un(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(Fn(r[t].image)):e.push(Fn(r[t]))}else e=Fn(r);n.url=e}return t||(e.images[this.uuid]=n),n}},Wa=0,Ga=new Y,Ka=class e extends Da{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=Yr,i=Yr,a=ei,o=ni,s=vi,c=ri,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Wa++}),this.uuid=un(),this.name=``,this.source=new Ua(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new X,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ga).x}get height(){return this.source.getSize(Ga).y}get depth(){return this.source.getSize(Ga).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,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.normalized=e.normalized,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.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){K(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?K(`Texture.setValues(): property '${t}' does not exist.`):r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jr:e.x-=Math.floor(e.x);break;case Yr:e.x=e.x<0?0:1;break;case Xr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Jr:e.y-=Math.floor(e.y);break;case Yr:e.y=e.y<0?0:1;break;case Xr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}},Ka.DEFAULT_IMAGE=null,Ka.DEFAULT_MAPPING=300,Ka.DEFAULT_ANISOTROPY=1,qa=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=dn(this.x,e.x,t.x),this.y=dn(this.y,e.y,t.y),this.z=dn(this.z,e.z,t.z),this.w=dn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=dn(this.x,e,t),this.y=dn(this.y,e,t),this.z=dn(this.z,e,t),this.w=dn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(dn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Ja=class extends Da{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ei,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new qa(0,0,e,t),this.scissorTest=!1,this.viewport=new qa(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},i=new Ka(r),a=n.count;for(let e=0;e<a;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:ei,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new Ua(n)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null){if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture}return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:`dispose`})}},Ya=class extends Ja{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Xa=class extends Ka{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Zr,this.minFilter=Zr,this.wrapR=Yr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Za=class extends Ka{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Zr,this.minFilter=Zr,this.wrapR=Yr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}},Qa=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/$a.setFromMatrixColumn(e,0).length(),i=1/$a.setFromMatrixColumn(e,1).length(),a=1/$a.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]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(to,e,no)}lookAt(e,t,n){let r=this.elements;return ao.subVectors(e,t),ao.lengthSq()===0&&(ao.z=1),ao.normalize(),ro.crossVectors(n,ao),ro.lengthSq()===0&&(Math.abs(n.z)===1?ao.x+=1e-4:ao.z+=1e-4,ao.normalize(),ro.crossVectors(n,ao)),ro.normalize(),io.crossVectors(ao,ro),r[0]=ro.x,r[4]=io.x,r[8]=ao.x,r[1]=ro.y,r[5]=io.y,r[9]=ao.y,r[2]=ro.z,r[6]=io.z,r[10]=ao.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let 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}getMaxScaleOnAxis(){let 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))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let 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}makeRotationY(e){let 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}makeRotationZ(e){let 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}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=$a.set(r[0],r[1],r[2]).length(),o=$a.set(r[4],r[5],r[6]).length(),s=$a.set(r[8],r[9],r[10]).length();i<0&&(a=-a),eo.copy(this);let c=1/a,l=1/o,u=1/s;return eo.elements[0]*=c,eo.elements[1]*=c,eo.elements[2]*=c,eo.elements[4]*=l,eo.elements[5]*=l,eo.elements[6]*=l,eo.elements[8]*=u,eo.elements[9]*=u,eo.elements[10]*=u,t.setFromRotationMatrix(eo),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=Ca,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=Ca,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let 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}},$a=new Y,eo=new Qa,to=new Y(0,0,0),no=new Y(1,1,1),ro=new Y,io=new Y,ao=new Y,oo=new Qa,so=new Na,co=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(dn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-dn(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(dn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-dn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(dn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-dn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:K(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return oo.makeRotationFromQuaternion(e),this.setFromRotationMatrix(oo,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return so.setFromEuler(this),this.setFromQuaternion(so,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}},co.DEFAULT_ORDER=`XYZ`,lo=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&1<<e)}},uo=0,fo=new Y,po=new Na,mo=new Qa,ho=new Y,go=new Y,_o=new Y,vo=new Na,yo=new Y(1,0,0),bo=new Y(0,1,0),xo=new Y(0,0,1),So={type:`added`},Co={type:`removed`},wo={type:`childadded`,child:null},To={type:`childremoved`,child:null},Eo=class e extends Da{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:uo++}),this.uuid=un(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new Y,n=new co,r=new Na,i=new Y(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Qa},normalMatrix:{value:new X}}),this.matrix=new Qa,this.matrixWorld=new Qa,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new lo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return po.setFromAxisAngle(e,t),this.quaternion.multiply(po),this}rotateOnWorldAxis(e,t){return po.setFromAxisAngle(e,t),this.quaternion.premultiply(po),this}rotateX(e){return this.rotateOnAxis(yo,e)}rotateY(e){return this.rotateOnAxis(bo,e)}rotateZ(e){return this.rotateOnAxis(xo,e)}translateOnAxis(e,t){return fo.copy(e).applyQuaternion(this.quaternion),this.position.add(fo.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(yo,e)}translateY(e){return this.translateOnAxis(bo,e)}translateZ(e){return this.translateOnAxis(xo,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(mo.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ho.copy(e):ho.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),go.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mo.lookAt(go,ho,this.up):mo.lookAt(ho,go,this.up),this.quaternion.setFromRotationMatrix(mo),r&&(mo.extractRotation(r.matrixWorld),po.setFromRotationMatrix(mo),this.quaternion.premultiply(po.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(q(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(So),wo.child=e,this.dispatchEvent(wo),wo.child=null):q(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Co),To.child=e,this.dispatchEvent(To),To.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),mo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),mo.multiply(e.parent.matrixWorld)),e.applyMatrix4(mo),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(So),wo.child=e,this.dispatchEvent(wo),wo.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(go,e,_o),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(go,vo,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}dispose(){this.dispatchEvent({type:`dispose`})}},Eo.DEFAULT_UP=new Y(0,1,0),Eo.DEFAULT_MATRIX_AUTO_UPDATE=!0,Eo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,Do=class extends Eo{constructor(){super(),this.isGroup=!0,this.type=`Group`}},Oo={type:`move`},ko=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Do,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Do,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Do,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Oo)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Do;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Ao={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},jo={h:0,s:0,l:0},Mo={h:0,s:0,l:0},No=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ga){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,za.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=za.workingColorSpace){return this.r=e,this.g=t,this.b=n,za.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=za.workingColorSpace){if(e=fn(e,1),t=dn(t,0,1),n=dn(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=In(i,r,e+1/3),this.g=In(i,r,e),this.b=In(i,r,e-1/3)}return za.colorSpaceToWorking(this,r),this}setStyle(e,t=ga){function n(t){t!==void 0&&parseFloat(t)<1&&K(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:K(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);K(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ga){let n=Ao[e.toLowerCase()];return n===void 0?K(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Nn(e.r),this.g=Nn(e.g),this.b=Nn(e.b),this}copyLinearToSRGB(e){return this.r=Pn(e.r),this.g=Pn(e.g),this.b=Pn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ga){return za.workingToColorSpace(Po.copy(this),e),Math.round(dn(Po.r*255,0,255))*65536+Math.round(dn(Po.g*255,0,255))*256+Math.round(dn(Po.b*255,0,255))}getHexString(e=ga){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=za.workingColorSpace){za.workingToColorSpace(Po.copy(this),t);let n=Po.r,r=Po.g,i=Po.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=za.workingColorSpace){return za.workingToColorSpace(Po.copy(this),t),e.r=Po.r,e.g=Po.g,e.b=Po.b,e}getStyle(e=ga){za.workingToColorSpace(Po.copy(this),e);let t=Po.r,n=Po.g,r=Po.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(jo),this.setHSL(jo.h+e,jo.s+t,jo.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(jo),e.getHSL(Mo);let n=hn(jo.h,Mo.h,t),r=hn(jo.s,Mo.s,t),i=hn(jo.l,Mo.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Po=new No,No.NAMES=Ao,Fo=class extends Eo{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new co,this.environmentIntensity=1,this.environmentRotation=new co,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}},Io=new Y,Lo=new Y,Ro=new Y,zo=new Y,Bo=new Y,Vo=new Y,Ho=new Y,Uo=new Y,Wo=new Y,Go=new Y,Ko=new qa,qo=new qa,Jo=new qa,Yo=class e{constructor(e=new Y,t=new Y,n=new Y){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Io.subVectors(e,t),r.cross(Io);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Io.subVectors(r,t),Lo.subVectors(n,t),Ro.subVectors(e,t);let a=Io.dot(Io),o=Io.dot(Lo),s=Io.dot(Ro),c=Lo.dot(Lo),l=Lo.dot(Ro),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,zo)!==null&&zo.x>=0&&zo.y>=0&&zo.x+zo.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,zo)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,zo.x),s.addScaledVector(a,zo.y),s.addScaledVector(o,zo.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Ko.setScalar(0),qo.setScalar(0),Jo.setScalar(0),Ko.fromBufferAttribute(e,t),qo.fromBufferAttribute(e,n),Jo.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ko,i.x),a.addScaledVector(qo,i.y),a.addScaledVector(Jo,i.z),a}static isFrontFacing(e,t,n,r){return Io.subVectors(n,t),Lo.subVectors(e,t),Io.cross(Lo).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Io.subVectors(this.c,this.b),Lo.subVectors(this.a,this.b),Io.cross(Lo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Bo.subVectors(r,n),Vo.subVectors(i,n),Uo.subVectors(e,n);let s=Bo.dot(Uo),c=Vo.dot(Uo);if(s<=0&&c<=0)return t.copy(n);Wo.subVectors(e,r);let l=Bo.dot(Wo),u=Vo.dot(Wo);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Bo,a);Go.subVectors(e,i);let f=Bo.dot(Go),p=Vo.dot(Go);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Vo,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Ho.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Ho,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Bo,a).addScaledVector(Vo,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Xo=class{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Qo.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Qo.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Qo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,Qo):Qo.fromBufferAttribute(r,t),Qo.applyMatrix4(e.matrixWorld),this.expandByPoint(Qo);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),$o.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),$o.copy(e.boundingBox)),$o.applyMatrix4(e.matrixWorld),this.union($o)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Qo),Qo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(os),ss.subVectors(this.max,os),es.subVectors(e.a,os),ts.subVectors(e.b,os),ns.subVectors(e.c,os),rs.subVectors(ts,es),is.subVectors(ns,ts),as.subVectors(es,ns);let t=[0,-rs.z,rs.y,0,-is.z,is.y,0,-as.z,as.y,rs.z,0,-rs.x,is.z,0,-is.x,as.z,0,-as.x,-rs.y,rs.x,0,-is.y,is.x,0,-as.y,as.x,0];return!Ln(t,es,ts,ns,ss)||(t=[1,0,0,0,1,0,0,0,1],!Ln(t,es,ts,ns,ss))?!1:(cs.crossVectors(rs,is),t=[cs.x,cs.y,cs.z],Ln(t,es,ts,ns,ss))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Qo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Qo).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Zo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zo)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Zo=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Qo=new Y,$o=new Xo,es=new Y,ts=new Y,ns=new Y,rs=new Y,is=new Y,as=new Y,os=new Y,ss=new Y,cs=new Y,ls=new Y,us=new Y,ds=new J,fs=0,ps=class extends Da{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:fs++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=xa,this.updateRanges=[],this.gpuType=li,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix3(e),this.setXY(t,ds.x,ds.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)us.fromBufferAttribute(this,t),us.applyMatrix3(e),this.setXYZ(t,us.x,us.y,us.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)us.fromBufferAttribute(this,t),us.applyMatrix4(e),this.setXYZ(t,us.x,us.y,us.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)us.fromBufferAttribute(this,t),us.applyNormalMatrix(e),this.setXYZ(t,us.x,us.y,us.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)us.fromBufferAttribute(this,t),us.transformDirection(e),this.setXYZ(t,us.x,us.y,us.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=An(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=jn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=An(t,this.array)),t}setX(e,t){return this.normalized&&(t=jn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=An(t,this.array)),t}setY(e,t){return this.normalized&&(t=jn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=An(t,this.array)),t}setZ(e,t){return this.normalized&&(t=jn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=An(t,this.array)),t}setW(e,t){return this.normalized&&(t=jn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=jn(t,this.array),n=jn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=jn(t,this.array),n=jn(n,this.array),r=jn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=jn(t,this.array),n=jn(n,this.array),r=jn(r,this.array),i=jn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:`dispose`})}},ms=class extends ps{constructor(e,t,n){super(new Uint16Array(e),t,n)}},hs=class extends ps{constructor(e,t,n){super(new Uint32Array(e),t,n)}},gs=class extends ps{constructor(e,t,n){super(new Float32Array(e),t,n)}},_s=new Xo,vs=new Y,ys=new Y,bs=class{constructor(e=new Y,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?_s.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;vs.subVectors(e,this.center);let t=vs.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(vs,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ys.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(vs.copy(e.center).add(ys)),this.expandByPoint(vs.copy(e.center).sub(ys))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},xs=0,Ss=new Qa,Cs=new Eo,ws=new Y,Ts=new Xo,Es=new Xo,Ds=new Y,Os=class e extends Da{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:xs++}),this.uuid=un(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(tn(e)?hs:ms)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new X().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Ss.makeRotationFromQuaternion(e),this.applyMatrix4(Ss),this}rotateX(e){return Ss.makeRotationX(e),this.applyMatrix4(Ss),this}rotateY(e){return Ss.makeRotationY(e),this.applyMatrix4(Ss),this}rotateZ(e){return Ss.makeRotationZ(e),this.applyMatrix4(Ss),this}translate(e,t,n){return Ss.makeTranslation(e,t,n),this.applyMatrix4(Ss),this}scale(e,t,n){return Ss.makeScale(e,t,n),this.applyMatrix4(Ss),this}lookAt(e){return Cs.lookAt(e),Cs.updateMatrix(),this.applyMatrix4(Cs.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ws).negate(),this.translate(ws.x,ws.y,ws.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new gs(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&K(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Xo);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)q(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));else{if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ts.setFromBufferAttribute(n),this.morphTargetsRelative?(Ds.addVectors(this.boundingBox.min,Ts.min),this.boundingBox.expandByPoint(Ds),Ds.addVectors(this.boundingBox.max,Ts.max),this.boundingBox.expandByPoint(Ds)):(this.boundingBox.expandByPoint(Ts.min),this.boundingBox.expandByPoint(Ts.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&q(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new bs);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)q(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new Y,1/0);else if(e){let n=this.boundingSphere.center;if(Ts.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Es.setFromBufferAttribute(n),this.morphTargetsRelative?(Ds.addVectors(Ts.min,Es.min),Ts.expandByPoint(Ds),Ds.addVectors(Ts.max,Es.max),Ts.expandByPoint(Ds)):(Ts.expandByPoint(Es.min),Ts.expandByPoint(Es.max))}Ts.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Ds.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Ds));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Ds.fromBufferAttribute(a,t),o&&(ws.fromBufferAttribute(e,t),Ds.add(ws)),r=Math.max(r,n.distanceToSquared(Ds))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&q(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){q(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new ps(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Y,s[e]=new Y;let c=new Y,l=new Y,u=new Y,d=new J,f=new J,p=new J,m=new Y,h=new Y;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new Y,y=new Y,b=new Y,x=new Y;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new ps(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new Y,i=new Y,a=new Y,o=new Y,s=new Y,c=new Y,l=new Y,u=new Y;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Ds.fromBufferAttribute(e,t),Ds.normalize(),e.setXYZ(t,Ds.x,Ds.y,Ds.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new ps(a,r,i)}if(this.index===null)return K(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},ks=new Y,As=new Y,js=new X,Ms=class{constructor(e=new Y(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=ks.subVectors(n,t).cross(As.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(ks),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||js.getNormalMatrix(e),r=this.coplanarPoint(ks).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},Ns=0,Ps=class extends Da{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ns++}),this.uuid=un(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new No(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ba,this.stencilZFail=ba,this.stencilZPass=ba,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){K(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?K(`Material: '${t}' is not a property of THREE.${this.type}.`):r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(e=>e.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new No().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(e=>new Ms().fromJSON(e))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new J().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Fs=new Y,Is=new Y,Ls=new Y,Rs=new Y,zs=class{constructor(e=new Y,t=new Y(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Fs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Fs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Fs.copy(this.origin).addScaledVector(this.direction,t),Fs.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Is.copy(e).add(t).multiplyScalar(.5),Ls.copy(t).sub(e).normalize(),Rs.copy(this.origin).sub(Is);let i=e.distanceTo(t)*.5,a=-this.direction.dot(Ls),o=Rs.dot(this.direction),s=-Rs.dot(Ls),c=Rs.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Is).addScaledVector(Ls,d),f}intersectSphere(e,t){if(e.radius<0)return null;Fs.subVectors(e.center,this.origin);let n=Fs.dot(this.direction),r=Fs.dot(Fs)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Fs)!==null}intersectTriangle(e,t,n,r,i){let a=this.origin,o=this.direction,s=o.x,c=o.y,l=o.z,u=e.x-a.x,d=e.y-a.y,f=e.z-a.z,p=t.x-a.x,m=t.y-a.y,h=t.z-a.z,g=n.x-a.x,_=n.y-a.y,v=n.z-a.z,y=Math.abs(s),b=Math.abs(c),x=Math.abs(l),S,C,w,T,E,D,O,k,A,j,M,N;if(y>=b&&y>=x?(w=s,D=u,A=p,N=g,s>=0?(S=c,C=l,T=d,E=f,O=m,k=h,j=_,M=v):(S=l,C=c,T=f,E=d,O=h,k=m,j=v,M=_)):b>=x?(w=c,D=d,A=m,N=_,c>=0?(S=l,C=s,T=f,E=u,O=h,k=p,j=v,M=g):(S=s,C=l,T=u,E=f,O=p,k=h,j=g,M=v)):(w=l,D=f,A=h,N=v,l>=0?(S=s,C=c,T=u,E=d,O=p,k=m,j=g,M=_):(S=c,C=s,T=d,E=u,O=m,k=p,j=_,M=g)),w===0)return null;let P=S/w,F=C/w,I=1/w,ee=T-P*D,te=E-F*D,ne=O-P*A,re=k-F*A,L=j-P*N,R=M-F*N,ie=L*re-R*ne,ae=ee*R-te*L,oe=ne*te-re*ee;if(r){if(ie<0||ae<0||oe<0)return null}else if((ie<0||ae<0||oe<0)&&(ie>0||ae>0||oe>0))return null;let se=ie+ae+oe;if(se===0)return null;let ce=I*(ie*D+ae*A+oe*N);return(se>0?ce<0:ce>0)?null:this.at(ce/se,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Bs=class extends Ps{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new No(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new co,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Vs=new Qa,Hs=new zs,Us=new bs,Ws=new Y,Gs=new Y,Ks=new Y,qs=new Y,Js=new Y,Ys=new Y,Xs=new Y,Zs=new Y,Qs=class extends Eo{constructor(e=new Os,t=new Bs){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){Ys.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(Js.fromBufferAttribute(s,e),a?Ys.addScaledVector(Js,r):Ys.addScaledVector(Js.sub(t),r))}t.add(Ys)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Us.copy(n.boundingSphere),Us.applyMatrix4(i),Hs.copy(e.ray).recast(e.near),!(Us.containsPoint(Hs.origin)===!1&&(Hs.intersectSphere(Us,Ws)===null||Hs.origin.distanceToSquared(Ws)>(e.far-e.near)**2))&&(Vs.copy(i).invert(),Hs.copy(e.ray).applyMatrix4(Vs),(n.boundingBox===null||Hs.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,Hs)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=zn(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=zn(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=zn(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=zn(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}},$s=class extends Ka{constructor(e=null,t=1,n=1,r,i,a,o,s,c=Zr,l=Zr,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},ec=new bs,tc=new J(.5,.5),nc=new Y,rc=class{constructor(e=new Ms,t=new Ms,n=new Ms,r=new Ms,i=new Ms,a=new Ms){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ca,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),ec.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),ec.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ec)}intersectsSprite(e){ec.center.set(0,0,0);let t=tc.distanceTo(e.center);return ec.radius=.7071067811865476+t,ec.applyMatrix4(e.matrixWorld),this.intersectsSphere(ec)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(nc.x=r.normal.x>0?e.max.x:e.min.x,nc.y=r.normal.y>0?e.max.y:e.min.y,nc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(nc)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},ic=class extends Ka{constructor(e,t,n,r,i=ei,a=ei,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},ac=class extends Ka{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},oc=class extends Ka{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},sc=class extends Ka{constructor(e,t,n=ci,r,i,a,o=Zr,s=Zr,c,l=yi,u=1){if(l!==1026&&l!==1027)throw Error(`THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ua(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},cc=class extends sc{constructor(e,t=ci,n=301,r,i,a=Zr,o=Zr,s,c=yi){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},lc=class extends Ka{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},uc=class e extends Os{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new gs(c,3)),this.setAttribute(`normal`,new gs(l,3)),this.setAttribute(`uv`,new gs(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new Y;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},dc=class e extends Os{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new Y,l=new J;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new gs(a,3)),this.setAttribute(`normal`,new gs(o,3)),this.setAttribute(`uv`,new gs(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},fc=class e extends Os{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new gs(u,3)),this.setAttribute(`normal`,new gs(d,3)),this.setAttribute(`uv`,new gs(f,2));function _(){let a=new Y,_=new Y,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new J,m=new Y,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},pc=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){K(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new J:new Y);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new Y,r=[],i=[],a=[],o=new Y,s=new Qa;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new Y)}i[0]=new Y,a[0]=new Y;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(dn(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(dn(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},mc=class extends pc{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new J){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},hc=class extends mc{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}},gc=new Y,_c=new Y,vc=new Bn,yc=new Bn,bc=new Bn,xc=class extends pc{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new Y){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(_c.subVectors(r[0],r[1]).add(r[0]),c=_c);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(gc.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=gc),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),vc.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),yc.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),bc.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(vc.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),yc.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),bc.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(vc.calc(s),yc.calc(s),bc.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new Y().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},Sc=class extends pc{constructor(e=new J,t=new J,n=new J,r=new J){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new J){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Xn(e,r.x,i.x,a.x,o.x),Xn(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Cc=class extends pc{constructor(e=new Y,t=new Y,n=new Y,r=new Y){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Y){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Xn(e,r.x,i.x,a.x,o.x),Xn(e,r.y,i.y,a.y,o.y),Xn(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},wc=class extends pc{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new J){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Tc=class extends pc{constructor(e=new Y,t=new Y){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new Y){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Y){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ec=class extends pc{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Gn(e,r.x,i.x,a.x),Gn(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Dc=class extends pc{constructor(e=new Y,t=new Y,n=new Y){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Y){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Gn(e,r.x,i.x,a.x),Gn(e,r.y,i.y,a.y),Gn(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Oc=class extends pc{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new J){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Vn(o,s.x,c.x,l.x,u.x),Vn(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new J().fromArray(n))}return this}},kc=Object.freeze({__proto__:null,ArcCurve:hc,CatmullRomCurve3:xc,CubicBezierCurve:Sc,CubicBezierCurve3:Cc,EllipseCurve:mc,LineCurve:wc,LineCurve3:Tc,QuadraticBezierCurve:Ec,QuadraticBezierCurve3:Dc,SplineCurve:Oc}),Ac=class extends pc{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new kc[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new kc[n.type]().fromJSON(n))}return this}},jc=class extends Ac{constructor(e){super(),this.type=`Path`,this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new wc(this.currentPoint.clone(),new J(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new Ec(this.currentPoint.clone(),new J(e,t),new J(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new Sc(this.currentPoint.clone(),new J(e,t),new J(n,r),new J(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new Oc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new mc(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Mc=class extends jc{constructor(e){super(e),this.uuid=un(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new jc().fromJSON(n))}return this}},Nc=class{static triangulate(e,t,n=2){return Zn(e,t,n)}},Pc=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];Ar(e),jr(n,e);let a=e.length;t.forEach(Ar);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,jr(n,t[e]);let o=Nc.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}},Fc=class e extends Os{constructor(e=new Mc([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new gs(r,3)),this.setAttribute(`uv`,new gs(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0||t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Ic:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new Y,b=new Y,x=new Y}l||(p=0,u=0,d=0,f=0);let S=e.extractPoints(o),C=S.shape,w=S.holes;if(!Pc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];Pc.isClockWise(t)&&(w[e]=t.reverse())}}function T(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));s<=10000000000000001e-36*c*c?(e.splice(r,1),n--):t=i}}T(C),w.forEach(T);let E=w.length,D=C;for(let e=0;e<E;e++){let t=w[e];C=C.concat(t)}function O(e,t,n){return t||q(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let k=C.length;function A(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new J(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new J(r/a,i/a)}let j=[];for(let e=0,t=D.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),j[e]=A(D[e],D[n],D[r]);let M=[],N,P=j.concat();for(let e=0,t=E;e<t;e++){let t=w[e];N=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),N[e]=A(t[e],t[r],t[i]);M.push(N),P=P.concat(N)}let F;if(p===0)F=Pc.triangulateShape(D,w);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=D.length;t<n;t++){let n=O(D[t],j[t],a);L(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=E;e<n;e++){let n=w[e];N=M[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=O(n[e],N[e],a);L(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}F=Pc.triangulateShape(e,t)}let I=F.length,ee=d+f;for(let e=0;e<k;e++){let t=l?O(C[e],P[e],ee):C[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),L(x.x,x.y,x.z)):L(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<k;t++){let n=l?O(C[t],P[t],ee):C[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),L(x.x,x.y,x.z)):L(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=D.length;e<t;e++){let t=O(D[e],j[e],r);L(t.x,t.y,c+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];N=M[e];for(let e=0,i=t.length;e<i;e++){let i=O(t[e],N[e],r);_?L(i.x,i.y+g[s-1].y,g[s-1].x+n):L(i.x,i.y,c+n)}}}te(),ne();function te(){let e=r.length/3;if(l){let e=0,t=k*e;for(let e=0;e<I;e++){let n=F[e];R(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=k*e;for(let e=0;e<I;e++){let n=F[e];R(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<I;e++){let t=F[e];R(t[2],t[1],t[0])}for(let e=0;e<I;e++){let t=F[e];R(t[0]+k*s,t[1]+k*s,t[2]+k*s)}}n.addGroup(e,r.length/3-e,0)}function ne(){let e=r.length/3,t=0;re(D,t),t+=D.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];re(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function re(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=k*e,a=k*(e+1);ie(t+r+n,t+i+n,t+i+a,t+r+a)}}}function L(e,t,n){a.push(e),a.push(t),a.push(n)}function R(e,t,i){ae(e),ae(t),ae(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);oe(o[0]),oe(o[1]),oe(o[2])}function ie(e,t,i,a){ae(e),ae(t),ae(a),ae(t),ae(i),ae(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);oe(s[0]),oe(s[1]),oe(s[3]),oe(s[1]),oe(s[2]),oe(s[3])}function ae(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function oe(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Mr(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new kc[i.type]().fromJSON(i)),new e(r,t.options)}},Ic={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new J(a,o),new J(s,c),new J(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new J(o,1-c),new J(l,1-d),new J(f,1-m),new J(h,1-_)]:[new J(s,1-c),new J(u,1-d),new J(p,1-m),new J(g,1-_)]}},Lc=class e extends Os{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=dn(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new Y,d=new J,f=new Y,p=new Y,m=new Y,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new gs(a,3)),this.setAttribute(`uv`,new gs(o,2)),this.setAttribute(`normal`,new gs(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},Rc=class e extends Os{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new gs(p,3)),this.setAttribute(`normal`,new gs(m,3)),this.setAttribute(`uv`,new gs(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},zc=class e extends Os{constructor(e=.5,t=1,n=32,r=1,i=0,a=Math.PI*2){super(),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);let o=[],s=[],c=[],l=[],u=e,d=(t-e)/r,f=new Y,p=new J;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;f.x=u*Math.cos(r),f.y=u*Math.sin(r),s.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,l.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r,a=r+n+1,s=r+n+2,c=r+1;o.push(i,a,c),o.push(a,s,c)}}this.setIndex(o),this.setAttribute(`position`,new gs(s,3)),this.setAttribute(`normal`,new gs(c,3)),this.setAttribute(`uv`,new gs(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Bc=class e extends Os{constructor(e=new Mc([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),t=12){super(),this.type=`ShapeGeometry`,this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(let t=0;t<e.length;t++)c(e[t]),this.addGroup(o,s,t),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new gs(r,3)),this.setAttribute(`normal`,new gs(i,3)),this.setAttribute(`uv`,new gs(a,2));function c(e){let o=r.length/3,c=e.extractPoints(t),l=c.shape,u=c.holes;Pc.isClockWise(l)===!1&&(l=l.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];Pc.isClockWise(t)===!0&&(u[e]=t.reverse())}let d=Pc.triangulateShape(l,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];l=l.concat(t)}for(let e=0,t=l.length;e<t;e++){let t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],r=t[0]+o,i=t[1]+o,a=t[2]+o;n.push(r,i,a),s+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return Nr(t,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}return new e(r,t.curveSegments)}},Vc=class e extends Os{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new Y,d=new Y,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=a+_*o,y=e*Math.cos(v),b=Math.sqrt(e*e-y*y),x=0;f===0&&a===0?x=.5/t:f===n&&s===Math.PI&&(x=-.5/t);for(let e=0;e<=t;e++){let n=e/t,a=r+n*i;u.x=-b*Math.cos(a),u.y=y,u.z=b*Math.sin(a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(n+x,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new gs(p,3)),this.setAttribute(`normal`,new gs(m,3)),this.setAttribute(`uv`,new gs(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Hc=class extends Ps{constructor(e){super(),this.isShadowMaterial=!0,this.type=`ShadowMaterial`,this.color=new No(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},Uc={clone:Pr,merge:Fr},Wc=`void main() {
|
|
1
|
+
var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},r=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},i=(e,t)=>e===null?t:e!==`false`&&e!==`0`,a=e=>e===null||e===``||Number.isNaN(Number(e))?void 0:Number(e);function o(e){let t=t=>e.getAttribute(t),n={},r={},o=t(`trigger`);if(o&&o!==`scene`){let e={load:`load`,click:`click`,hover:`hover`,scroll:`scroll`,inview:`in-view`,"in-view":`in-view`,mousemove:`cursor-move`,"cursor-move":`cursor-move`,none:`none`}[o];e&&(n.trigger=e)}let s=t(`trigger-loop`);s!==null&&(n.loop=s===`pingpong`?`pingpong`:i(s,!0)?`loop`:`none`);let c=a(t(`trigger-delay`));c!==void 0&&(n.delay=c/1e3);let l=a(t(`trigger-speed`));l!==void 0&&(n.speed=l),i(t(`cursor-enabled`),!0)||(r.follow=0);let u=a(t(`cursor-amount`));u!==void 0&&(r.follow=u/100);let d=t(`cursor-mode`);(d===`device`||d===`camera`)&&(r.mode=d);let f=a(t(`zoom-amount`));f!==void 0&&i(t(`zoom-enabled`),!0)&&(t(`zoom-mode`)===`dolly`?r.dolly=f/100:r.zoom=f/100);let p=a(t(`shake-intensity`));p!==void 0&&i(t(`shake-enabled`),!0)&&(r.shake=p/100),Object.keys(r).length&&(n.cursor=r);let m=a(t(`camera-zoom`));m&&(n.cameraZoom=m);let h=navigator.connection,g=!!h?.saveData||/(^|-)2g$/.test(h?.effectiveType??``);return{src:t(`src`),mockupId:t(`mockup-id`)??t(`uid`),base:t(`base`)??`https://irgtrjmgflkcsye5.public.blob.vercel-storage.com/scenes`,poster:t(`poster`),loader:i(t(`loader`),!1),progressive:i(t(`progressive`),!0),lowBandwidth:t(`low-bandwidth`)===null?g:i(t(`low-bandwidth`),g),theme:t(`theme`)===`dark`?`dark`:`light`,backgroundColor:t(`background-color`)?.trim()||null,overrides:n}}function s(e){return e.src?e.src:e.mockupId?`${e.base.replace(/\/$/,``)}/${e.mockupId}/project.json`:null}var c=n((()=>{}));function l(e,t,n=`cover`,r=[.5,.5]){if(n===`stretch`)return{repeat:[1,1],offset:[0,0]};let i=e>t;if(n===`cover`?i:!i){let n=t/e;return{repeat:[n,1],offset:[(1-n)*r[0],0]}}let a=e/t;return{repeat:[1,a],offset:[0,(1-a)*r[1]]}}function u(e){if(!e)return[.5,.5];let t=e=>Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5;return[t(e[0]),t(e[1])]}var d=n((()=>{})),f=n((()=>{}));function p(e=``){let t=typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return e?`${e}_${t.slice(0,8)}`:t}var m=n((()=>{}));function h(e,t,n,r){if(e===t&&n===r)return y.linear;let i=new Float64Array(b);for(let t=0;t<b;t++)i[t]=T(t*x,e,n);let a=t=>{let r=0,a=1;for(;a<10&&(i[a]??1)<=t;a++)r+=x;a--;let o=i[a]??0,s=i[a+1]??1,c=(t-o)/(s-o||1),l=r+c*x,u=E(l,e,n);if(u>=.001){for(let r=0;r<4;r++){let r=E(l,e,n);if(r===0)return l;l-=(T(l,e,n)-t)/r}return l}if(u===0)return l;let d=r,f=r+x;for(let r=0;r<10;r++){l=d+(f-d)/2;let r=T(l,e,n)-t;if(Math.abs(r)<1e-7)break;r>0?f=l:d=l}return l};return e=>e<=0?0:e>=1?1:T(a(e),t,r)}function g(e){if(typeof e==`string`)return y[e]??y.linear;let t=e.bezier.join(`,`),n=D.get(t);return n||(n=h(...e.bezier),D.set(t,n)),n}var _,v,y,b,x,S,C,w,T,E,D,O=n((()=>{_=1.70158,v=2.70158,y={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInOutCubic:e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,easeOutExpo:e=>e>=1?1:1-2**(-10*e),easeOutBack:e=>1+v*(e-1)**3+_*(e-1)**2,easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2},Object.keys(y),b=11,x=1/10,S=(e,t)=>1-3*t+3*e,C=(e,t)=>3*t-6*e,w=e=>3*e,T=(e,t,n)=>((S(t,n)*e+C(t,n))*e+w(t))*e,E=(e,t,n)=>3*S(t,n)*e*e+2*C(t,n)*e+w(t),D=new Map}));function k(e){return{duration:e.duration,fps:e.fps,tracks:e.tracks.filter(e=>e.keys.length>0).map(A)}}function A(e){let t=[...e.keys].sort((e,t)=>e.t-t.t);return{target:e.target,type:e.type,times:Float64Array.from(t,e=>e.t),values:t.map(e=>e.value),easings:t.map(e=>g(e.easing)),holds:t.map(e=>e.interpolation===`hold`)}}function j(e,t){let n=0,r=e.length-1;if(t<(e[0]??0))return-1;for(;n<r;){let i=n+r+1>>1;(e[i]??1/0)<=t?n=i:r=i-1}return n}function M(e,t){let{times:n,values:r}=e,i=n.length-1,a=j(n,t);if(a<0)return r[0];if(a>=i)return r[i];let o=r[a];if(e.holds[a])return o;let s=r[a+1],c=n[a]??0,l=(n[a+1]??c)-c;return P(o,s,l>0?(e.easings[a]??(e=>e))((t-c)/l):1,e.type)}function N(e,t){let n=new Map;for(let r of e.tracks)n.set(r.target,{value:M(r,t)});return n}function P(e,t,n,r){return r===`number`&&typeof e==`number`&&typeof t==`number`?e+(t-e)*n:r===`vec3`&&Array.isArray(e)&&Array.isArray(t)?F(e,t,n):r===`color`&&typeof e==`string`&&typeof t==`string`?I(e,t,n):n<1?e:t}function F(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function I(e,t,n){let r=ee(e),i=ee(t);if(!r||!i)return n<1?e:t;let a=e=>Math.round((r[e]??0)+((i[e]??0)-(r[e]??0))*n);return`#${[a(0),a(1),a(2)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function ee(e){let t=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!t||!t[1])return null;let n=parseInt(t[1],16);return[n>>16&255,n>>8&255,n&255]}var te=n((()=>{O()}));function ne(e,t){let{scene:n}=e,r={};for(let e of n.devices)r[e.id]={position:ie(e.transform.position),rotation:ie(e.transform.rotation),scale:e.transform.scale,params:{...e.params},screenFinish:e.screenFinish,glare:e.glare,visible:!0};let i={};for(let e of n.screens){let n=e.video,r=0;if(n){r=Math.max(0,(t-n.start)*n.playbackRate);let i=e.media&&`duration`in e.media?e.media.duration:void 0;n.loop&&i&&i>0&&(r%=i)}i[e.id]={mediaTime:r,opacity:1}}return{time:t,camera:{position:ie(n.camera.position),target:ie(n.camera.target),fov:n.camera.fov,roll:n.camera.roll,lens:{...n.camera.lens}},devices:r,screens:i,environment:{preset:n.environment.preset,intensity:n.environment.intensity,rotation:n.environment.rotation,glow:n.environment.glow},backdrop:{...n.backdrop},floor:{y:n.floor.mode===`fixed`?n.floor.y??0:null,shadow:n.floor.shadow},set:{...n.set}}}function re(e,t){for(let[n,r]of t){let t=n.split(`.`),[i]=t;if(i===`camera`)L(e.camera,t.slice(1),r.value,r.add);else if(i===`environment`)L(e.environment,t.slice(1),r.value,r.add);else if(i===`backdrop`)L(e.backdrop,t.slice(1),r.value,r.add);else if(i===`set`)L(e.set,t.slice(1),r.value,r.add);else if(i===`devices`||i===`screens`){let n=t[1],a=i===`devices`?e.devices:e.screens,o=n?a[n]:void 0;o&&L(o,t.slice(2),r.value,r.add)}}return e}function L(e,t,n,r){let i=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(!n)return;let r=i[n];typeof r==`object`&&r||(r={},i[n]=r),i=r}let a=t[t.length-1];if(!a)return;let o=i[a];r?typeof o==`number`&&typeof n==`number`?i[a]=o+n:Array.isArray(o)&&Array.isArray(n)&&(i[a]=o.map((e,t)=>typeof e==`number`?e+(n[t]??0):e)):i[a]=Array.isArray(n)?[...n]:n}function R(e,t,n=[],r=k(e.timeline)){let i=ne(e,t);re(i,N(r,t));for(let e of n)re(i,e);return i}var ie,ae=n((()=>{te(),ie=e=>[e[0],e[1],e[2]]}));function oe(e,t,n){let r=new Map;if(t<=0)return r;let i=Math.sin(e*.9)*.3*t,a=Math.sin(e*.6)*1.7*t,o=Math.sin(e*.45+1)*2.9*t;for(let e of n)r.set(`devices.${e}.position`,{value:[0,i,0],add:!0}),r.set(`devices.${e}.rotation`,{value:[a,o,0],add:!0});return r}var se=n((()=>{}));function ce(e,t,n){let r=new Set(n),i=e.timeline.tracks.filter(e=>{let t=e.target.split(`.`)[1];return!(e.target.startsWith(`devices.`)&&t&&r.has(t))&&!e.target.startsWith(`camera.`)}),a=[];for(let e of t.timeline.tracks){let t=le.exec(e.target),r=e.target;if(t&&t[1]!==void 0){let i=n[Number(t[1])];if(!i)continue;r=e.target.replace(le,`devices.${i}.`)}a.push({...e,id:p(`trk`),target:r,keys:e.keys.map(e=>({...e}))})}return{...e,scene:{...e.scene,camera:t.camera?{...e.scene.camera,...t.camera}:e.scene.camera},timeline:{...e.timeline,duration:t.timeline.duration,tracks:[...i,...a]},interaction:t.interaction?{...e.interaction,...t.interaction}:e.interaction}}var le,ue=n((()=>{m(),le=/^devices\.\$(\d+)\./}));function de(e){return!e&&!Le?Re:{lang:e?.lang??Le?.lang,message:e?.message,abortEarly:e?.abortEarly??Le?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Le?.abortPipeEarly}}function fe(e){return ze?.get(e)}function pe(e){return Be?.get(e)}function me(e,t){return Ve?.get(e)?.get(t)}function he(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function ge(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??he(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??me(e.reference,c.lang)??(l?pe(c.lang):null)??r.message??fe(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function _e(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}function ve(e,t){return Object.prototype.hasOwnProperty.call(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function z(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}function ye(e){return e[`~standard`]={version:1,vendor:`valibot`,validate:t=>e[`~run`]({value:t},de())},e}function be(e,t){return{kind:`validation`,type:`max_value`,reference:be,async:!1,expects:`<=${e instanceof Date?e.toJSON():he(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value<=this.requirement)&&ge(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():he(e.value)}),e}}}function xe(e,t){return{kind:`validation`,type:`min_value`,reference:xe,async:!1,expects:`>=${e instanceof Date?e.toJSON():he(e)}`,requirement:e,message:t,"~run"(e,t){return e.typed&&!(e.value>=this.requirement)&&ge(this,`value`,e,t,{received:e.value instanceof Date?e.value.toJSON():he(e.value)}),e}}}function B(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function Se(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function V(e,t){return ye({kind:`schema`,type:`array`,reference:V,expects:`Array`,async:!1,item:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else ge(this,`type`,e,t);return e}})}function Ce(e){return ye({kind:`schema`,type:`boolean`,reference:Ce,expects:`boolean`,async:!1,message:e,"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:ge(this,`type`,e,t),e}})}function we(e,t){return ye({kind:`schema`,type:`literal`,reference:we,expects:he(e),async:!1,literal:e,message:t,"~run"(e,t){return _e(e.value,this.literal)?e.typed=!0:ge(this,`type`,e,t),e}})}function Te(e,t){return ye({kind:`schema`,type:`loose_object`,reference:Te,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Se(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=B(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(ge(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}if(!e.issues||!t.abortEarly)for(let t in n)ve(n,t)&&!Object.prototype.hasOwnProperty.call(this.entries,t)&&(e.value[t]=n[t])}else ge(this,`type`,e,t);return e}})}function Ee(e,t){return ye({kind:`schema`,type:`nullable`,reference:Ee,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===null&&(this.default!==void 0&&(e.value=Se(this,e,t)),e.value===null)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}function H(e){return ye({kind:`schema`,type:`number`,reference:H,expects:`number`,async:!1,message:e,"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:ge(this,`type`,e,t),e}})}function De(e,t){return ye({kind:`schema`,type:`object`,reference:De,expects:`Object`,async:!1,entries:e,message:t,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:Se(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=B(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(ge(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else ge(this,`type`,e,t);return e}})}function U(e,t){return ye({kind:`schema`,type:`optional`,reference:U,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=Se(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}})}function Oe(e,t){return ye({kind:`schema`,type:`picklist`,reference:Oe,expects:z(e.map(he),`|`),async:!1,options:e,message:t,"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:ge(this,`type`,e,t),e}})}function ke(e,t,n){return ye({kind:`schema`,type:`record`,reference:ke,expects:`Object`,async:!1,key:e,value:t,message:n,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(ve(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}a.typed&&o.typed||(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else ge(this,`type`,e,t);return e}})}function W(e){return ye({kind:`schema`,type:`string`,reference:W,expects:`string`,async:!1,message:e,"~run"(e,t){return typeof e.value==`string`?e.typed=!0:ge(this,`type`,e,t),e}})}function Ae(e,t){return ye({kind:`schema`,type:`tuple`,reference:Ae,expects:`Array`,async:!1,items:e,message:t,"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<this.items.length;r++){let i=n[r],a=this.items[r][`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else ge(this,`type`,e,t);return e}})}function je(e){let t;if(e)for(let n of e)if(t)for(let e of n.issues)t.push(e);else t=n.issues;return t}function Me(e,t){return ye({kind:`schema`,type:`union`,reference:Me,expects:z(e.map(e=>e.expects),`|`),async:!1,options:e,message:t,"~run"(e,t){let n,r,i;for(let a of this.options){let o=a[`~run`]({value:e.value},t);if(o.typed){if(o.issues)r?r.push(o):r=[o];else{n=o;break}}else i?i.push(o):i=[o]}if(n)return n;if(r){if(r.length===1)return r[0];ge(this,`type`,e,t,{issues:je(r)}),e.typed=!0}else if(i?.length===1)return i[0];else ge(this,`type`,e,t,{issues:je(i)});return e}})}function Ne(){return ye({kind:`schema`,type:`unknown`,reference:Ne,expects:`unknown`,async:!1,"~run"(e){return e.typed=!0,e}})}function Pe(e,t,n){return ye({kind:`schema`,type:`variant`,reference:Pe,expects:`Object`,async:!1,key:e,options:t,message:n,"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},Ue).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;ge(this,`type`,e,t,{input:n[a],expected:z(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else ge(this,`type`,e,t);return e}})}function Fe(e,t,n){let r=e[`~run`]({value:t},de(n));if(r.issues)throw new He(r.issues);return r.value}function Ie(...e){return ye({...e[0],pipe:e,"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}t.issues&&(n.abortEarly||n.abortPipeEarly)||(t=r[`~run`](t,n))}return t}})}var Le,Re,ze,Be,Ve,He,Ue,We=n((()=>{Re={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0},He=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}},Ue={abortEarly:!0}}));function Ge(e){return Fe(mt,e)}var Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht=n((()=>{We(),f(),m(),Ke=Ae([H(),H()]),qe=Ae([H(),H(),H()]),Je=Ie(H(),xe(0),be(1)),Ye=De({label:W(),frame:W(),back:W(),frameRoughness:Je,backMaterial:U(Oe([`glass`,`metal`,`ceramic`])),accent:U(W())}),Xe=Pe(`source`,[De({kind:Oe([`image`,`video`]),source:we(`idb`),id:W(),hash:W(),mime:W(),width:H(),height:H(),duration:U(H())}),De({kind:Oe([`image`,`video`]),source:we(`url`),url:W(),width:U(H()),height:U(H()),duration:U(H())}),De({kind:we(`image`),source:we(`data`),dataUrl:W(),width:H(),height:H()})]),Ze=De({position:U(qe,()=>[0,0,0]),rotation:U(qe,()=>[0,0,0]),scale:U(H(),1)}),Qe=Te({id:W(),type:Oe([`phone`,`tablet`,`laptop`,`monitor`,`watch`]),spec:W(),finish:Me([W(),Ye]),params:U(ke(W(),H()),()=>({})),transform:U(Ze,()=>({position:[0,0,0],rotation:[0,0,0],scale:1})),screenFinish:U(Oe([`clean`,`glossy`,`matte`]),`matte`),glare:U(Je,1),screens:U(V(W()),()=>[])}),$e=Te({id:W(),media:U(Ee(Xe),null),fit:U(Oe([`cover`,`contain`,`stretch`]),`cover`),offset:U(Ke),video:U(De({start:U(H(),0),loop:U(Ce(),!0),muted:U(we(!0),!0),playbackRate:U(H(),1)})),poster:U(W())}),et=De({fisheye:U(H(),0),chromatic:U(H(),0),vignette:U(H(),0),bloom:U(H(),0),grain:U(H(),0),blur:U(H(),0),focus:U(H(),0),fade:U(H(),0)}),tt=Te({position:U(qe,()=>[0,1.5,48]),target:U(qe,()=>[0,0,0]),fov:U(H(),28),roll:U(H(),0),lens:U(et,()=>Fe(et,{}))}),nt=Te({preset:U(Oe([`studio`,`soft`,`contrast`,`night`]),`studio`),intensity:U(H(),1),rotation:U(H(),0),glow:U(H(),0)}),rt=Te({kind:U(Oe([`none`,`crevice`,`block`]),`none`),seed:U(H(),1),color:U(W(),`#3a3b40`)}),it=Te({kind:U(Oe([`transparent`,`solid`,`gradient`,`image`]),`gradient`),color:U(W()),inner:U(W()),outer:U(W()),angle:U(H()),image:U(Xe),tone:U(Oe([`light`,`dark`]),`light`)}),at=Te({mode:U(Oe([`auto`,`fixed`]),`auto`),y:U(H()),shadow:U(Je,.22)}),ot=Oe([`linear`,`easeInQuad`,`easeOutQuad`,`easeInOutQuad`,`easeInOutCubic`,`easeOutExpo`,`easeOutBack`,`easeInOutSine`]),st=Me([ot,De({bezier:Ae([H(),H(),H(),H()])})]),ct=De({id:U(W()),t:H(),value:Me([H(),qe,W()]),easing:U(st,`easeInOutCubic`),interpolation:U(Oe([`smooth`,`hold`]))}),lt=Te({id:W(),target:W(),type:Oe([`number`,`vec3`,`color`]),keys:U(V(ct),()=>[])}),ut=Te({duration:U(Ie(H(),xe(.1)),4),fps:U(H(),30),tracks:U(V(lt),()=>[]),markers:U(V(De({t:H(),label:W()})))}),dt=Te({trigger:U(Oe([`none`,`load`,`click`,`hover`,`scroll`,`in-view`,`cursor-move`]),`load`),loop:U(Oe([`none`,`loop`,`pingpong`]),`loop`),delay:U(H(),0),speed:U(H(),1),scroll:U(De({start:U(Oe([`enter`,`top`]),`enter`),end:U(Oe([`leave`,`bottom`]),`leave`),smoothing:U(H(),6)})),hover:U(De({reverseOnLeave:U(Ce(),!0)})),cursor:U(De({mode:U(Oe([`device`,`camera`]),`device`),follow:U(H(),0),zoom:U(H(),0),dolly:U(H(),0),shake:U(H(),0),smoothing:U(H(),5)}),()=>({mode:`device`,follow:0,zoom:0,dolly:0,shake:0,smoothing:5})),idle:U(De({float:U(H(),1)}),()=>({float:1}))}),ft=Te({width:U(H(),1920),height:U(H(),1080),fps:U(Oe([24,30,60]),30),range:U(Ae([H(),H()]),()=>[0,4]),format:U(Oe([`png`,`mp4`,`webm`,`webm-alpha`,`png-sequence`]),`mp4`),codec:U(Oe([`auto`,`avc`,`hevc`,`vp9`,`av1`]),`auto`),quality:U(Oe([`draft`,`standard`,`high`]),`standard`),transparent:U(Ce(),!1),includeIdleMotion:U(Ce(),!0)}),pt=Te({devices:U(V(Qe),()=>[]),screens:U(V($e),()=>[]),camera:U(tt,()=>Fe(tt,{})),environment:U(nt,()=>Fe(nt,{})),backdrop:U(it,()=>Fe(it,{})),floor:U(at,()=>Fe(at,{})),set:U(rt,()=>Fe(rt,{}))}),mt=Te({schemaVersion:U(we(1),1),id:U(W(),()=>p()),name:U(W(),`Untitled`),createdAt:U(W(),()=>new Date().toISOString()),updatedAt:U(W(),()=>new Date().toISOString()),scene:U(pt,()=>Fe(pt,{})),timeline:U(ut,()=>Fe(ut,{})),interaction:U(dt,()=>Fe(dt,{})),export:U(ft,()=>Fe(ft,{})),meta:U(ke(W(),Ne()))})}));function gt({name:e=`Untitled`,device:t}={}){let n=[],r=[];if(t){let e=p(`scr`);r.push({id:e}),n.push({id:p(`dev`),type:t.type,spec:t.spec,finish:t.finish,transform:{position:[0,0,0],rotation:[...vt],scale:1},..._t,screens:[e]})}return Ge({name:e,scene:{devices:n,screens:r}})}var _t,vt,yt=n((()=>{m(),ht(),_t={screenFinish:`glossy`,glare:.5},vt=[3.4,-24.1,2.3]}));function bt(e){let t=[];return e.rotation&&t.push({id:`${e.id}.rotation`,target:`devices.$0.rotation`,type:`vec3`,keys:e.rotation}),e.position&&t.push({id:`${e.id}.position`,target:`devices.$0.position`,type:`vec3`,keys:e.position}),e.scale&&t.push({id:`${e.id}.scale`,target:`devices.$0.scale`,type:`number`,keys:e.scale}),e.fov&&t.push({id:`${e.id}.fov`,target:`camera.fov`,type:`number`,keys:e.fov}),e.id===`preset.lid-open`&&t.push({id:`${e.id}.lid`,target:`devices.$0.params.lidAngle`,type:`number`,keys:[xt(0,2,`easeInOutCubic`),xt(2.2,110,St),xt(3.5,110,`linear`)]}),{id:e.id,name:e.name,tags:e.tags,slots:1,timeline:{duration:e.duration,fps:30,tracks:t}}}var xt,St,Ct,wt,Tt=n((()=>{yt(),xt=(e,t,n=`easeInOutCubic`)=>({t:e,value:t,easing:n}),St={bezier:[.4,0,.2,1]},Ct=[{id:`preset.turn`,name:`Turn`,tags:[`phone`,`tablet`,`watch`],duration:4,rotation:[xt(0,[3.4,-24.1,2.3]),xt(2,[-8,28,-4]),xt(4,[3.4,-24.1,2.3],`linear`)]},{id:`preset.push-in`,name:`Camera push-in`,tags:[`phone`,`tablet`,`watch`,`laptop`,`monitor`],duration:4,fov:[xt(0,28,St),xt(2.4,20,St),xt(4,28,`linear`)]},{id:`preset.rise`,name:`Rise`,tags:[`phone`,`tablet`,`watch`],duration:3,position:[xt(0,[0,-6,0],`easeOutExpo`),xt(1.4,[0,0,0],St),xt(3,[0,0,0],`linear`)],rotation:[xt(0,[-30,-40,0],`easeOutExpo`),xt(1.4,vt,St),xt(3,vt,`linear`)]},{id:`preset.flip`,name:`Spin`,tags:[`phone`,`tablet`,`watch`],duration:4,rotation:[xt(0,[0,-20,0]),xt(2,[0,160,0]),xt(4,[0,340,0],`linear`)]},{id:`preset.sway`,name:`Sway`,tags:[`phone`,`tablet`,`watch`],duration:5,rotation:[xt(0,[2,-18,1],`easeInOutSine`),xt(2.5,[-2,18,-1],`easeInOutSine`),xt(5,[2,-18,1],`linear`)],position:[xt(0,[-.6,0,0],`easeInOutSine`),xt(2.5,[.6,0,0],`easeInOutSine`),xt(5,[-.6,0,0],`linear`)]},{id:`preset.zoom-out`,name:`Reveal`,tags:[`phone`,`tablet`,`watch`,`laptop`,`monitor`],duration:3,scale:[xt(0,1.35,`easeOutExpo`),xt(1.6,1,St),xt(3,1,`linear`)],fov:[xt(0,22,`easeOutExpo`),xt(1.6,28,St),xt(3,28,`linear`)]},{id:`preset.lid-open`,name:`Lid opens`,tags:[`laptop`],duration:3.5,position:[xt(0,[0,0,0])]},{id:`preset.orbit`,name:`Swing`,tags:[`laptop`,`monitor`],duration:5,rotation:[xt(0,[0,-28,0],`easeInOutSine`),xt(2.5,[0,28,0],`easeInOutSine`),xt(5,[0,-28,0],`linear`)]}],wt=Ct.map(bt)}));function Et(e,t){return Math.sin(e*13.1+t)*.5+Math.sin(e*7.3+t*1.7)*.3+Math.sin(e*23.7+t*.4)*.2}function Dt(e,t,n,r,i){let a=new Map,{follow:o,zoom:s,dolly:c,shake:l,mode:u}=t;if(o<=0&&s<=0&&c<=0&&l<=0)return a;let d=It(Mt(i.target,i.position)),f=It(Lt(d,[0,1,0])),p=Lt(f,d),m=[0,0,0],h=0;if(o>0){if(u===`device`)for(let t of r)a.set(`devices.${t}.rotation`,{value:[-e.y*o*10,e.x*o*16,0],add:!0});else{let t=Ft(Mt(i.target,i.position))*.12*o;kt(m,Pt(f,e.x*t)),kt(m,Pt(p,e.y*t*.6))}}if(s>0){let t=1-Math.min(1,Math.hypot(e.x,e.y));h-=s*10*t}if(c>0){let t=Ft(Mt(i.target,i.position));kt(m,Pt(d,e.y*c*t*.15))}if(l>0){let t=l*Math.min(1,e.speed);for(let e of r){let r=a.get(`devices.${e}.rotation`)?.value,i=[Et(n,1)*2*t,Et(n,2)*2*t,Et(n,3)*1*t];a.set(`devices.${e}.rotation`,{value:r?Nt(r,i):i,add:!0})}kt(m,[Et(n,4)*.2*t,Et(n,5)*.2*t,0])}return(m[0]||m[1]||m[2])&&a.set(`camera.position`,{value:m,add:!0}),h&&a.set(`camera.fov`,{value:h,add:!0}),a}function Ot(e,t){let n=new Map;if(!e)return n;let r=Mt(t.target,t.position);return n.set(`camera.position`,{value:Pt(r,1-2**(-e/100)),add:!0}),n}function kt(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function At(e,t,n,r){let i=1-Math.exp(-n*r);return{x:e.x+(t.x-e.x)*i,y:e.y+(t.y-e.y)*i,speed:e.speed+(t.speed-e.speed)*Math.min(1,i*2)}}var jt,Mt,Nt,Pt,Ft,It,Lt,Rt=n((()=>{jt={x:0,y:0,speed:0},Mt=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],Nt=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],Pt=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],Ft=e=>Math.hypot(e[0],e[1],e[2]),It=e=>{let t=Ft(e)||1;return[e[0]/t,e[1]/t,e[2]/t]},Lt=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}));function zt(e){let t=gt({name:e.name,device:e.device}),n=t.scene.devices[0];n&&(e.device.type===`laptop`||e.device.type===`monitor`?(n.transform.rotation=e.rotation??[0,0,0],t.interaction.idle.float=0):e.rotation&&(n.transform.rotation=e.rotation)),t.scene.backdrop={...e.backdrop},e.shadow!==void 0&&(t.scene.floor.shadow=e.shadow),e.camera&&(t.scene.camera={...t.scene.camera,...e.camera});let[r,i]=Jt[e.aspect];t.export.width=r,t.export.height=i,e.environment&&(t.scene.environment={...t.scene.environment,...e.environment}),e.lens&&(t.scene.camera.lens={...t.scene.camera.lens,...e.lens}),e.set&&(t.scene.set={...e.set}),e.float!==void 0&&(t.interaction.idle.float=e.float),e.timeline&&n&&(t.timeline={...t.timeline,duration:e.timeline.duration,tracks:e.timeline.tracks.map(e=>({...e,target:e.target.replace(`$0`,n.id),keys:e.keys.map(e=>({...e}))}))}),e.cursor&&(t.interaction.cursor={...t.interaction.cursor,...e.cursor}),e.trigger&&(t.interaction.trigger=e.trigger);let a=e.preset?wt.find(t=>t.id===e.preset):void 0;if(a&&n){let e=t.scene.camera;t=ce(t,a,[n.id]),t.scene.camera={...e,lens:e.lens}}return t.export.range=[0,t.timeline.duration],{id:e.id,name:e.name,description:e.description,tags:[e.device.type],aspect:e.aspect,doc:t}}var G,Bt,Vt,Ht,Ut,Wt,Gt,Kt,qt,Jt,Yt,Xt=n((()=>{ue(),Tt(),yt(),G=(e,t,n=`easeInOutCubic`)=>({t:e,value:t,easing:n}),Bt={bezier:[.45,0,.85,.6]},Vt={bezier:[.15,.4,.3,1]},Ht={bezier:[.4,0,.2,1]},Ut={duration:10,tracks:[{id:`crevice.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[-26,8,74],Ht),G(1.6,[1,1.5,46],Bt),G(2.5,[5.5,-4.5,21],Vt),G(5.4,[3,-2.5,18.5],Ht),G(6.5,[-4.5,3.5,24],`linear`),G(8.3,[-4.5,-3.5,24],Ht),G(9.5,[0,.5,46],`linear`),G(10,[0,.5,47],`linear`)]},{id:`crevice.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[0,1.5,0],Ht),G(1.6,[0,1,0],Bt),G(2.5,[0,5,0],Vt),G(5.4,[0,4.5,0],Ht),G(6.5,[0,2.5,0],`linear`),G(8.3,[0,-3.5,0],Ht),G(9.5,[0,.5,0],`linear`),G(10,[0,.5,0],`linear`)]},{id:`crevice.camera.fov`,target:`camera.fov`,type:`number`,keys:[G(0,26,Ht),G(1.6,28,Bt),G(2.5,36,Vt),G(5.4,35,Ht),G(6.5,32,`linear`),G(8.3,32,Ht),G(9.5,28,`linear`),G(10,28,`linear`)]},{id:`crevice.camera.roll`,target:`camera.roll`,type:`number`,keys:[G(0,3,Ht),G(1.6,0,Bt),G(2.5,-7,Vt),G(5.4,-5,Ht),G(6.5,2,`linear`),G(8.3,2,Ht),G(9.5,0,`linear`),G(10,0,`linear`)]},{id:`crevice.camera.fade`,target:`camera.lens.fade`,type:`number`,keys:[G(0,1,`easeOutQuad`),G(.8,0,`linear`),G(9.6,0,`easeInQuad`),G(10,1,`linear`)]}]},Wt={bezier:[.3,0,.12,1]},Gt={duration:6,tracks:[{id:`block.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[-11,-.6,30],Wt),G(3.2,[-31,-7.3,62],`easeInOutSine`),G(6,[-30,-7,60],`linear`)]},{id:`block.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[3,.8,4],Wt),G(3.2,[3,7.8,2],`easeInOutSine`),G(6,[3,8,2],`linear`)]},{id:`block.lid`,target:`devices.$0.params.lidAngle`,type:`number`,keys:[G(0,2,`linear`),G(.35,2,Ht),G(2.7,100,`linear`),G(6,100,`linear`)]}]},Kt={duration:7,tracks:[{id:`push.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[-4,2,41],`linear`),G(.4,[-4,2,41],Ht),G(2.8,[9.4,-9.6,13.3],Vt),G(6.4,[8.8,-9.8,12.4],`linear`),G(7,[8.8,-9.8,12.4],`linear`)]},{id:`push.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[0,0,0],`linear`),G(.4,[0,0,0],Ht),G(2.8,[0,-3,0],Vt),G(6.4,[0,-3.4,0],`linear`),G(7,[0,-3.4,0],`linear`)]},{id:`push.camera.fov`,target:`camera.fov`,type:`number`,keys:[G(0,28,`linear`),G(.4,28,Ht),G(2.8,34,Vt),G(7,34,`linear`)]},{id:`push.camera.roll`,target:`camera.roll`,type:`number`,keys:[G(0,0,`linear`),G(.4,0,Ht),G(2.8,-9,Vt),G(6.4,-10,`linear`),G(7,-10,`linear`)]},{id:`push.camera.fade`,target:`camera.lens.fade`,type:`number`,keys:[G(0,0,`linear`),G(6.4,0,`easeInQuad`),G(6.95,1,`linear`),G(7,1,`linear`)]}]},qt={duration:10,tracks:[{id:`sweep.camera.position`,target:`camera.position`,type:`vec3`,keys:[G(0,[4.5,.5,11],`linear`),G(.6,[4.5,.5,11],Ht),G(4,[3,1.5,10.5],Ht),G(5.4,[-1.5,-7.5,12.5],Vt),G(7.4,[-2,-8,12],`linear`),G(10,[-2,-8,12],`linear`)]},{id:`sweep.camera.target`,target:`camera.target`,type:`vec3`,keys:[G(0,[0,5.2,0],`linear`),G(.6,[0,5.2,0],Ht),G(4,[.3,4.6,0],Ht),G(5.4,[0,-3.8,0],Vt),G(7.4,[0,-4.2,0],`linear`),G(10,[0,-4.2,0],`linear`)]},{id:`sweep.camera.fov`,target:`camera.fov`,type:`number`,keys:[G(0,36,`linear`),G(10,36,`linear`)]},{id:`sweep.camera.roll`,target:`camera.roll`,type:`number`,keys:[G(0,14,`linear`),G(.6,14,Ht),G(4,10,Ht),G(5.4,-6,Vt),G(7.4,-8,`linear`),G(10,-8,`linear`)]},{id:`sweep.camera.fade`,target:`camera.lens.fade`,type:`number`,keys:[G(0,1,`easeOutQuad`),G(.9,0,`linear`),G(7.4,0,`easeInQuad`),G(8.2,1,`linear`),G(10,1,`linear`)]}]},Jt={"16:9":[1920,1080],"9:16":[1080,1920],"1:1":[1080,1080],"4:3":[1440,1080]},Yt=[{id:`tpl.iphone-crevice`,name:`Stone crevice`,description:`An iPhone wedged between dark rocks, lit by its own screen. Push-in, close pass, pull back.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},backdrop:{kind:`solid`,color:`#030304`,tone:`dark`},shadow:0,aspect:`16:9`,rotation:[0,-6,0],float:0,cursor:{mode:`camera`,follow:.25},environment:{preset:`night`,intensity:1,glow:1.6},lens:{vignette:.45,bloom:.3,grain:.2,blur:.08},set:{kind:`crevice`,seed:3,color:`#3d3d40`},timeline:Ut},{id:`tpl.iphone-push`,name:`Grey push-in`,description:`An iPhone standing on grey. The camera swings round and closes in on the lower screen, then fades through black.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},backdrop:{kind:`solid`,color:`#cccccc`,tone:`light`},shadow:0,aspect:`4:3`,rotation:[0,0,0],float:0,cursor:{mode:`camera`,follow:.25},environment:{preset:`studio`,intensity:1},timeline:Kt},{id:`tpl.iphone-night-sweep`,name:`Night sweep`,description:`An iPhone in the dark, lit along its rim. The camera rises out of black, sweeps down the screen and fades away.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},backdrop:{kind:`solid`,color:`#000000`,tone:`dark`},shadow:0,aspect:`4:3`,rotation:[0,0,0],float:0,cursor:{mode:`camera`,follow:.25},environment:{preset:`night`,intensity:1,glow:1.2},lens:{vignette:.3,grain:.1},timeline:qt},{id:`tpl.iphone-turn`,name:`iPhone turn`,description:`A slow turn with a camera push-in. The classic hero shot.`,device:{type:`phone`,spec:`phone.iphone-18-pro`,finish:`black`},preset:`preset.turn`,backdrop:{kind:`gradient`,inner:`#f6f6f4`,outer:`#d5d5d1`,tone:`light`},aspect:`16:9`,cursor:{follow:.6}},{id:`tpl.iphone-reel`,name:`iPhone reel`,description:`Vertical, dark, rises into frame. Made for Reels and Shorts.`,device:{type:`phone`,spec:`phone.iphone-18-pro-max`,finish:`burgundy`},preset:`preset.rise`,backdrop:{kind:`gradient`,inner:`#2c2f39`,outer:`#0b0c10`,tone:`dark`},shadow:.5,aspect:`9:16`,camera:{position:[0,1.5,62],fov:26}},{id:`tpl.ipad-sway`,name:`iPad sway`,description:`A gentle sway on a warm backdrop for app showcases.`,device:{type:`tablet`,spec:`tablet.ipad-pro-13`,finish:`silver`},preset:`preset.sway`,backdrop:{kind:`gradient`,inner:`#fbf0e6`,outer:`#dfc2a8`,tone:`light`},aspect:`16:9`,camera:{position:[0,2,78],fov:28}},{id:`tpl.macbook-block`,name:`Concrete block`,description:`A MacBook on the corner of a concrete block. The lid opens as the camera cranes down, then holds.`,device:{type:`laptop`,spec:`laptop.macbook-pro-14`,finish:`space-black`},backdrop:{kind:`solid`,color:`#d1d1d1`,tone:`light`},shadow:0,aspect:`4:3`,camera:{position:[-30,-7,60],target:[3,8,2],fov:30},cursor:{mode:`camera`,follow:.2},environment:{preset:`studio`,intensity:1},lens:{grain:.08},set:{kind:`block`,seed:1,color:`#8a8a88`},timeline:Gt},{id:`tpl.macbook-open`,name:`MacBook lid opens`,description:`The lid lifts to reveal your site. Ends on a resting shot.`,device:{type:`laptop`,spec:`laptop.macbook-pro-14`,finish:`space-black`},preset:`preset.lid-open`,backdrop:{kind:`gradient`,inner:`#e4ecf3`,outer:`#b7c6d6`,tone:`light`},aspect:`16:9`,camera:{position:[0,14,70],target:[0,9,0],fov:30},rotation:[0,-14,0],cursor:{follow:.3,mode:`camera`}},{id:`tpl.macbook-orbit`,name:`MacBook orbit`,description:`A slow orbit around an open laptop on a dark set.`,device:{type:`laptop`,spec:`laptop.macbook-pro-16`,finish:`silver`},preset:`preset.orbit`,backdrop:{kind:`solid`,color:`#101114`,tone:`dark`},shadow:.55,aspect:`16:9`,camera:{position:[0,16,82],target:[0,10,0],fov:30}},{id:`tpl.studio-display`,name:`Studio Display push-in`,description:`Desktop software on a 27-inch display, slow push-in.`,device:{type:`monitor`,spec:`monitor.studio-display`,finish:`silver`},preset:`preset.push-in`,backdrop:{kind:`gradient`,inner:`#f6f6f4`,outer:`#d5d5d1`,tone:`light`},aspect:`16:9`,camera:{position:[0,32,150],target:[0,29,0],fov:28}},{id:`tpl.watch-square`,name:`Watch square`,description:`Square crop of a floating Apple Watch, turning. For feeds.`,device:{type:`watch`,spec:`watch.series-12-46`,finish:`jet-black`},preset:`preset.turn`,backdrop:{kind:`gradient`,inner:`#e4ecf3`,outer:`#b7c6d6`,tone:`light`},aspect:`1:1`,camera:{position:[0,.5,16],fov:26}},{id:`tpl.ultra-reveal`,name:`Ultra reveal`,description:`Apple Watch Ultra scales down into frame on a dark set.`,device:{type:`watch`,spec:`watch.ultra-4`,finish:`natural-titanium`},preset:`preset.zoom-out`,backdrop:{kind:`gradient`,inner:`#2c2f39`,outer:`#0b0c10`,tone:`dark`},shadow:.5,aspect:`9:16`,camera:{position:[0,.5,18],fov:26}}],Yt.map(zt)}));function Zt(e){if(typeof e!=`object`||!e)throw TypeError(`Project must be an object`);let t={...e},n=typeof t.schemaVersion==`number`?t.schemaVersion:1;if(n>1)throw new $t(n);for(;n<1;){let e=Qt[n];if(!e)throw Error(`No migration from schema version ${n}`);t=e(t),n++,t.schemaVersion=n}return Ge(t)}var Qt,$t,en=n((()=>{f(),ht(),Qt={},$t=class extends Error{found;constructor(e){super(`Project schema version ${e} is newer than this build supports (1). Update the app.`),this.found=e,this.name=`UnsupportedSchemaError`}}})),tn=n((()=>{c(),d(),f(),m(),O(),te(),ae(),se(),ue(),Tt(),Rt(),Xt(),ht(),en(),yt()}));function nn(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function rn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function an(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function on(){let e=an(`canvas`);return e.style.display=`block`,e}function sn(...e){let t=`THREE.`+e.shift();Ea?Ea(`log`,t,...e):console.log(t,...e)}function cn(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function K(...e){e=cn(e);let t=`THREE.`+e.shift();if(Ea)Ea(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function q(...e){e=cn(e);let t=`THREE.`+e.shift();if(Ea)Ea(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function ln(...e){let t=e.join(` `);t in Ta||(Ta[t]=!0,K(...e))}function un(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function dn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ka[e&255]+ka[e>>8&255]+ka[e>>16&255]+ka[e>>24&255]+`-`+ka[t&255]+ka[t>>8&255]+`-`+ka[t>>16&15|64]+ka[t>>24&255]+`-`+ka[n&63|128]+ka[n>>8&255]+`-`+ka[n>>16&255]+ka[n>>24&255]+ka[r&255]+ka[r>>8&255]+ka[r>>16&255]+ka[r>>24&255]).toLowerCase()}function fn(e,t,n){return Math.max(t,Math.min(n,e))}function pn(e,t){return(e%t+t)%t}function mn(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function hn(e,t,n){return e===t?0:(n-e)/(t-e)}function gn(e,t,n){return(1-n)*e+n*t}function _n(e,t,n,r){return gn(e,t,1-Math.exp(-n*r))}function vn(e,t=1){return t-Math.abs(pn(e,t*2)-t)}function yn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function bn(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function xn(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Sn(e,t){return e+Math.random()*(t-e)}function Cn(e){return e*(.5-Math.random())}function wn(e){e!==void 0&&(Aa=e);let t=Aa+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Tn(e){return e*ja}function En(e){return e*Ma}function Dn(e){return e>0&&Number.isInteger(e)&&2**Math.round(Math.log2(e))===e}function On(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function kn(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function An(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:K(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function jn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:case Uint8ClampedArray:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function Mn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`THREE.MathUtils: Invalid component type.`)}}function Nn(){let e={enabled:!0,workingColorSpace:va,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n||(this.spaces[t].transfer===`srgb`&&(e.r=Pn(e.r),e.g=Pn(e.g),e.b=Pn(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Fn(e.r),e.g=Fn(e.g),e.b=Fn(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?ya:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return ln(`ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return ln(`ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[va]:{primaries:t,whitePoint:r,transfer:ya,toXYZ:Ra,fromXYZ:za,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:_a},outputColorSpaceConfig:{drawingBufferColorSpace:_a}},[_a]:{primaries:t,whitePoint:r,transfer:ba,toXYZ:Ra,fromXYZ:za,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:_a}}}),e}function Pn(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Fn(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}function In(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Ha.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(K(`Texture: Unable to serialize Texture.`),{})}function Ln(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function Rn(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){us.fromArray(e,a);let o=i.x*Math.abs(us.x)+i.y*Math.abs(us.y)+i.z*Math.abs(us.z),s=t.dot(us),c=n.dot(us),l=r.dot(us);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}function zn(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;Qs.copy(s),Qs.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(Qs);return l<n.near||l>n.far?null:{distance:l,point:Qs.clone(),object:e}}function Bn(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,Ks),e.getVertexPosition(c,qs),e.getVertexPosition(l,Js);let u=zn(e,t,n,r,Ks,qs,Js,Zs);if(u){let e=new Y;Xo.getBarycoord(Zs,Ks,qs,Js,e),i&&(u.uv=Xo.getInterpolatedAttribute(i,s,c,l,e,new J)),a&&(u.uv1=Xo.getInterpolatedAttribute(a,s,c,l,e,new J)),o&&(u.normal=Xo.getInterpolatedAttribute(o,s,c,l,e,new Y),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new Y,materialIndex:0};Xo.getNormal(Ks,qs,Js,t.normal),u.face=t,u.barycoord=e}return u}function Vn(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Hn(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Un(e,t){let n=1-e;return n*n*t}function Wn(e,t){return 2*(1-e)*e*t}function Gn(e,t){return e*e*t}function Kn(e,t,n,r){return Un(e,t)+Wn(e,n)+Gn(e,r)}function qn(e,t){let n=1-e;return n*n*n*t}function Jn(e,t){let n=1-e;return 3*n*n*e*t}function Yn(e,t){return 3*(1-e)*e*e*t}function Xn(e,t){return e*e*e*t}function Zn(e,t,n,r,i){return qn(e,t)+Jn(e,n)+Yn(e,r)+Xn(e,i)}function Qn(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=$n(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=or(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return tr(a,o,n,s,c,l,0),o}function $n(e,t,n,r,i){let a;if(i===Ar(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Dr(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Dr(i/r|0,e[i],e[i+1],a);return a&&yr(a,a.next)&&(Or(a),a=a.next),a}function er(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(yr(n,n.next)||vr(n.prev,n,n.next)===0)){if(Or(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function tr(e,t,n,r,i,a,o){if(!e)return;!o&&a&&dr(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?rr(e,r,i,a):nr(e))t.push(c.i,e.i,l.i),Or(e),e=l.next,s=l.next;else if(e=l,e===s){o?o===1?(e=ir(er(e),t),tr(e,t,n,r,i,a,2)):o===2&&ar(e,t,n,r,i,a):tr(er(e),t,n,r,i,a,1);break}}}function nr(e){let t=e.prev,n=e,r=e.next;if(vr(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&gr(i,s,a,c,o,l,m.x,m.y)&&vr(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function rr(e,t,n,r){let i=e.prev,a=e,o=e.next;if(vr(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=pr(p,m,t,n,r),v=pr(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&gr(s,u,c,d,l,f,y.x,y.y)&&vr(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&gr(s,u,c,d,l,f,b.x,b.y)&&vr(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&gr(s,u,c,d,l,f,y.x,y.y)&&vr(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&gr(s,u,c,d,l,f,b.x,b.y)&&vr(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function ir(e,t){let n=e;do{let r=n.prev,i=n.next.next;!yr(r,i)&&br(r,n,n.next,i)&&wr(r,i)&&wr(i,r)&&(t.push(r.i,n.i,i.i),Or(n),Or(n.next),n=e=i),n=n.next}while(n!==e);return er(n)}function ar(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&_r(o,e)){let s=Er(o,e);o=er(o,o.next),s=er(s,s.next),tr(o,t,n,r,i,a,0),tr(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function or(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=$n(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(mr(o))}i.sort(sr);for(let e=0;e<i.length;e++)n=cr(i[e],n);return n}function sr(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function cr(e,t){let n=lr(e,t);if(!n)return t;let r=Er(n,e);return er(r,r.next),er(n,n.next)}function lr(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(yr(e,n))return n;do{if(yr(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&hr(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);wr(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&ur(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function ur(e,t){return vr(e.prev,e,t.prev)<0&&vr(t.next,e,e.next)<0}function dr(e,t,n,r){let i=e;do i.z===0&&(i.z=pr(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,fr(i)}function fr(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function pr(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function mr(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function hr(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function gr(e,t,n,r,i,a,o,s){return(e!==o||t!==s)&&hr(e,t,n,r,i,a,o,s)}function _r(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Cr(e,t)&&(wr(e,t)&&wr(t,e)&&Tr(e,t)&&(vr(e.prev,e,t.prev)||vr(e,t.prev,t))||yr(e,t)&&vr(e.prev,e,e.next)>0&&vr(t.prev,t,t.next)>0)}function vr(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function yr(e,t){return e.x===t.x&&e.y===t.y}function br(e,t,n,r){let i=Sr(vr(e,t,n)),a=Sr(vr(e,t,r)),o=Sr(vr(n,r,e)),s=Sr(vr(n,r,t));return!!(i!==a&&o!==s||i===0&&xr(e,n,t)||a===0&&xr(e,r,t)||o===0&&xr(n,e,r)||s===0&&xr(n,t,r))}function xr(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 Sr(e){return e>0?1:e<0?-1:0}function Cr(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&br(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function wr(e,t){return vr(e.prev,e,e.next)<0?vr(e,t,e.next)>=0&&vr(e,e.prev,t)>=0:vr(e,t,e.prev)<0||vr(e,e.next,t)<0}function Tr(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Er(e,t){let n=kr(e.i,e.x,e.y),r=kr(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Dr(e,t,n,r){let i=kr(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 Or(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 kr(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Ar(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function jr(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Mr(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function Nr(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Pr(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Fr(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(Lr(i))i.isRenderTargetTexture?(K(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i)){if(Lr(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice()}else t[n][r]=i}}return t}function Ir(e){let t={};for(let n=0;n<e.length;n++){let r=Fr(e[n]);for(let e in r)t[e]=r[e]}return t}function Lr(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Rr(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function zr(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Ba.workingColorSpace}function Br(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function Vr(e){return e!==void 0&&e.inTangents!==void 0&&e.outTangents!==void 0}function Hr(e,t,n,r,i){let a=1-e;return a*a*a*t+3*a*a*e*n+3*a*e*e*r+e*e*e*i}function Ur(e,t,n,r,i){let a=1-e;return 3*a*a*(n-t)+6*a*e*(r-n)+3*e*e*(i-r)}function Wr(e,t,n,r,i){let a=(e-t)/(i-t);for(let o=0;o<8;o++){let o=Hr(a,t,n,r,i)-e;if(Math.abs(o)<1e-10)break;let s=Ur(a,t,n,r,i);if(Math.abs(s)<1e-10)break;a=Math.max(0,Math.min(1,a-o/s))}return a}function Gr(e,t){for(let n=0,r=e.length;n!==r;n+=2)e[n]*=t}function Kr(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}function qr(e,t,n,r){let i=Jr(r);switch(n){case _i:return e*t;case Si:return e*t/i.components*i.byteLength;case Ci:return e*t/i.components*i.byteLength;case wi:return e*t*2/i.components*i.byteLength;case Ti:return e*t*2/i.components*i.byteLength;case vi:return e*t*3/i.components*i.byteLength;case yi:return e*t*4/i.components*i.byteLength;case Ei:return e*t*4/i.components*i.byteLength;case Di:case Oi:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ki:case Ai:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Mi:case Pi:return Math.max(e,16)*Math.max(t,8)/4;case ji:case Ni:return Math.max(e,8)*Math.max(t,8)/2;case Fi:case Ii:case Ri:case zi:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Li:case Bi:case Vi:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Hi:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Ui:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Wi:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Gi:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Ki:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case qi:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Ji:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Yi:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Xi:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Zi:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Qi:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case $i:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case ea:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case ta:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case na:case ra:case ia:return Math.ceil(e/4)*Math.ceil(t/4)*16;case aa:case oa:return Math.ceil(e/4)*Math.ceil(t/4)*8;case sa:case ca:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function Jr(e){switch(e){case ii:case ai:return{byteLength:1,components:1};case si:case oi:case di:return{byteLength:2,components:1};case fi:case pi:return{byteLength:2,components:4};case li:case ci:case ui:return{byteLength:4,components:1};case hi:case gi:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}var Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,J,Pa,Y,Fa,Ia,X,La,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu=n((()=>{Yr=1e3,Xr=1001,Zr=1002,Qr=1003,$r=1004,ei=1005,ti=1006,ni=1007,ri=1008,ii=1009,ai=1010,oi=1011,si=1012,ci=1013,li=1014,ui=1015,di=1016,fi=1017,pi=1018,mi=1020,hi=35902,gi=35899,_i=1021,vi=1022,yi=1023,bi=1026,xi=1027,Si=1028,Ci=1029,wi=1030,Ti=1031,Ei=1033,Di=33776,Oi=33777,ki=33778,Ai=33779,ji=35840,Mi=35841,Ni=35842,Pi=35843,Fi=36196,Ii=37492,Li=37496,Ri=37488,zi=37489,Bi=37490,Vi=37491,Hi=37808,Ui=37809,Wi=37810,Gi=37811,Ki=37812,qi=37813,Ji=37814,Yi=37815,Xi=37816,Zi=37817,Qi=37818,$i=37819,ea=37820,ta=37821,na=36492,ra=36494,ia=36495,aa=36283,oa=36284,sa=36285,ca=36286,la=2300,ua=2301,da=2302,fa=2303,pa=2400,ma=2401,ha=2402,ga=3200,_a=`srgb`,va=`srgb-linear`,ya=`linear`,ba=`srgb`,xa=7680,Sa=35044,Ca=`300 es`,wa=2e3,Ta={},Ea=null,Da={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},Oa=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},ka=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`),Aa=1234567,ja=Math.PI/180,Ma=180/Math.PI,Na={DEG2RAD:ja,RAD2DEG:Ma,generateUUID:dn,clamp:fn,euclideanModulo:pn,mapLinear:mn,inverseLerp:hn,lerp:gn,damp:_n,pingpong:vn,smoothstep:yn,smootherstep:bn,randInt:xn,randFloat:Sn,randFloatSpread:Cn,seededRandom:wn,degToRad:Tn,radToDeg:En,isPowerOfTwo:Dn,ceilPowerOfTwo:On,floorPowerOfTwo:kn,setQuaternionFromProperEuler:An,normalize:Mn,denormalize:jn},J=class e{static{e.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,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}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=fn(this.x,e.x,t.x),this.y=fn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=fn(this.x,e,t),this.y=fn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(fn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(fn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Pa=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:K(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let 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}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(fn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Y=class e{static{e.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ia.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ia.setFromAxisAngle(e,t))}applyMatrix3(e){let 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}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=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])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,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()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=fn(this.x,e.x,t.x),this.y=fn(this.y,e.y,t.y),this.z=fn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=fn(this.x,e,t),this.y=fn(this.y,e,t),this.z=fn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(fn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Fa.copy(this).projectOnVector(e),this.sub(Fa)}reflect(e){return this.sub(Fa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(fn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let 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}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Fa=new Y,Ia=new Pa,X=class e{static{e.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return ln(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(La.makeScale(e,t)),this}rotate(e){return ln(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(La.makeRotation(-e)),this}translate(e,t){return ln(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(La.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let 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}clone(){return new this.constructor().fromArray(this.elements)}},La=new X,Ra=new X().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),za=new X().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Ba=Nn(),Ha=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Va===void 0&&(Va=an(`canvas`)),Va.width=e.width,Va.height=e.height;let t=Va.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Va}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=an(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=Pn(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(Pn(t[e]/255)*255):t[e]=Pn(t[e]);return{data:t,width:e.width,height:e.height}}return K(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Ua=0,Wa=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Ua++}),this.uuid=dn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<`u`&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width,t.height,t.depth||0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(In(r[t].image)):e.push(In(r[t]))}else e=In(r);n.url=e}return t||(e.images[this.uuid]=n),n}},Ga=0,Ka=new Y,qa=class e extends Oa{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=Xr,i=Xr,a=ti,o=ri,s=yi,c=ii,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ga++}),this.uuid=dn(),this.name=``,this.source=new Wa(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new J(0,0),this.repeat=new J(1,1),this.center=new J(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new X,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Ka).x}get height(){return this.source.getSize(Ka).y}get depth(){return this.source.getSize(Ka).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,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.normalized=e.normalized,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.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){K(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?K(`Texture.setValues(): property '${t}' does not exist.`):r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Yr:e.x-=Math.floor(e.x);break;case Xr:e.x=e.x<0?0:1;break;case Zr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Yr:e.y-=Math.floor(e.y);break;case Xr:e.y=e.y<0?0:1;break;case Zr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}},qa.DEFAULT_IMAGE=null,qa.DEFAULT_MAPPING=300,qa.DEFAULT_ANISOTROPY=1,Ja=class e{static{e.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=fn(this.x,e.x,t.x),this.y=fn(this.y,e.y,t.y),this.z=fn(this.z,e.z,t.z),this.w=fn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=fn(this.x,e,t),this.y=fn(this.y,e,t),this.z=fn(this.z,e,t),this.w=fn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(fn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Ya=class extends Oa{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:ti,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Ja(0,0,e,t),this.scissorTest=!1,this.viewport=new Ja(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},i=new qa(r),a=n.count;for(let e=0;e<a;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:ti,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new Wa(n)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null){if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture}return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:`dispose`})}},Xa=class extends Ya{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Za=class extends qa{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Qr,this.minFilter=Qr,this.wrapR=Xr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Qa=class extends qa{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=Qr,this.minFilter=Qr,this.wrapR=Xr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}},$a=class e{static{e.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/eo.setFromMatrixColumn(e,0).length(),i=1/eo.setFromMatrixColumn(e,1).length(),a=1/eo.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]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(no,e,ro)}lookAt(e,t,n){let r=this.elements;return oo.subVectors(e,t),oo.lengthSq()===0&&(oo.z=1),oo.normalize(),io.crossVectors(n,oo),io.lengthSq()===0&&(Math.abs(n.z)===1?oo.x+=1e-4:oo.z+=1e-4,oo.normalize(),io.crossVectors(n,oo)),io.normalize(),ao.crossVectors(oo,io),r[0]=io.x,r[4]=ao.x,r[8]=oo.x,r[1]=io.y,r[5]=ao.y,r[9]=oo.y,r[2]=io.z,r[6]=ao.z,r[10]=oo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let 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}getMaxScaleOnAxis(){let 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))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let 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}makeRotationY(e){let 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}makeRotationZ(e){let 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}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=eo.set(r[0],r[1],r[2]).length(),o=eo.set(r[4],r[5],r[6]).length(),s=eo.set(r[8],r[9],r[10]).length();i<0&&(a=-a),to.copy(this);let c=1/a,l=1/o,u=1/s;return to.elements[0]*=c,to.elements[1]*=c,to.elements[2]*=c,to.elements[4]*=l,to.elements[5]*=l,to.elements[6]*=l,to.elements[8]*=u,to.elements[9]*=u,to.elements[10]*=u,t.setFromRotationMatrix(to),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=wa,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=wa,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let 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}},eo=new Y,to=new $a,no=new Y(0,0,0),ro=new Y(1,1,1),io=new Y,ao=new Y,oo=new Y,so=new $a,co=new Pa,lo=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(fn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-fn(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(fn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-fn(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(fn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-fn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:K(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return so.makeRotationFromQuaternion(e),this.setFromRotationMatrix(so,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return co.setFromEuler(this),this.setFromQuaternion(co,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}},lo.DEFAULT_ORDER=`XYZ`,uo=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&1<<e)}},fo=0,po=new Y,mo=new Pa,ho=new $a,go=new Y,_o=new Y,vo=new Y,yo=new Pa,bo=new Y(1,0,0),xo=new Y(0,1,0),So=new Y(0,0,1),Co={type:`added`},wo={type:`removed`},To={type:`childadded`,child:null},Eo={type:`childremoved`,child:null},Do=class e extends Oa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:fo++}),this.uuid=dn(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new Y,n=new lo,r=new Pa,i=new Y(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new $a},normalMatrix:{value:new X}}),this.matrix=new $a,this.matrixWorld=new $a,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new uo,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return mo.setFromAxisAngle(e,t),this.quaternion.multiply(mo),this}rotateOnWorldAxis(e,t){return mo.setFromAxisAngle(e,t),this.quaternion.premultiply(mo),this}rotateX(e){return this.rotateOnAxis(bo,e)}rotateY(e){return this.rotateOnAxis(xo,e)}rotateZ(e){return this.rotateOnAxis(So,e)}translateOnAxis(e,t){return po.copy(e).applyQuaternion(this.quaternion),this.position.add(po.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(bo,e)}translateY(e){return this.translateOnAxis(xo,e)}translateZ(e){return this.translateOnAxis(So,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ho.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?go.copy(e):go.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),_o.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ho.lookAt(_o,go,this.up):ho.lookAt(go,_o,this.up),this.quaternion.setFromRotationMatrix(ho),r&&(ho.extractRotation(r.matrixWorld),mo.setFromRotationMatrix(ho),this.quaternion.premultiply(mo.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(q(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Co),To.child=e,this.dispatchEvent(To),To.child=null):q(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(wo),Eo.child=e,this.dispatchEvent(Eo),Eo.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ho.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ho.multiply(e.parent.matrixWorld)),e.applyMatrix4(ho),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Co),To.child=e,this.dispatchEvent(To),To.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_o,e,vo),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_o,yo,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}dispose(){this.dispatchEvent({type:`dispose`})}},Do.DEFAULT_UP=new Y(0,1,0),Do.DEFAULT_MATRIX_AUTO_UPDATE=!0,Do.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,Oo=class extends Do{constructor(){super(),this.isGroup=!0,this.type=`Group`}},ko={type:`move`},Ao=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Oo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(ko)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new Oo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},jo={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},Mo={h:0,s:0,l:0},No={h:0,s:0,l:0},Po=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_a){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ba.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Ba.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ba.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Ba.workingColorSpace){if(e=pn(e,1),t=fn(t,0,1),n=fn(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=Ln(i,r,e+1/3),this.g=Ln(i,r,e),this.b=Ln(i,r,e-1/3)}return Ba.colorSpaceToWorking(this,r),this}setStyle(e,t=_a){function n(t){t!==void 0&&parseFloat(t)<1&&K(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:K(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);K(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=_a){let n=jo[e.toLowerCase()];return n===void 0?K(`Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Pn(e.r),this.g=Pn(e.g),this.b=Pn(e.b),this}copyLinearToSRGB(e){return this.r=Fn(e.r),this.g=Fn(e.g),this.b=Fn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_a){return Ba.workingToColorSpace(Fo.copy(this),e),Math.round(fn(Fo.r*255,0,255))*65536+Math.round(fn(Fo.g*255,0,255))*256+Math.round(fn(Fo.b*255,0,255))}getHexString(e=_a){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ba.workingColorSpace){Ba.workingToColorSpace(Fo.copy(this),t);let n=Fo.r,r=Fo.g,i=Fo.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=Ba.workingColorSpace){return Ba.workingToColorSpace(Fo.copy(this),t),e.r=Fo.r,e.g=Fo.g,e.b=Fo.b,e}getStyle(e=_a){Ba.workingToColorSpace(Fo.copy(this),e);let t=Fo.r,n=Fo.g,r=Fo.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(Mo),this.setHSL(Mo.h+e,Mo.s+t,Mo.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Mo),e.getHSL(No);let n=gn(Mo.h,No.h,t),r=gn(Mo.s,No.s,t),i=gn(Mo.l,No.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Fo=new Po,Po.NAMES=jo,Io=class extends Do{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new lo,this.environmentIntensity=1,this.environmentRotation=new lo,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}},Lo=new Y,Ro=new Y,zo=new Y,Bo=new Y,Vo=new Y,Ho=new Y,Uo=new Y,Wo=new Y,Go=new Y,Ko=new Y,qo=new Ja,Jo=new Ja,Yo=new Ja,Xo=class e{constructor(e=new Y,t=new Y,n=new Y){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Lo.subVectors(e,t),r.cross(Lo);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Lo.subVectors(r,t),Ro.subVectors(n,t),zo.subVectors(e,t);let a=Lo.dot(Lo),o=Lo.dot(Ro),s=Lo.dot(zo),c=Ro.dot(Ro),l=Ro.dot(zo),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Bo)!==null&&Bo.x>=0&&Bo.y>=0&&Bo.x+Bo.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Bo)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Bo.x),s.addScaledVector(a,Bo.y),s.addScaledVector(o,Bo.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return qo.setScalar(0),Jo.setScalar(0),Yo.setScalar(0),qo.fromBufferAttribute(e,t),Jo.fromBufferAttribute(e,n),Yo.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(qo,i.x),a.addScaledVector(Jo,i.y),a.addScaledVector(Yo,i.z),a}static isFrontFacing(e,t,n,r){return Lo.subVectors(n,t),Ro.subVectors(e,t),Lo.cross(Ro).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Lo.subVectors(this.c,this.b),Ro.subVectors(this.a,this.b),Lo.cross(Ro).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Vo.subVectors(r,n),Ho.subVectors(i,n),Wo.subVectors(e,n);let s=Vo.dot(Wo),c=Ho.dot(Wo);if(s<=0&&c<=0)return t.copy(n);Go.subVectors(e,r);let l=Vo.dot(Go),u=Ho.dot(Go);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(Vo,a);Ko.subVectors(e,i);let f=Vo.dot(Ko),p=Ho.dot(Ko);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Ho,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Uo.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Uo,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Vo,a).addScaledVector(Ho,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Zo=class{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint($o.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint($o.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=$o.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,$o):$o.fromBufferAttribute(r,t),$o.applyMatrix4(e.matrixWorld),this.expandByPoint($o);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),es.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),es.copy(e.boundingBox)),es.applyMatrix4(e.matrixWorld),this.union(es)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,$o),$o.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ss),cs.subVectors(this.max,ss),ts.subVectors(e.a,ss),ns.subVectors(e.b,ss),rs.subVectors(e.c,ss),is.subVectors(ns,ts),as.subVectors(rs,ns),os.subVectors(ts,rs);let t=[0,-is.z,is.y,0,-as.z,as.y,0,-os.z,os.y,is.z,0,-is.x,as.z,0,-as.x,os.z,0,-os.x,-is.y,is.x,0,-as.y,as.x,0,-os.y,os.x,0];return!Rn(t,ts,ns,rs,cs)||(t=[1,0,0,0,1,0,0,0,1],!Rn(t,ts,ns,rs,cs))?!1:(ls.crossVectors(is,as),t=[ls.x,ls.y,ls.z],Rn(t,ts,ns,rs,cs))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,$o).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize($o).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Qo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qo)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Qo=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],$o=new Y,es=new Zo,ts=new Y,ns=new Y,rs=new Y,is=new Y,as=new Y,os=new Y,ss=new Y,cs=new Y,ls=new Y,us=new Y,ds=new Y,fs=new J,ps=0,ms=class extends Oa{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ps++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Sa,this.updateRanges=[],this.gpuType=ui,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)fs.fromBufferAttribute(this,t),fs.applyMatrix3(e),this.setXY(t,fs.x,fs.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix3(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix4(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyNormalMatrix(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.transformDirection(e),this.setXYZ(t,ds.x,ds.y,ds.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=jn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Mn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=jn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Mn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=jn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Mn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=jn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Mn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=jn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Mn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Mn(t,this.array),n=Mn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Mn(t,this.array),n=Mn(n,this.array),r=Mn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=Mn(t,this.array),n=Mn(n,this.array),r=Mn(r,this.array),i=Mn(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:`dispose`})}},hs=class extends ms{constructor(e,t,n){super(new Uint16Array(e),t,n)}},gs=class extends ms{constructor(e,t,n){super(new Uint32Array(e),t,n)}},_s=class extends ms{constructor(e,t,n){super(new Float32Array(e),t,n)}},vs=new Zo,ys=new Y,bs=new Y,xs=class{constructor(e=new Y,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?vs.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ys.subVectors(e,this.center);let t=ys.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(ys,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(bs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ys.copy(e.center).add(bs)),this.expandByPoint(ys.copy(e.center).sub(bs))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Ss=0,Cs=new $a,ws=new Do,Ts=new Y,Es=new Zo,Ds=new Zo,Os=new Y,ks=class e extends Oa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ss++}),this.uuid=dn(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(nn(e)?gs:hs)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new X().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Cs.makeRotationFromQuaternion(e),this.applyMatrix4(Cs),this}rotateX(e){return Cs.makeRotationX(e),this.applyMatrix4(Cs),this}rotateY(e){return Cs.makeRotationY(e),this.applyMatrix4(Cs),this}rotateZ(e){return Cs.makeRotationZ(e),this.applyMatrix4(Cs),this}translate(e,t,n){return Cs.makeTranslation(e,t,n),this.applyMatrix4(Cs),this}scale(e,t,n){return Cs.makeScale(e,t,n),this.applyMatrix4(Cs),this}lookAt(e){return ws.lookAt(e),ws.updateMatrix(),this.applyMatrix4(ws.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ts).negate(),this.translate(Ts.x,Ts.y,Ts.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new _s(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&K(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zo);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)q(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));else{if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Es.setFromBufferAttribute(n),this.morphTargetsRelative?(Os.addVectors(this.boundingBox.min,Es.min),this.boundingBox.expandByPoint(Os),Os.addVectors(this.boundingBox.max,Es.max),this.boundingBox.expandByPoint(Os)):(this.boundingBox.expandByPoint(Es.min),this.boundingBox.expandByPoint(Es.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&q(`BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.`,this)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xs);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)q(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new Y,1/0);else if(e){let n=this.boundingSphere.center;if(Es.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Ds.setFromBufferAttribute(n),this.morphTargetsRelative?(Os.addVectors(Es.min,Ds.min),Es.expandByPoint(Os),Os.addVectors(Es.max,Ds.max),Es.expandByPoint(Os)):(Es.expandByPoint(Ds.min),Es.expandByPoint(Ds.max))}Es.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Os.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Os));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Os.fromBufferAttribute(a,t),o&&(Ts.fromBufferAttribute(e,t),Os.add(Ts)),r=Math.max(r,n.distanceToSquared(Os))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&q(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){q(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new ms(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[];for(let e=0;e<n.count;e++)o[e]=new Y,s[e]=new Y;let c=new Y,l=new Y,u=new Y,d=new J,f=new J,p=new J,m=new Y,h=new Y;function g(e,t,r){c.fromBufferAttribute(n,e),l.fromBufferAttribute(n,t),u.fromBufferAttribute(n,r),d.fromBufferAttribute(i,e),f.fromBufferAttribute(i,t),p.fromBufferAttribute(i,r),l.sub(c),u.sub(c),f.sub(d),p.sub(d);let a=1/(f.x*p.y-p.x*f.y);isFinite(a)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(a),h.copy(u).multiplyScalar(f.x).addScaledVector(l,-p.x).multiplyScalar(a),o[e].add(m),o[t].add(m),o[r].add(m),s[e].add(h),s[t].add(h),s[r].add(h))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)g(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new Y,y=new Y,b=new Y,x=new Y;function S(e){b.fromBufferAttribute(r,e),x.copy(b);let t=o[e];v.copy(t),v.sub(b.multiplyScalar(b.dot(t))).normalize(),y.crossVectors(x,t);let n=y.dot(s[e])<0?-1:1;a.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=_.length;t<n;++t){let n=_[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)S(e.getX(t+0)),S(e.getX(t+1)),S(e.getX(t+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new ms(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new Y,i=new Y,a=new Y,o=new Y,s=new Y,c=new Y,l=new Y,u=new Y;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Os.fromBufferAttribute(e,t),Os.normalize(),e.setXYZ(t,Os.x,Os.y,Os.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new ms(a,r,i)}if(this.index===null)return K(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},As=new Y,js=new Y,Ms=new X,Ns=class{constructor(e=new Y(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=As.subVectors(n,t).cross(js.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(As),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Ms.getNormalMatrix(e),r=this.coplanarPoint(As).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},Ps=0,Fs=class extends Oa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ps++}),this.uuid=dn(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Po(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=xa,this.stencilZFail=xa,this.stencilZPass=xa,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){K(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?K(`Material: '${t}' is not a property of THREE.${this.type}.`):r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(e=>e.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Po().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(e=>new Ns().fromJSON(e))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new J().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new J().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},Is=new Y,Ls=new Y,Rs=new Y,zs=new Y,Bs=class{constructor(e=new Y,t=new Y(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Is)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Is.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Is.copy(this.origin).addScaledVector(this.direction,t),Is.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Ls.copy(e).add(t).multiplyScalar(.5),Rs.copy(t).sub(e).normalize(),zs.copy(this.origin).sub(Ls);let i=e.distanceTo(t)*.5,a=-this.direction.dot(Rs),o=zs.dot(this.direction),s=-zs.dot(Rs),c=zs.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Ls).addScaledVector(Rs,d),f}intersectSphere(e,t){if(e.radius<0)return null;Is.subVectors(e.center,this.origin);let n=Is.dot(this.direction),r=Is.dot(Is)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Is)!==null}intersectTriangle(e,t,n,r,i){let a=this.origin,o=this.direction,s=o.x,c=o.y,l=o.z,u=e.x-a.x,d=e.y-a.y,f=e.z-a.z,p=t.x-a.x,m=t.y-a.y,h=t.z-a.z,g=n.x-a.x,_=n.y-a.y,v=n.z-a.z,y=Math.abs(s),b=Math.abs(c),x=Math.abs(l),S,C,w,T,E,D,O,k,A,j,M,N;if(y>=b&&y>=x?(w=s,D=u,A=p,N=g,s>=0?(S=c,C=l,T=d,E=f,O=m,k=h,j=_,M=v):(S=l,C=c,T=f,E=d,O=h,k=m,j=v,M=_)):b>=x?(w=c,D=d,A=m,N=_,c>=0?(S=l,C=s,T=f,E=u,O=h,k=p,j=v,M=g):(S=s,C=l,T=u,E=f,O=p,k=h,j=g,M=v)):(w=l,D=f,A=h,N=v,l>=0?(S=s,C=c,T=u,E=d,O=p,k=m,j=g,M=_):(S=c,C=s,T=d,E=u,O=m,k=p,j=_,M=g)),w===0)return null;let P=S/w,F=C/w,I=1/w,ee=T-P*D,te=E-F*D,ne=O-P*A,re=k-F*A,L=j-P*N,R=M-F*N,ie=L*re-R*ne,ae=ee*R-te*L,oe=ne*te-re*ee;if(r){if(ie<0||ae<0||oe<0)return null}else if((ie<0||ae<0||oe<0)&&(ie>0||ae>0||oe>0))return null;let se=ie+ae+oe;if(se===0)return null;let ce=I*(ie*D+ae*A+oe*N);return(se>0?ce<0:ce>0)?null:this.at(ce/se,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Vs=class extends Fs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Po(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lo,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Hs=new $a,Us=new Bs,Ws=new xs,Gs=new Y,Ks=new Y,qs=new Y,Js=new Y,Ys=new Y,Xs=new Y,Zs=new Y,Qs=new Y,$s=class extends Do{constructor(e=new ks,t=new Vs){super(),this.isMesh=!0,this.type=`Mesh`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){Xs.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(Ys.fromBufferAttribute(s,e),a?Xs.addScaledVector(Ys,r):Xs.addScaledVector(Ys.sub(t),r))}t.add(Xs)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),Ws.copy(n.boundingSphere),Ws.applyMatrix4(i),Us.copy(e.ray).recast(e.near),!(Ws.containsPoint(Us.origin)===!1&&(Us.intersectSphere(Ws,Gs)===null||Us.origin.distanceToSquared(Gs)>(e.far-e.near)**2))&&(Hs.copy(i).invert(),Us.copy(e.ray).applyMatrix4(Hs),(n.boundingBox===null||Us.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,Us)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Bn(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Bn(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Bn(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Bn(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}},ec=class extends qa{constructor(e=null,t=1,n=1,r,i,a,o,s,c=Qr,l=Qr,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},tc=new xs,nc=new J(.5,.5),rc=new Y,ic=class{constructor(e=new Ns,t=new Ns,n=new Ns,r=new Ns,i=new Ns,a=new Ns){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=wa,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),tc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),tc.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(tc)}intersectsSprite(e){tc.center.set(0,0,0);let t=nc.distanceTo(e.center);return tc.radius=.7071067811865476+t,tc.applyMatrix4(e.matrixWorld),this.intersectsSphere(tc)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(rc.x=r.normal.x>0?e.max.x:e.min.x,rc.y=r.normal.y>0?e.max.y:e.min.y,rc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(rc)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},ac=class extends qa{constructor(e,t,n,r,i=ti,a=ti,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},oc=class extends qa{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},sc=class extends qa{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},cc=class extends qa{constructor(e,t,n=li,r,i,a,o=Qr,s=Qr,c,l=bi,u=1){if(l!==1026&&l!==1027)throw Error(`THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Wa(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},lc=class extends cc{constructor(e,t=li,n=301,r,i,a=Qr,o=Qr,s,c=bi){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},uc=class extends qa{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},dc=class e extends ks{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new _s(c,3)),this.setAttribute(`normal`,new _s(l,3)),this.setAttribute(`uv`,new _s(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new Y;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},fc=class e extends ks{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new Y,l=new J;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new _s(a,3)),this.setAttribute(`normal`,new _s(o,3)),this.setAttribute(`uv`,new _s(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},pc=class e extends ks{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new _s(u,3)),this.setAttribute(`normal`,new _s(d,3)),this.setAttribute(`uv`,new _s(f,2));function _(){let a=new Y,_=new Y,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new J,m=new Y,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},mc=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){K(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new J:new Y);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new Y,r=[],i=[],a=[],o=new Y,s=new $a;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new Y)}i[0]=new Y,a[0]=new Y;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(fn(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(fn(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},hc=class extends mc{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new J){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},gc=class extends hc{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}},_c=new Y,vc=new Y,yc=new Vn,bc=new Vn,xc=new Vn,Sc=class extends mc{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new Y){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(vc.subVectors(r[0],r[1]).add(r[0]),c=vc);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(_c.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=_c),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),yc.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),bc.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),xc.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(yc.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),bc.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),xc.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(yc.calc(s),bc.calc(s),xc.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new Y().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},Cc=class extends mc{constructor(e=new J,t=new J,n=new J,r=new J){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new J){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Zn(e,r.x,i.x,a.x,o.x),Zn(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},wc=class extends mc{constructor(e=new Y,t=new Y,n=new Y,r=new Y){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new Y){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Zn(e,r.x,i.x,a.x,o.x),Zn(e,r.y,i.y,a.y,o.y),Zn(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Tc=class extends mc{constructor(e=new J,t=new J){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new J){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new J){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ec=class extends mc{constructor(e=new Y,t=new Y){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new Y){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Y){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Dc=class extends mc{constructor(e=new J,t=new J,n=new J){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new J){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Kn(e,r.x,i.x,a.x),Kn(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Oc=class extends mc{constructor(e=new Y,t=new Y,n=new Y){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Y){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Kn(e,r.x,i.x,a.x),Kn(e,r.y,i.y,a.y),Kn(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},kc=class extends mc{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new J){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Hn(o,s.x,c.x,l.x,u.x),Hn(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new J().fromArray(n))}return this}},Ac=Object.freeze({__proto__:null,ArcCurve:gc,CatmullRomCurve3:Sc,CubicBezierCurve:Cc,CubicBezierCurve3:wc,EllipseCurve:hc,LineCurve:Tc,LineCurve3:Ec,QuadraticBezierCurve:Dc,QuadraticBezierCurve3:Oc,SplineCurve:kc}),jc=class extends mc{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new Ac[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new Ac[n.type]().fromJSON(n))}return this}},Mc=class extends jc{constructor(e){super(),this.type=`Path`,this.currentPoint=new J,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new Tc(this.currentPoint.clone(),new J(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new Dc(this.currentPoint.clone(),new J(e,t),new J(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new Cc(this.currentPoint.clone(),new J(e,t),new J(n,r),new J(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new kc(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new hc(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Nc=class extends Mc{constructor(e){super(e),this.uuid=dn(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new Mc().fromJSON(n))}return this}},Pc=class{static triangulate(e,t,n=2){return Qn(e,t,n)}},Fc=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];jr(e),Mr(n,e);let a=e.length;t.forEach(jr);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,Mr(n,t[e]);let o=Pc.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}},Ic=class e extends ks{constructor(e=new Nc([new J(.5,.5),new J(-.5,.5),new J(-.5,-.5),new J(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new _s(r,3)),this.setAttribute(`uv`,new _s(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0||t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Lc:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new Y,b=new Y,x=new Y}l||(p=0,u=0,d=0,f=0);let S=e.extractPoints(o),C=S.shape,w=S.holes;if(!Fc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];Fc.isClockWise(t)&&(w[e]=t.reverse())}}function T(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));s<=10000000000000001e-36*c*c?(e.splice(r,1),n--):t=i}}T(C),w.forEach(T);let E=w.length,D=C;for(let e=0;e<E;e++){let t=w[e];C=C.concat(t)}function O(e,t,n){return t||q(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let k=C.length;function A(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new J(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new J(r/a,i/a)}let j=[];for(let e=0,t=D.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),j[e]=A(D[e],D[n],D[r]);let M=[],N,P=j.concat();for(let e=0,t=E;e<t;e++){let t=w[e];N=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),N[e]=A(t[e],t[r],t[i]);M.push(N),P=P.concat(N)}let F;if(p===0)F=Fc.triangulateShape(D,w);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=D.length;t<n;t++){let n=O(D[t],j[t],a);L(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=E;e<n;e++){let n=w[e];N=M[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=O(n[e],N[e],a);L(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}F=Fc.triangulateShape(e,t)}let I=F.length,ee=d+f;for(let e=0;e<k;e++){let t=l?O(C[e],P[e],ee):C[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),L(x.x,x.y,x.z)):L(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<k;t++){let n=l?O(C[t],P[t],ee):C[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),L(x.x,x.y,x.z)):L(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=D.length;e<t;e++){let t=O(D[e],j[e],r);L(t.x,t.y,c+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];N=M[e];for(let e=0,i=t.length;e<i;e++){let i=O(t[e],N[e],r);_?L(i.x,i.y+g[s-1].y,g[s-1].x+n):L(i.x,i.y,c+n)}}}te(),ne();function te(){let e=r.length/3;if(l){let e=0,t=k*e;for(let e=0;e<I;e++){let n=F[e];R(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=k*e;for(let e=0;e<I;e++){let n=F[e];R(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<I;e++){let t=F[e];R(t[2],t[1],t[0])}for(let e=0;e<I;e++){let t=F[e];R(t[0]+k*s,t[1]+k*s,t[2]+k*s)}}n.addGroup(e,r.length/3-e,0)}function ne(){let e=r.length/3,t=0;re(D,t),t+=D.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];re(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function re(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=k*e,a=k*(e+1);ie(t+r+n,t+i+n,t+i+a,t+r+a)}}}function L(e,t,n){a.push(e),a.push(t),a.push(n)}function R(e,t,i){ae(e),ae(t),ae(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);oe(o[0]),oe(o[1]),oe(o[2])}function ie(e,t,i,a){ae(e),ae(t),ae(a),ae(t),ae(i),ae(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);oe(s[0]),oe(s[1]),oe(s[3]),oe(s[1]),oe(s[2]),oe(s[3])}function ae(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function oe(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Nr(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new Ac[i.type]().fromJSON(i)),new e(r,t.options)}},Lc={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new J(a,o),new J(s,c),new J(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new J(o,1-c),new J(l,1-d),new J(f,1-m),new J(h,1-_)]:[new J(s,1-c),new J(u,1-d),new J(p,1-m),new J(g,1-_)]}},Rc=class e extends ks{constructor(e=[new J(0,-.5),new J(.5,0),new J(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=fn(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new Y,d=new J,f=new Y,p=new Y,m=new Y,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new _s(a,3)),this.setAttribute(`uv`,new _s(o,2)),this.setAttribute(`normal`,new _s(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},zc=class e extends ks{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new _s(p,3)),this.setAttribute(`normal`,new _s(m,3)),this.setAttribute(`uv`,new _s(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},Bc=class e extends ks{constructor(e=.5,t=1,n=32,r=1,i=0,a=Math.PI*2){super(),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);let o=[],s=[],c=[],l=[],u=e,d=(t-e)/r,f=new Y,p=new J;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;f.x=u*Math.cos(r),f.y=u*Math.sin(r),s.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,l.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r,a=r+n+1,s=r+n+2,c=r+1;o.push(i,a,c),o.push(a,s,c)}}this.setIndex(o),this.setAttribute(`position`,new _s(s,3)),this.setAttribute(`normal`,new _s(c,3)),this.setAttribute(`uv`,new _s(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Vc=class e extends ks{constructor(e=new Nc([new J(0,.5),new J(-.5,-.5),new J(.5,-.5)]),t=12){super(),this.type=`ShapeGeometry`,this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(let t=0;t<e.length;t++)c(e[t]),this.addGroup(o,s,t),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new _s(r,3)),this.setAttribute(`normal`,new _s(i,3)),this.setAttribute(`uv`,new _s(a,2));function c(e){let o=r.length/3,c=e.extractPoints(t),l=c.shape,u=c.holes;Fc.isClockWise(l)===!1&&(l=l.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];Fc.isClockWise(t)===!0&&(u[e]=t.reverse())}let d=Fc.triangulateShape(l,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];l=l.concat(t)}for(let e=0,t=l.length;e<t;e++){let t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],r=t[0]+o,i=t[1]+o,a=t[2]+o;n.push(r,i,a),s+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return Pr(t,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}return new e(r,t.curveSegments)}},Hc=class e extends ks{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new Y,d=new Y,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=a+_*o,y=e*Math.cos(v),b=Math.sqrt(e*e-y*y),x=0;f===0&&a===0?x=.5/t:f===n&&s===Math.PI&&(x=-.5/t);for(let e=0;e<=t;e++){let n=e/t,a=r+n*i;u.x=-b*Math.cos(a),u.y=y,u.z=b*Math.sin(a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(n+x,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new _s(p,3)),this.setAttribute(`normal`,new _s(m,3)),this.setAttribute(`uv`,new _s(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Uc=class extends Fs{constructor(e){super(),this.isShadowMaterial=!0,this.type=`ShadowMaterial`,this.color=new Po(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},Wc={clone:Fr,merge:Ir},Gc=`void main() {
|
|
2
2
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
|
-
}`,
|
|
3
|
+
}`,Kc=`void main() {
|
|
4
4
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
5
|
-
}`,Kc=class extends Ps{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Wc,this.fragmentShader=Gc,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Pr(e.uniforms),this.uniformsGroups=Lr(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case`t`:this.uniforms[n].value=t[r.value]||null;break;case`c`:this.uniforms[n].value=new No().setHex(r.value);break;case`v2`:this.uniforms[n].value=new J().fromArray(r.value);break;case`v3`:this.uniforms[n].value=new Y().fromArray(r.value);break;case`v4`:this.uniforms[n].value=new qa().fromArray(r.value);break;case`m3`:this.uniforms[n].value=new X().fromArray(r.value);break;case`m4`:this.uniforms[n].value=new Qa().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let t in e.extensions)this.extensions[t]=e.extensions[t];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},qc=class extends Kc{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type=`RawShaderMaterial`}},Jc=class extends Ps{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new No(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new No(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new co,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Yc=class extends Jc{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return dn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new No(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new No(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new No(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){this._retroreflectivity>0!=e>0&&this.version++,this._retroreflectivity=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Xc=class extends Ps{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=ha,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Zc=class extends Ps{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},Qc=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`THREE.Interpolant: Call to abstract method.`)}intervalChanged_(){}},$c=class extends Qc{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:fa,endingEnd:fa}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case pa:i=e,o=2*t-n;break;case ma:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case pa:a=e,s=2*n-t;break;case ma:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},el=class extends Qc{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},tl=class extends Qc{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},nl=class extends Qc{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let d=o*2,f=e-1;for(let p=0;p!==o;++p){let o=a[c+p],m=a[s+p],h=f*d+p*2,g=u[h],_=u[h+1],v=e*d+p*2,y=l[v],b=l[v+1],x=Ur(n,t,g,y,r);i[p]=Vr(x,o,_,b,m)}return i}},rl=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=zr(t,this.TimeBufferType),this.values=zr(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:zr(e.times,Array),values:zr(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t),Br(e.settings)&&(n.settings={inTangents:zr(e.settings.inTangents,Array),outTangents:zr(e.settings.outTangents,Array)})}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new tl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new el(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $c(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new nl(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case ca:t=this.InterpolantFactoryMethodDiscrete;break;case la:t=this.InterpolantFactoryMethodLinear;break;case ua:t=this.InterpolantFactoryMethodSmooth;break;case da:t=this.InterpolantFactoryMethodBezier}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return K(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ca;case this.InterpolantFactoryMethodLinear:return la;case this.InterpolantFactoryMethodSmooth:return ua;case this.InterpolantFactoryMethodBezier:return da}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e;Br(this.settings)&&(Wr(this.settings.inTangents,e),Wr(this.settings.outTangents,e))}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(q(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(q(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){q(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){q(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&nn(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){q(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===ua,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0])){if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,Br(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}},rl.prototype.ValueTypeName=``,rl.prototype.TimeBufferType=Float32Array,rl.prototype.ValueBufferType=Float32Array,rl.prototype.DefaultInterpolation=la,il=class extends rl{constructor(e,t,n){super(e,t,n)}},il.prototype.ValueTypeName=`bool`,il.prototype.ValueBufferType=Array,il.prototype.DefaultInterpolation=ca,il.prototype.InterpolantFactoryMethodLinear=void 0,il.prototype.InterpolantFactoryMethodSmooth=void 0,al=class extends rl{constructor(e,t,n,r){super(e,t,n,r)}},al.prototype.ValueTypeName=`color`,ol=class extends rl{constructor(e,t,n,r){super(e,t,n,r)}},ol.prototype.ValueTypeName=`number`,sl=class extends Qc{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Na.slerpFlat(i,0,a,c-o,a,c,s);return i}},cl=class extends rl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new sl(this.times,this.values,this.getValueSize(),e)}},cl.prototype.ValueTypeName=`quaternion`,cl.prototype.InterpolantFactoryMethodSmooth=void 0,ll=class extends rl{constructor(e,t,n){super(e,t,n)}},ll.prototype.ValueTypeName=`string`,ll.prototype.ValueBufferType=Array,ll.prototype.DefaultInterpolation=ca,ll.prototype.InterpolantFactoryMethodLinear=void 0,ll.prototype.InterpolantFactoryMethodSmooth=void 0,ul=class extends rl{constructor(e,t,n,r){super(e,t,n,r)}},ul.prototype.ValueTypeName=`vector`,dl={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(Gr(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!Gr(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},fl=class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return e=e.normalize(`NFC`),s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||=new AbortController,this._abortController}},pl=new fl,ml=class{constructor(e){this.manager=e===void 0?pl:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}},ml.DEFAULT_MATERIAL_NAME=`__DEFAULT`,hl={},gl=class extends Error{constructor(e,t){super(e),this.response=t}},_l=class extends ml{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=dl.get(`file:${e}`);if(i!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0);return}if(hl[e]!==void 0){hl[e].push({onLoad:t,onProgress:n,onError:r});return}hl[e]=[],hl[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&K(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=hl[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}}});return new Response(c)}throw new gl(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{dl.add(`file:${e}`,t);let n=hl[e];delete hl[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=hl[e];if(n===void 0)throw this.manager.itemError(e),t;delete hl[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},vl=class extends Eo{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new No(e),this.intensity=t}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},yl=new Qa,bl=new Y,xl=new Y,Sl=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.mapType=ri,this.map=null,this.mapPass=null,this.matrix=new Qa,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new rc,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new qa(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera;bl.setFromMatrixPosition(e.matrixWorld),t.position.copy(bl),xl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(xl),t.updateMatrixWorld(),this._updateMatrix(t,this.matrix,this._frustum)}_updateMatrix(e,t,n,r){yl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),n.setFromProjectionMatrix(yl,e.coordinateSystem,e.reversedDepth);let i=this._frameExtents,a=r?r.z/i.x:1,o=r?r.w/i.y:1,s=r?r.x/i.x:0,c=r?r.y/i.y:0;e.coordinateSystem===2001||e.reversedDepth?t.set(.5*a,0,0,.5*a+s,0,.5*o,0,.5*o+c,0,0,1,0,0,0,0,1):t.set(.5*a,0,0,.5*a+s,0,.5*o,0,.5*o+c,0,0,.5,.5,0,0,0,1),t.multiply(yl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return e.intensity=this.intensity,e.bias=this.bias,e.normalBias=this.normalBias,e.radius=this.radius,e.blurSamples=this.blurSamples,e.mapSize=this.mapSize.toArray(),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Cl=new Y,wl=new Na,Tl=new Y,El=class extends Eo{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new Qa,this.projectionMatrix=new Qa,this.projectionMatrixInverse=new Qa,this.coordinateSystem=Ca,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Cl,wl,Tl),Tl.x===1&&Tl.y===1&&Tl.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Cl,wl,Tl.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(Cl,wl,Tl),Tl.x===1&&Tl.y===1&&Tl.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Cl,wl,Tl.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Dl=new Y,Ol=new J,kl=new J,Al=class extends El{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=ja*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Aa*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ja*2*Math.atan(Math.tan(Aa*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Dl.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Dl.x,Dl.y).multiplyScalar(-e/Dl.z),Dl.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Dl.x,Dl.y).multiplyScalar(-e/Dl.z)}getViewSize(e,t){return this.getViewBounds(e,Ol,kl),t.subVectors(kl,Ol)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Aa*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},jl=class extends Sl{constructor(){super(new Al(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=ja*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this.aspect=e.aspect,this}toJSON(){let e=super.toJSON();return e.focus=this.focus,e.aspect=this.aspect,e}},Ml=class extends vl{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(Eo.DEFAULT_UP),this.updateMatrix(),this.target=new Eo,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new jl}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},Nl=class extends El{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Pl=class extends Sl{constructor(){super(new Nl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Fl=class extends vl{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(Eo.DEFAULT_UP),this.updateMatrix(),this.target=new Eo,this.shadow=new Pl}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},Il=-90,Ll=1,Rl=class extends Eo{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Al(Il,Ll,e,t);r.layers=this.layers,this.add(r);let i=new Al(Il,Ll,e,t);i.layers=this.layers,this.add(i);let a=new Al(Il,Ll,e,t);a.layers=this.layers,this.add(a);let o=new Al(Il,Ll,e,t);o.layers=this.layers,this.add(o);let s=new Al(Il,Ll,e,t);s.layers=this.layers,this.add(s);let c=new Al(Il,Ll,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let h=!1;h=e.isWebGLRenderer===!0?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,i),e.setRenderTarget(n,1,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,4,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},zl=class extends Al{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},Bl=`\\[\\]\\.:\\/`,Vl=RegExp(`[\\[\\]\\.:\\/]`,`g`),Hl=`[^\\[\\]\\.:\\/]`,Ul=`[^`+Bl.replace(`\\.`,``)+`]`,Wl=`((?:WC+[\\/:])*)`.replace(`WC`,Hl),Gl=`(WCOD+)?`.replace(`WCOD`,Ul),Kl=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,Hl),ql=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,Hl),Jl=RegExp(`^`+Wl+Gl+Kl+ql+`$`),Yl=[`material`,`materials`,`bones`,`map`],Xl=class{constructor(e,t,n){let r=n||Zl.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Zl=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(Vl,``)}static parseTrackName(e){let t=Jl.exec(e);if(t===null)throw Error(`THREE.PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);Yl.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){K(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){q(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){q(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){q(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){q(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){q(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){q(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){q(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;q(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){q(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){q(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Zl.Composite=Xl,Zl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Zl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Zl.prototype.GetterByBindingType=[Zl.prototype._getValue_direct,Zl.prototype._getValue_array,Zl.prototype._getValue_arrayElement,Zl.prototype._getValue_toArray],Zl.prototype.SetterByBindingTypeAndVersioning=[[Zl.prototype._setValue_direct,Zl.prototype._setValue_direct_setNeedsUpdate,Zl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Zl.prototype._setValue_array,Zl.prototype._setValue_array_setNeedsUpdate,Zl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Zl.prototype._setValue_arrayElement,Zl.prototype._setValue_arrayElement_setNeedsUpdate,Zl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Zl.prototype._setValue_fromArray,Zl.prototype._setValue_fromArray_setNeedsUpdate,Zl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],class e{static{e.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}},Ql=new J,$l=class{constructor(e=new J(1/0,1/0),t=new J(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Ql.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ql).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},eu=class{constructor(){this.type=`ShapePath`,this.color=new No,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new jc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(e,t){let n=!1,r=t.length;for(let i=0,a=r-1;i<r;a=i++){let r=t[i],o=t[a];r.y>e.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(n=!n)}return n}function t(t,n){let r=n.getCenter(new J);if(e(r,t))return r;let i=r.y,a=[],o=t.length;for(let e=0;e<o;e++){let n=t[e],r=t[(e+1)%o];if(n.y>i!=r.y>i){let e=n.x+(i-n.y)*(r.x-n.x)/(r.y-n.y);a.push(e)}}return a.length>1&&(a.sort((e,t)=>e-t),r.x=(a[0]+a[1])/2),r}let n=this.userData.style&&this.userData.style.fillRule||`nonzero`;n!==`nonzero`&&n!==`evenodd`&&(K(`Fill-rule "`+n+`" is not supported, falling back to "nonzero".`),n=`nonzero`);let r=n===`nonzero`?(e=>e!==0):(e=>!!(e&1)),i=[];for(let e of this.subPaths){let n=e.getPoints();if(n.length<3)continue;let r=Pc.area(n);if(r===0)continue;let a=new $l;for(let e=0;e<n.length;e++)a.expandByPoint(n[e]);i.push({subPath:e,points:n,boundingBox:a,interiorPoint:t(n,a),absArea:Math.abs(r),winding:r<0?-1:1,container:null,exclude:!1,role:null})}i.sort((e,t)=>t.absArea-e.absArea);for(let t=0;t<i.length;t++){let n=i[t],a=0;for(let r=t-1;r>=0;r--){let t=i[r];if(t.boundingBox.containsBox(n.boundingBox)&&e(n.interiorPoint,t.points)){n.container=t.exclude?t.container:t,a=t.winding,n.winding+=a;break}}r(n.winding)===r(a)&&(n.exclude=!0)}for(let e of i)e.exclude||(e.role=e.container===null||e.container.role===`hole`?`outer`:`hole`);let a=[],o=new Map;for(let e of i){if(e.exclude||e.role!==`outer`)continue;let t=new Mc;t.curves=e.subPath.curves,a.push(t),o.set(e,t)}for(let e of i){if(e.exclude||e.role!==`hole`)continue;let t=o.get(e.container);if(!t)continue;let n=new jc;n.curves=e.subPath.curves,t.holes.push(n)}return a}},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`186`}})),typeof window<`u`&&(window.__THREE__?K(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`186`)}));function nu(){let e=null,t=!1,n=null,r=null;function i(t,a){r=e.requestAnimationFrame(i),n(t,a)}return{start:function(){t!==!0&&n!==null&&e!==null&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e!==null&&e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ru(e){let t=new WeakMap;function n(t,n){let r=t.array,i=t.usage,a=r.byteLength,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,r,i),t.onUploadCallback();let s;if(r instanceof Float32Array)s=e.FLOAT;else if(typeof Float16Array<`u`&&r instanceof Float16Array)s=e.HALF_FLOAT;else if(r instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)s=e.SHORT;else if(r instanceof Uint32Array)s=e.UNSIGNED_INT;else if(r instanceof Int32Array)s=e.INT;else if(r instanceof Int8Array)s=e.BYTE;else if(r instanceof Uint8Array)s=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)s=e.UNSIGNED_BYTE;else throw Error(`THREE.WebGLAttributes: Unsupported buffer data format: `+r);return{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:a}}function r(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),a.length===0)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],r=a[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):(++t,a[t]=r)}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(r,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}function i(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)}function a(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))}function o(e,i){if(e.isInterleavedBufferAttribute&&(e=e.data),e.isGLBufferAttribute){let n=t.get(e);(!n||n.version<e.version)&&t.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version});return}let a=t.get(e);if(a===void 0)t.set(e,n(e,i));else if(a.version<e.version){if(a.size!==e.array.byteLength)throw Error(`THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.`);r(a.buffer,e,i),a.version=e.version}}return{get:i,remove:a,update:o}}function iu(e,t,n,r,i,a){let o=new No(0),s=i===!0?0:1,c,l,u=null,d=0,f=null;function p(e){let n=e.isScene===!0?e.background:null;if(n&&n.isTexture){let r=e.backgroundBlurriness>0;n=t.get(n,r)}return n}function m(t){let r=!1,i=p(t);i===null?g(o,s):i&&i.isColor&&(g(i,1),r=!0);let c=e.xr.getEnvironmentBlendMode();c===`additive`?n.buffers.color.setClear(0,0,0,1,a):c===`alpha-blend`&&n.buffers.color.setClear(0,0,0,0,a),(e.autoClear||r)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function h(t,n){let i=p(n);i&&(i.isCubeTexture||i.mapping===306)?(l===void 0&&(l=new Qs(new uc(1,1,1),new Kc({name:`BackgroundCubeMaterial`,uniforms:Pr(lf.backgroundCube.uniforms),vertexShader:lf.backgroundCube.vertexShader,fragmentShader:lf.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),l.geometry.deleteAttribute(`uv`),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=i,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(df.makeRotationFromEuler(n.backgroundRotation)).transpose(),i.isCubeTexture&&i.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(ff),l.material.toneMapped=za.getTransfer(i.colorSpace)!==ya,(u!==i||d!==i.version||f!==e.toneMapping)&&(l.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(c===void 0&&(c=new Qs(new Rc(2,2),new Kc({name:`BackgroundMaterial`,uniforms:Pr(lf.background.uniforms),vertexShader:lf.background.vertexShader,fragmentShader:lf.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute(`normal`),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=i,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.toneMapped=za.getTransfer(i.colorSpace)!==ya,i.matrixAutoUpdate===!0&&i.updateMatrix(),c.material.uniforms.uvTransform.value.copy(i.matrix),(u!==i||d!==i.version||f!==e.toneMapping)&&(c.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null))}function g(t,r){t.getRGB(uf,Rr(e)),n.buffers.color.setClear(uf.r,uf.g,uf.b,r,a)}function _(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),s=t,g(o,s)},getClearAlpha:function(){return s},setClearAlpha:function(e){s=e,g(o,s)},render:m,addToRenderList:h,dispose:_}}function au(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(n,s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n,i){let a=i.wireframe===!0,o=r[t.id];o===void 0&&(o={},r[t.id]=o);let s=e.isInstancedMesh===!0?e.id:0,l=o[s];l===void 0&&(l={},o[s]=l);let u=l[n.id];u===void 0&&(u={},l[n.id]=u);let d=u[a];return d===void 0&&(d=f(c()),u[a]=d),d}function f(e){let t=[],r=[],i=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function p(e,t,n,r){let i=a.attributes,o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function g(e){_(e,0)}function _(t,n){let r=a.newAttributes,i=a.enabledAttributes,o=a.attributeDivisors;r[t]=1,i[t]===0&&(e.enableVertexAttribArray(t),i[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function v(){let t=a.newAttributes,n=a.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,r,i,a,o,s){s===!0?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function b(n,r,i,a){h();let o=a.attributes,s=i.getAttributes(),c=r.defaultAttributeValues;for(let r in s){let i=s[r];if(i.location>=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)_(i.location+e,t.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,c*d,(p+o/i.locationSize*e)*d,f)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)_(i.location+e,s.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,o*d,o/i.locationSize*e*d,f)}}else if(c!==void 0){let t=c[r];if(t!==void 0)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}v()}function x(){T();for(let e in r){let t=r[e];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete r[e]}}function S(e){if(r[e.id]===void 0)return;let t=r[e.id];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete r[e.id]}function C(e){for(let t in r){let n=r[t];for(let t in n){let r=n[t];if(r[e.id]===void 0)continue;let i=r[e.id];for(let e in i)u(i[e].object),delete i[e];delete r[e.id]}}}function w(e){for(let t in r){let n=r[t],i=e.isInstancedMesh===!0?e.id:0,a=n[i];if(a!==void 0){for(let e in a){let t=a[e];for(let e in t)u(t[e].object),delete t[e];delete a[e]}delete n[i],Object.keys(n).length===0&&delete r[t]}}}function T(){E(),o=!0,a!==i&&(a=i,l(a.object))}function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:s,reset:T,resetDefaultState:E,dispose:x,releaseStatesOfGeometry:S,releaseStatesOfObject:w,releaseStatesOfProgram:C,initAttributes:h,enableAttribute:g,disableUnusedAttributes:v}}function ou(e,t,n){let r;function i(e){r=e}function a(t,i){e.drawArrays(r,t,i),n.update(i,r,1)}function o(t,i,a){a!==0&&(e.drawArraysInstanced(r,t,i,a),n.update(i,r,a))}function s(e,i,a){if(a===0)return;t.get(`WEBGL_multi_draw`).multiDrawArraysWEBGL(r,e,0,i,0,a);let o=0;for(let e=0;e<a;e++)o+=i[e];n.update(o,r,1)}this.setMode=i,this.render=a,this.renderInstances=o,this.renderMultiDraw=s}function su(e,t,n,r){let i;function a(){if(i!==void 0)return i;if(t.has(`EXT_texture_filter_anisotropic`)===!0){let n=t.get(`EXT_texture_filter_anisotropic`);i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(t){return t===1023||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)}function s(n){let i=n===1016&&(t.has(`EXT_color_buffer_half_float`)||t.has(`EXT_color_buffer_float`));return!(n!==1009&&n!==1015&&!i&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE))}function c(t){if(t===`highp`){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(K(`WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has(`EXT_clip_control`);n.reversedDepthBuffer===!0&&f===!1&&K(`WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.`);let p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=e.getParameter(e.MAX_SAMPLES),S=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reversedDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,maxSamples:x,samples:S}}function cu(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Ms,s=new X,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length<t)&&(l=new Float32Array(t));for(let t=0,n=r;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(i,s),o.normal.toArray(l,n),l[n+3]=o.constant}c.value=l,c.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,l}}function lu(e){let t=[],n=[],r=e,i=e-pf+1+mf;for(let e=0;e<i;e++){let e=2**r;t.push(e);let i=1/(e-2),a=-i,o=1+i,s=[a,a,o,a,o,o,a,a,o,o,a,o],c=new Float32Array(108),l=new Float32Array(108);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];c.set(r,18*e);for(let t=0;t<6;t++){let n=s[t*2]*2-1,r=s[t*2+1]*2-1;e===0?wf.set(1,r,n):e===1?wf.set(-n,1,-r):e===2?wf.set(-n,r,1):e===3?wf.set(-1,r,-n):e===4?wf.set(-n,-1,r):wf.set(n,r,-1),wf.toArray(l,(e*6+t)*3)}}let u=new Os;u.setAttribute(`position`,new ps(c,3)),u.setAttribute(`outputDirection`,new ps(l,3)),n.push(new Qs(u,null)),r>pf&&r--}return{lodMeshes:n,sizeLods:t}}function uu(e,t,n){let r=new Ya(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function du(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function fu(e,t,n){return new Kc({name:`PMREMGGXConvolution`,defines:{GGX_SAMPLES:gf,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:gu(),fragmentShader:`
|
|
5
|
+
}`,qc=class extends Fs{constructor(e){super(),this.isShaderMaterial=!0,this.type=`ShaderMaterial`,this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Gc,this.fragmentShader=Kc,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Fr(e.uniforms),this.uniformsGroups=Rr(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let n in this.uniforms){let r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:`t`,value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:`c`,value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:`v2`,value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:`v3`,value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:`v4`,value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:`m3`,value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:`m4`,value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case`t`:this.uniforms[n].value=t[r.value]||null;break;case`c`:this.uniforms[n].value=new Po().setHex(r.value);break;case`v2`:this.uniforms[n].value=new J().fromArray(r.value);break;case`v3`:this.uniforms[n].value=new Y().fromArray(r.value);break;case`v4`:this.uniforms[n].value=new Ja().fromArray(r.value);break;case`m3`:this.uniforms[n].value=new X().fromArray(r.value);break;case`m4`:this.uniforms[n].value=new $a().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let t in e.extensions)this.extensions[t]=e.extensions[t];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},Jc=class extends qc{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type=`RawShaderMaterial`}},Yc=class extends Fs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new Po(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Po(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new J(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new lo,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Xc=class extends Yc{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new J(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return fn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Po(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Po(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Po(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){this._retroreflectivity>0!=e>0&&this.version++,this._retroreflectivity=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Zc=class extends Fs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=ga,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},Qc=class extends Fs{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},$c=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<i)break forward_scan;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(i=r,r=t[++n],e<r)break seek}a=t.length;break linear_scan}if(!(e>=i)){let o=t[1];e<o&&(n=2,i=o);for(let a=n-2;;){if(i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(r=i,i=t[--n-1],e>=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n<a;){let r=n+a>>>1;e<t[r]?a=r:n=r+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r;for(let e=0;e!==r;++e)t[e]=n[i+e];return t}interpolate_(){throw Error(`THREE.Interpolant: Call to abstract method.`)}intervalChanged_(){}},el=class extends $c{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:pa,endingEnd:pa}}intervalChanged_(e,t,n){let r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case ma:i=e,o=2*t-n;break;case ha:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case ma:a=e,s=2*n-t;break;case ha:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}let c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(r-t),m=p*p,h=m*p,g=-d*h+2*d*m-d*p,_=(1+d)*h+(-1.5-2*d)*m+(-.5+d)*p+1,v=(-1-f)*h+(1.5+f)*m+.5*p,y=f*h-f*m;for(let e=0;e!==o;++e)i[e]=g*a[l+e]+_*a[c+e]+v*a[s+e]+y*a[u+e];return i}},tl=class extends $c{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l;for(let e=0;e!==o;++e)i[e]=a[c+e]*u+a[s+e]*l;return i}},nl=class extends $c{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},rl=class extends $c{interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this.inTangents,u=this.outTangents;if(!l||!u){let e=(n-t)/(r-t),l=1-e;for(let t=0;t!==o;++t)i[t]=a[c+t]*l+a[s+t]*e;return i}let d=o*2,f=e-1;for(let p=0;p!==o;++p){let o=a[c+p],m=a[s+p],h=f*d+p*2,g=u[h],_=u[h+1],v=e*d+p*2,y=l[v],b=l[v+1],x=Wr(n,t,g,y,r);i[p]=Hr(x,o,_,b,m)}return i}},il=class{constructor(e,t,n,r){if(e===void 0)throw Error(`THREE.KeyframeTrack: track name is undefined`);if(t===void 0||t.length===0)throw Error(`THREE.KeyframeTrack: no keyframes in track named `+e);this.name=e,this.times=Br(t,this.TimeBufferType),this.values=Br(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Br(e.times,Array),values:Br(e.values,Array)};let t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t),Vr(e.settings)&&(n.settings={inTangents:Br(e.settings.inTangents,Array),outTangents:Br(e.settings.outTangents,Array)})}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new nl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new tl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new el(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new rl(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case la:t=this.InterpolantFactoryMethodDiscrete;break;case ua:t=this.InterpolantFactoryMethodLinear;break;case da:t=this.InterpolantFactoryMethodSmooth;break;case fa:t=this.InterpolantFactoryMethodBezier}if(t===void 0){let t=`unsupported interpolation for `+this.ValueTypeName+` keyframe track named `+this.name;if(this.createInterpolant===void 0){if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t)}return K(`KeyframeTrack:`,t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return la;case this.InterpolantFactoryMethodLinear:return ua;case this.InterpolantFactoryMethodSmooth:return da;case this.InterpolantFactoryMethodBezier:return fa}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e;Vr(this.settings)&&(Gr(this.settings.inTangents,e),Gr(this.settings.outTangents,e))}return this}trim(e,t){let n=this.times,r=n.length,i=0,a=r-1;for(;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(q(`KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(q(`KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){q(`KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){q(`KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&rn(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){q(`KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===da,i=e.length-1,a=1;for(let o=1;o<i;++o){let i=!1,s=e[o];if(s!==e[o+1]&&(o!==1||s!==e[0])){if(r)i=!0;else{let e=o*n,r=e-n,a=e+n;for(let o=0;o!==n;++o){let n=t[e+o];if(n!==t[r+o]||n!==t[a+o]){i=!0;break}}}}if(i){if(o!==a){e[a]=e[o];let r=o*n,i=a*n;for(let e=0;e!==n;++e)t[i+e]=t[r+e]}++a}}if(i>0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,Vr(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}},il.prototype.ValueTypeName=``,il.prototype.TimeBufferType=Float32Array,il.prototype.ValueBufferType=Float32Array,il.prototype.DefaultInterpolation=ua,al=class extends il{constructor(e,t,n){super(e,t,n)}},al.prototype.ValueTypeName=`bool`,al.prototype.ValueBufferType=Array,al.prototype.DefaultInterpolation=la,al.prototype.InterpolantFactoryMethodLinear=void 0,al.prototype.InterpolantFactoryMethodSmooth=void 0,ol=class extends il{constructor(e,t,n,r){super(e,t,n,r)}},ol.prototype.ValueTypeName=`color`,sl=class extends il{constructor(e,t,n,r){super(e,t,n,r)}},sl.prototype.ValueTypeName=`number`,cl=class extends $c{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Pa.slerpFlat(i,0,a,c-o,a,c,s);return i}},ll=class extends il{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new cl(this.times,this.values,this.getValueSize(),e)}},ll.prototype.ValueTypeName=`quaternion`,ll.prototype.InterpolantFactoryMethodSmooth=void 0,ul=class extends il{constructor(e,t,n){super(e,t,n)}},ul.prototype.ValueTypeName=`string`,ul.prototype.ValueBufferType=Array,ul.prototype.DefaultInterpolation=la,ul.prototype.InterpolantFactoryMethodLinear=void 0,ul.prototype.InterpolantFactoryMethodSmooth=void 0,dl=class extends il{constructor(e,t,n,r){super(e,t,n,r)}},dl.prototype.ValueTypeName=`vector`,fl={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(Kr(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!Kr(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},pl=class{constructor(e,t,n){let r=this,i=!1,a=0,o=0,s,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(e){o++,i===!1&&r.onStart!==void 0&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,r.onProgress!==void 0&&r.onProgress(e,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(e){r.onError!==void 0&&r.onError(e)},this.resolveURL=function(e){return e=e.normalize(`NFC`),s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return c.push(e,t),this},this.removeHandler=function(e){let t=c.indexOf(e);return t!==-1&&c.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=c.length;t<n;t+=2){let n=c[t],r=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return r}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||=new AbortController,this._abortController}},ml=new pl,hl=class{constructor(e){this.manager=e===void 0?ml:e,this.crossOrigin=`anonymous`,this.withCredentials=!1,this.path=``,this.resourcePath=``,this.requestHeader={},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,i){n.load(e,r,t,i)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}},hl.DEFAULT_MATERIAL_NAME=`__DEFAULT`,gl={},_l=class extends Error{constructor(e,t){super(e),this.response=t}},vl=class extends hl{constructor(e){super(e),this.mimeType=``,this.responseType=``,this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=fl.get(`file:${e}`);if(i!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(i),this.manager.itemEnd(e)},0);return}if(gl[e]!==void 0){gl[e].push({onLoad:t,onProgress:n,onError:r});return}gl[e]=[],gl[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`,signal:typeof AbortSignal.any==`function`?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&K(`FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=gl[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e<t;e++){let t=n[e];t.onProgress&&t.onProgress(r)}e.enqueue(i),t()}},t=>{e.error(t)})}}});return new Response(c)}throw new _l(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{fl.add(`file:${e}`,t);let n=gl[e];delete gl[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onLoad&&r.onLoad(t)}}).catch(t=>{let n=gl[e];if(n===void 0)throw this.manager.itemError(e),t;delete gl[e];for(let e=0,r=n.length;e<r;e++){let r=n[e];r.onError&&r.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},yl=class extends Do{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new Po(e),this.intensity=t}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},bl=new $a,xl=new Y,Sl=new Y,Cl=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new J(512,512),this.mapType=ii,this.map=null,this.mapPass=null,this.matrix=new $a,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ic,this._frameExtents=new J(1,1),this._viewportCount=1,this._viewports=[new Ja(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera;xl.setFromMatrixPosition(e.matrixWorld),t.position.copy(xl),Sl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Sl),t.updateMatrixWorld(),this._updateMatrix(t,this.matrix,this._frustum)}_updateMatrix(e,t,n,r){bl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),n.setFromProjectionMatrix(bl,e.coordinateSystem,e.reversedDepth);let i=this._frameExtents,a=r?r.z/i.x:1,o=r?r.w/i.y:1,s=r?r.x/i.x:0,c=r?r.y/i.y:0;e.coordinateSystem===2001||e.reversedDepth?t.set(.5*a,0,0,.5*a+s,0,.5*o,0,.5*o+c,0,0,1,0,0,0,0,1):t.set(.5*a,0,0,.5*a+s,0,.5*o,0,.5*o+c,0,0,.5,.5,0,0,0,1),t.multiply(bl)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return e.intensity=this.intensity,e.bias=this.bias,e.normalBias=this.normalBias,e.radius=this.radius,e.blurSamples=this.blurSamples,e.mapSize=this.mapSize.toArray(),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},wl=new Y,Tl=new Pa,El=new Y,Dl=class extends Do{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new $a,this.projectionMatrix=new $a,this.projectionMatrixInverse=new $a,this.coordinateSystem=wa,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(wl,Tl,El),El.x===1&&El.y===1&&El.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(wl,Tl,El.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(wl,Tl,El),El.x===1&&El.y===1&&El.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(wl,Tl,El.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Ol=new Y,kl=new J,Al=new J,jl=class extends Dl{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ma*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(ja*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ma*2*Math.atan(Math.tan(ja*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Ol.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ol.x,Ol.y).multiplyScalar(-e/Ol.z),Ol.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ol.x,Ol.y).multiplyScalar(-e/Ol.z)}getViewSize(e,t){return this.getViewBounds(e,kl,Al),t.subVectors(Al,kl)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(ja*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},Ml=class extends Cl{constructor(){super(new jl(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ma*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this.aspect=e.aspect,this}toJSON(){let e=super.toJSON();return e.focus=this.focus,e.aspect=this.aspect,e}},Nl=class extends yl{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(Do.DEFAULT_UP),this.updateMatrix(),this.target=new Do,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new Ml}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},Pl=class extends Dl{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},Fl=class extends Cl{constructor(){super(new Pl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},Il=class extends yl{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(Do.DEFAULT_UP),this.updateMatrix(),this.target=new Do,this.shadow=new Fl}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},Ll=-90,Rl=1,zl=class extends Do{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new jl(Ll,Rl,e,t);r.layers=this.layers,this.add(r);let i=new jl(Ll,Rl,e,t);i.layers=this.layers,this.add(i);let a=new jl(Ll,Rl,e,t);a.layers=this.layers,this.add(a);let o=new jl(Ll,Rl,e,t);o.layers=this.layers,this.add(o);let s=new jl(Ll,Rl,e,t);s.layers=this.layers,this.add(s);let c=new jl(Ll,Rl,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let h=!1;h=e.isWebGLRenderer===!0?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,i),e.setRenderTarget(n,1,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,4,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),h&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},Bl=class extends jl{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},Vl=`\\[\\]\\.:\\/`,Hl=RegExp(`[\\[\\]\\.:\\/]`,`g`),Ul=`[^\\[\\]\\.:\\/]`,Wl=`[^`+Vl.replace(`\\.`,``)+`]`,Gl=`((?:WC+[\\/:])*)`.replace(`WC`,Ul),Kl=`(WCOD+)?`.replace(`WCOD`,Wl),ql=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,Ul),Jl=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,Ul),Yl=RegExp(`^`+Gl+Kl+ql+Jl+`$`),Xl=[`material`,`materials`,`bones`,`map`],Zl=class{constructor(e,t,n){let r=n||Ql.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},Ql=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(Hl,``)}static parseTrackName(e){let t=Yl.exec(e);if(t===null)throw Error(`THREE.PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);Xl.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`THREE.PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;r<e.length;r++){let i=e[r];if(i.name===t||i.uuid===t)return i;let a=n(i.children);if(a)return a}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){K(`PropertyBinding: No target node found for track: `+this.path+`.`);return}if(r){let e=n.objectIndex;switch(r){case`materials`:if(!t.material){q(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.materials){q(`PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.`,this);return}t=t.material.materials;break;case`bones`:if(!t.skeleton){q(`PropertyBinding: Can not bind to bones as node does not have a skeleton.`,this);return}t=t.skeleton.bones;for(let n=0;n<t.length;n++)if(t[n].name===e){e=n;break}break;case`map`:if(`map`in t){t=t.map;break}if(!t.material){q(`PropertyBinding: Can not bind to material as node does not have a material.`,this);return}if(!t.material.map){q(`PropertyBinding: Can not bind to material.map as node.material does not have a map.`,this);return}t=t.material.map;break;default:if(t[r]===void 0){q(`PropertyBinding: Can not bind to objectName of node undefined.`,this);return}t=t[r]}if(e!==void 0){if(t[e]===void 0){q(`PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.`,this,t);return}t=t[e]}}let o=t[i];if(o===void 0){let e=n.nodeName;q(`PropertyBinding: Trying to update property for track: `+e+`.`+i+` but it wasn't found.`,t);return}let s=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?s=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(s=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(a!==void 0){if(i===`morphTargetInfluences`){if(!t.geometry){q(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.`,this);return}if(!t.geometry.morphAttributes){q(`PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.`,this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=a}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}},Ql.Composite=Zl,Ql.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ql.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ql.prototype.GetterByBindingType=[Ql.prototype._getValue_direct,Ql.prototype._getValue_array,Ql.prototype._getValue_arrayElement,Ql.prototype._getValue_toArray],Ql.prototype.SetterByBindingTypeAndVersioning=[[Ql.prototype._setValue_direct,Ql.prototype._setValue_direct_setNeedsUpdate,Ql.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ql.prototype._setValue_array,Ql.prototype._setValue_array_setNeedsUpdate,Ql.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ql.prototype._setValue_arrayElement,Ql.prototype._setValue_arrayElement_setNeedsUpdate,Ql.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ql.prototype._setValue_fromArray,Ql.prototype._setValue_fromArray_setNeedsUpdate,Ql.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],class e{static{e.prototype.isMatrix2=!0}constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){let i=this.elements;return i[0]=e,i[2]=t,i[1]=n,i[3]=r,this}},$l=new J,eu=class{constructor(e=new J(1/0,1/0),t=new J(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=$l.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,$l).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},tu=class{constructor(){this.type=`ShapePath`,this.color=new Po,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new Mc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(e,t){let n=!1,r=t.length;for(let i=0,a=r-1;i<r;a=i++){let r=t[i],o=t[a];r.y>e.y!=o.y>e.y&&e.x<(o.x-r.x)*(e.y-r.y)/(o.y-r.y)+r.x&&(n=!n)}return n}function t(t,n){let r=n.getCenter(new J);if(e(r,t))return r;let i=r.y,a=[],o=t.length;for(let e=0;e<o;e++){let n=t[e],r=t[(e+1)%o];if(n.y>i!=r.y>i){let e=n.x+(i-n.y)*(r.x-n.x)/(r.y-n.y);a.push(e)}}return a.length>1&&(a.sort((e,t)=>e-t),r.x=(a[0]+a[1])/2),r}let n=this.userData.style&&this.userData.style.fillRule||`nonzero`;n!==`nonzero`&&n!==`evenodd`&&(K(`Fill-rule "`+n+`" is not supported, falling back to "nonzero".`),n=`nonzero`);let r=n===`nonzero`?(e=>e!==0):(e=>!!(e&1)),i=[];for(let e of this.subPaths){let n=e.getPoints();if(n.length<3)continue;let r=Fc.area(n);if(r===0)continue;let a=new eu;for(let e=0;e<n.length;e++)a.expandByPoint(n[e]);i.push({subPath:e,points:n,boundingBox:a,interiorPoint:t(n,a),absArea:Math.abs(r),winding:r<0?-1:1,container:null,exclude:!1,role:null})}i.sort((e,t)=>t.absArea-e.absArea);for(let t=0;t<i.length;t++){let n=i[t],a=0;for(let r=t-1;r>=0;r--){let t=i[r];if(t.boundingBox.containsBox(n.boundingBox)&&e(n.interiorPoint,t.points)){n.container=t.exclude?t.container:t,a=t.winding,n.winding+=a;break}}r(n.winding)===r(a)&&(n.exclude=!0)}for(let e of i)e.exclude||(e.role=e.container===null||e.container.role===`hole`?`outer`:`hole`);let a=[],o=new Map;for(let e of i){if(e.exclude||e.role!==`outer`)continue;let t=new Nc;t.curves=e.subPath.curves,a.push(t),o.set(e,t)}for(let e of i){if(e.exclude||e.role!==`hole`)continue;let t=o.get(e.container);if(!t)continue;let n=new Mc;n.curves=e.subPath.curves,t.holes.push(n)}return a}},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`register`,{detail:{revision:`186`}})),typeof window<`u`&&(window.__THREE__?K(`WARNING: Multiple instances of Three.js being imported.`):window.__THREE__=`186`)}));function ru(){let e=null,t=!1,n=null,r=null;function i(t,a){r=e.requestAnimationFrame(i),n(t,a)}return{start:function(){t!==!0&&n!==null&&e!==null&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e!==null&&e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function iu(e){let t=new WeakMap;function n(t,n){let r=t.array,i=t.usage,a=r.byteLength,o=e.createBuffer();e.bindBuffer(n,o),e.bufferData(n,r,i),t.onUploadCallback();let s;if(r instanceof Float32Array)s=e.FLOAT;else if(typeof Float16Array<`u`&&r instanceof Float16Array)s=e.HALF_FLOAT;else if(r instanceof Uint16Array)s=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)s=e.SHORT;else if(r instanceof Uint32Array)s=e.UNSIGNED_INT;else if(r instanceof Int32Array)s=e.INT;else if(r instanceof Int8Array)s=e.BYTE;else if(r instanceof Uint8Array)s=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)s=e.UNSIGNED_BYTE;else throw Error(`THREE.WebGLAttributes: Unsupported buffer data format: `+r);return{buffer:o,type:s,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:a}}function r(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),a.length===0)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],r=a[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):(++t,a[t]=r)}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(r,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}function i(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)}function a(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))}function o(e,i){if(e.isInterleavedBufferAttribute&&(e=e.data),e.isGLBufferAttribute){let n=t.get(e);(!n||n.version<e.version)&&t.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version});return}let a=t.get(e);if(a===void 0)t.set(e,n(e,i));else if(a.version<e.version){if(a.size!==e.array.byteLength)throw Error(`THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.`);r(a.buffer,e,i),a.version=e.version}}return{get:i,remove:a,update:o}}function au(e,t,n,r,i,a){let o=new Po(0),s=i===!0?0:1,c,l,u=null,d=0,f=null;function p(e){let n=e.isScene===!0?e.background:null;if(n&&n.isTexture){let r=e.backgroundBlurriness>0;n=t.get(n,r)}return n}function m(t){let r=!1,i=p(t);i===null?g(o,s):i&&i.isColor&&(g(i,1),r=!0);let c=e.xr.getEnvironmentBlendMode();c===`additive`?n.buffers.color.setClear(0,0,0,1,a):c===`alpha-blend`&&n.buffers.color.setClear(0,0,0,0,a),(e.autoClear||r)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function h(t,n){let i=p(n);i&&(i.isCubeTexture||i.mapping===306)?(l===void 0&&(l=new $s(new dc(1,1,1),new qc({name:`BackgroundCubeMaterial`,uniforms:Fr(uf.backgroundCube.uniforms),vertexShader:uf.backgroundCube.vertexShader,fragmentShader:uf.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),l.geometry.deleteAttribute(`uv`),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=i,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(ff.makeRotationFromEuler(n.backgroundRotation)).transpose(),i.isCubeTexture&&i.isRenderTargetTexture===!1&&l.material.uniforms.backgroundRotation.value.premultiply(pf),l.material.toneMapped=Ba.getTransfer(i.colorSpace)!==ba,(u!==i||d!==i.version||f!==e.toneMapping)&&(l.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(c===void 0&&(c=new $s(new zc(2,2),new qc({name:`BackgroundMaterial`,uniforms:Fr(uf.background.uniforms),vertexShader:uf.background.vertexShader,fragmentShader:uf.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute(`normal`),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=i,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.toneMapped=Ba.getTransfer(i.colorSpace)!==ba,i.matrixAutoUpdate===!0&&i.updateMatrix(),c.material.uniforms.uvTransform.value.copy(i.matrix),(u!==i||d!==i.version||f!==e.toneMapping)&&(c.material.needsUpdate=!0,u=i,d=i.version,f=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null))}function g(t,r){t.getRGB(df,zr(e)),n.buffers.color.setClear(df.r,df.g,df.b,r,a)}function _(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(e,t=1){o.set(e),s=t,g(o,s)},getClearAlpha:function(){return s},setClearAlpha:function(e){s=e,g(o,s)},render:m,addToRenderList:h,dispose:_}}function ou(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(n,s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n,i){let a=i.wireframe===!0,o=r[t.id];o===void 0&&(o={},r[t.id]=o);let s=e.isInstancedMesh===!0?e.id:0,l=o[s];l===void 0&&(l={},o[s]=l);let u=l[n.id];u===void 0&&(u={},l[n.id]=u);let d=u[a];return d===void 0&&(d=f(c()),u[a]=d),d}function f(e){let t=[],r=[],i=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function p(e,t,n,r){let i=a.attributes,o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function g(e){_(e,0)}function _(t,n){let r=a.newAttributes,i=a.enabledAttributes,o=a.attributeDivisors;r[t]=1,i[t]===0&&(e.enableVertexAttribArray(t),i[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function v(){let t=a.newAttributes,n=a.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,r,i,a,o,s){s===!0?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function b(n,r,i,a){h();let o=a.attributes,s=i.getAttributes(),c=r.defaultAttributeValues;for(let r in s){let i=s[r];if(i.location>=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<i.locationSize;e++)_(i.location+e,t.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,c*d,(p+o/i.locationSize*e)*d,f)}else{if(s.isInstancedBufferAttribute){for(let e=0;e<i.locationSize;e++)_(i.location+e,s.meshPerAttribute);n.isInstancedMesh!==!0&&a._maxInstanceCount===void 0&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let e=0;e<i.locationSize;e++)g(i.location+e);e.bindBuffer(e.ARRAY_BUFFER,l);for(let e=0;e<i.locationSize;e++)y(i.location+e,o/i.locationSize,u,r,o*d,o/i.locationSize*e*d,f)}}else if(c!==void 0){let t=c[r];if(t!==void 0)switch(t.length){case 2:e.vertexAttrib2fv(i.location,t);break;case 3:e.vertexAttrib3fv(i.location,t);break;case 4:e.vertexAttrib4fv(i.location,t);break;default:e.vertexAttrib1fv(i.location,t)}}}}v()}function x(){T();for(let e in r){let t=r[e];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete r[e]}}function S(e){if(r[e.id]===void 0)return;let t=r[e.id];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete r[e.id]}function C(e){for(let t in r){let n=r[t];for(let t in n){let r=n[t];if(r[e.id]===void 0)continue;let i=r[e.id];for(let e in i)u(i[e].object),delete i[e];delete r[e.id]}}}function w(e){for(let t in r){let n=r[t],i=e.isInstancedMesh===!0?e.id:0,a=n[i];if(a!==void 0){for(let e in a){let t=a[e];for(let e in t)u(t[e].object),delete t[e];delete a[e]}delete n[i],Object.keys(n).length===0&&delete r[t]}}}function T(){E(),o=!0,a!==i&&(a=i,l(a.object))}function E(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:s,reset:T,resetDefaultState:E,dispose:x,releaseStatesOfGeometry:S,releaseStatesOfObject:w,releaseStatesOfProgram:C,initAttributes:h,enableAttribute:g,disableUnusedAttributes:v}}function su(e,t,n){let r;function i(e){r=e}function a(t,i){e.drawArrays(r,t,i),n.update(i,r,1)}function o(t,i,a){a!==0&&(e.drawArraysInstanced(r,t,i,a),n.update(i,r,a))}function s(e,i,a){if(a===0)return;t.get(`WEBGL_multi_draw`).multiDrawArraysWEBGL(r,e,0,i,0,a);let o=0;for(let e=0;e<a;e++)o+=i[e];n.update(o,r,1)}this.setMode=i,this.render=a,this.renderInstances=o,this.renderMultiDraw=s}function cu(e,t,n,r){let i;function a(){if(i!==void 0)return i;if(t.has(`EXT_texture_filter_anisotropic`)===!0){let n=t.get(`EXT_texture_filter_anisotropic`);i=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(t){return t===1023||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)}function s(n){let i=n===1016&&(t.has(`EXT_color_buffer_half_float`)||t.has(`EXT_color_buffer_float`));return!(n!==1009&&n!==1015&&!i&&r.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE))}function c(t){if(t===`highp`){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(K(`WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&t.has(`EXT_clip_control`);n.reversedDepthBuffer===!0&&f===!1&&K(`WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.`);let p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=e.getParameter(e.MAX_SAMPLES),S=e.getParameter(e.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reversedDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,maxSamples:x,samples:S}}function lu(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Ns,s=new X,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length<t)&&(l=new Float32Array(t));for(let t=0,n=r;t!==a;++t,n+=4)o.copy(e[t]).applyMatrix4(i,s),o.normal.toArray(l,n),l[n+3]=o.constant}c.value=l,c.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,l}}function uu(e){let t=[],n=[],r=e,i=e-mf+1+hf;for(let e=0;e<i;e++){let e=2**r;t.push(e);let i=1/(e-2),a=-i,o=1+i,s=[a,a,o,a,o,o,a,a,o,o,a,o],c=new Float32Array(108),l=new Float32Array(108);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];c.set(r,18*e);for(let t=0;t<6;t++){let n=s[t*2]*2-1,r=s[t*2+1]*2-1;e===0?Tf.set(1,r,n):e===1?Tf.set(-n,1,-r):e===2?Tf.set(-n,r,1):e===3?Tf.set(-1,r,-n):e===4?Tf.set(-n,-1,r):Tf.set(n,r,-1),Tf.toArray(l,(e*6+t)*3)}}let u=new ks;u.setAttribute(`position`,new ms(c,3)),u.setAttribute(`outputDirection`,new ms(l,3)),n.push(new $s(u,null)),r>mf&&r--}return{lodMeshes:n,sizeLods:t}}function du(e,t,n){let r=new Xa(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function fu(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function pu(e,t,n){return new qc({name:`PMREMGGXConvolution`,defines:{GGX_SAMPLES:_f,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:_u(),fragmentShader:`
|
|
6
6
|
|
|
7
7
|
precision highp float;
|
|
8
8
|
precision highp int;
|
|
@@ -106,7 +106,7 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
106
106
|
|
|
107
107
|
gl_FragColor = vec4(prefilteredColor, 1.0);
|
|
108
108
|
}
|
|
109
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function
|
|
109
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function mu(e,t,n){return new qc({name:`SphericalGaussianBlur`,defines:{SAMPLES:gf,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:_u(),fragmentShader:`
|
|
110
110
|
|
|
111
111
|
precision highp float;
|
|
112
112
|
precision highp int;
|
|
@@ -166,7 +166,7 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
166
166
|
gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
|
|
167
167
|
|
|
168
168
|
}
|
|
169
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function
|
|
169
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function hu(){return new qc({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:_u(),fragmentShader:`
|
|
170
170
|
|
|
171
171
|
precision mediump float;
|
|
172
172
|
precision mediump int;
|
|
@@ -185,7 +185,7 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
185
185
|
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
|
|
186
186
|
|
|
187
187
|
}
|
|
188
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function
|
|
188
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function gu(){return new qc({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_u(),fragmentShader:`
|
|
189
189
|
|
|
190
190
|
precision mediump float;
|
|
191
191
|
precision mediump int;
|
|
@@ -201,7 +201,7 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
201
201
|
gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
|
|
202
202
|
|
|
203
203
|
}
|
|
204
|
-
`,blending:0,depthTest:!1,depthWrite:!1})}function
|
|
204
|
+
`,blending:0,depthTest:!1,depthWrite:!1})}function _u(){return`
|
|
205
205
|
|
|
206
206
|
precision mediump float;
|
|
207
207
|
precision mediump int;
|
|
@@ -216,7 +216,7 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
216
216
|
gl_Position = vec4( position, 1.0 );
|
|
217
217
|
|
|
218
218
|
}
|
|
219
|
-
`}function
|
|
219
|
+
`}function vu(e){let t=new WeakMap,n=new WeakMap,r=null;function i(e,t=!1){return e==null?null:t?o(e):a(e)}function a(n){if(n&&n.isTexture){let r=n.mapping;if(r===303||r===304){if(t.has(n)){let e=t.get(n).texture;return s(e,n.mapping)}{let r=n.image;if(r&&r.height>0){let i=new Df(r.height);return i.fromEquirectangularTexture(e,n),t.set(n,i),n.addEventListener(`dispose`,l),s(i.texture,n.mapping)}return null}}}return n}function o(t){if(t&&t.isTexture){let i=t.mapping,a=i===303||i===304,o=i===301||i===302;if(a||o){let i=n.get(t),s=i===void 0?0:i.texture.pmremVersion;if(t.isRenderTargetTexture&&t.pmremVersion!==s)return r===null&&(r=new Ef(e)),i=a?r.fromEquirectangular(t,i):r.fromCubemap(t,i),i.texture.pmremVersion=t.pmremVersion,n.set(t,i),i.texture;if(i!==void 0)return i.texture;{let s=t.image;return a&&s&&s.height>0||o&&s&&c(s)?(r===null&&(r=new Ef(e)),i=a?r.fromEquirectangular(t):r.fromCubemap(t),i.texture.pmremVersion=t.pmremVersion,n.set(t,i),t.addEventListener(`dispose`,u),i.texture):null}}}return t}function s(e,t){return t===303?e.mapping=301:t===304&&(e.mapping=302),e}function c(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function l(e){let n=e.target;n.removeEventListener(`dispose`,l);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function u(e){let t=e.target;t.removeEventListener(`dispose`,u);let r=n.get(t);r!==void 0&&(n.delete(t),r.dispose())}function d(){t=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:d}}function yu(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r=e.getExtension(n);return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&ln(`WebGLRenderer: `+e+` extension not supported.`),t}}}function bu(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0||(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++),t}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(i===void 0)return;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],i=e[t+1],a=e[t+2];n.push(r,i,i,a,a,r)}}else{let e=i.array;o=i.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,i=t+2;n.push(e,r,r,i,i,e)}}let s=new(i.count>=65535?gs:hs)(n,1);s.version=o;let c=a.get(e);c&&t.remove(c),a.set(e,s)}function u(e){let t=a.get(e);if(t){let n=e.index;n!==null&&t.version<n.version&&l(e)}else l(e);return a.get(e)}return{get:s,update:c,getWireframeAttribute:u}}function xu(e,t,n){let r;function i(e){r=e}let a,o;function s(e){a=e.type,o=e.bytesPerElement}function c(t,i){e.drawElements(r,i,a,t*o),n.update(i,r,1)}function l(t,i,s){s!==0&&(e.drawElementsInstanced(r,i,a,t*o,s),n.update(i,r,s))}function u(e,i,o){if(o===0)return;t.get(`WEBGL_multi_draw`).multiDrawElementsWEBGL(r,i,0,a,e,0,o);let s=0;for(let e=0;e<o;e++)s+=i[e];n.update(s,r,1)}this.setMode=i,this.setIndex=s,this.render=c,this.renderInstances=l,this.renderMultiDraw=u}function Su(e){let t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(t,r,i){switch(n.calls++,r){case e.TRIANGLES:n.triangles+=t/3*i;break;case e.LINES:n.lines+=t/2*i;break;case e.LINE_STRIP:n.lines+=i*(t-1);break;case e.LINE_LOOP:n.lines+=i*t;break;case e.POINTS:n.points+=i*t;break;default:q(`WebGLInfo: Unknown draw mode:`,r)}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function Cu(e,t,n){let r=new WeakMap,i=new Ja;function a(a,o,s){let c=a.morphTargetInfluences,l=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=l===void 0?0:l.length,d=r.get(o);if(d===void 0||d.count!==u){d!==void 0&&d.texture.dispose();let e=o.morphAttributes.position!==void 0,n=o.morphAttributes.normal!==void 0,a=o.morphAttributes.color!==void 0,s=o.morphAttributes.position||[],c=o.morphAttributes.normal||[],l=o.morphAttributes.color||[],p=0;e===!0&&(p=1),n===!0&&(p=2),a===!0&&(p=3);let m=o.attributes.position.count*p,h=1;m>t.maxTextureSize&&(h=Math.ceil(m/t.maxTextureSize),m=t.maxTextureSize);let g=new Float32Array(m*h*4*u),_=new Za(g,m,h,u);_.type=ui,_.needsUpdate=!0;let v=p*4;for(let t=0;t<u;t++){let r=s[t],o=c[t],u=l[t],d=m*h*4*t;for(let t=0;t<r.count;t++){let s=t*v;e===!0&&(i.fromBufferAttribute(r,t),g[d+s+0]=i.x,g[d+s+1]=i.y,g[d+s+2]=i.z,g[d+s+3]=0),n===!0&&(i.fromBufferAttribute(o,t),g[d+s+4]=i.x,g[d+s+5]=i.y,g[d+s+6]=i.z,g[d+s+7]=0),a===!0&&(i.fromBufferAttribute(u,t),g[d+s+8]=i.x,g[d+s+9]=i.y,g[d+s+10]=i.z,g[d+s+11]=u.itemSize===4?i.w:1)}}d={count:u,texture:_,size:new J(m,h)},r.set(o,d);function f(){_.dispose(),r.delete(o),o.removeEventListener(`dispose`,f)}o.addEventListener(`dispose`,f)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)s.getUniforms().setValue(e,`morphTexture`,a.morphTexture,n);else{let t=0;for(let e=0;e<c.length;e++)t+=c[e];let n=o.morphTargetsRelative?1:1-t;s.getUniforms().setValue(e,`morphTargetBaseInfluence`,n),s.getUniforms().setValue(e,`morphTargetInfluences`,c)}s.getUniforms().setValue(e,`morphTargetsTexture`,d.texture,n),s.getUniforms().setValue(e,`morphTargetsTextureSize`,d.size)}return{update:a}}function wu(e,t,n,r,i){let a=new WeakMap;function o(r){let o=i.render.frame,s=r.geometry,l=t.get(r,s);if(a.get(l)!==o&&(t.update(l),a.set(l,o)),r.isInstancedMesh&&(r.hasEventListener(`dispose`,c)===!1&&r.addEventListener(`dispose`,c),a.get(r)!==o&&(n.update(r.instanceMatrix,e.ARRAY_BUFFER),r.instanceColor!==null&&n.update(r.instanceColor,e.ARRAY_BUFFER),a.set(r,o))),r.isSkinnedMesh){let e=r.skeleton;a.get(e)!==o&&(e.update(),a.set(e,o))}return l}function s(){a=new WeakMap}function c(e){let t=e.target;t.removeEventListener(`dispose`,c),r.releaseStatesOfObject(t),n.remove(t.instanceMatrix),t.instanceColor!==null&&n.remove(t.instanceColor)}return{update:o,dispose:s}}function Tu(e,t,n,r,i,a){let o=new Xa(t,n,{type:e,depthBuffer:i,stencilBuffer:a,samples:r?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),s=null,c=null,l=new ks;l.setAttribute(`position`,new _s([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute(`uv`,new _s([0,2,0,0,2,0],2));let u=new Jc({uniforms:{tDiffuse:{value:null}},vertexShader:`
|
|
220
220
|
precision highp float;
|
|
221
221
|
|
|
222
222
|
uniform mat4 modelViewMatrix;
|
|
@@ -262,17 +262,17 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
262
262
|
#ifdef SRGB_TRANSFER
|
|
263
263
|
gl_FragColor = sRGBTransferOETF( gl_FragColor );
|
|
264
264
|
#endif
|
|
265
|
-
}`,depthTest:!1,depthWrite:!1}),d=new
|
|
265
|
+
}`,depthTest:!1,depthWrite:!1}),d=new $s(l,u),f=new Pl(-1,1,1,-1,0,1),p=null,m=null,h=!1,g,_=null,v=[],y=!1;this.setSize=function(e,t){o.setSize(e,t),s!==null&&s.setSize(e,t),c!==null&&c.setSize(e,t);for(let n=0;n<v.length;n++){let r=v[n];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){v=e,y=v.length>0&&v[0].isRenderPass===!0;let t=o.width,n=o.height;v.length>0&&s===null&&(s=new Xa(t,n,{type:di,depthBuffer:!1,stencilBuffer:!1}),c=new Xa(t,n,{type:di,depthBuffer:!1,stencilBuffer:!1}));for(let e=0;e<v.length;e++){let r=v[e];r.setSize&&r.setSize(t,n)}},this.begin=function(e,t){if(h||e.toneMapping===0&&v.length===0)return!1;if(_=t,t!==null){let e=t.width,n=t.height;(o.width!==e||o.height!==n)&&this.setSize(e,n)}return y===!1&&e.setRenderTarget(o),g=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return y},this.end=function(e,t){e.toneMapping=g,h=!0;let n=o,r=s;for(let i=0;i<v.length;i++){let a=v[i];a.enabled!==!1&&(a.render(e,r,n,t),a.needsSwap!==!1&&(n=r,r=r===s?c:s))}if(p!==e.outputColorSpace||m!==e.toneMapping){p=e.outputColorSpace,m=e.toneMapping,u.defines={},Ba.getTransfer(p)===`srgb`&&(u.defines.SRGB_TRANSFER=``);let t=Of[m];t&&(u.defines[t]=``),u.needsUpdate=!0}u.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(_),e.render(d,f),_=null,h=!1},this.isCompositing=function(){return h},this.dispose=function(){o.dispose(),s!==null&&s.dispose(),c!==null&&c.dispose(),l.dispose(),u.dispose()}}function Eu(e,t,n){let r=e[0];if(r<=0||r>0)return e;let i=t*n,a=Pf[i];if(a===void 0&&(a=new Float32Array(i),Pf[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function Du(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Ou(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function ku(e,t){let n=Ff[t];n===void 0&&(n=new Int32Array(t),Ff[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Au(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ju(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Du(n,t))return;e.uniform2fv(this.addr,t),Ou(n,t)}}function Mu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Du(n,t))return;e.uniform3fv(this.addr,t),Ou(n,t)}}function Nu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Du(n,t))return;e.uniform4fv(this.addr,t),Ou(n,t)}}function Pu(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(Du(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ou(n,t)}else{if(Du(n,r))return;Rf.set(r),e.uniformMatrix2fv(this.addr,!1,Rf),Ou(n,r)}}function Fu(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(Du(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ou(n,t)}else{if(Du(n,r))return;Lf.set(r),e.uniformMatrix3fv(this.addr,!1,Lf),Ou(n,r)}}function Iu(e,t){let n=this.cache,r=t.elements;if(r===void 0){if(Du(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ou(n,t)}else{if(Du(n,r))return;If.set(r),e.uniformMatrix4fv(this.addr,!1,If),Ou(n,r)}}function Lu(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Ru(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Du(n,t))return;e.uniform2iv(this.addr,t),Ou(n,t)}}function zu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(Du(n,t))return;e.uniform3iv(this.addr,t),Ou(n,t)}}function Bu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Du(n,t))return;e.uniform4iv(this.addr,t),Ou(n,t)}}function Vu(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Hu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Du(n,t))return;e.uniform2uiv(this.addr,t),Ou(n,t)}}function Uu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(Du(n,t))return;e.uniform3uiv(this.addr,t),Ou(n,t)}}function Wu(e,t){let n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Du(n,t))return;e.uniform4uiv(this.addr,t),Ou(n,t)}}function Gu(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i);let a;this.type===e.SAMPLER_2D_SHADOW?(Af.compareFunction=n.isReversedDepthBuffer()?518:515,a=Af):a=kf,n.setTexture2D(t||a,i)}function Ku(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Mf,i)}function qu(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||Nf,i)}function Ju(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||jf,i)}function Yu(e){switch(e){case 5126:return Au;case 35664:return ju;case 35665:return Mu;case 35666:return Nu;case 35674:return Pu;case 35675:return Fu;case 35676:return Iu;case 5124:case 35670:return Lu;case 35667:case 35671:return Ru;case 35668:case 35672:return zu;case 35669:case 35673:return Bu;case 5125:return Vu;case 36294:return Hu;case 36295:return Uu;case 36296:return Wu;case 35678:case 36198:case 36298:case 36306:case 35682:return Gu;case 35679:case 36299:case 36307:return Ku;case 35680:case 36300:case 36308:case 36293:return qu;case 36289:case 36303:case 36311:case 36292:return Ju}}function Xu(e,t){e.uniform1fv(this.addr,t)}function Zu(e,t){let n=Eu(t,this.size,2);e.uniform2fv(this.addr,n)}function Qu(e,t){let n=Eu(t,this.size,3);e.uniform3fv(this.addr,n)}function $u(e,t){let n=Eu(t,this.size,4);e.uniform4fv(this.addr,n)}function ed(e,t){let n=Eu(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function td(e,t){let n=Eu(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function nd(e,t){let n=Eu(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function rd(e,t){e.uniform1iv(this.addr,t)}function id(e,t){e.uniform2iv(this.addr,t)}function ad(e,t){e.uniform3iv(this.addr,t)}function od(e,t){e.uniform4iv(this.addr,t)}function sd(e,t){e.uniform1uiv(this.addr,t)}function cd(e,t){e.uniform2uiv(this.addr,t)}function ld(e,t){e.uniform3uiv(this.addr,t)}function ud(e,t){e.uniform4uiv(this.addr,t)}function dd(e,t,n){let r=this.cache,i=t.length,a=ku(n,i);Du(r,a)||(e.uniform1iv(this.addr,a),Ou(r,a));let o;o=this.type===e.SAMPLER_2D_SHADOW?Af:kf;for(let e=0;e!==i;++e)n.setTexture2D(t[e]||o,a[e])}function fd(e,t,n){let r=this.cache,i=t.length,a=ku(n,i);Du(r,a)||(e.uniform1iv(this.addr,a),Ou(r,a));for(let e=0;e!==i;++e)n.setTexture3D(t[e]||Mf,a[e])}function pd(e,t,n){let r=this.cache,i=t.length,a=ku(n,i);Du(r,a)||(e.uniform1iv(this.addr,a),Ou(r,a));for(let e=0;e!==i;++e)n.setTextureCube(t[e]||Nf,a[e])}function md(e,t,n){let r=this.cache,i=t.length,a=ku(n,i);Du(r,a)||(e.uniform1iv(this.addr,a),Ou(r,a));for(let e=0;e!==i;++e)n.setTexture2DArray(t[e]||jf,a[e])}function hd(e){switch(e){case 5126:return Xu;case 35664:return Zu;case 35665:return Qu;case 35666:return $u;case 35674:return ed;case 35675:return td;case 35676:return nd;case 5124:case 35670:return rd;case 35667:case 35671:return id;case 35668:case 35672:return ad;case 35669:case 35673:return od;case 5125:return sd;case 36294:return cd;case 36295:return ld;case 36296:return ud;case 35678:case 36198:case 36298:case 36306:case 35682:return dd;case 35679:case 36299:case 36307:return fd;case 35680:case 36300:case 36308:case 36293:return pd;case 36289:case 36303:case 36311:case 36292:return md}}function gd(e,t){e.seq.push(t),e.map[t.id]=t}function _d(e,t,n){let r=e.name,i=r.length;for(Hf.lastIndex=0;;){let a=Hf.exec(r),o=Hf.lastIndex,s=a[1],c=a[2]===`]`,l=a[3];if(c&&(s|=0),l===void 0||l===`[`&&o+2===i){gd(n,l===void 0?new zf(s,e,t):new Bf(s,e,t));break}{let e=n.map[s];e===void 0&&(e=new Vf(s),gd(n,e)),n=e}}}function vd(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}function yd(e,t){let n=e.split(`
|
|
266
266
|
`),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=i;e<a;e++){let i=e+1;r.push(`${i===t?`>`:` `} ${i}: ${n[e]}`)}return r.join(`
|
|
267
|
-
`)}function
|
|
267
|
+
`)}function bd(e){Ba._getMatrix(Kf,Ba.workingColorSpace,e);let t=`mat3( ${Kf.elements.map(e=>e.toFixed(4))} )`;switch(Ba.getTransfer(e)){case ya:return[t,`LinearTransferOETF`];case ba:return[t,`sRGBTransferOETF`];default:return K(`WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function xd(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||``).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+`
|
|
268
268
|
|
|
269
269
|
`+i+`
|
|
270
270
|
|
|
271
|
-
`+
|
|
272
|
-
`)}function
|
|
273
|
-
`)}function
|
|
274
|
-
`)}function
|
|
275
|
-
`)}function
|
|
271
|
+
`+yd(e.getShaderSource(t),r)}return i}function Sd(e,t){let n=bd(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(`
|
|
272
|
+
`)}function Cd(e,t){let n=qf[t];return n===void 0?(K(`WebGLProgram: Unsupported toneMapping:`,t),`vec3 `+e+`( vec3 color ) { return LinearToneMapping( color ); }`):`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}function wd(){return Ba.getLuminanceCoefficients(Jf),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${Jf.x.toFixed(4)}, ${Jf.y.toFixed(4)}, ${Jf.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(`
|
|
273
|
+
`)}function Td(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(Od).join(`
|
|
274
|
+
`)}function Ed(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(`
|
|
275
|
+
`)}function Dd(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){let r=e.getActiveAttrib(t,i),a=r.name,o=1;r.type===e.FLOAT_MAT2&&(o=2),r.type===e.FLOAT_MAT3&&(o=3),r.type===e.FLOAT_MAT4&&(o=4),n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}function Od(e){return e!==``}function kd(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_SUN_LIGHTS/g,t.numSunLights).replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,t.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ad(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function jd(e){return e.replace(Yf,Md)}function Md(e,t){let n=lf[t];if(n===void 0){let e=Xf.get(t);if(e!==void 0)n=lf[e],K(`WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`THREE.WebGLProgram: Can not resolve #include <`+t+`>`)}return jd(n)}function Nd(e){return e.replace(Zf,Pd)}function Pd(e,t,n,r){let i=``;for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,`[ `+e+` ]`).replace(/UNROLLED_LOOP_INDEX/g,e);return i}function Fd(e){let t=`precision ${e.precision} float;
|
|
276
276
|
precision ${e.precision} int;
|
|
277
277
|
precision ${e.precision} sampler2D;
|
|
278
278
|
precision ${e.precision} samplerCube;
|
|
@@ -292,28 +292,28 @@ var OpenMockupPlayer=(function(e){Object.defineProperty(e,Symbol.toStringTag,{va
|
|
|
292
292
|
`;return e.precision===`highp`?t+=`
|
|
293
293
|
#define HIGH_PRECISION`:e.precision===`mediump`?t+=`
|
|
294
294
|
#define MEDIUM_PRECISION`:e.precision===`lowp`&&(t+=`
|
|
295
|
-
#define LOW_PRECISION`),t}function
|
|
296
|
-
`:``;n.isRawShaderMaterial?(g=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(
|
|
295
|
+
#define LOW_PRECISION`),t}function Id(e){return Qf[e.shadowMapType]||`SHADOWMAP_TYPE_BASIC`}function Ld(e){return e.envMap===!1?`ENVMAP_TYPE_CUBE`:$f[e.envMapMode]||`ENVMAP_TYPE_CUBE`}function Rd(e){return e.envMap===!1?`ENVMAP_MODE_REFLECTION`:ep[e.envMapMode]||`ENVMAP_MODE_REFLECTION`}function zd(e){return e.envMap===!1?`ENVMAP_BLENDING_NONE`:tp[e.combine]||`ENVMAP_BLENDING_NONE`}function Bd(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let n=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(2**n,112)),texelHeight:r,maxMip:n}}function Vd(e,t,n,r){let i=e.getContext(),a=n.defines,o=n.vertexShader,s=n.fragmentShader,c=Id(n),l=Ld(n),u=Rd(n),d=zd(n),f=Bd(n),p=Td(n),m=Ed(a),h=i.createProgram(),g,_,v=n.glslVersion?`#version `+n.glslVersion+`
|
|
296
|
+
`:``;n.isRawShaderMaterial?(g=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Od).join(`
|
|
297
297
|
`),g.length>0&&(g+=`
|
|
298
|
-
`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(
|
|
298
|
+
`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(Od).join(`
|
|
299
299
|
`),_.length>0&&(_+=`
|
|
300
|
-
`)):(g=[
|
|
301
|
-
`].filter(
|
|
302
|
-
`),_=[
|
|
303
|
-
`].filter(
|
|
304
|
-
`)),o=
|
|
300
|
+
`)):(g=[Fd(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexNormals?`#define HAS_NORMAL`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,n.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,`
|
|
301
|
+
`].filter(Od).join(`
|
|
302
|
+
`),_=[Fd(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.packedNormalMap?`#define USE_PACKED_NORMALMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.retroreflection?`#define USE_RETROREFLECTION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor?`#define USE_COLOR`:``,n.vertexAlphas||n.batchingColor?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.numLightProbeGrids>0?`#define USE_LIGHT_PROBES_GRID`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGARITHMIC_DEPTH_BUFFER`:``,n.reversedDepthBuffer?`#define USE_REVERSED_DEPTH_BUFFER`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:lf.tonemapping_pars_fragment,n.toneMapping===0?``:Cd(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,lf.colorspace_pars_fragment,Sd(`linearToOutputTexel`,n.outputColorSpace),wd(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,`
|
|
303
|
+
`].filter(Od).join(`
|
|
304
|
+
`)),o=jd(o),o=kd(o,n),o=Ad(o,n),s=jd(s),s=kd(s,n),s=Ad(s,n),o=Nd(o),s=Nd(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es
|
|
305
305
|
`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(`
|
|
306
306
|
`)+`
|
|
307
307
|
`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#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(`
|
|
308
308
|
`)+`
|
|
309
|
-
`+_);let y=v+g+o,b=v+_+s,x=
|
|
309
|
+
`+_);let y=v+g+o,b=v+_+s,x=vd(i,i.VERTEX_SHADER,y),S=vd(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.hasPositionAttribute===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h)||``,r=i.getShaderInfoLog(x)||``,a=i.getShaderInfoLog(S)||``,o=n.trim(),s=r.trim(),c=a.trim(),l=!0,u=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1){if(l=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=xd(i,x,`vertex`),n=xd(i,S,`fragment`);q(`WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+`
|
|
310
310
|
|
|
311
311
|
Material Name: `+t.name+`
|
|
312
312
|
Material Type: `+t.type+`
|
|
313
313
|
|
|
314
314
|
Program Info Log: `+o+`
|
|
315
315
|
`+e+`
|
|
316
|
-
`+n)}}else o===``?(s===``||c===``)&&(u=!1):K(`WebGLProgram: Program Info Log:`,o);u&&(t.diagnostics={runnable:l,programLog:o,vertexShader:{log:s,prefix:g},fragmentShader:{log:c,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new Hf(i,h),T=Ed(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,Uf)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Wf++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}function Vd(e){return e===1030||e===37490||e===36285}function Hd(e,t,n,r,i,a){let o=new lo,s=new np,c=new Set,l=[],u=new Map,d=r.logarithmicDepthBuffer,f=r.precision,p={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distance`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function m(e){return c.add(e),e===0?`uv`:`uv${e}`}function h(i,o,l,u,h,g){let _=u.fog,v=h.geometry,y=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?u.environment:null,b=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,x=t.get(i.envMap||y,b),S=x&&x.mapping===306?x.image.height:null,C=p[i.type];i.precision!==null&&(f=r.getMaxPrecision(i.precision),f!==i.precision&&K(`WebGLProgram.getParameters:`,i.precision,`not supported, using`,f,`instead.`));let w=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,T=w===void 0?0:w.length,E=0;v.morphAttributes.position!==void 0&&(E=1),v.morphAttributes.normal!==void 0&&(E=2),v.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=lf[C];D=e.vertexShader,O=e.fragmentShader}else{D=i.vertexShader,O=i.fragmentShader;let e=s.getVertexShaderStage(i),t=s.getFragmentShaderStage(i);s.update(i,e,t),k=e.id,A=t.id}let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=h.isInstancedMesh===!0,P=h.isBatchedMesh===!0,F=!!i.map,I=!!i.matcap,ee=!!x,te=!!i.aoMap,ne=!!i.lightMap,re=!!i.bumpMap&&i.wireframe===!1,L=!!i.normalMap,R=!!i.displacementMap,ie=!!i.emissiveMap,ae=!!i.metalnessMap,oe=!!i.roughnessMap,se=i.anisotropy>0,ce=i.clearcoat>0,le=i.dispersion>0,ue=i.retroreflectivity>0,de=i.iridescence>0,fe=i.sheen>0,pe=i.transmission>0,me=se&&!!i.anisotropyMap,he=ce&&!!i.clearcoatMap,ge=ce&&!!i.clearcoatNormalMap,_e=ce&&!!i.clearcoatRoughnessMap,ve=de&&!!i.iridescenceMap,z=de&&!!i.iridescenceThicknessMap,ye=fe&&!!i.sheenColorMap,be=fe&&!!i.sheenRoughnessMap,xe=!!i.specularMap,B=!!i.specularColorMap,Se=!!i.specularIntensityMap,V=pe&&!!i.transmissionMap,Ce=pe&&!!i.thicknessMap,we=!!i.gradientMap,Te=!!i.alphaMap,Ee=i.alphaTest>0,H=!!i.alphaHash,De=!!i.extensions,U=0;i.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(U=e.toneMapping);let Oe={shaderID:C,shaderType:i.type,shaderName:i.name,vertexShader:D,fragmentShader:O,defines:i.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:i.isRawShaderMaterial===!0,glslVersion:i.glslVersion,precision:f,batching:P,batchingColor:P&&h._colorsTexture!==null,instancing:N,instancingColor:N&&h.instanceColor!==null,instancingMorph:N&&h.morphTexture!==null,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:za.workingColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:L,displacementMap:R,emissiveMap:ie,normalMapObjectSpace:L&&i.normalMapType===1,normalMapTangentSpace:L&&i.normalMapType===0,packedNormalMap:L&&i.normalMapType===0&&Vd(i.normalMap.format),metalnessMap:ae,roughnessMap:oe,anisotropy:se,anisotropyMap:me,clearcoat:ce,clearcoatMap:he,clearcoatNormalMap:ge,clearcoatRoughnessMap:_e,dispersion:le,retroreflection:ue,iridescence:de,iridescenceMap:ve,iridescenceThicknessMap:z,sheen:fe,sheenColorMap:ye,sheenRoughnessMap:be,specularMap:xe,specularColorMap:B,specularIntensityMap:Se,transmission:pe,transmissionMap:V,thicknessMap:Ce,gradientMap:we,opaque:i.transparent===!1&&i.blending===1&&i.alphaToCoverage===!1,alphaMap:Te,alphaTest:Ee,alphaHash:H,combine:i.combine,mapUv:F&&m(i.map.channel),aoMapUv:te&&m(i.aoMap.channel),lightMapUv:ne&&m(i.lightMap.channel),bumpMapUv:re&&m(i.bumpMap.channel),normalMapUv:L&&m(i.normalMap.channel),displacementMapUv:R&&m(i.displacementMap.channel),emissiveMapUv:ie&&m(i.emissiveMap.channel),metalnessMapUv:ae&&m(i.metalnessMap.channel),roughnessMapUv:oe&&m(i.roughnessMap.channel),anisotropyMapUv:me&&m(i.anisotropyMap.channel),clearcoatMapUv:he&&m(i.clearcoatMap.channel),clearcoatNormalMapUv:ge&&m(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:_e&&m(i.clearcoatRoughnessMap.channel),iridescenceMapUv:ve&&m(i.iridescenceMap.channel),iridescenceThicknessMapUv:z&&m(i.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&m(i.sheenColorMap.channel),sheenRoughnessMapUv:be&&m(i.sheenRoughnessMap.channel),specularMapUv:xe&&m(i.specularMap.channel),specularColorMapUv:B&&m(i.specularColorMap.channel),specularIntensityMapUv:Se&&m(i.specularIntensityMap.channel),transmissionMapUv:V&&m(i.transmissionMap.channel),thicknessMapUv:Ce&&m(i.thicknessMap.channel),alphaMapUv:Te&&m(i.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(L||se),vertexNormals:!!v.attributes.normal,vertexColors:i.vertexColors,vertexAlphas:i.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,pointsUvs:h.isPoints===!0&&!!v.attributes.uv&&(F||Te),fog:!!_,useFog:i.fog===!0,fogExp2:!!_&&_.isFogExp2,flatShading:i.wireframe===!1&&(i.flatShading===!0||v.attributes.normal===void 0&&L===!1&&(i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshPhysicalMaterial)),sizeAttenuation:i.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:M,skinning:h.isSkinnedMesh===!0,hasPositionAttribute:v.attributes.position!==void 0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numSunLights:o.sun.length,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numSunLightShadows:o.sunShadowMap.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numLightProbeGrids:g.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:U,decodeVideoTexture:F&&i.map.isVideoTexture===!0&&za.getTransfer(i.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:ie&&i.emissiveMap.isVideoTexture===!0&&za.getTransfer(i.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===2,flipSided:i.side===1,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:De&&i.extensions.clipCullDistance===!0&&n.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(De&&i.extensions.multiDraw===!0||P)&&n.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:n.has(`KHR_parallel_shader_compile`),customProgramCacheKey:i.customProgramCacheKey()};return Oe.vertexUv1s=c.has(1),Oe.vertexUv2s=c.has(2),Oe.vertexUv3s=c.has(3),c.clear(),Oe}function g(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(_(n,t),v(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function _(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numSunLights),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numSunLightShadows),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function v(e,t){o.disableAll(),t.instancing&&o.enable(0),t.instancingColor&&o.enable(1),t.instancingMorph&&o.enable(2),t.matcap&&o.enable(3),t.envMap&&o.enable(4),t.normalMapObjectSpace&&o.enable(5),t.normalMapTangentSpace&&o.enable(6),t.clearcoat&&o.enable(7),t.iridescence&&o.enable(8),t.alphaTest&&o.enable(9),t.vertexColors&&o.enable(10),t.vertexAlphas&&o.enable(11),t.vertexUv1s&&o.enable(12),t.vertexUv2s&&o.enable(13),t.vertexUv3s&&o.enable(14),t.vertexTangents&&o.enable(15),t.anisotropy&&o.enable(16),t.alphaHash&&o.enable(17),t.batching&&o.enable(18),t.dispersion&&o.enable(19),t.retroreflection&&o.enable(24),t.batchingColor&&o.enable(20),t.gradientMap&&o.enable(21),t.packedNormalMap&&o.enable(22),t.vertexNormals&&o.enable(23),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.reversedDepthBuffer&&o.enable(4),t.skinning&&o.enable(5),t.morphTargets&&o.enable(6),t.morphNormals&&o.enable(7),t.morphColors&&o.enable(8),t.premultipliedAlpha&&o.enable(9),t.shadowMapEnabled&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.transmission&&o.enable(15),t.sheen&&o.enable(16),t.opaque&&o.enable(17),t.pointsUvs&&o.enable(18),t.decodeVideoTexture&&o.enable(19),t.decodeVideoTextureEmissive&&o.enable(20),t.alphaToCoverage&&o.enable(21),t.numLightProbeGrids>0&&o.enable(22),t.hasPositionAttribute&&o.enable(23),e.push(o.mask)}function y(e){let t=p[e.type],n;if(t){let e=lf[t];n=Uc.clone(e.uniforms)}else n=e.uniforms;return n}function b(t,n){let r=u.get(n);return r===void 0?(r=new Bd(e,n,t,i),l.push(r),u.set(n,r)):++r.usedTimes,r}function x(e){if(--e.usedTimes===0){let t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),u.delete(e.cacheKey),e.destroy()}}function S(e){s.remove(e)}function C(){s.dispose()}return{getParameters:h,getProgramCacheKey:g,getUniforms:y,acquireProgram:b,releaseProgram:x,releaseShaderCache:S,programs:l,dispose:C}}function Ud(){let e=new WeakMap;function t(t){return e.has(t)}function n(t){let n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function r(t){e.delete(t)}function i(t,n,r){e.get(t)[n]=r}function a(){e=new WeakMap}return{has:t,get:n,remove:r,update:i,dispose:a}}function Wd(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.material.id===t.material.id?e.materialVariant===t.materialVariant?e.z===t.z?e.id-t.id:e.z-t.z:e.materialVariant-t.materialVariant:e.material.id-t.material.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function Gd(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function Kd(){let e=[],t=0,n=[],r=[],i=[];function a(){t=0,n.length=0,r.length=0,i.length=0}function o(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(n,r,i,a,s,c){let l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:i,materialVariant:o(n),groupOrder:a,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.materialVariant=o(n),l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function c(e,t,a,o,c,l,u){u.reversedDepth===!0&&(c=-c);let d=s(e,t,a,o,c,l);a.transmission>0?r.push(d):a.transparent===!0?i.push(d):n.push(d)}function l(e,t,a,o,c,l){let u=s(e,t,a,o,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function u(e,t){n.length>1&&n.sort(e||Wd),r.length>1&&r.sort(t||Gd),i.length>1&&i.sort(t||Gd)}function d(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(t.id===null)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}}return{opaque:n,transmissive:r,transparent:i,init:a,push:c,unshift:l,finish:d,sort:u}}function qd(){let e=new WeakMap;function t(t,n){let r=e.get(t),i;return r===void 0?(i=new Kd,e.set(t,[i])):n>=r.length?(i=new Kd,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function Jd(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`SunLight`:case`DirectionalLight`:n={direction:new Y,color:new No};break;case`SpotLight`:n={position:new Y,direction:new Y,color:new No,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new Y,color:new No,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new Y,skyColor:new No,groundColor:new No};break;case`RectAreaLight`:n={color:new No,position:new Y,halfWidth:new Y,halfHeight:new Y}}return e[t.id]=n,n}}}function Yd(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`SunLight`:case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}function Xd(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function Zd(e){let t=new Jd,n=Yd(),r={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new Y);let i=new Y,a=new Qa,o=new Qa;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0;i.sort(Xd);for(let e=0,S=i.length;e<S;e++){let S=i[e],C=S.color,w=S.intensity,T=S.distance,E=null;if(S.shadow&&S.shadow.map&&(E=S.shadow.map.texture.format===1030?S.shadow.map.texture:S.shadow.map.depthTexture||S.shadow.map.texture),S.isAmbientLight)a+=C.r*w,o+=C.g*w,s+=C.b*w;else if(S.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(S.sh.coefficients[e],w);x++}else if(S.isSunLight){let e=t.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){let e=S.shadow,t=n.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize.copy(e.mapSize).multiply(e.getFrameExtents()),r.sunShadow[l]=t,r.sunShadowMap[l]=E;let i=e.getViewportCount();for(let t=0;t<i;t++)r.sunShadowMatrix[u+t]=e.getMatrix(t),r.sunShadowCascade[u+t]=e._cascadeData[t];u+=i,l++}r.sun[c]=e,c++}else if(S.isDirectionalLight){let e=t.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){let e=S.shadow,t=n.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[d]=t,r.directionalShadowMap[d]=E,r.directionalShadowMatrix[d]=S.shadow.matrix,g++}r.directional[d]=e,d++}else if(S.isSpotLight){let e=t.get(S);e.position.setFromMatrixPosition(S.matrixWorld),e.color.copy(C).multiplyScalar(w),e.distance=T,e.coneCos=Math.cos(S.angle),e.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),e.decay=S.decay,r.spot[p]=e;let i=S.shadow;if(S.map&&(r.spotLightMap[y]=S.map,y++,i.updateMatrices(S),S.castShadow&&b++),r.spotLightMatrix[p]=i.matrix,S.castShadow){let e=n.get(S);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[p]=e,r.spotShadowMap[p]=E,v++}p++}else if(S.isRectAreaLight){let e=t.get(S);e.color.copy(C).multiplyScalar(w),e.halfWidth.set(S.width*.5,0,0),e.halfHeight.set(0,S.height*.5,0),r.rectArea[m]=e,m++}else if(S.isPointLight){let e=t.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),e.distance=S.distance,e.decay=S.decay,S.castShadow){let e=S.shadow,t=n.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[f]=t,r.pointShadowMap[f]=E,r.pointShadowMatrix[f]=S.shadow.matrix,_++}r.point[f]=e,f++}else if(S.isHemisphereLight){let e=t.get(S);e.skyColor.copy(S.color).multiplyScalar(w),e.groundColor.copy(S.groundColor).multiplyScalar(w),r.hemi[h]=e,h++}}m>0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Z.LTC_FLOAT_1,r.rectAreaLTC2=Z.LTC_FLOAT_2):(r.rectAreaLTC1=Z.LTC_HALF_1,r.rectAreaLTC2=Z.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let S=r.hash;(S.sunLength!==c||S.directionalLength!==d||S.pointLength!==f||S.spotLength!==p||S.rectAreaLength!==m||S.hemiLength!==h||S.numSunShadows!==l||S.numDirectionalShadows!==g||S.numPointShadows!==_||S.numSpotShadows!==v||S.numSpotMaps!==y||S.numLightProbes!==x)&&(r.sun.length=c,r.directional.length=d,r.spot.length=p,r.rectArea.length=m,r.point.length=f,r.hemi.length=h,r.sunShadow.length=l,r.sunShadowMap.length=l,r.sunShadowMatrix.length=u,r.sunShadowCascade.length=u,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.directionalShadowMatrix.length=g,r.pointShadow.length=_,r.pointShadowMap.length=_,r.pointShadowMatrix.length=_,r.spotShadow.length=v,r.spotShadowMap.length=v,r.spotLightMatrix.length=v+y-b,r.spotLightMap.length=y,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=x,S.sunLength=c,S.directionalLength=d,S.pointLength=f,S.spotLength=p,S.rectAreaLength=m,S.hemiLength=h,S.numSunShadows=l,S.numDirectionalShadows=g,S.numPointShadows=_,S.numSpotShadows=v,S.numSpotMaps=y,S.numLightProbes=x,r.version=ip++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=0,f=t.matrixWorldInverse;for(let t=0,p=e.length;t<p;t++){let p=e[t];if(p.isSunLight){let e=r.sun[n];e.direction.setFromMatrixPosition(p.matrixWorld),e.direction.transformDirection(f),n++}else if(p.isDirectionalLight){let e=r.directional[s];e.direction.setFromMatrixPosition(p.matrixWorld),i.setFromMatrixPosition(p.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(f),s++}else if(p.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(p.matrixWorld),e.position.applyMatrix4(f),e.direction.setFromMatrixPosition(p.matrixWorld),i.setFromMatrixPosition(p.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(f),l++}else if(p.isRectAreaLight){let e=r.rectArea[u];e.position.setFromMatrixPosition(p.matrixWorld),e.position.applyMatrix4(f),o.identity(),a.copy(p.matrixWorld),a.premultiply(f),o.extractRotation(a),e.halfWidth.set(p.width*.5,0,0),e.halfHeight.set(0,p.height*.5,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),u++}else if(p.isPointLight){let e=r.point[c];e.position.setFromMatrixPosition(p.matrixWorld),e.position.applyMatrix4(f),c++}else if(p.isHemisphereLight){let e=r.hemi[d];e.direction.setFromMatrixPosition(p.matrixWorld),e.direction.transformDirection(f),d++}}}return{setup:s,setupView:c,state:r}}function Qd(e){let t=new Zd(e),n=[],r=[],i=[];function a(e){d.camera=e,n.length=0,r.length=0,i.length=0}function o(e){n.push(e)}function s(e){r.push(e)}function c(e){i.push(e)}function l(){t.setup(n)}function u(e){t.setupView(n,e)}let d={lightsArray:n,shadowsArray:r,lightProbeGridArray:i,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:a,state:d,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s,pushLightProbeGrid:c}}function $d(e){let t=new WeakMap;function n(n,r=0){let i=t.get(n),a;return i===void 0?(a=new Qd(e),t.set(n,[a])):r>=i.length?(a=new Qd(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}function ef(e,t,n){let r=new rc,i=new J,a=new J,o=new qa,s=new Xc,c=new Zc,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new Kc({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new J},radius:{value:4}},vertexShader:ap,fragmentShader:op}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new Os;m.setAttribute(`position`,new ps(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new Qs(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;this.type===2&&(K(`WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead.`),this.type=1);let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.depth.getReversed()===!0?f.buffers.color.setClear(0,0,0,0):f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==this.type;p&&n.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let c=0,l=t.length;c<l;c++){let l=t[c],d=l.shadow;if(d===void 0){K(`WebGLShadowMap:`,l,`has no shadow.`);continue}if(d.autoUpdate===!1&&d.needsUpdate===!1)continue;i.copy(d.mapSize);let m=d.getFrameExtents();i.multiply(m),a.copy(d.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/m.x),i.x=a.x*m.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/m.y),i.y=a.y*m.y,d.mapSize.y=a.y));let h=e.state.buffers.depth.getReversed();if(d.camera._reversedDepth=h,d.map===null||p===!0){if(d.map!==null&&(d.map.depthTexture!==null&&(d.map.depthTexture.dispose(),d.map.depthTexture=null),d.map.dispose()),this.type===3){if(l.isPointLight){K(`WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.`);continue}d.map=new Ya(i.x,i.y,{format:Ci,type:ui,minFilter:ei,magFilter:ei,generateMipmaps:!1}),d.map.texture.name=l.name+`.shadowMap`,d.map.depthTexture=new sc(i.x,i.y,li),d.map.depthTexture.name=l.name+`.shadowMapDepth`,d.map.depthTexture.format=yi,d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=Zr,d.map.depthTexture.magFilter=Zr}else l.isPointLight?(d.map=new Ef(i.x),d.map.depthTexture=new cc(i.x,ci)):(d.map=new Ya(i.x,i.y),d.map.depthTexture=new sc(i.x,i.y,ci)),d.map.depthTexture.name=l.name+`.shadowMap`,d.map.depthTexture.format=yi,this.type===1?(d.map.depthTexture.compareFunction=h?518:515,d.map.depthTexture.minFilter=ei,d.map.depthTexture.magFilter=ei):(d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=Zr,d.map.depthTexture.magFilter=Zr);d.camera.updateProjectionMatrix()}d.map.isWebGLCubeRenderTarget!==!0&&(d.map.width!==i.x||d.map.height!==i.y)&&d.map.setSize(i.x,i.y);let g=d.map.isWebGLCubeRenderTarget?6:d.getViewportCount();l.isPointLight!==!0&&d.updateMatrices(l,s);for(let t=0;t<g;t++){let i=d.getCamera(t);if(l.isPointLight){let e=d.camera,n=d.matrix,r=l.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),up.setFromMatrixPosition(l.matrixWorld),e.position.copy(up),dp.copy(e.position),dp.add(sp[t]),e.up.copy(cp[t]),e.lookAt(dp),e.updateMatrixWorld(),n.makeTranslation(-up.x,-up.y,-up.z),lp.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),d._frustum.setFromProjectionMatrix(lp,e.coordinateSystem,e.reversedDepth)}if(d.map.isWebGLCubeRenderTarget)e.setRenderTarget(d.map,t),e.clear();else{t===0&&(e.setRenderTarget(d.map),e.clear());let n=d.getViewport(t);o.set(a.x*n.x,a.y*n.y,a.x*n.z,a.y*n.w),f.viewport(o)}r=d.getFrustum(t),b(n,s,i,l,this.type)}d.isPointLightShadow!==!0&&this.type===3&&v(d,s),d.needsUpdate=!1}_=this.type,g.needsUpdate=!1,e.setRenderTarget(c,l,d)};function v(n,r){let a=t.update(h);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),n.mapPass===null?n.mapPass=new Ya(i.x,i.y,{format:Ci,type:ui}):(n.mapPass.width!==n.map.width||n.mapPass.height!==n.map.height)&&n.mapPass.setSize(n.map.width,n.map.height),f.uniforms.shadow_pass.value=n.map.depthTexture,f.uniforms.resolution.value.set(n.map.width,n.map.height),f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,f,h,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value.set(n.map.width,n.map.height),p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,h,null)}function y(t,n,r,i){let a=null,o=r.isPointLight===!0?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)a=o;else if(a=r.isPointLight===!0?c:s,e.localClippingEnabled&&n.clipShadows===!0&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||n.intersectsFrustum(r))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l<u;l++){let u=t[l],d=c[u.materialIndex];if(d&&d.visible){let t=y(n,d,o,s);n.onBeforeShadow(e,n,i,a,r,t,u),e.renderBufferDirect(a,null,r,t,n,u),n.onAfterShadow(e,n,i,a,r,t,u)}}}else if(c.visible){let t=y(n,c,o,s);n.onBeforeShadow(e,n,i,a,r,t,null),e.renderBufferDirect(a,null,r,t,n,null),n.onAfterShadow(e,n,i,a,r,t,null)}}let c=n.children;for(let e=0,t=c.length;e<t;e++)b(c[e],i,a,o,s)}function x(e){e.target.removeEventListener(`dispose`,x);for(let t in l){let n=l[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}}function tf(e,t){function n(){let t=!1,n=new qa,r=null,i=new qa(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function r(){let n=!1,r=!1,i=null,a=null,o=null;return{setReversed:function(e){if(r!==e){let n=t.get(`EXT_clip_control`);e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;let i=o;o=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?ae(e.DEPTH_TEST):oe(e.DEPTH_TEST)},setMask:function(t){i!==t&&!n&&(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=Ea[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(o=t,r&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,i=null,a=null,o=null,r=!1}}}function i(){let t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(n){t||(n?ae(e.STENCIL_TEST):oe(e.STENCIL_TEST))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}let a=new n,o=new r,s=new i,c=new WeakMap,l=new WeakMap,u={},d={},f={},p=new WeakMap,m=[],h=null,g=!1,_=null,v=null,y=null,b=null,x=null,S=null,C=null,w=new No(0,0,0),T=0,E=!1,D=null,O=null,k=null,A=null,j=null,M=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),N=!1,P=0,F=e.getParameter(e.VERSION);F.indexOf(`WebGL`)===-1?F.indexOf(`OpenGL ES`)!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),N=P>=2):(P=parseFloat(/^WebGL (\d)/.exec(F)[1]),N=P>=1);let I=null,ee={},te=e.getParameter(e.SCISSOR_BOX),ne=e.getParameter(e.VIEWPORT),re=new qa().fromArray(te),L=new qa().fromArray(ne);function R(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<r;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}let ie={};ie[e.TEXTURE_2D]=R(e.TEXTURE_2D,e.TEXTURE_2D,1),ie[e.TEXTURE_CUBE_MAP]=R(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[e.TEXTURE_2D_ARRAY]=R(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ie[e.TEXTURE_3D]=R(e.TEXTURE_3D,e.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),ae(e.DEPTH_TEST),o.setFunc(3),me(!1),he(1),ae(e.CULL_FACE),fe(0);function ae(t){u[t]!==!0&&(e.enable(t),u[t]=!0)}function oe(t){u[t]!==!1&&(e.disable(t),u[t]=!1)}function se(t,n){return f[t]!==n&&(e.bindFramebuffer(t,n),f[t]=n,t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n),!0)}function ce(t,n){let r=m,i=!1;if(t){r=p.get(n),r===void 0&&(r=[],p.set(n,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)}function le(t){return h!==t&&(e.useProgram(t),h=t,!0)}let ue={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};ue[103]=e.MIN,ue[104]=e.MAX;let de={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function fe(t,n,r,i,a,o,s,c,l,u){if(t===0)g===!0&&(oe(e.BLEND),g=!1);else if(g===!1&&(ae(e.BLEND),g=!0),t!==5){if(t!==_||u!==E){if((v!==100||x!==100)&&(e.blendEquation(e.FUNC_ADD),v=100,x=100),u)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:q(`WebGLState: Invalid blending: `,t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:q(`WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true`);break;case 4:q(`WebGLState: MultiplyBlending requires material.premultipliedAlpha = true`);break;default:q(`WebGLState: Invalid blending: `,t)}y=null,b=null,S=null,C=null,w.set(0,0,0),T=0,_=t,E=u}}else a||=n,o||=r,s||=i,(n!==v||a!==x)&&(e.blendEquationSeparate(ue[n],ue[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==C)&&(e.blendFuncSeparate(de[r],de[i],de[o],de[s]),y=r,b=i,S=o,C=s),(c.equals(w)===!1||l!==T)&&(e.blendColor(c.r,c.g,c.b,l),w.copy(c),T=l),_=t,E=!1}function pe(t,n){t.side===2?oe(e.CULL_FACE):ae(e.CULL_FACE);let r=t.side===1;n&&(r=!r),me(r),t.blending===1&&t.transparent===!1?fe(0):fe(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),a.setMask(t.colorWrite);let i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),_e(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),t.alphaToCoverage===!0?ae(e.SAMPLE_ALPHA_TO_COVERAGE):oe(e.SAMPLE_ALPHA_TO_COVERAGE)}function me(t){D!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),D=t)}function he(t){t===0?oe(e.CULL_FACE):(ae(e.CULL_FACE),t!==O&&(t===1?e.cullFace(e.BACK):t===2?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))),O=t}function ge(t){t!==k&&(N&&e.lineWidth(t),k=t)}function _e(t,n,r){t?(ae(e.POLYGON_OFFSET_FILL),(A!==n||j!==r)&&(A=n,j=r,o.getReversed()&&(n=-n),e.polygonOffset(n,r))):oe(e.POLYGON_OFFSET_FILL)}function ve(t){t?ae(e.SCISSOR_TEST):oe(e.SCISSOR_TEST)}function z(t){t===void 0&&(t=e.TEXTURE0+M-1),I!==t&&(e.activeTexture(t),I=t)}function ye(t,n,r){r===void 0&&(r=I===null?e.TEXTURE0+M-1:I);let i=ee[r];i===void 0&&(i={type:void 0,texture:void 0},ee[r]=i),(i.type!==t||i.texture!==n)&&(I!==r&&(e.activeTexture(r),I=r),e.bindTexture(t,n||ie[t]),i.type=t,i.texture=n)}function be(){let t=ee[I];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function xe(){try{e.compressedTexImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function B(){try{e.compressedTexImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Se(){try{e.texSubImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function V(){try{e.texSubImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Ce(){try{e.compressedTexSubImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function we(){try{e.compressedTexSubImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Te(){try{e.texStorage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Ee(){try{e.texStorage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function H(){try{e.texImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function De(){try{e.texImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function U(t){return d[t]===void 0?e.getParameter(t):d[t]}function Oe(t,n){d[t]!==n&&(e.pixelStorei(t,n),d[t]=n)}function ke(t){re.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),re.copy(t))}function W(t){L.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),L.copy(t))}function Ae(t,n){let r=l.get(n);r===void 0&&(r=new WeakMap,l.set(n,r));let i=r.get(t);i===void 0&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))}function je(t,n){let r=l.get(n).get(t);c.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),c.set(n,r))}function Me(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},d={},I=null,ee={},f={},p=new WeakMap,m=[],h=null,g=!1,_=null,v=null,y=null,b=null,x=null,S=null,C=null,w=new No(0,0,0),T=0,E=!1,D=null,O=null,k=null,A=null,j=null,re.set(0,0,e.canvas.width,e.canvas.height),L.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}return{buffers:{color:a,depth:o,stencil:s},enable:ae,disable:oe,bindFramebuffer:se,drawBuffers:ce,useProgram:le,setBlending:fe,setMaterial:pe,setFlipSided:me,setCullFace:he,setLineWidth:ge,setPolygonOffset:_e,setScissorTest:ve,activeTexture:z,bindTexture:ye,unbindTexture:be,compressedTexImage2D:xe,compressedTexImage3D:B,texImage2D:H,texImage3D:De,pixelStorei:Oe,getParameter:U,updateUBOMapping:Ae,uniformBlockBinding:je,texStorage2D:Te,texStorage3D:Ee,texSubImage2D:Se,texSubImage3D:V,compressedTexSubImage2D:Ce,compressedTexSubImage3D:we,scissor:ke,viewport:W,reset:Me}}function nf(e,t,n,r,i,a,o){let s=t.has(`WEBGL_multisampled_render_to_texture`)?t.get(`WEBGL_multisampled_render_to_texture`):null,c=typeof navigator>`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new J,u=new WeakMap,d=new Set,f,p=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function h(e,t){return m?new OffscreenCanvas(e,t):rn(`canvas`)}function g(e,t,n){let r=1,i=xe(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);f===void 0&&(f=h(n,a));let o=t?h(n,a):f;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),K(`WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}return`data`in e&&K(`WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e}return e}function _(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,r,i,a,o,s=!1){if(n!==null){if(e[n]!==void 0)return e[n];K(`WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let c;a&&(c=t.get(`EXT_texture_norm16`),c||K(`WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension`));let l=r;if(r===e.RED&&(i===e.FLOAT&&(l=e.R32F),i===e.HALF_FLOAT&&(l=e.R16F),i===e.UNSIGNED_BYTE&&(l=e.R8),i===e.UNSIGNED_SHORT&&c&&(l=c.R16_EXT),i===e.SHORT&&c&&(l=c.R16_SNORM_EXT)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.R8UI),i===e.UNSIGNED_SHORT&&(l=e.R16UI),i===e.UNSIGNED_INT&&(l=e.R32UI),i===e.BYTE&&(l=e.R8I),i===e.SHORT&&(l=e.R16I),i===e.INT&&(l=e.R32I)),r===e.RG&&(i===e.FLOAT&&(l=e.RG32F),i===e.HALF_FLOAT&&(l=e.RG16F),i===e.UNSIGNED_BYTE&&(l=e.RG8),i===e.UNSIGNED_SHORT&&c&&(l=c.RG16_EXT),i===e.SHORT&&c&&(l=c.RG16_SNORM_EXT)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RG8UI),i===e.UNSIGNED_SHORT&&(l=e.RG16UI),i===e.UNSIGNED_INT&&(l=e.RG32UI),i===e.BYTE&&(l=e.RG8I),i===e.SHORT&&(l=e.RG16I),i===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGB8UI),i===e.UNSIGNED_SHORT&&(l=e.RGB16UI),i===e.UNSIGNED_INT&&(l=e.RGB32UI),i===e.BYTE&&(l=e.RGB8I),i===e.SHORT&&(l=e.RGB16I),i===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),i===e.UNSIGNED_INT&&(l=e.RGBA32UI),i===e.BYTE&&(l=e.RGBA8I),i===e.SHORT&&(l=e.RGBA16I),i===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_SHORT&&c&&(l=c.RGB16_EXT),i===e.SHORT&&c&&(l=c.RGB16_SNORM_EXT),i===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?va:za.getTransfer(o);i===e.FLOAT&&(l=e.RGBA32F),i===e.HALF_FLOAT&&(l=e.RGBA16F),i===e.UNSIGNED_BYTE&&(l=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT&&c&&(l=c.RGBA16_EXT),i===e.SHORT&&c&&(l=c.RGBA16_SNORM_EXT),i===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),l}function x(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,K(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function S(e,t){return _(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&u.delete(t),t.isHTMLTexture&&d.delete(t)}function w(e){let t=e.target;t.removeEventListener(`dispose`,w),D(t)}function T(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=p.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&E(e),Object.keys(i).length===0&&p.delete(n)}r.remove(e)}function E(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=p.get(i);delete a[n.__cacheKey],o.memory.textures--}function D(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let i=t.textures;for(let t=0,n=i.length;t<n;t++){let n=r.get(i[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),r.remove(i[t])}r.remove(t)}let O=0;function k(){O=0}function A(){return O}function j(e){O=e}function M(){let e=O;return e>=i.maxTextures&&K(`WebGLTextures: Trying to use `+(e+1)+` texture units while this GPU supports only `+i.maxTextures),O+=1,e}function N(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function P(t,i){let a=r.get(t);if(t.isVideoTexture&&ye(t),t.isRenderTargetTexture===!1&&t.isExternalTexture!==!0&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)K(`WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)K(`WebGLRenderer: Texture marked for update but image is incomplete`);else{oe(a,t,i);return}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function F(t,i){let a=r.get(t);t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version?oe(a,t,i):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i))}function I(t,i){let a=r.get(t);t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version?oe(a,t,i):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function ee(t,i){let a=r.get(t);t.isCubeDepthTexture!==!0&&t.version>0&&a.__version!==t.version?se(a,t,i):n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let te={[Jr]:e.REPEAT,[Yr]:e.CLAMP_TO_EDGE,[Xr]:e.MIRRORED_REPEAT},ne={[Zr]:e.NEAREST,[Qr]:e.NEAREST_MIPMAP_NEAREST,[$r]:e.NEAREST_MIPMAP_LINEAR,[ei]:e.LINEAR,[ti]:e.LINEAR_MIPMAP_NEAREST,[ni]:e.LINEAR_MIPMAP_LINEAR},re={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function L(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&K(`WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,te[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,te[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,te[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,ne[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,ne[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,re[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function R(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C));let i=n.source,a=p.get(i);a===void 0&&(a={},p.set(i,a));let s=N(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&E(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function ie(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ae(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e<o.length;e++){let t=o[s],n=o[e],i=t.start+t.count,a=ie(n.start,r.width,4),c=ie(t.start,r.width,4);n.start<=i+1&&a===c&&ie(n.start+n.count-1,r.width,4)===a?t.count=Math.max(t.count,n.start+n.count-t.start):(++s,o[s]=n)}o.length=s+1;let c=n.getParameter(e.UNPACK_ROW_LENGTH),l=n.getParameter(e.UNPACK_SKIP_PIXELS),u=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,s=o.length;t<s;t++){let s=o[t],c=Math.floor(s.start/4),l=Math.ceil(s.count/4),u=c%r.width,d=Math.floor(c/r.width),f=l;n.pixelStorei(e.UNPACK_SKIP_PIXELS,u),n.pixelStorei(e.UNPACK_SKIP_ROWS,d),n.texSubImage2D(e.TEXTURE_2D,0,u,d,f,1,i,a,r.data)}t.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,c),n.pixelStorei(e.UNPACK_SKIP_PIXELS,l),n.pixelStorei(e.UNPACK_SKIP_ROWS,u)}}function oe(t,o,s){let c=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(c=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(c=e.TEXTURE_3D);let l=R(t,o),u=o.source;n.bindTexture(c,t.__webglTexture,e.TEXTURE0+s);let f=r.get(u);if(u.version!==f.__version||l===!0){if(n.activeTexture(e.TEXTURE0+s),!(typeof ImageBitmap<`u`&&o.image instanceof ImageBitmap)){let t=za.getPrimaries(za.workingColorSpace),r=o.colorSpace===``?null:za.getPrimaries(o.colorSpace),i=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,i)}n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment);let t=g(o.image,!1,i.maxTextureSize);t=be(o,t);let r=a.convert(o.format,o.colorSpace),p=a.convert(o.type),m=b(o.internalFormat,r,p,o.normalized,o.colorSpace,o.isVideoTexture);L(c,o);let h,y=o.mipmaps,C=o.isVideoTexture!==!0,w=f.__version===void 0||l===!0,T=u.dataReady,E=S(o,t);if(o.isDepthTexture)m=x(o.format===bi,o.type),w&&(C?n.texStorage2D(e.TEXTURE_2D,1,m,t.width,t.height):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,r,p,null));else if(o.isDataTexture){if(y.length>0){C&&w&&n.texStorage2D(e.TEXTURE_2D,E,m,y[0].width,y[0].height);for(let t=0,i=y.length;t<i;t++)h=y[t],C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,p,h.data):n.texImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,r,p,h.data);o.generateMipmaps=!1}else C?(w&&n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height),T&&ae(o,t,r,p)):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,r,p,t.data)}else if(o.isCompressedTexture){if(o.isCompressedArrayTexture){C&&w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,y[0].width,y[0].height,t.depth);for(let i=0,a=y.length;i<a;i++)if(h=y[i],o.format!==1023){if(r!==null){if(C){if(T){if(o.layerUpdates.size>0){let t=Kr(h.width,h.height,o.format,o.type);for(let a of o.layerUpdates){let o=h.data.subarray(a*t/h.data.BYTES_PER_ELEMENT,(a+1)*t/h.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,a,h.width,h.height,1,r,o)}}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,h.data)}}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,h.data,0,0)}else K(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`)}else C?T&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,p,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,r,p,h.data);o.layerUpdates.size>0&&o.clearLayerUpdates()}else{C&&w&&n.texStorage2D(e.TEXTURE_2D,E,m,y[0].width,y[0].height);for(let t=0,i=y.length;t<i;t++)h=y[t],o.format===1023?C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,p,h.data):n.texImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,r,p,h.data):r===null?K(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):C?T&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,h.data):n.compressedTexImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,h.data)}}else if(o.isDataArrayTexture){if(C){if(w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,t.width,t.height,t.depth),T){if(o.layerUpdates.size>0){let i=Kr(t.width,t.height,o.format,o.type);for(let a of o.layerUpdates){let o=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,a,t.width,t.height,1,r,p,o)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)}}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,m,t.width,t.height,t.depth,0,r,p,t.data)}else if(o.isData3DTexture)C?(w&&n.texStorage3D(e.TEXTURE_3D,E,m,t.width,t.height,t.depth),T&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)):n.texImage3D(e.TEXTURE_3D,0,m,t.width,t.height,t.depth,0,r,p,t.data);else if(o.isFramebufferTexture){if(w){if(C)n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height);else{let i=t.width,a=t.height;for(let t=0;t<E;t++)n.texImage2D(e.TEXTURE_2D,t,m,i,a,0,r,p,null),i>>=1,a>>=1}}}else if(o.isHTMLTexture){if(`texElementImage2D`in e){let n=e.canvas;if(n.hasAttribute(`layoutsubtree`)||n.setAttribute(`layoutsubtree`,`true`),t.parentNode!==n){n.appendChild(t),d.add(o),n.onpaint=e=>{let t=e.changedElements;for(let e of d)t.includes(e.image)&&(e.needsUpdate=!0)},n.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,t);else{let n=e.RGBA,r=e.RGBA,i=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,n,r,i,t)}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)}}else if(y.length>0){if(C&&w){let t=xe(y[0]);n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height)}for(let t=0,i=y.length;t<i;t++)h=y[t],C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,r,p,h):n.texImage2D(e.TEXTURE_2D,t,m,r,p,h);o.generateMipmaps=!1}else if(C){if(w){let r=xe(t);n.texStorage2D(e.TEXTURE_2D,E,m,r.width,r.height)}T&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,r,p,t)}else n.texImage2D(e.TEXTURE_2D,0,m,r,p,t);_(o)&&v(c),f.__version=u.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function se(t,o,s){if(o.image.length!==6)return;let c=R(t,o),l=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);let u=r.get(l);if(l.version!==u.__version||c===!0){n.activeTexture(e.TEXTURE0+s);let t=za.getPrimaries(za.workingColorSpace),r=o.colorSpace===``?null:za.getPrimaries(o.colorSpace),d=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let f=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)!f&&!p?m[e]=g(o.image[e],!0,i.maxCubemapSize):m[e]=p?o.image[e].image:o.image[e],m[e]=be(o,m[e]);let h=m[0],y=a.convert(o.format,o.colorSpace),x=a.convert(o.type),C=b(o.internalFormat,y,x,o.normalized,o.colorSpace),w=o.isVideoTexture!==!0,T=u.__version===void 0||c===!0,E=l.dataReady,D=S(o,h);L(e.TEXTURE_CUBE_MAP,o);let O;if(f){w&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,h.width,h.height);for(let t=0;t<6;t++){O=m[t].mipmaps;for(let r=0;r<O.length;r++){let i=O[r];o.format===1023?w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,y,x,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,y,x,i.data):y===null?K(`WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):w?E&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,y,i.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,i.data)}}}else{if(O=o.mipmaps,w&&T){O.length>0&&D++;let t=xe(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,y,x,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,y,x,m[t].data);for(let r=0;r<O.length;r++){let i=O[r].image[t].image;w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,i.width,i.height,y,x,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,i.width,i.height,0,y,x,i.data)}}else{w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,y,x,m[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,y,x,m[t]);for(let r=0;r<O.length;r++){let i=O[r];w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,y,x,i.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,y,x,i.image[t])}}}_(o)&&v(e.TEXTURE_CUBE_MAP),u.__version=l.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function ce(t,i,o,c,l,u){let d=a.convert(o.format,o.colorSpace),f=a.convert(o.type),p=b(o.internalFormat,d,f,o.normalized,o.colorSpace),m=r.get(i),h=r.get(o);if(h.__renderTarget=i,!m.__hasExternalTextures){let t=Math.max(1,i.width>>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,ve(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function le(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=x(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ve(n),o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,ve(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i<t.length;i++){let o=t[i],c=a.convert(o.format,o.colorSpace),l=a.convert(o.type),u=b(o.internalFormat,c,l,o.normalized,o.colorSpace);z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ve(n),u,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,ve(n),u,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,u,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function ue(t,i,o){let c=i.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(i.depthTexture&&i.depthTexture.isDepthTexture))throw Error(`THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.`);let l=r.get(i.depthTexture);if(l.__renderTarget=i,l.__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),c){if(l.__webglInit===void 0&&(l.__webglInit=!0,i.depthTexture.addEventListener(`dispose`,C)),l.__webglTexture===void 0){l.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),L(e.TEXTURE_CUBE_MAP,i.depthTexture);let t=a.convert(i.depthTexture.format),r=a.convert(i.depthTexture.type),o;i.depthTexture.format===1026?o=e.DEPTH_COMPONENT24:i.depthTexture.format===1027&&(o=e.DEPTH24_STENCIL8);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o,i.width,i.height,0,t,r,null)}}else P(i.depthTexture,0);let u=l.__webglTexture,d=ve(i),f=c?e.TEXTURE_CUBE_MAP_POSITIVE_X+o:e.TEXTURE_2D,p=i.depthTexture.format===1027?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(i.depthTexture.format===1026)z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,u,0);else if(i.depthTexture.format===1027)z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,u,0);else throw Error(`THREE.WebGLTextures: Unknown depthTexture format.`)}function de(t){let i=r.get(t),a=t.isWebGLCubeRenderTarget===!0;if(i.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(i.__depthDisposeCallback&&i.__depthDisposeCallback(),e){let t=()=>{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)for(let e=0;e<6;e++)ue(i.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?ue(i.__webglFramebuffer[0],t,0):ue(i.__webglFramebuffer,t,0)}}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),le(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),le(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function fe(t,n,i){let a=r.get(t);n!==void 0&&ce(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&de(t)}function pe(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,w);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<i.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<i.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=l.length;t<n;t++){let n=r.get(l[t]);n.__webglTexture===void 0&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&z(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<l.length;n++){let r=l[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);let i=a.convert(r.format,r.colorSpace),o=a.convert(r.type),c=b(r.internalFormat,i,o,r.normalized,r.colorSpace,t.isXRRenderTarget===!0),u=ve(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,c,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),le(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){n.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),L(e.TEXTURE_CUBE_MAP,i);for(let n=0;n<6;n++)if(i.mipmaps&&i.mipmaps.length>0)for(let r=0;r<i.mipmaps.length;r++)ce(s.__webglFramebuffer[n][r],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else ce(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);_(i)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let i=0,a=l.length;i<a;i++){let a=l[i],o=r.get(a),c=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(c=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(c,o.__webglTexture),L(c,a),ce(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+i,c,0),_(a)&&v(c)}n.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(r,c.__webglTexture),L(r,i),i.mipmaps&&i.mipmaps.length>0)for(let n=0;n<i.mipmaps.length;n++)ce(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,r,n);else ce(s.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0,r,0);_(i)&&v(r),n.unbindTexture()}t.depthBuffer&&de(t)}function me(e){let t=e.textures;for(let i=0,a=t.length;i<a;i++){let a=t[i];if(_(a)){let t=y(e),i=r.get(a).__webglTexture;n.bindTexture(t,i),v(t),n.unbindTexture()}}}let he=[],ge=[];function _e(t){if(t.samples>0){if(z(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t<i.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);let f=t.texture.mipmaps;f&&f.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n<i.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRenderbuffer[n]);let t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),c===!0&&(he.length=0,ge.length=0,he.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&t.storeMultisampledDepthBuffer===!1&&(he.push(l),ge.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,ge)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,he))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<i.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);let a=r.get(i[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&t.storeMultisampledDepthBuffer===!1&&c){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}}function ve(e){return Math.min(i.maxSamples,e.samples)}function z(e){let n=r.get(e);return e.samples>0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function ye(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function be(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(za.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&K(`WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):q(`WebGLTextures: Unsupported texture color space:`,n)),t}function xe(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=M,this.resetTextureUnits=k,this.getTextureUnits=A,this.setTextureUnits=j,this.setTexture2D=P,this.setTexture2DArray=F,this.setTexture3D=I,this.setTextureCube=ee,this.rebindTextures=fe,this.setupRenderTarget=pe,this.updateRenderTargetMipmap=me,this.updateMultisampleRenderTarget=_e,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=z,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function rf(e,t){function n(n,r=``){let i,a=za.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779){if(a===`srgb`){if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null}else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null}if(n===35840||n===35841||n===35842||n===35843){if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null}if(n===36196||n===37492||n===37496||n===37488||n===37489||n===37490||n===37491){if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===37488)return i.COMPRESSED_R11_EAC;if(n===37489)return i.COMPRESSED_SIGNED_R11_EAC;if(n===37490)return i.COMPRESSED_RG11_EAC;if(n===37491)return i.COMPRESSED_SIGNED_RG11_EAC}else return null}if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821){if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null}if(n===36492||n===36494||n===36495){if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null}if(n===36283||n===36284||n===36285||n===36286){if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36283)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null}return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}function af(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,Rr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isNodeMaterial?t.uniformsNeedUpdate=!1:t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&p(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),m(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),h(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===1&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===1&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(gp.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(_p),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.retroreflectivity>0&&(e.retroreflectivity.value=t.retroreflectivity),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function of(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(g(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,v));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return q(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=r.length;e<t;e++){let t=r[e];if(Array.isArray(t))for(let n=0,r=t.length;n<r;n++)p(t[n],e,n,a);else p(t,e,0,a)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(t,n,r,i){if(h(t,n,r,i)===!0){let n=t.__offset,r=t.value;if(Array.isArray(r)){let e=0;for(let n=0;n<r.length;n++){let i=r[n],a=_(i);m(i,t.__data,e),typeof i!=`number`&&typeof i!=`boolean`&&!i.isMatrix3&&!ArrayBuffer.isView(i)&&(e+=a.storage/Float32Array.BYTES_PER_ELEMENT)}}else m(r,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function m(e,t,n){typeof e==`number`||typeof e==`boolean`?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function h(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return r[a]=typeof i==`number`||typeof i==`boolean`?i:ArrayBuffer.isView(i)?i.slice():i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(ArrayBuffer.isView(i))return!0;else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function g(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=_(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function _(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?K(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):K(`WebGLRenderer: Unsupported uniform value type.`,e),t}function v(t){let n=t.target;n.removeEventListener(`dispose`,v);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function y(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:y}}function sf(){return yp===null&&(yp=new $s(vp,16,16,Ci,ui),yp.name=`DFG_LUT`,yp.minFilter=ei,yp.magFilter=ei,yp.wrapS=Yr,yp.wrapT=Yr,yp.generateMipmaps=!1,yp.needsUpdate=!0),yp}var cf,Z,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up,dp,fp,pp,mp,hp,gp,_p,vp,yp,bp,xp=n((()=>{tu(),cf={alphahash_fragment:`#ifdef USE_ALPHAHASH
|
|
316
|
+
`+n)}}else o===``?(s===``||c===``)&&(u=!1):K(`WebGLProgram: Program Info Log:`,o);u&&(t.diagnostics={runnable:l,programLog:o,vertexShader:{log:s,prefix:g},fragmentShader:{log:c,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new Uf(i,h),T=Dd(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,Wf)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Gf++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}function Hd(e){return e===1030||e===37490||e===36285}function Ud(e,t,n,r,i,a){let o=new uo,s=new rp,c=new Set,l=[],u=new Map,d=r.logarithmicDepthBuffer,f=r.precision,p={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distance`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function m(e){return c.add(e),e===0?`uv`:`uv${e}`}function h(i,o,l,u,h,g){let _=u.fog,v=h.geometry,y=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?u.environment:null,b=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,x=t.get(i.envMap||y,b),S=x&&x.mapping===306?x.image.height:null,C=p[i.type];i.precision!==null&&(f=r.getMaxPrecision(i.precision),f!==i.precision&&K(`WebGLProgram.getParameters:`,i.precision,`not supported, using`,f,`instead.`));let w=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,T=w===void 0?0:w.length,E=0;v.morphAttributes.position!==void 0&&(E=1),v.morphAttributes.normal!==void 0&&(E=2),v.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=uf[C];D=e.vertexShader,O=e.fragmentShader}else{D=i.vertexShader,O=i.fragmentShader;let e=s.getVertexShaderStage(i),t=s.getFragmentShaderStage(i);s.update(i,e,t),k=e.id,A=t.id}let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=h.isInstancedMesh===!0,P=h.isBatchedMesh===!0,F=!!i.map,I=!!i.matcap,ee=!!x,te=!!i.aoMap,ne=!!i.lightMap,re=!!i.bumpMap&&i.wireframe===!1,L=!!i.normalMap,R=!!i.displacementMap,ie=!!i.emissiveMap,ae=!!i.metalnessMap,oe=!!i.roughnessMap,se=i.anisotropy>0,ce=i.clearcoat>0,le=i.dispersion>0,ue=i.retroreflectivity>0,de=i.iridescence>0,fe=i.sheen>0,pe=i.transmission>0,me=se&&!!i.anisotropyMap,he=ce&&!!i.clearcoatMap,ge=ce&&!!i.clearcoatNormalMap,_e=ce&&!!i.clearcoatRoughnessMap,ve=de&&!!i.iridescenceMap,z=de&&!!i.iridescenceThicknessMap,ye=fe&&!!i.sheenColorMap,be=fe&&!!i.sheenRoughnessMap,xe=!!i.specularMap,B=!!i.specularColorMap,Se=!!i.specularIntensityMap,V=pe&&!!i.transmissionMap,Ce=pe&&!!i.thicknessMap,we=!!i.gradientMap,Te=!!i.alphaMap,Ee=i.alphaTest>0,H=!!i.alphaHash,De=!!i.extensions,U=0;i.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(U=e.toneMapping);let Oe={shaderID:C,shaderType:i.type,shaderName:i.name,vertexShader:D,fragmentShader:O,defines:i.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:i.isRawShaderMaterial===!0,glslVersion:i.glslVersion,precision:f,batching:P,batchingColor:P&&h._colorsTexture!==null,instancing:N,instancingColor:N&&h.instanceColor!==null,instancingMorph:N&&h.morphTexture!==null,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Ba.workingColorSpace,alphaToCoverage:!!i.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:L,displacementMap:R,emissiveMap:ie,normalMapObjectSpace:L&&i.normalMapType===1,normalMapTangentSpace:L&&i.normalMapType===0,packedNormalMap:L&&i.normalMapType===0&&Hd(i.normalMap.format),metalnessMap:ae,roughnessMap:oe,anisotropy:se,anisotropyMap:me,clearcoat:ce,clearcoatMap:he,clearcoatNormalMap:ge,clearcoatRoughnessMap:_e,dispersion:le,retroreflection:ue,iridescence:de,iridescenceMap:ve,iridescenceThicknessMap:z,sheen:fe,sheenColorMap:ye,sheenRoughnessMap:be,specularMap:xe,specularColorMap:B,specularIntensityMap:Se,transmission:pe,transmissionMap:V,thicknessMap:Ce,gradientMap:we,opaque:i.transparent===!1&&i.blending===1&&i.alphaToCoverage===!1,alphaMap:Te,alphaTest:Ee,alphaHash:H,combine:i.combine,mapUv:F&&m(i.map.channel),aoMapUv:te&&m(i.aoMap.channel),lightMapUv:ne&&m(i.lightMap.channel),bumpMapUv:re&&m(i.bumpMap.channel),normalMapUv:L&&m(i.normalMap.channel),displacementMapUv:R&&m(i.displacementMap.channel),emissiveMapUv:ie&&m(i.emissiveMap.channel),metalnessMapUv:ae&&m(i.metalnessMap.channel),roughnessMapUv:oe&&m(i.roughnessMap.channel),anisotropyMapUv:me&&m(i.anisotropyMap.channel),clearcoatMapUv:he&&m(i.clearcoatMap.channel),clearcoatNormalMapUv:ge&&m(i.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:_e&&m(i.clearcoatRoughnessMap.channel),iridescenceMapUv:ve&&m(i.iridescenceMap.channel),iridescenceThicknessMapUv:z&&m(i.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&m(i.sheenColorMap.channel),sheenRoughnessMapUv:be&&m(i.sheenRoughnessMap.channel),specularMapUv:xe&&m(i.specularMap.channel),specularColorMapUv:B&&m(i.specularColorMap.channel),specularIntensityMapUv:Se&&m(i.specularIntensityMap.channel),transmissionMapUv:V&&m(i.transmissionMap.channel),thicknessMapUv:Ce&&m(i.thicknessMap.channel),alphaMapUv:Te&&m(i.alphaMap.channel),vertexTangents:!!v.attributes.tangent&&(L||se),vertexNormals:!!v.attributes.normal,vertexColors:i.vertexColors,vertexAlphas:i.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,pointsUvs:h.isPoints===!0&&!!v.attributes.uv&&(F||Te),fog:!!_,useFog:i.fog===!0,fogExp2:!!_&&_.isFogExp2,flatShading:i.wireframe===!1&&(i.flatShading===!0||v.attributes.normal===void 0&&L===!1&&(i.isMeshLambertMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isMeshPhysicalMaterial)),sizeAttenuation:i.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:M,skinning:h.isSkinnedMesh===!0,hasPositionAttribute:v.attributes.position!==void 0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numSunLights:o.sun.length,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numSunLightShadows:o.sunShadowMap.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numLightProbeGrids:g.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.length>0,shadowMapType:e.shadowMap.type,toneMapping:U,decodeVideoTexture:F&&i.map.isVideoTexture===!0&&Ba.getTransfer(i.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:ie&&i.emissiveMap.isVideoTexture===!0&&Ba.getTransfer(i.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:i.premultipliedAlpha,doubleSided:i.side===2,flipSided:i.side===1,useDepthPacking:i.depthPacking>=0,depthPacking:i.depthPacking||0,index0AttributeName:i.index0AttributeName,extensionClipCullDistance:De&&i.extensions.clipCullDistance===!0&&n.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(De&&i.extensions.multiDraw===!0||P)&&n.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:n.has(`KHR_parallel_shader_compile`),customProgramCacheKey:i.customProgramCacheKey()};return Oe.vertexUv1s=c.has(1),Oe.vertexUv2s=c.has(2),Oe.vertexUv3s=c.has(3),c.clear(),Oe}function g(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(_(n,t),v(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function _(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numSunLights),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numSunLightShadows),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function v(e,t){o.disableAll(),t.instancing&&o.enable(0),t.instancingColor&&o.enable(1),t.instancingMorph&&o.enable(2),t.matcap&&o.enable(3),t.envMap&&o.enable(4),t.normalMapObjectSpace&&o.enable(5),t.normalMapTangentSpace&&o.enable(6),t.clearcoat&&o.enable(7),t.iridescence&&o.enable(8),t.alphaTest&&o.enable(9),t.vertexColors&&o.enable(10),t.vertexAlphas&&o.enable(11),t.vertexUv1s&&o.enable(12),t.vertexUv2s&&o.enable(13),t.vertexUv3s&&o.enable(14),t.vertexTangents&&o.enable(15),t.anisotropy&&o.enable(16),t.alphaHash&&o.enable(17),t.batching&&o.enable(18),t.dispersion&&o.enable(19),t.retroreflection&&o.enable(24),t.batchingColor&&o.enable(20),t.gradientMap&&o.enable(21),t.packedNormalMap&&o.enable(22),t.vertexNormals&&o.enable(23),e.push(o.mask),o.disableAll(),t.fog&&o.enable(0),t.useFog&&o.enable(1),t.flatShading&&o.enable(2),t.logarithmicDepthBuffer&&o.enable(3),t.reversedDepthBuffer&&o.enable(4),t.skinning&&o.enable(5),t.morphTargets&&o.enable(6),t.morphNormals&&o.enable(7),t.morphColors&&o.enable(8),t.premultipliedAlpha&&o.enable(9),t.shadowMapEnabled&&o.enable(10),t.doubleSided&&o.enable(11),t.flipSided&&o.enable(12),t.useDepthPacking&&o.enable(13),t.dithering&&o.enable(14),t.transmission&&o.enable(15),t.sheen&&o.enable(16),t.opaque&&o.enable(17),t.pointsUvs&&o.enable(18),t.decodeVideoTexture&&o.enable(19),t.decodeVideoTextureEmissive&&o.enable(20),t.alphaToCoverage&&o.enable(21),t.numLightProbeGrids>0&&o.enable(22),t.hasPositionAttribute&&o.enable(23),e.push(o.mask)}function y(e){let t=p[e.type],n;if(t){let e=uf[t];n=Wc.clone(e.uniforms)}else n=e.uniforms;return n}function b(t,n){let r=u.get(n);return r===void 0?(r=new Vd(e,n,t,i),l.push(r),u.set(n,r)):++r.usedTimes,r}function x(e){if(--e.usedTimes===0){let t=l.indexOf(e);l[t]=l[l.length-1],l.pop(),u.delete(e.cacheKey),e.destroy()}}function S(e){s.remove(e)}function C(){s.dispose()}return{getParameters:h,getProgramCacheKey:g,getUniforms:y,acquireProgram:b,releaseProgram:x,releaseShaderCache:S,programs:l,dispose:C}}function Wd(){let e=new WeakMap;function t(t){return e.has(t)}function n(t){let n=e.get(t);return n===void 0&&(n={},e.set(t,n)),n}function r(t){e.delete(t)}function i(t,n,r){e.get(t)[n]=r}function a(){e=new WeakMap}return{has:t,get:n,remove:r,update:i,dispose:a}}function Gd(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.material.id===t.material.id?e.materialVariant===t.materialVariant?e.z===t.z?e.id-t.id:e.z-t.z:e.materialVariant-t.materialVariant:e.material.id-t.material.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function Kd(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function qd(){let e=[],t=0,n=[],r=[],i=[];function a(){t=0,n.length=0,r.length=0,i.length=0}function o(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(n,r,i,a,s,c){let l=e[t];return l===void 0?(l={id:n.id,object:n,geometry:r,material:i,materialVariant:o(n),groupOrder:a,renderOrder:n.renderOrder,z:s,group:c},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.materialVariant=o(n),l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=c),t++,l}function c(e,t,a,o,c,l,u){u.reversedDepth===!0&&(c=-c);let d=s(e,t,a,o,c,l);a.transmission>0?r.push(d):a.transparent===!0?i.push(d):n.push(d)}function l(e,t,a,o,c,l){let u=s(e,t,a,o,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function u(e,t){n.length>1&&n.sort(e||Gd),r.length>1&&r.sort(t||Kd),i.length>1&&i.sort(t||Kd)}function d(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(t.id===null)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}}return{opaque:n,transmissive:r,transparent:i,init:a,push:c,unshift:l,finish:d,sort:u}}function Jd(){let e=new WeakMap;function t(t,n){let r=e.get(t),i;return r===void 0?(i=new qd,e.set(t,[i])):n>=r.length?(i=new qd,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function Yd(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`SunLight`:case`DirectionalLight`:n={direction:new Y,color:new Po};break;case`SpotLight`:n={position:new Y,direction:new Y,color:new Po,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new Y,color:new Po,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new Y,skyColor:new Po,groundColor:new Po};break;case`RectAreaLight`:n={color:new Po,position:new Y,halfWidth:new Y,halfHeight:new Y}}return e[t.id]=n,n}}}function Xd(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`SunLight`:case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new J,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}function Zd(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function Qd(e){let t=new Yd,n=Xd(),r={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new Y);let i=new Y,a=new $a,o=new $a;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0,x=0;i.sort(Zd);for(let e=0,S=i.length;e<S;e++){let S=i[e],C=S.color,w=S.intensity,T=S.distance,E=null;if(S.shadow&&S.shadow.map&&(E=S.shadow.map.texture.format===1030?S.shadow.map.texture:S.shadow.map.depthTexture||S.shadow.map.texture),S.isAmbientLight)a+=C.r*w,o+=C.g*w,s+=C.b*w;else if(S.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(S.sh.coefficients[e],w);x++}else if(S.isSunLight){let e=t.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){let e=S.shadow,t=n.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize.copy(e.mapSize).multiply(e.getFrameExtents()),r.sunShadow[l]=t,r.sunShadowMap[l]=E;let i=e.getViewportCount();for(let t=0;t<i;t++)r.sunShadowMatrix[u+t]=e.getMatrix(t),r.sunShadowCascade[u+t]=e._cascadeData[t];u+=i,l++}r.sun[c]=e,c++}else if(S.isDirectionalLight){let e=t.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){let e=S.shadow,t=n.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[d]=t,r.directionalShadowMap[d]=E,r.directionalShadowMatrix[d]=S.shadow.matrix,g++}r.directional[d]=e,d++}else if(S.isSpotLight){let e=t.get(S);e.position.setFromMatrixPosition(S.matrixWorld),e.color.copy(C).multiplyScalar(w),e.distance=T,e.coneCos=Math.cos(S.angle),e.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),e.decay=S.decay,r.spot[p]=e;let i=S.shadow;if(S.map&&(r.spotLightMap[y]=S.map,y++,i.updateMatrices(S),S.castShadow&&b++),r.spotLightMatrix[p]=i.matrix,S.castShadow){let e=n.get(S);e.shadowIntensity=i.intensity,e.shadowBias=i.bias,e.shadowNormalBias=i.normalBias,e.shadowRadius=i.radius,e.shadowMapSize=i.mapSize,r.spotShadow[p]=e,r.spotShadowMap[p]=E,v++}p++}else if(S.isRectAreaLight){let e=t.get(S);e.color.copy(C).multiplyScalar(w),e.halfWidth.set(S.width*.5,0,0),e.halfHeight.set(0,S.height*.5,0),r.rectArea[m]=e,m++}else if(S.isPointLight){let e=t.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),e.distance=S.distance,e.decay=S.decay,S.castShadow){let e=S.shadow,t=n.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[f]=t,r.pointShadowMap[f]=E,r.pointShadowMatrix[f]=S.shadow.matrix,_++}r.point[f]=e,f++}else if(S.isHemisphereLight){let e=t.get(S);e.skyColor.copy(S.color).multiplyScalar(w),e.groundColor.copy(S.groundColor).multiplyScalar(w),r.hemi[h]=e,h++}}m>0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Z.LTC_FLOAT_1,r.rectAreaLTC2=Z.LTC_FLOAT_2):(r.rectAreaLTC1=Z.LTC_HALF_1,r.rectAreaLTC2=Z.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let S=r.hash;(S.sunLength!==c||S.directionalLength!==d||S.pointLength!==f||S.spotLength!==p||S.rectAreaLength!==m||S.hemiLength!==h||S.numSunShadows!==l||S.numDirectionalShadows!==g||S.numPointShadows!==_||S.numSpotShadows!==v||S.numSpotMaps!==y||S.numLightProbes!==x)&&(r.sun.length=c,r.directional.length=d,r.spot.length=p,r.rectArea.length=m,r.point.length=f,r.hemi.length=h,r.sunShadow.length=l,r.sunShadowMap.length=l,r.sunShadowMatrix.length=u,r.sunShadowCascade.length=u,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.directionalShadowMatrix.length=g,r.pointShadow.length=_,r.pointShadowMap.length=_,r.pointShadowMatrix.length=_,r.spotShadow.length=v,r.spotShadowMap.length=v,r.spotLightMatrix.length=v+y-b,r.spotLightMap.length=y,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=x,S.sunLength=c,S.directionalLength=d,S.pointLength=f,S.spotLength=p,S.rectAreaLength=m,S.hemiLength=h,S.numSunShadows=l,S.numDirectionalShadows=g,S.numPointShadows=_,S.numSpotShadows=v,S.numSpotMaps=y,S.numLightProbes=x,r.version=ap++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=0,f=t.matrixWorldInverse;for(let t=0,p=e.length;t<p;t++){let p=e[t];if(p.isSunLight){let e=r.sun[n];e.direction.setFromMatrixPosition(p.matrixWorld),e.direction.transformDirection(f),n++}else if(p.isDirectionalLight){let e=r.directional[s];e.direction.setFromMatrixPosition(p.matrixWorld),i.setFromMatrixPosition(p.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(f),s++}else if(p.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(p.matrixWorld),e.position.applyMatrix4(f),e.direction.setFromMatrixPosition(p.matrixWorld),i.setFromMatrixPosition(p.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(f),l++}else if(p.isRectAreaLight){let e=r.rectArea[u];e.position.setFromMatrixPosition(p.matrixWorld),e.position.applyMatrix4(f),o.identity(),a.copy(p.matrixWorld),a.premultiply(f),o.extractRotation(a),e.halfWidth.set(p.width*.5,0,0),e.halfHeight.set(0,p.height*.5,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),u++}else if(p.isPointLight){let e=r.point[c];e.position.setFromMatrixPosition(p.matrixWorld),e.position.applyMatrix4(f),c++}else if(p.isHemisphereLight){let e=r.hemi[d];e.direction.setFromMatrixPosition(p.matrixWorld),e.direction.transformDirection(f),d++}}}return{setup:s,setupView:c,state:r}}function $d(e){let t=new Qd(e),n=[],r=[],i=[];function a(e){d.camera=e,n.length=0,r.length=0,i.length=0}function o(e){n.push(e)}function s(e){r.push(e)}function c(e){i.push(e)}function l(){t.setup(n)}function u(e){t.setupView(n,e)}let d={lightsArray:n,shadowsArray:r,lightProbeGridArray:i,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:a,state:d,setupLights:l,setupLightsView:u,pushLight:o,pushShadow:s,pushLightProbeGrid:c}}function ef(e){let t=new WeakMap;function n(n,r=0){let i=t.get(n),a;return i===void 0?(a=new $d(e),t.set(n,[a])):r>=i.length?(a=new $d(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}function tf(e,t,n){let r=new ic,i=new J,a=new J,o=new Ja,s=new Zc,c=new Qc,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new qc({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new J},radius:{value:4}},vertexShader:op,fragmentShader:sp}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new ks;m.setAttribute(`position`,new ms(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new $s(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;this.type===2&&(K(`WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead.`),this.type=1);let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.depth.getReversed()===!0?f.buffers.color.setClear(0,0,0,0):f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==this.type;p&&n.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let c=0,l=t.length;c<l;c++){let l=t[c],d=l.shadow;if(d===void 0){K(`WebGLShadowMap:`,l,`has no shadow.`);continue}if(d.autoUpdate===!1&&d.needsUpdate===!1)continue;i.copy(d.mapSize);let m=d.getFrameExtents();i.multiply(m),a.copy(d.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/m.x),i.x=a.x*m.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/m.y),i.y=a.y*m.y,d.mapSize.y=a.y));let h=e.state.buffers.depth.getReversed();if(d.camera._reversedDepth=h,d.map===null||p===!0){if(d.map!==null&&(d.map.depthTexture!==null&&(d.map.depthTexture.dispose(),d.map.depthTexture=null),d.map.dispose()),this.type===3){if(l.isPointLight){K(`WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.`);continue}d.map=new Xa(i.x,i.y,{format:wi,type:di,minFilter:ti,magFilter:ti,generateMipmaps:!1}),d.map.texture.name=l.name+`.shadowMap`,d.map.depthTexture=new cc(i.x,i.y,ui),d.map.depthTexture.name=l.name+`.shadowMapDepth`,d.map.depthTexture.format=bi,d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=Qr,d.map.depthTexture.magFilter=Qr}else l.isPointLight?(d.map=new Df(i.x),d.map.depthTexture=new lc(i.x,li)):(d.map=new Xa(i.x,i.y),d.map.depthTexture=new cc(i.x,i.y,li)),d.map.depthTexture.name=l.name+`.shadowMap`,d.map.depthTexture.format=bi,this.type===1?(d.map.depthTexture.compareFunction=h?518:515,d.map.depthTexture.minFilter=ti,d.map.depthTexture.magFilter=ti):(d.map.depthTexture.compareFunction=null,d.map.depthTexture.minFilter=Qr,d.map.depthTexture.magFilter=Qr);d.camera.updateProjectionMatrix()}d.map.isWebGLCubeRenderTarget!==!0&&(d.map.width!==i.x||d.map.height!==i.y)&&d.map.setSize(i.x,i.y);let g=d.map.isWebGLCubeRenderTarget?6:d.getViewportCount();l.isPointLight!==!0&&d.updateMatrices(l,s);for(let t=0;t<g;t++){let i=d.getCamera(t);if(l.isPointLight){let e=d.camera,n=d.matrix,r=l.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),dp.setFromMatrixPosition(l.matrixWorld),e.position.copy(dp),fp.copy(e.position),fp.add(cp[t]),e.up.copy(lp[t]),e.lookAt(fp),e.updateMatrixWorld(),n.makeTranslation(-dp.x,-dp.y,-dp.z),up.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),d._frustum.setFromProjectionMatrix(up,e.coordinateSystem,e.reversedDepth)}if(d.map.isWebGLCubeRenderTarget)e.setRenderTarget(d.map,t),e.clear();else{t===0&&(e.setRenderTarget(d.map),e.clear());let n=d.getViewport(t);o.set(a.x*n.x,a.y*n.y,a.x*n.z,a.y*n.w),f.viewport(o)}r=d.getFrustum(t),b(n,s,i,l,this.type)}d.isPointLightShadow!==!0&&this.type===3&&v(d,s),d.needsUpdate=!1}_=this.type,g.needsUpdate=!1,e.setRenderTarget(c,l,d)};function v(n,r){let a=t.update(h);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),n.mapPass===null?n.mapPass=new Xa(i.x,i.y,{format:wi,type:di}):(n.mapPass.width!==n.map.width||n.mapPass.height!==n.map.height)&&n.mapPass.setSize(n.map.width,n.map.height),f.uniforms.shadow_pass.value=n.map.depthTexture,f.uniforms.resolution.value.set(n.map.width,n.map.height),f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,a,f,h,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value.set(n.map.width,n.map.height),p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,a,p,h,null)}function y(t,n,r,i){let a=null,o=r.isPointLight===!0?t.customDistanceMaterial:t.customDepthMaterial;if(o!==void 0)a=o;else if(a=r.isPointLight===!0?c:s,e.localClippingEnabled&&n.clipShadows===!0&&Array.isArray(n.clippingPlanes)&&n.clippingPlanes.length!==0||n.displacementMap&&n.displacementScale!==0||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||n.intersectsFrustum(r))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l<u;l++){let u=t[l],d=c[u.materialIndex];if(d&&d.visible){let t=y(n,d,o,s);n.onBeforeShadow(e,n,i,a,r,t,u),e.renderBufferDirect(a,null,r,t,n,u),n.onAfterShadow(e,n,i,a,r,t,u)}}}else if(c.visible){let t=y(n,c,o,s);n.onBeforeShadow(e,n,i,a,r,t,null),e.renderBufferDirect(a,null,r,t,n,null),n.onAfterShadow(e,n,i,a,r,t,null)}}let c=n.children;for(let e=0,t=c.length;e<t;e++)b(c[e],i,a,o,s)}function x(e){e.target.removeEventListener(`dispose`,x);for(let t in l){let n=l[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}}function nf(e,t){function n(){let t=!1,n=new Ja,r=null,i=new Ja(0,0,0,0);return{setMask:function(n){r!==n&&!t&&(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){s===!0&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),i.equals(n)===!1&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}}function r(){let n=!1,r=!1,i=null,a=null,o=null;return{setReversed:function(e){if(r!==e){let n=t.get(`EXT_clip_control`);e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;let i=o;o=null,this.setClear(i)}},getReversed:function(){return r},setTest:function(t){t?ae(e.DEPTH_TEST):oe(e.DEPTH_TEST)},setMask:function(t){i!==t&&!n&&(e.depthMask(t),i=t)},setFunc:function(t){if(r&&(t=Da[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}a=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(o=t,r&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,i=null,a=null,o=null,r=!1}}}function i(){let t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(n){t||(n?ae(e.STENCIL_TEST):oe(e.STENCIL_TEST))},setMask:function(r){n!==r&&!t&&(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||c!==r)&&(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}}let a=new n,o=new r,s=new i,c=new WeakMap,l=new WeakMap,u={},d={},f={},p=new WeakMap,m=[],h=null,g=!1,_=null,v=null,y=null,b=null,x=null,S=null,C=null,w=new Po(0,0,0),T=0,E=!1,D=null,O=null,k=null,A=null,j=null,M=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),N=!1,P=0,F=e.getParameter(e.VERSION);F.indexOf(`WebGL`)===-1?F.indexOf(`OpenGL ES`)!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),N=P>=2):(P=parseFloat(/^WebGL (\d)/.exec(F)[1]),N=P>=1);let I=null,ee={},te=e.getParameter(e.SCISSOR_BOX),ne=e.getParameter(e.VIEWPORT),re=new Ja().fromArray(te),L=new Ja().fromArray(ne);function R(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<r;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}let ie={};ie[e.TEXTURE_2D]=R(e.TEXTURE_2D,e.TEXTURE_2D,1),ie[e.TEXTURE_CUBE_MAP]=R(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ie[e.TEXTURE_2D_ARRAY]=R(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ie[e.TEXTURE_3D]=R(e.TEXTURE_3D,e.TEXTURE_3D,1,1),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),ae(e.DEPTH_TEST),o.setFunc(3),me(!1),he(1),ae(e.CULL_FACE),fe(0);function ae(t){u[t]!==!0&&(e.enable(t),u[t]=!0)}function oe(t){u[t]!==!1&&(e.disable(t),u[t]=!1)}function se(t,n){return f[t]!==n&&(e.bindFramebuffer(t,n),f[t]=n,t===e.DRAW_FRAMEBUFFER&&(f[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(f[e.DRAW_FRAMEBUFFER]=n),!0)}function ce(t,n){let r=m,i=!1;if(t){r=p.get(n),r===void 0&&(r=[],p.set(n,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)}function le(t){return h!==t&&(e.useProgram(t),h=t,!0)}let ue={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};ue[103]=e.MIN,ue[104]=e.MAX;let de={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function fe(t,n,r,i,a,o,s,c,l,u){if(t===0)g===!0&&(oe(e.BLEND),g=!1);else if(g===!1&&(ae(e.BLEND),g=!0),t!==5){if(t!==_||u!==E){if((v!==100||x!==100)&&(e.blendEquation(e.FUNC_ADD),v=100,x=100),u)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:q(`WebGLState: Invalid blending: `,t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:q(`WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true`);break;case 4:q(`WebGLState: MultiplyBlending requires material.premultipliedAlpha = true`);break;default:q(`WebGLState: Invalid blending: `,t)}y=null,b=null,S=null,C=null,w.set(0,0,0),T=0,_=t,E=u}}else a||=n,o||=r,s||=i,(n!==v||a!==x)&&(e.blendEquationSeparate(ue[n],ue[a]),v=n,x=a),(r!==y||i!==b||o!==S||s!==C)&&(e.blendFuncSeparate(de[r],de[i],de[o],de[s]),y=r,b=i,S=o,C=s),(c.equals(w)===!1||l!==T)&&(e.blendColor(c.r,c.g,c.b,l),w.copy(c),T=l),_=t,E=!1}function pe(t,n){t.side===2?oe(e.CULL_FACE):ae(e.CULL_FACE);let r=t.side===1;n&&(r=!r),me(r),t.blending===1&&t.transparent===!1?fe(0):fe(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),o.setFunc(t.depthFunc),o.setTest(t.depthTest),o.setMask(t.depthWrite),a.setMask(t.colorWrite);let i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),_e(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),t.alphaToCoverage===!0?ae(e.SAMPLE_ALPHA_TO_COVERAGE):oe(e.SAMPLE_ALPHA_TO_COVERAGE)}function me(t){D!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),D=t)}function he(t){t===0?oe(e.CULL_FACE):(ae(e.CULL_FACE),t!==O&&(t===1?e.cullFace(e.BACK):t===2?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))),O=t}function ge(t){t!==k&&(N&&e.lineWidth(t),k=t)}function _e(t,n,r){t?(ae(e.POLYGON_OFFSET_FILL),(A!==n||j!==r)&&(A=n,j=r,o.getReversed()&&(n=-n),e.polygonOffset(n,r))):oe(e.POLYGON_OFFSET_FILL)}function ve(t){t?ae(e.SCISSOR_TEST):oe(e.SCISSOR_TEST)}function z(t){t===void 0&&(t=e.TEXTURE0+M-1),I!==t&&(e.activeTexture(t),I=t)}function ye(t,n,r){r===void 0&&(r=I===null?e.TEXTURE0+M-1:I);let i=ee[r];i===void 0&&(i={type:void 0,texture:void 0},ee[r]=i),(i.type!==t||i.texture!==n)&&(I!==r&&(e.activeTexture(r),I=r),e.bindTexture(t,n||ie[t]),i.type=t,i.texture=n)}function be(){let t=ee[I];t!==void 0&&t.type!==void 0&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)}function xe(){try{e.compressedTexImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function B(){try{e.compressedTexImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Se(){try{e.texSubImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function V(){try{e.texSubImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Ce(){try{e.compressedTexSubImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function we(){try{e.compressedTexSubImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Te(){try{e.texStorage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function Ee(){try{e.texStorage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function H(){try{e.texImage2D(...arguments)}catch(e){q(`WebGLState:`,e)}}function De(){try{e.texImage3D(...arguments)}catch(e){q(`WebGLState:`,e)}}function U(t){return d[t]===void 0?e.getParameter(t):d[t]}function Oe(t,n){d[t]!==n&&(e.pixelStorei(t,n),d[t]=n)}function ke(t){re.equals(t)===!1&&(e.scissor(t.x,t.y,t.z,t.w),re.copy(t))}function W(t){L.equals(t)===!1&&(e.viewport(t.x,t.y,t.z,t.w),L.copy(t))}function Ae(t,n){let r=l.get(n);r===void 0&&(r=new WeakMap,l.set(n,r));let i=r.get(t);i===void 0&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))}function je(t,n){let r=l.get(n).get(t);c.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),c.set(n,r))}function Me(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),o.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),u={},d={},I=null,ee={},f={},p=new WeakMap,m=[],h=null,g=!1,_=null,v=null,y=null,b=null,x=null,S=null,C=null,w=new Po(0,0,0),T=0,E=!1,D=null,O=null,k=null,A=null,j=null,re.set(0,0,e.canvas.width,e.canvas.height),L.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}return{buffers:{color:a,depth:o,stencil:s},enable:ae,disable:oe,bindFramebuffer:se,drawBuffers:ce,useProgram:le,setBlending:fe,setMaterial:pe,setFlipSided:me,setCullFace:he,setLineWidth:ge,setPolygonOffset:_e,setScissorTest:ve,activeTexture:z,bindTexture:ye,unbindTexture:be,compressedTexImage2D:xe,compressedTexImage3D:B,texImage2D:H,texImage3D:De,pixelStorei:Oe,getParameter:U,updateUBOMapping:Ae,uniformBlockBinding:je,texStorage2D:Te,texStorage3D:Ee,texSubImage2D:Se,texSubImage3D:V,compressedTexSubImage2D:Ce,compressedTexSubImage3D:we,scissor:ke,viewport:W,reset:Me}}function rf(e,t,n,r,i,a,o){let s=t.has(`WEBGL_multisampled_render_to_texture`)?t.get(`WEBGL_multisampled_render_to_texture`):null,c=typeof navigator>`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new J,u=new WeakMap,d=new Set,f,p=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function h(e,t){return m?new OffscreenCanvas(e,t):an(`canvas`)}function g(e,t,n){let r=1,i=xe(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);f===void 0&&(f=h(n,a));let o=t?h(n,a):f;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),K(`WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}return`data`in e&&K(`WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e}return e}function _(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,r,i,a,o,s=!1){if(n!==null){if(e[n]!==void 0)return e[n];K(`WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let c;a&&(c=t.get(`EXT_texture_norm16`),c||K(`WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension`));let l=r;if(r===e.RED&&(i===e.FLOAT&&(l=e.R32F),i===e.HALF_FLOAT&&(l=e.R16F),i===e.UNSIGNED_BYTE&&(l=e.R8),i===e.UNSIGNED_SHORT&&c&&(l=c.R16_EXT),i===e.SHORT&&c&&(l=c.R16_SNORM_EXT)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.R8UI),i===e.UNSIGNED_SHORT&&(l=e.R16UI),i===e.UNSIGNED_INT&&(l=e.R32UI),i===e.BYTE&&(l=e.R8I),i===e.SHORT&&(l=e.R16I),i===e.INT&&(l=e.R32I)),r===e.RG&&(i===e.FLOAT&&(l=e.RG32F),i===e.HALF_FLOAT&&(l=e.RG16F),i===e.UNSIGNED_BYTE&&(l=e.RG8),i===e.UNSIGNED_SHORT&&c&&(l=c.RG16_EXT),i===e.SHORT&&c&&(l=c.RG16_SNORM_EXT)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RG8UI),i===e.UNSIGNED_SHORT&&(l=e.RG16UI),i===e.UNSIGNED_INT&&(l=e.RG32UI),i===e.BYTE&&(l=e.RG8I),i===e.SHORT&&(l=e.RG16I),i===e.INT&&(l=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGB8UI),i===e.UNSIGNED_SHORT&&(l=e.RGB16UI),i===e.UNSIGNED_INT&&(l=e.RGB32UI),i===e.BYTE&&(l=e.RGB8I),i===e.SHORT&&(l=e.RGB16I),i===e.INT&&(l=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(l=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(l=e.RGBA16UI),i===e.UNSIGNED_INT&&(l=e.RGBA32UI),i===e.BYTE&&(l=e.RGBA8I),i===e.SHORT&&(l=e.RGBA16I),i===e.INT&&(l=e.RGBA32I)),r===e.RGB&&(i===e.UNSIGNED_SHORT&&c&&(l=c.RGB16_EXT),i===e.SHORT&&c&&(l=c.RGB16_SNORM_EXT),i===e.UNSIGNED_INT_5_9_9_9_REV&&(l=e.RGB9_E5),i===e.UNSIGNED_INT_10F_11F_11F_REV&&(l=e.R11F_G11F_B10F)),r===e.RGBA){let t=s?ya:Ba.getTransfer(o);i===e.FLOAT&&(l=e.RGBA32F),i===e.HALF_FLOAT&&(l=e.RGBA16F),i===e.UNSIGNED_BYTE&&(l=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT&&c&&(l=c.RGBA16_EXT),i===e.SHORT&&c&&(l=c.RGBA16_SNORM_EXT),i===e.UNSIGNED_SHORT_4_4_4_4&&(l=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(l=e.RGB5_A1)}return(l===e.R16F||l===e.R32F||l===e.RG16F||l===e.RG32F||l===e.RGBA16F||l===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),l}function x(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,K(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function S(e,t){return _(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),T(t),t.isVideoTexture&&u.delete(t),t.isHTMLTexture&&d.delete(t)}function w(e){let t=e.target;t.removeEventListener(`dispose`,w),D(t)}function T(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=p.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&E(e),Object.keys(i).length===0&&p.delete(n)}r.remove(e)}function E(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=p.get(i);delete a[n.__cacheKey],o.memory.textures--}function D(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let i=t.textures;for(let t=0,n=i.length;t<n;t++){let n=r.get(i[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),r.remove(i[t])}r.remove(t)}let O=0;function k(){O=0}function A(){return O}function j(e){O=e}function M(){let e=O;return e>=i.maxTextures&&K(`WebGLTextures: Trying to use `+(e+1)+` texture units while this GPU supports only `+i.maxTextures),O+=1,e}function N(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function P(t,i){let a=r.get(t);if(t.isVideoTexture&&ye(t),t.isRenderTargetTexture===!1&&t.isExternalTexture!==!0&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)K(`WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)K(`WebGLRenderer: Texture marked for update but image is incomplete`);else{oe(a,t,i);return}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function F(t,i){let a=r.get(t);t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version?oe(a,t,i):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i))}function I(t,i){let a=r.get(t);t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version?oe(a,t,i):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function ee(t,i){let a=r.get(t);t.isCubeDepthTexture!==!0&&t.version>0&&a.__version!==t.version?se(a,t,i):n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let te={[Yr]:e.REPEAT,[Xr]:e.CLAMP_TO_EDGE,[Zr]:e.MIRRORED_REPEAT},ne={[Qr]:e.NEAREST,[$r]:e.NEAREST_MIPMAP_NEAREST,[ei]:e.NEAREST_MIPMAP_LINEAR,[ti]:e.LINEAR,[ni]:e.LINEAR_MIPMAP_NEAREST,[ri]:e.LINEAR_MIPMAP_LINEAR},re={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function L(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&K(`WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,te[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,te[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,te[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,ne[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,ne[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,re[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function R(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,C));let i=n.source,a=p.get(i);a===void 0&&(a={},p.set(i,a));let s=N(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&E(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function ie(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ae(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e<o.length;e++){let t=o[s],n=o[e],i=t.start+t.count,a=ie(n.start,r.width,4),c=ie(t.start,r.width,4);n.start<=i+1&&a===c&&ie(n.start+n.count-1,r.width,4)===a?t.count=Math.max(t.count,n.start+n.count-t.start):(++s,o[s]=n)}o.length=s+1;let c=n.getParameter(e.UNPACK_ROW_LENGTH),l=n.getParameter(e.UNPACK_SKIP_PIXELS),u=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,s=o.length;t<s;t++){let s=o[t],c=Math.floor(s.start/4),l=Math.ceil(s.count/4),u=c%r.width,d=Math.floor(c/r.width),f=l;n.pixelStorei(e.UNPACK_SKIP_PIXELS,u),n.pixelStorei(e.UNPACK_SKIP_ROWS,d),n.texSubImage2D(e.TEXTURE_2D,0,u,d,f,1,i,a,r.data)}t.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,c),n.pixelStorei(e.UNPACK_SKIP_PIXELS,l),n.pixelStorei(e.UNPACK_SKIP_ROWS,u)}}function oe(t,o,s){let c=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(c=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(c=e.TEXTURE_3D);let l=R(t,o),u=o.source;n.bindTexture(c,t.__webglTexture,e.TEXTURE0+s);let f=r.get(u);if(u.version!==f.__version||l===!0){if(n.activeTexture(e.TEXTURE0+s),!(typeof ImageBitmap<`u`&&o.image instanceof ImageBitmap)){let t=Ba.getPrimaries(Ba.workingColorSpace),r=o.colorSpace===``?null:Ba.getPrimaries(o.colorSpace),i=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,i)}n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment);let t=g(o.image,!1,i.maxTextureSize);t=be(o,t);let r=a.convert(o.format,o.colorSpace),p=a.convert(o.type),m=b(o.internalFormat,r,p,o.normalized,o.colorSpace,o.isVideoTexture);L(c,o);let h,y=o.mipmaps,C=o.isVideoTexture!==!0,w=f.__version===void 0||l===!0,T=u.dataReady,E=S(o,t);if(o.isDepthTexture)m=x(o.format===xi,o.type),w&&(C?n.texStorage2D(e.TEXTURE_2D,1,m,t.width,t.height):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,r,p,null));else if(o.isDataTexture){if(y.length>0){C&&w&&n.texStorage2D(e.TEXTURE_2D,E,m,y[0].width,y[0].height);for(let t=0,i=y.length;t<i;t++)h=y[t],C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,p,h.data):n.texImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,r,p,h.data);o.generateMipmaps=!1}else C?(w&&n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height),T&&ae(o,t,r,p)):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,r,p,t.data)}else if(o.isCompressedTexture){if(o.isCompressedArrayTexture){C&&w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,y[0].width,y[0].height,t.depth);for(let i=0,a=y.length;i<a;i++)if(h=y[i],o.format!==1023){if(r!==null){if(C){if(T){if(o.layerUpdates.size>0){let t=qr(h.width,h.height,o.format,o.type);for(let a of o.layerUpdates){let o=h.data.subarray(a*t/h.data.BYTES_PER_ELEMENT,(a+1)*t/h.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,a,h.width,h.height,1,r,o)}}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,h.data)}}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,h.data,0,0)}else K(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`)}else C?T&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,h.width,h.height,t.depth,r,p,h.data):n.texImage3D(e.TEXTURE_2D_ARRAY,i,m,h.width,h.height,t.depth,0,r,p,h.data);o.layerUpdates.size>0&&o.clearLayerUpdates()}else{C&&w&&n.texStorage2D(e.TEXTURE_2D,E,m,y[0].width,y[0].height);for(let t=0,i=y.length;t<i;t++)h=y[t],o.format===1023?C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,p,h.data):n.texImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,r,p,h.data):r===null?K(`WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`):C?T&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,h.width,h.height,r,h.data):n.compressedTexImage2D(e.TEXTURE_2D,t,m,h.width,h.height,0,h.data)}}else if(o.isDataArrayTexture){if(C){if(w&&n.texStorage3D(e.TEXTURE_2D_ARRAY,E,m,t.width,t.height,t.depth),T){if(o.layerUpdates.size>0){let i=qr(t.width,t.height,o.format,o.type);for(let a of o.layerUpdates){let o=t.data.subarray(a*i/t.data.BYTES_PER_ELEMENT,(a+1)*i/t.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,a,t.width,t.height,1,r,p,o)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)}}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,m,t.width,t.height,t.depth,0,r,p,t.data)}else if(o.isData3DTexture)C?(w&&n.texStorage3D(e.TEXTURE_3D,E,m,t.width,t.height,t.depth),T&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,r,p,t.data)):n.texImage3D(e.TEXTURE_3D,0,m,t.width,t.height,t.depth,0,r,p,t.data);else if(o.isFramebufferTexture){if(w){if(C)n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height);else{let i=t.width,a=t.height;for(let t=0;t<E;t++)n.texImage2D(e.TEXTURE_2D,t,m,i,a,0,r,p,null),i>>=1,a>>=1}}}else if(o.isHTMLTexture){if(`texElementImage2D`in e){let n=e.canvas;if(n.hasAttribute(`layoutsubtree`)||n.setAttribute(`layoutsubtree`,`true`),t.parentNode!==n){n.appendChild(t),d.add(o),n.onpaint=e=>{let t=e.changedElements;for(let e of d)t.includes(e.image)&&(e.needsUpdate=!0)},n.requestPaint();return}if(e.texElementImage2D.length===3)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,t);else{let n=e.RGBA,r=e.RGBA,i=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,n,r,i,t)}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)}}else if(y.length>0){if(C&&w){let t=xe(y[0]);n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height)}for(let t=0,i=y.length;t<i;t++)h=y[t],C?T&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,r,p,h):n.texImage2D(e.TEXTURE_2D,t,m,r,p,h);o.generateMipmaps=!1}else if(C){if(w){let r=xe(t);n.texStorage2D(e.TEXTURE_2D,E,m,r.width,r.height)}T&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,r,p,t)}else n.texImage2D(e.TEXTURE_2D,0,m,r,p,t);_(o)&&v(c),f.__version=u.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function se(t,o,s){if(o.image.length!==6)return;let c=R(t,o),l=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+s);let u=r.get(l);if(l.version!==u.__version||c===!0){n.activeTexture(e.TEXTURE0+s);let t=Ba.getPrimaries(Ba.workingColorSpace),r=o.colorSpace===``?null:Ba.getPrimaries(o.colorSpace),d=o.colorSpace===``||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let f=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,m=[];for(let e=0;e<6;e++)!f&&!p?m[e]=g(o.image[e],!0,i.maxCubemapSize):m[e]=p?o.image[e].image:o.image[e],m[e]=be(o,m[e]);let h=m[0],y=a.convert(o.format,o.colorSpace),x=a.convert(o.type),C=b(o.internalFormat,y,x,o.normalized,o.colorSpace),w=o.isVideoTexture!==!0,T=u.__version===void 0||c===!0,E=l.dataReady,D=S(o,h);L(e.TEXTURE_CUBE_MAP,o);let O;if(f){w&&T&&n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,h.width,h.height);for(let t=0;t<6;t++){O=m[t].mipmaps;for(let r=0;r<O.length;r++){let i=O[r];o.format===1023?w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,y,x,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,y,x,i.data):y===null?K(`WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()`):w?E&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,0,0,i.width,i.height,y,i.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r,C,i.width,i.height,0,i.data)}}}else{if(O=o.mipmaps,w&&T){O.length>0&&D++;let t=xe(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,y,x,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,y,x,m[t].data);for(let r=0;r<O.length;r++){let i=O[r].image[t].image;w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,i.width,i.height,y,x,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,i.width,i.height,0,y,x,i.data)}}else{w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,y,x,m[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,y,x,m[t]);for(let r=0;r<O.length;r++){let i=O[r];w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,0,0,y,x,i.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,r+1,C,y,x,i.image[t])}}}_(o)&&v(e.TEXTURE_CUBE_MAP),u.__version=l.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function ce(t,i,o,c,l,u){let d=a.convert(o.format,o.colorSpace),f=a.convert(o.type),p=b(o.internalFormat,d,f,o.normalized,o.colorSpace),m=r.get(i),h=r.get(o);if(h.__renderTarget=i,!m.__hasExternalTextures){let t=Math.max(1,i.width>>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,ve(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function le(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=x(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ve(n),o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,ve(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i<t.length;i++){let o=t[i],c=a.convert(o.format,o.colorSpace),l=a.convert(o.type),u=b(o.internalFormat,c,l,o.normalized,o.colorSpace);z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ve(n),u,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,ve(n),u,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,u,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function ue(t,i,o){let c=i.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(i.depthTexture&&i.depthTexture.isDepthTexture))throw Error(`THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.`);let l=r.get(i.depthTexture);if(l.__renderTarget=i,l.__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),c){if(l.__webglInit===void 0&&(l.__webglInit=!0,i.depthTexture.addEventListener(`dispose`,C)),l.__webglTexture===void 0){l.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),L(e.TEXTURE_CUBE_MAP,i.depthTexture);let t=a.convert(i.depthTexture.format),r=a.convert(i.depthTexture.type),o;i.depthTexture.format===1026?o=e.DEPTH_COMPONENT24:i.depthTexture.format===1027&&(o=e.DEPTH24_STENCIL8);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o,i.width,i.height,0,t,r,null)}}else P(i.depthTexture,0);let u=l.__webglTexture,d=ve(i),f=c?e.TEXTURE_CUBE_MAP_POSITIVE_X+o:e.TEXTURE_2D,p=i.depthTexture.format===1027?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(i.depthTexture.format===1026)z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,u,0);else if(i.depthTexture.format===1027)z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,u,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,u,0);else throw Error(`THREE.WebGLTextures: Unknown depthTexture format.`)}function de(t){let i=r.get(t),a=t.isWebGLCubeRenderTarget===!0;if(i.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(i.__depthDisposeCallback&&i.__depthDisposeCallback(),e){let t=()=>{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)for(let e=0;e<6;e++)ue(i.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?ue(i.__webglFramebuffer[0],t,0):ue(i.__webglFramebuffer,t,0)}}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),le(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),le(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function fe(t,n,i){let a=r.get(t);n!==void 0&&ce(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&de(t)}function pe(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,w);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n<i.mipmaps.length;n++)s.__webglFramebuffer[t][n]=e.createFramebuffer()}else s.__webglFramebuffer[t]=e.createFramebuffer()}else{if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer=[];for(let t=0;t<i.mipmaps.length;t++)s.__webglFramebuffer[t]=e.createFramebuffer()}else s.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=l.length;t<n;t++){let n=r.get(l[t]);n.__webglTexture===void 0&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&z(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n<l.length;n++){let r=l[n];s.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s.__webglColorRenderbuffer[n]);let i=a.convert(r.format,r.colorSpace),o=a.convert(r.type),c=b(r.internalFormat,i,o,r.normalized,r.colorSpace,t.isXRRenderTarget===!0),u=ve(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,u,c,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,s.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),le(s.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(u){n.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),L(e.TEXTURE_CUBE_MAP,i);for(let n=0;n<6;n++)if(i.mipmaps&&i.mipmaps.length>0)for(let r=0;r<i.mipmaps.length;r++)ce(s.__webglFramebuffer[n][r],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else ce(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);_(i)&&v(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let i=0,a=l.length;i<a;i++){let a=l[i],o=r.get(a),c=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(c=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(c,o.__webglTexture),L(c,a),ce(s.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+i,c,0),_(a)&&v(c)}n.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(r,c.__webglTexture),L(r,i),i.mipmaps&&i.mipmaps.length>0)for(let n=0;n<i.mipmaps.length;n++)ce(s.__webglFramebuffer[n],t,i,e.COLOR_ATTACHMENT0,r,n);else ce(s.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0,r,0);_(i)&&v(r),n.unbindTexture()}t.depthBuffer&&de(t)}function me(e){let t=e.textures;for(let i=0,a=t.length;i<a;i++){let a=t[i];if(_(a)){let t=y(e),i=r.get(a).__webglTexture;n.bindTexture(t,i),v(t),n.unbindTexture()}}}let he=[],ge=[];function _e(t){if(t.samples>0){if(z(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t<i.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);let f=t.texture.mipmaps;f&&f.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n<i.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRenderbuffer[n]);let t=r.get(i[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),c===!0&&(he.length=0,ge.length=0,he.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&t.storeMultisampledDepthBuffer===!1&&(he.push(l),ge.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,ge)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,he))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<i.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);let a=r.get(i[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&t.storeMultisampledDepthBuffer===!1&&c){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}}function ve(e){return Math.min(i.maxSamples,e.samples)}function z(e){let n=r.get(e);return e.samples>0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function ye(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function be(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(Ba.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&K(`WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):q(`WebGLTextures: Unsupported texture color space:`,n)),t}function xe(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=M,this.resetTextureUnits=k,this.getTextureUnits=A,this.setTextureUnits=j,this.setTexture2D=P,this.setTexture2DArray=F,this.setTexture3D=I,this.setTextureCube=ee,this.rebindTextures=fe,this.setupRenderTarget=pe,this.updateRenderTargetMipmap=me,this.updateMultisampleRenderTarget=_e,this.setupDepthRenderbuffer=de,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=z,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function af(e,t){function n(n,r=``){let i,a=Ba.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===35899)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779){if(a===`srgb`){if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null}else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null}if(n===35840||n===35841||n===35842||n===35843){if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null}if(n===36196||n===37492||n===37496||n===37488||n===37489||n===37490||n===37491){if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===37488)return i.COMPRESSED_R11_EAC;if(n===37489)return i.COMPRESSED_SIGNED_R11_EAC;if(n===37490)return i.COMPRESSED_RG11_EAC;if(n===37491)return i.COMPRESSED_SIGNED_RG11_EAC}else return null}if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821){if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null}if(n===36492||n===36494||n===36495){if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null}if(n===36283||n===36284||n===36285||n===36286){if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36283)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null}return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}function of(e,t){function n(e,t){e.matrixAutoUpdate===!0&&e.updateMatrix(),t.value.copy(e.matrix)}function r(t,n){n.color.getRGB(t.fogColor.value,zr(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)}function i(e,t,n,r,i){t.isNodeMaterial?t.uniformsNeedUpdate=!1:t.isMeshBasicMaterial?a(e,t):t.isMeshLambertMaterial?(a(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshToonMaterial?(a(e,t),d(e,t)):t.isMeshPhongMaterial?(a(e,t),u(e,t),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)):t.isMeshStandardMaterial?(a(e,t),f(e,t),t.isMeshPhysicalMaterial&&p(e,t,i)):t.isMeshMatcapMaterial?(a(e,t),m(e,t)):t.isMeshDepthMaterial?a(e,t):t.isMeshDistanceMaterial?(a(e,t),h(e,t)):t.isMeshNormalMaterial?a(e,t):t.isLineBasicMaterial?(o(e,t),t.isLineDashedMaterial&&s(e,t)):t.isPointsMaterial?c(e,t,n,r):t.isSpriteMaterial?l(e,t):t.isShadowMaterial?(e.color.value.copy(t.color),e.opacity.value=t.opacity):t.isShaderMaterial&&(t.uniformsNeedUpdate=!1)}function a(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===1&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===1&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(_p.makeRotationFromEuler(o)).transpose(),a.isCubeTexture&&a.isRenderTargetTexture===!1&&e.envMapRotation.value.premultiply(vp),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.retroreflectivity>0&&(e.retroreflectivity.value=t.retroreflectivity),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function sf(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(g(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,v));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e<s;e++)if(o.indexOf(e)===-1)return o.push(e),e;return q(`WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.`),0}function f(t){let n=i[t.id],r=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=r.length;e<t;e++){let t=r[e];if(Array.isArray(t))for(let n=0,r=t.length;n<r;n++)p(t[n],e,n,a);else p(t,e,0,a)}e.bindBuffer(e.UNIFORM_BUFFER,null)}function p(t,n,r,i){if(h(t,n,r,i)===!0){let n=t.__offset,r=t.value;if(Array.isArray(r)){let e=0;for(let n=0;n<r.length;n++){let i=r[n],a=_(i);m(i,t.__data,e),typeof i!=`number`&&typeof i!=`boolean`&&!i.isMatrix3&&!ArrayBuffer.isView(i)&&(e+=a.storage/Float32Array.BYTES_PER_ELEMENT)}}else m(r,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function m(e,t,n){typeof e==`number`||typeof e==`boolean`?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function h(e,t,n,r){let i=e.value,a=t+`_`+n;if(r[a]===void 0)return r[a]=typeof i==`number`||typeof i==`boolean`?i:ArrayBuffer.isView(i)?i.slice():i.clone(),!0;{let e=r[a];if(typeof i==`number`||typeof i==`boolean`){if(e!==i)return r[a]=i,!0}else if(ArrayBuffer.isView(i))return!0;else if(e.equals(i)===!1)return e.copy(i),!0}return!1}function g(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=i[e],a=_(r),o=n%16,s=o%a.boundary,c=o+s;n+=s,c!==0&&16-c<a.storage&&(n+=16-c),t.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=a.storage}}}let r=n%16;return r>0&&(n+=16-r),e.__size=n,e.__cache={},this}function _(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?K(`WebGLRenderer: Texture samplers can not be part of an uniforms group.`):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):K(`WebGLRenderer: Unsupported uniform value type.`,e),t}function v(t){let n=t.target;n.removeEventListener(`dispose`,v);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function y(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:y}}function cf(){return bp===null&&(bp=new ec(yp,16,16,wi,di),bp.name=`DFG_LUT`,bp.minFilter=ti,bp.magFilter=ti,bp.wrapS=Xr,bp.wrapT=Xr,bp.generateMipmaps=!1,bp.needsUpdate=!0),bp}var lf,Z,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf,Zf,Qf,$f,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up,dp,fp,pp,mp,hp,gp,_p,vp,yp,bp,xp,Sp=n((()=>{nu(),lf={alphahash_fragment:`#ifdef USE_ALPHAHASH
|
|
317
317
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
318
318
|
#endif`,alphahash_pars_fragment:`#ifdef USE_ALPHAHASH
|
|
319
319
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -4131,7 +4131,7 @@ void main() {
|
|
|
4131
4131
|
#include <tonemapping_fragment>
|
|
4132
4132
|
#include <colorspace_fragment>
|
|
4133
4133
|
#include <fog_fragment>
|
|
4134
|
-
}`},Z={common:{diffuse:{value:new No(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new X},alphaMap:{value:null},alphaMapTransform:{value:new X},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new X}},envmap:{envMap:{value:null},envMapRotation:{value:new X},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new X}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new X}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new X},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new X},normalScale:{value:new J(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new X},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new X}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new X}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new X}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new No(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new Y},probesMax:{value:new Y},probesResolution:{value:new Y}},points:{diffuse:{value:new No(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new X},alphaTest:{value:0},uvTransform:{value:new X}},sprite:{diffuse:{value:new No(16777215)},opacity:{value:1},center:{value:new J(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new X},alphaMap:{value:null},alphaMapTransform:{value:new X},alphaTest:{value:0}}},lf={basic:{uniforms:Fr([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:cf.meshbasic_vert,fragmentShader:cf.meshbasic_frag},lambert:{uniforms:Fr([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new No(0)},envMapIntensity:{value:1}}]),vertexShader:cf.meshlambert_vert,fragmentShader:cf.meshlambert_frag},phong:{uniforms:Fr([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new No(0)},specular:{value:new No(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:cf.meshphong_vert,fragmentShader:cf.meshphong_frag},standard:{uniforms:Fr([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new No(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:cf.meshphysical_vert,fragmentShader:cf.meshphysical_frag},toon:{uniforms:Fr([Z.common,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new No(0)}}]),vertexShader:cf.meshtoon_vert,fragmentShader:cf.meshtoon_frag},matcap:{uniforms:Fr([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:cf.meshmatcap_vert,fragmentShader:cf.meshmatcap_frag},points:{uniforms:Fr([Z.points,Z.fog]),vertexShader:cf.points_vert,fragmentShader:cf.points_frag},dashed:{uniforms:Fr([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:cf.linedashed_vert,fragmentShader:cf.linedashed_frag},depth:{uniforms:Fr([Z.common,Z.displacementmap]),vertexShader:cf.depth_vert,fragmentShader:cf.depth_frag},normal:{uniforms:Fr([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:cf.meshnormal_vert,fragmentShader:cf.meshnormal_frag},sprite:{uniforms:Fr([Z.sprite,Z.fog]),vertexShader:cf.sprite_vert,fragmentShader:cf.sprite_frag},background:{uniforms:{uvTransform:{value:new X},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:cf.background_vert,fragmentShader:cf.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new X}},vertexShader:cf.backgroundCube_vert,fragmentShader:cf.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:cf.cube_vert,fragmentShader:cf.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:cf.equirect_vert,fragmentShader:cf.equirect_frag},distance:{uniforms:Fr([Z.common,Z.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:cf.distance_vert,fragmentShader:cf.distance_frag},shadow:{uniforms:Fr([Z.lights,Z.fog,{color:{value:new No(0)},opacity:{value:1}}]),vertexShader:cf.shadow_vert,fragmentShader:cf.shadow_frag}},lf.physical={uniforms:Fr([lf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new X},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new X},clearcoatNormalScale:{value:new J(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new X},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new X},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new X},sheen:{value:0},sheenColor:{value:new No(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new X},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new X},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new X},transmissionSamplerSize:{value:new J},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new X},attenuationDistance:{value:0},attenuationColor:{value:new No(0)},specularColor:{value:new No(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new X},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new X},anisotropyVector:{value:new J},anisotropyMap:{value:null},anisotropyMapTransform:{value:new X}}]),vertexShader:cf.meshphysical_vert,fragmentShader:cf.meshphysical_frag},uf={r:0,b:0,g:0},df=new Qa,ff=new X,ff.set(-1,0,0,0,1,0,0,0,1),pf=4,mf=6,hf=20,gf=256,_f=new Nl,vf=new No,yf=null,bf=0,xf=0,Sf=!1,Cf=new Y,wf=new Y,Tf=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=Cf}=i;yf=this._renderer.getRenderTarget(),bf=this._renderer.getActiveCubeFace(),xf=this._renderer.getActiveMipmapLevel(),Sf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=hu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=mu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(yf,bf,xf),this._renderer.xr.enabled=Sf,e.scissorTest=!1,du(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),yf=this._renderer.getRenderTarget(),bf=this._renderer.getActiveCubeFace(),xf=this._renderer.getActiveMipmapLevel(),Sf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:ei,minFilter:ei,generateMipmaps:!1,type:ui,format:vi,colorSpace:_a,depthBuffer:!1},r=uu(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=uu(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=lu(r)),this._blurMaterial=pu(r,e,t),this._ggxMaterial=fu(r,e,t)}return r}_compileMaterial(e){let t=new Qs(new Os,e);this._renderer.compile(t,_f)}_sceneToCubeUV(e,t,n,r,i){let a=new Al(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],c=this._renderer,l=c.autoClear,u=c.toneMapping;c.getClearColor(vf),c.toneMapping=0,c.autoClear=!1,c.state.buffers.depth.getReversed()&&(c.setRenderTarget(r),c.clearDepth(),c.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Qs(new uc,new Bs({name:`PMREM.Background`,side:1,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(vf),p=!0);for(let t=0;t<6;t++){let n=t%3;n===0?(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+s[t],i.y,i.z)):n===1?(a.up.set(0,0,o[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+s[t],i.z)):(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+s[t]));let l=this._cubeSize;du(r,n*l,t>2?l:0,l,l),c.setRenderTarget(r),p&&c.render(d,a),c.render(e,a)}c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=hu()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=mu());let i=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=i;let o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;du(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,_f)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,i=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let s=a.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l)*(c*1.25),{_lodMax:d}=this,f=this._sizeLods[n],p=3*f*(n>d-pf?n-d+pf:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,du(i,p,m,3*f,2*f),r.setRenderTarget(i),r.render(o,_f),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,du(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,_f)}_blur(e,t,n,r){let i=this._pingPongRenderTarget,a=Math.min(r,Math.PI)/Math.SQRT2;this._blurPass(e,i,t,n,a),this._blurPass(i,e,n,n,a)}_blurPass(e,t,n,r,i){let a=this._renderer,o=this._blurMaterial,s=this._lodMeshes[r];s.material=o;let c=o.uniforms;c.envMap.value=e.texture,c.sigma.value=i,c.mipInt.value=this._lodMax-n;let l=this._sizeLods[r];du(t,3*l*(r>this._lodMax-pf?r-this._lodMax+pf:0),4*(this._cubeSize-l),3*l,2*l),a.setRenderTarget(t),a.render(s,_f)}},Ef=class extends Ya{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new ac(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
4134
|
+
}`},Z={common:{diffuse:{value:new Po(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new X},alphaMap:{value:null},alphaMapTransform:{value:new X},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new X}},envmap:{envMap:{value:null},envMapRotation:{value:new X},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new X}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new X}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new X},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new X},normalScale:{value:new J(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new X},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new X}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new X}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new X}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Po(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new Y},probesMax:{value:new Y},probesResolution:{value:new Y}},points:{diffuse:{value:new Po(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new X},alphaTest:{value:0},uvTransform:{value:new X}},sprite:{diffuse:{value:new Po(16777215)},opacity:{value:1},center:{value:new J(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new X},alphaMap:{value:null},alphaMapTransform:{value:new X},alphaTest:{value:0}}},uf={basic:{uniforms:Ir([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:lf.meshbasic_vert,fragmentShader:lf.meshbasic_frag},lambert:{uniforms:Ir([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new Po(0)},envMapIntensity:{value:1}}]),vertexShader:lf.meshlambert_vert,fragmentShader:lf.meshlambert_frag},phong:{uniforms:Ir([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new Po(0)},specular:{value:new Po(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:lf.meshphong_vert,fragmentShader:lf.meshphong_frag},standard:{uniforms:Ir([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new Po(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lf.meshphysical_vert,fragmentShader:lf.meshphysical_frag},toon:{uniforms:Ir([Z.common,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new Po(0)}}]),vertexShader:lf.meshtoon_vert,fragmentShader:lf.meshtoon_frag},matcap:{uniforms:Ir([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:lf.meshmatcap_vert,fragmentShader:lf.meshmatcap_frag},points:{uniforms:Ir([Z.points,Z.fog]),vertexShader:lf.points_vert,fragmentShader:lf.points_frag},dashed:{uniforms:Ir([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lf.linedashed_vert,fragmentShader:lf.linedashed_frag},depth:{uniforms:Ir([Z.common,Z.displacementmap]),vertexShader:lf.depth_vert,fragmentShader:lf.depth_frag},normal:{uniforms:Ir([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:lf.meshnormal_vert,fragmentShader:lf.meshnormal_frag},sprite:{uniforms:Ir([Z.sprite,Z.fog]),vertexShader:lf.sprite_vert,fragmentShader:lf.sprite_frag},background:{uniforms:{uvTransform:{value:new X},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lf.background_vert,fragmentShader:lf.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new X}},vertexShader:lf.backgroundCube_vert,fragmentShader:lf.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lf.cube_vert,fragmentShader:lf.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lf.equirect_vert,fragmentShader:lf.equirect_frag},distance:{uniforms:Ir([Z.common,Z.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lf.distance_vert,fragmentShader:lf.distance_frag},shadow:{uniforms:Ir([Z.lights,Z.fog,{color:{value:new Po(0)},opacity:{value:1}}]),vertexShader:lf.shadow_vert,fragmentShader:lf.shadow_frag}},uf.physical={uniforms:Ir([uf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new X},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new X},clearcoatNormalScale:{value:new J(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new X},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new X},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new X},sheen:{value:0},sheenColor:{value:new Po(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new X},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new X},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new X},transmissionSamplerSize:{value:new J},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new X},attenuationDistance:{value:0},attenuationColor:{value:new Po(0)},specularColor:{value:new Po(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new X},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new X},anisotropyVector:{value:new J},anisotropyMap:{value:null},anisotropyMapTransform:{value:new X}}]),vertexShader:lf.meshphysical_vert,fragmentShader:lf.meshphysical_frag},df={r:0,b:0,g:0},ff=new $a,pf=new X,pf.set(-1,0,0,0,1,0,0,0,1),mf=4,hf=6,gf=20,_f=256,vf=new Pl,yf=new Po,bf=null,xf=0,Sf=0,Cf=!1,wf=new Y,Tf=new Y,Ef=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=wf}=i;bf=this._renderer.getRenderTarget(),xf=this._renderer.getActiveCubeFace(),Sf=this._renderer.getActiveMipmapLevel(),Cf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=gu(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=hu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(bf,xf,Sf),this._renderer.xr.enabled=Cf,e.scissorTest=!1,fu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===301||e.mapping===302?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),bf=this._renderer.getRenderTarget(),xf=this._renderer.getActiveCubeFace(),Sf=this._renderer.getActiveMipmapLevel(),Cf=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:ti,minFilter:ti,generateMipmaps:!1,type:di,format:yi,colorSpace:va,depthBuffer:!1},r=du(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=du(e,t,n);let{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}=uu(r)),this._blurMaterial=mu(r,e,t),this._ggxMaterial=pu(r,e,t)}return r}_compileMaterial(e){let t=new $s(new ks,e);this._renderer.compile(t,vf)}_sceneToCubeUV(e,t,n,r,i){let a=new jl(90,1,t,n),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],c=this._renderer,l=c.autoClear,u=c.toneMapping;c.getClearColor(yf),c.toneMapping=0,c.autoClear=!1,c.state.buffers.depth.getReversed()&&(c.setRenderTarget(r),c.clearDepth(),c.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new $s(new dc,new Vs({name:`PMREM.Background`,side:1,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(yf),p=!0);for(let t=0;t<6;t++){let n=t%3;n===0?(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x+s[t],i.y,i.z)):n===1?(a.up.set(0,0,o[t]),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y+s[t],i.z)):(a.up.set(0,o[t],0),a.position.set(i.x,i.y,i.z),a.lookAt(i.x,i.y,i.z+s[t]));let l=this._cubeSize;fu(r,n*l,t>2?l:0,l,l),c.setRenderTarget(r),p&&c.render(d,a),c.render(e,a)}c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=gu()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=hu());let i=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=i;let o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;fu(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,vf)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,i=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let s=a.uniforms,c=n/(this._lodMeshes.length-1),l=t/(this._lodMeshes.length-1),u=Math.sqrt(c*c-l*l)*(c*1.25),{_lodMax:d}=this,f=this._sizeLods[n],p=3*f*(n>d-mf?n-d+mf:0),m=4*(this._cubeSize-f);s.envMap.value=e.texture,s.roughness.value=u,s.mipInt.value=d-t,fu(i,p,m,3*f,2*f),r.setRenderTarget(i),r.render(o,vf),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,fu(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,vf)}_blur(e,t,n,r){let i=this._pingPongRenderTarget,a=Math.min(r,Math.PI)/Math.SQRT2;this._blurPass(e,i,t,n,a),this._blurPass(i,e,n,n,a)}_blurPass(e,t,n,r,i){let a=this._renderer,o=this._blurMaterial,s=this._lodMeshes[r];s.material=o;let c=o.uniforms;c.envMap.value=e.texture,c.sigma.value=i,c.mipInt.value=this._lodMax-n;let l=this._sizeLods[r];fu(t,3*l*(r>this._lodMax-mf?r-this._lodMax+mf:0),4*(this._cubeSize-l),3*l,2*l),a.setRenderTarget(t),a.render(s,vf)}},Df=class extends Xa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new oc(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
4135
4135
|
|
|
4136
4136
|
varying vec3 vWorldDirection;
|
|
4137
4137
|
|
|
@@ -4166,9 +4166,9 @@ void main() {
|
|
|
4166
4166
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
4167
4167
|
|
|
4168
4168
|
}
|
|
4169
|
-
`},r=new
|
|
4169
|
+
`},r=new dc(5,5,5),i=new qc({name:`CubemapFromEquirect`,uniforms:Fr(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new $s(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=ti),new zl(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},Of={1:`LINEAR_TONE_MAPPING`,2:`REINHARD_TONE_MAPPING`,3:`CINEON_TONE_MAPPING`,4:`ACES_FILMIC_TONE_MAPPING`,6:`AGX_TONE_MAPPING`,7:`NEUTRAL_TONE_MAPPING`,5:`CUSTOM_TONE_MAPPING`},kf=new qa,Af=new cc(1,1),jf=new Za,Mf=new Qa,Nf=new oc,Pf=[],Ff=[],If=new Float32Array(16),Lf=new Float32Array(9),Rf=new Float32Array(4),zf=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Yu(t.type)}},Bf=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=hd(t.type)}},Vf=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let i=0,a=r.length;i!==a;++i){let a=r[i];a.setValue(e,t[a.id],n)}}},Hf=/(\w+)(\])?(\[|\.)?/g,Uf=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){let n=e.getActiveUniform(t,r);_d(n,e.getUniformLocation(t,n.name),this)}let r=[],i=[];for(let t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(t):i.push(t);r.length>0&&(this.seq=r.concat(i))}setValue(e,t,n,r){let i=this.map[t];i!==void 0&&i.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,a=t.length;i!==a;++i){let a=t[i],o=n[a.id];o.needsUpdate!==!1&&a.setValue(e,o.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,i=e.length;r!==i;++r){let i=e[r];i.id in t&&n.push(i)}return n}},Wf=37297,Gf=0,Kf=new X,qf={1:`Linear`,2:`Reinhard`,3:`Cineon`,4:`ACESFilmic`,6:`AgX`,7:`Neutral`,5:`Custom`},Jf=new Y,Yf=/^[ \t]*#include +<([\w\d./]+)>/gm,Xf=new Map,Zf=/#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,Qf={1:`SHADOWMAP_TYPE_PCF`,3:`SHADOWMAP_TYPE_VSM`},$f={301:`ENVMAP_TYPE_CUBE`,302:`ENVMAP_TYPE_CUBE`,306:`ENVMAP_TYPE_CUBE_UV`},ep={302:`ENVMAP_MODE_REFRACTION`},tp={0:`ENVMAP_BLENDING_MULTIPLY`,1:`ENVMAP_BLENDING_MIX`,2:`ENVMAP_BLENDING_ADD`},np=0,rp=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new ip(e),t.set(e,n)),n}},ip=class{constructor(e){this.id=np++,this.code=e,this.usedTimes=0}},ap=0,op=`void main() {
|
|
4170
4170
|
gl_Position = vec4( position, 1.0 );
|
|
4171
|
-
}`,
|
|
4171
|
+
}`,sp=`uniform sampler2D shadow_pass;
|
|
4172
4172
|
uniform vec2 resolution;
|
|
4173
4173
|
uniform float radius;
|
|
4174
4174
|
void main() {
|
|
@@ -4193,12 +4193,12 @@ void main() {
|
|
|
4193
4193
|
squared_mean = squared_mean / samples;
|
|
4194
4194
|
float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
|
|
4195
4195
|
gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
|
|
4196
|
-
}`,
|
|
4196
|
+
}`,cp=[new Y(1,0,0),new Y(-1,0,0),new Y(0,1,0),new Y(0,-1,0),new Y(0,0,1),new Y(0,0,-1)],lp=[new Y(0,-1,0),new Y(0,-1,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,-1,0),new Y(0,-1,0)],up=new $a,dp=new Y,fp=new Y,pp=`
|
|
4197
4197
|
void main() {
|
|
4198
4198
|
|
|
4199
4199
|
gl_Position = vec4( position, 1.0 );
|
|
4200
4200
|
|
|
4201
|
-
}`,
|
|
4201
|
+
}`,mp=`
|
|
4202
4202
|
uniform sampler2DArray depthColor;
|
|
4203
4203
|
uniform float depthWidth;
|
|
4204
4204
|
uniform float depthHeight;
|
|
@@ -4217,7 +4217,7 @@ void main() {
|
|
|
4217
4217
|
|
|
4218
4218
|
}
|
|
4219
4219
|
|
|
4220
|
-
}`,mp=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new lc(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new Kc({vertexShader:fp,fragmentShader:pp,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Qs(new Rc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},hp=class extends Da{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new mp,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new J,C=null,w=null,T=new Al;T.viewport=new qa;let E=new Al;E.viewport=new qa;let D=[T,E],O=new zl,k=null,A=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new ko,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new ko,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new ko,b[e]=t),t.getHandSpace()};function j(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function M(){r.removeEventListener(`select`,j),r.removeEventListener(`selectstart`,j),r.removeEventListener(`selectend`,j),r.removeEventListener(`squeeze`,j),r.removeEventListener(`squeezestart`,j),r.removeEventListener(`squeezeend`,j),r.removeEventListener(`end`,M),r.removeEventListener(`inputsourceschange`,N);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}k=null,A=null,h.reset();for(let e in g)delete g[e];if(e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,L.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),w!==null){let e=w.camera;e.fov=w.fov,e.zoom=w.zoom,e.updateProjectionMatrix(),w=null}n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,j),r.addEventListener(`selectstart`,j),r.addEventListener(`selectend`,j),r.addEventListener(`squeeze`,j),r.addEventListener(`squeezestart`,j),r.addEventListener(`squeezeend`,j),r.addEventListener(`end`,M),r.addEventListener(`inputsourceschange`,N),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?bi:yi,a=_.stencil?pi:ci);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new Ya(d.textureWidth,d.textureHeight,{format:vi,type:ri,depthTexture:new sc(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new Ya(f.framebufferWidth,f.framebufferHeight,{format:vi,type:ri,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1,storeMultisampledDepthBuffer:f.ignoreDepthValues===!1,storeMultisampledStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),L.setContext(r),L.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function N(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let P=new Y,F=new Y;function I(e,t,n){P.setFromMatrixPosition(t.matrixWorld),F.setFromMatrixPosition(n.matrixWorld);let r=P.distanceTo(F),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ee(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),O.near=E.near=T.near=t,O.far=E.far=T.far=n,(k!==O.near||A!==O.far)&&(r.updateRenderState({depthNear:O.near,depthFar:O.far}),k=O.near,A=O.far),O.layers.mask=e.layers.mask|6,T.layers.mask=O.layers.mask&-5,E.layers.mask=O.layers.mask&-3;let i=e.parent,a=O.cameras;ee(O,i);for(let e=0;e<a.length;e++)ee(a[e],i);a.length===2?I(O,T,E):O.projectionMatrix.copy(T.projectionMatrix),w===null&&e.isPerspectiveCamera&&(w={camera:e,fov:e.fov,zoom:e.zoom}),te(e,O,i)};function te(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=ja*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(d!==null||f!==null)return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(O)},this.getCameraTexture=function(e){return g[e]};let ne=null;function re(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==O.cameras.length&&(O.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=D[n];o===void 0&&(o=new Al,o.layers.enable(n),o.viewport=new qa,D[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(O.matrix.copy(o.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),i===!0&&O.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new lc,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}ne&&ne(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let L=new nu;L.setAnimationLoop(re),this.setAnimationLoop=function(e){ne=e},this.dispose=function(){}}},gp=new Qa,_p=new X,_p.set(-1,0,0,0,1,0,0,0,1),vp=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),yp=null,bp=class{constructor(e={}){let{canvas:t=an(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=ri}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([Ti,wi,Si]),g=new Set([ri,ci,oi,pi,di,fi]),_=new Uint32Array(4),v=new Int32Array(4),y=new Y,b=null,x=null,S=[],C=[],w=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let T=this,E=!1,D=null,O=null,k=null,A=null;this._outputColorSpace=ga;let j=0,M=0,N=null,P=-1,F=null,I=new qa,ee=new qa,te=null,ne=new No(0),re=0,L=t.width,R=t.height,ie=1,ae=null,oe=null,se=new qa(0,0,L,R),ce=new qa(0,0,L,R),le=!1,ue=new rc,de=!1,fe=!1,pe=new Qa,me=new Y,he=new qa,ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},_e=!1;function ve(){return N===null?ie:1}let z=n;function ye(e,n){return t.getContext(e,n)}let be,xe,B,Se,V,Ce,we,Te,Ee,H,De,U,Oe,ke,W,Ae,je,Me,Ne,Pe,Fe,Ie,Le;try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r186`),t.addEventListener(`webglcontextlost`,Be,!1),t.addEventListener(`webglcontextrestored`,Ve,!1),t.addEventListener(`webglcontextcreationerror`,He,!1),z===null){let t=`webgl2`;if(z=ye(t,e),z===null)throw ye(t)?Error(`THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.`):Error(`THREE.WebGLRenderer: Error creating WebGL context.`)}Re()}catch(e){throw t.removeEventListener(`webglcontextlost`,Be,!1),t.removeEventListener(`webglcontextrestored`,Ve,!1),t.removeEventListener(`webglcontextcreationerror`,He,!1),q(`WebGLRenderer: `+e.message),e}function Re(){be=new vu(z),be.init(),Fe=new rf(z,be),xe=new su(z,be,e,Fe),B=new tf(z,be),xe.reversedDepthBuffer&&d&&B.buffers.depth.setReversed(!0),O=z.createFramebuffer(),k=z.createFramebuffer(),A=z.createFramebuffer(),Se=new xu(z),V=new Ud,Ce=new nf(z,be,B,V,xe,Fe,Se),we=new _u(T),Te=new ru(z),Ie=new au(z,Te),Ee=new yu(z,Te,Se,Ie),H=new Cu(z,Ee,Te,Ie,Se),Me=new Su(z,xe,Ce),W=new cu(V),De=new Hd(T,we,be,xe,Ie,W),U=new af(T,V),Oe=new qd,ke=new $d(be),je=new iu(T,we,B,H,p,s),Ae=new ef(T,H,xe),Le=new of(z,Se,xe,B),Ne=new ou(z,be,Se),Pe=new bu(z,be,Se),Se.programs=De.programs,T.capabilities=xe,T.extensions=be,T.properties=V,T.renderLists=Oe,T.shadowMap=Ae,T.state=B,T.info=Se}m!==1009&&(w=new wu(m,t.width,t.height,o,r,i));let ze=new hp(T,z);this.xr=ze,this.getContext=function(){return z},this.getContextAttributes=function(){return z.getContextAttributes()},this.forceContextLoss=function(){let e=be.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=be.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return ie},this.setPixelRatio=function(e){e!==void 0&&(ie=e,this.setSize(L,R,!1))},this.getSize=function(e){return e.set(L,R)},this.setSize=function(e,n,r=!0){ze.isPresenting?K(`WebGLRenderer: Can't change size while VR device is presenting.`):(L=e,R=n,t.width=Math.floor(e*ie),t.height=Math.floor(n*ie),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(L*ie,R*ie).floor()},this.setDrawingBufferSize=function(e,n,r){L=e,R=n,ie=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009)q(`WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);else{if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){K(`WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}w.setEffects(e||[])}},this.getCurrentViewport=function(e){return e.copy(I)},this.getViewport=function(e){return e.copy(se)},this.setViewport=function(e,t,n,r){e.isVector4?se.set(e.x,e.y,e.z,e.w):se.set(e,t,n,r),B.viewport(I.copy(se).multiplyScalar(ie).round())},this.getScissor=function(e){return e.copy(ce)},this.setScissor=function(e,t,n,r){e.isVector4?ce.set(e.x,e.y,e.z,e.w):ce.set(e,t,n,r),B.scissor(ee.copy(ce).multiplyScalar(ie).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(e){B.setScissorTest(le=e)},this.setOpaqueSort=function(e){ae=e},this.setTransparentSort=function(e){oe=e},this.getClearColor=function(e){return e.copy(je.getClearColor())},this.setClearColor=function(){je.setClearColor(...arguments)},this.getClearAlpha=function(){return je.getClearAlpha()},this.setClearAlpha=function(){je.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(N!==null){let t=N.texture.format;e=h.has(t)}if(e){let e=N.texture.type,t=g.has(e),n=je.getClearColor(),r=je.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(_[0]=i,_[1]=a,_[2]=o,_[3]=r,z.clearBufferuiv(z.COLOR,0,_)):(v[0]=i,v[1]=a,v[2]=o,v[3]=r,z.clearBufferiv(z.COLOR,0,v))}else r|=z.COLOR_BUFFER_BIT}t&&(r|=z.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&z.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(e){e.setRenderer(this),D=e},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Be,!1),t.removeEventListener(`webglcontextrestored`,Ve,!1),t.removeEventListener(`webglcontextcreationerror`,He,!1),je.dispose(),Oe.dispose(),ke.dispose(),V.dispose(),we.dispose(),H.dispose(),Ie.dispose(),Le.dispose(),De.dispose(),ze.dispose(),ze.removeEventListener(`sessionstart`,Ye),ze.removeEventListener(`sessionend`,Xe),Ze.stop()};function Be(e){e.preventDefault(),on(`WebGLRenderer: Context Lost.`),E=!0}function Ve(){on(`WebGLRenderer: Context Restored.`),E=!1;let e=Se.autoReset,t=Ae.enabled,n=Ae.autoUpdate,r=Ae.needsUpdate,i=Ae.type;Re(),Se.autoReset=e,Ae.enabled=t,Ae.autoUpdate=n,Ae.needsUpdate=r,Ae.type=i}function He(e){q(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Ue(e){let t=e.target;t.removeEventListener(`dispose`,Ue),We(t)}function We(e){Ge(e),V.remove(e)}function Ge(e){let t=V.get(e).programs;t!==void 0&&(t.forEach(function(e){De.releaseProgram(e)}),e.isShaderMaterial&&De.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=ge);let o=i.isMesh&&i.matrixWorld.determinantAffine()<0,s=st(e,t,n,r,i);B.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Ee.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ie.setup(i,r,s,n,c);let h,g=Ne;if(c!==null&&(h=Te.get(c),g=Pe,g.setIndex(h)),i.isMesh)r.wireframe===!0?(B.setLineWidth(r.wireframeLinewidth*ve()),g.setMode(z.LINES)):g.setMode(z.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),B.setLineWidth(e*ve()),i.isLineSegments?g.setMode(z.LINES):i.isLineLoop?g.setMode(z.LINE_LOOP):g.setMode(z.LINE_STRIP)}else i.isPoints?g.setMode(z.POINTS):i.isSprite&&g.setMode(z.TRIANGLES);if(i.isBatchedMesh){if(be.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?Te.get(c).bytesPerElement:1,o=V.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(z,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function Ke(e,t,n,r){D!==null&&e.isNodeMaterial&&D.setObject(r,e),de===!0&&W.setState(e,n,!1),e.transparent===!0&&e.side===2&&e.forceSinglePass===!1?(e.side=1,e.needsUpdate=!0,rt(e,t,r),e.side=0,e.needsUpdate=!0,rt(e,t,r),e.side=2):rt(e,t,r)}this.compile=function(e,t,n=null){n===null&&(n=e),D!==null&&D.renderStart(e,t,n),x=ke.get(n),x.init(t),C.push(x),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))}),x.setupLights(),D!==null&&D.updateLights(x.state.lightsArray),fe=this.localClippingEnabled,de=W.init(this.clippingPlanes,fe),de===!0&&W.setGlobalState(this.clippingPlanes,t),D!==null&&Ae.render(x.state.shadowsArray,n,t);let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let i=e.material;if(i){if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];Ke(o,n,t,e),r.add(o)}else Ke(i,n,t,e),r.add(i)}}),x=C.pop(),D!==null&&D.renderEnd(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){r.forEach(function(e){let t=V.get(e).currentProgram;(t===void 0||t.isReady())&&r.delete(e)}),r.size===0?t(e):setTimeout(n,10)}be.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let qe=null;function Je(e){qe&&qe(e)}function Ye(){Ze.stop()}function Xe(){Ze.start()}let Ze=new nu;Ze.setAnimationLoop(Je),typeof self<`u`&&Ze.setContext(self),this.setAnimationLoop=function(e){qe=e,ze.setAnimationLoop(e),e===null?Ze.stop():Ze.start()},ze.addEventListener(`sessionstart`,Ye),ze.addEventListener(`sessionend`,Xe),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){q(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(E===!0)return;D!==null&&D.renderStart(e,t);let n=ze.enabled===!0&&ze.isPresenting===!0,r=w!==null&&(N===null||n)&&w.begin(T,N);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),ze.enabled===!0&&ze.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(ze.cameraAutoUpdate===!0&&ze.updateCamera(t),t=ze.getCamera()),e.isScene===!0&&e.onBeforeRender(T,e,t,N),x=ke.get(e,C.length),x.init(t),x.state.textureUnits=Ce.getTextureUnits(),C.push(x),pe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ue.setFromProjectionMatrix(pe,Ca,t.reversedDepth),fe=this.localClippingEnabled,de=W.init(this.clippingPlanes,fe),b=Oe.get(e,S.length),b.init(),S.push(b),ze.enabled===!0&&ze.isPresenting===!0){let e=T.xr.getDepthSensingMesh();e!==null&&Qe(e,t,-1/0,T.sortObjects)}Qe(e,t,0,T.sortObjects),b.finish(),D!==null&&D.updateLights(x.state.lightsArray),T.sortObjects===!0&&b.sort(ae,oe),_e=ze.enabled===!1||ze.isPresenting===!1||ze.hasDepthSensing()===!1,_e&&je.addToRenderList(b,e),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),de===!0&&W.beginShadows();let i=x.state.shadowsArray;if(Ae.render(i,e,t),de===!0&&W.endShadows(),(r&&w.hasRenderPass())===!1){let n=b.opaque,r=b.transmissive;if(x.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];et(n,r,e,a)}_e&&je.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];$e(b,e,n,n.viewport)}}else r.length>0&&et(n,r,e,t),_e&&je.render(e),$e(b,e,t)}N!==null&&M===0&&(Ce.updateMultisampleRenderTarget(N),Ce.updateRenderTargetMipmap(N)),r&&w.end(T),e.isScene===!0&&e.onAfterRender(T,e,t),Ie.resetDefaultState(),P=-1,F=null,C.pop(),C.length>0?(x=C[C.length-1],Ce.setTextureUnits(x.state.textureUnits),de===!0&&W.setGlobalState(T.clippingPlanes,x.state.camera)):x=null,S.pop(),b=S.length>0?S[S.length-1]:null,D!==null&&D.renderEnd()};function Qe(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)x.pushLightProbeGrid(e);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||e.intersectsFrustum(ue)){r&&he.setFromMatrixPosition(e.matrixWorld).applyMatrix4(pe);let i=H.update(e),a=e.material;a.visible&&b.push(e,i,a,n,he.z,null,t)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||e.intersectsFrustum(ue))){let i=H.update(e),a=e.material;if(r&&(e.boundingSphere===void 0?(i.boundingSphere===null&&i.computeBoundingSphere(),he.copy(i.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),he.copy(e.boundingSphere.center)),he.applyMatrix4(e.matrixWorld).applyMatrix4(pe)),Array.isArray(a)){let r=i.groups;for(let o=0,s=r.length;o<s;o++){let s=r[o],c=a[s.materialIndex];c&&c.visible&&b.push(e,i,c,n,he.z,s,t)}}else a.visible&&b.push(e,i,a,n,he.z,null,t)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)Qe(i[e],t,n,r)}function $e(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;x.setupLightsView(n),de===!0&&W.setGlobalState(T.clippingPlanes,n),r&&B.viewport(I.copy(r)),i.length>0&&tt(i,t,n),a.length>0&&tt(a,t,n),o.length>0&&tt(o,t,n),B.buffers.depth.setTest(!0),B.buffers.depth.setMask(!0),B.buffers.color.setMask(!0),B.setPolygonOffset(!1)}function et(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(x.state.transmissionRenderTarget[r.id]===void 0){let e=be.has(`EXT_color_buffer_half_float`)||be.has(`EXT_color_buffer_float`);x.state.transmissionRenderTarget[r.id]=new Ya(1,1,{generateMipmaps:!0,type:e?ui:ri,minFilter:ni,samples:Math.max(4,xe.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:za.workingColorSpace})}let a=x.state.transmissionRenderTarget[r.id],o=r.viewport||I;a.setSize(o.z*T.transmissionResolutionScale,o.w*T.transmissionResolutionScale);let s=T.getRenderTarget(),c=T.getActiveCubeFace(),l=T.getActiveMipmapLevel();T.setRenderTarget(a),T.getClearColor(ne),re=T.getClearAlpha(),re<1&&T.setClearColor(16777215,.5),T.clear(),_e&&je.render(n);let u=T.toneMapping;T.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),x.setupLightsView(r),de===!0&&W.setGlobalState(T.clippingPlanes,r),tt(e,n,r),Ce.updateMultisampleRenderTarget(a),Ce.updateRenderTargetMipmap(a),be.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===2&&a.layers.test(r.layers)){let t=s.side;s.side=1,s.needsUpdate=!0,nt(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(Ce.updateMultisampleRenderTarget(a),Ce.updateRenderTargetMipmap(a))}T.setRenderTarget(s,c,l),T.setClearColor(ne,re),d!==void 0&&(r.viewport=d),T.toneMapping=u}function tt(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&nt(o,t,n,s,l,c)}}function nt(e,t,n,r,i,a){D!==null&&i.isNodeMaterial&&D.setObject(e,i),e.onBeforeRender(T,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(T,t,n,r,e,a),i.transparent===!0&&i.side===2&&i.forceSinglePass===!1?(i.side=1,i.needsUpdate=!0,T.renderBufferDirect(n,t,r,i,e,a),i.side=0,i.needsUpdate=!0,T.renderBufferDirect(n,t,r,i,e,a),i.side=2):T.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(T,t,n,r,i,a)}function rt(e,t,n){t.isScene!==!0&&(t=ge);let r=V.get(e),i=x.state.lights,a=x.state.shadowsArray,o=i.state.version,s=De.getParameters(e,i.state,a,t,n,x.state.lightProbeGridArray),c=De.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=we.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,Ue),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return at(e,s),d}else s.uniforms=De.getUniforms(e),D!==null&&e.isNodeMaterial&&D.build(e,n,s),e.onBeforeCompile(s,T),d=De.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=W.uniform),at(e,s),r.needsLights=lt(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.sunLights.value=i.state.sun,f.sunLightShadows.value=i.state.sunShadow,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.sunShadowMatrix.value=i.state.sunShadowMatrix,f.sunShadowCascade.value=i.state.sunShadowCascade,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.lightProbeGrid=x.state.lightProbeGridArray.length>0,r.currentProgram=d,r.uniformsList=null,d}function it(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=Hf.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function at(e,t){let n=V.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function ot(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.texture!==null&&n.boundingBox.containsPoint(y))return n}return null}function st(e,t,n,r,i){t.isScene!==!0&&(t=ge),Ce.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=N===null?T.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:za.workingColorSpace,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=we.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(h=T.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=V.get(r),y=x.state.lights;if(de===!0&&(fe===!0||e!==F)){let t=e===F&&r.id===P;W.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i._colorsTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i._colorsTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==W.numPlanes||v.numIntersection!==W.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=x.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let S=v.currentProgram;b===!0&&(S=rt(r,t,i),D&&r.isNodeMaterial&&D.onUpdateProgram(r,S,v));let C=!1,w=!1,E=!1,O=S.getUniforms(),k=v.uniforms;if(B.useProgram(S.program)&&(C=!0,w=!0,E=!0),r.id!==P&&(P=r.id,w=!0),v.needsLights){let e=ot(x.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,w=!0)}if(C||F!==e){B.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(z,`projectionMatrix`,e.projectionMatrix),O.setValue(z,`viewMatrix`,e.matrixWorldInverse);let t=O.map.cameraPosition;t!==void 0&&t.setValue(z,me.setFromMatrixPosition(e.matrixWorld)),xe.logarithmicDepthBuffer&&O.setValue(z,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&O.setValue(z,`isOrthographic`,e.isOrthographicCamera===!0),F!==e&&(F=e,w=!0,E=!0)}if(v.needsLights&&(y.state.sunShadowMap.length>0&&O.setValue(z,`sunShadowMap`,y.state.sunShadowMap,Ce),y.state.directionalShadowMap.length>0&&O.setValue(z,`directionalShadowMap`,y.state.directionalShadowMap,Ce),y.state.spotShadowMap.length>0&&O.setValue(z,`spotShadowMap`,y.state.spotShadowMap,Ce),y.state.pointShadowMap.length>0&&O.setValue(z,`pointShadowMap`,y.state.pointShadowMap,Ce)),i.isSkinnedMesh){O.setOptional(z,i,`bindMatrix`),O.setOptional(z,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),O.setValue(z,`boneTexture`,e.boneTexture,Ce))}i.isBatchedMesh&&(O.setOptional(z,i,`batchingTexture`),O.setValue(z,`batchingTexture`,i._matricesTexture,Ce),O.setOptional(z,i,`batchingIdTexture`),O.setValue(z,`batchingIdTexture`,i._indirectTexture,Ce),O.setOptional(z,i,`batchingColorTexture`),i._colorsTexture!==null&&O.setValue(z,`batchingColorTexture`,i._colorsTexture,Ce));let A=n.morphAttributes;if((A.position!==void 0||A.normal!==void 0||A.color!==void 0)&&Me.update(i,n,S),(w||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,O.setValue(z,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(k.envMapIntensity.value=t.environmentIntensity),k.dfgLUT!==void 0&&(k.dfgLUT.value=sf()),w){if(O.setValue(z,`toneMappingExposure`,T.toneMappingExposure),v.needsLights&&ct(k,E),a&&r.fog===!0&&U.refreshFogUniforms(k,a),U.refreshMaterialUniforms(k,r,ie,R,x.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;k.probesSH.value=e.texture,k.probesMin.value.copy(e.boundingBox.min),k.probesMax.value.copy(e.boundingBox.max),k.probesResolution.value.copy(e.resolution)}Hf.upload(z,it(v),k,Ce)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(Hf.upload(z,it(v),k,Ce),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&O.setValue(z,`center`,i.center),O.setValue(z,`modelViewMatrix`,i.modelViewMatrix),O.setValue(z,`normalMatrix`,i.normalMatrix),O.setValue(z,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Le.update(n,S),Le.bind(n,S)}}return S}function ct(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.sunLights.needsUpdate=t,e.sunLightShadows.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function lt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return j},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(e,t,n){let r=V.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),V.get(e.texture).__webglTexture=t,V.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=V.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0},this.setRenderTarget=function(e,t=0,n=0){N=e,j=t,M=n;let r=null,i=!1,a=!1;if(e){let o=V.get(e);if(o.__useDefaultFramebuffer!==void 0){B.bindFramebuffer(z.FRAMEBUFFER,o.__webglFramebuffer),I.copy(e.viewport),ee.copy(e.scissor),te=e.scissorTest,B.viewport(I),B.scissor(ee),B.setScissorTest(te),P=-1;return}if(o.__webglFramebuffer===void 0)Ce.setupRenderTarget(e);else if(o.__hasExternalTextures)Ce.rebindTextures(e,V.get(e.texture).__webglTexture,V.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&V.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.`);Ce.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=V.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&Ce.useMultisampledRTT(e)===!1?V.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,I.copy(e.viewport),ee.copy(e.scissor),te=e.scissorTest}else I.copy(se).multiplyScalar(ie).floor(),ee.copy(ce).multiplyScalar(ie).floor(),te=le;if(n!==0&&(r=O),B.bindFramebuffer(z.FRAMEBUFFER,r)&&B.drawBuffers(e,r),B.viewport(I),B.scissor(ee),B.setScissorTest(te),i){let r=V.get(e.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=V.get(e.textures[t]);z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=V.get(e.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,t.__webglTexture,n)}P=-1};function ut(e){let t=V.get(e);return(t.__readFormat!==e.format||t.__readType!==e.type)&&(t.__readFormat=e.format,t.__readType=e.type,t.__formatReadable=xe.textureFormatReadable(e.format),t.__typeReadable=xe.textureTypeReadable(e.type)),t}this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){q(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=V.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){B.bindFramebuffer(z.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;e.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+s);let u=ut(o);if(u.__formatReadable===!1){q(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(u.__typeReadable===!1){q(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&z.readPixels(t,n,r,i,Fe.convert(c),Fe.convert(l),a)}finally{let e=N===null?null:V.get(N).__webglFramebuffer;B.bindFramebuffer(z.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=V.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){B.bindFramebuffer(z.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;e.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+s);let d=ut(o);if(d.__formatReadable===!1)throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(d.__typeReadable===!1)throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let f=z.createBuffer();z.bindBuffer(z.PIXEL_PACK_BUFFER,f),z.bufferData(z.PIXEL_PACK_BUFFER,a.byteLength,z.STREAM_READ),z.readPixels(t,n,r,i,Fe.convert(l),Fe.convert(u),0),z.bindBuffer(z.PIXEL_PACK_BUFFER,null);let p=N===null?null:V.get(N).__webglFramebuffer;B.bindFramebuffer(z.FRAMEBUFFER,p);let m=z.fenceSync(z.SYNC_GPU_COMMANDS_COMPLETE,0);return z.flush(),await ln(z,m,4),z.bindBuffer(z.PIXEL_PACK_BUFFER,f),z.getBufferSubData(z.PIXEL_PACK_BUFFER,0,a),z.bindBuffer(z.PIXEL_PACK_BUFFER,null),z.deleteBuffer(f),z.deleteSync(m),a}throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)}},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;Ce.setTexture2D(e,0),z.copyTexSubImage2D(z.TEXTURE_2D,n,0,0,o,s,i,a),B.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Fe.convert(t.format),_=Fe.convert(t.type),v;t.isData3DTexture?(Ce.setTexture3D(t,0),v=z.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(Ce.setTexture2DArray(t,0),v=z.TEXTURE_2D_ARRAY):(Ce.setTexture2D(t,0),v=z.TEXTURE_2D),B.activeTexture(z.TEXTURE0),B.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,t.flipY),B.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),B.pixelStorei(z.UNPACK_ALIGNMENT,t.unpackAlignment);let y=B.getParameter(z.UNPACK_ROW_LENGTH),b=B.getParameter(z.UNPACK_IMAGE_HEIGHT),x=B.getParameter(z.UNPACK_SKIP_PIXELS),S=B.getParameter(z.UNPACK_SKIP_ROWS),C=B.getParameter(z.UNPACK_SKIP_IMAGES);B.pixelStorei(z.UNPACK_ROW_LENGTH,h.width),B.pixelStorei(z.UNPACK_IMAGE_HEIGHT,h.height),B.pixelStorei(z.UNPACK_SKIP_PIXELS,l),B.pixelStorei(z.UNPACK_SKIP_ROWS,u),B.pixelStorei(z.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=V.get(e),r=V.get(t),h=V.get(n.__renderTarget),g=V.get(r.__renderTarget);B.bindFramebuffer(z.READ_FRAMEBUFFER,h.__webglFramebuffer),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,V.get(e).__webglTexture,i,d+n),z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,V.get(t).__webglTexture,a,m+n)),z.blitFramebuffer(l,u,o,s,f,p,o,s,z.DEPTH_BUFFER_BIT,z.NEAREST);B.bindFramebuffer(z.READ_FRAMEBUFFER,null),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||V.has(e)){let n=V.get(e),r=V.get(t);B.bindFramebuffer(z.READ_FRAMEBUFFER,k),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,A);for(let e=0;e<c;e++)w?z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):z.framebufferTexture2D(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,n.__webglTexture,i),T?z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):z.framebufferTexture2D(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,r.__webglTexture,a),i===0?T?z.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):z.copyTexSubImage2D(v,a,f,p,l,u,o,s):z.blitFramebuffer(l,u,o,s,f,p,o,s,z.COLOR_BUFFER_BIT,z.NEAREST);B.bindFramebuffer(z.READ_FRAMEBUFFER,null),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?z.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?z.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):z.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):z.texSubImage2D(z.TEXTURE_2D,a,f,p,o,s,g,_,h);B.pixelStorei(z.UNPACK_ROW_LENGTH,y),B.pixelStorei(z.UNPACK_IMAGE_HEIGHT,b),B.pixelStorei(z.UNPACK_SKIP_PIXELS,x),B.pixelStorei(z.UNPACK_SKIP_ROWS,S),B.pixelStorei(z.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&z.generateMipmap(v),B.unbindTexture()},this.initRenderTarget=function(e){V.get(e).__webglFramebuffer===void 0&&Ce.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Ce.setTextureCube(e,0):e.isData3DTexture?Ce.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Ce.setTexture2DArray(e,0):Ce.setTexture2D(e,0),B.unbindTexture()},this.resetState=function(){j=0,M=0,N=null,B.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return Ca}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=za._getDrawingBufferColorSpace(e),t.unpackColorSpace=za._getUnpackColorSpace()}}}));function Sp(e,t){let n=e.color??e.inner??e.outer??Tp;if(e.kind===`image`)return t?{kind:`image`,fallback:n}:{kind:`flat`,color:n};if(e.kind===`gradient`){let{inner:t,outer:n,angle:r}=e;return t&&n?r!==void 0&&Number.isFinite(r)?{kind:`linear`,inner:t,outer:n,angle:r}:{kind:`radial`,inner:t,outer:n}:{kind:`flat`,color:t??n??e.color??Tp}}return{kind:`flat`,color:n}}function Cp(e,t){let n=e*Math.PI/180,r=Math.sin(n),i=Math.cos(n);return{x:r,y:i,length:Math.abs(t*r)+Math.abs(i)}}function wp(e,t){return l(e,t,`cover`)}var Tp,Ep=n((()=>{en(),Tp=`#f6f6f4`}));function Dp(){let e=new Kc({depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{inner:{value:new No(`#f6f6f4`)},outer:{value:new No(`#d5d5d1`)},center:{value:new J(.5,.4)},aspect:{value:1},mode:{value:0},axis:{value:new Y(0,-1,1)},map:{value:null},uvRepeat:{value:new J(1,1)},uvOffset:{value:new J(0,0)}},vertexShader:`
|
|
4220
|
+
}`,hp=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new uc(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new qc({vertexShader:pp,fragmentShader:mp,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new $s(new zc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},gp=class extends Oa{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=typeof XRWebGLBinding<`u`,h=new hp,g={},_=t.getContextAttributes(),v=null,y=null,b=[],x=[],S=new J,C=null,w=null,T=new jl;T.viewport=new Ja;let E=new jl;E.viewport=new Ja;let D=[T,E],O=new Bl,k=null,A=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return t===void 0&&(t=new Ao,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return t===void 0&&(t=new Ao,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return t===void 0&&(t=new Ao,b[e]=t),t.getHandSpace()};function j(e){let t=x.indexOf(e.inputSource);if(t===-1)return;let n=b[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function M(){r.removeEventListener(`select`,j),r.removeEventListener(`selectstart`,j),r.removeEventListener(`selectend`,j),r.removeEventListener(`squeeze`,j),r.removeEventListener(`squeezestart`,j),r.removeEventListener(`squeezeend`,j),r.removeEventListener(`end`,M),r.removeEventListener(`inputsourceschange`,N);for(let e=0;e<b.length;e++){let t=x[e];t!==null&&(x[e]=null,b[e].disconnect(t))}k=null,A=null,h.reset();for(let e in g)delete g[e];if(e.setRenderTarget(v),f=null,d=null,u=null,r=null,y=null,L.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(S.width,S.height,!1),w!==null){let e=w.camera;e.fov=w.fov,e.zoom=w.zoom,e.updateProjectionMatrix(),w=null}n.dispatchEvent({type:`sessionend`})}this.setFramebufferScaleFactor=function(e){i=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change framebuffer scale while presenting.`)},this.setReferenceSpaceType=function(e){o=e,n.isPresenting===!0&&K(`WebXRManager: Cannot change reference space type while presenting.`)},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return d===null?f:d},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(r,t)),u},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,r!==null){if(v=e.getRenderTarget(),r.addEventListener(`select`,j),r.addEventListener(`selectstart`,j),r.addEventListener(`selectend`,j),r.addEventListener(`squeeze`,j),r.addEventListener(`squeezestart`,j),r.addEventListener(`squeezeend`,j),r.addEventListener(`end`,M),r.addEventListener(`inputsourceschange`,N),_.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(S),m&&`createProjectionLayer`in XRWebGLBinding.prototype){let n=null,a=null,o=null;_.depth&&(o=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=_.stencil?xi:bi,a=_.stencil?mi:li);let s={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:i};u=this.getBinding(),d=u.createProjectionLayer(s),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new Xa(d.textureWidth,d.textureHeight,{format:yi,type:ii,depthTexture:new cc(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1,storeMultisampledDepthBuffer:d.ignoreDepthValues===!1,storeMultisampledStencilBuffer:d.ignoreDepthValues===!1})}else{let n={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:i};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new Xa(f.framebufferWidth,f.framebufferHeight,{format:yi,type:ii,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1,storeMultisampledDepthBuffer:f.ignoreDepthValues===!1,storeMultisampledStencilBuffer:f.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(s),c=null,a=await r.requestReferenceSpace(o),L.setContext(r),L.start(),n.isPresenting=!0,n.dispatchEvent({type:`sessionstart`})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};function N(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=x.indexOf(n);r>=0&&(x[r]=null,b[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=x.indexOf(n);if(r===-1){for(let e=0;e<b.length;e++)if(e>=x.length){x.push(n),r=e;break}else if(x[e]===null){x[e]=n,r=e;break}if(r===-1)break}let i=b[r];i&&i.connect(n)}}let P=new Y,F=new Y;function I(e,t,n){P.setFromMatrixPosition(t.matrixWorld),F.setFromMatrixPosition(n.matrixWorld);let r=P.distanceTo(F),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function ee(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;h.texture!==null&&(h.depthNear>0&&(t=h.depthNear),h.depthFar>0&&(n=h.depthFar)),O.near=E.near=T.near=t,O.far=E.far=T.far=n,(k!==O.near||A!==O.far)&&(r.updateRenderState({depthNear:O.near,depthFar:O.far}),k=O.near,A=O.far),O.layers.mask=e.layers.mask|6,T.layers.mask=O.layers.mask&-5,E.layers.mask=O.layers.mask&-3;let i=e.parent,a=O.cameras;ee(O,i);for(let e=0;e<a.length;e++)ee(a[e],i);a.length===2?I(O,T,E):O.projectionMatrix.copy(T.projectionMatrix),w===null&&e.isPerspectiveCamera&&(w={camera:e,fov:e.fov,zoom:e.zoom}),te(e,O,i)};function te(e,t,n){n===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(n.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=Ma*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(d!==null||f!==null)return s},this.setFoveation=function(e){s=e,d!==null&&(d.fixedFoveation=e),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return h.texture!==null},this.getDepthSensingMesh=function(){return h.getMesh(O)},this.getCameraTexture=function(e){return g[e]};let ne=null;function re(t,i){if(l=i.getViewerPose(c||a),p=i,l!==null){let t=l.views;f!==null&&(e.setRenderTargetFramebuffer(y,f.framebuffer),e.setRenderTarget(y));let i=!1;t.length!==O.cameras.length&&(O.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(f!==null)a=f.getViewport(r);else{let t=u.getViewSubImage(d,r);a=t.viewport,n===0&&(e.setRenderTargetTextures(y,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(y))}let o=D[n];o===void 0&&(o=new jl,o.layers.enable(n),o.viewport=new Ja,D[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(a.x,a.y,a.width,a.height),n===0&&(O.matrix.copy(o.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),i===!0&&O.cameras.push(o)}let a=r.enabledFeatures;if(a&&a.includes(`depth-sensing`)&&r.depthUsage==`gpu-optimized`&&m){u=n.getBinding();let e=u.getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(a&&a.includes(`camera-access`)&&m){e.state.unbindTexture(),u=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new uc,g[n]=e);let t=u.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<b.length;e++){let t=x[e],n=b[e];t!==null&&n!==void 0&&n.update(t,i,c||a)}ne&&ne(t,i),i.detectedPlanes&&n.dispatchEvent({type:`planesdetected`,data:i}),p=null}let L=new ru;L.setAnimationLoop(re),this.setAnimationLoop=function(e){ne=e},this.dispose=function(){}}},_p=new $a,vp=new X,vp.set(-1,0,0,0,1,0,0,0,1),yp=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),bp=null,xp=class{constructor(e={}){let{canvas:t=on(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=ii}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);p=n.getContextAttributes().alpha}else p=a;let m=f,h=new Set([Ei,Ti,Ci]),g=new Set([ii,li,si,mi,fi,pi]),_=new Uint32Array(4),v=new Int32Array(4),y=new Y,b=null,x=null,S=[],C=[],w=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let T=this,E=!1,D=null,O=null,k=null,A=null;this._outputColorSpace=_a;let j=0,M=0,N=null,P=-1,F=null,I=new Ja,ee=new Ja,te=null,ne=new Po(0),re=0,L=t.width,R=t.height,ie=1,ae=null,oe=null,se=new Ja(0,0,L,R),ce=new Ja(0,0,L,R),le=!1,ue=new ic,de=!1,fe=!1,pe=new $a,me=new Y,he=new Ja,ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},_e=!1;function ve(){return N===null?ie:1}let z=n;function ye(e,n){return t.getContext(e,n)}let be,xe,B,Se,V,Ce,we,Te,Ee,H,De,U,Oe,ke,W,Ae,je,Me,Ne,Pe,Fe,Ie,Le;try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r186`),t.addEventListener(`webglcontextlost`,Be,!1),t.addEventListener(`webglcontextrestored`,Ve,!1),t.addEventListener(`webglcontextcreationerror`,He,!1),z===null){let t=`webgl2`;if(z=ye(t,e),z===null)throw ye(t)?Error(`THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.`):Error(`THREE.WebGLRenderer: Error creating WebGL context.`)}Re()}catch(e){throw t.removeEventListener(`webglcontextlost`,Be,!1),t.removeEventListener(`webglcontextrestored`,Ve,!1),t.removeEventListener(`webglcontextcreationerror`,He,!1),q(`WebGLRenderer: `+e.message),e}function Re(){be=new yu(z),be.init(),Fe=new af(z,be),xe=new cu(z,be,e,Fe),B=new nf(z,be),xe.reversedDepthBuffer&&d&&B.buffers.depth.setReversed(!0),O=z.createFramebuffer(),k=z.createFramebuffer(),A=z.createFramebuffer(),Se=new Su(z),V=new Wd,Ce=new rf(z,be,B,V,xe,Fe,Se),we=new vu(T),Te=new iu(z),Ie=new ou(z,Te),Ee=new bu(z,Te,Se,Ie),H=new wu(z,Ee,Te,Ie,Se),Me=new Cu(z,xe,Ce),W=new lu(V),De=new Ud(T,we,be,xe,Ie,W),U=new of(T,V),Oe=new Jd,ke=new ef(be),je=new au(T,we,B,H,p,s),Ae=new tf(T,H,xe),Le=new sf(z,Se,xe,B),Ne=new su(z,be,Se),Pe=new xu(z,be,Se),Se.programs=De.programs,T.capabilities=xe,T.extensions=be,T.properties=V,T.renderLists=Oe,T.shadowMap=Ae,T.state=B,T.info=Se}m!==1009&&(w=new Tu(m,t.width,t.height,o,r,i));let ze=new gp(T,z);this.xr=ze,this.getContext=function(){return z},this.getContextAttributes=function(){return z.getContextAttributes()},this.forceContextLoss=function(){let e=be.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=be.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return ie},this.setPixelRatio=function(e){e!==void 0&&(ie=e,this.setSize(L,R,!1))},this.getSize=function(e){return e.set(L,R)},this.setSize=function(e,n,r=!0){ze.isPresenting?K(`WebGLRenderer: Can't change size while VR device is presenting.`):(L=e,R=n,t.width=Math.floor(e*ie),t.height=Math.floor(n*ie),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(L*ie,R*ie).floor()},this.setDrawingBufferSize=function(e,n,r){L=e,R=n,ie=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.setEffects=function(e){if(m===1009)q(`WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.`);else{if(e){for(let t=0;t<e.length;t++)if(e[t].isOutputPass===!0){K(`WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.`);break}}w.setEffects(e||[])}},this.getCurrentViewport=function(e){return e.copy(I)},this.getViewport=function(e){return e.copy(se)},this.setViewport=function(e,t,n,r){e.isVector4?se.set(e.x,e.y,e.z,e.w):se.set(e,t,n,r),B.viewport(I.copy(se).multiplyScalar(ie).round())},this.getScissor=function(e){return e.copy(ce)},this.setScissor=function(e,t,n,r){e.isVector4?ce.set(e.x,e.y,e.z,e.w):ce.set(e,t,n,r),B.scissor(ee.copy(ce).multiplyScalar(ie).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(e){B.setScissorTest(le=e)},this.setOpaqueSort=function(e){ae=e},this.setTransparentSort=function(e){oe=e},this.getClearColor=function(e){return e.copy(je.getClearColor())},this.setClearColor=function(){je.setClearColor(...arguments)},this.getClearAlpha=function(){return je.getClearAlpha()},this.setClearAlpha=function(){je.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(N!==null){let t=N.texture.format;e=h.has(t)}if(e){let e=N.texture.type,t=g.has(e),n=je.getClearColor(),r=je.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(_[0]=i,_[1]=a,_[2]=o,_[3]=r,z.clearBufferuiv(z.COLOR,0,_)):(v[0]=i,v[1]=a,v[2]=o,v[3]=r,z.clearBufferiv(z.COLOR,0,v))}else r|=z.COLOR_BUFFER_BIT}t&&(r|=z.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),r!==0&&z.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(e){e.setRenderer(this),D=e},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Be,!1),t.removeEventListener(`webglcontextrestored`,Ve,!1),t.removeEventListener(`webglcontextcreationerror`,He,!1),je.dispose(),Oe.dispose(),ke.dispose(),V.dispose(),we.dispose(),H.dispose(),Ie.dispose(),Le.dispose(),De.dispose(),ze.dispose(),ze.removeEventListener(`sessionstart`,Ye),ze.removeEventListener(`sessionend`,Xe),Ze.stop()};function Be(e){e.preventDefault(),sn(`WebGLRenderer: Context Lost.`),E=!0}function Ve(){sn(`WebGLRenderer: Context Restored.`),E=!1;let e=Se.autoReset,t=Ae.enabled,n=Ae.autoUpdate,r=Ae.needsUpdate,i=Ae.type;Re(),Se.autoReset=e,Ae.enabled=t,Ae.autoUpdate=n,Ae.needsUpdate=r,Ae.type=i}function He(e){q(`WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Ue(e){let t=e.target;t.removeEventListener(`dispose`,Ue),We(t)}function We(e){Ge(e),V.remove(e)}function Ge(e){let t=V.get(e).programs;t!==void 0&&(t.forEach(function(e){De.releaseProgram(e)}),e.isShaderMaterial&&De.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=ge);let o=i.isMesh&&i.matrixWorld.determinantAffine()<0,s=st(e,t,n,r,i);B.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=Ee.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ie.setup(i,r,s,n,c);let h,g=Ne;if(c!==null&&(h=Te.get(c),g=Pe,g.setIndex(h)),i.isMesh)r.wireframe===!0?(B.setLineWidth(r.wireframeLinewidth*ve()),g.setMode(z.LINES)):g.setMode(z.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),B.setLineWidth(e*ve()),i.isLineSegments?g.setMode(z.LINES):i.isLineLoop?g.setMode(z.LINE_LOOP):g.setMode(z.LINE_STRIP)}else i.isPoints?g.setMode(z.POINTS):i.isSprite&&g.setMode(z.TRIANGLES);if(i.isBatchedMesh){if(be.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?Te.get(c).bytesPerElement:1,o=V.get(r).currentProgram.getUniforms();for(let r=0;r<n;r++)o.setValue(z,`_gl_DrawID`,r),g.render(e[r]/a,t[r])}}else if(i.isInstancedMesh)g.renderInstances(f,m,i.count);else if(n.isInstancedBufferGeometry){let e=n._maxInstanceCount===void 0?1/0:n._maxInstanceCount,t=Math.min(n.instanceCount,e);g.renderInstances(f,m,t)}else g.render(f,m)};function Ke(e,t,n,r){D!==null&&e.isNodeMaterial&&D.setObject(r,e),de===!0&&W.setState(e,n,!1),e.transparent===!0&&e.side===2&&e.forceSinglePass===!1?(e.side=1,e.needsUpdate=!0,rt(e,t,r),e.side=0,e.needsUpdate=!0,rt(e,t,r),e.side=2):rt(e,t,r)}this.compile=function(e,t,n=null){n===null&&(n=e),D!==null&&D.renderStart(e,t,n),x=ke.get(n),x.init(t),C.push(x),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))}),x.setupLights(),D!==null&&D.updateLights(x.state.lightsArray),fe=this.localClippingEnabled,de=W.init(this.clippingPlanes,fe),de===!0&&W.setGlobalState(this.clippingPlanes,t),D!==null&&Ae.render(x.state.shadowsArray,n,t);let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let i=e.material;if(i){if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];Ke(o,n,t,e),r.add(o)}else Ke(i,n,t,e),r.add(i)}}),x=C.pop(),D!==null&&D.renderEnd(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){r.forEach(function(e){let t=V.get(e).currentProgram;(t===void 0||t.isReady())&&r.delete(e)}),r.size===0?t(e):setTimeout(n,10)}be.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let qe=null;function Je(e){qe&&qe(e)}function Ye(){Ze.stop()}function Xe(){Ze.start()}let Ze=new ru;Ze.setAnimationLoop(Je),typeof self<`u`&&Ze.setContext(self),this.setAnimationLoop=function(e){qe=e,ze.setAnimationLoop(e),e===null?Ze.stop():Ze.start()},ze.addEventListener(`sessionstart`,Ye),ze.addEventListener(`sessionend`,Xe),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){q(`WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(E===!0)return;D!==null&&D.renderStart(e,t);let n=ze.enabled===!0&&ze.isPresenting===!0,r=w!==null&&(N===null||n)&&w.begin(T,N);if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),ze.enabled===!0&&ze.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(ze.cameraAutoUpdate===!0&&ze.updateCamera(t),t=ze.getCamera()),e.isScene===!0&&e.onBeforeRender(T,e,t,N),x=ke.get(e,C.length),x.init(t),x.state.textureUnits=Ce.getTextureUnits(),C.push(x),pe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ue.setFromProjectionMatrix(pe,wa,t.reversedDepth),fe=this.localClippingEnabled,de=W.init(this.clippingPlanes,fe),b=Oe.get(e,S.length),b.init(),S.push(b),ze.enabled===!0&&ze.isPresenting===!0){let e=T.xr.getDepthSensingMesh();e!==null&&Qe(e,t,-1/0,T.sortObjects)}Qe(e,t,0,T.sortObjects),b.finish(),D!==null&&D.updateLights(x.state.lightsArray),T.sortObjects===!0&&b.sort(ae,oe),_e=ze.enabled===!1||ze.isPresenting===!1||ze.hasDepthSensing()===!1,_e&&je.addToRenderList(b,e),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),de===!0&&W.beginShadows();let i=x.state.shadowsArray;if(Ae.render(i,e,t),de===!0&&W.endShadows(),(r&&w.hasRenderPass())===!1){let n=b.opaque,r=b.transmissive;if(x.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];et(n,r,e,a)}_e&&je.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];$e(b,e,n,n.viewport)}}else r.length>0&&et(n,r,e,t),_e&&je.render(e),$e(b,e,t)}N!==null&&M===0&&(Ce.updateMultisampleRenderTarget(N),Ce.updateRenderTargetMipmap(N)),r&&w.end(T),e.isScene===!0&&e.onAfterRender(T,e,t),Ie.resetDefaultState(),P=-1,F=null,C.pop(),C.length>0?(x=C[C.length-1],Ce.setTextureUnits(x.state.textureUnits),de===!0&&W.setGlobalState(T.clippingPlanes,x.state.camera)):x=null,S.pop(),b=S.length>0?S[S.length-1]:null,D!==null&&D.renderEnd()};function Qe(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLightProbeGrid)x.pushLightProbeGrid(e);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||e.intersectsFrustum(ue)){r&&he.setFromMatrixPosition(e.matrixWorld).applyMatrix4(pe);let i=H.update(e),a=e.material;a.visible&&b.push(e,i,a,n,he.z,null,t)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||e.intersectsFrustum(ue))){let i=H.update(e),a=e.material;if(r&&(e.boundingSphere===void 0?(i.boundingSphere===null&&i.computeBoundingSphere(),he.copy(i.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),he.copy(e.boundingSphere.center)),he.applyMatrix4(e.matrixWorld).applyMatrix4(pe)),Array.isArray(a)){let r=i.groups;for(let o=0,s=r.length;o<s;o++){let s=r[o],c=a[s.materialIndex];c&&c.visible&&b.push(e,i,c,n,he.z,s,t)}}else a.visible&&b.push(e,i,a,n,he.z,null,t)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)Qe(i[e],t,n,r)}function $e(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;x.setupLightsView(n),de===!0&&W.setGlobalState(T.clippingPlanes,n),r&&B.viewport(I.copy(r)),i.length>0&&tt(i,t,n),a.length>0&&tt(a,t,n),o.length>0&&tt(o,t,n),B.buffers.depth.setTest(!0),B.buffers.depth.setMask(!0),B.buffers.color.setMask(!0),B.setPolygonOffset(!1)}function et(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;if(x.state.transmissionRenderTarget[r.id]===void 0){let e=be.has(`EXT_color_buffer_half_float`)||be.has(`EXT_color_buffer_float`);x.state.transmissionRenderTarget[r.id]=new Xa(1,1,{generateMipmaps:!0,type:e?di:ii,minFilter:ri,samples:Math.max(4,xe.samples),stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:Ba.workingColorSpace})}let a=x.state.transmissionRenderTarget[r.id],o=r.viewport||I;a.setSize(o.z*T.transmissionResolutionScale,o.w*T.transmissionResolutionScale);let s=T.getRenderTarget(),c=T.getActiveCubeFace(),l=T.getActiveMipmapLevel();T.setRenderTarget(a),T.getClearColor(ne),re=T.getClearAlpha(),re<1&&T.setClearColor(16777215,.5),T.clear(),_e&&je.render(n);let u=T.toneMapping;T.toneMapping=0;let d=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),x.setupLightsView(r),de===!0&&W.setGlobalState(T.clippingPlanes,r),tt(e,n,r),Ce.updateMultisampleRenderTarget(a),Ce.updateRenderTargetMipmap(a),be.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i<a;i++){let{object:a,geometry:o,material:s,group:c}=t[i];if(s.side===2&&a.layers.test(r.layers)){let t=s.side;s.side=1,s.needsUpdate=!0,nt(a,n,r,o,s,c),s.side=t,s.needsUpdate=!0,e=!0}}e===!0&&(Ce.updateMultisampleRenderTarget(a),Ce.updateRenderTargetMipmap(a))}T.setRenderTarget(s,c,l),T.setClearColor(ne,re),d!==void 0&&(r.viewport=d),T.toneMapping=u}function tt(e,t,n){let r=t.isScene===!0?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:c}=a,l=a.material;l.allowOverride===!0&&r!==null&&(l=r),o.layers.test(n.layers)&&nt(o,t,n,s,l,c)}}function nt(e,t,n,r,i,a){D!==null&&i.isNodeMaterial&&D.setObject(e,i),e.onBeforeRender(T,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(T,t,n,r,e,a),i.transparent===!0&&i.side===2&&i.forceSinglePass===!1?(i.side=1,i.needsUpdate=!0,T.renderBufferDirect(n,t,r,i,e,a),i.side=0,i.needsUpdate=!0,T.renderBufferDirect(n,t,r,i,e,a),i.side=2):T.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(T,t,n,r,i,a)}function rt(e,t,n){t.isScene!==!0&&(t=ge);let r=V.get(e),i=x.state.lights,a=x.state.shadowsArray,o=i.state.version,s=De.getParameters(e,i.state,a,t,n,x.state.lightProbeGridArray),c=De.getProgramCacheKey(s),l=r.programs;r.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,r.fog=t.fog;let u=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;r.envMap=we.get(e.envMap||r.environment,u),r.envMapRotation=r.environment!==null&&e.envMap===null?t.environmentRotation:e.envMapRotation,l===void 0&&(e.addEventListener(`dispose`,Ue),l=new Map,r.programs=l);let d=l.get(c);if(d!==void 0){if(r.currentProgram===d&&r.lightsStateVersion===o)return at(e,s),d}else s.uniforms=De.getUniforms(e),D!==null&&e.isNodeMaterial&&D.build(e,n,s),e.onBeforeCompile(s,T),d=De.acquireProgram(s,c),l.set(c,d),r.uniforms=s.uniforms;let f=r.uniforms;return(!e.isShaderMaterial&&!e.isRawShaderMaterial||e.clipping===!0)&&(f.clippingPlanes=W.uniform),at(e,s),r.needsLights=lt(e),r.lightsStateVersion=o,r.needsLights&&(f.ambientLightColor.value=i.state.ambient,f.lightProbe.value=i.state.probe,f.sunLights.value=i.state.sun,f.sunLightShadows.value=i.state.sunShadow,f.directionalLights.value=i.state.directional,f.directionalLightShadows.value=i.state.directionalShadow,f.spotLights.value=i.state.spot,f.spotLightShadows.value=i.state.spotShadow,f.rectAreaLights.value=i.state.rectArea,f.ltc_1.value=i.state.rectAreaLTC1,f.ltc_2.value=i.state.rectAreaLTC2,f.pointLights.value=i.state.point,f.pointLightShadows.value=i.state.pointShadow,f.hemisphereLights.value=i.state.hemi,f.sunShadowMatrix.value=i.state.sunShadowMatrix,f.sunShadowCascade.value=i.state.sunShadowCascade,f.directionalShadowMatrix.value=i.state.directionalShadowMatrix,f.spotLightMatrix.value=i.state.spotLightMatrix,f.spotLightMap.value=i.state.spotLightMap,f.pointShadowMatrix.value=i.state.pointShadowMatrix),r.lightProbeGrid=x.state.lightProbeGridArray.length>0,r.currentProgram=d,r.uniformsList=null,d}function it(e){if(e.uniformsList===null){let t=e.currentProgram.getUniforms();e.uniformsList=Uf.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function at(e,t){let n=V.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function ot(e,t){if(e.length===0)return null;if(e.length===1)return e[0].texture===null?null:e[0];y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.texture!==null&&n.boundingBox.containsPoint(y))return n}return null}function st(e,t,n,r,i){t.isScene!==!0&&(t=ge),Ce.resetTextureUnits();let a=t.fog,o=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?t.environment:null,s=N===null?T.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:Ba.workingColorSpace,c=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,l=we.get(r.envMap||o,c),u=r.vertexColors===!0&&!!n.attributes.color&&n.attributes.color.itemSize===4,d=!!n.attributes.tangent&&(!!r.normalMap||r.anisotropy>0),f=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,h=0;r.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(h=T.toneMapping);let g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=g===void 0?0:g.length,v=V.get(r),y=x.state.lights;if(de===!0&&(fe===!0||e!==F)){let t=e===F&&r.id===P;W.setState(r,e,t)}let b=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version?b=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i._colorsTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i._colorsTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?b=!0:v.envMap===l?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==W.numPlanes||v.numIntersection!==W.numIntersection)?b=!0:v.vertexAlphas===u&&v.vertexTangents===d&&v.morphTargets===f&&v.morphNormals===p&&v.morphColors===m&&v.toneMapping===h&&v.morphTargetsCount===_?!!v.lightProbeGrid!=x.state.lightProbeGridArray.length>0&&(b=!0):b=!0:b=!0:b=!0:(b=!0,v.__version=r.version);let S=v.currentProgram;b===!0&&(S=rt(r,t,i),D&&r.isNodeMaterial&&D.onUpdateProgram(r,S,v));let C=!1,w=!1,E=!1,O=S.getUniforms(),k=v.uniforms;if(B.useProgram(S.program)&&(C=!0,w=!0,E=!0),r.id!==P&&(P=r.id,w=!0),v.needsLights){let e=ot(x.state.lightProbeGridArray,i);v.lightProbeGrid!==e&&(v.lightProbeGrid=e,w=!0)}if(C||F!==e){B.buffers.depth.getReversed()&&e.reversedDepth!==!0&&(e._reversedDepth=!0,e.updateProjectionMatrix()),O.setValue(z,`projectionMatrix`,e.projectionMatrix),O.setValue(z,`viewMatrix`,e.matrixWorldInverse);let t=O.map.cameraPosition;t!==void 0&&t.setValue(z,me.setFromMatrixPosition(e.matrixWorld)),xe.logarithmicDepthBuffer&&O.setValue(z,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&O.setValue(z,`isOrthographic`,e.isOrthographicCamera===!0),F!==e&&(F=e,w=!0,E=!0)}if(v.needsLights&&(y.state.sunShadowMap.length>0&&O.setValue(z,`sunShadowMap`,y.state.sunShadowMap,Ce),y.state.directionalShadowMap.length>0&&O.setValue(z,`directionalShadowMap`,y.state.directionalShadowMap,Ce),y.state.spotShadowMap.length>0&&O.setValue(z,`spotShadowMap`,y.state.spotShadowMap,Ce),y.state.pointShadowMap.length>0&&O.setValue(z,`pointShadowMap`,y.state.pointShadowMap,Ce)),i.isSkinnedMesh){O.setOptional(z,i,`bindMatrix`),O.setOptional(z,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),O.setValue(z,`boneTexture`,e.boneTexture,Ce))}i.isBatchedMesh&&(O.setOptional(z,i,`batchingTexture`),O.setValue(z,`batchingTexture`,i._matricesTexture,Ce),O.setOptional(z,i,`batchingIdTexture`),O.setValue(z,`batchingIdTexture`,i._indirectTexture,Ce),O.setOptional(z,i,`batchingColorTexture`),i._colorsTexture!==null&&O.setValue(z,`batchingColorTexture`,i._colorsTexture,Ce));let A=n.morphAttributes;if((A.position!==void 0||A.normal!==void 0||A.color!==void 0)&&Me.update(i,n,S),(w||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,O.setValue(z,`receiveShadow`,i.receiveShadow)),(r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial)&&r.envMap===null&&t.environment!==null&&(k.envMapIntensity.value=t.environmentIntensity),k.dfgLUT!==void 0&&(k.dfgLUT.value=cf()),w){if(O.setValue(z,`toneMappingExposure`,T.toneMappingExposure),v.needsLights&&ct(k,E),a&&r.fog===!0&&U.refreshFogUniforms(k,a),U.refreshMaterialUniforms(k,r,ie,R,x.state.transmissionRenderTarget[e.id]),v.needsLights&&v.lightProbeGrid){let e=v.lightProbeGrid;k.probesSH.value=e.texture,k.probesMin.value.copy(e.boundingBox.min),k.probesMax.value.copy(e.boundingBox.max),k.probesResolution.value.copy(e.resolution)}Uf.upload(z,it(v),k,Ce)}if(r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(Uf.upload(z,it(v),k,Ce),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&O.setValue(z,`center`,i.center),O.setValue(z,`modelViewMatrix`,i.modelViewMatrix),O.setValue(z,`normalMatrix`,i.normalMatrix),O.setValue(z,`modelMatrix`,i.matrixWorld),r.uniformsGroups!==void 0){let e=r.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];Le.update(n,S),Le.bind(n,S)}}return S}function ct(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.sunLights.needsUpdate=t,e.sunLightShadows.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function lt(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&e.lights===!0}this.getActiveCubeFace=function(){return j},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(e,t,n){let r=V.get(e);r.__autoAllocateDepthBuffer=e.resolveDepthBuffer===!1,r.__autoAllocateDepthBuffer===!1&&(r.__useRenderToTexture=!1),V.get(e.texture).__webglTexture=t,V.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=V.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=t===void 0},this.setRenderTarget=function(e,t=0,n=0){N=e,j=t,M=n;let r=null,i=!1,a=!1;if(e){let o=V.get(e);if(o.__useDefaultFramebuffer!==void 0){B.bindFramebuffer(z.FRAMEBUFFER,o.__webglFramebuffer),I.copy(e.viewport),ee.copy(e.scissor),te=e.scissorTest,B.viewport(I),B.scissor(ee),B.setScissorTest(te),P=-1;return}if(o.__webglFramebuffer===void 0)Ce.setupRenderTarget(e);else if(o.__hasExternalTextures)Ce.rebindTextures(e,V.get(e.texture).__webglTexture,V.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(t!==null&&V.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error(`THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.`);Ce.setupDepthRenderbuffer(e)}}let s=e.texture;(s.isData3DTexture||s.isDataArrayTexture||s.isCompressedArrayTexture)&&(a=!0);let c=V.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&Ce.useMultisampledRTT(e)===!1?V.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,I.copy(e.viewport),ee.copy(e.scissor),te=e.scissorTest}else I.copy(se).multiplyScalar(ie).floor(),ee.copy(ce).multiplyScalar(ie).floor(),te=le;if(n!==0&&(r=O),B.bindFramebuffer(z.FRAMEBUFFER,r)&&B.drawBuffers(e,r),B.viewport(I),B.scissor(ee),B.setScissorTest(te),i){let r=V.get(e.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a){let r=t;for(let t=0;t<e.textures.length;t++){let i=V.get(e.textures[t]);z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0+t,i.__webglTexture,n,r)}}else if(e!==null&&n!==0){let t=V.get(e.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,t.__webglTexture,n)}P=-1};function ut(e){let t=V.get(e);return(t.__readFormat!==e.format||t.__readType!==e.type)&&(t.__readFormat=e.format,t.__readType=e.type,t.__formatReadable=xe.textureFormatReadable(e.format),t.__typeReadable=xe.textureTypeReadable(e.type)),t}this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){q(`WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=V.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){B.bindFramebuffer(z.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;e.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+s);let u=ut(o);if(u.__formatReadable===!1){q(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(u.__typeReadable===!1){q(`WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&z.readPixels(t,n,r,i,Fe.convert(c),Fe.convert(l),a)}finally{let e=N===null?null:V.get(N).__webglFramebuffer;B.bindFramebuffer(z.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=V.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){B.bindFramebuffer(z.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;e.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+s);let d=ut(o);if(d.__formatReadable===!1)throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(d.__typeReadable===!1)throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let f=z.createBuffer();z.bindBuffer(z.PIXEL_PACK_BUFFER,f),z.bufferData(z.PIXEL_PACK_BUFFER,a.byteLength,z.STREAM_READ),z.readPixels(t,n,r,i,Fe.convert(l),Fe.convert(u),0),z.bindBuffer(z.PIXEL_PACK_BUFFER,null);let p=N===null?null:V.get(N).__webglFramebuffer;B.bindFramebuffer(z.FRAMEBUFFER,p);let m=z.fenceSync(z.SYNC_GPU_COMMANDS_COMPLETE,0);return z.flush(),await un(z,m,4),z.bindBuffer(z.PIXEL_PACK_BUFFER,f),z.getBufferSubData(z.PIXEL_PACK_BUFFER,0,a),z.bindBuffer(z.PIXEL_PACK_BUFFER,null),z.deleteBuffer(f),z.deleteSync(m),a}throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)}},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;Ce.setTexture2D(e,0),z.copyTexSubImage2D(z.TEXTURE_2D,n,0,0,o,s,i,a),B.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Fe.convert(t.format),_=Fe.convert(t.type),v;t.isData3DTexture?(Ce.setTexture3D(t,0),v=z.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(Ce.setTexture2DArray(t,0),v=z.TEXTURE_2D_ARRAY):(Ce.setTexture2D(t,0),v=z.TEXTURE_2D),B.activeTexture(z.TEXTURE0),B.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,t.flipY),B.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),B.pixelStorei(z.UNPACK_ALIGNMENT,t.unpackAlignment);let y=B.getParameter(z.UNPACK_ROW_LENGTH),b=B.getParameter(z.UNPACK_IMAGE_HEIGHT),x=B.getParameter(z.UNPACK_SKIP_PIXELS),S=B.getParameter(z.UNPACK_SKIP_ROWS),C=B.getParameter(z.UNPACK_SKIP_IMAGES);B.pixelStorei(z.UNPACK_ROW_LENGTH,h.width),B.pixelStorei(z.UNPACK_IMAGE_HEIGHT,h.height),B.pixelStorei(z.UNPACK_SKIP_PIXELS,l),B.pixelStorei(z.UNPACK_SKIP_ROWS,u),B.pixelStorei(z.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=V.get(e),r=V.get(t),h=V.get(n.__renderTarget),g=V.get(r.__renderTarget);B.bindFramebuffer(z.READ_FRAMEBUFFER,h.__webglFramebuffer),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<c;n++)w&&(z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,V.get(e).__webglTexture,i,d+n),z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,V.get(t).__webglTexture,a,m+n)),z.blitFramebuffer(l,u,o,s,f,p,o,s,z.DEPTH_BUFFER_BIT,z.NEAREST);B.bindFramebuffer(z.READ_FRAMEBUFFER,null),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else if(i!==0||e.isRenderTargetTexture||V.has(e)){let n=V.get(e),r=V.get(t);B.bindFramebuffer(z.READ_FRAMEBUFFER,k),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,A);for(let e=0;e<c;e++)w?z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,n.__webglTexture,i,d+e):z.framebufferTexture2D(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,n.__webglTexture,i),T?z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,r.__webglTexture,a,m+e):z.framebufferTexture2D(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,r.__webglTexture,a),i===0?T?z.copyTexSubImage3D(v,a,f,p,m+e,l,u,o,s):z.copyTexSubImage2D(v,a,f,p,l,u,o,s):z.blitFramebuffer(l,u,o,s,f,p,o,s,z.COLOR_BUFFER_BIT,z.NEAREST);B.bindFramebuffer(z.READ_FRAMEBUFFER,null),B.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else T?e.isDataTexture||e.isData3DTexture?z.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h.data):t.isCompressedArrayTexture?z.compressedTexSubImage3D(v,a,f,p,m,o,s,c,g,h.data):z.texSubImage3D(v,a,f,p,m,o,s,c,g,_,h):e.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,a,f,p,o,s,g,_,h.data):e.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,a,f,p,h.width,h.height,g,h.data):z.texSubImage2D(z.TEXTURE_2D,a,f,p,o,s,g,_,h);B.pixelStorei(z.UNPACK_ROW_LENGTH,y),B.pixelStorei(z.UNPACK_IMAGE_HEIGHT,b),B.pixelStorei(z.UNPACK_SKIP_PIXELS,x),B.pixelStorei(z.UNPACK_SKIP_ROWS,S),B.pixelStorei(z.UNPACK_SKIP_IMAGES,C),a===0&&t.generateMipmaps&&z.generateMipmap(v),B.unbindTexture()},this.initRenderTarget=function(e){V.get(e).__webglFramebuffer===void 0&&Ce.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?Ce.setTextureCube(e,0):e.isData3DTexture?Ce.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?Ce.setTexture2DArray(e,0):Ce.setTexture2D(e,0),B.unbindTexture()},this.resetState=function(){j=0,M=0,N=null,B.reset(),Ie.reset()},typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}get coordinateSystem(){return wa}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=Ba._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ba._getUnpackColorSpace()}}}));function Cp(e,t){let n=e.color??e.inner??e.outer??Ep;if(e.kind===`image`)return t?{kind:`image`,fallback:n}:{kind:`flat`,color:n};if(e.kind===`gradient`){let{inner:t,outer:n,angle:r}=e;return t&&n?r!==void 0&&Number.isFinite(r)?{kind:`linear`,inner:t,outer:n,angle:r}:{kind:`radial`,inner:t,outer:n}:{kind:`flat`,color:t??n??e.color??Ep}}return{kind:`flat`,color:n}}function wp(e,t){let n=e*Math.PI/180,r=Math.sin(n),i=Math.cos(n);return{x:r,y:i,length:Math.abs(t*r)+Math.abs(i)}}function Tp(e,t){return l(e,t,`cover`)}var Ep,Dp=n((()=>{tn(),Ep=`#f6f6f4`}));function Op(){let e=new qc({depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{inner:{value:new Po(`#f6f6f4`)},outer:{value:new Po(`#d5d5d1`)},center:{value:new J(.5,.4)},aspect:{value:1},mode:{value:0},axis:{value:new Y(0,-1,1)},map:{value:null},uvRepeat:{value:new J(1,1)},uvOffset:{value:new J(0,0)}},vertexShader:`
|
|
4221
4221
|
varying vec2 vUv;
|
|
4222
4222
|
void main() {
|
|
4223
4223
|
vUv = uv;
|
|
@@ -4262,15 +4262,15 @@ void main() {
|
|
|
4262
4262
|
gl_FragColor = vec4(rgb, 1.0);
|
|
4263
4263
|
#include <colorspace_fragment>
|
|
4264
4264
|
}
|
|
4265
|
-
`}),t=new
|
|
4265
|
+
`}),t=new $s(new zc(2,2),e);t.frustumCulled=!1;let n=new Io;n.add(t);let r=new Pl(-1,1,1,-1,0,1),i=new J,a=(e,t)=>e.setStyle(t,va),o=null,s=1;return{setImage(e,t=1){o=e,s=t},render(t,c){if(c.kind===`transparent`)return;let l=e.uniforms;t.getDrawingBufferSize(i);let u=t.getRenderTarget(),d=u?u.width/u.height:i.x/i.y;l.aspect.value=d;let f=Cp(c,o!==null);if(f.kind===`image`){let{repeat:e,offset:t}=Tp(s,d);l.uvRepeat.value.set(e[0],e[1]),l.uvOffset.value.set(t[0],t[1]),l.map.value=o,l.mode.value=3}else if(f.kind===`flat`)a(l.inner.value,f.color),l.mode.value=0;else if(a(l.inner.value,f.inner),a(l.outer.value,f.outer),f.kind===`linear`){let e=wp(f.angle,d);l.axis.value.set(e.x,e.y,e.length),l.mode.value=2}else l.mode.value=1;t.render(n,r)},dispose(){t.geometry.dispose(),e.dispose()}}}var kp=n((()=>{Sp(),Dp()}));function Ap(e,t){e.position.set(t.position[0],t.position[1],t.position[2]),Mp.set(t.target[0],t.target[1],t.target[2]).sub(e.position).normalize(),Np.set(0,1,0).applyAxisAngle(Mp,t.roll*jp),e.up.copy(Np),e.lookAt(t.target[0],t.target[1],t.target[2]),e.fov!==t.fov&&(e.fov=t.fov,e.updateProjectionMatrix())}var jp,Mp,Np,Pp=n((()=>{Sp(),jp=Math.PI/180,Mp=new Y,Np=new Y}));function Fp(e){return e!==void 0&&Object.hasOwn(Ip,e)?e:`studio`}var Ip,Lp=n((()=>{Ip={studio:{room:[[0,`#55555a`],[.38,`#3a3a3e`],[.5,`#262629`],[.62,`#323236`],[1,`#4a4a4e`]],feather:.15,keySize:1,gain:{key:1,overhead:1,strip:1,rim:1,rear:1,fill:1,bounce:1,sweep:1},shadow:{opacity:1,radius:28}},soft:{room:[[0,`#5e5e63`],[.38,`#4c4c51`],[.5,`#3e3e43`],[.62,`#47474b`],[1,`#55555a`]],feather:.3,keySize:1.5,gain:{key:.72,overhead:1.25,strip:.55,rim:.5,rear:.6,fill:1.25,bounce:1.2,sweep:1},shadow:{opacity:.75,radius:40}},contrast:{room:[[0,`#46464c`],[.38,`#27272b`],[.5,`#111113`],[.62,`#1b1b1e`],[1,`#35353a`]],feather:.1,keySize:.85,gain:{key:1.45,overhead:.8,strip:1.5,rim:1.5,rear:1.3,fill:.45,bounce:.4,sweep:.35},shadow:{opacity:1.25,radius:20}},night:{room:[[0,`#17181e`],[.38,`#0b0c10`],[.5,`#050506`],[.62,`#08080a`],[1,`#0f1014`]],feather:.22,keySize:.9,gain:{key:.55,overhead:.7,strip:.9,rim:1.1,rear:.8,fill:.18,bounce:.15,sweep:.1},shadow:{opacity:.6,radius:30}}}}));function Rp(e,t=`studio`){let n=Ip[t],r=new Io,i=[],a=Bp(1,256,n.room),o=new Hc(60,48,24),s=new Vs({map:a,side:1});r.add(new $s(o,s)),i.push(a,o,s);let c=Vp(`none`,n.feather),l=Vp(`top`,n.feather),u=Vp(`left`,n.feather);i.push(c,l,u);let d=(e,t,a,o,s,c)=>{let l=new zc(t,a),u=new Vs({side:2,map:c,transparent:!0,blending:2,depthWrite:!1});u.color.setScalar(o*n.gain[e]);let d=new $s(l,u);d.position.set(...s),d.lookAt(0,0,0),r.add(d),i.push(l,u)};d(`key`,22*n.keySize,16*n.keySize,3.2,[-11,8,12],l),d(`overhead`,30,20,1.3,[0,18,2],c),d(`strip`,5,26,6.5,[16,2,4],c),d(`rim`,5,26,4.5,[-16,1,-5],c),d(`rear`,20,12,2,[4,7,-16],l),d(`fill`,30,18,.85,[-4,4,26],u),d(`bounce`,26,8,.6,[3,-6,18],c),d(`sweep`,56,56,.55,[0,-14,3],c);let f=new Ef(e),p=f.fromScene(r,.035).texture;f.dispose();for(let e of i)e.dispose();return p}function zp(e,t){let n=document.createElement(`canvas`);return n.width=e,n.height=t,[n,n.getContext(`2d`)]}function Bp(e,t,n){let[r,i]=zp(e,t);if(i){let r=i.createLinearGradient(0,0,0,t);for(let[e,t]of n)r.addColorStop(e,t);i.fillStyle=r,i.fillRect(0,0,e,t)}let a=new sc(r);return a.colorSpace=_a,a}function Vp(e,t){let[n,r]=zp(128,128);if(r){let n=r.createImageData(128,128),i=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)};for(let r=0;r<128;r++)for(let a=0;a<128;a++){let o=(a+.5)/128,s=(r+.5)/128,c=i(0,t,Math.min(o,1-o,s,1-s));e===`top`&&(c*=.35+.65*(1-s)),e===`left`&&(c*=.3+.7*(1-o));let l=Math.round(c*255),u=(r*128+a)*4;n.data[u]=n.data[u+1]=n.data[u+2]=l,n.data[u+3]=255}r.putImageData(n,0,0)}return new sc(n)}var Hp=n((()=>{Sp(),Lp()}));function Up(e,t){let n=new Il(16777215,.6);n.position.set(.6,30,1.2),n.castShadow=!0,n.shadow.mapSize.set(512,512),Object.assign(n.shadow.camera,{left:-12,right:12,top:12,bottom:-12,near:1,far:60}),n.shadow.radius=28,n.shadow.blurSamples=25,n.shadow.bias=-5e-4,e.add(n,n.target);let r=new Uc({opacity:.22}),i=new $s(new zc(80,80),r);return i.rotation.x=-Math.PI/2,i.position.y=t,i.receiveShadow=!0,e.add(i),{light:n,ground:i,setY(e){i.position.y=e},setOpacity(e){r.opacity=e},setVisible(e){i.visible=e},fit(e){let t=Math.max(4,e*1.3),r=n.shadow.camera;r.right!==t&&(Object.assign(r,{left:-t,right:t,top:t,bottom:-t,far:Math.max(60,t*6)}),n.position.set(.6,Math.max(30,t*2.5),1.2),r.updateProjectionMatrix(),i.scale.setScalar(Math.max(1,t/10)))},dispose(){e.remove(n,n.target,i),i.geometry.dispose(),r.dispose(),n.dispose()}}}var Wp=n((()=>{Sp()}));function Gp(e){let t=new Map,n=new Xa(Kp,Kp,{type:ii}),r=new Uint8Array(64),i=new qc({uniforms:{map:{value:null}},vertexShader:`
|
|
4266
4266
|
varying vec2 vUv;
|
|
4267
4267
|
void main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }
|
|
4268
4268
|
`,fragmentShader:`
|
|
4269
4269
|
uniform sampler2D map;
|
|
4270
4270
|
varying vec2 vUv;
|
|
4271
4271
|
void main() {
|
|
4272
|
-
vec2 cell = vec2(${(1/
|
|
4273
|
-
vec2 origin = floor(vUv * ${
|
|
4272
|
+
vec2 cell = vec2(${(1/Kp).toFixed(4)});
|
|
4273
|
+
vec2 origin = floor(vUv * ${Kp.toFixed(1)}) * cell;
|
|
4274
4274
|
vec3 sum = vec3(0.0);
|
|
4275
4275
|
for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++) {
|
|
4276
4276
|
sum += texture2D(map, origin + (vec2(x, y) + 0.5) * cell / 4.0).rgb;
|
|
@@ -4278,12 +4278,12 @@ void main() {
|
|
|
4278
4278
|
// sqrt keeps precision in the darks through the 8-bit target.
|
|
4279
4279
|
gl_FragColor = vec4(sqrt(sum / 16.0), 1.0);
|
|
4280
4280
|
}
|
|
4281
|
-
`,depthTest:!1,depthWrite:!1}),a=new
|
|
4281
|
+
`,depthTest:!1,depthWrite:!1}),a=new $s(new zc(2,2),i);a.frustumCulled=!1;let o=new Io;o.add(a);let s=new Pl(-1,1,1,-1,0,1);function c(t,a){i.uniforms.map.value=t;let c=e.getRenderTarget();e.setRenderTarget(n),e.render(o,s),e.readRenderTargetPixels(n,0,0,Kp,Kp,r),e.setRenderTarget(c);let l=0,u=0,d=0;for(let e=0;e<r.length;e+=4)l+=(r[e]/255)**2,u+=(r[e+1]/255)**2,d+=(r[e+2]/255)**2;a.setRGB(l/16,u/16,d/16,va)}function l(e){let n=t.get(e);if(n)return n;let r=e.mesh.geometry;r.computeBoundingBox();let i=r.boundingBox,a=i.max.x-i.min.x,o=i.max.y-i.min.y,s=(i.max.x+i.min.x)/2,c=(i.max.y+i.min.y)/2,l=i.max.z+.05,u=[];for(let t of[-o/4,o/4]){let n=new Nl(16777215,0,0,Na.degToRad(88),1,2);n.position.set(s,c+t,l),n.target.position.set(s,c+t,l+10),e.mesh.add(n,n.target),u.push(n)}return n={surface:e,lights:u,area:a*o,color:new Po(0,0,0),measured:``},t.set(e,n),n}function u(e){for(let t of e.lights)t.parent?.remove(t,t.target),t.dispose()}return{update(e,n){let r=new Set(e.map(e=>e.surface));for(let[e,n]of t)r.has(e)||(u(n),t.delete(e));if(!(n<=0&&t.size===0))for(let{surface:t,texture:r}of e){let e=l(t),i=r?`${r.uuid}:${r.version}`:``;i!==e.measured&&(e.measured=i,r?c(r,e.color):e.color.setRGB(0,0,0));let a=n*e.area*1.2;for(let t of e.lights)t.color.copy(e.color),t.intensity=a,t.visible=n>0}},dispose(){for(let e of t.values())u(e);t.clear(),n.dispose(),i.dispose(),a.geometry.dispose()}}}var Kp,qp=n((()=>{Sp(),Kp=4}));function Jp(e){return sm(e.fisheye)>0||sm(e.chromatic)>0||sm(e.vignette)>0||sm(e.bloom)>0||sm(e.grain)>0||sm(e.blur)>0||sm(e.fade)>0}function Yp(e,t=4){let n=1,r=1,i=1,a=new cc(1,1,ui),o=new Xa(1,1,{type:di,colorSpace:va,samples:t,depthBuffer:!0,depthTexture:a}),s=new Xa(1,1,{type:ii,samples:t,depthBuffer:!0}),c=new Vs({color:0}),l=new Vs({color:16777215}),u=new Xa(1,1,{type:di,colorSpace:va,depthBuffer:!1,count:2}),d=[];for(let e=0;e<rm;e++)d.push(new Xa(1,1,{type:di,colorSpace:va,depthBuffer:!1}));let f=new qc({glslVersion:Ca,depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{tColor:{value:o.texture},tMask:{value:s.texture},tDepth:{value:a},texel:{value:new J(1,1)},camNear:{value:1},camFar:{value:100},focus:{value:1},maxCoc:{value:0}},vertexShader:cm,fragmentShader:`
|
|
4282
4282
|
uniform sampler2D tColor;
|
|
4283
4283
|
uniform sampler2D tMask;
|
|
4284
4284
|
uniform sampler2D tDepth;
|
|
4285
4285
|
uniform vec2 texel; // 1 / full-resolution size
|
|
4286
|
-
${
|
|
4286
|
+
${lm}
|
|
4287
4287
|
varying vec2 vUv;
|
|
4288
4288
|
layout(location = 0) out highp vec4 outColor;
|
|
4289
4289
|
layout(location = 1) out highp vec4 outMask;
|
|
@@ -4308,8 +4308,8 @@ void main() {
|
|
|
4308
4308
|
vec2 macc = m0;
|
|
4309
4309
|
float wsum = 1.0;
|
|
4310
4310
|
// Small blurs need few taps; only wide ones pay for the full disc.
|
|
4311
|
-
float taps = clamp(8.0 + c0 * 0.7, 8.0, float(${
|
|
4312
|
-
const int N = ${
|
|
4311
|
+
float taps = clamp(8.0 + c0 * 0.7, 8.0, float(${im}));
|
|
4312
|
+
const int N = ${im};
|
|
4313
4313
|
for (int i = 0; i < N; i++) {
|
|
4314
4314
|
if (float(i) >= taps) break;
|
|
4315
4315
|
float r = sqrt((float(i) + 0.5) / taps);
|
|
@@ -4328,7 +4328,7 @@ void main() {
|
|
|
4328
4328
|
outColor = acc / wsum;
|
|
4329
4329
|
outMask = vec4(macc / wsum, 0.0, 1.0);
|
|
4330
4330
|
}
|
|
4331
|
-
`}),p=new
|
|
4331
|
+
`}),p=new qc({depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{tSrc:{value:o.texture},tSrcMask:{value:s.texture},texel:{value:new J(1,1)},threshold:{value:em},knee:{value:tm}},vertexShader:cm,fragmentShader:`
|
|
4332
4332
|
uniform sampler2D tSrc;
|
|
4333
4333
|
uniform sampler2D tSrcMask; // r: exact pixel, g: display
|
|
4334
4334
|
uniform vec2 texel; // of the source
|
|
@@ -4354,7 +4354,7 @@ void main() {
|
|
|
4354
4354
|
+ bright(vUv + texel * vec2( 1.0, 1.0));
|
|
4355
4355
|
gl_FragColor = vec4(s * 0.25, 1.0);
|
|
4356
4356
|
}
|
|
4357
|
-
`}),m=new
|
|
4357
|
+
`}),m=new qc({depthTest:!1,depthWrite:!1,toneMapped:!1,uniforms:{tSrc:{value:null},texel:{value:new J(1,1)}},vertexShader:cm,fragmentShader:`
|
|
4358
4358
|
uniform sampler2D tSrc;
|
|
4359
4359
|
uniform vec2 texel; // of the source
|
|
4360
4360
|
varying vec2 vUv;
|
|
@@ -4366,7 +4366,7 @@ void main() {
|
|
|
4366
4366
|
s += texture2D(tSrc, vUv + texel * vec2( 1.0, 1.0)).rgb;
|
|
4367
4367
|
gl_FragColor = vec4(s * 0.125, 1.0);
|
|
4368
4368
|
}
|
|
4369
|
-
`}),h=new
|
|
4369
|
+
`}),h=new qc({depthTest:!1,depthWrite:!1,toneMapped:!1,blending:5,blendEquation:100,blendSrc:201,blendDst:201,blendSrcAlpha:200,blendDstAlpha:201,uniforms:{tSrc:{value:null},texel:{value:new J(1,1)}},vertexShader:cm,fragmentShader:`
|
|
4370
4370
|
uniform sampler2D tSrc;
|
|
4371
4371
|
uniform vec2 texel; // of the (smaller) source
|
|
4372
4372
|
varying vec2 vUv;
|
|
@@ -4382,7 +4382,7 @@ void main() {
|
|
|
4382
4382
|
s += texture2D(tSrc, vUv + vec2( h.x, h.y)).rgb * 2.0;
|
|
4383
4383
|
gl_FragColor = vec4(s / 12.0, 1.0);
|
|
4384
4384
|
}
|
|
4385
|
-
`}),g=new
|
|
4385
|
+
`}),g=new qc({depthTest:!1,depthWrite:!1,uniforms:{tColor:{value:o.texture},tMask:{value:s.texture},tDepth:{value:a},tDofColor:{value:u.textures[0]},tDofMask:{value:u.textures[1]},tBloom:{value:d[0].texture},overscan:{value:1},aspect:{value:1},barrel:{value:0},chromatic:{value:0},vignette:{value:0},dofOn:{value:0},bloomAmount:{value:0},grain:{value:0},frame:{value:0},fade:{value:0},camNear:{value:1},camFar:{value:100},focus:{value:1},maxCoc:{value:0}},vertexShader:cm,fragmentShader:`
|
|
4386
4386
|
// three injects <common> and the tone-mapping functions into every program prefix.
|
|
4387
4387
|
uniform sampler2D tColor;
|
|
4388
4388
|
uniform sampler2D tMask;
|
|
@@ -4400,7 +4400,7 @@ void main() {
|
|
|
4400
4400
|
uniform float grain;
|
|
4401
4401
|
uniform float frame;
|
|
4402
4402
|
uniform float fade;
|
|
4403
|
-
${
|
|
4403
|
+
${lm}
|
|
4404
4404
|
varying vec2 vUv;
|
|
4405
4405
|
|
|
4406
4406
|
// Normalised so r = 1 at the frame corners.
|
|
@@ -4473,13 +4473,13 @@ void main() {
|
|
|
4473
4473
|
gl_FragColor = vec4(rgb, alpha);
|
|
4474
4474
|
#include <colorspace_fragment>
|
|
4475
4475
|
}
|
|
4476
|
-
`}),_=new
|
|
4476
|
+
`}),_=new $s(new zc(2,2),g);_.frustumCulled=!1;let v=new Io;v.add(_);let y=new Pl(-1,1,1,-1,0,1);function b(t,n){_.material=t,e.setRenderTarget(n),e.render(v,y)}let x=2;function S(){u.setSize(Math.max(1,Math.ceil(o.width/x)),Math.max(1,Math.ceil(o.height/x)))}function C(e){let t=Math.ceil(e/.04)*.04,a=Math.max(1,Math.round(n*t)),c=Math.max(1,Math.round(r*t));(t!==i||o.width!==a||o.height!==c)&&(i=t,o.setSize(a,c),s.setSize(a,c),S(),d.forEach((e,t)=>{let n=2**(t+1);e.setSize(Math.max(1,Math.ceil(a/n)),Math.max(1,Math.ceil(c/n)))}))}let w=new J;return{setSize(e,t){n=e,r=t,C(i)},render(t,a,_,v,y,T=[],E=0){let D=sm(y.fisheye),O=sm(y.chromatic),k=sm(y.vignette),A=Math.min(1,sm(y.bloom)),j=Math.min(1,sm(y.grain)),M=Math.min(1,sm(y.blur)),N=Math.min(1,sm(y.fade)),P=sm(y.focus),F=M>0&&P>0,I=Zp*D;C(1+I+Qp*O+.005);let ee=a.fov;a.fov=2*Math.atan(Math.tan(ee*Xp/2)*i)/Xp,a.updateProjectionMatrix(),o.resolveDepthBuffer=F,e.setRenderTarget(o),e.clear(),_.render(e,v),e.render(t,a);let te=e.shadowMap.autoUpdate;e.shadowMap.autoUpdate=!1,e.setRenderTarget(s),e.setClearColor(16711680,1),e.clear();let ne=T.filter(e=>e.visible);for(let e of ne)e.visible=!1;t.overrideMaterial=c,e.render(t,a),a.layers.set(1),t.overrideMaterial=l,e.render(t,a),a.layers.set(0),t.overrideMaterial=null;for(let e of ne)e.visible=!0;e.setClearColor(0,0),e.shadowMap.autoUpdate=te,a.fov=ee,a.updateProjectionMatrix();let re=M*$p*r;if(F){let e=re>=am?4:2;e!==x&&(x=e,S());let t=f.uniforms;w.set(1/o.width,1/o.height),t.texel.value.copy(w),t.camNear.value=a.near,t.camFar.value=a.far,t.focus.value=P,t.maxCoc.value=re,b(f,u)}if(A>0){let e=p.uniforms;e.tSrc.value=F?u.textures[0]:o.texture,e.tSrcMask.value=F?u.textures[1]:s.texture;let t=F?u:o;e.texel.value.set(1/t.width,1/t.height),b(p,d[0]);for(let e=1;e<rm;e++){let t=d[e-1];m.uniforms.tSrc.value=t.texture,m.uniforms.texel.value.set(1/t.width,1/t.height),b(m,d[e])}for(let e=3;e>=0;e--){let t=d[e+1];h.uniforms.tSrc.value=t.texture,h.uniforms.texel.value.set(1/t.width,1/t.height),b(h,d[e])}}let L=g.uniforms;L.overscan.value=i,L.aspect.value=n/r,L.barrel.value=I,L.chromatic.value=Qp*O,L.vignette.value=k,L.dofOn.value=+!!F,L.camNear.value=a.near,L.camFar.value=a.far,L.focus.value=P,L.maxCoc.value=re,L.bloomAmount.value=A*nm,L.grain.value=j,L.frame.value=Math.floor(Math.max(0,E)*om+1e-6),L.fade.value=N,e.setRenderTarget(null),e.clear(),b(g,null)},dispose(){o.dispose(),a.dispose(),s.dispose(),u.dispose();for(let e of d)e.dispose();c.dispose(),l.dispose(),_.geometry.dispose(),g.dispose(),f.dispose(),p.dispose(),m.dispose(),h.dispose()}}}var Xp,Zp,Qp,$p,em,tm,nm,rm,im,am,om,sm,cm,lm,um=n((()=>{Sp(),Xp=Math.PI/180,Zp=.25,Qp=.012,$p=.016,em=.7,tm=.3,nm=.9,rm=5,im=24,am=12,om=24,sm=e=>typeof e==`number`&&e>0?e:0,cm=`
|
|
4477
4477
|
varying vec2 vUv;
|
|
4478
4478
|
void main() {
|
|
4479
4479
|
vUv = uv;
|
|
4480
4480
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
4481
4481
|
}
|
|
4482
|
-
`,
|
|
4482
|
+
`,lm=`
|
|
4483
4483
|
uniform float camNear;
|
|
4484
4484
|
uniform float camFar;
|
|
4485
4485
|
uniform float focus;
|
|
@@ -4493,7 +4493,7 @@ void main() {
|
|
|
4493
4493
|
float cocOf(float d) {
|
|
4494
4494
|
return maxCoc * clamp(abs(1.0 - focus / viewZ(d)), 0.0, 1.0);
|
|
4495
4495
|
}
|
|
4496
|
-
`}));function
|
|
4496
|
+
`}));function dm(e,t,n,r,i,a){let o=2*Math.PI*i/4,s=Math.max(a-2*i,0),c=Math.PI/4;fm.copy(t),fm[r]=0,fm.normalize();let l=.5*o/(o+s),u=1-fm.angleTo(e)/c;return Math.sign(fm[n])===1?u*l:s/(o+s)+l+l*(1-u)}var fm,pm,mm=n((()=>{Sp(),fm=new Y,pm=class e extends dc{constructor(e=1,t=1,n=1,r=2,i=.1){let a=r*2+1;if(i=Math.min(e/2,t/2,n/2,i),super(1,1,1,a,a,a),this.type=`RoundedBoxGeometry`,this.parameters={width:e,height:t,depth:n,segments:r,radius:i},a===1)return;let o=this.toNonIndexed();this.index=null,this.attributes.position=o.attributes.position,this.attributes.normal=o.attributes.normal,this.attributes.uv=o.attributes.uv;let s=new Y,c=new Y,l=new Y(e,t,n).divideScalar(2).subScalar(i),u=this.attributes.position.array,d=this.attributes.normal.array,f=this.attributes.uv.array,p=u.length/6,m=new Y,h=.5/a;for(let r=0,a=0;r<u.length;r+=3,a+=2)switch(s.fromArray(u,r),c.copy(s),c.x-=Math.sign(c.x)*h,c.y-=Math.sign(c.y)*h,c.z-=Math.sign(c.z)*h,c.normalize(),u[r+0]=l.x*Math.sign(s.x)+c.x*i,u[r+1]=l.y*Math.sign(s.y)+c.y*i,u[r+2]=l.z*Math.sign(s.z)+c.z*i,d[r+0]=c.x,d[r+1]=c.y,d[r+2]=c.z,Math.floor(r/p)){case 0:m.set(1,0,0),f[a+0]=dm(m,c,`z`,`y`,i,n),f[a+1]=1-dm(m,c,`y`,`z`,i,t);break;case 1:m.set(-1,0,0),f[a+0]=1-dm(m,c,`z`,`y`,i,n),f[a+1]=1-dm(m,c,`y`,`z`,i,t);break;case 2:m.set(0,1,0),f[a+0]=1-dm(m,c,`x`,`z`,i,e),f[a+1]=dm(m,c,`z`,`x`,i,n);break;case 3:m.set(0,-1,0),f[a+0]=1-dm(m,c,`x`,`z`,i,e),f[a+1]=1-dm(m,c,`z`,`x`,i,n);break;case 4:m.set(0,0,1),f[a+0]=1-dm(m,c,`x`,`y`,i,e),f[a+1]=1-dm(m,c,`y`,`x`,i,t);break;case 5:m.set(0,0,-1),f[a+0]=dm(m,c,`x`,`y`,i,e),f[a+1]=1-dm(m,c,`y`,`x`,i,t)}}static fromJSON(t){return new e(t.width,t.height,t.depth,t.segments,t.radius)}}}));function hm(e){let t=new Yc({color:e,roughness:.72,metalness:0});return t.onBeforeCompile=e=>{e.vertexShader=e.vertexShader.replace(`#include <common>`,`#include <common>
|
|
4497
4497
|
attribute float aCavity;
|
|
4498
4498
|
varying float vCavity;
|
|
4499
4499
|
varying vec3 vStonePos;`).replace(`#include <begin_vertex>`,`#include <begin_vertex>
|
|
@@ -4501,7 +4501,7 @@ void main() {
|
|
|
4501
4501
|
vStonePos = position;`),e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>
|
|
4502
4502
|
varying float vCavity;
|
|
4503
4503
|
varying vec3 vStonePos;
|
|
4504
|
-
${
|
|
4504
|
+
${gm}
|
|
4505
4505
|
vec3 hash3(vec3 p) {
|
|
4506
4506
|
p = vec3(dot(p, vec3(127.1, 311.7, 74.7)), dot(p, vec3(269.5, 183.3, 246.1)), dot(p, vec3(113.5, 271.9, 124.6)));
|
|
4507
4507
|
return fract(sin(p) * 43758.5453123);
|
|
@@ -4590,7 +4590,7 @@ void main() {
|
|
|
4590
4590
|
normal = stonePerturb(-vViewPosition, normal, stoneH * 0.5, faceDirection);`).replace(`#include <aomap_fragment>`,`#include <aomap_fragment>
|
|
4591
4591
|
float stoneAO = mix(1.0, 0.35, crease) * (1.0 - 0.4 * stoneD.y);
|
|
4592
4592
|
reflectedLight.indirectDiffuse *= stoneAO;
|
|
4593
|
-
reflectedLight.indirectSpecular *= stoneAO;`)},t.customProgramCacheKey=()=>`openmockup-stone-13`,t}var
|
|
4593
|
+
reflectedLight.indirectSpecular *= stoneAO;`)},t.customProgramCacheKey=()=>`openmockup-stone-13`,t}var gm,_m=n((()=>{Sp(),gm=`
|
|
4594
4594
|
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
4595
4595
|
vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
|
|
4596
4596
|
vec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }
|
|
@@ -4637,11 +4637,11 @@ float snoise(vec3 v) {
|
|
|
4637
4637
|
m = m * m;
|
|
4638
4638
|
return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
|
4639
4639
|
}
|
|
4640
|
-
`}));function
|
|
4640
|
+
`}));function vm(e){let t=new Yc({color:e,roughness:.9,metalness:0});return t.onBeforeCompile=e=>{e.vertexShader=e.vertexShader.replace(`#include <common>`,`#include <common>
|
|
4641
4641
|
varying vec3 vConcretePos;`).replace(`#include <begin_vertex>`,`#include <begin_vertex>
|
|
4642
4642
|
vConcretePos = position;`),e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>
|
|
4643
4643
|
varying vec3 vConcretePos;
|
|
4644
|
-
${
|
|
4644
|
+
${gm}
|
|
4645
4645
|
float lod(float wavelength, float footprint) {
|
|
4646
4646
|
return 1.0 - smoothstep(wavelength * 0.12, wavelength * 0.45, footprint);
|
|
4647
4647
|
}
|
|
@@ -4676,17 +4676,17 @@ float snoise(vec3 v) {
|
|
|
4676
4676
|
normal = concretePerturb(-vViewPosition, normal, concreteH, faceDirection);`).replace(`#include <aomap_fragment>`,`#include <aomap_fragment>
|
|
4677
4677
|
float concreteRoom = 0.1 * (1.0 - 0.5 * concreteHoles);
|
|
4678
4678
|
reflectedLight.indirectDiffuse *= concreteRoom;
|
|
4679
|
-
reflectedLight.indirectSpecular *= concreteRoom;`)},t.customProgramCacheKey=()=>`openmockup-concrete-4`,t}var vm=n((()=>{xp(),gm()}));function ym({color:e,subject:t}){let n=new Do;n.name=`set:block`;let r=_m(e),i=t.getCenter(new Y),a=t.getSize(new Y),o=Math.max(a.x*3,90),s=Math.max(a.z*2.4,60),c=Math.max(a.y*6,o),l=t.min.x+a.x*.3,u=t.max.z+.6,d=t.min.y,f=new fm(o,c,s,3,.35),p=new Qs(f,r);p.position.set(l+o/2,d-c/2,u-s/2),p.castShadow=!1,p.receiveShadow=!0,n.add(p);let m=Math.max(a.length()*3.2,110),h=new Ml(16184818,1,m*4,.62,.85,2);h.position.set(i.x-m,i.y+m*.25,u-m*.12),h.target.position.set(l,d-a.y,u),h.castShadow=!0,h.shadow.mapSize.set(2048,2048),h.shadow.camera.near=m*.3,h.shadow.camera.far=m*3,h.shadow.radius=6,h.shadow.blurSamples=16,h.shadow.bias=-2e-4,h.shadow.normalBias=.3;let g=new Ml(14673134,1,m*4,.8,1,2);g.position.set(i.x-m*.3,i.y-m*.2,i.z+m*1.2),g.target.position.set(l,d-a.y,u),n.add(h,h.target,g,g.target);let _=h.position.distanceTo(h.target.position),v=g.position.distanceTo(g.target.position);return{group:n,update(e,t){r.color.set(e.color),h.intensity=4*_*_*t,g.intensity=.12*v*v*t},dispose(){f.dispose(),r.dispose(),h.shadow.map?.dispose(),h.dispose(),g.dispose()}}}var bm=n((()=>{xp(),pm(),vm()}));function xm(e){let t=e*2654435761>>>0||1;return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function Sm(e){let t=xm(e),n=new Uint8Array(256);for(let e=0;e<256;e++)n[e]=e;for(let e=255;e>0;e--){let r=Math.floor(t()*(e+1)),i=n[e];n[e]=n[r],n[r]=i}let r=new Uint8Array(512),i=new Uint8Array(512);for(let e=0;e<512;e++)r[e]=n[e&255],i[e]=r[e]%12;return(e,t,n)=>{let a=(e+t+n)*Em,o=Math.floor(e+a),s=Math.floor(t+a),c=Math.floor(n+a),l=(o+s+c)*Dm,u=e-(o-l),d=t-(s-l),f=n-(c-l),p=0,m=0,h=0,g=0,_=0,v=0;u>=d?d>=f?(p=1,g=1,_=1):u>=f?(p=1,g=1,v=1):(h=1,g=1,v=1):d<f?(h=1,_=1,v=1):u<f?(m=1,_=1,v=1):(m=1,g=1,_=1);let y=u-p+Dm,b=d-m+Dm,x=f-h+Dm,S=u-g+2*Dm,C=d-_+2*Dm,w=f-v+2*Dm,T=u-1+3*Dm,E=d-1+3*Dm,D=f-1+3*Dm,O=o&255,k=s&255,A=c&255,j=Cm(i[O+r[k+r[A]]],u,d,f),M=Cm(i[O+p+r[k+m+r[A+h]]],y,b,x),N=Cm(i[O+g+r[k+_+r[A+v]]],S,C,w),P=Cm(i[O+1+r[k+1+r[A+1]]],T,E,D);return 32*(j+M+N+P)}}function Cm(e,t,n,r){let i=.6-t*t-n*n-r*r;if(i<0)return 0;i*=i;let a=e*3;return i*i*(Tm[a]*t+Tm[a+1]*n+Tm[a+2]*r)}function wm(e,t,n,r,i,a=.5){let o=0,s=1,c=1,l=0;for(let u=0;u<i;u++)o+=s*e(t*c,n*c,r*c),l+=s,s*=a,c*=2;return o/l}var Tm,Em,Dm,Om=n((()=>{Tm=new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),Em=1/3,Dm=1/6}));function km({seed:e,size:t,detail:n=5,sides:r=6,notches:i,relief:a=1,shape:o=`pillar`,color:s}){let c=xm(e),l=Sm(e),u=new Y(t[0]/2,t[1]/2,t[2]/2),d=Math.hypot(...t),f=Math.min(u.x,u.z)*.03+.12,p=[],m=c()*Math.PI*2;for(let e=0;e<r;e++){let t=m+(e+(c()-.5)*.5)/r*Math.PI*2,n=o===`boulder`?(c()-.5)*1.6:(c()-.5)*.08,i=new Y(Math.cos(t),n,Math.sin(t)).normalize(),a=Math.hypot(i.x*u.x,i.z*u.z);p.push({n:i,d:a*(.86+c()*.1)})}let h=Array.from({length:2+Math.floor(c()*3)},()=>(c()*1.5-.75)*u.y).sort((e,t)=>e-t),g=p.map(()=>h.map(()=>c()<.65?-(c()*.16):c()*.06)),_=c()*Math.PI,v=new Y(Math.cos(_),0,Math.sin(_)),y=(c()-.5)*Math.min(u.x,u.z)*.6,b=p.map(()=>-(c()*.12)),x=p.length;p.push({n:new Y(c()-.5,2.2,c()-.5).normalize(),d:u.y*.92}),p.push({n:new Y((c()-.5)*.3,-1,(c()-.5)*.3).normalize(),d:u.y});let S=1+Math.floor(c()*2);for(let e=0;e<S;e++){let e=c()*Math.PI*2,t=new Y(Math.cos(e)*.55,-.85,Math.sin(e)*.55).normalize();p.push({n:t,d:Math.hypot(t.x*u.x,t.y*u.y,t.z*u.z)*.72})}let C=16+Math.floor(c()*8);for(let e=0;e<C;e++){let e=new Y(c()*2-1,c()*2-1,c()*2-1).normalize(),t=Math.abs(e.x)*u.x+Math.abs(e.y)*u.y+Math.abs(e.z)*u.z;p.push({n:e,d:t*(.78+c()*.12)})}let w=[],T=i??Math.round(t[1]/18+c()*3);for(let e=0;e<T;e++){let e=p[Math.floor(c()*r)],t=(c()*1.6-.8)*u.y,n=c()<.5?-1:1,i=new Y(-e.n.z,0,e.n.x).multiplyScalar(n*(.45+c()*.4)*Math.min(u.x,u.z)),a=e.n.clone().setY(0).normalize().multiplyScalar(e.d).add(i).setY(t),o=Math.min(u.x,u.z)*(.12+c()*.18);w.push({center:a,half:new Y(Math.min(u.x,u.z)*(.25+c()*.45),u.y*(.04+c()*.12),o),yaw:Math.atan2(e.n.x,e.n.z)+(c()-.5)*.2})}let E=new Float64Array(p.length*4);p.forEach((e,t)=>E.set([e.n.x,e.n.y,e.n.z,e.d],t*4));let D=new Float64Array(x*h.length);for(let e=0;e<x;e++)for(let t=0;t<h.length;t++)D[e*h.length+t]=g[e][t]*p[e].d;let O=Float64Array.from(b,(e,t)=>e*p[t].d),k=new Float64Array(w.length*8);w.forEach((e,t)=>k.set([e.center.x,e.center.y,e.center.z,Math.cos(-e.yaw),Math.sin(-e.yaw),e.half.x,e.half.y,e.half.z],t*8));let A=new Float64Array(h.length),j=v.x,M=v.z,N=(e,t,n)=>{let r=Am(-f*.4,f*.4,e*j+n*M-y);for(let e=0;e<h.length;e++)A[e]=Am(-f*.3,f*.3,t-h[e]);let i=-1/0;for(let a=0;a<p.length;a++){let o=a*4,s=0;if(a<x){for(let e=0;e<h.length;e++)s+=D[a*h.length+e]*A[e];s+=O[a]*r}i=jm(i,e*E[o]+t*E[o+1]+n*E[o+2]-(E[o+3]+s),f)}for(let r=0;r<w.length;r++){let a=r*8,o=e-k[a],s=t-k[a+1],c=n-k[a+2],l=k[a+3],u=k[a+4],d=Math.abs(o*l+c*u)-k[a+5],p=Math.abs(s)-k[a+6],m=Math.abs(-o*u+c*l)-k[a+7],h=d>0?d:0,g=p>0?p:0,_=m>0?m:0,v=Math.min(Math.max(d,p,m),0)+Math.sqrt(h*h+g*g+_*_);i=jm(i,-v,f*.6)}let o=e/d,s=t/d,c=n/d;return i-=wm(l,o*2.2,s*2.2,c*2.2,3,.5)*d*.007*a,i-=wm(l,o*9+7.1,s*9+3.3,c*9-2.2,2,.5)*d*.004*a,i},P=e=>N(e.x,e.y,e.z),{positions:F,indices:I}=Nm(n),ee=F.length/3,te=new Y,ne=new Y,re=u.length()*1.5;for(let e=0;e<ee;e++){te.fromArray(F,e*3).multiply(u).normalize();let t=re,n=re;for(let e=0;e<200&&t>0;e++){let e=P(ne.copy(te).multiplyScalar(t));if(e<0)break;n=t,t-=Math.max(e*.8,.3)}let r=Math.max(t,0),i=n;for(let e=0;e<9;e++){let e=(r+i)/2;P(ne.copy(te).multiplyScalar(e))<0?r=e:i=e}ne.copy(te).multiplyScalar((r+i)/2).toArray(F,e*3)}Mm(F,I,P,4);let L=new Os;L.setAttribute(`position`,new ps(F,3)),L.setIndex(new ps(I,1)),L.computeVertexNormals(),L.setAttribute(`aCavity`,new ps(Pm(L),1)),L.computeBoundingBox(),L.computeBoundingSphere();let R=s===void 0?null:mm(s),ie=new Qs(L,R??void 0);return ie.castShadow=!0,ie.receiveShadow=!0,{mesh:ie,dispose(){L.dispose(),R?.dispose()}}}function Am(e,t,n){let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)}function jm(e,t,n){if(e===-1/0)return t;let r=Math.min(1,Math.max(0,.5-.5*(t-e)/n));return t+(e-t)*r+n*r*(1-r)}function Mm(e,t,n,r){let i=e.length/3,a=Array.from({length:i},()=>[]);for(let e=0;e<t.length;e+=3)for(let n=0;n<3;n++){let r=t[e+n],i=t[e+(n+1)%3];a[r].includes(i)||a[r].push(i),a[i].includes(r)||a[i].push(r)}let o=new Y,s=new Y,c=new Y,l=.05,u=new Float32Array(e.length);for(let t=0;t<r;t++){for(let t=0;t<i;t++){let r=0,i=0,d=0;for(let n of a[t])r+=e[n*3],i+=e[n*3+1],d+=e[n*3+2];let f=a[t].length;o.set(e[t*3]*.4+r/f*.6,e[t*3+1]*.4+i/f*.6,e[t*3+2]*.4+d/f*.6);for(let e=0;e<2;e++){let e=n(o);s.set(n(c.set(o.x+l,o.y,o.z))-e,n(c.set(o.x,o.y+l,o.z))-e,n(c.set(o.x,o.y,o.z+l))-e).divideScalar(l);let t=s.lengthSq();if(t<1e-8)break;o.addScaledVector(s,-e/t)}o.toArray(u,t*3)}e.set(u)}}function Nm(e){let t=(1+Math.sqrt(5))/2,n=[-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];for(let e=0;e<n.length;e+=3){let t=Math.hypot(n[e],n[e+1],n[e+2]);n[e]/=t,n[e+1]/=t,n[e+2]/=t}for(let t=0;t<e;t++){let e=new Map,t=(t,r)=>{let i=t<r?t*1e7+r:r*1e7+t,a=e.get(i);if(a!==void 0)return a;let o=n[t*3]+n[r*3],s=n[t*3+1]+n[r*3+1],c=n[t*3+2]+n[r*3+2],l=Math.hypot(o,s,c);n.push(o/l,s/l,c/l);let u=n.length/3-1;return e.set(i,u),u},i=[];for(let e=0;e<r.length;e+=3){let n=r[e],a=r[e+1],o=r[e+2],s=t(n,a),c=t(a,o),l=t(o,n);i.push(n,s,l,a,c,s,o,l,c,s,c,l)}r=i}return{positions:new Float32Array(n),indices:new Uint32Array(r)}}function Pm(e){let t=e.getAttribute(`position`),n=e.getAttribute(`normal`),r=e.getIndex(),i=t.count,a=Array.from({length:i},()=>new Set);for(let e=0;e<r.count;e+=3){let t=r.getX(e),n=r.getX(e+1),i=r.getX(e+2);a[t].add(n).add(i),a[n].add(t).add(i),a[i].add(t).add(n)}let o=new Float32Array(i);for(let e=0;e<i;e++){let r=0,i=0,s=0,c=0,l=t.getX(e),u=t.getY(e),d=t.getZ(e);for(let n of a[e])r+=t.getX(n),i+=t.getY(n),s+=t.getZ(n),c+=Math.hypot(t.getX(n)-l,t.getY(n)-u,t.getZ(n)-d);let f=a[e].size||1,p=((r/f-l)*n.getX(e)+(i/f-u)*n.getY(e)+(s/f-d)*n.getZ(e))/(c/f||1);o[e]=p}for(let e=0;e<2;e++){let e=new Float32Array(i);for(let t=0;t<i;t++){let n=o[t];for(let e of a[t])n+=o[e];e[t]=n/(a[t].size+1)}o=e}for(let e=0;e<i;e++)o[e]=Math.min(1,Math.max(0,.5+o[e]*4));return o}var Fm=n((()=>{xp(),Om(),gm()}));function Im({seed:e,color:t,subject:n}){let r=xm(e*7919+13),i=new Do;i.name=`set:crevice`;let a=mm(t),o=[],s=n.getCenter(new Y),c=n.getSize(new Y),l=c.x+Math.max(1.2,c.x*.18)*2,u=Math.max(c.y*4.2,l*6.3),d=l*3.1,f=Math.max(l*3,c.z*6),p=s.y-u*.3;for(let t of[-1,1]){let n=km({seed:e*31+(t<0?1:2),size:[d*(.9+r()*.2),u*(.94+r()*.08),f*(.9+r()*.15)]});n.mesh.material=a;let m=n.mesh;m.rotation.set((r()-.5)*.06,(r()-.5)*.5,-t*(.05+r()*.04)),m.position.set(s.x+t*(l/2+d/2),p+u/2,s.z-f*.28),m.updateMatrixWorld(!0);let h=Lm(m,t,s,c);h!==null&&(m.position.x+=s.x+l/2*t-h),i.add(m),o.push(n)}let m=l*.9;for(let[t,u]of[[-1,-.3],[1,.35]]){let d=km({seed:e*31+(t<0?4:5),size:[l*1.5,c.y*1.3,m],sides:6,notches:1,relief:1.5,detail:4});d.mesh.material=a,d.mesh.rotation.set((r()-.5)*.1,(r()-.5)*.5,-t*(.04+r()*.06)),d.mesh.position.set(s.x+t*(c.x/2+l*.75-.5),s.y+u*c.y,n.max.z+m*.5+.8),d.mesh.updateMatrixWorld(!0);let f=Rm(d.mesh);f!==null&&f<n.max.z+.4&&(d.mesh.position.z+=n.max.z+.4-f),i.add(d.mesh),o.push(d)}let h=km({seed:e*31+3,size:[l*2.2,c.y*.45,f*.55],sides:8,notches:1,relief:2,shape:`boulder`,detail:4});h.mesh.material=a,h.mesh.rotation.set(0,(r()-.5)*.6,(r()-.5)*.15),h.mesh.position.set(s.x,n.min.y,s.z-f*.08),h.mesh.updateMatrixWorld(!0);let g=zm(h.mesh,s,c);g!==null&&(h.mesh.position.y+=n.min.y-.15-g),i.add(h.mesh),o.push(h);let _=u,v=new Ml(15001584,1,_*4,.36,.95,2);v.position.set(s.x-_*.7,s.y+_*1.15,s.z+_*.4),v.target.position.copy(s),v.castShadow=!0,v.shadow.mapSize.set(2048,2048),v.shadow.camera.near=_*.3,v.shadow.camera.far=_*3,v.shadow.radius=3,v.shadow.blurSamples=12,v.shadow.bias=-2e-4,v.shadow.normalBias=.6;let y=new Ml(3364351,1,_*4,.45,.9,2);y.position.set(s.x+_*.7,s.y+_*.35,s.z-_*.55),y.target.position.set(s.x-l,s.y,s.z);let b=new Ml(11122406,1,_*4,.9,1,2);b.position.set(s.x+_*.4,s.y-_*.1,s.z+_*1.1),b.target.position.copy(s),i.add(v,v.target,y,y.target,b,b.target);let x=v.position.distanceTo(s),S=y.position.distanceTo(s),C=b.position.distanceTo(s);return{group:i,update(e,t){a.color.set(e.color),v.intensity=5*x*x*t,y.intensity=.6*S*S*t,b.intensity=.45*C*C*t},dispose(){for(let e of o)e.dispose();a.dispose(),v.shadow.map?.dispose(),v.dispose(),y.dispose(),b.dispose()}}}function Lm(e,t,n,r){let i=e.geometry.getAttribute(`position`),a=null;for(let o=0;o<i.count;o++)Bm.fromBufferAttribute(i,o).applyMatrix4(e.matrixWorld),!(Math.abs(Bm.y-n.y)>r.y*.6||Math.abs(Bm.z-n.z)>Math.max(r.z*2,3))&&(a===null||(t<0?Bm.x>a:Bm.x<a))&&(a=Bm.x);return a}function Rm(e){let t=e.geometry.getAttribute(`position`),n=null;for(let r=0;r<t.count;r++)Bm.fromBufferAttribute(t,r).applyMatrix4(e.matrixWorld),(n===null||Bm.z<n)&&(n=Bm.z);return n}function zm(e,t,n){let r=e.geometry.getAttribute(`position`),i=null;for(let a=0;a<r.count;a++)Bm.fromBufferAttribute(r,a).applyMatrix4(e.matrixWorld),!(Math.abs(Bm.x-t.x)>n.x*.5||Math.abs(Bm.z-t.z)>Math.max(n.z,1))&&(i===null||Bm.y>i)&&(i=Bm.y);return i}var Bm,Vm=n((()=>{xp(),Om(),Fm(),gm(),Bm=new Y}));function Hm(e,t){let n=Um[e];return n?n(t):null}var Um,Wm=n((()=>{bm(),Vm(),Um={crevice:Im,block:ym}}));function Gm(e){return e.kind===`image`&&e.image?JSON.stringify(e.image):null}function Km({canvas:e,alpha:t=!0,quality:n=`preview`}){let r=new bp({canvas:e,antialias:!0,alpha:t}),i=typeof window<`u`?window.devicePixelRatio:1;r.setPixelRatio(n===`export`?1:Math.min(i,2)),r.setClearColor(0,0),r.autoClear=!1,r.toneMapping=7,r.shadowMap.enabled=!0,r.shadowMap.type=3;let a=new Fo,o=`studio`,s=Lp(r,o);a.environment=s;let c=new Al(28,1,5,300);c.position.set(0,1.5,48);let l=Hp(a,-10.5),d=Dp(),f=Jp(r,n===`export`?8:4),p=new Map,m=new Map,h=0,g=Ym,_=Xm,v=null,y=null,b=0,x=new J,S=0,C=null,w=``,T=new Y,E=new Y,D=Wp(r),O=[],k=new Y;function A(e){let t=s;o=e,s=Lp(r,e),a.environment=s,t.dispose(),l.light.shadow.radius=Fp[e].shadow.radius}async function j(e,t){let n=Gm(e);if(n===v)return null;let i=++b,a=null;return e.image&&n&&t.resolveBackdrop&&(a=await Promise.resolve(t.resolveBackdrop(e.image,{maxAnisotropy:r.capabilities.getMaxAnisotropy()})).catch(()=>null)),()=>{if(i!==b)return a?.dispose();y?.dispose(),y=a,v=n,d.setImage(a?.texture??null,a?.aspect)}}function M(){let e=1/0;for(let{build:t,root:n}of p.values()){let r=t.bounds.min.y*n.scale.y+n.position.y;e=Math.min(e,r-(t.restsOnFloor?0:qm))}return Number.isFinite(e)?e:null}function N(){let e=M();e!==null&&l.setY(e);let t=0;for(let{build:e,root:n}of p.values()){let r=new Y;e.bounds.getSize(r),t=Math.max(t,Math.max(r.x,r.y,r.z)/2*n.scale.x+n.position.length())}t>0&&l.fit(t)}function P(){re.forceLensPath||qp(_)?f.render(a,c,d,g,_,[l.ground],S):(r.setRenderTarget(null),r.clear(),d.render(r,g),r.render(a,c))}function F(e,t=`device-${++h}`){let n=new Do,r=new Do;n.add(r),r.add(e.group);for(let t of e.screens)t.mesh.layers.enable(1);a.add(n);let i={id:t,root:n,offset:r,build:e};return p.set(t,i),N(),i}function I(e){let t=p.get(e);t&&(a.remove(t.root),t.build.dispose(),p.delete(e),N())}function ee(){let e=new Xo;for(let{build:t,root:n}of p.values())n.visible&&e.union(t.bounds.clone().applyMatrix4(new Qa().compose(n.position,new Na,n.scale)));return e.isEmpty()?null:e}function te(e){let t=e.set?.kind??`none`,n=t===`none`?null:ee();if(t!==`none`&&!n)return;let r=n?n.getSize(E).toArray().map(e=>e.toFixed(1)).join(`,`):``,i=`${t}:${e.set?.seed}:${r}`;i===w?C&&n&&C.group.position.copy(n.getCenter(E)).sub(T):(w=i,C&&(a.remove(C.group),C.dispose()),C=n?Hm(t,{seed:e.set.seed,color:e.set.color,subject:n}):null,n&&n.getCenter(T),C&&a.add(C.group))}function ne(e,{skipCamera:t=!1}={}){S=e.time;for(let[t,n]of p){let r=e.devices[t];if(!r)n.root.visible=!1;else{n.root.visible=r.visible,n.root.position.set(r.position[0],r.position[1],r.position[2]),n.root.rotation.set(r.rotation[0]*Jm,r.rotation[1]*Jm,r.rotation[2]*Jm),n.root.scale.setScalar(r.scale);for(let[e,t]of Object.entries(r.params))n.build.setParam(e,t);n.build.setGlare(r.glare,r.screenFinish)}}if(t||kp(c,e.camera),_=e.camera.lens,_.blur>0&&!(_.focus>0)){let t=k.set(e.camera.target[0],e.camera.target[1],e.camera.target[2]).distanceTo(c.position);_={..._,focus:t}}g=e.backdrop;let n=Pp(e.environment.preset);n!==o&&A(n),a.environmentIntensity=e.environment.intensity,a.environmentRotation.y=e.environment.rotation*Jm;let r=Math.min(1,e.floor.shadow*Fp[o].shadow.opacity);l.setOpacity(r),l.setY(e.floor.y??M()??l.ground.position.y),te(e),l.setVisible(!C&&r>0),C?.update(e.set,e.environment.intensity),D.update(O,e.environment.glow??0)}let re={renderer:r,scene:a,camera:c,floor:l,devices:p,screenSources:m,maxAnisotropy:r.capabilities.getMaxAnisotropy(),forceLensPath:!1,addDevice:F,removeDevice:I,async loadScene(e,t){let n=new Map(e.screens.map(e=>[e.id,e])),i=[];for(let a of e.devices){let e=await t.buildDevice(a),o=[];for(let i=0;i<e.screens.length;i++){let s=e.screens[i],c=a.screens[i],l=c?n.get(c):void 0;if(!s||!l)continue;let d=await t.resolveScreen(l,a,{maxAnisotropy:r.capabilities.getMaxAnisotropy(),screenAspect:s.aspect});d&&o.push({screenId:l.id,source:d,surface:s,fit:l.fit,pan:u(l.offset)})}i.push({deviceDoc:a,build:e,sources:o})}let a=await j(e.backdrop,t);for(let e of[...p.keys()])I(e);for(let e of m.values())e.dispose();m.clear(),O=[];for(let{deviceDoc:e,build:t,sources:n}of i){F(t,e.id);for(let{screenId:e,source:t,surface:r,fit:i,pan:a}of n)m.set(e,t),r.setTexture(t.texture,t.aspect,i,a);for(let e of t.screens)O.push({surface:e,texture:n.find(t=>t.surface===e)?.source.texture??null})}a?.()},async loadBackdrop(e,t){(await j(e,t))?.()},setSize(e,t){r.setSize(e,t,!1),r.getDrawingBufferSize(x),f.setSize(x.x,x.y),c.aspect=e/t,c.updateProjectionMatrix()},applyState:ne,async prepareFrame(e){let t=[];for(let[n,r]of m){let i=e.screens[n];r.seek&&i&&t.push(r.seek(i.mediaTime))}await Promise.all(t)},render:P,renderFrame(e,t){ne(e,t),P()},start(e){let t=performance.now();r.setAnimationLoop(n=>{let r=Math.min((n-t)/1e3,.05);t=n,e?.(n,r),P()})},stop(){r.setAnimationLoop(null)},renderToCanvas(e){let t=r.getPixelRatio();r.setPixelRatio(t*e),r.getDrawingBufferSize(x),f.setSize(x.x,x.y),P();let n=document.createElement(`canvas`);return n.width=r.domElement.width,n.height=r.domElement.height,n.getContext(`2d`)?.drawImage(r.domElement,0,0),r.setPixelRatio(t),r.getDrawingBufferSize(x),f.setSize(x.x,x.y),P(),n},dispose(){r.setAnimationLoop(null);for(let e of[...p.keys()])I(e);for(let e of m.values())e.dispose();m.clear(),y?.dispose(),C?.dispose(),D.dispose(),l.dispose(),d.dispose(),f.dispose(),s.dispose(),r.dispose()}};return re}var qm,Jm,Ym,Xm,Zm=n((()=>{xp(),en(),Op(),Np(),Ip(),Vp(),Up(),Kp(),lm(),Wm(),qm=2.35,Jm=Math.PI/180,Ym={kind:`gradient`,inner:`#f6f6f4`,outer:`#d5d5d1`,tone:`light`},Xm={fisheye:0,chromatic:0,vignette:0,bloom:0,grain:0,blur:0,focus:0,fade:0}}));function Qm(e){return{start:e?.start,playbackRate:e?.playbackRate,loop:e?.loop}}function $m({start:e=0,playbackRate:t=1,loop:n=!0}={}){let r=Number.isFinite(t)&&t>0?Math.min(nh,Math.max(th,t)):1;return{delayMs:Number.isFinite(e)&&e>0?e*1e3:0,rate:r,loop:n}}function eh(e,t={}){let{delayMs:n,rate:r,loop:i}=$m(t);e.loop=i,e.defaultPlaybackRate=r,e.playbackRate=r;let a,o,s=()=>{a=void 0,e.play().catch(()=>{typeof window<`u`&&(o=()=>void e.play().catch(()=>void 0),window.addEventListener(`pointerdown`,o,{once:!0}))})};return n>0?(e.pause(),e.currentTime=0,a=setTimeout(s,n)):s(),()=>{a!==void 0&&clearTimeout(a),o&&typeof window<`u`&&window.removeEventListener(`pointerdown`,o)}}var th,nh,rh=n((()=>{th=.0625,nh=16}));function ih(e,t){return e.colorSpace=ga,e.anisotropy=t,e}var ah=n((()=>{xp()}));function oh(e,t){let n=e>1,r=n?2048:1179,i=Math.round(r/e),a=document.createElement(`canvas`);a.width=r,a.height=i;let o=a.getContext(`2d`);o&&(n?sh:ch)(o,r,i);let s=ih(new oc(a),t);return{texture:s,aspect:r/i,dispose:()=>s.dispose()}}function sh(e,t,n){let r=(e,t)=>`${e} ${t}px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`;e.textBaseline=`middle`;let i=e.createLinearGradient(0,0,t,n);i.addColorStop(0,`#15171f`),i.addColorStop(1,`#0a0b0f`),e.fillStyle=i,e.fillRect(0,0,t,n);let a=e.createRadialGradient(t*.8,n*.2,0,t*.8,n*.2,t*.6);a.addColorStop(0,`rgba(124, 92, 255, 0.28)`),a.addColorStop(1,`rgba(124, 92, 255, 0)`),e.fillStyle=a,e.fillRect(0,0,t,n);let o=Math.round(n*.035);e.fillStyle=`rgba(255,255,255,0.06)`,e.fillRect(0,0,t,o),e.fillStyle=`#f2f3f5`,e.font=r(600,o*.5),e.fillText(`Focus`,o*.9,o/2),e.fillStyle=`rgba(242,243,245,0.6)`,e.font=r(500,o*.45),e.fillText(`Tue 21 Oct 10:08`,t-o*7.2,o/2);let s=Math.round(t*.17),c=Math.round(t*.018);e.fillStyle=`rgba(255,255,255,0.045)`,e.fillRect(0,o,s,n-o),[`Overview`,`Projects`,`Timeline`,`Exports`,`Settings`].forEach((t,n)=>{let i=o+c*1.6+n*c*2.2;n===0&&(e.fillStyle=`rgba(124, 92, 255, 0.35)`,e.beginPath(),e.roundRect(c*.6,i-c*.8,s-c*1.2,c*1.6,c*.4),e.fill()),e.fillStyle=n===0?`#ffffff`:`rgba(242,243,245,0.6)`,e.font=r(n===0?650:500,c*.78),e.fillText(t,c*1.3,i)});let l=s+c*1.5,u=t-l-c*1.5;e.fillStyle=`rgba(242,243,245,0.55)`,e.font=r(500,c*.8),e.fillText(`Tuesday, 21 October`,l,o+c*1.6),e.fillStyle=`#f2f3f5`,e.font=r(700,c*1.7),e.fillText(`Good morning`,l,o+c*3.2);let d=o+c*4.6,f=Math.round((n-d-c*1.5)*.52),p=e.createLinearGradient(l,d,l+u,d+f);p.addColorStop(0,`#6d5dfc`),p.addColorStop(.55,`#c14dd6`),p.addColorStop(1,`#ff8a5c`),e.fillStyle=p,e.beginPath(),e.roundRect(l,d,u,f,c*1.1),e.fill(),e.fillStyle=`rgba(255,255,255,0.8)`,e.font=r(600,c*.85),e.fillText(`Focus time this week`,l+c*1.4,d+c*1.8),e.fillStyle=`#fff`,e.font=r(700,c*3.2),e.fillText(`26h 40m`,l+c*1.3,d+c*4.2);let m=[.35,.55,.42,.7,.5,.92,.64,.58,.77,.48,.86,.6],h=l+u*.46,g=u*.5/m.length,_=d+f-c*1.2;m.forEach((t,n)=>{let r=t*(f-c*2.6);e.fillStyle=n===5?`#fff`:`rgba(255,255,255,0.34)`,e.beginPath(),e.roundRect(h+n*g+g*.22,_-r,g*.56,r,c*.25),e.fill()});let v=d+f+c,y=n-v-c*1.5,b=c,x=(u-b*2)/3;[[`Steps`,`8,240`,.82,`#3ddc97`],[`Sleep`,`7h 40m`,.64,`#5ab0ff`],[`Sessions`,`14`,.47,`#ffb23f`]].forEach(([t,n,i,a],o)=>{let s=l+o*(x+b);e.fillStyle=`#171a22`,e.beginPath(),e.roundRect(s,v,x,y,c*.9),e.fill(),e.fillStyle=`rgba(242,243,245,0.55)`,e.font=r(600,c*.8),e.fillText(t,s+c,v+c*1.4),e.fillStyle=`#f2f3f5`,e.font=r(700,c*1.6),e.fillText(n,s+c,v+c*3.2);let u=s+x-c*1.9,d=v+y/2,f=Math.min(y*.28,c*1.4);e.lineWidth=f*.32,e.lineCap=`round`,e.strokeStyle=`rgba(255,255,255,0.1)`,e.beginPath(),e.arc(u,d,f,0,Math.PI*2),e.stroke(),e.strokeStyle=a,e.beginPath(),e.arc(u,d,f,-Math.PI/2,-Math.PI/2+Math.PI*2*i),e.stroke()})}function ch(e,t,n){let r=(e,t)=>`${e} ${t}px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`;e.textBaseline=`middle`;let i=e.createLinearGradient(0,0,0,n);i.addColorStop(0,`#12141b`),i.addColorStop(1,`#07080b`),e.fillStyle=i,e.fillRect(0,0,t,n);let a=e.createRadialGradient(t*.85,n*.12,0,t*.85,n*.12,t);a.addColorStop(0,`rgba(124, 92, 255, 0.32)`),a.addColorStop(1,`rgba(124, 92, 255, 0)`),e.fillStyle=a,e.fillRect(0,0,t,n),e.fillStyle=`#f2f3f5`,e.font=r(600,46),e.fillText(`10:08`,108,92);for(let n=0;n<4;n++){let r=12+n*8;e.fillRect(t-84-250+n*22,108-r,14,r)}e.strokeStyle=`rgba(242, 243, 245, 0.5)`,e.lineWidth=3,e.beginPath(),e.roundRect(t-84-140,76,84,34,10),e.stroke(),e.beginPath(),e.roundRect(t-84-134,82,60,22,5),e.fill(),e.fillRect(t-84-52,86,5,14),e.fillStyle=`rgba(242, 243, 245, 0.55)`,e.font=r(500,40),e.fillText(`Tuesday, 21 October`,84,262),e.fillStyle=`#f2f3f5`,e.font=r(700,92),e.fillText(`Good morning`,84,360);let o=t-168,s=e.createLinearGradient(84,450,84+o,1090);s.addColorStop(0,`#6d5dfc`),s.addColorStop(.55,`#c14dd6`),s.addColorStop(1,`#ff8a5c`),e.fillStyle=s,e.beginPath(),e.roundRect(84,450,o,640,64),e.fill(),e.fillStyle=`rgba(255, 255, 255, 0.8)`,e.font=r(600,40),e.fillText(`Focus time today`,148,550),e.fillStyle=`#fff`,e.font=r(700,140),e.fillText(`4h 12m`,140,675),e.fillStyle=`rgba(255, 255, 255, 0.8)`,e.font=r(500,38),e.fillText(`+38 min vs. last week`,148,770);let c=[.35,.55,.42,.7,.5,.92,.64],l=(o-128)/c.length;c.forEach((t,n)=>{let r=t*190;e.fillStyle=n===5?`#fff`:`rgba(255, 255, 255, 0.34)`,e.beginPath(),e.roundRect(148+n*l+l*.2,1026-r,l*.6,r,14),e.fill()});let u=(o-40)/2;[{label:`Steps`,value:`8,240`,progress:.82,color:`#3ddc97`},{label:`Sleep`,value:`7h 40m`,progress:.64,color:`#5ab0ff`}].forEach((t,n)=>{let i=84+n*(u+40);e.fillStyle=`#171a22`,e.beginPath(),e.roundRect(i,1134,u,300,48),e.fill(),e.fillStyle=`rgba(242, 243, 245, 0.55)`,e.font=r(600,38),e.fillText(t.label,i+48,1216),e.fillStyle=`#f2f3f5`,e.font=r(700,70),e.fillText(t.value,i+48,1330);let a=i+u-96,o=1220;e.lineWidth=16,e.lineCap=`round`,e.strokeStyle=`rgba(255, 255, 255, 0.1)`,e.beginPath(),e.arc(a,o,42,0,Math.PI*2),e.stroke(),e.strokeStyle=t.color,e.beginPath(),e.arc(a,o,42,-Math.PI/2,-Math.PI/2+Math.PI*2*t.progress),e.stroke()});let d=1530;e.fillStyle=`#f2f3f5`,e.font=r(700,50),e.fillText(`Up next`,84,d),d+=64;for(let[t,n,i]of[[`Design review`,`11:00 · Studio B`,`#ffb23f`],[`Team lunch`,`13:30 · Rooftop`,`#3ddc97`],[`Ship v0.2`,`17:00 · Release`,`#ff5c7a`]])e.fillStyle=i+`33`,e.beginPath(),e.arc(124,d+68,40,0,Math.PI*2),e.fill(),e.fillStyle=i,e.beginPath(),e.arc(124,d+68,14,0,Math.PI*2),e.fill(),e.fillStyle=`#f2f3f5`,e.font=r(600,46),e.fillText(t,196,d+46),e.fillStyle=`rgba(242, 243, 245, 0.5)`,e.font=r(500,36),e.fillText(n,196,d+96),e.fillStyle=`rgba(255, 255, 255, 0.07)`,e.fillRect(196,d+140,o-112,2),d+=146;let f=n-262;e.fillStyle=`rgba(28, 31, 40, 0.95)`,e.beginPath(),e.roundRect(84,f,o,150,75),e.fill();for(let t=0;t<4;t++){let n=84+o*((t+.5)/4);e.fillStyle=t===0?`#f2f3f5`:`rgba(242, 243, 245, 0.32)`,e.beginPath(),e.roundRect(n-24,f+51,48,48,14),e.fill()}e.fillStyle=`rgba(255, 255, 255, 0.85)`,e.beginPath(),e.roundRect(t/2-140,n-46,280,12,6),e.fill()}var lh=n((()=>{xp(),ah()})),uh=n((()=>{ah(),lh(),rh()}));function dh({engine:e,element:t,getDoc:n,overrides:r,onTime:i}){let a=0,o=0,s=0,c=!1,l=1,u=!1,d=0,f=0,p=At,m=At,h=null,g=null,_=null,v=()=>({...n().interaction,...r,cursor:{...n().interaction.cursor,...r?.cursor}});function y(e){return g&&g.timeline===e.timeline||(g={timeline:e.timeline,compiled:k(e.timeline)}),g.compiled}function b(e,t,n){if(n===`loop`)return(e%t+t)%t;if(n===`pingpong`){let n=e%(t*2);return n<=t?n:t*2-n}return Math.max(0,Math.min(t,e))}function x(e,t,n){let r=t.timeline.duration;switch(n.trigger){case`none`:return 0;case`load`:case`in-view`:case`click`:return c&&(s+=e*n.speed*l),n.loop===`none`&&s>=r&&(s=r,c=!1),b(Math.max(0,s-n.delay),r,n.loop);case`hover`:return c&&(s+=e*n.speed*l,s>=r&&(s=r,n.loop===`none`?c=!1:n.loop===`pingpong`?l=-1:s=0),s<=0&&(s=0,l===-1&&(c=!1))),Math.max(0,Math.min(r,s));case`scroll`:{let t=n.scroll?.smoothing??6;return f+=(d-f)*(1-Math.exp(-e*t)),f*r}case`cursor-move`:return(m.x+1)/2*r}}function S(){let e=t.getBoundingClientRect(),n=window.innerHeight||1,r=v(),i=r.scroll?.start===`top`?n-e.height:n,a=i-(r.scroll?.end===`bottom`?n-e.height:-e.height)||1;d=Math.max(0,Math.min(1,(i-e.top)/a))}function C(t){a=requestAnimationFrame(C);let r=Math.min((t-o)/1e3,.05)||0;o=t;let s=n(),c=v();m=kt(m,p,r,c.cursor.smoothing),p={...p,speed:p.speed*Math.exp(-r*6)};let l=x(r,s,c);i?.(l);let u=s.scene.devices.map(e=>e.id),d=[];s.interaction.idle.float>0&&d.push(oe(t/1e3,s.interaction.idle.float,u));let f=R(s,l,[],y(s));d.push(Dt(m,c.cursor,t/1e3,u,f.camera)),e.renderFrame(R(s,l,d,y(s)))}let w=e=>{let n=t.getBoundingClientRect(),r=(e.clientX-n.left)/n.width*2-1,i=-((e.clientY-n.top)/n.height*2-1),a=performance.now(),o=p.speed;if(h){let e=Math.max(1,a-h.time)/1e3;o=Math.min(1,Math.hypot(r-h.x,i-h.y)/e/6)}h={x:r,y:i,time:a},p={x:Math.max(-1,Math.min(1,r)),y:Math.max(-1,Math.min(1,i)),speed:o}},T=()=>{p=At,h=null,u=!1;let e=v();e.trigger===`hover`&&(e.hover?.reverseOnLeave??!0?(l=-1,c=!0):c=!1)},E=()=>{u=!0,v().trigger===`hover`&&(l=1,c=!0)},D=()=>{v().trigger===`click`&&(!c||s>=n().timeline.duration?(s>=n().timeline.duration&&(s=0),c=!0):c=!1)},O=()=>S();return{start(){if(a)return;let e=v();t.addEventListener(`pointermove`,w),t.addEventListener(`pointerleave`,T),t.addEventListener(`pointerenter`,E),t.addEventListener(`click`,D),window.addEventListener(`scroll`,O,{passive:!0}),window.addEventListener(`resize`,O),S(),s=0,l=1,c=e.trigger===`load`,e.trigger===`in-view`&&(_=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(c=!0,_?.disconnect())},{threshold:.5}),_.observe(t)),o=performance.now(),a=requestAnimationFrame(C)},stop(){cancelAnimationFrame(a),a=0,t.removeEventListener(`pointermove`,w),t.removeEventListener(`pointerleave`,T),t.removeEventListener(`pointerenter`,E),t.removeEventListener(`click`,D),window.removeEventListener(`scroll`,O),window.removeEventListener(`resize`,O),_?.disconnect(),_=null},restart(){s=0,l=1,c=v().trigger!==`none`&&v().trigger!==`scroll`&&v().trigger!==`cursor-move`&&(v().trigger!==`hover`||u)},dispose(){this.stop()}}}var fh=n((()=>{en()})),ph=n((()=>{Zm(),Np(),Op(),Ep(),lm(),Vp(),Ip(),Up(),uh(),fh(),Fm(),gm()}));function mh(){return{amount:{value:_h.noise.default},grain:{value:_h.noiseScale.default/10}}}function hh(e,t){e.userData.surfaceNoise=t,e.onBeforeCompile=e=>{e.uniforms.uSurfaceNoiseAmount=t.amount,e.uniforms.uSurfaceNoiseGrain=t.grain,e.vertexShader=e.vertexShader.replace(`#include <common>`,`#include <common>\n${vh}`).replace(`#include <begin_vertex>`,`#include <begin_vertex>\n${yh}`),e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>\n${bh}`).replace(`#include <roughnessmap_fragment>`,xh).replace(`#include <normal_fragment_maps>`,Sh)},e.customProgramCacheKey=()=>`surface-noise`}function gh(e){let t=new Set;e.group.traverse(e=>{let n=e.material;for(let e of Array.isArray(n)?n:n?[n]:[]){let n=e.userData.surfaceNoise;n&&t.add(n)}});let n=e.setParam;return{...e,params:{...e.params,..._h},setParam(e,r){if(e===`noise`)for(let e of t)e.amount.value=r;else if(e===`noiseScale`)for(let e of t)e.grain.value=r/10;else n(e,r)}}}var _h,vh,yh,bh,xh,Sh,Ch=n((()=>{_h={noise:{min:0,max:1,default:.3,unit:``,label:`Surface noise`},noiseScale:{min:.1,max:5,default:.4,unit:`mm`,label:`Noise size`}},vh=`
|
|
4679
|
+
reflectedLight.indirectSpecular *= concreteRoom;`)},t.customProgramCacheKey=()=>`openmockup-concrete-4`,t}var ym=n((()=>{Sp(),_m()}));function bm({color:e,subject:t}){let n=new Oo;n.name=`set:block`;let r=vm(e),i=t.getCenter(new Y),a=t.getSize(new Y),o=Math.max(a.x*3,90),s=Math.max(a.z*2.4,60),c=Math.max(a.y*6,o),l=t.min.x+a.x*.3,u=t.max.z+.6,d=t.min.y,f=new pm(o,c,s,3,.35),p=new $s(f,r);p.position.set(l+o/2,d-c/2,u-s/2),p.castShadow=!1,p.receiveShadow=!0,n.add(p);let m=Math.max(a.length()*3.2,110),h=new Nl(16184818,1,m*4,.62,.85,2);h.position.set(i.x-m,i.y+m*.25,u-m*.12),h.target.position.set(l,d-a.y,u),h.castShadow=!0,h.shadow.mapSize.set(2048,2048),h.shadow.camera.near=m*.3,h.shadow.camera.far=m*3,h.shadow.radius=6,h.shadow.blurSamples=16,h.shadow.bias=-2e-4,h.shadow.normalBias=.3;let g=new Nl(14673134,1,m*4,.8,1,2);g.position.set(i.x-m*.3,i.y-m*.2,i.z+m*1.2),g.target.position.set(l,d-a.y,u),n.add(h,h.target,g,g.target);let _=h.position.distanceTo(h.target.position),v=g.position.distanceTo(g.target.position);return{group:n,update(e,t){r.color.set(e.color),h.intensity=4*_*_*t,g.intensity=.12*v*v*t},dispose(){f.dispose(),r.dispose(),h.shadow.map?.dispose(),h.dispose(),g.dispose()}}}var xm=n((()=>{Sp(),mm(),ym()}));function Sm(e){let t=e*2654435761>>>0||1;return()=>{t=t+1831565813>>>0;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}function Cm(e){let t=Sm(e),n=new Uint8Array(256);for(let e=0;e<256;e++)n[e]=e;for(let e=255;e>0;e--){let r=Math.floor(t()*(e+1)),i=n[e];n[e]=n[r],n[r]=i}let r=new Uint8Array(512),i=new Uint8Array(512);for(let e=0;e<512;e++)r[e]=n[e&255],i[e]=r[e]%12;return(e,t,n)=>{let a=(e+t+n)*Dm,o=Math.floor(e+a),s=Math.floor(t+a),c=Math.floor(n+a),l=(o+s+c)*Om,u=e-(o-l),d=t-(s-l),f=n-(c-l),p=0,m=0,h=0,g=0,_=0,v=0;u>=d?d>=f?(p=1,g=1,_=1):u>=f?(p=1,g=1,v=1):(h=1,g=1,v=1):d<f?(h=1,_=1,v=1):u<f?(m=1,_=1,v=1):(m=1,g=1,_=1);let y=u-p+Om,b=d-m+Om,x=f-h+Om,S=u-g+2*Om,C=d-_+2*Om,w=f-v+2*Om,T=u-1+3*Om,E=d-1+3*Om,D=f-1+3*Om,O=o&255,k=s&255,A=c&255,j=wm(i[O+r[k+r[A]]],u,d,f),M=wm(i[O+p+r[k+m+r[A+h]]],y,b,x),N=wm(i[O+g+r[k+_+r[A+v]]],S,C,w),P=wm(i[O+1+r[k+1+r[A+1]]],T,E,D);return 32*(j+M+N+P)}}function wm(e,t,n,r){let i=.6-t*t-n*n-r*r;if(i<0)return 0;i*=i;let a=e*3;return i*i*(Em[a]*t+Em[a+1]*n+Em[a+2]*r)}function Tm(e,t,n,r,i,a=.5){let o=0,s=1,c=1,l=0;for(let u=0;u<i;u++)o+=s*e(t*c,n*c,r*c),l+=s,s*=a,c*=2;return o/l}var Em,Dm,Om,km=n((()=>{Em=new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),Dm=1/3,Om=1/6}));function Am({seed:e,size:t,detail:n=5,sides:r=6,notches:i,relief:a=1,shape:o=`pillar`,color:s}){let c=Sm(e),l=Cm(e),u=new Y(t[0]/2,t[1]/2,t[2]/2),d=Math.hypot(...t),f=Math.min(u.x,u.z)*.03+.12,p=[],m=c()*Math.PI*2;for(let e=0;e<r;e++){let t=m+(e+(c()-.5)*.5)/r*Math.PI*2,n=o===`boulder`?(c()-.5)*1.6:(c()-.5)*.08,i=new Y(Math.cos(t),n,Math.sin(t)).normalize(),a=Math.hypot(i.x*u.x,i.z*u.z);p.push({n:i,d:a*(.86+c()*.1)})}let h=Array.from({length:2+Math.floor(c()*3)},()=>(c()*1.5-.75)*u.y).sort((e,t)=>e-t),g=p.map(()=>h.map(()=>c()<.65?-(c()*.16):c()*.06)),_=c()*Math.PI,v=new Y(Math.cos(_),0,Math.sin(_)),y=(c()-.5)*Math.min(u.x,u.z)*.6,b=p.map(()=>-(c()*.12)),x=p.length;p.push({n:new Y(c()-.5,2.2,c()-.5).normalize(),d:u.y*.92}),p.push({n:new Y((c()-.5)*.3,-1,(c()-.5)*.3).normalize(),d:u.y});let S=1+Math.floor(c()*2);for(let e=0;e<S;e++){let e=c()*Math.PI*2,t=new Y(Math.cos(e)*.55,-.85,Math.sin(e)*.55).normalize();p.push({n:t,d:Math.hypot(t.x*u.x,t.y*u.y,t.z*u.z)*.72})}let C=16+Math.floor(c()*8);for(let e=0;e<C;e++){let e=new Y(c()*2-1,c()*2-1,c()*2-1).normalize(),t=Math.abs(e.x)*u.x+Math.abs(e.y)*u.y+Math.abs(e.z)*u.z;p.push({n:e,d:t*(.78+c()*.12)})}let w=[],T=i??Math.round(t[1]/18+c()*3);for(let e=0;e<T;e++){let e=p[Math.floor(c()*r)],t=(c()*1.6-.8)*u.y,n=c()<.5?-1:1,i=new Y(-e.n.z,0,e.n.x).multiplyScalar(n*(.45+c()*.4)*Math.min(u.x,u.z)),a=e.n.clone().setY(0).normalize().multiplyScalar(e.d).add(i).setY(t),o=Math.min(u.x,u.z)*(.12+c()*.18);w.push({center:a,half:new Y(Math.min(u.x,u.z)*(.25+c()*.45),u.y*(.04+c()*.12),o),yaw:Math.atan2(e.n.x,e.n.z)+(c()-.5)*.2})}let E=new Float64Array(p.length*4);p.forEach((e,t)=>E.set([e.n.x,e.n.y,e.n.z,e.d],t*4));let D=new Float64Array(x*h.length);for(let e=0;e<x;e++)for(let t=0;t<h.length;t++)D[e*h.length+t]=g[e][t]*p[e].d;let O=Float64Array.from(b,(e,t)=>e*p[t].d),k=new Float64Array(w.length*8);w.forEach((e,t)=>k.set([e.center.x,e.center.y,e.center.z,Math.cos(-e.yaw),Math.sin(-e.yaw),e.half.x,e.half.y,e.half.z],t*8));let A=new Float64Array(h.length),j=v.x,M=v.z,N=(e,t,n)=>{let r=jm(-f*.4,f*.4,e*j+n*M-y);for(let e=0;e<h.length;e++)A[e]=jm(-f*.3,f*.3,t-h[e]);let i=-1/0;for(let a=0;a<p.length;a++){let o=a*4,s=0;if(a<x){for(let e=0;e<h.length;e++)s+=D[a*h.length+e]*A[e];s+=O[a]*r}i=Mm(i,e*E[o]+t*E[o+1]+n*E[o+2]-(E[o+3]+s),f)}for(let r=0;r<w.length;r++){let a=r*8,o=e-k[a],s=t-k[a+1],c=n-k[a+2],l=k[a+3],u=k[a+4],d=Math.abs(o*l+c*u)-k[a+5],p=Math.abs(s)-k[a+6],m=Math.abs(-o*u+c*l)-k[a+7],h=d>0?d:0,g=p>0?p:0,_=m>0?m:0,v=Math.min(Math.max(d,p,m),0)+Math.sqrt(h*h+g*g+_*_);i=Mm(i,-v,f*.6)}let o=e/d,s=t/d,c=n/d;return i-=Tm(l,o*2.2,s*2.2,c*2.2,3,.5)*d*.007*a,i-=Tm(l,o*9+7.1,s*9+3.3,c*9-2.2,2,.5)*d*.004*a,i},P=e=>N(e.x,e.y,e.z),{positions:F,indices:I}=Pm(n),ee=F.length/3,te=new Y,ne=new Y,re=u.length()*1.5;for(let e=0;e<ee;e++){te.fromArray(F,e*3).multiply(u).normalize();let t=re,n=re;for(let e=0;e<200&&t>0;e++){let e=P(ne.copy(te).multiplyScalar(t));if(e<0)break;n=t,t-=Math.max(e*.8,.3)}let r=Math.max(t,0),i=n;for(let e=0;e<9;e++){let e=(r+i)/2;P(ne.copy(te).multiplyScalar(e))<0?r=e:i=e}ne.copy(te).multiplyScalar((r+i)/2).toArray(F,e*3)}Nm(F,I,P,4);let L=new ks;L.setAttribute(`position`,new ms(F,3)),L.setIndex(new ms(I,1)),L.computeVertexNormals(),L.setAttribute(`aCavity`,new ms(Fm(L),1)),L.computeBoundingBox(),L.computeBoundingSphere();let R=s===void 0?null:hm(s),ie=new $s(L,R??void 0);return ie.castShadow=!0,ie.receiveShadow=!0,{mesh:ie,dispose(){L.dispose(),R?.dispose()}}}function jm(e,t,n){let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)}function Mm(e,t,n){if(e===-1/0)return t;let r=Math.min(1,Math.max(0,.5-.5*(t-e)/n));return t+(e-t)*r+n*r*(1-r)}function Nm(e,t,n,r){let i=e.length/3,a=Array.from({length:i},()=>[]);for(let e=0;e<t.length;e+=3)for(let n=0;n<3;n++){let r=t[e+n],i=t[e+(n+1)%3];a[r].includes(i)||a[r].push(i),a[i].includes(r)||a[i].push(r)}let o=new Y,s=new Y,c=new Y,l=.05,u=new Float32Array(e.length);for(let t=0;t<r;t++){for(let t=0;t<i;t++){let r=0,i=0,d=0;for(let n of a[t])r+=e[n*3],i+=e[n*3+1],d+=e[n*3+2];let f=a[t].length;o.set(e[t*3]*.4+r/f*.6,e[t*3+1]*.4+i/f*.6,e[t*3+2]*.4+d/f*.6);for(let e=0;e<2;e++){let e=n(o);s.set(n(c.set(o.x+l,o.y,o.z))-e,n(c.set(o.x,o.y+l,o.z))-e,n(c.set(o.x,o.y,o.z+l))-e).divideScalar(l);let t=s.lengthSq();if(t<1e-8)break;o.addScaledVector(s,-e/t)}o.toArray(u,t*3)}e.set(u)}}function Pm(e){let t=(1+Math.sqrt(5))/2,n=[-1,t,0,1,t,0,-1,-t,0,1,-t,0,0,-1,t,0,1,t,0,-1,-t,0,1,-t,t,0,-1,t,0,1,-t,0,-1,-t,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];for(let e=0;e<n.length;e+=3){let t=Math.hypot(n[e],n[e+1],n[e+2]);n[e]/=t,n[e+1]/=t,n[e+2]/=t}for(let t=0;t<e;t++){let e=new Map,t=(t,r)=>{let i=t<r?t*1e7+r:r*1e7+t,a=e.get(i);if(a!==void 0)return a;let o=n[t*3]+n[r*3],s=n[t*3+1]+n[r*3+1],c=n[t*3+2]+n[r*3+2],l=Math.hypot(o,s,c);n.push(o/l,s/l,c/l);let u=n.length/3-1;return e.set(i,u),u},i=[];for(let e=0;e<r.length;e+=3){let n=r[e],a=r[e+1],o=r[e+2],s=t(n,a),c=t(a,o),l=t(o,n);i.push(n,s,l,a,c,s,o,l,c,s,c,l)}r=i}return{positions:new Float32Array(n),indices:new Uint32Array(r)}}function Fm(e){let t=e.getAttribute(`position`),n=e.getAttribute(`normal`),r=e.getIndex(),i=t.count,a=Array.from({length:i},()=>new Set);for(let e=0;e<r.count;e+=3){let t=r.getX(e),n=r.getX(e+1),i=r.getX(e+2);a[t].add(n).add(i),a[n].add(t).add(i),a[i].add(t).add(n)}let o=new Float32Array(i);for(let e=0;e<i;e++){let r=0,i=0,s=0,c=0,l=t.getX(e),u=t.getY(e),d=t.getZ(e);for(let n of a[e])r+=t.getX(n),i+=t.getY(n),s+=t.getZ(n),c+=Math.hypot(t.getX(n)-l,t.getY(n)-u,t.getZ(n)-d);let f=a[e].size||1,p=((r/f-l)*n.getX(e)+(i/f-u)*n.getY(e)+(s/f-d)*n.getZ(e))/(c/f||1);o[e]=p}for(let e=0;e<2;e++){let e=new Float32Array(i);for(let t=0;t<i;t++){let n=o[t];for(let e of a[t])n+=o[e];e[t]=n/(a[t].size+1)}o=e}for(let e=0;e<i;e++)o[e]=Math.min(1,Math.max(0,.5+o[e]*4));return o}var Im=n((()=>{Sp(),km(),_m()}));function Lm({seed:e,color:t,subject:n}){let r=Sm(e*7919+13),i=new Oo;i.name=`set:crevice`;let a=hm(t),o=[],s=n.getCenter(new Y),c=n.getSize(new Y),l=c.x+Math.max(1.2,c.x*.18)*2,u=Math.max(c.y*4.2,l*6.3),d=l*3.1,f=Math.max(l*3,c.z*6),p=s.y-u*.3;for(let t of[-1,1]){let n=Am({seed:e*31+(t<0?1:2),size:[d*(.9+r()*.2),u*(.94+r()*.08),f*(.9+r()*.15)]});n.mesh.material=a;let m=n.mesh;m.rotation.set((r()-.5)*.06,(r()-.5)*.5,-t*(.05+r()*.04)),m.position.set(s.x+t*(l/2+d/2),p+u/2,s.z-f*.28),m.updateMatrixWorld(!0);let h=Rm(m,t,s,c);h!==null&&(m.position.x+=s.x+l/2*t-h),i.add(m),o.push(n)}let m=l*.9;for(let[t,u]of[[-1,-.3],[1,.35]]){let d=Am({seed:e*31+(t<0?4:5),size:[l*1.5,c.y*1.3,m],sides:6,notches:1,relief:1.5,detail:4});d.mesh.material=a,d.mesh.rotation.set((r()-.5)*.1,(r()-.5)*.5,-t*(.04+r()*.06)),d.mesh.position.set(s.x+t*(c.x/2+l*.75-.5),s.y+u*c.y,n.max.z+m*.5+.8),d.mesh.updateMatrixWorld(!0);let f=zm(d.mesh);f!==null&&f<n.max.z+.4&&(d.mesh.position.z+=n.max.z+.4-f),i.add(d.mesh),o.push(d)}let h=Am({seed:e*31+3,size:[l*2.2,c.y*.45,f*.55],sides:8,notches:1,relief:2,shape:`boulder`,detail:4});h.mesh.material=a,h.mesh.rotation.set(0,(r()-.5)*.6,(r()-.5)*.15),h.mesh.position.set(s.x,n.min.y,s.z-f*.08),h.mesh.updateMatrixWorld(!0);let g=Bm(h.mesh,s,c);g!==null&&(h.mesh.position.y+=n.min.y-.15-g),i.add(h.mesh),o.push(h);let _=u,v=new Nl(15001584,1,_*4,.36,.95,2);v.position.set(s.x-_*.7,s.y+_*1.15,s.z+_*.4),v.target.position.copy(s),v.castShadow=!0,v.shadow.mapSize.set(2048,2048),v.shadow.camera.near=_*.3,v.shadow.camera.far=_*3,v.shadow.radius=3,v.shadow.blurSamples=12,v.shadow.bias=-2e-4,v.shadow.normalBias=.6;let y=new Nl(3364351,1,_*4,.45,.9,2);y.position.set(s.x+_*.7,s.y+_*.35,s.z-_*.55),y.target.position.set(s.x-l,s.y,s.z);let b=new Nl(11122406,1,_*4,.9,1,2);b.position.set(s.x+_*.4,s.y-_*.1,s.z+_*1.1),b.target.position.copy(s),i.add(v,v.target,y,y.target,b,b.target);let x=v.position.distanceTo(s),S=y.position.distanceTo(s),C=b.position.distanceTo(s);return{group:i,update(e,t){a.color.set(e.color),v.intensity=5*x*x*t,y.intensity=.6*S*S*t,b.intensity=.45*C*C*t},dispose(){for(let e of o)e.dispose();a.dispose(),v.shadow.map?.dispose(),v.dispose(),y.dispose(),b.dispose()}}}function Rm(e,t,n,r){let i=e.geometry.getAttribute(`position`),a=null;for(let o=0;o<i.count;o++)Vm.fromBufferAttribute(i,o).applyMatrix4(e.matrixWorld),!(Math.abs(Vm.y-n.y)>r.y*.6||Math.abs(Vm.z-n.z)>Math.max(r.z*2,3))&&(a===null||(t<0?Vm.x>a:Vm.x<a))&&(a=Vm.x);return a}function zm(e){let t=e.geometry.getAttribute(`position`),n=null;for(let r=0;r<t.count;r++)Vm.fromBufferAttribute(t,r).applyMatrix4(e.matrixWorld),(n===null||Vm.z<n)&&(n=Vm.z);return n}function Bm(e,t,n){let r=e.geometry.getAttribute(`position`),i=null;for(let a=0;a<r.count;a++)Vm.fromBufferAttribute(r,a).applyMatrix4(e.matrixWorld),!(Math.abs(Vm.x-t.x)>n.x*.5||Math.abs(Vm.z-t.z)>Math.max(n.z,1))&&(i===null||Vm.y>i)&&(i=Vm.y);return i}var Vm,Hm=n((()=>{Sp(),km(),Im(),_m(),Vm=new Y}));function Um(e,t){let n=Wm[e];return n?n(t):null}var Wm,Gm=n((()=>{xm(),Hm(),Wm={crevice:Lm,block:bm}}));function Km(e){return e.kind===`image`&&e.image?JSON.stringify(e.image):null}function qm({canvas:e,alpha:t=!0,quality:n=`preview`}){let r=new xp({canvas:e,antialias:!0,alpha:t}),i=typeof window<`u`?window.devicePixelRatio:1;r.setPixelRatio(n===`export`?1:Math.min(i,2)),r.setClearColor(0,0),r.autoClear=!1,r.toneMapping=7,r.shadowMap.enabled=!0,r.shadowMap.type=3;let a=new Io,o=`studio`,s=Rp(r,o);a.environment=s;let c=new jl(28,1,5,300);c.position.set(0,1.5,48);let l=Up(a,-10.5),d=Op(),f=Yp(r,n===`export`?8:4),p=new Map,m=new Map,h=0,g=Xm,_=Zm,v=null,y=null,b=0,x=new J,S=0,C=null,w=``,T=new Y,E=new Y,D=Gp(r),O=[],k=new Y;function A(e){let t=s;o=e,s=Rp(r,e),a.environment=s,t.dispose(),l.light.shadow.radius=Ip[e].shadow.radius}async function j(e,t){let n=Km(e);if(n===v)return null;let i=++b,a=null;return e.image&&n&&t.resolveBackdrop&&(a=await Promise.resolve(t.resolveBackdrop(e.image,{maxAnisotropy:r.capabilities.getMaxAnisotropy()})).catch(()=>null)),()=>{if(i!==b)return a?.dispose();y?.dispose(),y=a,v=n,d.setImage(a?.texture??null,a?.aspect)}}function M(){let e=1/0;for(let{build:t,root:n}of p.values()){let r=t.bounds.min.y*n.scale.y+n.position.y;e=Math.min(e,r-(t.restsOnFloor?0:Jm))}return Number.isFinite(e)?e:null}function N(){let e=M();e!==null&&l.setY(e);let t=0;for(let{build:e,root:n}of p.values()){let r=new Y;e.bounds.getSize(r),t=Math.max(t,Math.max(r.x,r.y,r.z)/2*n.scale.x+n.position.length())}t>0&&l.fit(t)}function P(){re.forceLensPath||Jp(_)?f.render(a,c,d,g,_,[l.ground],S):(r.setRenderTarget(null),r.clear(),d.render(r,g),r.render(a,c))}function F(e,t=`device-${++h}`){let n=new Oo,r=new Oo;n.add(r),r.add(e.group);for(let t of e.screens)t.mesh.layers.enable(1);a.add(n);let i={id:t,root:n,offset:r,build:e};return p.set(t,i),N(),i}function I(e){let t=p.get(e);t&&(a.remove(t.root),t.build.dispose(),p.delete(e),N())}function ee(){let e=new Zo;for(let{build:t,root:n}of p.values())n.visible&&e.union(t.bounds.clone().applyMatrix4(new $a().compose(n.position,new Pa,n.scale)));return e.isEmpty()?null:e}function te(e){let t=e.set?.kind??`none`,n=t===`none`?null:ee();if(t!==`none`&&!n)return;let r=n?n.getSize(E).toArray().map(e=>e.toFixed(1)).join(`,`):``,i=`${t}:${e.set?.seed}:${r}`;i===w?C&&n&&C.group.position.copy(n.getCenter(E)).sub(T):(w=i,C&&(a.remove(C.group),C.dispose()),C=n?Um(t,{seed:e.set.seed,color:e.set.color,subject:n}):null,n&&n.getCenter(T),C&&a.add(C.group))}function ne(e,{skipCamera:t=!1}={}){S=e.time;for(let[t,n]of p){let r=e.devices[t];if(!r)n.root.visible=!1;else{n.root.visible=r.visible,n.root.position.set(r.position[0],r.position[1],r.position[2]),n.root.rotation.set(r.rotation[0]*Ym,r.rotation[1]*Ym,r.rotation[2]*Ym),n.root.scale.setScalar(r.scale);for(let[e,t]of Object.entries(r.params))n.build.setParam(e,t);n.build.setGlare(r.glare,r.screenFinish)}}if(t||Ap(c,e.camera),_=e.camera.lens,_.blur>0&&!(_.focus>0)){let t=k.set(e.camera.target[0],e.camera.target[1],e.camera.target[2]).distanceTo(c.position);_={..._,focus:t}}g=e.backdrop;let n=Fp(e.environment.preset);n!==o&&A(n),a.environmentIntensity=e.environment.intensity,a.environmentRotation.y=e.environment.rotation*Ym;let r=Math.min(1,e.floor.shadow*Ip[o].shadow.opacity);l.setOpacity(r),l.setY(e.floor.y??M()??l.ground.position.y),te(e),l.setVisible(!C&&r>0),C?.update(e.set,e.environment.intensity),D.update(O,e.environment.glow??0)}let re={renderer:r,scene:a,camera:c,floor:l,devices:p,screenSources:m,maxAnisotropy:r.capabilities.getMaxAnisotropy(),forceLensPath:!1,addDevice:F,removeDevice:I,async loadScene(e,t){let n=new Map(e.screens.map(e=>[e.id,e])),i=[];for(let a of e.devices){let e=await t.buildDevice(a),o=[];for(let i=0;i<e.screens.length;i++){let s=e.screens[i],c=a.screens[i],l=c?n.get(c):void 0;if(!s||!l)continue;let d=await t.resolveScreen(l,a,{maxAnisotropy:r.capabilities.getMaxAnisotropy(),screenAspect:s.aspect});d&&o.push({screenId:l.id,source:d,surface:s,fit:l.fit,pan:u(l.offset)})}i.push({deviceDoc:a,build:e,sources:o})}let a=await j(e.backdrop,t);for(let e of[...p.keys()])I(e);for(let e of m.values())e.dispose();m.clear(),O=[];for(let{deviceDoc:e,build:t,sources:n}of i){F(t,e.id);for(let{screenId:e,source:t,surface:r,fit:i,pan:a}of n)m.set(e,t),r.setTexture(t.texture,t.aspect,i,a);for(let e of t.screens)O.push({surface:e,texture:n.find(t=>t.surface===e)?.source.texture??null})}a?.()},async loadBackdrop(e,t){(await j(e,t))?.()},setSize(e,t){r.setSize(e,t,!1),r.getDrawingBufferSize(x),f.setSize(x.x,x.y),c.aspect=e/t,c.updateProjectionMatrix()},applyState:ne,async prepareFrame(e){let t=[];for(let[n,r]of m){let i=e.screens[n];r.seek&&i&&t.push(r.seek(i.mediaTime))}await Promise.all(t)},render:P,renderFrame(e,t){ne(e,t),P()},start(e){let t=performance.now();r.setAnimationLoop(n=>{let r=Math.min((n-t)/1e3,.05);t=n,e?.(n,r),P()})},stop(){r.setAnimationLoop(null)},renderToCanvas(e){let t=r.getPixelRatio();r.setPixelRatio(t*e),r.getDrawingBufferSize(x),f.setSize(x.x,x.y),P();let n=document.createElement(`canvas`);return n.width=r.domElement.width,n.height=r.domElement.height,n.getContext(`2d`)?.drawImage(r.domElement,0,0),r.setPixelRatio(t),r.getDrawingBufferSize(x),f.setSize(x.x,x.y),P(),n},dispose(){r.setAnimationLoop(null);for(let e of[...p.keys()])I(e);for(let e of m.values())e.dispose();m.clear(),y?.dispose(),C?.dispose(),D.dispose(),l.dispose(),d.dispose(),f.dispose(),s.dispose(),r.dispose()}};return re}var Jm,Ym,Xm,Zm,Qm=n((()=>{Sp(),tn(),kp(),Pp(),Lp(),Hp(),Wp(),qp(),um(),Gm(),Jm=2.35,Ym=Math.PI/180,Xm={kind:`gradient`,inner:`#f6f6f4`,outer:`#d5d5d1`,tone:`light`},Zm={fisheye:0,chromatic:0,vignette:0,bloom:0,grain:0,blur:0,focus:0,fade:0}}));function $m(e){return{start:e?.start,playbackRate:e?.playbackRate,loop:e?.loop}}function eh({start:e=0,playbackRate:t=1,loop:n=!0}={}){let r=Number.isFinite(t)&&t>0?Math.min(rh,Math.max(nh,t)):1;return{delayMs:Number.isFinite(e)&&e>0?e*1e3:0,rate:r,loop:n}}function th(e,t={}){let{delayMs:n,rate:r,loop:i}=eh(t);e.loop=i,e.defaultPlaybackRate=r,e.playbackRate=r;let a,o,s=()=>{a=void 0,e.play().catch(()=>{typeof window<`u`&&(o=()=>void e.play().catch(()=>void 0),window.addEventListener(`pointerdown`,o,{once:!0}))})};return n>0?(e.pause(),e.currentTime=0,a=setTimeout(s,n)):s(),()=>{a!==void 0&&clearTimeout(a),o&&typeof window<`u`&&window.removeEventListener(`pointerdown`,o)}}var nh,rh,ih=n((()=>{nh=.0625,rh=16}));function ah(e,t){return e.colorSpace=_a,e.anisotropy=t,e}var oh=n((()=>{Sp()}));function sh(e,t){let n=e>1,r=n?2048:1179,i=Math.round(r/e),a=document.createElement(`canvas`);a.width=r,a.height=i;let o=a.getContext(`2d`);o&&(n?ch:lh)(o,r,i);let s=ah(new sc(a),t);return{texture:s,aspect:r/i,dispose:()=>s.dispose()}}function ch(e,t,n){let r=(e,t)=>`${e} ${t}px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`;e.textBaseline=`middle`;let i=e.createLinearGradient(0,0,t,n);i.addColorStop(0,`#15171f`),i.addColorStop(1,`#0a0b0f`),e.fillStyle=i,e.fillRect(0,0,t,n);let a=e.createRadialGradient(t*.8,n*.2,0,t*.8,n*.2,t*.6);a.addColorStop(0,`rgba(124, 92, 255, 0.28)`),a.addColorStop(1,`rgba(124, 92, 255, 0)`),e.fillStyle=a,e.fillRect(0,0,t,n);let o=Math.round(n*.035);e.fillStyle=`rgba(255,255,255,0.06)`,e.fillRect(0,0,t,o),e.fillStyle=`#f2f3f5`,e.font=r(600,o*.5),e.fillText(`Focus`,o*.9,o/2),e.fillStyle=`rgba(242,243,245,0.6)`,e.font=r(500,o*.45),e.fillText(`Tue 21 Oct 10:08`,t-o*7.2,o/2);let s=Math.round(t*.17),c=Math.round(t*.018);e.fillStyle=`rgba(255,255,255,0.045)`,e.fillRect(0,o,s,n-o),[`Overview`,`Projects`,`Timeline`,`Exports`,`Settings`].forEach((t,n)=>{let i=o+c*1.6+n*c*2.2;n===0&&(e.fillStyle=`rgba(124, 92, 255, 0.35)`,e.beginPath(),e.roundRect(c*.6,i-c*.8,s-c*1.2,c*1.6,c*.4),e.fill()),e.fillStyle=n===0?`#ffffff`:`rgba(242,243,245,0.6)`,e.font=r(n===0?650:500,c*.78),e.fillText(t,c*1.3,i)});let l=s+c*1.5,u=t-l-c*1.5;e.fillStyle=`rgba(242,243,245,0.55)`,e.font=r(500,c*.8),e.fillText(`Tuesday, 21 October`,l,o+c*1.6),e.fillStyle=`#f2f3f5`,e.font=r(700,c*1.7),e.fillText(`Good morning`,l,o+c*3.2);let d=o+c*4.6,f=Math.round((n-d-c*1.5)*.52),p=e.createLinearGradient(l,d,l+u,d+f);p.addColorStop(0,`#6d5dfc`),p.addColorStop(.55,`#c14dd6`),p.addColorStop(1,`#ff8a5c`),e.fillStyle=p,e.beginPath(),e.roundRect(l,d,u,f,c*1.1),e.fill(),e.fillStyle=`rgba(255,255,255,0.8)`,e.font=r(600,c*.85),e.fillText(`Focus time this week`,l+c*1.4,d+c*1.8),e.fillStyle=`#fff`,e.font=r(700,c*3.2),e.fillText(`26h 40m`,l+c*1.3,d+c*4.2);let m=[.35,.55,.42,.7,.5,.92,.64,.58,.77,.48,.86,.6],h=l+u*.46,g=u*.5/m.length,_=d+f-c*1.2;m.forEach((t,n)=>{let r=t*(f-c*2.6);e.fillStyle=n===5?`#fff`:`rgba(255,255,255,0.34)`,e.beginPath(),e.roundRect(h+n*g+g*.22,_-r,g*.56,r,c*.25),e.fill()});let v=d+f+c,y=n-v-c*1.5,b=c,x=(u-b*2)/3;[[`Steps`,`8,240`,.82,`#3ddc97`],[`Sleep`,`7h 40m`,.64,`#5ab0ff`],[`Sessions`,`14`,.47,`#ffb23f`]].forEach(([t,n,i,a],o)=>{let s=l+o*(x+b);e.fillStyle=`#171a22`,e.beginPath(),e.roundRect(s,v,x,y,c*.9),e.fill(),e.fillStyle=`rgba(242,243,245,0.55)`,e.font=r(600,c*.8),e.fillText(t,s+c,v+c*1.4),e.fillStyle=`#f2f3f5`,e.font=r(700,c*1.6),e.fillText(n,s+c,v+c*3.2);let u=s+x-c*1.9,d=v+y/2,f=Math.min(y*.28,c*1.4);e.lineWidth=f*.32,e.lineCap=`round`,e.strokeStyle=`rgba(255,255,255,0.1)`,e.beginPath(),e.arc(u,d,f,0,Math.PI*2),e.stroke(),e.strokeStyle=a,e.beginPath(),e.arc(u,d,f,-Math.PI/2,-Math.PI/2+Math.PI*2*i),e.stroke()})}function lh(e,t,n){let r=(e,t)=>`${e} ${t}px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`;e.textBaseline=`middle`;let i=e.createLinearGradient(0,0,0,n);i.addColorStop(0,`#12141b`),i.addColorStop(1,`#07080b`),e.fillStyle=i,e.fillRect(0,0,t,n);let a=e.createRadialGradient(t*.85,n*.12,0,t*.85,n*.12,t);a.addColorStop(0,`rgba(124, 92, 255, 0.32)`),a.addColorStop(1,`rgba(124, 92, 255, 0)`),e.fillStyle=a,e.fillRect(0,0,t,n),e.fillStyle=`#f2f3f5`,e.font=r(600,46),e.fillText(`10:08`,108,92);for(let n=0;n<4;n++){let r=12+n*8;e.fillRect(t-84-250+n*22,108-r,14,r)}e.strokeStyle=`rgba(242, 243, 245, 0.5)`,e.lineWidth=3,e.beginPath(),e.roundRect(t-84-140,76,84,34,10),e.stroke(),e.beginPath(),e.roundRect(t-84-134,82,60,22,5),e.fill(),e.fillRect(t-84-52,86,5,14),e.fillStyle=`rgba(242, 243, 245, 0.55)`,e.font=r(500,40),e.fillText(`Tuesday, 21 October`,84,262),e.fillStyle=`#f2f3f5`,e.font=r(700,92),e.fillText(`Good morning`,84,360);let o=t-168,s=e.createLinearGradient(84,450,84+o,1090);s.addColorStop(0,`#6d5dfc`),s.addColorStop(.55,`#c14dd6`),s.addColorStop(1,`#ff8a5c`),e.fillStyle=s,e.beginPath(),e.roundRect(84,450,o,640,64),e.fill(),e.fillStyle=`rgba(255, 255, 255, 0.8)`,e.font=r(600,40),e.fillText(`Focus time today`,148,550),e.fillStyle=`#fff`,e.font=r(700,140),e.fillText(`4h 12m`,140,675),e.fillStyle=`rgba(255, 255, 255, 0.8)`,e.font=r(500,38),e.fillText(`+38 min vs. last week`,148,770);let c=[.35,.55,.42,.7,.5,.92,.64],l=(o-128)/c.length;c.forEach((t,n)=>{let r=t*190;e.fillStyle=n===5?`#fff`:`rgba(255, 255, 255, 0.34)`,e.beginPath(),e.roundRect(148+n*l+l*.2,1026-r,l*.6,r,14),e.fill()});let u=(o-40)/2;[{label:`Steps`,value:`8,240`,progress:.82,color:`#3ddc97`},{label:`Sleep`,value:`7h 40m`,progress:.64,color:`#5ab0ff`}].forEach((t,n)=>{let i=84+n*(u+40);e.fillStyle=`#171a22`,e.beginPath(),e.roundRect(i,1134,u,300,48),e.fill(),e.fillStyle=`rgba(242, 243, 245, 0.55)`,e.font=r(600,38),e.fillText(t.label,i+48,1216),e.fillStyle=`#f2f3f5`,e.font=r(700,70),e.fillText(t.value,i+48,1330);let a=i+u-96,o=1220;e.lineWidth=16,e.lineCap=`round`,e.strokeStyle=`rgba(255, 255, 255, 0.1)`,e.beginPath(),e.arc(a,o,42,0,Math.PI*2),e.stroke(),e.strokeStyle=t.color,e.beginPath(),e.arc(a,o,42,-Math.PI/2,-Math.PI/2+Math.PI*2*t.progress),e.stroke()});let d=1530;e.fillStyle=`#f2f3f5`,e.font=r(700,50),e.fillText(`Up next`,84,d),d+=64;for(let[t,n,i]of[[`Design review`,`11:00 · Studio B`,`#ffb23f`],[`Team lunch`,`13:30 · Rooftop`,`#3ddc97`],[`Ship v0.2`,`17:00 · Release`,`#ff5c7a`]])e.fillStyle=i+`33`,e.beginPath(),e.arc(124,d+68,40,0,Math.PI*2),e.fill(),e.fillStyle=i,e.beginPath(),e.arc(124,d+68,14,0,Math.PI*2),e.fill(),e.fillStyle=`#f2f3f5`,e.font=r(600,46),e.fillText(t,196,d+46),e.fillStyle=`rgba(242, 243, 245, 0.5)`,e.font=r(500,36),e.fillText(n,196,d+96),e.fillStyle=`rgba(255, 255, 255, 0.07)`,e.fillRect(196,d+140,o-112,2),d+=146;let f=n-262;e.fillStyle=`rgba(28, 31, 40, 0.95)`,e.beginPath(),e.roundRect(84,f,o,150,75),e.fill();for(let t=0;t<4;t++){let n=84+o*((t+.5)/4);e.fillStyle=t===0?`#f2f3f5`:`rgba(242, 243, 245, 0.32)`,e.beginPath(),e.roundRect(n-24,f+51,48,48,14),e.fill()}e.fillStyle=`rgba(255, 255, 255, 0.85)`,e.beginPath(),e.roundRect(t/2-140,n-46,280,12,6),e.fill()}var uh=n((()=>{Sp(),oh()})),dh=n((()=>{oh(),uh(),ih()}));function fh({engine:e,element:t,getDoc:n,overrides:r,onTime:i}){let a=0,o=0,s=0,c=!1,l=1,u=!1,d=0,f=0,p=jt,m=jt,h=null,g=null,_=null,v=()=>({...n().interaction,...r,cursor:{...n().interaction.cursor,...r?.cursor}});function y(e){return g&&g.timeline===e.timeline||(g={timeline:e.timeline,compiled:k(e.timeline)}),g.compiled}function b(e,t,n){if(n===`loop`)return(e%t+t)%t;if(n===`pingpong`){let n=e%(t*2);return n<=t?n:t*2-n}return Math.max(0,Math.min(t,e))}function x(e,t,n){let r=t.timeline.duration;switch(n.trigger){case`none`:return 0;case`load`:case`in-view`:case`click`:return c&&(s+=e*n.speed*l),n.loop===`none`&&s>=r&&(s=r,c=!1),b(Math.max(0,s-n.delay),r,n.loop);case`hover`:return c&&(s+=e*n.speed*l,s>=r&&(s=r,n.loop===`none`?c=!1:n.loop===`pingpong`?l=-1:s=0),s<=0&&(s=0,l===-1&&(c=!1))),Math.max(0,Math.min(r,s));case`scroll`:{let t=n.scroll?.smoothing??6;return f+=(d-f)*(1-Math.exp(-e*t)),f*r}case`cursor-move`:return(m.x+1)/2*r}}function S(){let e=t.getBoundingClientRect(),n=window.innerHeight||1,r=v(),i=r.scroll?.start===`top`?n-e.height:n,a=i-(r.scroll?.end===`bottom`?n-e.height:-e.height)||1;d=Math.max(0,Math.min(1,(i-e.top)/a))}function C(t){a=requestAnimationFrame(C);let s=Math.min((t-o)/1e3,.05)||0;o=t;let c=n(),l=v();m=At(m,p,s,l.cursor.smoothing),p={...p,speed:p.speed*Math.exp(-s*6)};let u=x(s,c,l);i?.(u);let d=c.scene.devices.map(e=>e.id),f=[];c.interaction.idle.float>0&&f.push(oe(t/1e3,c.interaction.idle.float,d));let h=R(c,u,[],y(c));f.push(Dt(m,l.cursor,t/1e3,d,h.camera)),r?.cameraZoom&&f.push(Ot(r.cameraZoom,h.camera)),e.renderFrame(R(c,u,f,y(c)))}let w=e=>{let n=t.getBoundingClientRect(),r=(e.clientX-n.left)/n.width*2-1,i=-((e.clientY-n.top)/n.height*2-1),a=performance.now(),o=p.speed;if(h){let e=Math.max(1,a-h.time)/1e3;o=Math.min(1,Math.hypot(r-h.x,i-h.y)/e/6)}h={x:r,y:i,time:a},p={x:Math.max(-1,Math.min(1,r)),y:Math.max(-1,Math.min(1,i)),speed:o}},T=()=>{p=jt,h=null,u=!1;let e=v();e.trigger===`hover`&&(e.hover?.reverseOnLeave??!0?(l=-1,c=!0):c=!1)},E=()=>{u=!0,v().trigger===`hover`&&(l=1,c=!0)},D=()=>{v().trigger===`click`&&(!c||s>=n().timeline.duration?(s>=n().timeline.duration&&(s=0),c=!0):c=!1)},O=()=>S();return{start(){if(a)return;let e=v();t.addEventListener(`pointermove`,w),t.addEventListener(`pointerleave`,T),t.addEventListener(`pointerenter`,E),t.addEventListener(`click`,D),window.addEventListener(`scroll`,O,{passive:!0}),window.addEventListener(`resize`,O),S(),s=0,l=1,c=e.trigger===`load`,e.trigger===`in-view`&&(_=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(c=!0,_?.disconnect())},{threshold:.5}),_.observe(t)),o=performance.now(),a=requestAnimationFrame(C)},stop(){cancelAnimationFrame(a),a=0,t.removeEventListener(`pointermove`,w),t.removeEventListener(`pointerleave`,T),t.removeEventListener(`pointerenter`,E),t.removeEventListener(`click`,D),window.removeEventListener(`scroll`,O),window.removeEventListener(`resize`,O),_?.disconnect(),_=null},restart(){s=0,l=1,c=v().trigger!==`none`&&v().trigger!==`scroll`&&v().trigger!==`cursor-move`&&(v().trigger!==`hover`||u)},dispose(){this.stop()}}}var ph=n((()=>{tn()})),mh=n((()=>{Qm(),Pp(),kp(),Dp(),um(),Hp(),Lp(),Wp(),dh(),ph(),Im(),_m()}));function hh(){return{amount:{value:vh.noise.default},grain:{value:vh.noiseScale.default/10}}}function gh(e,t){e.userData.surfaceNoise=t,e.onBeforeCompile=e=>{e.uniforms.uSurfaceNoiseAmount=t.amount,e.uniforms.uSurfaceNoiseGrain=t.grain,e.vertexShader=e.vertexShader.replace(`#include <common>`,`#include <common>\n${yh}`).replace(`#include <begin_vertex>`,`#include <begin_vertex>\n${bh}`),e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>\n${xh}`).replace(`#include <roughnessmap_fragment>`,Sh).replace(`#include <normal_fragment_maps>`,Ch)},e.customProgramCacheKey=()=>`surface-noise`}function _h(e){let t=new Set;e.group.traverse(e=>{let n=e.material;for(let e of Array.isArray(n)?n:n?[n]:[]){let n=e.userData.surfaceNoise;n&&t.add(n)}});let n=e.setParam;return{...e,params:{...e.params,...vh},setParam(e,r){if(e===`noise`)for(let e of t)e.amount.value=r;else if(e===`noiseScale`)for(let e of t)e.grain.value=r/10;else n(e,r)}}}var vh,yh,bh,xh,Sh,Ch,wh=n((()=>{vh={noise:{min:0,max:1,default:.3,unit:``,label:`Surface noise`},noiseScale:{min:.1,max:5,default:.4,unit:`mm`,label:`Noise size`}},yh=`
|
|
4680
4680
|
varying vec3 vSurfaceNoisePos;
|
|
4681
4681
|
varying vec3 vSurfaceNoiseX;
|
|
4682
4682
|
varying vec3 vSurfaceNoiseY;
|
|
4683
4683
|
varying vec3 vSurfaceNoiseZ;
|
|
4684
|
-
`,
|
|
4684
|
+
`,bh=`
|
|
4685
4685
|
vSurfaceNoisePos = position;
|
|
4686
4686
|
vSurfaceNoiseX = normalMatrix[0];
|
|
4687
4687
|
vSurfaceNoiseY = normalMatrix[1];
|
|
4688
4688
|
vSurfaceNoiseZ = normalMatrix[2];
|
|
4689
|
-
`,
|
|
4689
|
+
`,xh=`
|
|
4690
4690
|
uniform float uSurfaceNoiseAmount;
|
|
4691
4691
|
uniform float uSurfaceNoiseGrain;
|
|
4692
4692
|
varying vec3 vSurfaceNoisePos;
|
|
@@ -4730,7 +4730,7 @@ vec4 surfaceNoiseD( vec3 x ) {
|
|
|
4730
4730
|
)
|
|
4731
4731
|
);
|
|
4732
4732
|
}
|
|
4733
|
-
`,
|
|
4733
|
+
`,Sh=`
|
|
4734
4734
|
#include <roughnessmap_fragment>
|
|
4735
4735
|
float surfaceNoiseFootprint = length( fwidth( vSurfaceNoisePos ) ) / max( uSurfaceNoiseGrain, 1e-4 );
|
|
4736
4736
|
float surfaceNoiseFade1 = 1.0 - smoothstep( 0.6, 1.6, surfaceNoiseFootprint );
|
|
@@ -4750,10 +4750,10 @@ roughnessFactor = clamp(
|
|
|
4750
4750
|
0.03,
|
|
4751
4751
|
1.0
|
|
4752
4752
|
);
|
|
4753
|
-
`,
|
|
4753
|
+
`,Ch=`
|
|
4754
4754
|
#include <normal_fragment_maps>
|
|
4755
4755
|
{
|
|
4756
4756
|
vec3 g = mat3( vSurfaceNoiseX, vSurfaceNoiseY, vSurfaceNoiseZ ) * surfaceNoiseGrad * uSurfaceNoiseAmount;
|
|
4757
4757
|
normal = normalize( normal - ( g - dot( g, normal ) * normal ) );
|
|
4758
4758
|
}
|
|
4759
|
-
`}));function wh(e){e.computeBoundingBox();let t=e.boundingBox,n=e.attributes.position,r=e.attributes.uv;if(!t||!n||!r)return e;for(let e=0;e<n.count;e++)r.setXY(e,(n.getX(e)-t.min.x)/(t.max.x-t.min.x),(n.getY(e)-t.min.y)/(t.max.y-t.min.y));return r.needsUpdate=!0,e}var Th=n((()=>{}));function Eh(e){e.traverse(e=>{if(!(e instanceof Qs))return;e.geometry.dispose();let t=Array.isArray(e.material)?e.material:[e.material];for(let e of t)e.dispose()})}var Dh=n((()=>{xp()}));function Oh(e,t,n,r=2,i=32){return new Mc(kh(e,t,n,r,i))}function kh(e,t,n,r=2,i=32){let a=Math.min(n,e/2,t/2),o=-e/2+a,s=e/2-a,c=-t/2+a,l=t/2-a,u=[[s,c,-Math.PI/2],[s,l,0],[o,l,Math.PI/2],[o,c,Math.PI]],d=[];for(let[e,t,n]of u)for(let o=0;o<=i;o++){let s=n+o/i*(Math.PI/2),c=Math.cos(s),l=Math.sin(s),u=new J(e+a*Math.sign(c)*Math.abs(c)**(2/r),t+a*Math.sign(l)*Math.abs(l)**(2/r)),f=d[d.length-1];(!f||f.distanceToSquared(u)>1e-12)&&d.push(u)}let f=d[0],p=d[d.length-1];return f&&p&&f!==p&&f.distanceToSquared(p)<1e-12&&d.pop(),d}var Ah=n((()=>{xp()}));function jh({width:e,height:t,depth:n,radius:r,exponent:i=2,edge:a,quality:o}){let s=Math.min(a,n/2-1e-4),c=new Fc(Oh(e-2*s,t-2*s,Math.max(r-s,.001),i,o.corner),{depth:n-2*s,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:o.bevel});return c.translate(0,0,-(n-2*s)/2),c}function Mh(e,t,n,r,i){return new Bc(Oh(e,t,n,r,i.corner))}function Q(e,t,n,r={}){let i=new Qs(t,n);return i.castShadow=!0,i.position.set(r.x??0,r.y??0,r.z??0),i.rotation.set(r.rx??0,r.ry??0,r.rz??0),e.add(i),i}function Nh(e,t,n,r,i){let a=r===`x`?e:t,o=r===`x`?t:e,s=Math.min(t,n)*.3,c=new Fc(Oh(a-2*s,o-2*s,Math.min(a,o)/2-s,2,Math.max(6,i.corner/2)),{depth:n-2*s,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:4});return c.translate(0,0,-(n-2*s)/2),c}var Ph,$,Fh=n((()=>{xp(),Ah(),Ph={low:{corner:12,bevel:4,round:24},high:{corner:32,bevel:10,round:64}},$=.002}));function Ih({width:e,height:t,radius:n,exponent:r,segments:i,profile:a}){let o=kh(e,t,n,r,i),s=o.length,c=o.map((e,t)=>{let n=o[(t-1+s)%s],r=o[(t+1)%s];return new J(r.y-n.y,-(r.x-n.x)).normalize()}),l=s+1,u=a.length,d=new Float32Array(l*u*3),f=new Float32Array(l*u*2),p=[0];for(let e=1;e<l;e++)p.push(p[e-1]+o[e%s].distanceTo(o[(e-1)%s]));let m=[0];for(let e=1;e<u;e++){let[t,n]=a[e-1],[r,i]=a[e];m.push(m[e-1]+Math.hypot(r-t,i-n))}for(let e=0;e<u;e++){let[t,n]=a[e];for(let r=0;r<l;r++){let i=o[r%s],a=c[r%s],u=e*l+r;d[u*3]=i.x-a.x*t,d[u*3+1]=i.y-a.y*t,d[u*3+2]=n,f[u*2]=p[r],f[u*2+1]=m[e]}}let h=[];for(let e=0;e<u-1;e++)for(let t=0;t<l-1;t++){let n=e*l+t,r=n+1,i=n+l,a=i+1;h.push(n,i,r,r,i,a)}let g=new Os;g.setAttribute(`position`,new ps(d,3)),g.setAttribute(`uv`,new ps(f,2)),g.setIndex(h),g.computeVertexNormals();let _=g.attributes.normal,v=new Y;for(let e=0;e<u;e++){let t=e*l,n=t+l-1;v.set(_.getX(t)+_.getX(n),_.getY(t)+_.getY(n),_.getZ(t)+_.getZ(n)).normalize(),_.setXYZ(t,v.x,v.y,v.z),_.setXYZ(n,v.x,v.y,v.z)}return g}function Lh(e,t,n=8){let r=[];for(let i=0;i<=n;i++){let a=i/n*(Math.PI/2);r.push([e-e*Math.sin(a),t-e+e*Math.cos(a)])}return r}var Rh=n((()=>{xp(),Ah()}));function zh(e){let t={frame:new Yc({metalness:1,anisotropy:.4}),back:new Yc({roughness:.45,clearcoat:.8,clearcoatRoughness:.28}),island:new Yc({metalness:1,roughness:.3}),glass:new Yc({color:131587,roughness:.6,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02}),display:new Yc({color:0,emissive:16777215,roughness:1,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02,toneMapped:!1}),bezel:new Jc({color:328966,roughness:.55}),dark:new Jc({color:1710620,roughness:.65}),lens:new Yc({color:329224,roughness:.08,clearcoat:1,clearcoatRoughness:.02,iridescence:1,iridescenceIOR:1.8,iridescenceThicknessRange:[220,480]}),lensRing:new Yc({metalness:1,roughness:.12}),pupil:new Yc({color:0,roughness:.3,clearcoat:1,clearcoatRoughness:.05}),flash:new Yc({color:15261640,roughness:.45,clearcoat:1,clearcoatRoughness:.1}),logo:new Yc({metalness:1,roughness:.08,side:2}),accent:new Yc({color:16738816,roughness:.5}),band:new Yc({color:1776413,roughness:.75,sheen:.4,sheenRoughness:.8})},n=mh();for(let e of[t.frame,t.back,t.island])hh(e,n);return Bh(t,e),t}function Bh(e,t){switch(e.frame.color.set(t.frame),e.frame.roughness=t.frameRoughness,e.lensRing.color.set(t.frame).lerp(new No(16777215),.35),e.island.color.set(t.frame),e.back.color.set(t.back),t.backMaterial??`glass`){case`metal`:e.back.metalness=1,e.back.roughness=t.frameRoughness+.05,e.back.clearcoat=0;break;case`ceramic`:e.back.metalness=0,e.back.roughness=.2,e.back.clearcoat=1,e.back.clearcoatRoughness=.05;break;default:e.back.metalness=0,e.back.roughness=.45,e.back.clearcoat=.8,e.back.clearcoatRoughness=.28}e.logo.color.set(t.frame).lerp(new No(16777215),.25),t.accent&&e.accent.color.set(t.accent)}function Vh(e,t,n){return{mesh:e,aspect:t,setTexture(e,r,i=`cover`,a){if(e){let{repeat:n,offset:o}=l(r,t,i,a);e.wrapS=e.wrapT=Yr,e.repeat.set(n[0],n[1]),e.offset.set(o[0],o[1])}n.display.emissiveMap=e,n.display.needsUpdate=!0},setGlare(e,t=`matte`){let r=n.display;t===`glossy`?(r.clearcoat=0,r.roughness=.04,r.specularIntensity=e,r.ior=1.2):(r.clearcoat=t===`matte`?e:0,r.roughness=1,r.specularIntensity=0,r.ior=1.5),n.glass.clearcoat=.25+(t===`clean`?0:e*.75)}}}var Hh=n((()=>{xp(),en(),Ch()}));function Uh(e,t,n=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let r=t.userData.transform,i=e.gradientUnits===`objectBoundingBox`,a=null;if(i&&(a=Wh(t,r),a===null))return null;function o(t,n,o){o.set(t,n,1),e.gradientTransform&&o.applyMatrix3(e.gradientTransform),i&&o.set(a.minX+o.x*a.width,a.minY+o.y*a.height,1),r&&o.applyMatrix3(r)}let s=document.createElement(`canvas`),c;if(e.type===`linearGradient`){s.width=n,s.height=1;let t=s.getContext(`2d`),r=t.createLinearGradient(0,0,n,0);Gh(r,e.stops),t.fillStyle=r,t.fillRect(0,0,n,1);let i=new Y,a=new Y;o(e.x1,e.y1,i),o(e.x2,e.y2,a);let l=a.x-i.x,u=a.y-i.y,d=l*l+u*u||1e-20,f=l/d,p=u/d,m=-(f*i.x+p*i.y);c=new X().set(f,p,m,0,0,.5,0,0,1)}else{let t=e.cx,o=e.cy,l=e.fx,u=e.fy,d=e.r;if(e.gradientTransform){let n=new Y;n.set(t,o,1).applyMatrix3(e.gradientTransform),t=n.x,o=n.y,n.set(l,u,1).applyMatrix3(e.gradientTransform),l=n.x,u=n.y}if(i&&(t=a.minX+t*a.width,o=a.minY+o*a.height,l=a.minX+l*a.width,u=a.minY+u*a.height,d*=Math.sqrt((a.width*a.width+a.height*a.height)/2)),d<=0)return null;s.width=n,s.height=n;let f=s.getContext(`2d`),p=t-d,m=o-d,h=2*d,g=n/h;f.setTransform(g,0,0,g,-p*g,-m*g);let _=f.createRadialGradient(l,u,0,t,o,d);Gh(_,e.stops),f.fillStyle=_,f.fillRect(p,m,h,h);let v=r?r.clone().invert():new X;c=new X().set(1/h,0,-p/h,0,1/h,-m/h,0,0,1).multiply(v)}let l=new oc(s);l.colorSpace=Kh,l.flipY=!1,l.matrixAutoUpdate=!1,l.matrix=c;let u=e.spreadMethod===`reflect`?Xr:e.spreadMethod===`repeat`?Jr:Yr;return l.wrapS=u,l.wrapT=u,l}function Wh(e,t){let n=t?t.clone().invert():null,r=new J,i=new $l;for(let t of e.subPaths)for(let e of t.getPoints())r.copy(e),n&&r.applyMatrix3(n),i.expandByPoint(r);return i.isEmpty()?null:{minX:i.min.x,minY:i.min.y,width:i.max.x-i.min.x,height:i.max.y-i.min.y}}function Gh(e,t){let n=new No;for(let r of t){let t=r.color;if(r.opacity<1){n.setStyle(r.color,Kh);let e=/rgb\(([^)]+)\)/.exec(n.getStyle(Kh));e&&(t=`rgba(${e[1]},${r.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,r.offset)),t)}}var Kh,qh,Jh,Yh=n((()=>{xp(),Kh=ga,qh=class e extends ml{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit=`px`}load(e,t,n,r){let i=this,a=new _l(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this;function n(e,t){if(e.nodeType!==1)return;e.hasAttribute(`filter`)&&console.warn(`THREE.SVGLoader: Filters are not supported.`);let a=b(e),o=!1,p=null;switch(e.nodeName){case`svg`:t=m(e,t);break;case`style`:i(e);break;case`g`:t=m(e,t);break;case`path`:t=m(e,t),e.hasAttribute(`d`)&&(p=r(e));break;case`rect`:t=m(e,t),p=s(e);break;case`polygon`:t=m(e,t),p=c(e);break;case`polyline`:t=m(e,t),p=l(e);break;case`circle`:t=m(e,t),p=u(e);break;case`ellipse`:t=m(e,t),p=d(e);break;case`line`:t=m(e,t),p=f(e);break;case`defs`:o=!0;break;case`use`:t=m(e,t);let a=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||``).substring(1),h=e.viewportElement.getElementById(a);h?n(h,t):console.warn(`SVGLoader: 'use node' references non-existent node id: `+a)}if(p){t.fill!==void 0&&t.fill!==`none`&&!t.fill.startsWith(`url`)&&p.color.setStyle(t.fill,Kh),C(p,re),A.push(p);let n=Object.assign({},t);n.strokeWidth=t.strokeWidth*O(re),p.userData={node:e,style:n,transform:re.clone(),gradients:M}}let h=e.childNodes;for(let e=0;e<h.length;e++){let r=h[e];o&&r.nodeName!==`style`&&r.nodeName!==`defs`||n(r,t)}a&&(N.pop(),N.length>0?re.copy(N[N.length-1]):re.identity())}function r(e){let t=new eu,n=new J,r=new J,i=new J,o=!0,s=!1,c=e.getAttribute(`d`);if(c===``||c===`none`)return null;let l=c.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,c=l.length;e<c;e++){let c=l[e],u=c.charAt(0),d=c.slice(1).trim();o===!0&&(s=!0,o=!1);let f;switch(u){case`M`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x=f[e+0],n.y=f[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`H`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.x=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`V`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.y=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`L`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x=f[e+0],n.y=f[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`C`:f=g(d);for(let e=0,a=f.length;e<a;e+=6)t.bezierCurveTo(f[e+0],f[e+1],f[e+2],f[e+3],f[e+4],f[e+5]),r.x=f[e+2],r.y=f[e+3],n.x=f[e+4],n.y=f[e+5],e===0&&s===!0&&i.copy(n);break;case`S`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),f[e+0],f[e+1],f[e+2],f[e+3]),r.x=f[e+0],r.y=f[e+1],n.x=f[e+2],n.y=f[e+3],e===0&&s===!0&&i.copy(n);break;case`Q`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.quadraticCurveTo(f[e+0],f[e+1],f[e+2],f[e+3]),r.x=f[e+0],r.y=f[e+1],n.x=f[e+2],n.y=f[e+3],e===0&&s===!0&&i.copy(n);break;case`T`:f=g(d);for(let e=0,a=f.length;e<a;e+=2){let a=h(n.x,r.x),o=h(n.y,r.y);t.quadraticCurveTo(a,o,f[e+0],f[e+1]),r.x=a,r.y=o,n.x=f[e+0],n.y=f[e+1],e===0&&s===!0&&i.copy(n)}break;case`A`:f=g(d,[3,4],7);for(let e=0,o=f.length;e<o;e+=7){if(f[e+5]==n.x&&f[e+6]==n.y)continue;let o=n.clone();n.x=f[e+5],n.y=f[e+6],r.x=n.x,r.y=n.y,a(t,f[e],f[e+1],f[e+2],f[e+3],f[e+4],o,n),e===0&&s===!0&&i.copy(n)}break;case`m`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x+=f[e+0],n.y+=f[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`h`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.x+=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`v`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.y+=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`l`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x+=f[e+0],n.y+=f[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`c`:f=g(d);for(let e=0,a=f.length;e<a;e+=6)t.bezierCurveTo(n.x+f[e+0],n.y+f[e+1],n.x+f[e+2],n.y+f[e+3],n.x+f[e+4],n.y+f[e+5]),r.x=n.x+f[e+2],r.y=n.y+f[e+3],n.x+=f[e+4],n.y+=f[e+5],e===0&&s===!0&&i.copy(n);break;case`s`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),n.x+f[e+0],n.y+f[e+1],n.x+f[e+2],n.y+f[e+3]),r.x=n.x+f[e+0],r.y=n.y+f[e+1],n.x+=f[e+2],n.y+=f[e+3],e===0&&s===!0&&i.copy(n);break;case`q`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.quadraticCurveTo(n.x+f[e+0],n.y+f[e+1],n.x+f[e+2],n.y+f[e+3]),r.x=n.x+f[e+0],r.y=n.y+f[e+1],n.x+=f[e+2],n.y+=f[e+3],e===0&&s===!0&&i.copy(n);break;case`t`:f=g(d);for(let e=0,a=f.length;e<a;e+=2){let a=h(n.x,r.x),o=h(n.y,r.y);t.quadraticCurveTo(a,o,n.x+f[e+0],n.y+f[e+1]),r.x=a,r.y=o,n.x+=f[e+0],n.y+=f[e+1],e===0&&s===!0&&i.copy(n)}break;case`a`:f=g(d,[3,4],7);for(let e=0,o=f.length;e<o;e+=7){if(f[e+5]==0&&f[e+6]==0)continue;let o=n.clone();n.x+=f[e+5],n.y+=f[e+6],r.x=n.x,r.y=n.y,a(t,f[e],f[e+1],f[e+2],f[e+3],f[e+4],o,n),e===0&&s===!0&&i.copy(n)}break;case`Z`:case`z`:t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(n.copy(i),t.currentPath.currentPoint.copy(n),o=!0);break;default:console.warn(c)}s=!1}return t}function i(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let n=e.sheet.cssRules[t];if(n.type!==1)continue;let r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim());for(let e=0;e<r.length;e++){let t=Object.fromEntries(Object.entries(n.style).filter(([,e])=>e!==``));j[r[e]]=Object.assign(j[r[e]]||{},t)}}}function a(e,t,n,r,i,a,s,c){if(t==0||n==0){e.lineTo(c.x,c.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let l=(s.x-c.x)/2,u=(s.y-c.y)/2,d=Math.cos(r)*l+Math.sin(r)*u,f=-Math.sin(r)*l+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(s.x+c.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(s.y+c.y)/2,T=o(1,0,(d-x)/t,(f-S)/n),E=o((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.currentPath.absellipse(C,w,t,n,T,T+E,a===0,r)}function o(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function s(e){let t=y(e.getAttribute(`x`)||0),n=y(e.getAttribute(`y`)||0),r=y(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=y(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=y(e.getAttribute(`width`)),o=y(e.getAttribute(`height`)),s=.448084975506,c=new eu;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function c(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new eu,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!0,r}function l(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new eu,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!1,r}function u(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`r`)||0),i=new jc;i.absarc(t,n,r,0,Math.PI*2);let a=new eu;return a.subPaths.push(i),a}function d(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`rx`)||0),i=y(e.getAttribute(`ry`)||0),a=new jc;a.absellipse(t,n,r,i,0,Math.PI*2);let o=new eu;return o.subPaths.push(a),o}function f(e){let t=y(e.getAttribute(`x1`)||0),n=y(e.getAttribute(`y1`)||0),r=y(e.getAttribute(`x2`)||0),i=y(e.getAttribute(`y2`)||0),a=new eu;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}function p(e){let t=e.querySelectorAll(`linearGradient, radialGradient`),n=[`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`],r={};for(let e of t){let t=e.getAttribute(`id`);if(!t)continue;let i={type:e.nodeName===`radialGradient`?`radialGradient`:`linearGradient`,attrs:{},stops:null,href:null},a=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``;a.startsWith(`#`)&&(i.href=a.substring(1));for(let t of n)e.hasAttribute(t)&&(i.attrs[t]=e.getAttribute(t));let o=e.querySelectorAll(`stop`);if(o.length>0){i.stops=[];for(let e of o){let t=e.getAttribute(`stop-color`);!t&&e.style&&(t=e.style[`stop-color`]),t||=`#000`;let n=e.getAttribute(`stop-opacity`);(n===null||n===``)&&e.style&&(n=e.style[`stop-opacity`]),n=n===null||n===``||n===void 0?1:Math.max(0,Math.min(1,parseFloat(n)));let r=Math.max(0,Math.min(1,parseFloat(e.getAttribute(`offset`)||`0`)));i.stops.push({offset:r,color:t,opacity:n})}}r[t]=i}function i(e,t){let n=r[e];if(!n||t.has(e))return n;if(t.add(e),n.href&&r[n.href]){let e=i(n.href,t);if(e){n.stops||=e.stops;for(let t in e.attrs)t in n.attrs||(n.attrs[t]=e.attrs[t])}}return n}for(let e in r)i(e,new Set);for(let e in r){let t=r[e],n=t.attrs,i=n.gradientUnits===`userSpaceOnUse`?`userSpaceOnUse`:`objectBoundingBox`,a={type:t.type,gradientUnits:i,spreadMethod:n.spreadMethod===`reflect`||n.spreadMethod===`repeat`?n.spreadMethod:`pad`,gradientTransform:null,stops:(t.stops||[]).slice().sort((e,t)=>e.offset-t.offset)};n.gradientTransform&&(a.gradientTransform=new X,S(n.gradientTransform,a.gradientTransform));function o(e){return typeof e==`string`?e.endsWith(`%`)?parseFloat(e)/100:y(e):0}if(t.type===`linearGradient`)a.x1=n.x1===void 0?0:o(n.x1),a.y1=n.y1===void 0?0:o(n.y1),a.x2=n.x2===void 0?+(i===`objectBoundingBox`):o(n.x2),a.y2=n.y2===void 0?0:o(n.y2);else{let e=i===`objectBoundingBox`?.5:0,t=i===`objectBoundingBox`?.5:0;a.cx=n.cx===void 0?e:o(n.cx),a.cy=n.cy===void 0?e:o(n.cy),a.r=n.r===void 0?t:o(n.r),a.fx=n.fx===void 0?a.cx:o(n.fx),a.fy=n.fy===void 0?a.cy:o(n.fy)}M[e]=a}}function m(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)n=Object.assign(n,j[`.`+t[e]])}e.hasAttribute(`id`)&&(n=Object.assign(n,j[`#`+e.getAttribute(`id`)]));function r(r,i,a){a===void 0&&(a=function(e){return e}),e.hasAttribute(r)&&(t[i]=a(e.getAttribute(r))),n[i]&&(t[i]=a(n[i])),e.style&&e.style[r]!==``&&(t[i]=a(e.style[r]))}function i(e){return Math.max(0,Math.min(1,y(e)))}function a(e){return Math.max(0,y(e))}return r(`fill`,`fill`),r(`fill-opacity`,`fillOpacity`,i),r(`fill-rule`,`fillRule`),r(`opacity`,`opacity`,i),r(`stroke`,`stroke`),r(`stroke-opacity`,`strokeOpacity`,i),r(`stroke-width`,`strokeWidth`,a),r(`stroke-linejoin`,`strokeLineJoin`),r(`stroke-linecap`,`strokeLineCap`),r(`stroke-miterlimit`,`strokeMiterLimit`,a),r(`visibility`,`visibility`),t}function h(e,t){return e-(t-e)}function g(e,t,n){if(typeof e!=`string`)throw TypeError(`Invalid input: `+typeof e);let r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},i=0,a=!0,o=``,s=``,c=[];function l(e,t,n){let r=SyntaxError(`Unexpected character "`+e+`" at index `+t+`.`);throw r.partial=n,r}function u(){o!==``&&(s===``?c.push(Number(o)):c.push(Number(o)*10**Number(s))),o=``,s=``}let d,f=e.length;for(let p=0;p<f;p++)if(d=e[p],Array.isArray(t)&&t.includes(c.length%n)&&r.FLAGS.test(d))i=1,o=d,u();else{if(i===0){if(r.WHITESPACE.test(d))continue;if(r.DIGIT.test(d)||r.SIGN.test(d)){i=1,o=d;continue}if(r.POINT.test(d)){i=2,o=d;continue}r.COMMA.test(d)&&(a&&l(d,p,c),a=!0)}if(i===1){if(r.DIGIT.test(d)){o+=d;continue}if(r.POINT.test(d)){o+=d,i=2;continue}if(r.EXP.test(d)){i=3;continue}r.SIGN.test(d)&&o.length===1&&r.SIGN.test(o[0])&&l(d,p,c)}if(i===2){if(r.DIGIT.test(d)){o+=d;continue}if(r.EXP.test(d)){i=3;continue}r.POINT.test(d)&&o[o.length-1]===`.`&&l(d,p,c)}if(i===3){if(r.DIGIT.test(d)){s+=d;continue}if(r.SIGN.test(d)){if(s===``){s+=d;continue}s.length===1&&r.SIGN.test(s)&&l(d,p,c)}}r.WHITESPACE.test(d)?(u(),i=0,a=!1):r.COMMA.test(d)?(u(),i=0,a=!0):r.SIGN.test(d)?(u(),i=1,o=d):r.POINT.test(d)?(u(),i=2,o=d):l(d,p,c)}return u(),c}let _=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],v={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function y(e){let n=`px`;if(typeof e==`string`||e instanceof String)for(let t=0,r=_.length;t<r;t++){let r=_[t];if(e.endsWith(r)){n=r,e=e.substring(0,e.length-r.length);break}}let r;return n===`px`&&t.defaultUnit!==`px`?r=v.in[t.defaultUnit]/t.defaultDPI:(r=v[n][t.defaultUnit],r<0&&(r=v[n].in*t.defaultDPI)),r*parseFloat(e)}function b(e){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let t=x(e);return N.length>0&&t.premultiply(N[N.length-1]),re.copy(t),N.push(t),t}function x(e){let t=new X;if(e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))){let n=y(e.getAttribute(`x`)||0),r=y(e.getAttribute(`y`)||0);t.makeTranslation(n,r)}return e.hasAttribute(`transform`)&&S(e.getAttribute(`transform`),t),t}function S(e,t){let n=P,r=e.split(`)`);for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(i===``)continue;let a=i.indexOf(`(`),o=i.length;if(a>0&&a<o){let e=i.slice(0,a),r=g(i.slice(a+1));switch(n.identity(),e){case`translate`:if(r.length>=1){let e=r[0],t=0;r.length>=2&&(t=r[1]),n.makeTranslation(e,t)}break;case`rotate`:if(r.length>=1){let e=0,t=0,i=0;e=r[0]*Math.PI/180,r.length>=3&&(t=r[1],i=r[2]),F.makeTranslation(-t,-i),I.makeRotation(e),ee.multiplyMatrices(I,F),F.makeTranslation(t,i),n.multiplyMatrices(F,ee)}break;case`scale`:if(r.length>=1){let e=r[0],t=e;r.length>=2&&(t=r[1]),n.makeScale(e,t)}break;case`skewX`:r.length===1&&n.set(1,Math.tan(r[0]*Math.PI/180),0,0,1,0,0,0,1);break;case`skewY`:r.length===1&&n.set(1,0,0,Math.tan(r[0]*Math.PI/180),1,0,0,0,1);break;case`matrix`:r.length===6&&n.set(r[0],r[2],r[4],r[1],r[3],r[5],0,0,1)}t.premultiply(n)}}return t}function C(e,t){function n(e){ne.set(e.x,e.y,1).applyMatrix3(t),e.set(ne.x,ne.y)}function r(e){let n=e.xRadius,r=e.yRadius,i=Math.cos(e.aRotation),a=Math.sin(e.aRotation),o=new Y(n*i,n*a,0),s=new Y(-r*a,r*i,0),c=o.applyMatrix3(t),l=s.applyMatrix3(t),u=P.set(c.x,l.x,0,c.y,l.y,0,0,0,1),d=F.copy(u).invert(),f=I.copy(d).transpose().multiply(d).elements,p=k(f[0],f[1],f[4]),m=Math.sqrt(p.rt1),h=Math.sqrt(p.rt2);if(e.xRadius=1/m,e.yRadius=1/h,e.aRotation=Math.atan2(p.sn,p.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<2**-52)){let n=F.set(m,0,0,0,h,0,0,0,1),r=I.set(p.cs,p.sn,0,-p.sn,p.cs,0,0,0,1),i=n.multiply(r).multiply(u),a=e=>{let{x:t,y:n}=new Y(Math.cos(e),Math.sin(e),0).applyMatrix3(i);return Math.atan2(n,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),w(t)&&(e.aClockwise=!e.aClockwise)}}function i(e){let n=E(t),r=D(t);e.xRadius*=n,e.yRadius*=r;let i=n>2**-52?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,w(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}let a=e.subPaths;for(let e=0,o=a.length;e<o;e++){let o=a[e].curves;for(let e=0;e<o.length;e++){let a=o[e];a.isLineCurve?(n(a.v1),n(a.v2)):a.isCubicBezierCurve?(n(a.v0),n(a.v1),n(a.v2),n(a.v3)):a.isQuadraticBezierCurve?(n(a.v0),n(a.v1),n(a.v2)):a.isEllipseCurve&&(te.set(a.aX,a.aY),n(te),a.aX=te.x,a.aY=te.y,T(t)?r(a):i(a))}}}function w(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function T(e){let t=e.elements,n=t[0]*t[3]+t[1]*t[4];if(n===0)return!1;let r=E(e),i=D(e);return Math.abs(n/(r*i))>2**-52}function E(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function D(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function O(e){let t=e.elements,n=t[0]*t[4]-t[1]*t[3];return Math.sqrt(Math.abs(n))}function k(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}let A=[],j={},M={},N=[],P=new X,F=new X,I=new X,ee=new X,te=new J,ne=new Y,re=new X,L=new DOMParser().parseFromString(e,`image/svg+xml`);return p(L),n(L.documentElement,{fill:`#000`,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:`miter`,strokeLineCap:`butt`,strokeMiterLimit:4}),{paths:A,gradients:M,xml:L.documentElement}}static createFillMaterial(e){let t=e.userData.style;if(t.fill===void 0||t.fill===`none`)return null;let n=e.color,r=null,i=Jh.exec(t.fill);i&&(r=Uh(e.userData.gradients&&e.userData.gradients[i[1]],e));let a=new Bs({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1});return r===null?a.color=n:a.map=r,a}static createStrokeMaterial(e){let t=e.userData.style;return t.stroke===void 0||t.stroke===`none`?null:(Jh.test(t.stroke)&&console.warn(`THREE.SVGLoader: Gradient strokes are not supported.`),new Bs({color:new No().setStyle(t.stroke,Kh),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1}))}static createShapes(e){return console.warn(`SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.`),e.toShapes()}static getStrokeStyle(e,t,n,r,i){return e=e===void 0?1:e,t=t===void 0?`#000`:t,n=n===void 0?`miter`:n,r=r===void 0?`butt`:r,i=i===void 0?4:i,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:i}}static pointsToStroke(t,n,r,i){let a=[],o=[],s=[];if(e.pointsToStrokeWithBuffers(t,n,r,i,a,o,s)===0)return null;let c=new Os;return c.setAttribute(`position`,new gs(a,3)),c.setAttribute(`normal`,new gs(o,3)),c.setAttribute(`uv`,new gs(s,2)),c}static pointsToStrokeWithBuffers(e,t,n,r,i,a,o,s){let c=new J,l=new J,u=new J,d=new J,f=new J,p=new J,m=new J,h=new J,g=new J,_=new J,v=new J,y=new J,b=new J,x=new J,S=new J,C=new J,w=new J;n=n===void 0?12:n,r=r===void 0?.001:r,s=s===void 0?0:s,e=le(e);let T=e.length;if(T<2)return 0;let E=e[0].equals(e[T-1]),D,O=e[0],k,A=t.strokeWidth/2,j=1/(T-1),M=0,N,P,F,I,ee=!1,te=0,ne=s*3,re=s*2;L(e[0],e[1],c).multiplyScalar(A),h.copy(e[0]).sub(c),g.copy(e[0]).add(c),_.copy(h),v.copy(g);for(let n=1;n<T;n++){D=e[n],k=n===T-1?E?e[1]:void 0:e[n+1];let r=c;if(L(O,D,r),u.copy(r).multiplyScalar(A),y.copy(D).sub(u),b.copy(D).add(u),N=M+j,P=!1,k!==void 0){L(D,k,l),u.copy(l).multiplyScalar(A),x.copy(D).sub(u),S.copy(D).add(u),F=!0,u.subVectors(k,O),r.dot(u)<0&&(F=!1),n===1&&(ee=F),u.subVectors(k,D),u.normalize();let e=Math.abs(r.dot(u));if(e>2**-52){let n=A/e;u.multiplyScalar(-n),d.subVectors(D,O),f.copy(d).setLength(n).add(u),C.copy(f).negate();let r=f.length(),i=d.length();d.divideScalar(i),p.subVectors(k,D);let a=p.length();if(p.divideScalar(a),d.dot(C)<i&&p.dot(C)<a&&(P=!0),w.copy(f).add(D),C.add(D),P){let e=F?g:h,t=(w.x-e.x)*(C.y-e.y)-(w.y-e.y)*(C.x-e.x);(F&&t<0||!F&&t>0)&&C.copy(e)}switch(I=!1,P?F?(S.copy(C),b.copy(C)):(x.copy(C),y.copy(C)):ae(),t.strokeLineJoin){case`bevel`:oe(F,P,N);break;case`round`:se(F,P),F?ie(D,y,x,N,0):ie(D,S,b,N,1);break;default:let e=A*t.strokeMiterLimit/r;if(e<1){if(t.strokeLineJoin!==`miter-clip`){oe(F,P,N);break}se(F,P),F?(p.subVectors(w,y).multiplyScalar(e).add(y),m.subVectors(w,x).multiplyScalar(e).add(x),R(y,N,0),R(p,N,0),R(D,N,.5),R(D,N,.5),R(p,N,0),R(m,N,0),R(D,N,.5),R(m,N,0),R(x,N,0)):(p.subVectors(w,b).multiplyScalar(e).add(b),m.subVectors(w,S).multiplyScalar(e).add(S),R(b,N,1),R(p,N,1),R(D,N,.5),R(D,N,.5),R(p,N,1),R(m,N,1),R(D,N,.5),R(m,N,1),R(S,N,1))}else P?(F?(R(g,M,1),R(h,M,0),R(w,N,0),R(g,M,1),R(w,N,0),R(C,N,1)):(R(g,M,1),R(h,M,0),R(w,N,1),R(h,M,0),R(C,N,0),R(w,N,1)),F?x.copy(w):S.copy(w)):F?(R(y,N,0),R(w,N,0),R(D,N,.5),R(D,N,.5),R(w,N,0),R(x,N,0)):(R(b,N,1),R(w,N,1),R(D,N,.5),R(D,N,.5),R(w,N,1),R(S,N,1)),I=!0}}else ae()}else ae();!E&&n===T-1&&ce(e[0],_,v,F,!0,M),M=N,O=D,h.copy(x),g.copy(S)}if(!E)ce(D,y,b,F,!1,N);else if(P&&i){let e=w,t=C;ee!==F&&(e=C,t=w),F?(I||ee)&&(t.toArray(i,0),t.toArray(i,9),I&&e.toArray(i,3)):(I||!ee)&&(t.toArray(i,3),t.toArray(i,9),I&&e.toArray(i,0))}if(i){let e=[new J,new J,new J],t=s*3;for(let n=t;n<ne;n+=9)e[0].set(i[n],i[n+1]),e[1].set(i[n+3],i[n+4]),e[2].set(i[n+6],i[n+7]),Pc.area(e)<0&&(i[n+3]=e[0].x,i[n+4]=e[0].y)}return te;function L(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function R(e,t,n){i&&(i[ne]=e.x,i[ne+1]=e.y,i[ne+2]=0,a&&(a[ne]=0,a[ne+1]=0,a[ne+2]=1),ne+=3,o&&(o[re]=t,o[re+1]=n,re+=2)),te+=3}function ie(e,t,r,i,a){c.copy(t).sub(e).normalize(),l.copy(r).sub(e).normalize();let o=Math.PI,s=c.dot(l);Math.abs(s)<1&&(o=Math.abs(Math.acos(s))),o/=n,u.copy(t);for(let t=0,r=n-1;t<r;t++)d.copy(u).rotateAround(e,o),R(u,i,a),R(d,i,a),R(e,i,.5),u.copy(d);R(u,i,a),R(r,i,a),R(e,i,.5)}function ae(){R(g,M,1),R(h,M,0),R(y,N,0),R(g,M,1),R(y,N,0),R(b,N,1)}function oe(e,t,n){t?e?(R(g,M,1),R(h,M,0),R(y,N,0),R(g,M,1),R(y,N,0),R(C,N,1),R(y,n,0),R(x,n,0),R(C,n,.5)):(R(g,M,1),R(h,M,0),R(b,N,1),R(h,M,0),R(C,N,0),R(b,N,1),R(b,n,1),R(C,n,0),R(S,n,1)):e?(R(y,n,0),R(x,n,0),R(D,n,.5)):(R(b,n,1),R(S,n,0),R(D,n,.5))}function se(e,t){t&&(e?(R(g,M,1),R(h,M,0),R(y,N,0),R(g,M,1),R(y,N,0),R(C,N,1),R(y,M,0),R(D,N,.5),R(C,N,1),R(D,N,.5),R(x,M,0),R(C,N,1)):(R(g,M,1),R(h,M,0),R(b,N,1),R(h,M,0),R(C,N,0),R(b,N,1),R(b,M,1),R(C,N,0),R(D,N,.5),R(D,N,.5),R(C,N,0),R(S,M,1)))}function ce(e,n,r,a,s,f){switch(t.strokeLineCap){case`round`:s?ie(e,r,n,f,.5):ie(e,n,r,f,.5);break;case`square`:if(s)c.subVectors(n,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e),a?(u.toArray(i,3),d.toArray(i,0),d.toArray(i,9)):(u.toArray(i,3),o[7]===1?d.toArray(i,9):u.toArray(i,9),d.toArray(i,0));else{c.subVectors(r,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e);let t=i.length;a?(u.toArray(i,t-3),d.toArray(i,t-6),d.toArray(i,t-12)):(d.toArray(i,t-6),u.toArray(i,t-3),d.toArray(i,t-12))}}}function le(e){let t=!1;for(let n=1,i=e.length-1;n<i;n++)if(e[n].distanceTo(e[n+1])<r){t=!0;break}if(!t)return e;let n=[];n.push(e[0]);for(let t=1,i=e.length-1;t<i;t++)e[t].distanceTo(e[t+1])>=r&&n.push(e[t]);return n.push(e[e.length-1]),n}}},Jh=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/}));function Xh(){if(!$h){let e=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${Qh}"/></svg>`,{paths:t}=new qh().parse(e);$h=t.flatMap(e=>qh.createShapes(e))}return $h}function Zh(e){let t=new Bc(Xh(),12);t.computeBoundingBox();let n=t.boundingBox;if(!n)return t;let r=new Y;n.getSize(r);let i=new Y;n.getCenter(i);let a=e/r.y;return t.translate(-i.x,-i.y,0),t.scale(a,-a,1),t.computeVertexNormals(),t}var Qh,$h,eg=n((()=>{xp(),Yh(),Qh=`M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701`,$h=null}));function tg(){return{logo:new Yc({roughness:.35,specularIntensity:.4,clearcoat:.3,clearcoatRoughness:.15,side:2}),seam:new Jc({roughness:.9}),cover:new Yc({color:0,roughness:.02,ior:1.77,specularIntensity:.45,iridescence:1,iridescenceIOR:1.38,iridescenceThicknessRange:[95,130],transparent:!0,blending:2,depthWrite:!1}),well:new Yc({color:131587,roughness:.55,specularIntensity:.4}),control:new Yc({color:921104,roughness:.1,clearcoat:1,clearcoatRoughness:.03})}}function ng(e,t,n){Bh(e,n),e.frame.anisotropy=0,e.lensRing.color.set(n.frame).lerp(lg,.06),e.lensRing.roughness=.24,e.back.roughness=.55,e.back.specularIntensity=.6,e.back.clearcoat=.2,e.back.clearcoatRoughness=.4,t.logo.color.set(n.back).multiplyScalar(.78),t.seam.color.set(n.back).multiplyScalar(.3)}function rg(e,t,n=`high`){let r=Ph[n],{width:i,height:a,depth:o,rimInset:s,bezel:c}=e,{radius:l,exponent:u}=e.corner,d=zh(t),f=tg();ng(d,f,t);let p=new Do;Q(p,Ih({width:i,height:a,radius:l,exponent:u,segments:r.corner,profile:e.edgeProfile}),d.frame);for(let t of e.buttons)ag(e,t,d,f,p,r);let m=new Do;m.position.z=o/2,p.add(m),Q(m,jh({width:i-2*s,height:a-2*s,radius:l-s,exponent:u,depth:.05,edge:.022,quality:r}),d.glass,{z:-.05/2});let h=i-2*c,g=a-2*c,_=Q(m,wh(Mh(h,g,l-c,u,r)),d.display,{z:$*2});Q(m,Mh(e.island.width,e.island.height,e.island.height/2,2,r),d.bezel,{y:g/2-e.island.fromTop-e.island.height/2,z:$*3});let[v,y]=e.edgeProfile[e.edgeProfile.length-1],b=new Do;b.position.z=y,b.rotation.y=Math.PI,p.add(b),Q(b,Mh(i-2*v,a-2*v,l-v,u,r),d.frame),og(e,d,f,b,r),sg(e,d,f,b,r);let x=Vh(_,h/g,d);return{group:p,screens:[x],bounds:new Xo().setFromObject(p),params:{},restsOnFloor:!1,setParam(){},setFinish:e=>ng(d,f,e),setGlare:(e,t)=>x.setGlare(e,t),dispose:()=>{Eh(p);for(let e of Object.values(f))e.dispose()}}}function ig(e,t,n){return{x:-e.width/2+t,y:e.height/2-n}}function ag(e,t,n,r,i,a){let o=e.height/2-t.fromTop,s=e.width/2*t.side;if(t.kind===`camera`){Q(i,Nh(t.length,.304,.03,`y`,a),n.lensRing,{x:s-t.side*.012,y:o,ry:Math.PI/2}),Q(i,Nh(t.length-.046,.259,.03,`y`,a),r.control,{x:s-t.side*.006,y:o,ry:Math.PI/2});return}let c=.146;Q(i,Nh(t.length,.267,c,`y`,a),n.frame,{x:s+t.side*(.046-c/2),y:o,ry:Math.PI/2})}function og(e,t,n,r,i){let{fromTop:a,margin:o,radius:s}=e.backPanel,c=e.width-2*o,l=e.height-a-o,u=e.height/2-a-l/2,d=.012;Q(r,Mh(c+2*d,l+2*d,s+d,e.corner.exponent,i),n.seam,{y:u,z:$}),Q(r,Mh(c,l,s,e.corner.exponent,i),t.back,{y:u,z:$*2}),e.branding!==!1&&Q(r,Zh(e.logo.height),n.logo,{y:e.height/2-e.logo.fromTop,z:$*3})}function sg(e,t,n,r,i){let{height:a,margin:o,raise:s,radius:c,lip:l}=e.plateau,u=e.width-2*o,d=e.height/2-o-a/2,f=e.corner.exponent,p=[...Lh(l,s,i.bevel),[0,-.02]];Q(r,Ih({width:u,height:a,radius:c,exponent:f,segments:i.corner,profile:p}),t.frame,{y:d}),Q(r,Mh(u-2*l,a-2*l,c-l,f,i),t.frame,{y:d,z:s});let m=cg(e.lens.radius,i.round);for(let[i,a]of e.lens.centres){let o=ig(e,i,a),c=new Do;c.position.set(o.x,o.y,s),c.rotation.x=Math.PI/2,r.add(c),Q(c,m.housing,t.lensRing),Q(c,m.well,n.well),Q(c,m.element,t.lens),Q(c,m.cover,n.cover).renderOrder=1}let h=ig(e,e.flash.x,e.flash.y);Q(r,new zc(e.flash.radius*.86,e.flash.radius,i.round),t.lensRing,{...h,z:s+$}),Q(r,new dc(e.flash.radius*.86,i.round),t.flash,{...h,z:s+$});let g=ig(e,e.lidar.x,e.lidar.y);Q(r,new dc(e.lidar.radius,i.round),t.pupil,{...g,z:s+$});let _=ig(e,e.mic.x,e.mic.y);Q(r,new dc(e.mic.radius,16),t.bezel,{..._,z:s+$})}function cg(e,t){let n=e/.833,r=e=>new Lc(e.map(([e,t])=>new J(e*n,t*n)),t);return{housing:r([[.833,-.02],[.833,.137],[.83,.152],[.822,.165],[.81,.176],[.795,.185],[.775,.189],[.75,.19],[.711,.19],[.711,.03],[.67,.03]]),well:r([[.712,.035],[.646,.035],[.646,.183],[.482,.183],[.47,.17],[.42,.11],[.325,.105],[.3,.075],[.275,.056],[.256,-.035]]),element:r([[.256,-.035],[.24,-.02],[.2,.01],[.15,.035],[.1,.05],[.05,.058],[0,.06]]),cover:r([[.711,.056],[.717,.2],[.712,.205],[.705,.209],[.69,.212],[0,.212]])}}var lg,ug=n((()=>{xp(),Th(),Dh(),Fh(),Rh(),Hh(),eg(),lg=new No(16777215)})),dg,fg=n((()=>{dg={black:{label:`Black`,frame:`#2e2f33`,back:`#1b1c20`,frameRoughness:.4,backMaterial:`glass`},silver:{label:`Silver`,frame:`#cfd0d2`,back:`#d2d2d0`,frameRoughness:.42,backMaterial:`glass`},glacier:{label:`Glacier`,frame:`#bccddb`,back:`#ccdae6`,frameRoughness:.42,backMaterial:`glass`},burgundy:{label:`Burgundy`,frame:`#553a3e`,back:`#3d2226`,frameRoughness:.38,backMaterial:`glass`}}}));function pg(e){return{flash:{radius:.3365,x:e-1.388,y:1.382},lidar:{radius:.336,x:e-1.388,y:3.416},mic:{radius:.038,x:e-1.695,y:3.07}}}var mg,hg,gg,_g,vg=n((()=>{mg={depth:.875,corner:{radius:1.4,exponent:2.2},edgeProfile:[[1.22,4.7],[1.16,4.81],[.92,4.78],[.77,4.69],[.56,4.47],[.38,4.21],[.25,3.92],[.16,3.62],[.1,3.28],[.05,2.9],[.02,2.3],[0,1.6],[0,-.4],[.01,-1],[.03,-1.36],[.05,-1.6],[.07,-1.75],[.1,-1.97],[.17,-2.33],[.27,-2.63],[.41,-2.91],[.59,-3.16],[.82,-3.37],[1.09,-3.53],[1.36,-3.64],[1.72,-3.73],[2.22,-3.8],[2.86,-3.83]].map(([e,t])=>[e/10,t/10-.0555]),rimInset:.12,bezel:.256,island:{width:1.575,height:.607,fromTop:.232},plateau:{height:4.012,margin:.387,raise:.279,radius:1.11,lip:.11},lens:{radius:.833,centres:[[1.442,1.437],[1.442,3.361],[3.262,2.399]]},finishes:[`black`,`silver`,`glacier`,`burgundy`]},hg={...mg,id:`phone.iphone-18-pro-max`,label:`iPhone 18 Pro Max`,width:7.8,height:16.34,display:{px:[1320,2868],ppi:460},...pg(7.8),backPanel:{fromTop:4.878,margin:.381,radius:1.035},buttons:[{side:-1,fromTop:3.429,length:.692,kind:`action`},{side:-1,fromTop:4.844,length:1.122,kind:`volume`},{side:-1,fromTop:6.264,length:1.122,kind:`volume`},{side:1,fromTop:5.554,length:1.772,kind:`side`},{side:1,fromTop:11.184,length:1.712,kind:`camera`}],logo:{height:2.004,fromTop:9.753}},gg={...mg,id:`phone.iphone-18-pro`,label:`iPhone 18 Pro`,width:7.19,height:15,display:{px:[1206,2622],ppi:460},...pg(7.19),backPanel:{fromTop:4.878,margin:.381,radius:1.035},buttons:[{side:-1,fromTop:3.429,length:.692,kind:`action`},{side:-1,fromTop:4.844,length:1.122,kind:`volume`},{side:-1,fromTop:6.264,length:1.122,kind:`volume`},{side:1,fromTop:5.554,length:1.772,kind:`side`},{side:1,fromTop:10.264,length:1.712,kind:`camera`}],logo:{height:2.004,fromTop:9.079}},_g={[gg.id]:gg,[hg.id]:hg}})),yg=r({IPHONE_18_PRO:()=>gg,IPHONE_18_PRO_MAX:()=>hg,PHONE_FINISHES:()=>dg,PHONE_SPECS:()=>_g,buildPhone:()=>rg,phone:()=>bg}),bg,xg=n((()=>{ug(),fg(),vg(),bg={type:`phone`,specs:_g,finishes:dg,build:rg}}));function Sg(e,t=!1){let n=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,c=new Os,l=0;for(let u=0;u<e.length;++u){let d=e[u],f=0;if(n!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let e in d.attributes){if(!r.has(e))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. All geometries must have compatible attributes; make sure "`+e+`" attribute exists among all geometries, or in none of them.`),null;a[e]===void 0&&(a[e]=[]),a[e].push(d.attributes[e]),f++}if(f!==r.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. Make sure all geometries have the same number of attributes.`),null;if(s!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let e in d.morphAttributes){if(!i.has(e))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. .morphAttributes must be consistent throughout all geometries.`),null;o[e]===void 0&&(o[e]=[]),o[e].push(d.morphAttributes[e])}if(t){let e;if(n)e=d.index.count;else if(d.attributes.position!==void 0)e=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. The geometry must have either an index or a position attribute`),null;c.addGroup(l,e,u),l+=e}}if(n){let t=0,n=[];for(let r=0;r<e.length;++r){let i=e[r].index;for(let e=0;e<i.count;++e)n.push(i.getX(e)+t);t+=e[r].attributes.position.count}c.setIndex(n)}for(let e in a){let t=Cg(a[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;c.setAttribute(e,t)}for(let e in o){let t=o[e][0].length;if(t!==0){c.morphAttributes=c.morphAttributes||{},c.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<o[e].length;++r)t.push(o[e][r][n]);let r=Cg(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;c.morphAttributes[e].push(r)}}}return c}function Cg(e){let t,n,r,i=-1,a=0;for(let o=0;o<e.length;++o){let s=e[o];if(t===void 0&&(t=s.array.constructor),t!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(n===void 0&&(n=s.itemSize),n!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(r===void 0&&(r=s.normalized),r!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(i===-1&&(i=s.gpuType),i!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;a+=s.count*n}let o=new t(a),s=new ps(o,n,r),c=0;for(let t=0;t<e.length;++t){let r=e[t];if(r.isInterleavedBufferAttribute){let e=c/n;for(let t=0,i=r.count;t<i;t++)for(let i=0;i<n;i++){let n=r.getComponent(t,i);s.setComponent(t+e,i,n)}}else o.set(r.array,c);c+=r.count*n}return i!==void 0&&(s.gpuType=i),s}function wg(e,t=Math.PI/3){let n=e.index?e.toNonIndexed():e,r=n.attributes.position,i=r.count,a;if(r.isBufferAttribute===!0&&r.itemSize===3&&r.normalized===!1)a=r.array;else{a=new Float64Array(i*3);for(let e=0;e<i;e++)a[3*e+0]=r.getX(e),a[3*e+1]=r.getY(e),a[3*e+2]=r.getZ(e)}let o=Math.cos(t),s=(1+1e-10)*100,c=i/3,l=new Float64Array(c*3);for(let e=0;e<c;e++){let t=9*e,n=a[t+0],r=a[t+1],i=a[t+2],o=a[t+3],s=a[t+4],c=a[t+5],u=a[t+6],d=a[t+7],f=a[t+8],p=u-o,m=d-s,h=f-c,g=n-o,_=r-s,v=i-c,y=m*v-h*_,b=h*g-p*v,x=p*_-m*g,S=1/(Math.sqrt(y*y+b*b+x*x)||1);l[3*e+0]=y*S,l[3*e+1]=b*S,l[3*e+2]=x*S}let u=new Int32Array(i),d=new Float64Array(i*3),f=1;for(;f<i*2;)f<<=1;let p=f-1,m=new Int32Array(f),h=0;for(let e=0;e<i;e++){let t=3*e,n=Math.trunc(a[t+0]*s),r=Math.trunc(a[t+1]*s),i=Math.trunc(a[t+2]*s),o=(Math.imul(n,73856093)^Math.imul(r,19349663)^Math.imul(i,83492791))&p;for(;;){let t=m[o];if(t===0){let t=3*h;d[t+0]=n,d[t+1]=r,d[t+2]=i,m[o]=h+1,u[e]=h++;break}let a=3*(t-1);if(d[a+0]===n&&d[a+1]===r&&d[a+2]===i){u[e]=t-1;break}o=o+1&p}}let g=new Int32Array(h+1);for(let e=0;e<i;e++)g[u[e]+1]++;for(let e=0;e<h;e++)g[e+1]+=g[e];let _=new Int32Array(i),v=g.slice(0,h);for(let e=0;e<c;e++){let t=3*e;_[v[u[t+0]]++]=e,_[v[u[t+1]]++]=e,_[v[u[t+2]]++]=e}let y=new Float32Array(i*3);for(let e=0;e<c;e++){let t=3*e,n=l[t+0],r=l[t+1],i=l[t+2];for(let e=0;e<3;e++){let a=t+e,s=u[a],c=0,d=0,f=0;for(let e=g[s],t=g[s+1];e<t;e++){let t=3*_[e],a=l[t+0],s=l[t+1],u=l[t+2];n*a+r*s+i*u>o&&(c+=a,d+=s,f+=u)}let p=1/(Math.sqrt(c*c+d*d+f*f)||1);y[3*a+0]=c*p,y[3*a+1]=d*p,y[3*a+2]=f*p}}return n.setAttribute(`normal`,new ps(y,3,!1)),n}var Tg=n((()=>{xp()})),Eg,Dg,Og,kg,Ag,jg=n((()=>{Eg={camera:{size:2.56,radius:.68,fromSide:.59,fromTop:.5,raise:.139,glassInset:.126},lens:{x:.56,y:.5,ring:.45,glass:.39,raise:.04},lidar:{x:-.555,y:-.025,radius:.394},flash:{x:-.556,y:.82,radius:.155},sensor:{x:.56,y:-.59,radius:.09},mic:{x:-.556,y:-.806,radius:.09},topButton:{length:1.16,height:.28,proud:.065,fromSide:1.95},volume:{length:1.01,gap:.13,height:.224,proud:.09,fromTop:2.1},speaker:{holes:17,hole:.194,pitch:.2235,fromSide:2.8},usbC:{length:.862,height:.276}},Dg={cornerRadius:1.3,edgeRadius:.04,rim:.113,frontCamera:{fromEdge:.355,radius:.16},finishes:[`space-black`,`silver`]},Og={...Dg,id:`tablet.ipad-pro-11`,label:`iPad Pro 11-inch`,width:17.75,height:24.97,depth:.53,display:{px:[1668,2420],ppi:264,cornerRadius:.72},logo:{height:3.05,raise:.29}},kg={...Dg,id:`tablet.ipad-pro-13`,label:`iPad Pro 13-inch`,width:21.55,height:28.16,depth:.51,display:{px:[2064,2752],ppi:264,cornerRadius:.72},logo:{height:3.44,raise:.33}},Ag={[Og.id]:Og,[kg.id]:kg}}));function Mg(e,t){Bh(e,t),e.frame.anisotropy=0}function Ng(e,t,n=`high`){let r=Ph[n],{width:i,height:a,depth:o,cornerRadius:s,rim:c}=e,l=zh(t);Mg(l,t);let u=new Do;Q(u,jh({width:i,height:a,depth:o,radius:s,edge:e.edgeRadius,quality:r}),l.frame),Fg(e,l,u,r);let d=new Do;d.position.z=o/2,u.add(d),Q(d,Mh(i-2*c,a-2*c,s-c,2,r),l.glass,{z:$});let f=e.display.px[0]/e.display.ppi*2.54,p=e.display.px[1]/e.display.ppi*2.54,m=Q(d,wh(Mh(f,p,e.display.cornerRadius,2,r)),l.display,{z:$*2}),h=e.frontCamera;Q(d,new dc(h.radius,r.round),l.lens,{x:i/2-h.fromEdge,z:$*3}),Q(d,new dc(h.radius*.66,r.round),l.pupil,{x:i/2-h.fromEdge,z:$*4});let g=new Do;g.position.z=-o/2,g.rotation.y=Math.PI,u.add(g),Q(g,Mh(i-.1,a-.1,s-.05,2,r),l.back,{z:$}),Pg(e,l,g,r),e.branding!==!1&&Q(g,Zh(e.logo.height),l.logo,{y:e.logo.raise,z:$*2});let _=Vh(m,f/p,l);return{group:u,screens:[_],bounds:new Xo().setFromObject(u),params:{},restsOnFloor:!1,setParam(){},setFinish:e=>Mg(l,e),setGlare:(e,t)=>_.setGlare(e,t),dispose:()=>Eh(u)}}function Pg(e,t,n,r){let i=Eg.camera,a=-e.width/2+i.fromSide+i.size/2,o=e.height/2-i.fromTop-i.size/2,s=new Do;s.position.set(a,o,0),n.add(s);let c=.03;Q(s,new Fc(Oh(i.size-2*c,i.size-2*c,i.radius-c,2,r.corner),{depth:i.raise-c,bevelEnabled:!0,bevelThickness:c,bevelSize:c,bevelSegments:4}),t.island);let l=i.raise+$,u=i.size-2*i.glassInset;Q(s,Mh(u,u,i.radius-i.glassInset,2,r),t.glass,{z:l});let d=e=>-e,{lens:f,lidar:p,flash:m,sensor:h,mic:g}=Eg,_=new fc(f.ring,f.ring,f.raise,r.round);_.rotateX(Math.PI/2),Q(s,_,t.lensRing,{x:d(f.x),y:f.y,z:l+f.raise/2});let v=l+f.raise+$;Q(s,new dc(f.glass,r.round),t.lens,{x:d(f.x),y:f.y,z:v}),Q(s,new dc(f.glass*.36,r.round),t.pupil,{x:d(f.x),y:f.y,z:v+$}),Q(s,new dc(p.radius,r.round),t.pupil,{x:d(p.x),y:p.y,z:l+$}),Q(s,new dc(m.radius,r.round),t.flash,{x:d(m.x),y:m.y,z:l+$}),Q(s,new dc(h.radius,r.round),t.pupil,{x:d(h.x),y:h.y,z:l+$}),Q(s,new dc(g.radius,r.round),t.bezel,{x:d(g.x),y:g.y,z:l+$})}function Fg(e,t,n,r){let{width:i,height:a}=e,o=.1,s=Eg.topButton;Q(n,Nh(s.length,s.height,s.proud+o,`x`,r),t.frame,{x:i/2-s.fromSide,y:a/2+s.proud-(s.proud+o)/2,rx:Math.PI/2});let c=Eg.volume;for(let e of[0,1])Q(n,Nh(c.length,c.height,c.proud+o,`y`,r),t.frame,{x:i/2+c.proud-(c.proud+o)/2,y:a/2-c.fromTop-c.length/2-e*(c.length+c.gap),ry:Math.PI/2});let l=Eg.speaker,u=[];for(let e of[-1,1])for(let t=0;t<l.holes;t++){let n=new dc(l.hole/2,12);n.translate(e*(i/2-l.fromSide-t*l.pitch),0,0),u.push(n)}let d=Sg(u);for(let e of u)e.dispose();Q(n,d,t.bezel,{y:a/2+$,rx:-Math.PI/2}),Q(n,d.clone(),t.bezel,{y:-a/2-$,rx:Math.PI/2}),Q(n,new dc(.05,12),t.bezel,{y:a/2+$,rx:-Math.PI/2}),Q(n,Mh(Eg.usbC.length,Eg.usbC.height,Eg.usbC.height/2,2,r),t.bezel,{y:-a/2-$,rx:Math.PI/2})}var Ig=n((()=>{xp(),Tg(),Dh(),eg(),Hh(),Fh(),Ah(),Th(),jg()})),Lg,Rg=n((()=>{Lg={"space-black":{label:`Space Black`,frame:`#2b2b2e`,back:`#2b2b2e`,frameRoughness:.34,backMaterial:`metal`},silver:{label:`Silver`,frame:`#d7d7d9`,back:`#d7d7d9`,frameRoughness:.3,backMaterial:`metal`}}})),zg=r({IPAD_PRO_11:()=>Og,IPAD_PRO_13:()=>kg,TABLET_FINISHES:()=>Lg,TABLET_SPECS:()=>Ag,buildTablet:()=>Ng,tablet:()=>Bg}),Bg,Vg=n((()=>{Ig(),Rg(),jg(),Bg={type:`tablet`,specs:Ag,finishes:Lg,build:Ng}}));function Hg(e,t,n){let r=(Yg-t.reduce((e,t)=>e+t,0))/(t.length-1),i=-27.23/2;return t.map((t,a)=>{let o=n[a]??``,s=typeof o==`string`?{label:o}:o,c={x:i+t/2,y:e*Jg+qg/2,w:t,h:qg,...s};return i+=t+r,c})}function Ug(e,t){let n=new Map,r=[];for(let i of Qg){let a=`${i.w}x${i.h}`,o=n.get(a);if(!o){let e=$g.roll;o=new Fc(Oh(i.w-2*e,i.h-2*e,$g.radius-e,2,t),{depth:$g.height-2*e,bevelEnabled:!0,bevelThickness:e,bevelSize:e,bevelSegments:3}),o.deleteAttribute(`uv`),n.set(a,o)}let s=o.clone();s.translate(i.x,Xg.depth/2-i.y,e-$g.height+$g.roll),r.push(s)}let i=Sg(r);for(let e of[...r,...n.values()])e.dispose();return i}function Wg(e){return Qg.map(t=>{let n=Oh(t.w+2*e_,t.h+2*e_,$g.radius+e_,2,Math.max(4,e/2)).getPoints().map(e=>new J(e.x+t.x,e.y+Xg.depth/2-t.y));return new jc(n.reverse())})}function Gg(){let e=document.createElement(`canvas`);e.width=Math.round(Xg.width*76),e.height=Math.round(Xg.depth*76);let t=e.getContext(`2d`);if(t){let e=(e,t=400)=>`${t} ${e}px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`;t.fillStyle=`#fff`,t.strokeStyle=`#fff`;for(let n of Qg){let r=(n.x+Xg.width/2)*76,i=n.y*76,a=n.w/2*76,o=n.h/2*76,s=.2*76;n.touchId?(t.lineWidth=2,t.globalAlpha=.35,t.beginPath(),t.arc(r,i,35.72,0,Math.PI*2),t.stroke(),t.globalAlpha=1):n.label&&(n.shift?(t.font=e(.27*76),t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(n.shift,r,i-.27*76),t.fillText(n.label,r,i+.27*76)):n.align?(t.font=e(.2*76),t.textBaseline=`alphabetic`,t.textAlign=n.align,t.fillText(n.label,n.align===`left`?r-a+s:r+a-s,i+o-s)):(t.font=e((n.label.length>1||n.h<1.596?.22:.34)*76),t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(n.label,r,i)))}}let n=new oc(e);return n.colorSpace=ga,n.anisotropy=8,n}var Kg,qg,Jg,Yg,Xg,Zg,Qg,$g,e_,t_=n((()=>{xp(),Tg(),Ah(),Kg=1.646,qg=1.596,Jg=1.846,Yg=27.23,Xg={width:Yg,depth:10.826},Zg=e=>Array(e).fill(Kg),Qg=[...Hg(0,[2.593,...Zg(13)],[{label:`esc`,align:`left`},`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`,{touchId:!0}]),...Hg(1,[...Zg(13),2.593],[{label:"`",shift:`~`},{label:`1`,shift:`!`},{label:`2`,shift:`@`},{label:`3`,shift:`#`},{label:`4`,shift:`$`},{label:`5`,shift:`%`},{label:`6`,shift:`^`},{label:`7`,shift:`&`},{label:`8`,shift:`*`},{label:`9`,shift:`(`},{label:`0`,shift:`)`},{label:`-`,shift:`_`},{label:`=`,shift:`+`},{label:`delete`,align:`right`}]),...Hg(2,[2.593,...Zg(13)],[{label:`tab`,align:`left`},`Q`,`W`,`E`,`R`,`T`,`Y`,`U`,`I`,`O`,`P`,{label:`[`,shift:`{`},{label:`]`,shift:`}`},{label:`\\`,shift:`|`}]),...Hg(3,[3.067,...Zg(11),3.067],[{label:`caps lock`,align:`left`},`A`,`S`,`D`,`F`,`G`,`H`,`J`,`K`,`L`,{label:`;`,shift:`:`},{label:`'`,shift:`"`},{label:`return`,align:`right`}]),...Hg(4,[4.015,...Zg(10),4.015],[{label:`shift`,align:`left`},`Z`,`X`,`C`,`V`,`B`,`N`,`M`,{label:`,`,shift:`<`},{label:`.`,shift:`>`},{label:`/`,shift:`?`},{label:`shift`,align:`right`}]),...[[-12.792,Kg,`fn`,`left`],[-10.897,Kg,`control`,`left`],[-9.002,Kg,`option`,`left`],[-6.87,2.12,`command`,`left`],[-.9475,9.226,``],[4.9745,2.12,`command`,`right`],[7.107,Kg,`option`,`right`]].map(([e,t,n,r])=>({x:e,y:10.028,w:t,h:qg,label:n,align:r})),{x:9.002,y:10.826-.389,w:Kg,h:.778,label:`◀`},{x:10.897,y:9.619,w:Kg,h:.778,label:`▲`},{x:10.897,y:10.826-.389,w:Kg,h:.778,label:`▼`},{x:12.792,y:10.826-.389,w:Kg,h:.778,label:`▶`}],$g={radius:.146,roll:.021,height:.146},e_=.04}));function n_(){let e=new Jc({color:328966,roughness:.9,transparent:!0,depthWrite:!1}),t=f_();t?e.alphaMap=t:e.opacity=.35;let n=new Jc({color:14277083,roughness:.6,transparent:!0,depthWrite:!1});return typeof document<`u`&&(n.map=Gg()),{keycap:new Yc({color:1118483,roughness:.55,clearcoat:.25,clearcoatRoughness:.5}),legend:n,plate:new Jc({color:657931,roughness:.75}),well:new Jc({color:197380,roughness:.9}),trackpad:new Yc({roughness:.4,clearcoat:.4,clearcoatRoughness:.35}),gap:new Jc({color:394759,roughness:.8}),grille:e,foot:new Jc({color:2697515,roughness:.92}),clutch:new Yc({color:789517,roughness:.35,clearcoat:.6,clearcoatRoughness:.2}),cameraHousing:r_(855312),cameraLens:r_(328967),cameraWindow:r_(724260),cameraPupil:r_(0)}}function r_(e){return new Yc({color:e,roughness:.6,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02})}function i_(e,t,n){Bh(e,n),e.frame.anisotropy=0,t.trackpad.color.set(n.frame).multiplyScalar(.62)}function a_(e,t,n=`high`){let r=Ph[n],i=zh(t),a=n_();i_(i,a,t);let o=new Do,s=new Do;s.position.y=e.feet.height+e.baseHeight,s.rotation.x=-Math.PI/2,o.add(s),o_(e,i,a,s,r);let c=new Do;c.position.set(0,s.position.y-e.lid.pivot.belowDeck,-e.depth/2+e.lid.pivot.fromBack),o.add(c);let{displayMesh:l,aspect:u,setOpen:d}=c_(e,i,a,c,r),f=e=>{c.rotation.x=(90-e)*p_,d(e)};f(110);let p=Vh(l,u,i);return{group:o,screens:[p],bounds:new Xo().setFromObject(o),params:{lidAngle:{min:0,max:135,default:110,unit:`deg`,label:`Lid angle`}},restsOnFloor:!0,setParam(e,t){e===`lidAngle`&&f(t)},setFinish:e=>i_(i,a,e),setGlare:(e,t)=>{p.setGlare(e,t);for(let e of[a.cameraHousing,a.cameraLens,a.cameraWindow,a.cameraPupil])e.clearcoat=i.glass.clearcoat},dispose:()=>{Eh(o);for(let e of Object.values(a))e.map?.dispose(),e.alphaMap?.dispose(),e.dispose()}}}function o_(e,t,n,r,i){let{width:a,depth:o,baseHeight:s}=e,{radius:c,exponent:l}=e.corner,u=e.scoop.height,d=o/2-e.keyboard.fromBack-Xg.depth/2,f=Xg.width+2*e.keyboard.margin,p=Xg.depth+2*e.keyboard.margin,m=new Mc(s_(e,i)),h=Oh(f,p,.5,2,i.corner).getPoints().map(e=>new J(e.x,e.y+d));m.holes.push(new jc(h));let g=new Fc(m,{depth:u,bevelEnabled:!1,curveSegments:i.corner});g.translate(0,0,-u),Q(r,wg(g,30*p_),t.frame);let _=h_-s,v=m_.map(([e,t])=>[e,t<-.48?t+_:t]);Q(r,Ih({width:a,height:o,radius:c,exponent:l,segments:i.corner,profile:v}),t.frame),Q(r,Mh(a,o,c,l,i),t.frame,{z:-u});let[y]=v[v.length-1];Q(r,Mh(a-2*y,o-2*y,c-y,l,i),t.frame,{z:-s,rx:Math.PI}),Q(r,Mh(f,p,.5,2,i),n.well,{y:d,z:-.258});let b=Oh(f,p,.5,2,i.corner);for(let e of Wg(i.corner))b.holes.push(e);Q(r,new Bc(b,i.corner),n.plate,{y:d}),Q(r,Ug(.01,Math.max(6,i.corner/3)),n.keycap,{y:d}),n.legend.map&&Q(r,new Rc(Xg.width,Xg.depth),n.legend,{y:d,z:.0125});let x=e.trackpad,S=-o/2+x.fromFront+x.depth/2;Q(r,Mh(x.width+.055,x.depth+.055,x.radius+.0275,2,i),n.gap,{y:S,z:$}),Q(r,Mh(x.width,x.depth,x.radius,2,i),n.trackpad,{y:S,z:$*2});let C=Xg.depth-.19,w=e.grille.outer-e.grille.inner;n.grille.alphaMap?.repeat.set(w/.64,C/.64);for(let t of[-1,1])Q(r,new Rc(w,C),n.grille,{x:t*(e.grille.inner+w/2),y:d,z:$});Q(r,new fc(.3,.3,e.hinge.width-.3,i.round),n.clutch,{y:o/2-.44,z:-.3,rz:Math.PI/2});for(let t of e.ports){let e=v_[t.kind];Q(r,Mh(e.height,e.length,e.radius,2,i),n.gap,{x:t.side*(a/2+.002),y:o/2-t.fromBack,z:e.z,ry:t.side*Math.PI/2})}let T=e.feet;for(let e of[-1,1])for(let t of[-1,1])Q(r,new fc(T.radius,T.radius,T.height,i.round),n.foot,{x:e*(a/2-T.inset),y:t*(o/2-T.inset),z:-s-T.height/2,rx:Math.PI/2})}function s_(e,t){let{width:n,depth:r}=e,i=kh(n,r,e.corner.radius,e.corner.exponent,t.corner),a=r/2,o=i.findIndex((e,t)=>{let n=i[(t+1)%i.length];return Math.abs(e.y-a)<1e-6&&Math.abs(n.y-a)<1e-6&&n.x<e.x}),s=e.hinge.width/2,c=[new J(s,a),new J(s,a-e.hinge.depth),new J(-s,a-e.hinge.depth),new J(-s,a)];i.splice(o+1,0,...c);let l=e.scoop.width/2,u=.74,d=[];for(let t=0;t<=8;t++){let n=t/8,i=n*n*(3-2*n);d.push(new J(-l+u*n,-r/2+e.scoop.depth*i))}for(let t=8;t>=0;t--){let n=t/8,i=n*n*(3-2*n);d.push(new J(l-u*n,-r/2+e.scoop.depth*i))}return i.push(...d),i}function c_(e,t,n,r,i){let{width:a}=e,{thickness:o,rim:s}=e.lid,{radius:c,exponent:l}=e.lid.corner,u=e.depth+g_.overhang,d=g_.bottom+u/2,f=g_.front,p=f-o,m=[[s,f],[s*.4,f-.007],[.008,f-.025],[0,f-.047],[0,p+.08],[.012,p+.04],[.04,p+.015],[.09,p+.002],[.15,p]];Q(r,Ih({width:a,height:u,radius:c,exponent:l,segments:i.corner,profile:m}),t.frame,{y:d}),Q(r,Mh(a-2*s,u-2*s,c-s,l,i),t.glass,{y:d,z:f+$});let h=e.display.px[0]/e.display.ppi*2.54,g=e.display.px[1]/e.display.ppi*2.54,_=g_.bottom+u-e.bezel,{radius:v,exponent:y}=e.displayCorner,b=Q(r,wh(new Bc(u_(h,g,v,y,i.corner))),t.display,{y:_-g/2,z:f+$*2});Q(r,new Bc(d_(e.notch,i.corner)),t.glass,{y:_,z:f+$*3});let x=e.camera,S=_-x.fromTop;Q(r,new dc(x.housing,i.round),n.cameraHousing,{y:S,z:f+$*4}),Q(r,new dc(x.lens,i.round),n.cameraLens,{y:S,z:f+$*5}),Q(r,new dc(x.window,i.round),n.cameraWindow,{y:S,z:f+$*6}),Q(r,new dc(x.pupil,i.round),n.cameraPupil,{y:S,z:f+$*7});let C=new Do;C.position.z=p,C.rotation.y=Math.PI,r.add(C),Q(C,Mh(a-.3,u-.3,c-.15,l,i),t.frame,{y:d});let w=Mh(e.hinge.width-.28,__,.3,2,i);w.translate(0,__/2,0);let T=Q(C,w,n.clutch,{y:g_.bottom,z:$});return e.branding!==!1&&Q(C,Zh(e.logo.height),t.logo,{y:d+e.logo.raise,z:$}),{displayMesh:b,aspect:h/g,setOpen:e=>{let t=Math.min(1,Math.max(0,e/40));T.scale.y=Math.max(.001,t*t*(3-2*t)),T.visible=e>.5}}}function l_(e,t,n,r,i,a,o){let s=[];for(let c=0;c<=o;c++){let l=i+(a-i)*c/o,u=Math.cos(l),d=Math.sin(l);s.push(new J(e+n*Math.sign(u)*Math.abs(u)**(2/r),t+n*Math.sign(d)*Math.abs(d)**(2/r)))}return s}function u_(e,t,n,r,i){let a=e/2-n,o=t/2-n;return new Mc([new J(-e/2,-t/2),new J(e/2,-t/2),...l_(a,o,n,r,0,Math.PI/2,i),...l_(-a,o,n,r,Math.PI/2,Math.PI,i)])}function d_(e,t,n=.3){let{height:r,radius:i,exponent:a,flare:o}=e,s=e.width/2,c=Math.max(6,t/2),l=[new J(s+o,n),...l_(s+o,-o,o,2,Math.PI/2,Math.PI,c),...l_(s-i,-(r-i),i,a,0,-Math.PI/2,c)],u=l.map(e=>new J(-e.x,e.y)).reverse();return new Mc([...l,...u])}function f_(){if(typeof document>`u`)return null;let e=document.createElement(`canvas`);e.width=e.height=128;let t=e.getContext(`2d`);if(!t)return null;t.fillStyle=`#000`,t.fillRect(0,0,128,128),t.fillStyle=`#fff`;for(let e=0;e<8;e++)for(let n=0;n<=8;n++){let r=n*16+(e%2?8:0);t.beginPath(),t.arc(r%128,e*16+8,4,0,Math.PI*2),t.fill()}let n=new oc(e);return n.wrapS=n.wrapT=Jr,n.anisotropy=8,n}var p_,m_,h_,g_,__,v_,y_=n((()=>{xp(),Tg(),Dh(),eg(),Hh(),Fh(),Ah(),Rh(),Th(),t_(),p_=Math.PI/180,m_=[[0,-.33],[.001,-.48],[.003,-.56],[.008,-.64],[.018,-.716],[.037,-.792],[.064,-.865],[.102,-.933],[.146,-.995],[.205,-1.057],[.259,-1.101],[.268,-1.107],[.305,-1.131],[.338,-1.149],[.378,-1.167],[.421,-1.184],[.492,-1.203],[.571,-1.215],[.651,-1.221],[.8,-1.224]],h_=1.224,g_={front:-.243,bottom:-.52,overhang:.026},__=1.27,v_={"usb-c":{length:.862,height:.276,radius:.138,z:-.377},magsafe:{length:1.62,height:.34,radius:.17,z:-.38},headphone:{length:.38,height:.38,radius:.19,z:-.375},hdmi:{length:1.45,height:.5,radius:.08,z:-.42},sd:{length:2.45,height:.2,radius:.1,z:-.38}}})),b_,x_=n((()=>{b_={"space-black":{label:`Space Black`,frame:`#47484c`,back:`#47484c`,frameRoughness:.4,backMaterial:`metal`},silver:{label:`Silver`,frame:`#d3d4d6`,back:`#d3d4d6`,frameRoughness:.42,backMaterial:`metal`}}})),S_,C_,w_,T_,E_,D_,O_=n((()=>{S_={corner:{radius:1,exponent:2.2},feet:{radius:.956,height:.18,inset:2.74},keyboard:{fromBack:2.779,margin:.325},scoop:{width:5.46,depth:.249,height:.336},hinge:{width:28.12,depth:.556},lid:{thickness:.417,corner:{radius:1.15,exponent:2.2},rim:.08,pivot:{fromBack:.494,belowDeck:.204}},displayCorner:{radius:.66,exponent:3.6},bezel:.548,notch:{width:3.68,height:.637,radius:.2875,exponent:3,flare:.098},camera:{fromTop:.167,housing:.201,lens:.175,window:.11,pupil:.036},logo:{height:4.646,raise:.387},finishes:[`space-black`,`silver`]},C_=[{side:-1,kind:`magsafe`,fromBack:3.572},{side:-1,kind:`usb-c`,fromBack:5.423},{side:-1,kind:`usb-c`,fromBack:6.907},{side:-1,kind:`headphone`,fromBack:8.186},{side:1,kind:`hdmi`,fromBack:3.579},{side:1,kind:`usb-c`,fromBack:5.428},{side:1,kind:`sd`,fromBack:7.866}],w_={...S_,id:`laptop.macbook-pro-16`,label:`MacBook Pro 16-inch`,width:35.57,depth:24.81,height:1.68,baseHeight:1.224,trackpad:{width:15.903,depth:9.92,fromFront:.577,radius:.525},grille:{inner:14.061,outer:17.646},display:{px:[3456,2234],ppi:254},ports:C_},T_=[{side:-1,kind:`magsafe`,fromBack:2.779},{side:-1,kind:`usb-c`,fromBack:4.627},{side:-1,kind:`usb-c`,fromBack:6.112},{side:-1,kind:`headphone`,fromBack:7.398},{side:1,kind:`hdmi`,fromBack:2.78},{side:1,kind:`usb-c`,fromBack:4.627},{side:1,kind:`sd`,fromBack:7.08}],E_={...S_,id:`laptop.macbook-pro-14`,label:`MacBook Pro 14-inch`,width:31.26,depth:22.12,height:1.55,baseHeight:1.113,keyboard:{fromBack:1.98,margin:.325},trackpad:{width:12.883,depth:8.044,fromFront:.578,radius:.525},scoop:{width:5.449,depth:.25,height:.389},grille:{inner:14.056,outer:15.45},hinge:{width:23.68,depth:.463},lid:{...S_.lid,thickness:.392},display:{px:[3024,1964],ppi:254},ports:T_},D_={[E_.id]:E_,[w_.id]:w_}})),k_=r({LAPTOP_FINISHES:()=>b_,LAPTOP_SPECS:()=>D_,MACBOOK_PRO_14:()=>E_,MACBOOK_PRO_16:()=>w_,buildLaptop:()=>a_,laptop:()=>A_}),A_,j_=n((()=>{y_(),x_(),O_(),A_={type:`laptop`,specs:D_,finishes:b_,build:a_}}));function M_(){let e=new Jc({color:328966,roughness:.9,transparent:!0,depthWrite:!1});return{gap:new Jc({color:394759,roughness:.8}),socket:new Jc({color:2763309,roughness:.6}),vent:e,pad:new Jc({color:657931,roughness:.6}),cameraHousing:N_(855312),cameraLens:N_(328967),cameraWindow:N_(724260),cameraPupil:N_(0)}}function N_(e){return new Yc({color:e,roughness:.6,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02})}function P_(e,t){Bh(e,t),e.frame.anisotropy=0}function F_(e,t,n=`high`){let r=Ph[n],i=zh(t),a=M_();P_(i,t);let o=B_(e.vents);o?a.vent.alphaMap=o:a.vent.opacity=.35;let s=new Do;L_(e,i,a,s,r);let{barrel:c}=e.stand,l=new Do;l.position.set(0,c.y,c.z),s.add(l);let u=new Do;u.position.set(0,e.hinge.drop,e.hinge.behind),l.add(u);let{displayMesh:d,aspect:f}=I_(e,i,a,u,r),p=e=>{l.rotation.x=-e*V_};p(0);let m=Vh(d,f,i);return{group:s,screens:[m],bounds:new Xo().setFromObject(s),params:{tilt:{min:-5,max:25,default:0,unit:`deg`,label:`Tilt`}},restsOnFloor:!0,setParam(e,t){e===`tilt`&&p(t)},setFinish:e=>P_(i,e),setGlare:(e,t)=>{m.setGlare(e,t);for(let e of[a.cameraHousing,a.cameraLens,a.cameraWindow,a.cameraPupil])e.clearcoat=i.glass.clearcoat},dispose:()=>{a.vent.alphaMap?.dispose(),Eh(s)}}}function I_(e,t,n,r,i){let{width:a,height:o,depth:s,radius:c,glass:l}=e.panel,u=-l-.03,d=-s,f=[[.04,u],[.012,u-.012],[0,u-.04],[0,d+.04],[.012,d+.012],[.04,d]];Q(r,Ih({width:a,height:o,radius:c,exponent:2,segments:i.corner,profile:f}),t.frame),Q(r,Mh(a-.08,o-.08,c-.04,2,i),n.gap,{z:u}),Q(r,jh({width:a,height:o,depth:l,radius:c,edge:.02,quality:i}),t.glass,{z:-l/2});let p=a-2*e.bezel,m=p*e.display.px[1]/e.display.px[0],h=Q(r,wh(Mh(p,m,.05,2,i)),t.display,{z:$}),g=o/2-e.cameraFromTop;Q(r,new dc(.22,i.round),n.cameraHousing,{y:g,z:$*2}),Q(r,new dc(.17,i.round),n.cameraLens,{y:g,z:$*3}),Q(r,new dc(.15,i.round),n.cameraWindow,{y:g,z:$*4}),Q(r,new dc(.06,i.round),n.cameraPupil,{y:g,z:$*5}),Q(r,new dc(.05,i.round),n.cameraHousing,{x:.73,y:g,z:$*2});let{vents:_}=e,v=-_.centre,y=new Rc(_.length,_.band);n.vent.alphaMap&&n.vent.alphaMap.repeat.set(_.length/(_.pitch*2),1),Q(r,y,n.vent,{y:o/2+$,z:v,rx:-Math.PI/2}),Q(r,y,n.vent,{y:-o/2-$,z:v,rx:Math.PI/2});let b=new Do;b.position.z=d,b.rotation.y=Math.PI,r.add(b),Q(b,Mh(a-.08,o-.08,c-.04,2,i),t.frame),e.branding!==!1&&Q(b,Zh(e.logo.height),t.logo,{y:e.logo.raise,z:$});let{power:x}=e;Q(b,new zc(x.radius-.05,x.radius,i.round),n.gap,{y:-x.drop,z:$}),Q(b,new dc(.54,i.round),n.gap,{y:-x.drop,z:$}),Q(b,new dc(.36,i.round),n.socket,{y:-x.drop,z:$*2});let{ports:S}=e,C=Mh(S.width,S.height,S.width/2,2,i),w=Mh(.07,S.height*.62,.035,2,i);for(let e of S.x)Q(b,C,n.gap,{x:-e,y:-S.drop,z:$}),Q(b,w,n.socket,{x:-e,y:-S.drop,z:$*2});let{barrel:T}=e.stand,E=e.hinge.behind-s;return Q(r,jh({width:T.bracket-.06,height:1.3,depth:E+.3,radius:.3,edge:.05,quality:i}),t.frame,{y:-e.hinge.drop,z:d-E/2+.15}),{displayMesh:h,aspect:p/m}}function L_(e,t,n,r,i){let a=e.stand,{foot:o}=a,s=o.pad+o.thickness;Q(r,jh({width:a.width,height:o.depth,depth:o.thickness,radius:o.radius,edge:.06,quality:i}),t.frame,{y:o.pad+o.thickness/2,rx:-Math.PI/2}),Q(r,jh({width:a.width-.38,height:o.depth-.46,depth:o.pad+.05,radius:o.radius-.2,edge:.02,quality:i}),n.pad,{y:(o.pad+.05)/2,rx:-Math.PI/2});let c=a.lean*V_,l=new J(Math.sin(c),Math.cos(c)),u=new J(l.y,-l.x),d=new J(a.backZ,s),f=R_(d,l,u,a.sheet,a.fillet.front,a.fillet.back,s,i.corner),p=new Fc(f,{depth:a.width,bevelEnabled:!1,curveSegments:i.corner});p.translate(0,0,-a.width/2),p.rotateY(-Math.PI/2),Q(r,p,t.frame);let m=new J(a.barrel.z,a.barrel.y).clone().sub(d).dot(l)-2,h=(a.hole.centreY-s)/Math.cos(c)-2,g=Oh(a.width,m,.02,2,2);g.holes.push(z_(a.hole.width,a.hole.length,h-m/2));let _=new Fc(g,{depth:a.sheet,bevelEnabled:!1,curveSegments:i.corner});_.translate(0,m/2+2,0);let v=Q(r,_,t.frame);v.rotation.x=c,v.position.set(0,d.y,d.x);let{barrel:y}=a,b=(a.width-y.bracket)/2-.03,x=new fc(y.radius,y.radius,b,i.round,1);x.rotateZ(Math.PI/2);for(let e of[-1,1])Q(r,x,t.frame,{x:e*(a.width/2-b/2),y:y.y,z:y.z});let S=new fc(y.radius-.02,y.radius-.02,y.bracket,i.round,1);S.rotateZ(Math.PI/2),Q(r,S,t.frame,{y:y.y,z:y.z});let C=new fc(y.radius-.05,y.radius-.05,a.width-.1,i.round,1);C.rotateZ(Math.PI/2),Q(r,C,n.gap,{y:y.y,z:y.z})}function R_(e,t,n,r,i,a,o,s){let c=n=>e.clone().addScaledVector(t,n),l=i=>e.clone().addScaledVector(n,r).addScaledVector(t,i),u=(e,r,i)=>{let a=n.clone().multiplyScalar(r),c=(o+i-e.y-a.y*i)/t.y,l=e.clone().addScaledVector(t,c).addScaledVector(a,i),u=l.clone().addScaledVector(a,-i),d=new J(l.x,o),f=Math.atan2(u.y-l.y,u.x-l.x),p=Math.atan2(d.y-l.y,d.x-l.x)-f;p>Math.PI&&(p-=2*Math.PI),p<-Math.PI&&(p+=2*Math.PI);let m=[];for(let e=0;e<=s;e++){let t=f+p*e/s;m.push(new J(l.x+i*Math.cos(t),l.y+i*Math.sin(t)))}return m},d=u(l(0),1,i),f=u(c(0),-1,a),p=o-.25,m=[c(3),l(3),...d,new J(d[d.length-1].x,p),new J(f[f.length-1].x,p),...f.slice().reverse()];return Pc.isClockWise(m)&&m.reverse(),new Mc(m)}function z_(e,t,n){let r=e/2,i=Math.max(0,t/2-r),a=new jc;return a.absarc(0,n+i,r,0,Math.PI,!1),a.absarc(0,n-i,r,Math.PI,2*Math.PI,!1),a.closePath(),a}function B_(e){if(typeof document>`u`)return null;let t=Math.round(e.pitch*2*400),n=Math.round(e.band*400),r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)return null;i.fillStyle=`#000`,i.fillRect(0,0,t,n),i.fillStyle=`#fff`;let a=n/e.rows,o=t/2,s=e.hole/2*400;for(let t=0;t<e.rows;t++)for(let e=-1;e<=2;e++)i.beginPath(),i.arc(e*o+(t%2?o/2:0),(t+.5)*a,s,0,Math.PI*2),i.fill();let c=new oc(r);return c.wrapS=Jr,c.wrapT=Yr,c.anisotropy=8,c}var V_,H_=n((()=>{xp(),Dh(),eg(),Hh(),Fh(),Ah(),Rh(),Th(),V_=Math.PI/180})),U_,W_=n((()=>{U_={silver:{label:`Silver`,frame:`#d3d4d6`,back:`#d3d4d6`,frameRoughness:.42,backMaterial:`metal`}}})),G_,K_,q_=n((()=>{G_={id:`monitor.studio-display`,label:`Studio Display`,finishes:[`silver`],panel:{width:62.3,height:36.2,depth:1.97,radius:.5,glass:.1},display:{px:[5120,2880],ppi:218},bezel:1.37,cameraFromTop:.53,logo:{height:8.35,raise:5.04},power:{drop:15.34,radius:1.52},ports:{x:[17.25,18.75,20.25,21.76],drop:15.34,width:.31,height:.89},vents:{length:60.9,band:.83,centre:1.31,hole:.16,pitch:.19,rows:5},stand:{width:15.2,foot:{depth:16.8,thickness:.56,radius:1.2,pad:.1},sheet:.7,lean:13.1,backZ:-6.09,fillet:{front:1,back:.6},hole:{width:4,length:6.26,centreY:13.63},barrel:{radius:1.05,y:20.61,z:-.39,bracket:5.34}},hinge:{drop:9.04,behind:3.15}},K_={[G_.id]:G_}})),J_=r({MONITOR_FINISHES:()=>U_,MONITOR_SPECS:()=>K_,STUDIO_DISPLAY:()=>G_,buildMonitor:()=>F_,monitor:()=>Y_}),Y_,X_=n((()=>{H_(),W_(),q_(),Y_={type:`monitor`,specs:K_,finishes:U_,build:F_}}));function Z_({width:e,thickness:t,length:n,curl:r,direction:i,segments:a=24}){let o=i,s=new xc([new Y(0,0,0),new Y(0,o*n*.35,-t*.2),new Y(0,o*n*.7,-n*r*.35),new Y(0,o*n,-n*r)]),c=t/2,l=new Mc;return l.moveTo(-e/2+c,-c),l.lineTo(e/2-c,-c),l.absarc(e/2-c,0,c,-Math.PI/2,Math.PI/2,!1),l.lineTo(-e/2+c,c),l.absarc(-e/2+c,0,c,Math.PI/2,3*Math.PI/2,!1),new Fc(l,{steps:a,bevelEnabled:!1,extrudePath:s})}var Q_=n((()=>{xp()})),$_=r({WATCH_FINISHES:()=>iv,WATCH_SERIES_12_42:()=>nv,WATCH_SERIES_12_46:()=>tv,WATCH_SPECS:()=>av,WATCH_ULTRA_4:()=>rv,buildWatch:()=>ev,watch:()=>ov});function ev(e,t,n=`high`){let r=Ph[n],{width:i,height:a,depth:o,bezel:s}=e,{radius:c,exponent:l}=e.corner,u=zh(t),d=new Do;Q(d,jh({width:i,height:a,depth:o,radius:c,exponent:l,edge:e.edgeRadius,quality:r}),u.frame);let f=new Do;f.position.z=o/2,d.add(f);let p=e.crystal===`flat`?.2:.05,m=i-2*s,h=a-2*s;Q(f,Mh(i-2*p,a-2*p,c-p,l,r),u.bezel,{z:$});let g=Q(f,wh(Mh(m,h,c-s,l,r)),u.display,{z:$*2}),_=e.crown;Q(d,new fc(_.radius,_.radius,_.depth,r.round),u.frame,{x:i/2+_.depth/2-.04,y:_.y,rz:Math.PI/2}),Q(d,new fc(_.radius*.55,_.radius*.55,_.depth+.04,r.round),u.pupil,{x:i/2+_.depth/2-.02,y:_.y,rz:Math.PI/2}),Q(d,Nh(e.sideButton.length,.18,.16,`y`,r),u.frame,{x:i/2+.02,y:e.sideButton.y,ry:Math.PI/2}),e.actionButton&&Q(d,Nh(e.actionButton.length,.3,.26,`y`,r),u.accent,{x:-i/2-.02,y:e.actionButton.y,ry:Math.PI/2});let v=new Do;v.position.z=-o/2,v.rotation.y=Math.PI,d.add(v),Q(v,new dc(Math.min(i,a)*.42,r.round),u.back,{z:$}),e.branding!==!1&&Q(v,Zh(e.logoHeight),u.logo,{y:Math.min(i,a)*.22,z:$*2});let y=e.band;for(let e of[1,-1])Q(d,Z_({width:y.width,thickness:y.thickness,length:y.length*.55,curl:1.1,direction:e}),u.band,{y:e*(a/2-.15),z:-o*.15});let b=Vh(g,m/h,u);return{group:d,screens:[b],bounds:new Xo().setFromObject(d),params:{},restsOnFloor:!1,setParam(){},setFinish:e=>Bh(u,e),setGlare:(e,t)=>b.setGlare(e,t),dispose:()=>Eh(d)}}var tv,nv,rv,iv,av,ov,sv=n((()=>{xp(),Dh(),eg(),Hh(),Fh(),Q_(),Th(),tv={id:`watch.series-12-46`,label:`Apple Watch Series 12 (46 mm)`,finishes:[`jet-black`,`space-gray`,`light-gold`,`dark-bronze`,`natural-titanium`,`radiant-gold`,`pearl-white`,`night-blue`],width:4,height:4.6,depth:.97,corner:{radius:1.25,exponent:2.8},edgeRadius:.22,display:{px:[416,496],ppi:326},bezel:.28,crystal:`domed`,crown:{radius:.32,depth:.22,y:.75},sideButton:{length:1.1,y:-.55},band:{width:2.2,thickness:.3,length:7.5},logoHeight:.9},nv={...tv,id:`watch.series-12-42`,label:`Apple Watch Series 12 (42 mm)`,width:3.7,height:4.2,corner:{radius:1.15,exponent:2.8},display:{px:[374,446],ppi:326},crown:{radius:.3,depth:.2,y:.65},sideButton:{length:1,y:-.5},band:{width:2,thickness:.28,length:7},logoHeight:.8},rv={id:`watch.ultra-4`,label:`Apple Watch Ultra 4`,finishes:[`natural-titanium`,`black-titanium`],width:4.4,height:4.9,depth:1.2,corner:{radius:1,exponent:2.4},edgeRadius:.12,display:{px:[422,514],ppi:326},bezel:.36,crystal:`flat`,crown:{radius:.36,depth:.28,y:.7},sideButton:{length:1.2,y:-.6},actionButton:{length:1.3,y:.3},band:{width:2.4,thickness:.34,length:8},logoHeight:1},iv={"jet-black":{label:`Black`,frame:`#1c1c1e`,back:`#141416`,frameRoughness:.12,backMaterial:`ceramic`},"space-gray":{label:`Space Gray`,frame:`#6e6e73`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`},"light-gold":{label:`Light Gold`,frame:`#d9c9a9`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`},"dark-bronze":{label:`Dark Bronze`,frame:`#5b4738`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`},"natural-titanium":{label:`Natural Titanium`,frame:`#a19d95`,back:`#141416`,frameRoughness:.34,backMaterial:`ceramic`,accent:`#ff7a1a`},"radiant-gold":{label:`Radiant Gold`,frame:`#c9a96c`,back:`#141416`,frameRoughness:.22,backMaterial:`ceramic`},"black-titanium":{label:`Black Titanium`,frame:`#2b2b2e`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`,accent:`#ff7a1a`},"pearl-white":{label:`Pearl White`,frame:`#ecebe5`,back:`#ecebe5`,frameRoughness:.12,backMaterial:`ceramic`},"night-blue":{label:`Night Blue`,frame:`#1f2a44`,back:`#1f2a44`,frameRoughness:.12,backMaterial:`ceramic`}},av={[tv.id]:tv,[nv.id]:nv,[rv.id]:rv},ov={type:`watch`,specs:av,finishes:iv,build:ev}}));function cv(e){let t=pv.get(e);return t||(t=fv[e](),pv.set(e,t)),t}function lv(e){let t=e.split(`.`)[0];if(!(t in fv))throw Error(`Unknown device spec '${e}'`);return t}function uv(e,t,n){if(typeof n!=`string`)return n;let r=e.finishes[n]??e.finishes[t.finishes[0]??``];if(!r)throw Error(`Device '${t.id}' has no finishes`);return r}async function dv(e,t,n=`high`){let r=await cv(lv(e)),i=r.specs[e];if(!i)throw Error(`Unknown device spec '${e}'`);return gh(r.build(i,uv(r,i,t),n))}var fv,pv,mv=n((()=>{Ch(),fv={phone:()=>Promise.resolve().then(()=>(xg(),yg)).then(e=>e.phone),tablet:()=>Promise.resolve().then(()=>(Vg(),zg)).then(e=>e.tablet),laptop:()=>Promise.resolve().then(()=>(j_(),k_)).then(e=>e.laptop),monitor:()=>Promise.resolve().then(()=>(X_(),J_)).then(e=>e.monitor),watch:()=>Promise.resolve().then(()=>(sv(),$_)).then(e=>e.watch)},pv=new Map}));function hv(e,t){try{return new URL(e,t).href}catch{return e}}async function gv(e,t){let n=new Image;n.crossOrigin=`anonymous`,n.src=e,await n.decode();let r=ih(new Ka(n),t);return r.needsUpdate=!0,{texture:r,aspect:n.naturalWidth/n.naturalHeight,dispose:()=>r.dispose()}}async function _v(e,t,n){let r=document.createElement(`video`);r.crossOrigin=`anonymous`,r.muted=!0,r.playsInline=!0,r.preload=`auto`,r.src=e,await new Promise((t,n)=>{r.addEventListener(`loadedmetadata`,()=>t(),{once:!0}),r.addEventListener(`error`,()=>n(Error(`Video failed: ${e}`)),{once:!0})});let i=eh(r,Qm(n.video)),a=ih(new ic(r),t);return{texture:a,aspect:r.videoWidth/r.videoHeight,duration:r.duration,dispose(){i(),r.pause(),r.removeAttribute(`src`),r.load(),a.dispose()}}}function vv(e,t,n){return{buildDevice:e=>dv(e.spec,e.finish,t),async resolveScreen(t,r,{maxAnisotropy:i,screenAspect:a}){let o=t.media;if(n)return t.poster?gv(t.poster,i).catch(()=>oh(a,i)):o?.source===`url`&&o.kind===`image`?gv(hv(o.url,e),i).catch(()=>null):oh(a,i);if(!o)return oh(a,i);if(o.source===`data`)return gv(o.dataUrl,i);if(o.source===`url`){let n=hv(o.url,e);return o.kind===`video`?_v(n,i,t):gv(n,i)}return oh(a,i)},async resolveBackdrop(t,{maxAnisotropy:r}){return n||t.kind!==`image`||t.source===`idb`?null:gv(t.source===`data`?t.dataUrl:hv(t.url,e),r)}}}var yv=n((()=>{xp(),mv(),ph()})),bv=r({mount:()=>Sv});function xv(e){let t=document.createElement(`div`),n=e===`dark`?`#f1f1f3`:`#17181b`;return t.style.cssText=`position:absolute;inset:0;display:grid;place-items:center;background:${e===`dark`?`#0d0e11`:`#f4f4f2`};transition:opacity .3s`,t.innerHTML=`<div style="width:28px;height:28px;border-radius:50%;border:2px solid ${n}33;border-top-color:${n};animation:om-spin .8s linear infinite"></div><style>@keyframes om-spin{to{transform:rotate(360deg)}}</style>`,t}async function Sv(e,t,n){let r=await fetch(n,{credentials:`omit`});if(!r.ok)throw Error(`Could not load ${n} (${r.status})`);let i=Xt(await r.json()),a=document.createElement(`div`);a.style.cssText=`position:absolute;inset:0;`;let o=document.createElement(`canvas`);o.style.cssText=`display:block;width:100%;height:100%;`,o.setAttribute(`aria-label`,i.name),a.append(o),e.append(a);let s=t.loader?xv(t.theme):null;s&&e.append(s);let c=Km({canvas:o,quality:`embed`}),l=()=>c.setSize(e.clientWidth||1,e.clientHeight||1),u=new ResizeObserver(l);u.observe(e);let d=t.progressive?vv(n,`low`,!0):vv(n,`high`,!1);await c.loadScene(i.scene,d),l();let f=dh({engine:c,element:e,getDoc:()=>i,overrides:t.overrides});f.start(),s&&(s.style.opacity=`0`,setTimeout(()=>s.remove(),350));let p=!1;return t.progressive&&Cv(()=>{p||c.loadScene(i.scene,vv(n,`high`,!1))}),{dispose(){p=!0,u.disconnect(),f.dispose(),c.dispose(),a.remove(),s?.remove()}}}var Cv,wv=n((()=>{en(),ph(),yv(),Cv=e=>{let t=window;t.requestIdleCallback?t.requestIdleCallback(e,{timeout:2e3}):setTimeout(e,300)}})),Tv=`mockup-embed`,Ev=class extends HTMLElement{static get observedAttributes(){return[`src`,`mockup-id`,`aspect-ratio`,`width`,`height`,`poster`,`theme`]}player=null;observer=null;poster=null;loading=!1;connectedCallback(){this.style.display||=`block`,this.style.position||=`relative`,this.style.overflow=`hidden`,this.applySize(),this.showPoster();let e=o(this);e.lowBandwidth||(e.overrides.trigger===`load`||this.getAttribute(`trigger`)===`load`?this.load():(this.observer=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this.observer?.disconnect(),this.observer=null,this.load())},{rootMargin:`200px`}),this.observer.observe(this)))}disconnectedCallback(){this.observer?.disconnect(),this.observer=null,this.player?.dispose(),this.player=null}attributeChangedCallback(e){(e===`aspect-ratio`||e===`width`||e===`height`)&&this.applySize(),e===`poster`&&this.showPoster()}applySize(){let e=this.getAttribute(`width`),t=this.getAttribute(`height`),n=this.getAttribute(`aspect-ratio`),r=e=>/^\d+(\.\d+)?$/.test(e)?`${e}px`:e;e&&(this.style.width=r(e)),t&&(this.style.height=r(t)),n&&!t&&(this.style.aspectRatio=n),!e&&!this.style.width&&(this.style.width=`100%`),n||t||this.style.height||(this.style.aspectRatio=`16 / 9`)}showPoster(){let e=this.getAttribute(`poster`);e&&(this.poster||(this.poster=document.createElement(`img`),this.poster.alt=``,this.poster.style.cssText=`position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:opacity .4s`,this.prepend(this.poster)),this.poster.src=e)}async load(){if(this.loading||this.player)return;this.loading=!0;let e=o(this),t=s(e);if(!t)console.warn(`<${Tv}> needs a src or mockup-id attribute.`);else try{let n=await Promise.resolve().then(()=>(wv(),bv));this.player=await n.mount(this,e,t),this.poster&&(this.poster.style.opacity=`0`,setTimeout(()=>this.poster?.remove(),450))}catch(e){console.error(`<${Tv}> failed to load`,e)}finally{this.loading=!1}}};return typeof customElements<`u`&&!customElements.get(Tv)&&customElements.define(Tv,Ev),e.MockupEmbed=Ev,e})({});
|
|
4759
|
+
`}));function Th(e){e.computeBoundingBox();let t=e.boundingBox,n=e.attributes.position,r=e.attributes.uv;if(!t||!n||!r)return e;for(let e=0;e<n.count;e++)r.setXY(e,(n.getX(e)-t.min.x)/(t.max.x-t.min.x),(n.getY(e)-t.min.y)/(t.max.y-t.min.y));return r.needsUpdate=!0,e}var Eh=n((()=>{}));function Dh(e){e.traverse(e=>{if(!(e instanceof $s))return;e.geometry.dispose();let t=Array.isArray(e.material)?e.material:[e.material];for(let e of t)e.dispose()})}var Oh=n((()=>{Sp()}));function kh(e,t,n,r=2,i=32){return new Nc(Ah(e,t,n,r,i))}function Ah(e,t,n,r=2,i=32){let a=Math.min(n,e/2,t/2),o=-e/2+a,s=e/2-a,c=-t/2+a,l=t/2-a,u=[[s,c,-Math.PI/2],[s,l,0],[o,l,Math.PI/2],[o,c,Math.PI]],d=[];for(let[e,t,n]of u)for(let o=0;o<=i;o++){let s=n+o/i*(Math.PI/2),c=Math.cos(s),l=Math.sin(s),u=new J(e+a*Math.sign(c)*Math.abs(c)**(2/r),t+a*Math.sign(l)*Math.abs(l)**(2/r)),f=d[d.length-1];(!f||f.distanceToSquared(u)>1e-12)&&d.push(u)}let f=d[0],p=d[d.length-1];return f&&p&&f!==p&&f.distanceToSquared(p)<1e-12&&d.pop(),d}var jh=n((()=>{Sp()}));function Mh({width:e,height:t,depth:n,radius:r,exponent:i=2,edge:a,quality:o}){let s=Math.min(a,n/2-1e-4),c=new Ic(kh(e-2*s,t-2*s,Math.max(r-s,.001),i,o.corner),{depth:n-2*s,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:o.bevel});return c.translate(0,0,-(n-2*s)/2),c}function Nh(e,t,n,r,i){return new Vc(kh(e,t,n,r,i.corner))}function Q(e,t,n,r={}){let i=new $s(t,n);return i.castShadow=!0,i.position.set(r.x??0,r.y??0,r.z??0),i.rotation.set(r.rx??0,r.ry??0,r.rz??0),e.add(i),i}function Ph(e,t,n,r,i){let a=r===`x`?e:t,o=r===`x`?t:e,s=Math.min(t,n)*.3,c=new Ic(kh(a-2*s,o-2*s,Math.min(a,o)/2-s,2,Math.max(6,i.corner/2)),{depth:n-2*s,bevelEnabled:!0,bevelThickness:s,bevelSize:s,bevelSegments:4});return c.translate(0,0,-(n-2*s)/2),c}var Fh,$,Ih=n((()=>{Sp(),jh(),Fh={low:{corner:12,bevel:4,round:24},high:{corner:32,bevel:10,round:64}},$=.002}));function Lh({width:e,height:t,radius:n,exponent:r,segments:i,profile:a}){let o=Ah(e,t,n,r,i),s=o.length,c=o.map((e,t)=>{let n=o[(t-1+s)%s],r=o[(t+1)%s];return new J(r.y-n.y,-(r.x-n.x)).normalize()}),l=s+1,u=a.length,d=new Float32Array(l*u*3),f=new Float32Array(l*u*2),p=[0];for(let e=1;e<l;e++)p.push(p[e-1]+o[e%s].distanceTo(o[(e-1)%s]));let m=[0];for(let e=1;e<u;e++){let[t,n]=a[e-1],[r,i]=a[e];m.push(m[e-1]+Math.hypot(r-t,i-n))}for(let e=0;e<u;e++){let[t,n]=a[e];for(let r=0;r<l;r++){let i=o[r%s],a=c[r%s],u=e*l+r;d[u*3]=i.x-a.x*t,d[u*3+1]=i.y-a.y*t,d[u*3+2]=n,f[u*2]=p[r],f[u*2+1]=m[e]}}let h=[];for(let e=0;e<u-1;e++)for(let t=0;t<l-1;t++){let n=e*l+t,r=n+1,i=n+l,a=i+1;h.push(n,i,r,r,i,a)}let g=new ks;g.setAttribute(`position`,new ms(d,3)),g.setAttribute(`uv`,new ms(f,2)),g.setIndex(h),g.computeVertexNormals();let _=g.attributes.normal,v=new Y;for(let e=0;e<u;e++){let t=e*l,n=t+l-1;v.set(_.getX(t)+_.getX(n),_.getY(t)+_.getY(n),_.getZ(t)+_.getZ(n)).normalize(),_.setXYZ(t,v.x,v.y,v.z),_.setXYZ(n,v.x,v.y,v.z)}return g}function Rh(e,t,n=8){let r=[];for(let i=0;i<=n;i++){let a=i/n*(Math.PI/2);r.push([e-e*Math.sin(a),t-e+e*Math.cos(a)])}return r}var zh=n((()=>{Sp(),jh()}));function Bh(e){let t={frame:new Xc({metalness:1,anisotropy:.4}),back:new Xc({roughness:.45,clearcoat:.8,clearcoatRoughness:.28}),island:new Xc({metalness:1,roughness:.3}),glass:new Xc({color:131587,roughness:.6,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02}),display:new Xc({color:0,emissive:16777215,roughness:1,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02,toneMapped:!1}),bezel:new Yc({color:328966,roughness:.55}),dark:new Yc({color:1710620,roughness:.65}),lens:new Xc({color:329224,roughness:.08,clearcoat:1,clearcoatRoughness:.02,iridescence:1,iridescenceIOR:1.8,iridescenceThicknessRange:[220,480]}),lensRing:new Xc({metalness:1,roughness:.12}),pupil:new Xc({color:0,roughness:.3,clearcoat:1,clearcoatRoughness:.05}),flash:new Xc({color:15261640,roughness:.45,clearcoat:1,clearcoatRoughness:.1}),logo:new Xc({metalness:1,roughness:.08,side:2}),accent:new Xc({color:16738816,roughness:.5}),band:new Xc({color:1776413,roughness:.75,sheen:.4,sheenRoughness:.8})},n=hh();for(let e of[t.frame,t.back,t.island])gh(e,n);return Vh(t,e),t}function Vh(e,t){switch(e.frame.color.set(t.frame),e.frame.roughness=t.frameRoughness,e.lensRing.color.set(t.frame).lerp(new Po(16777215),.35),e.island.color.set(t.frame),e.back.color.set(t.back),t.backMaterial??`glass`){case`metal`:e.back.metalness=1,e.back.roughness=t.frameRoughness+.05,e.back.clearcoat=0;break;case`ceramic`:e.back.metalness=0,e.back.roughness=.2,e.back.clearcoat=1,e.back.clearcoatRoughness=.05;break;default:e.back.metalness=0,e.back.roughness=.45,e.back.clearcoat=.8,e.back.clearcoatRoughness=.28}e.logo.color.set(t.frame).lerp(new Po(16777215),.25),t.accent&&e.accent.color.set(t.accent)}function Hh(e,t,n){return{mesh:e,aspect:t,setTexture(e,r,i=`cover`,a){if(e){let{repeat:n,offset:o}=l(r,t,i,a);e.wrapS=e.wrapT=Xr,e.repeat.set(n[0],n[1]),e.offset.set(o[0],o[1])}n.display.emissiveMap=e,n.display.needsUpdate=!0},setGlare(e,t=`matte`){let r=n.display;t===`glossy`?(r.clearcoat=0,r.roughness=.04,r.specularIntensity=e,r.ior=1.2):(r.clearcoat=t===`matte`?e:0,r.roughness=1,r.specularIntensity=0,r.ior=1.5),n.glass.clearcoat=.25+(t===`clean`?0:e*.75)}}}var Uh=n((()=>{Sp(),tn(),wh()}));function Wh(e,t,n=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let r=t.userData.transform,i=e.gradientUnits===`objectBoundingBox`,a=null;if(i&&(a=Gh(t,r),a===null))return null;function o(t,n,o){o.set(t,n,1),e.gradientTransform&&o.applyMatrix3(e.gradientTransform),i&&o.set(a.minX+o.x*a.width,a.minY+o.y*a.height,1),r&&o.applyMatrix3(r)}let s=document.createElement(`canvas`),c;if(e.type===`linearGradient`){s.width=n,s.height=1;let t=s.getContext(`2d`),r=t.createLinearGradient(0,0,n,0);Kh(r,e.stops),t.fillStyle=r,t.fillRect(0,0,n,1);let i=new Y,a=new Y;o(e.x1,e.y1,i),o(e.x2,e.y2,a);let l=a.x-i.x,u=a.y-i.y,d=l*l+u*u||1e-20,f=l/d,p=u/d,m=-(f*i.x+p*i.y);c=new X().set(f,p,m,0,0,.5,0,0,1)}else{let t=e.cx,o=e.cy,l=e.fx,u=e.fy,d=e.r;if(e.gradientTransform){let n=new Y;n.set(t,o,1).applyMatrix3(e.gradientTransform),t=n.x,o=n.y,n.set(l,u,1).applyMatrix3(e.gradientTransform),l=n.x,u=n.y}if(i&&(t=a.minX+t*a.width,o=a.minY+o*a.height,l=a.minX+l*a.width,u=a.minY+u*a.height,d*=Math.sqrt((a.width*a.width+a.height*a.height)/2)),d<=0)return null;s.width=n,s.height=n;let f=s.getContext(`2d`),p=t-d,m=o-d,h=2*d,g=n/h;f.setTransform(g,0,0,g,-p*g,-m*g);let _=f.createRadialGradient(l,u,0,t,o,d);Kh(_,e.stops),f.fillStyle=_,f.fillRect(p,m,h,h);let v=r?r.clone().invert():new X;c=new X().set(1/h,0,-p/h,0,1/h,-m/h,0,0,1).multiply(v)}let l=new sc(s);l.colorSpace=qh,l.flipY=!1,l.matrixAutoUpdate=!1,l.matrix=c;let u=e.spreadMethod===`reflect`?Zr:e.spreadMethod===`repeat`?Yr:Xr;return l.wrapS=u,l.wrapT=u,l}function Gh(e,t){let n=t?t.clone().invert():null,r=new J,i=new eu;for(let t of e.subPaths)for(let e of t.getPoints())r.copy(e),n&&r.applyMatrix3(n),i.expandByPoint(r);return i.isEmpty()?null:{minX:i.min.x,minY:i.min.y,width:i.max.x-i.min.x,height:i.max.y-i.min.y}}function Kh(e,t){let n=new Po;for(let r of t){let t=r.color;if(r.opacity<1){n.setStyle(r.color,qh);let e=/rgb\(([^)]+)\)/.exec(n.getStyle(qh));e&&(t=`rgba(${e[1]},${r.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,r.offset)),t)}}var qh,Jh,Yh,Xh=n((()=>{Sp(),qh=_a,Jh=class e extends hl{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit=`px`}load(e,t,n,r){let i=this,a=new vl(i.manager);a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this;function n(e,t){if(e.nodeType!==1)return;e.hasAttribute(`filter`)&&console.warn(`THREE.SVGLoader: Filters are not supported.`);let a=b(e),o=!1,p=null;switch(e.nodeName){case`svg`:t=m(e,t);break;case`style`:i(e);break;case`g`:t=m(e,t);break;case`path`:t=m(e,t),e.hasAttribute(`d`)&&(p=r(e));break;case`rect`:t=m(e,t),p=s(e);break;case`polygon`:t=m(e,t),p=c(e);break;case`polyline`:t=m(e,t),p=l(e);break;case`circle`:t=m(e,t),p=u(e);break;case`ellipse`:t=m(e,t),p=d(e);break;case`line`:t=m(e,t),p=f(e);break;case`defs`:o=!0;break;case`use`:t=m(e,t);let a=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||``).substring(1),h=e.viewportElement.getElementById(a);h?n(h,t):console.warn(`SVGLoader: 'use node' references non-existent node id: `+a)}if(p){t.fill!==void 0&&t.fill!==`none`&&!t.fill.startsWith(`url`)&&p.color.setStyle(t.fill,qh),C(p,re),A.push(p);let n=Object.assign({},t);n.strokeWidth=t.strokeWidth*O(re),p.userData={node:e,style:n,transform:re.clone(),gradients:M}}let h=e.childNodes;for(let e=0;e<h.length;e++){let r=h[e];o&&r.nodeName!==`style`&&r.nodeName!==`defs`||n(r,t)}a&&(N.pop(),N.length>0?re.copy(N[N.length-1]):re.identity())}function r(e){let t=new tu,n=new J,r=new J,i=new J,o=!0,s=!1,c=e.getAttribute(`d`);if(c===``||c===`none`)return null;let l=c.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,c=l.length;e<c;e++){let c=l[e],u=c.charAt(0),d=c.slice(1).trim();o===!0&&(s=!0,o=!1);let f;switch(u){case`M`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x=f[e+0],n.y=f[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`H`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.x=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`V`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.y=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`L`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x=f[e+0],n.y=f[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`C`:f=g(d);for(let e=0,a=f.length;e<a;e+=6)t.bezierCurveTo(f[e+0],f[e+1],f[e+2],f[e+3],f[e+4],f[e+5]),r.x=f[e+2],r.y=f[e+3],n.x=f[e+4],n.y=f[e+5],e===0&&s===!0&&i.copy(n);break;case`S`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),f[e+0],f[e+1],f[e+2],f[e+3]),r.x=f[e+0],r.y=f[e+1],n.x=f[e+2],n.y=f[e+3],e===0&&s===!0&&i.copy(n);break;case`Q`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.quadraticCurveTo(f[e+0],f[e+1],f[e+2],f[e+3]),r.x=f[e+0],r.y=f[e+1],n.x=f[e+2],n.y=f[e+3],e===0&&s===!0&&i.copy(n);break;case`T`:f=g(d);for(let e=0,a=f.length;e<a;e+=2){let a=h(n.x,r.x),o=h(n.y,r.y);t.quadraticCurveTo(a,o,f[e+0],f[e+1]),r.x=a,r.y=o,n.x=f[e+0],n.y=f[e+1],e===0&&s===!0&&i.copy(n)}break;case`A`:f=g(d,[3,4],7);for(let e=0,o=f.length;e<o;e+=7){if(f[e+5]==n.x&&f[e+6]==n.y)continue;let o=n.clone();n.x=f[e+5],n.y=f[e+6],r.x=n.x,r.y=n.y,a(t,f[e],f[e+1],f[e+2],f[e+3],f[e+4],o,n),e===0&&s===!0&&i.copy(n)}break;case`m`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x+=f[e+0],n.y+=f[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`h`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.x+=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`v`:f=g(d);for(let e=0,a=f.length;e<a;e++)n.y+=f[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`l`:f=g(d);for(let e=0,a=f.length;e<a;e+=2)n.x+=f[e+0],n.y+=f[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y),e===0&&s===!0&&i.copy(n);break;case`c`:f=g(d);for(let e=0,a=f.length;e<a;e+=6)t.bezierCurveTo(n.x+f[e+0],n.y+f[e+1],n.x+f[e+2],n.y+f[e+3],n.x+f[e+4],n.y+f[e+5]),r.x=n.x+f[e+2],r.y=n.y+f[e+3],n.x+=f[e+4],n.y+=f[e+5],e===0&&s===!0&&i.copy(n);break;case`s`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),n.x+f[e+0],n.y+f[e+1],n.x+f[e+2],n.y+f[e+3]),r.x=n.x+f[e+0],r.y=n.y+f[e+1],n.x+=f[e+2],n.y+=f[e+3],e===0&&s===!0&&i.copy(n);break;case`q`:f=g(d);for(let e=0,a=f.length;e<a;e+=4)t.quadraticCurveTo(n.x+f[e+0],n.y+f[e+1],n.x+f[e+2],n.y+f[e+3]),r.x=n.x+f[e+0],r.y=n.y+f[e+1],n.x+=f[e+2],n.y+=f[e+3],e===0&&s===!0&&i.copy(n);break;case`t`:f=g(d);for(let e=0,a=f.length;e<a;e+=2){let a=h(n.x,r.x),o=h(n.y,r.y);t.quadraticCurveTo(a,o,n.x+f[e+0],n.y+f[e+1]),r.x=a,r.y=o,n.x+=f[e+0],n.y+=f[e+1],e===0&&s===!0&&i.copy(n)}break;case`a`:f=g(d,[3,4],7);for(let e=0,o=f.length;e<o;e+=7){if(f[e+5]==0&&f[e+6]==0)continue;let o=n.clone();n.x+=f[e+5],n.y+=f[e+6],r.x=n.x,r.y=n.y,a(t,f[e],f[e+1],f[e+2],f[e+3],f[e+4],o,n),e===0&&s===!0&&i.copy(n)}break;case`Z`:case`z`:t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(n.copy(i),t.currentPath.currentPoint.copy(n),o=!0);break;default:console.warn(c)}s=!1}return t}function i(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let n=e.sheet.cssRules[t];if(n.type!==1)continue;let r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim());for(let e=0;e<r.length;e++){let t=Object.fromEntries(Object.entries(n.style).filter(([,e])=>e!==``));j[r[e]]=Object.assign(j[r[e]]||{},t)}}}function a(e,t,n,r,i,a,s,c){if(t==0||n==0){e.lineTo(c.x,c.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let l=(s.x-c.x)/2,u=(s.y-c.y)/2,d=Math.cos(r)*l+Math.sin(r)*u,f=-Math.sin(r)*l+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(s.x+c.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(s.y+c.y)/2,T=o(1,0,(d-x)/t,(f-S)/n),E=o((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.currentPath.absellipse(C,w,t,n,T,T+E,a===0,r)}function o(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function s(e){let t=y(e.getAttribute(`x`)||0),n=y(e.getAttribute(`y`)||0),r=y(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=y(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=y(e.getAttribute(`width`)),o=y(e.getAttribute(`height`)),s=.448084975506,c=new tu;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function c(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new tu,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!0,r}function l(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,r=new tu,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!1,r}function u(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`r`)||0),i=new Mc;i.absarc(t,n,r,0,Math.PI*2);let a=new tu;return a.subPaths.push(i),a}function d(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`rx`)||0),i=y(e.getAttribute(`ry`)||0),a=new Mc;a.absellipse(t,n,r,i,0,Math.PI*2);let o=new tu;return o.subPaths.push(a),o}function f(e){let t=y(e.getAttribute(`x1`)||0),n=y(e.getAttribute(`y1`)||0),r=y(e.getAttribute(`x2`)||0),i=y(e.getAttribute(`y2`)||0),a=new tu;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}function p(e){let t=e.querySelectorAll(`linearGradient, radialGradient`),n=[`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`],r={};for(let e of t){let t=e.getAttribute(`id`);if(!t)continue;let i={type:e.nodeName===`radialGradient`?`radialGradient`:`linearGradient`,attrs:{},stops:null,href:null},a=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``;a.startsWith(`#`)&&(i.href=a.substring(1));for(let t of n)e.hasAttribute(t)&&(i.attrs[t]=e.getAttribute(t));let o=e.querySelectorAll(`stop`);if(o.length>0){i.stops=[];for(let e of o){let t=e.getAttribute(`stop-color`);!t&&e.style&&(t=e.style[`stop-color`]),t||=`#000`;let n=e.getAttribute(`stop-opacity`);(n===null||n===``)&&e.style&&(n=e.style[`stop-opacity`]),n=n===null||n===``||n===void 0?1:Math.max(0,Math.min(1,parseFloat(n)));let r=Math.max(0,Math.min(1,parseFloat(e.getAttribute(`offset`)||`0`)));i.stops.push({offset:r,color:t,opacity:n})}}r[t]=i}function i(e,t){let n=r[e];if(!n||t.has(e))return n;if(t.add(e),n.href&&r[n.href]){let e=i(n.href,t);if(e){n.stops||=e.stops;for(let t in e.attrs)t in n.attrs||(n.attrs[t]=e.attrs[t])}}return n}for(let e in r)i(e,new Set);for(let e in r){let t=r[e],n=t.attrs,i=n.gradientUnits===`userSpaceOnUse`?`userSpaceOnUse`:`objectBoundingBox`,a={type:t.type,gradientUnits:i,spreadMethod:n.spreadMethod===`reflect`||n.spreadMethod===`repeat`?n.spreadMethod:`pad`,gradientTransform:null,stops:(t.stops||[]).slice().sort((e,t)=>e.offset-t.offset)};n.gradientTransform&&(a.gradientTransform=new X,S(n.gradientTransform,a.gradientTransform));function o(e){return typeof e==`string`?e.endsWith(`%`)?parseFloat(e)/100:y(e):0}if(t.type===`linearGradient`)a.x1=n.x1===void 0?0:o(n.x1),a.y1=n.y1===void 0?0:o(n.y1),a.x2=n.x2===void 0?+(i===`objectBoundingBox`):o(n.x2),a.y2=n.y2===void 0?0:o(n.y2);else{let e=i===`objectBoundingBox`?.5:0,t=i===`objectBoundingBox`?.5:0;a.cx=n.cx===void 0?e:o(n.cx),a.cy=n.cy===void 0?e:o(n.cy),a.r=n.r===void 0?t:o(n.r),a.fx=n.fx===void 0?a.cx:o(n.fx),a.fy=n.fy===void 0?a.cy:o(n.fy)}M[e]=a}}function m(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)n=Object.assign(n,j[`.`+t[e]])}e.hasAttribute(`id`)&&(n=Object.assign(n,j[`#`+e.getAttribute(`id`)]));function r(r,i,a){a===void 0&&(a=function(e){return e}),e.hasAttribute(r)&&(t[i]=a(e.getAttribute(r))),n[i]&&(t[i]=a(n[i])),e.style&&e.style[r]!==``&&(t[i]=a(e.style[r]))}function i(e){return Math.max(0,Math.min(1,y(e)))}function a(e){return Math.max(0,y(e))}return r(`fill`,`fill`),r(`fill-opacity`,`fillOpacity`,i),r(`fill-rule`,`fillRule`),r(`opacity`,`opacity`,i),r(`stroke`,`stroke`),r(`stroke-opacity`,`strokeOpacity`,i),r(`stroke-width`,`strokeWidth`,a),r(`stroke-linejoin`,`strokeLineJoin`),r(`stroke-linecap`,`strokeLineCap`),r(`stroke-miterlimit`,`strokeMiterLimit`,a),r(`visibility`,`visibility`),t}function h(e,t){return e-(t-e)}function g(e,t,n){if(typeof e!=`string`)throw TypeError(`Invalid input: `+typeof e);let r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},i=0,a=!0,o=``,s=``,c=[];function l(e,t,n){let r=SyntaxError(`Unexpected character "`+e+`" at index `+t+`.`);throw r.partial=n,r}function u(){o!==``&&(s===``?c.push(Number(o)):c.push(Number(o)*10**Number(s))),o=``,s=``}let d,f=e.length;for(let p=0;p<f;p++)if(d=e[p],Array.isArray(t)&&t.includes(c.length%n)&&r.FLAGS.test(d))i=1,o=d,u();else{if(i===0){if(r.WHITESPACE.test(d))continue;if(r.DIGIT.test(d)||r.SIGN.test(d)){i=1,o=d;continue}if(r.POINT.test(d)){i=2,o=d;continue}r.COMMA.test(d)&&(a&&l(d,p,c),a=!0)}if(i===1){if(r.DIGIT.test(d)){o+=d;continue}if(r.POINT.test(d)){o+=d,i=2;continue}if(r.EXP.test(d)){i=3;continue}r.SIGN.test(d)&&o.length===1&&r.SIGN.test(o[0])&&l(d,p,c)}if(i===2){if(r.DIGIT.test(d)){o+=d;continue}if(r.EXP.test(d)){i=3;continue}r.POINT.test(d)&&o[o.length-1]===`.`&&l(d,p,c)}if(i===3){if(r.DIGIT.test(d)){s+=d;continue}if(r.SIGN.test(d)){if(s===``){s+=d;continue}s.length===1&&r.SIGN.test(s)&&l(d,p,c)}}r.WHITESPACE.test(d)?(u(),i=0,a=!1):r.COMMA.test(d)?(u(),i=0,a=!0):r.SIGN.test(d)?(u(),i=1,o=d):r.POINT.test(d)?(u(),i=2,o=d):l(d,p,c)}return u(),c}let _=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],v={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function y(e){let n=`px`;if(typeof e==`string`||e instanceof String)for(let t=0,r=_.length;t<r;t++){let r=_[t];if(e.endsWith(r)){n=r,e=e.substring(0,e.length-r.length);break}}let r;return n===`px`&&t.defaultUnit!==`px`?r=v.in[t.defaultUnit]/t.defaultDPI:(r=v[n][t.defaultUnit],r<0&&(r=v[n].in*t.defaultDPI)),r*parseFloat(e)}function b(e){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let t=x(e);return N.length>0&&t.premultiply(N[N.length-1]),re.copy(t),N.push(t),t}function x(e){let t=new X;if(e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))){let n=y(e.getAttribute(`x`)||0),r=y(e.getAttribute(`y`)||0);t.makeTranslation(n,r)}return e.hasAttribute(`transform`)&&S(e.getAttribute(`transform`),t),t}function S(e,t){let n=P,r=e.split(`)`);for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(i===``)continue;let a=i.indexOf(`(`),o=i.length;if(a>0&&a<o){let e=i.slice(0,a),r=g(i.slice(a+1));switch(n.identity(),e){case`translate`:if(r.length>=1){let e=r[0],t=0;r.length>=2&&(t=r[1]),n.makeTranslation(e,t)}break;case`rotate`:if(r.length>=1){let e=0,t=0,i=0;e=r[0]*Math.PI/180,r.length>=3&&(t=r[1],i=r[2]),F.makeTranslation(-t,-i),I.makeRotation(e),ee.multiplyMatrices(I,F),F.makeTranslation(t,i),n.multiplyMatrices(F,ee)}break;case`scale`:if(r.length>=1){let e=r[0],t=e;r.length>=2&&(t=r[1]),n.makeScale(e,t)}break;case`skewX`:r.length===1&&n.set(1,Math.tan(r[0]*Math.PI/180),0,0,1,0,0,0,1);break;case`skewY`:r.length===1&&n.set(1,0,0,Math.tan(r[0]*Math.PI/180),1,0,0,0,1);break;case`matrix`:r.length===6&&n.set(r[0],r[2],r[4],r[1],r[3],r[5],0,0,1)}t.premultiply(n)}}return t}function C(e,t){function n(e){ne.set(e.x,e.y,1).applyMatrix3(t),e.set(ne.x,ne.y)}function r(e){let n=e.xRadius,r=e.yRadius,i=Math.cos(e.aRotation),a=Math.sin(e.aRotation),o=new Y(n*i,n*a,0),s=new Y(-r*a,r*i,0),c=o.applyMatrix3(t),l=s.applyMatrix3(t),u=P.set(c.x,l.x,0,c.y,l.y,0,0,0,1),d=F.copy(u).invert(),f=I.copy(d).transpose().multiply(d).elements,p=k(f[0],f[1],f[4]),m=Math.sqrt(p.rt1),h=Math.sqrt(p.rt2);if(e.xRadius=1/m,e.yRadius=1/h,e.aRotation=Math.atan2(p.sn,p.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<2**-52)){let n=F.set(m,0,0,0,h,0,0,0,1),r=I.set(p.cs,p.sn,0,-p.sn,p.cs,0,0,0,1),i=n.multiply(r).multiply(u),a=e=>{let{x:t,y:n}=new Y(Math.cos(e),Math.sin(e),0).applyMatrix3(i);return Math.atan2(n,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),w(t)&&(e.aClockwise=!e.aClockwise)}}function i(e){let n=E(t),r=D(t);e.xRadius*=n,e.yRadius*=r;let i=n>2**-52?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,w(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}let a=e.subPaths;for(let e=0,o=a.length;e<o;e++){let o=a[e].curves;for(let e=0;e<o.length;e++){let a=o[e];a.isLineCurve?(n(a.v1),n(a.v2)):a.isCubicBezierCurve?(n(a.v0),n(a.v1),n(a.v2),n(a.v3)):a.isQuadraticBezierCurve?(n(a.v0),n(a.v1),n(a.v2)):a.isEllipseCurve&&(te.set(a.aX,a.aY),n(te),a.aX=te.x,a.aY=te.y,T(t)?r(a):i(a))}}}function w(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function T(e){let t=e.elements,n=t[0]*t[3]+t[1]*t[4];if(n===0)return!1;let r=E(e),i=D(e);return Math.abs(n/(r*i))>2**-52}function E(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function D(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function O(e){let t=e.elements,n=t[0]*t[4]-t[1]*t[3];return Math.sqrt(Math.abs(n))}function k(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}let A=[],j={},M={},N=[],P=new X,F=new X,I=new X,ee=new X,te=new J,ne=new Y,re=new X,L=new DOMParser().parseFromString(e,`image/svg+xml`);return p(L),n(L.documentElement,{fill:`#000`,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:`miter`,strokeLineCap:`butt`,strokeMiterLimit:4}),{paths:A,gradients:M,xml:L.documentElement}}static createFillMaterial(e){let t=e.userData.style;if(t.fill===void 0||t.fill===`none`)return null;let n=e.color,r=null,i=Yh.exec(t.fill);i&&(r=Wh(e.userData.gradients&&e.userData.gradients[i[1]],e));let a=new Vs({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1});return r===null?a.color=n:a.map=r,a}static createStrokeMaterial(e){let t=e.userData.style;return t.stroke===void 0||t.stroke===`none`?null:(Yh.test(t.stroke)&&console.warn(`THREE.SVGLoader: Gradient strokes are not supported.`),new Vs({color:new Po().setStyle(t.stroke,qh),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1}))}static createShapes(e){return console.warn(`SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.`),e.toShapes()}static getStrokeStyle(e,t,n,r,i){return e=e===void 0?1:e,t=t===void 0?`#000`:t,n=n===void 0?`miter`:n,r=r===void 0?`butt`:r,i=i===void 0?4:i,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:i}}static pointsToStroke(t,n,r,i){let a=[],o=[],s=[];if(e.pointsToStrokeWithBuffers(t,n,r,i,a,o,s)===0)return null;let c=new ks;return c.setAttribute(`position`,new _s(a,3)),c.setAttribute(`normal`,new _s(o,3)),c.setAttribute(`uv`,new _s(s,2)),c}static pointsToStrokeWithBuffers(e,t,n,r,i,a,o,s){let c=new J,l=new J,u=new J,d=new J,f=new J,p=new J,m=new J,h=new J,g=new J,_=new J,v=new J,y=new J,b=new J,x=new J,S=new J,C=new J,w=new J;n=n===void 0?12:n,r=r===void 0?.001:r,s=s===void 0?0:s,e=le(e);let T=e.length;if(T<2)return 0;let E=e[0].equals(e[T-1]),D,O=e[0],k,A=t.strokeWidth/2,j=1/(T-1),M=0,N,P,F,I,ee=!1,te=0,ne=s*3,re=s*2;L(e[0],e[1],c).multiplyScalar(A),h.copy(e[0]).sub(c),g.copy(e[0]).add(c),_.copy(h),v.copy(g);for(let n=1;n<T;n++){D=e[n],k=n===T-1?E?e[1]:void 0:e[n+1];let r=c;if(L(O,D,r),u.copy(r).multiplyScalar(A),y.copy(D).sub(u),b.copy(D).add(u),N=M+j,P=!1,k!==void 0){L(D,k,l),u.copy(l).multiplyScalar(A),x.copy(D).sub(u),S.copy(D).add(u),F=!0,u.subVectors(k,O),r.dot(u)<0&&(F=!1),n===1&&(ee=F),u.subVectors(k,D),u.normalize();let e=Math.abs(r.dot(u));if(e>2**-52){let n=A/e;u.multiplyScalar(-n),d.subVectors(D,O),f.copy(d).setLength(n).add(u),C.copy(f).negate();let r=f.length(),i=d.length();d.divideScalar(i),p.subVectors(k,D);let a=p.length();if(p.divideScalar(a),d.dot(C)<i&&p.dot(C)<a&&(P=!0),w.copy(f).add(D),C.add(D),P){let e=F?g:h,t=(w.x-e.x)*(C.y-e.y)-(w.y-e.y)*(C.x-e.x);(F&&t<0||!F&&t>0)&&C.copy(e)}switch(I=!1,P?F?(S.copy(C),b.copy(C)):(x.copy(C),y.copy(C)):ae(),t.strokeLineJoin){case`bevel`:oe(F,P,N);break;case`round`:se(F,P),F?ie(D,y,x,N,0):ie(D,S,b,N,1);break;default:let e=A*t.strokeMiterLimit/r;if(e<1){if(t.strokeLineJoin!==`miter-clip`){oe(F,P,N);break}se(F,P),F?(p.subVectors(w,y).multiplyScalar(e).add(y),m.subVectors(w,x).multiplyScalar(e).add(x),R(y,N,0),R(p,N,0),R(D,N,.5),R(D,N,.5),R(p,N,0),R(m,N,0),R(D,N,.5),R(m,N,0),R(x,N,0)):(p.subVectors(w,b).multiplyScalar(e).add(b),m.subVectors(w,S).multiplyScalar(e).add(S),R(b,N,1),R(p,N,1),R(D,N,.5),R(D,N,.5),R(p,N,1),R(m,N,1),R(D,N,.5),R(m,N,1),R(S,N,1))}else P?(F?(R(g,M,1),R(h,M,0),R(w,N,0),R(g,M,1),R(w,N,0),R(C,N,1)):(R(g,M,1),R(h,M,0),R(w,N,1),R(h,M,0),R(C,N,0),R(w,N,1)),F?x.copy(w):S.copy(w)):F?(R(y,N,0),R(w,N,0),R(D,N,.5),R(D,N,.5),R(w,N,0),R(x,N,0)):(R(b,N,1),R(w,N,1),R(D,N,.5),R(D,N,.5),R(w,N,1),R(S,N,1)),I=!0}}else ae()}else ae();!E&&n===T-1&&ce(e[0],_,v,F,!0,M),M=N,O=D,h.copy(x),g.copy(S)}if(!E)ce(D,y,b,F,!1,N);else if(P&&i){let e=w,t=C;ee!==F&&(e=C,t=w),F?(I||ee)&&(t.toArray(i,0),t.toArray(i,9),I&&e.toArray(i,3)):(I||!ee)&&(t.toArray(i,3),t.toArray(i,9),I&&e.toArray(i,0))}if(i){let e=[new J,new J,new J],t=s*3;for(let n=t;n<ne;n+=9)e[0].set(i[n],i[n+1]),e[1].set(i[n+3],i[n+4]),e[2].set(i[n+6],i[n+7]),Fc.area(e)<0&&(i[n+3]=e[0].x,i[n+4]=e[0].y)}return te;function L(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function R(e,t,n){i&&(i[ne]=e.x,i[ne+1]=e.y,i[ne+2]=0,a&&(a[ne]=0,a[ne+1]=0,a[ne+2]=1),ne+=3,o&&(o[re]=t,o[re+1]=n,re+=2)),te+=3}function ie(e,t,r,i,a){c.copy(t).sub(e).normalize(),l.copy(r).sub(e).normalize();let o=Math.PI,s=c.dot(l);Math.abs(s)<1&&(o=Math.abs(Math.acos(s))),o/=n,u.copy(t);for(let t=0,r=n-1;t<r;t++)d.copy(u).rotateAround(e,o),R(u,i,a),R(d,i,a),R(e,i,.5),u.copy(d);R(u,i,a),R(r,i,a),R(e,i,.5)}function ae(){R(g,M,1),R(h,M,0),R(y,N,0),R(g,M,1),R(y,N,0),R(b,N,1)}function oe(e,t,n){t?e?(R(g,M,1),R(h,M,0),R(y,N,0),R(g,M,1),R(y,N,0),R(C,N,1),R(y,n,0),R(x,n,0),R(C,n,.5)):(R(g,M,1),R(h,M,0),R(b,N,1),R(h,M,0),R(C,N,0),R(b,N,1),R(b,n,1),R(C,n,0),R(S,n,1)):e?(R(y,n,0),R(x,n,0),R(D,n,.5)):(R(b,n,1),R(S,n,0),R(D,n,.5))}function se(e,t){t&&(e?(R(g,M,1),R(h,M,0),R(y,N,0),R(g,M,1),R(y,N,0),R(C,N,1),R(y,M,0),R(D,N,.5),R(C,N,1),R(D,N,.5),R(x,M,0),R(C,N,1)):(R(g,M,1),R(h,M,0),R(b,N,1),R(h,M,0),R(C,N,0),R(b,N,1),R(b,M,1),R(C,N,0),R(D,N,.5),R(D,N,.5),R(C,N,0),R(S,M,1)))}function ce(e,n,r,a,s,f){switch(t.strokeLineCap){case`round`:s?ie(e,r,n,f,.5):ie(e,n,r,f,.5);break;case`square`:if(s)c.subVectors(n,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e),a?(u.toArray(i,3),d.toArray(i,0),d.toArray(i,9)):(u.toArray(i,3),o[7]===1?d.toArray(i,9):u.toArray(i,9),d.toArray(i,0));else{c.subVectors(r,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e);let t=i.length;a?(u.toArray(i,t-3),d.toArray(i,t-6),d.toArray(i,t-12)):(d.toArray(i,t-6),u.toArray(i,t-3),d.toArray(i,t-12))}}}function le(e){let t=!1;for(let n=1,i=e.length-1;n<i;n++)if(e[n].distanceTo(e[n+1])<r){t=!0;break}if(!t)return e;let n=[];n.push(e[0]);for(let t=1,i=e.length-1;t<i;t++)e[t].distanceTo(e[t+1])>=r&&n.push(e[t]);return n.push(e[e.length-1]),n}}},Yh=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/}));function Zh(){if(!eg){let e=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="${$h}"/></svg>`,{paths:t}=new Jh().parse(e);eg=t.flatMap(e=>Jh.createShapes(e))}return eg}function Qh(e){let t=new Vc(Zh(),12);t.computeBoundingBox();let n=t.boundingBox;if(!n)return t;let r=new Y;n.getSize(r);let i=new Y;n.getCenter(i);let a=e/r.y;return t.translate(-i.x,-i.y,0),t.scale(a,-a,1),t.computeVertexNormals(),t}var $h,eg,tg=n((()=>{Sp(),Xh(),$h=`M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701`,eg=null}));function ng(){return{logo:new Xc({roughness:.35,specularIntensity:.4,clearcoat:.3,clearcoatRoughness:.15,side:2}),seam:new Yc({roughness:.9}),cover:new Xc({color:0,roughness:.02,ior:1.77,specularIntensity:.45,iridescence:1,iridescenceIOR:1.38,iridescenceThicknessRange:[95,130],transparent:!0,blending:2,depthWrite:!1}),well:new Xc({color:131587,roughness:.55,specularIntensity:.4}),control:new Xc({color:921104,roughness:.1,clearcoat:1,clearcoatRoughness:.03})}}function rg(e,t,n){Vh(e,n),e.frame.anisotropy=0,e.lensRing.color.set(n.frame).lerp(ug,.06),e.lensRing.roughness=.24,e.back.roughness=.55,e.back.specularIntensity=.6,e.back.clearcoat=.2,e.back.clearcoatRoughness=.4,t.logo.color.set(n.back).multiplyScalar(.78),t.seam.color.set(n.back).multiplyScalar(.3)}function ig(e,t,n=`high`){let r=Fh[n],{width:i,height:a,depth:o,rimInset:s,bezel:c}=e,{radius:l,exponent:u}=e.corner,d=Bh(t),f=ng();rg(d,f,t);let p=new Oo;Q(p,Lh({width:i,height:a,radius:l,exponent:u,segments:r.corner,profile:e.edgeProfile}),d.frame);for(let t of e.buttons)og(e,t,d,f,p,r);let m=new Oo;m.position.z=o/2,p.add(m),Q(m,Mh({width:i-2*s,height:a-2*s,radius:l-s,exponent:u,depth:.05,edge:.022,quality:r}),d.glass,{z:-.05/2});let h=i-2*c,g=a-2*c,_=Q(m,Th(Nh(h,g,l-c,u,r)),d.display,{z:$*2});Q(m,Nh(e.island.width,e.island.height,e.island.height/2,2,r),d.bezel,{y:g/2-e.island.fromTop-e.island.height/2,z:$*3});let[v,y]=e.edgeProfile[e.edgeProfile.length-1],b=new Oo;b.position.z=y,b.rotation.y=Math.PI,p.add(b),Q(b,Nh(i-2*v,a-2*v,l-v,u,r),d.frame),sg(e,d,f,b,r),cg(e,d,f,b,r);let x=Hh(_,h/g,d);return{group:p,screens:[x],bounds:new Zo().setFromObject(p),params:{},restsOnFloor:!1,setParam(){},setFinish:e=>rg(d,f,e),setGlare:(e,t)=>x.setGlare(e,t),dispose:()=>{Dh(p);for(let e of Object.values(f))e.dispose()}}}function ag(e,t,n){return{x:-e.width/2+t,y:e.height/2-n}}function og(e,t,n,r,i,a){let o=e.height/2-t.fromTop,s=e.width/2*t.side;if(t.kind===`camera`){Q(i,Ph(t.length,.304,.03,`y`,a),n.lensRing,{x:s-t.side*.012,y:o,ry:Math.PI/2}),Q(i,Ph(t.length-.046,.259,.03,`y`,a),r.control,{x:s-t.side*.006,y:o,ry:Math.PI/2});return}let c=.146;Q(i,Ph(t.length,.267,c,`y`,a),n.frame,{x:s+t.side*(.046-c/2),y:o,ry:Math.PI/2})}function sg(e,t,n,r,i){let{fromTop:a,margin:o,radius:s}=e.backPanel,c=e.width-2*o,l=e.height-a-o,u=e.height/2-a-l/2,d=.012;Q(r,Nh(c+2*d,l+2*d,s+d,e.corner.exponent,i),n.seam,{y:u,z:$}),Q(r,Nh(c,l,s,e.corner.exponent,i),t.back,{y:u,z:$*2}),e.branding!==!1&&Q(r,Qh(e.logo.height),n.logo,{y:e.height/2-e.logo.fromTop,z:$*3})}function cg(e,t,n,r,i){let{height:a,margin:o,raise:s,radius:c,lip:l}=e.plateau,u=e.width-2*o,d=e.height/2-o-a/2,f=e.corner.exponent,p=[...Rh(l,s,i.bevel),[0,-.02]];Q(r,Lh({width:u,height:a,radius:c,exponent:f,segments:i.corner,profile:p}),t.frame,{y:d}),Q(r,Nh(u-2*l,a-2*l,c-l,f,i),t.frame,{y:d,z:s});let m=lg(e.lens.radius,i.round);for(let[i,a]of e.lens.centres){let o=ag(e,i,a),c=new Oo;c.position.set(o.x,o.y,s),c.rotation.x=Math.PI/2,r.add(c),Q(c,m.housing,t.lensRing),Q(c,m.well,n.well),Q(c,m.element,t.lens),Q(c,m.cover,n.cover).renderOrder=1}let h=ag(e,e.flash.x,e.flash.y);Q(r,new Bc(e.flash.radius*.86,e.flash.radius,i.round),t.lensRing,{...h,z:s+$}),Q(r,new fc(e.flash.radius*.86,i.round),t.flash,{...h,z:s+$});let g=ag(e,e.lidar.x,e.lidar.y);Q(r,new fc(e.lidar.radius,i.round),t.pupil,{...g,z:s+$});let _=ag(e,e.mic.x,e.mic.y);Q(r,new fc(e.mic.radius,16),t.bezel,{..._,z:s+$})}function lg(e,t){let n=e/.833,r=e=>new Rc(e.map(([e,t])=>new J(e*n,t*n)),t);return{housing:r([[.833,-.02],[.833,.137],[.83,.152],[.822,.165],[.81,.176],[.795,.185],[.775,.189],[.75,.19],[.711,.19],[.711,.03],[.67,.03]]),well:r([[.712,.035],[.646,.035],[.646,.183],[.482,.183],[.47,.17],[.42,.11],[.325,.105],[.3,.075],[.275,.056],[.256,-.035]]),element:r([[.256,-.035],[.24,-.02],[.2,.01],[.15,.035],[.1,.05],[.05,.058],[0,.06]]),cover:r([[.711,.056],[.717,.2],[.712,.205],[.705,.209],[.69,.212],[0,.212]])}}var ug,dg=n((()=>{Sp(),Eh(),Oh(),Ih(),zh(),Uh(),tg(),ug=new Po(16777215)})),fg,pg=n((()=>{fg={black:{label:`Black`,frame:`#2e2f33`,back:`#1b1c20`,frameRoughness:.4,backMaterial:`glass`},silver:{label:`Silver`,frame:`#cfd0d2`,back:`#d2d2d0`,frameRoughness:.42,backMaterial:`glass`},glacier:{label:`Glacier`,frame:`#bccddb`,back:`#ccdae6`,frameRoughness:.42,backMaterial:`glass`},burgundy:{label:`Burgundy`,frame:`#553a3e`,back:`#3d2226`,frameRoughness:.38,backMaterial:`glass`}}}));function mg(e){return{flash:{radius:.3365,x:e-1.388,y:1.382},lidar:{radius:.336,x:e-1.388,y:3.416},mic:{radius:.038,x:e-1.695,y:3.07}}}var hg,gg,_g,vg,yg=n((()=>{hg={depth:.875,corner:{radius:1.4,exponent:2.2},edgeProfile:[[1.22,4.7],[1.16,4.81],[.92,4.78],[.77,4.69],[.56,4.47],[.38,4.21],[.25,3.92],[.16,3.62],[.1,3.28],[.05,2.9],[.02,2.3],[0,1.6],[0,-.4],[.01,-1],[.03,-1.36],[.05,-1.6],[.07,-1.75],[.1,-1.97],[.17,-2.33],[.27,-2.63],[.41,-2.91],[.59,-3.16],[.82,-3.37],[1.09,-3.53],[1.36,-3.64],[1.72,-3.73],[2.22,-3.8],[2.86,-3.83]].map(([e,t])=>[e/10,t/10-.0555]),rimInset:.12,bezel:.256,island:{width:1.575,height:.607,fromTop:.232},plateau:{height:4.012,margin:.387,raise:.279,radius:1.11,lip:.11},lens:{radius:.833,centres:[[1.442,1.437],[1.442,3.361],[3.262,2.399]]},finishes:[`black`,`silver`,`glacier`,`burgundy`]},gg={...hg,id:`phone.iphone-18-pro-max`,label:`iPhone 18 Pro Max`,width:7.8,height:16.34,display:{px:[1320,2868],ppi:460},...mg(7.8),backPanel:{fromTop:4.878,margin:.381,radius:1.035},buttons:[{side:-1,fromTop:3.429,length:.692,kind:`action`},{side:-1,fromTop:4.844,length:1.122,kind:`volume`},{side:-1,fromTop:6.264,length:1.122,kind:`volume`},{side:1,fromTop:5.554,length:1.772,kind:`side`},{side:1,fromTop:11.184,length:1.712,kind:`camera`}],logo:{height:2.004,fromTop:9.753}},_g={...hg,id:`phone.iphone-18-pro`,label:`iPhone 18 Pro`,width:7.19,height:15,display:{px:[1206,2622],ppi:460},...mg(7.19),backPanel:{fromTop:4.878,margin:.381,radius:1.035},buttons:[{side:-1,fromTop:3.429,length:.692,kind:`action`},{side:-1,fromTop:4.844,length:1.122,kind:`volume`},{side:-1,fromTop:6.264,length:1.122,kind:`volume`},{side:1,fromTop:5.554,length:1.772,kind:`side`},{side:1,fromTop:10.264,length:1.712,kind:`camera`}],logo:{height:2.004,fromTop:9.079}},vg={[_g.id]:_g,[gg.id]:gg}})),bg=r({IPHONE_18_PRO:()=>_g,IPHONE_18_PRO_MAX:()=>gg,PHONE_FINISHES:()=>fg,PHONE_SPECS:()=>vg,buildPhone:()=>ig,phone:()=>xg}),xg,Sg=n((()=>{dg(),pg(),yg(),xg={type:`phone`,specs:vg,finishes:fg,build:ig}}));function Cg(e,t=!1){let n=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),i=new Set(Object.keys(e[0].morphAttributes)),a={},o={},s=e[0].morphTargetsRelative,c=new ks,l=0;for(let u=0;u<e.length;++u){let d=e[u],f=0;if(n!==(d.index!==null))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.`),null;for(let e in d.attributes){if(!r.has(e))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. All geometries must have compatible attributes; make sure "`+e+`" attribute exists among all geometries, or in none of them.`),null;a[e]===void 0&&(a[e]=[]),a[e].push(d.attributes[e]),f++}if(f!==r.size)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. Make sure all geometries have the same number of attributes.`),null;if(s!==d.morphTargetsRelative)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. .morphTargetsRelative must be consistent throughout all geometries.`),null;for(let e in d.morphAttributes){if(!i.has(e))return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. .morphAttributes must be consistent throughout all geometries.`),null;o[e]===void 0&&(o[e]=[]),o[e].push(d.morphAttributes[e])}if(t){let e;if(n)e=d.index.count;else if(d.attributes.position!==void 0)e=d.attributes.position.count;else return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index `+u+`. The geometry must have either an index or a position attribute`),null;c.addGroup(l,e,u),l+=e}}if(n){let t=0,n=[];for(let r=0;r<e.length;++r){let i=e[r].index;for(let e=0;e<i.count;++e)n.push(i.getX(e)+t);t+=e[r].attributes.position.count}c.setIndex(n)}for(let e in a){let t=wg(a[e]);if(!t)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` attribute.`),null;c.setAttribute(e,t)}for(let e in o){let t=o[e][0].length;if(t!==0){c.morphAttributes=c.morphAttributes||{},c.morphAttributes[e]=[];for(let n=0;n<t;++n){let t=[];for(let r=0;r<o[e].length;++r)t.push(o[e][r][n]);let r=wg(t);if(!r)return console.error(`THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the `+e+` morphAttribute.`),null;c.morphAttributes[e].push(r)}}}return c}function wg(e){let t,n,r,i=-1,a=0;for(let o=0;o<e.length;++o){let s=e[o];if(t===void 0&&(t=s.array.constructor),t!==s.array.constructor)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.`),null;if(n===void 0&&(n=s.itemSize),n!==s.itemSize)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.`),null;if(r===void 0&&(r=s.normalized),r!==s.normalized)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.`),null;if(i===-1&&(i=s.gpuType),i!==s.gpuType)return console.error(`THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.`),null;a+=s.count*n}let o=new t(a),s=new ms(o,n,r),c=0;for(let t=0;t<e.length;++t){let r=e[t];if(r.isInterleavedBufferAttribute){let e=c/n;for(let t=0,i=r.count;t<i;t++)for(let i=0;i<n;i++){let n=r.getComponent(t,i);s.setComponent(t+e,i,n)}}else o.set(r.array,c);c+=r.count*n}return i!==void 0&&(s.gpuType=i),s}function Tg(e,t=Math.PI/3){let n=e.index?e.toNonIndexed():e,r=n.attributes.position,i=r.count,a;if(r.isBufferAttribute===!0&&r.itemSize===3&&r.normalized===!1)a=r.array;else{a=new Float64Array(i*3);for(let e=0;e<i;e++)a[3*e+0]=r.getX(e),a[3*e+1]=r.getY(e),a[3*e+2]=r.getZ(e)}let o=Math.cos(t),s=(1+1e-10)*100,c=i/3,l=new Float64Array(c*3);for(let e=0;e<c;e++){let t=9*e,n=a[t+0],r=a[t+1],i=a[t+2],o=a[t+3],s=a[t+4],c=a[t+5],u=a[t+6],d=a[t+7],f=a[t+8],p=u-o,m=d-s,h=f-c,g=n-o,_=r-s,v=i-c,y=m*v-h*_,b=h*g-p*v,x=p*_-m*g,S=1/(Math.sqrt(y*y+b*b+x*x)||1);l[3*e+0]=y*S,l[3*e+1]=b*S,l[3*e+2]=x*S}let u=new Int32Array(i),d=new Float64Array(i*3),f=1;for(;f<i*2;)f<<=1;let p=f-1,m=new Int32Array(f),h=0;for(let e=0;e<i;e++){let t=3*e,n=Math.trunc(a[t+0]*s),r=Math.trunc(a[t+1]*s),i=Math.trunc(a[t+2]*s),o=(Math.imul(n,73856093)^Math.imul(r,19349663)^Math.imul(i,83492791))&p;for(;;){let t=m[o];if(t===0){let t=3*h;d[t+0]=n,d[t+1]=r,d[t+2]=i,m[o]=h+1,u[e]=h++;break}let a=3*(t-1);if(d[a+0]===n&&d[a+1]===r&&d[a+2]===i){u[e]=t-1;break}o=o+1&p}}let g=new Int32Array(h+1);for(let e=0;e<i;e++)g[u[e]+1]++;for(let e=0;e<h;e++)g[e+1]+=g[e];let _=new Int32Array(i),v=g.slice(0,h);for(let e=0;e<c;e++){let t=3*e;_[v[u[t+0]]++]=e,_[v[u[t+1]]++]=e,_[v[u[t+2]]++]=e}let y=new Float32Array(i*3);for(let e=0;e<c;e++){let t=3*e,n=l[t+0],r=l[t+1],i=l[t+2];for(let e=0;e<3;e++){let a=t+e,s=u[a],c=0,d=0,f=0;for(let e=g[s],t=g[s+1];e<t;e++){let t=3*_[e],a=l[t+0],s=l[t+1],u=l[t+2];n*a+r*s+i*u>o&&(c+=a,d+=s,f+=u)}let p=1/(Math.sqrt(c*c+d*d+f*f)||1);y[3*a+0]=c*p,y[3*a+1]=d*p,y[3*a+2]=f*p}}return n.setAttribute(`normal`,new ms(y,3,!1)),n}var Eg=n((()=>{Sp()})),Dg,Og,kg,Ag,jg,Mg=n((()=>{Dg={camera:{size:2.56,radius:.68,fromSide:.59,fromTop:.5,raise:.139,glassInset:.126},lens:{x:.56,y:.5,ring:.45,glass:.39,raise:.04},lidar:{x:-.555,y:-.025,radius:.394},flash:{x:-.556,y:.82,radius:.155},sensor:{x:.56,y:-.59,radius:.09},mic:{x:-.556,y:-.806,radius:.09},topButton:{length:1.16,height:.28,proud:.065,fromSide:1.95},volume:{length:1.01,gap:.13,height:.224,proud:.09,fromTop:2.1},speaker:{holes:17,hole:.194,pitch:.2235,fromSide:2.8},usbC:{length:.862,height:.276}},Og={cornerRadius:1.3,edgeRadius:.04,rim:.113,frontCamera:{fromEdge:.355,radius:.16},finishes:[`space-black`,`silver`]},kg={...Og,id:`tablet.ipad-pro-11`,label:`iPad Pro 11-inch`,width:17.75,height:24.97,depth:.53,display:{px:[1668,2420],ppi:264,cornerRadius:.72},logo:{height:3.05,raise:.29}},Ag={...Og,id:`tablet.ipad-pro-13`,label:`iPad Pro 13-inch`,width:21.55,height:28.16,depth:.51,display:{px:[2064,2752],ppi:264,cornerRadius:.72},logo:{height:3.44,raise:.33}},jg={[kg.id]:kg,[Ag.id]:Ag}}));function Ng(e,t){Vh(e,t),e.frame.anisotropy=0}function Pg(e,t,n=`high`){let r=Fh[n],{width:i,height:a,depth:o,cornerRadius:s,rim:c}=e,l=Bh(t);Ng(l,t);let u=new Oo;Q(u,Mh({width:i,height:a,depth:o,radius:s,edge:e.edgeRadius,quality:r}),l.frame),Ig(e,l,u,r);let d=new Oo;d.position.z=o/2,u.add(d),Q(d,Nh(i-2*c,a-2*c,s-c,2,r),l.glass,{z:$});let f=e.display.px[0]/e.display.ppi*2.54,p=e.display.px[1]/e.display.ppi*2.54,m=Q(d,Th(Nh(f,p,e.display.cornerRadius,2,r)),l.display,{z:$*2}),h=e.frontCamera;Q(d,new fc(h.radius,r.round),l.lens,{x:i/2-h.fromEdge,z:$*3}),Q(d,new fc(h.radius*.66,r.round),l.pupil,{x:i/2-h.fromEdge,z:$*4});let g=new Oo;g.position.z=-o/2,g.rotation.y=Math.PI,u.add(g),Q(g,Nh(i-.1,a-.1,s-.05,2,r),l.back,{z:$}),Fg(e,l,g,r),e.branding!==!1&&Q(g,Qh(e.logo.height),l.logo,{y:e.logo.raise,z:$*2});let _=Hh(m,f/p,l);return{group:u,screens:[_],bounds:new Zo().setFromObject(u),params:{},restsOnFloor:!1,setParam(){},setFinish:e=>Ng(l,e),setGlare:(e,t)=>_.setGlare(e,t),dispose:()=>Dh(u)}}function Fg(e,t,n,r){let i=Dg.camera,a=-e.width/2+i.fromSide+i.size/2,o=e.height/2-i.fromTop-i.size/2,s=new Oo;s.position.set(a,o,0),n.add(s);let c=.03;Q(s,new Ic(kh(i.size-2*c,i.size-2*c,i.radius-c,2,r.corner),{depth:i.raise-c,bevelEnabled:!0,bevelThickness:c,bevelSize:c,bevelSegments:4}),t.island);let l=i.raise+$,u=i.size-2*i.glassInset;Q(s,Nh(u,u,i.radius-i.glassInset,2,r),t.glass,{z:l});let d=e=>-e,{lens:f,lidar:p,flash:m,sensor:h,mic:g}=Dg,_=new pc(f.ring,f.ring,f.raise,r.round);_.rotateX(Math.PI/2),Q(s,_,t.lensRing,{x:d(f.x),y:f.y,z:l+f.raise/2});let v=l+f.raise+$;Q(s,new fc(f.glass,r.round),t.lens,{x:d(f.x),y:f.y,z:v}),Q(s,new fc(f.glass*.36,r.round),t.pupil,{x:d(f.x),y:f.y,z:v+$}),Q(s,new fc(p.radius,r.round),t.pupil,{x:d(p.x),y:p.y,z:l+$}),Q(s,new fc(m.radius,r.round),t.flash,{x:d(m.x),y:m.y,z:l+$}),Q(s,new fc(h.radius,r.round),t.pupil,{x:d(h.x),y:h.y,z:l+$}),Q(s,new fc(g.radius,r.round),t.bezel,{x:d(g.x),y:g.y,z:l+$})}function Ig(e,t,n,r){let{width:i,height:a}=e,o=.1,s=Dg.topButton;Q(n,Ph(s.length,s.height,s.proud+o,`x`,r),t.frame,{x:i/2-s.fromSide,y:a/2+s.proud-(s.proud+o)/2,rx:Math.PI/2});let c=Dg.volume;for(let e of[0,1])Q(n,Ph(c.length,c.height,c.proud+o,`y`,r),t.frame,{x:i/2+c.proud-(c.proud+o)/2,y:a/2-c.fromTop-c.length/2-e*(c.length+c.gap),ry:Math.PI/2});let l=Dg.speaker,u=[];for(let e of[-1,1])for(let t=0;t<l.holes;t++){let n=new fc(l.hole/2,12);n.translate(e*(i/2-l.fromSide-t*l.pitch),0,0),u.push(n)}let d=Cg(u);for(let e of u)e.dispose();Q(n,d,t.bezel,{y:a/2+$,rx:-Math.PI/2}),Q(n,d.clone(),t.bezel,{y:-a/2-$,rx:Math.PI/2}),Q(n,new fc(.05,12),t.bezel,{y:a/2+$,rx:-Math.PI/2}),Q(n,Nh(Dg.usbC.length,Dg.usbC.height,Dg.usbC.height/2,2,r),t.bezel,{y:-a/2-$,rx:Math.PI/2})}var Lg=n((()=>{Sp(),Eg(),Oh(),tg(),Uh(),Ih(),jh(),Eh(),Mg()})),Rg,zg=n((()=>{Rg={"space-black":{label:`Space Black`,frame:`#2b2b2e`,back:`#2b2b2e`,frameRoughness:.34,backMaterial:`metal`},silver:{label:`Silver`,frame:`#d7d7d9`,back:`#d7d7d9`,frameRoughness:.3,backMaterial:`metal`}}})),Bg=r({IPAD_PRO_11:()=>kg,IPAD_PRO_13:()=>Ag,TABLET_FINISHES:()=>Rg,TABLET_SPECS:()=>jg,buildTablet:()=>Pg,tablet:()=>Vg}),Vg,Hg=n((()=>{Lg(),zg(),Mg(),Vg={type:`tablet`,specs:jg,finishes:Rg,build:Pg}}));function Ug(e,t,n){let r=(Xg-t.reduce((e,t)=>e+t,0))/(t.length-1),i=-27.23/2;return t.map((t,a)=>{let o=n[a]??``,s=typeof o==`string`?{label:o}:o,c={x:i+t/2,y:e*Yg+Jg/2,w:t,h:Jg,...s};return i+=t+r,c})}function Wg(e,t){let n=new Map,r=[];for(let i of $g){let a=`${i.w}x${i.h}`,o=n.get(a);if(!o){let e=e_.roll;o=new Ic(kh(i.w-2*e,i.h-2*e,e_.radius-e,2,t),{depth:e_.height-2*e,bevelEnabled:!0,bevelThickness:e,bevelSize:e,bevelSegments:3}),o.deleteAttribute(`uv`),n.set(a,o)}let s=o.clone();s.translate(i.x,Zg.depth/2-i.y,e-e_.height+e_.roll),r.push(s)}let i=Cg(r);for(let e of[...r,...n.values()])e.dispose();return i}function Gg(e){return $g.map(t=>{let n=kh(t.w+2*t_,t.h+2*t_,e_.radius+t_,2,Math.max(4,e/2)).getPoints().map(e=>new J(e.x+t.x,e.y+Zg.depth/2-t.y));return new Mc(n.reverse())})}function Kg(){let e=document.createElement(`canvas`);e.width=Math.round(Zg.width*76),e.height=Math.round(Zg.depth*76);let t=e.getContext(`2d`);if(t){let e=(e,t=400)=>`${t} ${e}px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif`;t.fillStyle=`#fff`,t.strokeStyle=`#fff`;for(let n of $g){let r=(n.x+Zg.width/2)*76,i=n.y*76,a=n.w/2*76,o=n.h/2*76,s=.2*76;n.touchId?(t.lineWidth=2,t.globalAlpha=.35,t.beginPath(),t.arc(r,i,35.72,0,Math.PI*2),t.stroke(),t.globalAlpha=1):n.label&&(n.shift?(t.font=e(.27*76),t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(n.shift,r,i-.27*76),t.fillText(n.label,r,i+.27*76)):n.align?(t.font=e(.2*76),t.textBaseline=`alphabetic`,t.textAlign=n.align,t.fillText(n.label,n.align===`left`?r-a+s:r+a-s,i+o-s)):(t.font=e((n.label.length>1||n.h<1.596?.22:.34)*76),t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(n.label,r,i)))}}let n=new sc(e);return n.colorSpace=_a,n.anisotropy=8,n}var qg,Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_=n((()=>{Sp(),Eg(),jh(),qg=1.646,Jg=1.596,Yg=1.846,Xg=27.23,Zg={width:Xg,depth:10.826},Qg=e=>Array(e).fill(qg),$g=[...Ug(0,[2.593,...Qg(13)],[{label:`esc`,align:`left`},`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`,{touchId:!0}]),...Ug(1,[...Qg(13),2.593],[{label:"`",shift:`~`},{label:`1`,shift:`!`},{label:`2`,shift:`@`},{label:`3`,shift:`#`},{label:`4`,shift:`$`},{label:`5`,shift:`%`},{label:`6`,shift:`^`},{label:`7`,shift:`&`},{label:`8`,shift:`*`},{label:`9`,shift:`(`},{label:`0`,shift:`)`},{label:`-`,shift:`_`},{label:`=`,shift:`+`},{label:`delete`,align:`right`}]),...Ug(2,[2.593,...Qg(13)],[{label:`tab`,align:`left`},`Q`,`W`,`E`,`R`,`T`,`Y`,`U`,`I`,`O`,`P`,{label:`[`,shift:`{`},{label:`]`,shift:`}`},{label:`\\`,shift:`|`}]),...Ug(3,[3.067,...Qg(11),3.067],[{label:`caps lock`,align:`left`},`A`,`S`,`D`,`F`,`G`,`H`,`J`,`K`,`L`,{label:`;`,shift:`:`},{label:`'`,shift:`"`},{label:`return`,align:`right`}]),...Ug(4,[4.015,...Qg(10),4.015],[{label:`shift`,align:`left`},`Z`,`X`,`C`,`V`,`B`,`N`,`M`,{label:`,`,shift:`<`},{label:`.`,shift:`>`},{label:`/`,shift:`?`},{label:`shift`,align:`right`}]),...[[-12.792,qg,`fn`,`left`],[-10.897,qg,`control`,`left`],[-9.002,qg,`option`,`left`],[-6.87,2.12,`command`,`left`],[-.9475,9.226,``],[4.9745,2.12,`command`,`right`],[7.107,qg,`option`,`right`]].map(([e,t,n,r])=>({x:e,y:10.028,w:t,h:Jg,label:n,align:r})),{x:9.002,y:10.826-.389,w:qg,h:.778,label:`◀`},{x:10.897,y:9.619,w:qg,h:.778,label:`▲`},{x:10.897,y:10.826-.389,w:qg,h:.778,label:`▼`},{x:12.792,y:10.826-.389,w:qg,h:.778,label:`▶`}],e_={radius:.146,roll:.021,height:.146},t_=.04}));function r_(){let e=new Yc({color:328966,roughness:.9,transparent:!0,depthWrite:!1}),t=p_();t?e.alphaMap=t:e.opacity=.35;let n=new Yc({color:14277083,roughness:.6,transparent:!0,depthWrite:!1});return typeof document<`u`&&(n.map=Kg()),{keycap:new Xc({color:1118483,roughness:.55,clearcoat:.25,clearcoatRoughness:.5}),legend:n,plate:new Yc({color:657931,roughness:.75}),well:new Yc({color:197380,roughness:.9}),trackpad:new Xc({roughness:.4,clearcoat:.4,clearcoatRoughness:.35}),gap:new Yc({color:394759,roughness:.8}),grille:e,foot:new Yc({color:2697515,roughness:.92}),clutch:new Xc({color:789517,roughness:.35,clearcoat:.6,clearcoatRoughness:.2}),cameraHousing:i_(855312),cameraLens:i_(328967),cameraWindow:i_(724260),cameraPupil:i_(0)}}function i_(e){return new Xc({color:e,roughness:.6,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02})}function a_(e,t,n){Vh(e,n),e.frame.anisotropy=0,t.trackpad.color.set(n.frame).multiplyScalar(.62)}function o_(e,t,n=`high`){let r=Fh[n],i=Bh(t),a=r_();a_(i,a,t);let o=new Oo,s=new Oo;s.position.y=e.feet.height+e.baseHeight,s.rotation.x=-Math.PI/2,o.add(s),s_(e,i,a,s,r);let c=new Oo;c.position.set(0,s.position.y-e.lid.pivot.belowDeck,-e.depth/2+e.lid.pivot.fromBack),o.add(c);let{displayMesh:l,aspect:u,setOpen:d}=l_(e,i,a,c,r),f=e=>{c.rotation.x=(90-e)*m_,d(e)};f(110);let p=Hh(l,u,i);return{group:o,screens:[p],bounds:new Zo().setFromObject(o),params:{lidAngle:{min:0,max:135,default:110,unit:`deg`,label:`Lid angle`}},restsOnFloor:!0,setParam(e,t){e===`lidAngle`&&f(t)},setFinish:e=>a_(i,a,e),setGlare:(e,t)=>{p.setGlare(e,t);for(let e of[a.cameraHousing,a.cameraLens,a.cameraWindow,a.cameraPupil])e.clearcoat=i.glass.clearcoat},dispose:()=>{Dh(o);for(let e of Object.values(a))e.map?.dispose(),e.alphaMap?.dispose(),e.dispose()}}}function s_(e,t,n,r,i){let{width:a,depth:o,baseHeight:s}=e,{radius:c,exponent:l}=e.corner,u=e.scoop.height,d=o/2-e.keyboard.fromBack-Zg.depth/2,f=Zg.width+2*e.keyboard.margin,p=Zg.depth+2*e.keyboard.margin,m=new Nc(c_(e,i)),h=kh(f,p,.5,2,i.corner).getPoints().map(e=>new J(e.x,e.y+d));m.holes.push(new Mc(h));let g=new Ic(m,{depth:u,bevelEnabled:!1,curveSegments:i.corner});g.translate(0,0,-u),Q(r,Tg(g,30*m_),t.frame);let _=g_-s,v=h_.map(([e,t])=>[e,t<-.48?t+_:t]);Q(r,Lh({width:a,height:o,radius:c,exponent:l,segments:i.corner,profile:v}),t.frame),Q(r,Nh(a,o,c,l,i),t.frame,{z:-u});let[y]=v[v.length-1];Q(r,Nh(a-2*y,o-2*y,c-y,l,i),t.frame,{z:-s,rx:Math.PI}),Q(r,Nh(f,p,.5,2,i),n.well,{y:d,z:-.258});let b=kh(f,p,.5,2,i.corner);for(let e of Gg(i.corner))b.holes.push(e);Q(r,new Vc(b,i.corner),n.plate,{y:d}),Q(r,Wg(.01,Math.max(6,i.corner/3)),n.keycap,{y:d}),n.legend.map&&Q(r,new zc(Zg.width,Zg.depth),n.legend,{y:d,z:.0125});let x=e.trackpad,S=-o/2+x.fromFront+x.depth/2;Q(r,Nh(x.width+.055,x.depth+.055,x.radius+.0275,2,i),n.gap,{y:S,z:$}),Q(r,Nh(x.width,x.depth,x.radius,2,i),n.trackpad,{y:S,z:$*2});let C=Zg.depth-.19,w=e.grille.outer-e.grille.inner;n.grille.alphaMap?.repeat.set(w/.64,C/.64);for(let t of[-1,1])Q(r,new zc(w,C),n.grille,{x:t*(e.grille.inner+w/2),y:d,z:$});Q(r,new pc(.3,.3,e.hinge.width-.3,i.round),n.clutch,{y:o/2-.44,z:-.3,rz:Math.PI/2});for(let t of e.ports){let e=y_[t.kind];Q(r,Nh(e.height,e.length,e.radius,2,i),n.gap,{x:t.side*(a/2+.002),y:o/2-t.fromBack,z:e.z,ry:t.side*Math.PI/2})}let T=e.feet;for(let e of[-1,1])for(let t of[-1,1])Q(r,new pc(T.radius,T.radius,T.height,i.round),n.foot,{x:e*(a/2-T.inset),y:t*(o/2-T.inset),z:-s-T.height/2,rx:Math.PI/2})}function c_(e,t){let{width:n,depth:r}=e,i=Ah(n,r,e.corner.radius,e.corner.exponent,t.corner),a=r/2,o=i.findIndex((e,t)=>{let n=i[(t+1)%i.length];return Math.abs(e.y-a)<1e-6&&Math.abs(n.y-a)<1e-6&&n.x<e.x}),s=e.hinge.width/2,c=[new J(s,a),new J(s,a-e.hinge.depth),new J(-s,a-e.hinge.depth),new J(-s,a)];i.splice(o+1,0,...c);let l=e.scoop.width/2,u=.74,d=[];for(let t=0;t<=8;t++){let n=t/8,i=n*n*(3-2*n);d.push(new J(-l+u*n,-r/2+e.scoop.depth*i))}for(let t=8;t>=0;t--){let n=t/8,i=n*n*(3-2*n);d.push(new J(l-u*n,-r/2+e.scoop.depth*i))}return i.push(...d),i}function l_(e,t,n,r,i){let{width:a}=e,{thickness:o,rim:s}=e.lid,{radius:c,exponent:l}=e.lid.corner,u=e.depth+__.overhang,d=__.bottom+u/2,f=__.front,p=f-o,m=[[s,f],[s*.4,f-.007],[.008,f-.025],[0,f-.047],[0,p+.08],[.012,p+.04],[.04,p+.015],[.09,p+.002],[.15,p]];Q(r,Lh({width:a,height:u,radius:c,exponent:l,segments:i.corner,profile:m}),t.frame,{y:d}),Q(r,Nh(a-2*s,u-2*s,c-s,l,i),t.glass,{y:d,z:f+$});let h=e.display.px[0]/e.display.ppi*2.54,g=e.display.px[1]/e.display.ppi*2.54,_=__.bottom+u-e.bezel,{radius:v,exponent:y}=e.displayCorner,b=Q(r,Th(new Vc(d_(h,g,v,y,i.corner))),t.display,{y:_-g/2,z:f+$*2});Q(r,new Vc(f_(e.notch,i.corner)),t.glass,{y:_,z:f+$*3});let x=e.camera,S=_-x.fromTop;Q(r,new fc(x.housing,i.round),n.cameraHousing,{y:S,z:f+$*4}),Q(r,new fc(x.lens,i.round),n.cameraLens,{y:S,z:f+$*5}),Q(r,new fc(x.window,i.round),n.cameraWindow,{y:S,z:f+$*6}),Q(r,new fc(x.pupil,i.round),n.cameraPupil,{y:S,z:f+$*7});let C=new Oo;C.position.z=p,C.rotation.y=Math.PI,r.add(C),Q(C,Nh(a-.3,u-.3,c-.15,l,i),t.frame,{y:d});let w=Nh(e.hinge.width-.28,v_,.3,2,i);w.translate(0,v_/2,0);let T=Q(C,w,n.clutch,{y:__.bottom,z:$});return e.branding!==!1&&Q(C,Qh(e.logo.height),t.logo,{y:d+e.logo.raise,z:$}),{displayMesh:b,aspect:h/g,setOpen:e=>{let t=Math.min(1,Math.max(0,e/40));T.scale.y=Math.max(.001,t*t*(3-2*t)),T.visible=e>.5}}}function u_(e,t,n,r,i,a,o){let s=[];for(let c=0;c<=o;c++){let l=i+(a-i)*c/o,u=Math.cos(l),d=Math.sin(l);s.push(new J(e+n*Math.sign(u)*Math.abs(u)**(2/r),t+n*Math.sign(d)*Math.abs(d)**(2/r)))}return s}function d_(e,t,n,r,i){let a=e/2-n,o=t/2-n;return new Nc([new J(-e/2,-t/2),new J(e/2,-t/2),...u_(a,o,n,r,0,Math.PI/2,i),...u_(-a,o,n,r,Math.PI/2,Math.PI,i)])}function f_(e,t,n=.3){let{height:r,radius:i,exponent:a,flare:o}=e,s=e.width/2,c=Math.max(6,t/2),l=[new J(s+o,n),...u_(s+o,-o,o,2,Math.PI/2,Math.PI,c),...u_(s-i,-(r-i),i,a,0,-Math.PI/2,c)],u=l.map(e=>new J(-e.x,e.y)).reverse();return new Nc([...l,...u])}function p_(){if(typeof document>`u`)return null;let e=document.createElement(`canvas`);e.width=e.height=128;let t=e.getContext(`2d`);if(!t)return null;t.fillStyle=`#000`,t.fillRect(0,0,128,128),t.fillStyle=`#fff`;for(let e=0;e<8;e++)for(let n=0;n<=8;n++){let r=n*16+(e%2?8:0);t.beginPath(),t.arc(r%128,e*16+8,4,0,Math.PI*2),t.fill()}let n=new sc(e);return n.wrapS=n.wrapT=Yr,n.anisotropy=8,n}var m_,h_,g_,__,v_,y_,b_=n((()=>{Sp(),Eg(),Oh(),tg(),Uh(),Ih(),jh(),zh(),Eh(),n_(),m_=Math.PI/180,h_=[[0,-.33],[.001,-.48],[.003,-.56],[.008,-.64],[.018,-.716],[.037,-.792],[.064,-.865],[.102,-.933],[.146,-.995],[.205,-1.057],[.259,-1.101],[.268,-1.107],[.305,-1.131],[.338,-1.149],[.378,-1.167],[.421,-1.184],[.492,-1.203],[.571,-1.215],[.651,-1.221],[.8,-1.224]],g_=1.224,__={front:-.243,bottom:-.52,overhang:.026},v_=1.27,y_={"usb-c":{length:.862,height:.276,radius:.138,z:-.377},magsafe:{length:1.62,height:.34,radius:.17,z:-.38},headphone:{length:.38,height:.38,radius:.19,z:-.375},hdmi:{length:1.45,height:.5,radius:.08,z:-.42},sd:{length:2.45,height:.2,radius:.1,z:-.38}}})),x_,S_=n((()=>{x_={"space-black":{label:`Space Black`,frame:`#47484c`,back:`#47484c`,frameRoughness:.4,backMaterial:`metal`},silver:{label:`Silver`,frame:`#d3d4d6`,back:`#d3d4d6`,frameRoughness:.42,backMaterial:`metal`}}})),C_,w_,T_,E_,D_,O_,k_=n((()=>{C_={corner:{radius:1,exponent:2.2},feet:{radius:.956,height:.18,inset:2.74},keyboard:{fromBack:2.779,margin:.325},scoop:{width:5.46,depth:.249,height:.336},hinge:{width:28.12,depth:.556},lid:{thickness:.417,corner:{radius:1.15,exponent:2.2},rim:.08,pivot:{fromBack:.494,belowDeck:.204}},displayCorner:{radius:.66,exponent:3.6},bezel:.548,notch:{width:3.68,height:.637,radius:.2875,exponent:3,flare:.098},camera:{fromTop:.167,housing:.201,lens:.175,window:.11,pupil:.036},logo:{height:4.646,raise:.387},finishes:[`space-black`,`silver`]},w_=[{side:-1,kind:`magsafe`,fromBack:3.572},{side:-1,kind:`usb-c`,fromBack:5.423},{side:-1,kind:`usb-c`,fromBack:6.907},{side:-1,kind:`headphone`,fromBack:8.186},{side:1,kind:`hdmi`,fromBack:3.579},{side:1,kind:`usb-c`,fromBack:5.428},{side:1,kind:`sd`,fromBack:7.866}],T_={...C_,id:`laptop.macbook-pro-16`,label:`MacBook Pro 16-inch`,width:35.57,depth:24.81,height:1.68,baseHeight:1.224,trackpad:{width:15.903,depth:9.92,fromFront:.577,radius:.525},grille:{inner:14.061,outer:17.646},display:{px:[3456,2234],ppi:254},ports:w_},E_=[{side:-1,kind:`magsafe`,fromBack:2.779},{side:-1,kind:`usb-c`,fromBack:4.627},{side:-1,kind:`usb-c`,fromBack:6.112},{side:-1,kind:`headphone`,fromBack:7.398},{side:1,kind:`hdmi`,fromBack:2.78},{side:1,kind:`usb-c`,fromBack:4.627},{side:1,kind:`sd`,fromBack:7.08}],D_={...C_,id:`laptop.macbook-pro-14`,label:`MacBook Pro 14-inch`,width:31.26,depth:22.12,height:1.55,baseHeight:1.113,keyboard:{fromBack:1.98,margin:.325},trackpad:{width:12.883,depth:8.044,fromFront:.578,radius:.525},scoop:{width:5.449,depth:.25,height:.389},grille:{inner:14.056,outer:15.45},hinge:{width:23.68,depth:.463},lid:{...C_.lid,thickness:.392},display:{px:[3024,1964],ppi:254},ports:E_},O_={[D_.id]:D_,[T_.id]:T_}})),A_=r({LAPTOP_FINISHES:()=>x_,LAPTOP_SPECS:()=>O_,MACBOOK_PRO_14:()=>D_,MACBOOK_PRO_16:()=>T_,buildLaptop:()=>o_,laptop:()=>j_}),j_,M_=n((()=>{b_(),S_(),k_(),j_={type:`laptop`,specs:O_,finishes:x_,build:o_}}));function N_(){let e=new Yc({color:328966,roughness:.9,transparent:!0,depthWrite:!1});return{gap:new Yc({color:394759,roughness:.8}),socket:new Yc({color:2763309,roughness:.6}),vent:e,pad:new Yc({color:657931,roughness:.6}),cameraHousing:P_(855312),cameraLens:P_(328967),cameraWindow:P_(724260),cameraPupil:P_(0)}}function P_(e){return new Xc({color:e,roughness:.6,specularIntensity:0,clearcoat:1,clearcoatRoughness:.02})}function F_(e,t){Vh(e,t),e.frame.anisotropy=0}function I_(e,t,n=`high`){let r=Fh[n],i=Bh(t),a=N_();F_(i,t);let o=V_(e.vents);o?a.vent.alphaMap=o:a.vent.opacity=.35;let s=new Oo;R_(e,i,a,s,r);let{barrel:c}=e.stand,l=new Oo;l.position.set(0,c.y,c.z),s.add(l);let u=new Oo;u.position.set(0,e.hinge.drop,e.hinge.behind),l.add(u);let{displayMesh:d,aspect:f}=L_(e,i,a,u,r),p=e=>{l.rotation.x=-e*H_};p(0);let m=Hh(d,f,i);return{group:s,screens:[m],bounds:new Zo().setFromObject(s),params:{tilt:{min:-5,max:25,default:0,unit:`deg`,label:`Tilt`}},restsOnFloor:!0,setParam(e,t){e===`tilt`&&p(t)},setFinish:e=>F_(i,e),setGlare:(e,t)=>{m.setGlare(e,t);for(let e of[a.cameraHousing,a.cameraLens,a.cameraWindow,a.cameraPupil])e.clearcoat=i.glass.clearcoat},dispose:()=>{a.vent.alphaMap?.dispose(),Dh(s)}}}function L_(e,t,n,r,i){let{width:a,height:o,depth:s,radius:c,glass:l}=e.panel,u=-l-.03,d=-s,f=[[.04,u],[.012,u-.012],[0,u-.04],[0,d+.04],[.012,d+.012],[.04,d]];Q(r,Lh({width:a,height:o,radius:c,exponent:2,segments:i.corner,profile:f}),t.frame),Q(r,Nh(a-.08,o-.08,c-.04,2,i),n.gap,{z:u}),Q(r,Mh({width:a,height:o,depth:l,radius:c,edge:.02,quality:i}),t.glass,{z:-l/2});let p=a-2*e.bezel,m=p*e.display.px[1]/e.display.px[0],h=Q(r,Th(Nh(p,m,.05,2,i)),t.display,{z:$}),g=o/2-e.cameraFromTop;Q(r,new fc(.22,i.round),n.cameraHousing,{y:g,z:$*2}),Q(r,new fc(.17,i.round),n.cameraLens,{y:g,z:$*3}),Q(r,new fc(.15,i.round),n.cameraWindow,{y:g,z:$*4}),Q(r,new fc(.06,i.round),n.cameraPupil,{y:g,z:$*5}),Q(r,new fc(.05,i.round),n.cameraHousing,{x:.73,y:g,z:$*2});let{vents:_}=e,v=-_.centre,y=new zc(_.length,_.band);n.vent.alphaMap&&n.vent.alphaMap.repeat.set(_.length/(_.pitch*2),1),Q(r,y,n.vent,{y:o/2+$,z:v,rx:-Math.PI/2}),Q(r,y,n.vent,{y:-o/2-$,z:v,rx:Math.PI/2});let b=new Oo;b.position.z=d,b.rotation.y=Math.PI,r.add(b),Q(b,Nh(a-.08,o-.08,c-.04,2,i),t.frame),e.branding!==!1&&Q(b,Qh(e.logo.height),t.logo,{y:e.logo.raise,z:$});let{power:x}=e;Q(b,new Bc(x.radius-.05,x.radius,i.round),n.gap,{y:-x.drop,z:$}),Q(b,new fc(.54,i.round),n.gap,{y:-x.drop,z:$}),Q(b,new fc(.36,i.round),n.socket,{y:-x.drop,z:$*2});let{ports:S}=e,C=Nh(S.width,S.height,S.width/2,2,i),w=Nh(.07,S.height*.62,.035,2,i);for(let e of S.x)Q(b,C,n.gap,{x:-e,y:-S.drop,z:$}),Q(b,w,n.socket,{x:-e,y:-S.drop,z:$*2});let{barrel:T}=e.stand,E=e.hinge.behind-s;return Q(r,Mh({width:T.bracket-.06,height:1.3,depth:E+.3,radius:.3,edge:.05,quality:i}),t.frame,{y:-e.hinge.drop,z:d-E/2+.15}),{displayMesh:h,aspect:p/m}}function R_(e,t,n,r,i){let a=e.stand,{foot:o}=a,s=o.pad+o.thickness;Q(r,Mh({width:a.width,height:o.depth,depth:o.thickness,radius:o.radius,edge:.06,quality:i}),t.frame,{y:o.pad+o.thickness/2,rx:-Math.PI/2}),Q(r,Mh({width:a.width-.38,height:o.depth-.46,depth:o.pad+.05,radius:o.radius-.2,edge:.02,quality:i}),n.pad,{y:(o.pad+.05)/2,rx:-Math.PI/2});let c=a.lean*H_,l=new J(Math.sin(c),Math.cos(c)),u=new J(l.y,-l.x),d=new J(a.backZ,s),f=z_(d,l,u,a.sheet,a.fillet.front,a.fillet.back,s,i.corner),p=new Ic(f,{depth:a.width,bevelEnabled:!1,curveSegments:i.corner});p.translate(0,0,-a.width/2),p.rotateY(-Math.PI/2),Q(r,p,t.frame);let m=new J(a.barrel.z,a.barrel.y).clone().sub(d).dot(l)-2,h=(a.hole.centreY-s)/Math.cos(c)-2,g=kh(a.width,m,.02,2,2);g.holes.push(B_(a.hole.width,a.hole.length,h-m/2));let _=new Ic(g,{depth:a.sheet,bevelEnabled:!1,curveSegments:i.corner});_.translate(0,m/2+2,0);let v=Q(r,_,t.frame);v.rotation.x=c,v.position.set(0,d.y,d.x);let{barrel:y}=a,b=(a.width-y.bracket)/2-.03,x=new pc(y.radius,y.radius,b,i.round,1);x.rotateZ(Math.PI/2);for(let e of[-1,1])Q(r,x,t.frame,{x:e*(a.width/2-b/2),y:y.y,z:y.z});let S=new pc(y.radius-.02,y.radius-.02,y.bracket,i.round,1);S.rotateZ(Math.PI/2),Q(r,S,t.frame,{y:y.y,z:y.z});let C=new pc(y.radius-.05,y.radius-.05,a.width-.1,i.round,1);C.rotateZ(Math.PI/2),Q(r,C,n.gap,{y:y.y,z:y.z})}function z_(e,t,n,r,i,a,o,s){let c=n=>e.clone().addScaledVector(t,n),l=i=>e.clone().addScaledVector(n,r).addScaledVector(t,i),u=(e,r,i)=>{let a=n.clone().multiplyScalar(r),c=(o+i-e.y-a.y*i)/t.y,l=e.clone().addScaledVector(t,c).addScaledVector(a,i),u=l.clone().addScaledVector(a,-i),d=new J(l.x,o),f=Math.atan2(u.y-l.y,u.x-l.x),p=Math.atan2(d.y-l.y,d.x-l.x)-f;p>Math.PI&&(p-=2*Math.PI),p<-Math.PI&&(p+=2*Math.PI);let m=[];for(let e=0;e<=s;e++){let t=f+p*e/s;m.push(new J(l.x+i*Math.cos(t),l.y+i*Math.sin(t)))}return m},d=u(l(0),1,i),f=u(c(0),-1,a),p=o-.25,m=[c(3),l(3),...d,new J(d[d.length-1].x,p),new J(f[f.length-1].x,p),...f.slice().reverse()];return Fc.isClockWise(m)&&m.reverse(),new Nc(m)}function B_(e,t,n){let r=e/2,i=Math.max(0,t/2-r),a=new Mc;return a.absarc(0,n+i,r,0,Math.PI,!1),a.absarc(0,n-i,r,Math.PI,2*Math.PI,!1),a.closePath(),a}function V_(e){if(typeof document>`u`)return null;let t=Math.round(e.pitch*2*400),n=Math.round(e.band*400),r=document.createElement(`canvas`);r.width=t,r.height=n;let i=r.getContext(`2d`);if(!i)return null;i.fillStyle=`#000`,i.fillRect(0,0,t,n),i.fillStyle=`#fff`;let a=n/e.rows,o=t/2,s=e.hole/2*400;for(let t=0;t<e.rows;t++)for(let e=-1;e<=2;e++)i.beginPath(),i.arc(e*o+(t%2?o/2:0),(t+.5)*a,s,0,Math.PI*2),i.fill();let c=new sc(r);return c.wrapS=Yr,c.wrapT=Xr,c.anisotropy=8,c}var H_,U_=n((()=>{Sp(),Oh(),tg(),Uh(),Ih(),jh(),zh(),Eh(),H_=Math.PI/180})),W_,G_=n((()=>{W_={silver:{label:`Silver`,frame:`#d3d4d6`,back:`#d3d4d6`,frameRoughness:.42,backMaterial:`metal`}}})),K_,q_,J_=n((()=>{K_={id:`monitor.studio-display`,label:`Studio Display`,finishes:[`silver`],panel:{width:62.3,height:36.2,depth:1.97,radius:.5,glass:.1},display:{px:[5120,2880],ppi:218},bezel:1.37,cameraFromTop:.53,logo:{height:8.35,raise:5.04},power:{drop:15.34,radius:1.52},ports:{x:[17.25,18.75,20.25,21.76],drop:15.34,width:.31,height:.89},vents:{length:60.9,band:.83,centre:1.31,hole:.16,pitch:.19,rows:5},stand:{width:15.2,foot:{depth:16.8,thickness:.56,radius:1.2,pad:.1},sheet:.7,lean:13.1,backZ:-6.09,fillet:{front:1,back:.6},hole:{width:4,length:6.26,centreY:13.63},barrel:{radius:1.05,y:20.61,z:-.39,bracket:5.34}},hinge:{drop:9.04,behind:3.15}},q_={[K_.id]:K_}})),Y_=r({MONITOR_FINISHES:()=>W_,MONITOR_SPECS:()=>q_,STUDIO_DISPLAY:()=>K_,buildMonitor:()=>I_,monitor:()=>X_}),X_,Z_=n((()=>{U_(),G_(),J_(),X_={type:`monitor`,specs:q_,finishes:W_,build:I_}}));function Q_({width:e,thickness:t,length:n,curl:r,direction:i,segments:a=24}){let o=i,s=new Sc([new Y(0,0,0),new Y(0,o*n*.35,-t*.2),new Y(0,o*n*.7,-n*r*.35),new Y(0,o*n,-n*r)]),c=t/2,l=new Nc;return l.moveTo(-e/2+c,-c),l.lineTo(e/2-c,-c),l.absarc(e/2-c,0,c,-Math.PI/2,Math.PI/2,!1),l.lineTo(-e/2+c,c),l.absarc(-e/2+c,0,c,Math.PI/2,3*Math.PI/2,!1),new Ic(l,{steps:a,bevelEnabled:!1,extrudePath:s})}var $_=n((()=>{Sp()})),ev=r({WATCH_FINISHES:()=>av,WATCH_SERIES_12_42:()=>rv,WATCH_SERIES_12_46:()=>nv,WATCH_SPECS:()=>ov,WATCH_ULTRA_4:()=>iv,buildWatch:()=>tv,watch:()=>sv});function tv(e,t,n=`high`){let r=Fh[n],{width:i,height:a,depth:o,bezel:s}=e,{radius:c,exponent:l}=e.corner,u=Bh(t),d=new Oo;Q(d,Mh({width:i,height:a,depth:o,radius:c,exponent:l,edge:e.edgeRadius,quality:r}),u.frame);let f=new Oo;f.position.z=o/2,d.add(f);let p=e.crystal===`flat`?.2:.05,m=i-2*s,h=a-2*s;Q(f,Nh(i-2*p,a-2*p,c-p,l,r),u.bezel,{z:$});let g=Q(f,Th(Nh(m,h,c-s,l,r)),u.display,{z:$*2}),_=e.crown;Q(d,new pc(_.radius,_.radius,_.depth,r.round),u.frame,{x:i/2+_.depth/2-.04,y:_.y,rz:Math.PI/2}),Q(d,new pc(_.radius*.55,_.radius*.55,_.depth+.04,r.round),u.pupil,{x:i/2+_.depth/2-.02,y:_.y,rz:Math.PI/2}),Q(d,Ph(e.sideButton.length,.18,.16,`y`,r),u.frame,{x:i/2+.02,y:e.sideButton.y,ry:Math.PI/2}),e.actionButton&&Q(d,Ph(e.actionButton.length,.3,.26,`y`,r),u.accent,{x:-i/2-.02,y:e.actionButton.y,ry:Math.PI/2});let v=new Oo;v.position.z=-o/2,v.rotation.y=Math.PI,d.add(v),Q(v,new fc(Math.min(i,a)*.42,r.round),u.back,{z:$}),e.branding!==!1&&Q(v,Qh(e.logoHeight),u.logo,{y:Math.min(i,a)*.22,z:$*2});let y=e.band;for(let e of[1,-1])Q(d,Q_({width:y.width,thickness:y.thickness,length:y.length*.55,curl:1.1,direction:e}),u.band,{y:e*(a/2-.15),z:-o*.15});let b=Hh(g,m/h,u);return{group:d,screens:[b],bounds:new Zo().setFromObject(d),params:{},restsOnFloor:!1,setParam(){},setFinish:e=>Vh(u,e),setGlare:(e,t)=>b.setGlare(e,t),dispose:()=>Dh(d)}}var nv,rv,iv,av,ov,sv,cv=n((()=>{Sp(),Oh(),tg(),Uh(),Ih(),$_(),Eh(),nv={id:`watch.series-12-46`,label:`Apple Watch Series 12 (46 mm)`,finishes:[`jet-black`,`space-gray`,`light-gold`,`dark-bronze`,`natural-titanium`,`radiant-gold`,`pearl-white`,`night-blue`],width:4,height:4.6,depth:.97,corner:{radius:1.25,exponent:2.8},edgeRadius:.22,display:{px:[416,496],ppi:326},bezel:.28,crystal:`domed`,crown:{radius:.32,depth:.22,y:.75},sideButton:{length:1.1,y:-.55},band:{width:2.2,thickness:.3,length:7.5},logoHeight:.9},rv={...nv,id:`watch.series-12-42`,label:`Apple Watch Series 12 (42 mm)`,width:3.7,height:4.2,corner:{radius:1.15,exponent:2.8},display:{px:[374,446],ppi:326},crown:{radius:.3,depth:.2,y:.65},sideButton:{length:1,y:-.5},band:{width:2,thickness:.28,length:7},logoHeight:.8},iv={id:`watch.ultra-4`,label:`Apple Watch Ultra 4`,finishes:[`natural-titanium`,`black-titanium`],width:4.4,height:4.9,depth:1.2,corner:{radius:1,exponent:2.4},edgeRadius:.12,display:{px:[422,514],ppi:326},bezel:.36,crystal:`flat`,crown:{radius:.36,depth:.28,y:.7},sideButton:{length:1.2,y:-.6},actionButton:{length:1.3,y:.3},band:{width:2.4,thickness:.34,length:8},logoHeight:1},av={"jet-black":{label:`Black`,frame:`#1c1c1e`,back:`#141416`,frameRoughness:.12,backMaterial:`ceramic`},"space-gray":{label:`Space Gray`,frame:`#6e6e73`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`},"light-gold":{label:`Light Gold`,frame:`#d9c9a9`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`},"dark-bronze":{label:`Dark Bronze`,frame:`#5b4738`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`},"natural-titanium":{label:`Natural Titanium`,frame:`#a19d95`,back:`#141416`,frameRoughness:.34,backMaterial:`ceramic`,accent:`#ff7a1a`},"radiant-gold":{label:`Radiant Gold`,frame:`#c9a96c`,back:`#141416`,frameRoughness:.22,backMaterial:`ceramic`},"black-titanium":{label:`Black Titanium`,frame:`#2b2b2e`,back:`#141416`,frameRoughness:.3,backMaterial:`ceramic`,accent:`#ff7a1a`},"pearl-white":{label:`Pearl White`,frame:`#ecebe5`,back:`#ecebe5`,frameRoughness:.12,backMaterial:`ceramic`},"night-blue":{label:`Night Blue`,frame:`#1f2a44`,back:`#1f2a44`,frameRoughness:.12,backMaterial:`ceramic`}},ov={[nv.id]:nv,[rv.id]:rv,[iv.id]:iv},sv={type:`watch`,specs:ov,finishes:av,build:tv}}));function lv(e){let t=mv.get(e);return t||(t=pv[e](),mv.set(e,t)),t}function uv(e){let t=e.split(`.`)[0];if(!(t in pv))throw Error(`Unknown device spec '${e}'`);return t}function dv(e,t,n){if(typeof n!=`string`)return n;let r=e.finishes[n]??e.finishes[t.finishes[0]??``];if(!r)throw Error(`Device '${t.id}' has no finishes`);return r}async function fv(e,t,n=`high`){let r=await lv(uv(e)),i=r.specs[e];if(!i)throw Error(`Unknown device spec '${e}'`);return _h(r.build(i,dv(r,i,t),n))}var pv,mv,hv=n((()=>{wh(),pv={phone:()=>Promise.resolve().then(()=>(Sg(),bg)).then(e=>e.phone),tablet:()=>Promise.resolve().then(()=>(Hg(),Bg)).then(e=>e.tablet),laptop:()=>Promise.resolve().then(()=>(M_(),A_)).then(e=>e.laptop),monitor:()=>Promise.resolve().then(()=>(Z_(),Y_)).then(e=>e.monitor),watch:()=>Promise.resolve().then(()=>(cv(),ev)).then(e=>e.watch)},mv=new Map}));function gv(e,t){try{return new URL(e,t).href}catch{return e}}async function _v(e,t){let n=new Image;n.crossOrigin=`anonymous`,n.src=e,await n.decode();let r=ah(new qa(n),t);return r.needsUpdate=!0,{texture:r,aspect:n.naturalWidth/n.naturalHeight,dispose:()=>r.dispose()}}async function vv(e,t,n){let r=document.createElement(`video`);r.crossOrigin=`anonymous`,r.muted=!0,r.playsInline=!0,r.preload=`auto`,r.src=e,await new Promise((t,n)=>{r.addEventListener(`loadedmetadata`,()=>t(),{once:!0}),r.addEventListener(`error`,()=>n(Error(`Video failed: ${e}`)),{once:!0})});let i=th(r,$m(n.video)),a=ah(new ac(r),t);return{texture:a,aspect:r.videoWidth/r.videoHeight,duration:r.duration,dispose(){i(),r.pause(),r.removeAttribute(`src`),r.load(),a.dispose()}}}function yv(e,t,n){return{buildDevice:e=>fv(e.spec,e.finish,t),async resolveScreen(t,r,{maxAnisotropy:i,screenAspect:a}){let o=t.media;if(n)return t.poster?_v(t.poster,i).catch(()=>sh(a,i)):o?.source===`url`&&o.kind===`image`?_v(gv(o.url,e),i).catch(()=>null):sh(a,i);if(!o)return sh(a,i);if(o.source===`data`)return _v(o.dataUrl,i);if(o.source===`url`){let n=gv(o.url,e);return o.kind===`video`?vv(n,i,t):_v(n,i)}return sh(a,i)},async resolveBackdrop(t,{maxAnisotropy:r}){return n||t.kind!==`image`||t.source===`idb`?null:_v(t.source===`data`?t.dataUrl:gv(t.url,e),r)}}}var bv=n((()=>{Sp(),hv(),mh()})),xv=r({mount:()=>Cv});function Sv(e,t){let n=document.createElement(`div`),r=e===`dark`?`#f1f1f3`:`#17181b`;return n.style.cssText=`position:absolute;inset:0;display:grid;place-items:center;background:${t&&t!==`transparent`?t:e===`dark`?`#0d0e11`:`#f4f4f2`};transition:opacity .3s`,n.innerHTML=`<div style="width:28px;height:28px;border-radius:50%;border:2px solid ${r}33;border-top-color:${r};animation:om-spin .8s linear infinite"></div><style>@keyframes om-spin{to{transform:rotate(360deg)}}</style>`,n}async function Cv(e,t,n){let r=await fetch(n,{credentials:`omit`});if(!r.ok)throw Error(`Could not load ${n} (${r.status})`);let i=Zt(await r.json()),a=t.backgroundColor;a&&(i.scene.backdrop=a===`transparent`?{...i.scene.backdrop,kind:`transparent`}:{...i.scene.backdrop,kind:`solid`,color:a});let o=document.createElement(`div`);o.style.cssText=`position:absolute;inset:0;`;let s=document.createElement(`canvas`);s.style.cssText=`display:block;width:100%;height:100%;`,s.setAttribute(`aria-label`,i.name),o.append(s),e.append(o);let c=t.loader?Sv(t.theme,a):null;c&&e.append(c);let l=qm({canvas:s,quality:`embed`}),u=()=>l.setSize(e.clientWidth||1,e.clientHeight||1),d=new ResizeObserver(u);d.observe(e);let f=t.progressive?yv(n,`low`,!0):yv(n,`high`,!1);await l.loadScene(i.scene,f),u();let p=fh({engine:l,element:e,getDoc:()=>i,overrides:t.overrides});p.start(),c&&(c.style.opacity=`0`,setTimeout(()=>c.remove(),350));let m=!1;return t.progressive&&wv(()=>{m||l.loadScene(i.scene,yv(n,`high`,!1))}),{dispose(){m=!0,d.disconnect(),p.dispose(),l.dispose(),o.remove(),c?.remove()}}}var wv,Tv=n((()=>{tn(),mh(),bv(),wv=e=>{let t=window;t.requestIdleCallback?t.requestIdleCallback(e,{timeout:2e3}):setTimeout(e,300)}})),Ev=`mockup-embed`,Dv=class extends HTMLElement{static get observedAttributes(){return[`src`,`mockup-id`,`aspect-ratio`,`width`,`height`,`poster`,`theme`]}player=null;observer=null;poster=null;loading=!1;connectedCallback(){this.style.display||=`block`,this.style.position||=`relative`,this.style.overflow=`hidden`,this.applySize(),this.showPoster();let e=o(this);e.lowBandwidth||(e.overrides.trigger===`load`||this.getAttribute(`trigger`)===`load`?this.load():(this.observer=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(this.observer?.disconnect(),this.observer=null,this.load())},{rootMargin:`200px`}),this.observer.observe(this)))}disconnectedCallback(){this.observer?.disconnect(),this.observer=null,this.player?.dispose(),this.player=null}attributeChangedCallback(e){(e===`aspect-ratio`||e===`width`||e===`height`)&&this.applySize(),e===`poster`&&this.showPoster()}applySize(){let e=this.getAttribute(`width`),t=this.getAttribute(`height`),n=this.getAttribute(`aspect-ratio`),r=e=>/^\d+(\.\d+)?$/.test(e)?`${e}px`:e;e&&(this.style.width=r(e)),t&&(this.style.height=r(t)),n&&!t&&(this.style.aspectRatio=n),!e&&!this.style.width&&(this.style.width=`100%`),n||t||this.style.height||(this.style.aspectRatio=`16 / 9`)}showPoster(){let e=this.getAttribute(`poster`);e&&(this.poster||(this.poster=document.createElement(`img`),this.poster.alt=``,this.poster.style.cssText=`position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:opacity .4s`,this.prepend(this.poster)),this.poster.src=e)}async load(){if(this.loading||this.player)return;this.loading=!0;let e=o(this),t=s(e);if(!t)console.warn(`<${Ev}> needs a src or mockup-id attribute.`);else try{let n=await Promise.resolve().then(()=>(Tv(),xv));this.player=await n.mount(this,e,t),this.poster&&(this.poster.style.opacity=`0`,setTimeout(()=>this.poster?.remove(),450))}catch(e){console.error(`<${Ev}> failed to load`,e)}finally{this.loading=!1}}};return typeof customElements<`u`&&!customElements.get(Ev)&&customElements.define(Ev,Dv),e.MockupEmbed=Dv,e})({});
|