@fleox/agent3d 0.2.0 → 0.2.1

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.
Files changed (81) hide show
  1. package/README.md +350 -126
  2. package/changelog.json +12 -0
  3. package/dist/agent/agent3d.mjs +16 -16
  4. package/dist/agent/chunks/{cdp-CaKRRzMX.mjs → cdp-Bdtm4fBN.mjs} +3 -2
  5. package/dist/agent/chunks/{imageCodec-BpDU9Lsq.mjs → imageCodec-Dz9PFxi9.mjs} +1 -1
  6. package/dist/agent/chunks/{package-Ck7_Nszg.mjs → package-BOIyp_2B.mjs} +1 -1
  7. package/dist/agent/chunks/{render-Cbuhz5uW.mjs → render-CN4mgGLQ.mjs} +2 -2
  8. package/dist/runtime/agent3d-runtime.js +23 -23
  9. package/dist/runtime/agent3d-runtime.single.js +2 -2
  10. package/dist/runtime/chunks/{BufferGeometryUtils-Re3wQkXp.js → BufferGeometryUtils-XmME4f7Z.js} +1 -1
  11. package/dist/runtime/chunks/{EXRLoader-Bzm84si5.js → EXRLoader-CBdIpBMT.js} +1 -1
  12. package/dist/runtime/chunks/{FontLoader-BocwqK8V.js → FontLoader-dVu9WH2X.js} +1 -1
  13. package/dist/runtime/chunks/GLTFLoader-Z9Inv-Xm.js +1 -0
  14. package/dist/runtime/chunks/{GroundedSkybox-esvlRCO0.js → GroundedSkybox-g1ASZWNu.js} +1 -1
  15. package/dist/runtime/chunks/{HDRLoader-DHrHp8fs.js → HDRLoader-DBOMWa7O.js} +2 -2
  16. package/dist/{studio/assets/OrbitControls-fcOgB96a.js → runtime/chunks/OrbitControls-BIpWXK4x.js} +1 -1
  17. package/dist/runtime/chunks/{RectAreaLightUniformsLib-_mZ62yWn.js → RectAreaLightUniformsLib-4ZzgX9vp.js} +1 -1
  18. package/dist/runtime/chunks/{RoomEnvironment-CL4UR6ZW.js → RoomEnvironment-CXgfLJdO.js} +1 -1
  19. package/dist/runtime/chunks/{RoundedBoxGeometry-x-ot8ZSh.js → RoundedBoxGeometry-BViRogcJ.js} +1 -1
  20. package/dist/runtime/chunks/{SVGLoader-hRF0EwD-.js → SVGLoader-CV0U1EIF.js} +1 -1
  21. package/dist/runtime/chunks/{Sky-BrLN9Fk5.js → Sky-DGJXlPb_.js} +1 -1
  22. package/dist/runtime/chunks/{extrude-m04mghOS.js → extrude-D6WnITQq.js} +1 -1
  23. package/dist/runtime/chunks/{game-BoG2S6g4.js → game-BoEiyZrL.js} +3 -3
  24. package/dist/runtime/chunks/generators-D5JUo0jp.js +331 -0
  25. package/dist/runtime/chunks/{materials-C2uffFEd.js → materials-Dn-bYrZd.js} +5 -5
  26. package/dist/runtime/chunks/{model-D-4xZz21.js → model-BCVF3QzB.js} +1 -1
  27. package/dist/runtime/chunks/{params-DdApDOBw.js → params-C2uoUDJ0.js} +1 -1
  28. package/dist/runtime/chunks/{physicsHost-DPaVdM0R.js → physicsHost-ChPgysMQ.js} +1 -1
  29. package/dist/runtime/chunks/{postfx-BpBXjLX3.js → postfx-UgKCbmZs.js} +29 -29
  30. package/dist/{studio/assets/shaders-BEznGIct.js → runtime/chunks/shaders-Dw6zHdu_.js} +3 -3
  31. package/dist/runtime/chunks/svg-CmlFY_8O.js +1 -0
  32. package/dist/runtime/chunks/{text-CmkU-b0C.js → text-D1EQpdSU.js} +2 -2
  33. package/dist/runtime/chunks/{three.module-W4hp4qHb.js → three.module-DnaBiDAJ.js} +31 -31
  34. package/dist/runtime/chunks/{toon-B5Jhf37V.js → toon-BsvVk_nK.js} +1 -1
  35. package/dist/runtime/chunks/{util-THUewKBk.js → util-CyaW1fcW.js} +1 -1
  36. package/dist/studio/assets/{BufferGeometryUtils-wW9vV1l2.js → BufferGeometryUtils-CAlXAboW.js} +1 -1
  37. package/dist/studio/assets/{EXRLoader-f8U8jnlr.js → EXRLoader-BKkzlNd8.js} +1 -1
  38. package/dist/studio/assets/{FontLoader-9sHudKzD.js → FontLoader-Bzjx8mXt.js} +2 -2
  39. package/dist/studio/assets/GLTFLoader-1Zd9N406.js +1 -0
  40. package/dist/studio/assets/GroundedSkybox-BEMqNCBD.js +1 -0
  41. package/dist/studio/assets/{HDRLoader-CkQyrTWY.js → HDRLoader-DxB0kxPH.js} +2 -2
  42. package/dist/{runtime/chunks/OrbitControls-sjN2MF0e.js → studio/assets/OrbitControls-MlE9XiCg.js} +1 -1
  43. package/dist/studio/assets/{RectAreaLightUniformsLib-CZHWO9xf.js → RectAreaLightUniformsLib-ClHrtYY6.js} +1 -1
  44. package/dist/studio/assets/{RoomEnvironment-BsISzuCp.js → RoomEnvironment-MJ-jIEC8.js} +1 -1
  45. package/dist/studio/assets/{SVGLoader-BIkQDT66.js → SVGLoader-CIYl0nEy.js} +1 -1
  46. package/dist/studio/assets/{Sky-C282PFL1.js → Sky-DNMfpp92.js} +1 -1
  47. package/dist/studio/assets/{camera-BhKdE9ej.js → camera-7sEn13L-.js} +2 -2
  48. package/dist/studio/assets/editor-CnbvVkhU.js +53 -0
  49. package/dist/studio/assets/{extrude-CnayHczh.js → extrude-9bG8hr2C.js} +1 -1
  50. package/dist/studio/assets/{game-Dv5s4eMN.js → game-B04KGAK0.js} +3 -3
  51. package/dist/studio/assets/generators-LSni1Yfc.js +331 -0
  52. package/dist/studio/assets/{index-Dh-2Y34U.js → index-3LL5NEIH.js} +8 -8
  53. package/dist/studio/assets/{model-XZSP52pV.js → model-CNddhwmA.js} +2 -2
  54. package/dist/studio/assets/{physicsHost-C84FddIe.js → physicsHost-hMU_SDiX.js} +1 -1
  55. package/dist/studio/assets/{postfx-BWWXb8i8.js → postfx-BcCZS0Bq.js} +27 -27
  56. package/dist/studio/assets/runtime-DY_KqD1x.js +572 -0
  57. package/dist/{runtime/chunks/shaders-CmeJRio1.js → studio/assets/shaders-BhMCstyv.js} +3 -3
  58. package/dist/studio/assets/svg-CNKK-h7H.js +2 -0
  59. package/dist/studio/assets/{text-5DsJJHcj.js → text-BSPI7dk1.js} +3 -3
  60. package/dist/studio/assets/{three.module-ByMn_ZTv.js → three.module-CnI50X0U.js} +31 -31
  61. package/dist/studio/index.html +3 -3
  62. package/package.json +1 -1
  63. package/plugin/.claude-plugin/plugin.json +2 -2
  64. package/plugin/skills/agent3d-assets/SKILL.md +24 -24
  65. package/plugin/skills/agent3d-create/SKILL.md +20 -20
  66. package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
  67. package/plugin/skills/agent3d-create/references/recipes.md +6 -6
  68. package/plugin/skills/agent3d-edit/SKILL.md +22 -22
  69. package/plugin/skills/agent3d-edit/references/patch-ops.md +2 -2
  70. package/plugin/skills/agent3d-game/SKILL.md +7 -7
  71. package/plugin/skills/agent3d-publish/SKILL.md +21 -21
  72. package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
  73. package/dist/runtime/chunks/GLTFLoader-DHp1wv6J.js +0 -1
  74. package/dist/runtime/chunks/generators-OHhFCc2E.js +0 -331
  75. package/dist/runtime/chunks/svg-B3nZaQFD.js +0 -1
  76. package/dist/studio/assets/GLTFLoader-C3C_3K62.js +0 -1
  77. package/dist/studio/assets/GroundedSkybox-BTqmv4fv.js +0 -1
  78. package/dist/studio/assets/editor-BgY_RoRd.js +0 -1
  79. package/dist/studio/assets/generators-DVX3bAxe.js +0 -331
  80. package/dist/studio/assets/runtime-k_MFerbJ.js +0 -572
  81. package/dist/studio/assets/svg-DT8kx37i.js +0 -2
@@ -1,572 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./shaders-BEznGIct.js","./three.module-ByMn_ZTv.js","./generators-DVX3bAxe.js","./camera-BhKdE9ej.js","./index-Dh-2Y34U.js","./index-BQT0otii.css","./BufferGeometryUtils-wW9vV1l2.js","./RectAreaLightUniformsLib-CZHWO9xf.js","./Sky-C282PFL1.js","./HDRLoader-CkQyrTWY.js","./EXRLoader-f8U8jnlr.js","./GroundedSkybox-BTqmv4fv.js","./RoomEnvironment-BsISzuCp.js","./text-5DsJJHcj.js","./extrude-CnayHczh.js","./svg-DT8kx37i.js","./model-XZSP52pV.js","./game-Dv5s4eMN.js","./postfx-BWWXb8i8.js"])))=>i.map(i=>d[i]);
2
- import{C as e,D as t,E as n,O as r,T as i,_ as a,f as o,h as s,k as c,m as l,p as u,t as d,v as f,w as p,x as m,y as h}from"./index-Dh-2Y34U.js";import{$t as g,An as _,B as v,Ct as y,D as ee,Dn as b,Dt as x,E as S,Et as te,F as ne,Ft as re,G as ie,Ht as ae,It as oe,K as se,Ln as C,Lt as ce,M as w,N as le,Nn as ue,On as de,Ot as fe,P as T,Pn as pe,Rn as E,S as D,St as O,Tn as me,Tt as he,U as ge,Un as _e,V as ve,Vn as ye,Vt as k,W as be,Wt as xe,X as Se,Yt as Ce,_ as we,_n as Te,b as Ee,cn as De,en as Oe,f as A,ft as ke,g as Ae,gn as je,h as Me,hn as Ne,i as Pe,in as j,kt as M,l as Fe,ln as Ie,lt as Le,m as Re,n as ze,nn as Be,nt as Ve,o as He,on as Ue,q as We,qt as N,r as Ge,rn as Ke,sn as P,t as qe,ut as Je,v as Ye,vt as Xe,w as Ze,wn as Qe,wt as $e,xt as F,y as et,yn as I,z as tt}from"./three.module-ByMn_ZTv.js";import{C as nt,S as L,_ as rt,b as it,c as at,d as R,f as z,g as ot,h as st,i as ct,m as lt,n as ut,p as dt,r as ft,s as pt,t as mt,v as B,x as V,y as H}from"./camera-BhKdE9ej.js";function ht(e){return e.endsWith(`/`)?e:e+`/`}function gt(e){let t=ht(e.assetBase??`./`),n=ht(e.libraryBase??t+`assets/library/`),r=e.assetUrls??{};return e=>{if(r[e])return r[e];if(/^(https?:|data:|blob:|\/)/.test(e))return e;if(e.startsWith(`library:`)){let t=e.slice(8);return t.startsWith(`fonts/`)&&!/\.json$/.test(t)&&(t+=`.typeface.json`),r[`library:`+t]?r[`library:`+t]:n+t}return t+e.replace(/^\.\//,``)}}var _t=new Map;function vt(e){let t=_t.get(e);return t||(t=fetch(e).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status} for ${e}`);return t.text()}),t.catch(()=>_t.delete(e)),_t.set(e,t)),t}async function yt(e){return JSON.parse(await vt(e))}var bt=new Map;function xt(e){let t=bt.get(e);return t||(t=s(()=>import(`./three.module-ByMn_ZTv.js`).then(e=>e.a).then(t=>new Promise((n,r)=>{new t.TextureLoader().load(e,n,void 0,()=>r(Error(`Cannot load texture ${e}`)))})),[],import.meta.url),t.catch(()=>bt.delete(e)),bt.set(e,t)),t.then(e=>{let t=e.clone();return t.needsUpdate=!0,t})}var St=(e,t)=>{try{return e?e.color(t).clone():new D(t)}catch{return new D(t)}};function Ct(e,t,n){let r=t??{},i=t=>{let n=e.params.find(e=>e.name===t);if(!n)throw Error(`${e.id}: no catalog param "${t}"`);return n},a=e=>{let t=i(e),n=r[e];return n===void 0?t.default:n},o=(e,t)=>{let n=i(e);return n.min!==void 0&&t<n.min&&(t=n.min),n.max!==void 0&&t>n.max&&(t=n.max),t},s=e=>{let t=a(e);return typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isFinite(t)||(t=i(e).default),o(e,typeof t==`number`?t:0)};return{num:s,numOrNull:e=>r[e]===null?null:s(e),int:e=>Math.round(s(e)),bool:e=>{let t=a(e);return typeof t==`boolean`?t:!!i(e).default},str:e=>{let t=i(e),n=a(e);return typeof n==`string`&&(!t.options||t.options.includes(n))?n:t.default},color:e=>{let t=a(e);return St(n,typeof t==`string`?t:String(i(e).default??`#ffffff`))},colors:e=>{let t=a(e);return typeof t==`string`&&(t=[t]),Array.isArray(t)&&t.length!==0||(t=i(e).default),t.map(e=>St(n,typeof e==`string`?e:`#ffffff`))},vec3:e=>{let t=a(e),n=i(e).default??[0,0,0];return Array.isArray(t)?[0,1,2].map(e=>typeof t[e]==`number`?t[e]:n[e]):[...n]},raw:e=>a(e)}}var wt=(e,t)=>{let n=e.find(e=>e.id===t);if(!n)throw Error(`unknown catalog id ${t}`);return n},Tt=(t,n,r)=>Ct(wt(e,t),n,r),Et=(e,n,r)=>Ct(wt(t,e),n,r),Dt={map:`color`,emissiveMap:`color`,normalMap:`normal`,roughnessMap:`data`,metalnessMap:`data`,aoMap:`data`,bumpMap:`data`,displacementMap:`data`,alphaMap:`data`},Ot=class{perm=new Uint16Array(512);grads=new Float32Array(512);constructor(e){let t=ct(e),n=Array.from({length:256},(e,t)=>t);for(let e=255;e>0;e--){let r=Math.floor(t.next()*(e+1));[n[e],n[r]]=[n[r],n[e]]}for(let e=0;e<512;e++)this.perm[e]=n[e&255];for(let e=0;e<256;e++){let n=t.next()*Math.PI*2;this.grads[e*2]=Math.cos(n),this.grads[e*2+1]=Math.sin(n)}}g(e,t,n,r,i,a){let o=(e%n+n)%n,s=(t%r+r)%r,c=this.perm[this.perm[o&255]+s&511]&255;return this.grads[c*2]*i+this.grads[c*2+1]*a}noise(e,t,n,r){let i=Math.floor(e),a=Math.floor(t),o=e-i,s=t-a,c=o*o*o*(o*(o*6-15)+10),l=s*s*s*(s*(s*6-15)+10),u=this.g(i,a,n,r,o,s),d=this.g(i+1,a,n,r,o-1,s),f=this.g(i,a+1,n,r,o,s-1),p=this.g(i+1,a+1,n,r,o-1,s-1);return(u+(d-u)*c+(f-u)*l+(u-d-f+p)*c*l)*1.4}fbm(e,t,n,r,i=n){let a=0,o=.5,s=0,c=n,l=i;for(let n=0;n<r;n++)a+=o*this.noise(e*c,t*l,c,l),s+=o,o*=.5,c*=2,l*=2;return a/s}},U=(e,t,n)=>{let r=Math.imul(e|0,374761393)+Math.imul(t|0,668265263)+Math.imul(n|0,2246822519)|0;return r=Math.imul(r^r>>>13,1274126177),r^=r>>>16,(r>>>0)/4294967296},W=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e||1e-6)));return r*r*(3-2*r)},G=e=>e-Math.floor(e);function kt(e,t,n,r,i){let a=e*n,o=t*n,s=Math.floor(a),c=Math.floor(o),l=9,u=9,d=0,f=0;for(let e=-1;e<=1;e++)for(let t=-1;t<=1;t++){let p=s+t,m=c+e,h=(p%n+n)%n,g=(m%n+n)%n,_=p+.5+(U(h,g,i)-.5)*r,v=m+.5+(U(h,g,i+17)-.5)*r,y=Math.hypot(_-a,v-o);y<l?(u=l,l=y,d=h,f=g):y<u&&(u=y)}return{f1:l,f2:u,cx:d,cy:f}}var At={marble(e,t){let n=e.num(`scale`),r=Math.max(1,Math.round(2*n)),i=2+e.num(`veins`)*22,a=e.num(`turbulence`);return{h(e,n){let o=t.fbm(e,n,r*2,5),s=t.fbm(e+.37,n+.71,r*2,5),c=t.fbm(e+o*.12*a,n+s*.12*a,r*3,6),l=(e*.6+n)*r+a*2.6*c,u=(1-Math.abs(Math.sin(Math.PI*l)))**i,d=t.fbm(e+.5,n,r*6,5),f=(1-Math.abs(Math.sin(Math.PI*(l*2.3+d*3))))**(i*2.5)*.45,p=(t.fbm(e,n+.3,r*2,4)*.5+.5)*.18;return Math.min(1,u*.9+f+p)}}},wood(e,t){let n=e.num(`scale`),r=e.num(`rings`),i=e.num(`grain`),a=Math.max(1,Math.round(n));return{h(e,o){let s=t.fbm(e,o,2*a,4,1*a),c=G(e*Math.round(r*n)+s*1.8),l=W(0,.7,c)*(1-W(.85,1,c)),u=t.noise(e*64*a,o*3*a,64*a,3*a)*.5+.5;return Math.min(1,Math.max(0,l*.75+u*i*.35+(s*.5+.5)*.15))}}},terrazzo(e,t,n){let r=Math.max(2,Math.round(10*e.num(`scale`)/e.num(`chipSize`))),i=e.num(`density`),a=Math.max(1,e.colors(`colors`).length-1),o=(e,o)=>{let s=kt(e,o,r,1,n);if(U(s.cx,s.cy,n+5)>i)return{m:0,idx:-1};let c=.18+U(s.cx,s.cy,n+9)*.3,l=s.f1+t.noise(e*r*4,o*r*4,r*4,r*4)*.08;return{m:1-W(c-.03,c+.01,l),idx:1+Math.floor(U(s.cx,s.cy,n+3)*a)}};return{h(e,t){return o(e,t).m},pick(e,t){let n=o(e,t);return n.m>.5?n.idx:-1}}},carbon(e,t){let n=Math.max(2,Math.round(8*e.num(`scale`)));return{h(e,r){let i=e*n,a=r*n,o=Math.floor(i),s=Math.floor(a),c=i-o,l=a-s,u=((o+s)%4+4)%4<2,d=u?l:c,f=u?e:r,p=Math.sin(Math.PI*d),m=t.noise(f*n*2,d*40,n*2,40)*.5+.5;return Math.min(1,p*(u?.85:.45)*(.75+m*.25))}}},noise(e,t){let n=Math.max(1,Math.round(4*e.num(`scale`))),r=e.int(`octaves`),i=e.num(`contrast`);return{h:(e,a)=>Math.min(1,Math.max(0,.5+t.fbm(e,a,n,r)*.5*i*1.6))}},voronoi(e,t,n){let r=Math.max(1,Math.round(8*e.num(`scale`))),i=e.num(`jitter`);return{h(e,t){let a=kt(e,t,r,i,n);return W(0,.25,a.f2-a.f1)}}},flakes(e,t,n){let r=Math.max(4,Math.round(64*e.num(`scale`))),i=e.num(`strength`);return{h(e,t){return U(Math.floor(e*r),Math.floor(t*r),n)},normal(e,t,a){let o=kt(e,t,r,1,n),s=U(o.cx,o.cy,n+1)*Math.PI*2,c=Math.sqrt(U(o.cx,o.cy,n+2))*i,l=Math.cos(s)*c,u=Math.sin(s)*c;a[0]=l,a[1]=u,a[2]=Math.sqrt(Math.max(0,1-l*l-u*u))}}},brushed(e,t){let n=Math.max(1,Math.round(e.num(`scale`))),r=e.num(`streaks`),i=Math.max(8,Math.round(300*r*n));return{h(e,r){let a=t.noise(e*2*n,r*i,2*n,i)*.5+.5,o=t.noise(e*6*n,r*i*2.5,6*n,Math.round(i*2.5))*.5+.5,s=t.fbm(e,r,3*n,3)*.5+.5;return Math.min(1,Math.max(0,a*.5+o*.3+s*.2))}}},grid(e,t,n,r){let i=Math.max(1,Math.round(e.int(`cells`)*e.num(`scale`))),a=i/r,o=Math.max(e.num(`lineWidth`)*.5,a*.75);return{h(e,t){let n=G(e*i),r=G(t*i),s=Math.min(n,1-n,r,1-r);return 1-W(o-a*.5,o+a*.5,s)}}},checker(e){let t=Math.max(1,Math.round(e.int(`cells`)*e.num(`scale`)));return{h:(e,n)=>Math.floor(e*t)+Math.floor(n*t)&1?1:0}},stripes(e){let t=Math.max(1,Math.round(e.int(`count`)*e.num(`scale`))),n=e.num(`angle`)*Math.PI/180,r=Math.round(Math.cos(n)*t),i=Math.round(Math.sin(n)*t),a=Math.max(.002,e.num(`softness`));return{h(e,t){let n=Math.abs(G(e*r+t*i)-.5)*2;return W(.5-a*2,.5+a*2,n)}}},dots(e){let t=Math.max(1,Math.round(e.int(`cells`)*e.num(`scale`))),n=e.num(`radius`);return{h(e,r){let i=G(e*t)-.5,a=G(r*t)-.5;return 1-W(n-.02,n+.01,Math.hypot(i,a))}}}};Object.keys(At);var jt=e=>{let t=e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;return Math.max(0,Math.min(255,Math.round(t*255)))},Mt=new Map;function Nt(e){return 2**Math.round(Math.log2(Math.max(32,Math.min(2048,e))))}function Pt(e,t){let n=t+`:`+JSON.stringify(e),i=Mt.get(n);if(i)return i;let a=r.find(t=>t.id===e.procedural),o=At[e.procedural];if(!a||!o)throw Error(`Unknown procedural texture "${e.procedural}"`);let s=Ct(a,e),c=s.int(`seed`),l=Nt(s.int(`resolution`)),u=o(s,new Ot(c),c,l),d=new Uint8Array(l*l*4),f=new Float32Array(l*l);for(let e=0;e<l;e++){let t=(e+.5)/l;for(let n=0;n<l;n++)f[e*l+n]=u.h((n+.5)/l,t)}if(t===`color`){let e=s.colors(`colors`).map(e=>[e.r,e.g,e.b]),t=e.length;for(let n=0;n<l;n++)for(let r=0;r<l;r++){let i=n*l+r,a,o,s,c=u.pick?u.pick((r+.5)/l,(n+.5)/l):-1;if(c>=0)[a,o,s]=e[Math.min(c,t-1)];else if(u.pick)[a,o,s]=e[0];else{let n=Math.min(1,Math.max(0,f[i]))*(t-1),r=Math.min(t-2,Math.floor(n)),c=t>1?n-r:0,l=e[Math.max(0,r)],u=e[Math.min(t-1,r+1)];a=l[0]+(u[0]-l[0])*c,o=l[1]+(u[1]-l[1])*c,s=l[2]+(u[2]-l[2])*c}d[i*4]=jt(a),d[i*4+1]=jt(o),d[i*4+2]=jt(s),d[i*4+3]=255}}else if(t===`normal`){let e=[0,0,1],t=l/256*2;for(let n=0;n<l;n++)for(let r=0;r<l;r++){let i=n*l+r,a,o,s;if(u.normal)u.normal((r+.5)/l,(n+.5)/l,e),[a,o,s]=e;else{let e=(e,t)=>f[(t+l)%l*l+(e+l)%l],i=(e(r+1,n-1)+2*e(r+1,n)+e(r+1,n+1)-e(r-1,n-1)-2*e(r-1,n)-e(r-1,n+1))/8,c=(e(r-1,n+1)+2*e(r,n+1)+e(r+1,n+1)-e(r-1,n-1)-2*e(r,n-1)-e(r+1,n-1))/8;a=-i*t,o=-c*t,s=1;let u=Math.hypot(a,o,s);a/=u,o/=u,s/=u}d[i*4]=Math.round((a*.5+.5)*255),d[i*4+1]=Math.round((o*.5+.5)*255),d[i*4+2]=Math.round((s*.5+.5)*255),d[i*4+3]=255}}else for(let e=0;e<l*l;e++){let t=Math.round(Math.min(1,Math.max(0,f[e]))*255);d[e*4]=d[e*4+1]=d[e*4+2]=t,d[e*4+3]=255}let p={data:d,size:l};return Mt.size>64&&Mt.clear(),Mt.set(n,p),p}function Ft(e,t){let n=Pt(e,t),r=new ee(n.data,n.size,n.size,Ce,pe);return r.colorSpace=t===`color`?j:``,r.wrapS=r.wrapT=Be,r.magFilter=Le,r.minFilter=Je,r.generateMipmaps=!0,r.anisotropy=4,r.needsUpdate=!0,r.name=`procedural:${e.procedural}`,r}var It=`
3
- float a3dToonBand( float x ) {
4
- float w = max( fwidth( x ), 1e-3 ) * 0.75;
5
- return 0.5 * smoothstep( - w, w, x ) + 0.5 * smoothstep( 0.42 - w, 0.42 + w, x );
6
- }
7
- `,Lt=`float dotNL = saturate( dot( geometryNormal, directLight.direction ) );`;function Rt(e){let t=e.onBeforeCompile,n=e.customProgramCacheKey.call(e);e.onBeforeCompile=(n,r)=>{t.call(e,n,r);let i=ze.lights_physical_pars_fragment;i.includes(Lt)&&(n.fragmentShader=n.fragmentShader.replace(`#include <lights_physical_pars_fragment>`,It+i.replace(Lt,`float dotNL = a3dToonBand( dot( geometryNormal, directLight.direction ) );`)))},e.customProgramCacheKey=()=>`a3d-toon(${n})`,e.userData.toon=!0}function zt(e={}){let t=new M({roughness:.75,metalness:0,...e});return Rt(t),t}n.map(e=>e.id);function Bt(e){let t=e??{},r={...(t.preset?n.find(e=>e.id===t.preset):void 0)?.props??{}};for(let[e,n]of Object.entries(t))n!==void 0&&e!==`preset`&&(r[e]=n);return r.type||=r.shader?`shader`:r.gradient?`gradient`:`standard`,r}function K(e,t,n){let r=e.userData.a3dPatches;if(!r){r=e.userData.a3dPatches=[];let t=e.onBeforeCompile;if(t!==Xe.prototype.onBeforeCompile){let n=e.customProgramCacheKey.call(e);r.push({key:`own(${n})`,patch:(n,r)=>t.call(e,n,r)})}}if(r.some(e=>e.key===t))return;r.push({key:t,patch:n});let i=r;e.onBeforeCompile=(e,t)=>{for(let n of i)n.patch(e,t)},e.customProgramCacheKey=()=>`agent3d:`+i.map(e=>e.key).join(`+`),e.needsUpdate=!0}var Vt=null;function Ht(){if(Vt)return Vt;if(typeof document>`u`)return null;let e=document.createElement(`canvas`);e.width=e.height=256;let t=e.getContext(`2d`);if(!t)return null;let n=t.createRadialGradient(97.28,81.92,5.12,128,128,133.12);n.addColorStop(0,`#ffffff`),n.addColorStop(.25,`#e6e6ea`),n.addColorStop(.7,`#7d7f88`),n.addColorStop(1,`#2a2b30`),t.fillStyle=n,t.fillRect(0,0,256,256);let r=t.createRadialGradient(128,128,102.4,128,128,128);return r.addColorStop(0,`rgba(255,255,255,0)`),r.addColorStop(1,`rgba(200,210,255,0.35)`),t.fillStyle=r,t.fillRect(0,0,256,256),Vt=new we(e),Vt.colorSpace=j,Vt}var Ut={front:0,back:1,double:2},Wt=8;function Gt(e,t,n=!1){let r=t.slice(0,Wt).map(e=>V(e));for(;r.length<Wt;)r.push(r[r.length-1].clone());let i={uGradColors:{value:r},uGradCount:{value:Math.min(Math.max(t.length,1),Wt)},uGradMin:{value:-.5},uGradMax:{value:.5}};return K(e,n?`gradient-emissive`:`gradient`,e=>{Object.assign(e.uniforms,i),e.vertexShader=`varying float vGradY;
8
- `+e.vertexShader.replace(`#include <begin_vertex>`,`#include <begin_vertex>
9
- vGradY = position.y;`);let t=`varying float vGradY;\nuniform vec3 uGradColors[${Wt}];\nuniform int uGradCount;\nuniform float uGradMin;\nuniform float uGradMax;\n`+e.fragmentShader.replace(`vec4 diffuseColor = vec4( diffuse, opacity );`,`float gT = clamp((vGradY - uGradMin) / max(uGradMax - uGradMin, 1e-5), 0.0, 1.0);
10
- vec3 gCol = uGradColors[0];
11
- if (uGradCount > 1) {
12
- float f = gT * float(uGradCount - 1);
13
- for (int i = 0; i < 7; i++) {
14
- if (i < uGradCount - 1) gCol = mix(gCol, uGradColors[i + 1], clamp(f - float(i), 0.0, 1.0));
15
- }
16
- }
17
- vec4 diffuseColor = vec4( diffuse * gCol, opacity );`);n&&(t=t.replace(`#include <emissivemap_fragment>`,`#include <emissivemap_fragment>
18
- totalEmissiveRadiance *= gCol;`)),e.fragmentShader=t}),e.userData.gradient=i,i}function Kt(e,t){for(let n of Array.isArray(e)?e:[e]){let e=n.userData.gradient;if(!e)continue;t.boundingBox||t.computeBoundingBox();let r=t.boundingBox;e.uGradMin.value=r.min.y,e.uGradMax.value=r.max.y}}var qt=`
19
- varying vec3 vTriPos;
20
- varying vec3 vTriNormal;
21
- uniform vec2 uTriScale;
22
- vec3 triW() {
23
- vec3 w = pow(abs(normalize(vTriNormal)), vec3(4.0));
24
- return w / max(w.x + w.y + w.z, 1e-5);
25
- }
26
- vec4 triSample(sampler2D tex) {
27
- vec3 w = triW();
28
- vec3 p = vTriPos;
29
- return texture2D(tex, p.zy * uTriScale) * w.x + texture2D(tex, p.xz * uTriScale) * w.y + texture2D(tex, p.xy * uTriScale) * w.z;
30
- }
31
- `;function Jt(e,t,n){let r={value:new C(t*(n?.[0]??1),t*(n?.[1]??n?.[0]??1))};K(e,`triplanar`,e=>{e.uniforms.uTriScale=r,e.vertexShader=`varying vec3 vTriPos;
32
- varying vec3 vTriNormal;
33
- `+e.vertexShader.replace(`#include <begin_vertex>`,`#include <begin_vertex>
34
- vTriPos = position;
35
- vTriNormal = normal;`);let t=e.fragmentShader;t=t.replace(`#include <common>`,`#include <common>
36
- `+qt+`
37
- #if defined( USE_NORMALMAP_TANGENTSPACE ) && !defined( USE_NORMALMAP_OBJECTSPACE )
38
- uniform mat3 normalMatrix;
39
- #endif
40
- `),t=t.replace(`#include <map_fragment>`,`#ifdef USE_MAP
41
- diffuseColor *= triSample( map );
42
- #endif`),t=t.replace(`#include <roughnessmap_fragment>`,`float roughnessFactor = roughness;
43
- #ifdef USE_ROUGHNESSMAP
44
- roughnessFactor *= triSample( roughnessMap ).g;
45
- #endif`),t=t.replace(`#include <metalnessmap_fragment>`,`float metalnessFactor = metalness;
46
- #ifdef USE_METALNESSMAP
47
- metalnessFactor *= triSample( metalnessMap ).b;
48
- #endif`),t=t.replace(`#include <emissivemap_fragment>`,`#ifdef USE_EMISSIVEMAP
49
- totalEmissiveRadiance *= triSample( emissiveMap ).rgb;
50
- #endif`),t=t.replace(`#include <normal_fragment_maps>`,`#if defined( USE_NORMALMAP_TANGENTSPACE )
51
- {
52
- vec3 tw = triW();
53
- vec3 on = normalize( vTriNormal );
54
- vec3 p = vTriPos;
55
- vec3 tx = texture2D( normalMap, p.zy * uTriScale ).xyz * 2.0 - 1.0;
56
- vec3 ty = texture2D( normalMap, p.xz * uTriScale ).xyz * 2.0 - 1.0;
57
- vec3 tz = texture2D( normalMap, p.xy * uTriScale ).xyz * 2.0 - 1.0;
58
- tx.xy *= normalScale; ty.xy *= normalScale; tz.xy *= normalScale;
59
- tx = vec3( tx.xy + on.zy, abs( tx.z ) * on.x );
60
- ty = vec3( ty.xy + on.xz, abs( ty.z ) * on.y );
61
- tz = vec3( tz.xy + on.xy, abs( tz.z ) * on.z );
62
- vec3 objN = normalize( tx.zyx * tw.x + ty.xzy * tw.y + tz.xyz * tw.z );
63
- normal = normalize( normalMatrix * objN ) * faceDirection;
64
- }
65
- #else
66
- #include <normal_fragment_maps>
67
- #endif`),e.fragmentShader=t})}var Yt=Object.keys(Dt);function Xt(e,t,n){e.colorSpace=n?j:``,(t.repeat||t.triplanar)&&(e.wrapS=e.wrapT=Be,t.repeat&&!t.triplanar&&e.repeat.set(t.repeat[0],t.repeat[1])),e.anisotropy=Math.max(e.anisotropy,4)}function Zt(e,t,n,r){let i=e;i[t]=n,t===`map`&&!r.color&&e.color?.set(16777215),t===`emissiveMap`&&!r.emissive&&e.emissive?.set(16777215),t===`alphaMap`&&(e.transparent=r.transparent??!0),e.needsUpdate=!0}function Qt(e,t,n){for(let r of Yt){let i=t[r];if(!i||!(r in e))continue;let a=Dt[r];if(typeof i==`object`){try{let n=Ft(i,a);Xt(n,t,a===`color`),n.wrapS=n.wrapT=Be,Zt(e,r,n,t)}catch(e){n.issue(`unknown-catalog-id`,e.message,`material.${String(r)}`)}continue}let o=n.resolveAsset(i);n.track(xt(o).then(n=>{Xt(n,t,a===`color`),Zt(e,r,n,t)}).catch(e=>n.issue(`asset-load`,e.message,i)))}}function $t(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}async function en(e,t,n={}){let r=Bt(e),i=r.type??`standard`,a=r.color??(e?.preset?void 0:n.defaultColor);if(i===`shader`){let e=await t.shaders().catch(()=>({})),n=r.shader??`plasma`,i=e[n];if(i){let e={...r.uniforms??{}};r.color&&e.color===void 0&&(e.color=r.color),r.gradient&&e.colors===void 0&&(e.colors=r.gradient),r.opacity!==void 0&&e.opacity===void 0&&(e.opacity=r.opacity);let n=i.create(e,t);if(n.update){let e=n.update.bind(n);t.onUpdate(t=>e(t))}return r.side&&(n.material.side=Ut[r.side]),n.material}t.issue(`unknown-catalog-id`,`Unknown shader "${n}"`,`material.shader`)}let o={};a&&(o.color=V(a)),r.opacity!==void 0&&(o.opacity=r.opacity),(r.transparent!==void 0||r.opacity!==void 0&&r.opacity<1)&&(o.transparent=r.transparent??!0),r.wireframe&&(o.wireframe=!0),r.side&&(o.side=Ut[r.side]),n.vertexColors&&(o.vertexColors=!0);let s={...o};r.emissive&&(s.emissive=V(r.emissive)),r.emissiveIntensity!==void 0&&(s.emissiveIntensity=r.emissiveIntensity),r.flatShading&&(s.flatShading=!0),r.bumpScale!==void 0&&(s.bumpScale=r.bumpScale),r.normalScale!==void 0&&(s.normalScale=new C(r.normalScale,r.normalScale)),r.aoMapIntensity!==void 0&&(s.aoMapIntensity=r.aoMapIntensity),r.displacementScale!==void 0&&(s.displacementScale=r.displacementScale);let c={...s};r.metalness!==void 0&&(c.metalness=r.metalness),c.roughness=B(r.roughness,.5),r.envMapIntensity!==void 0&&(c.envMapIntensity=r.envMapIntensity);let l;switch(i){case`physical`:{let e={...c};if(r.transmission!==void 0&&(e.transmission=r.transmission),r.thickness!==void 0&&(e.thickness=r.thickness),r.ior!==void 0&&(e.ior=r.ior),r.clearcoat!==void 0&&(e.clearcoat=r.clearcoat,e.clearcoatRoughness=B(r.clearcoatRoughness,.1)),r.iridescence!==void 0){e.iridescence=r.iridescence,e.iridescenceIOR=B(r.iridescenceIOR,1.6);let[t,n]=r.iridescenceThicknessRange??[180,600];e.iridescenceThicknessMinimum=t,e.iridescenceThicknessMaximum=n}r.sheen!==void 0&&(e.sheen=r.sheen,e.sheenRoughness=B(r.sheenRoughness,.6),e.sheenColor=r.sheenColor?V(r.sheenColor):V(a??`#ffffff`).lerp(new D(1,1,1),.5)),r.anisotropy!==void 0&&(e.anisotropy=r.anisotropy,e.anisotropyRotation=B(r.anisotropyRotation,0)*R),r.attenuationColor!==void 0&&(e.attenuationColor=V(r.attenuationColor)),r.attenuationDistance!==void 0&&(e.attenuationDistance=r.attenuationDistance),r.specularIntensity!==void 0&&(e.specularIntensity=r.specularIntensity),r.specularColor!==void 0&&(e.specularColor=V(r.specularColor)),r.dispersion!==void 0&&(e.dispersion=r.dispersion),l=new fe(e),r.transmission&&!on(r)&&an(l);break}case`basic`:l=new y(o);break;case`lambert`:l=new he(s);break;case`toon`:l=zt({...c,roughness:B(r.roughness,.75)});break;case`normal`:l=new x($t({flatShading:!!r.flatShading,wireframe:!!r.wireframe,side:o.side,transparent:o.transparent,opacity:r.opacity??1}));break;case`matcap`:l=new te($t({...o,flatShading:!!r.flatShading,matcap:Ht()??void 0}));break;case`gradient`:l=new M({...c,color:V(r.color??`#ffffff`)}),Gt(l,lt(r.gradient,[`#3a86ff`,`#ff006e`]),!!r.gradientEmissive);break;default:l=new M(c)}return r.envMapIntensity!==void 0&&l instanceof M&&r.envMapIntensity!==1&&(nn(l).value=r.envMapIntensity),l instanceof fe&&on(r)&&sn(l,r),r.triplanar&&l instanceof M&&Jt(l,typeof r.triplanar==`number`?r.triplanar:1,r.repeat),Qt(l,r,t),l}async function tn(e,t,n){let r=await en(t,n);e.traverse(e=>{let t=e;t.isMesh&&(t.material=r,Kt(r,t.geometry))})}function nn(e){let t=e.userData.envScale;if(t)return t;let n={value:1};return e.userData.envScale=n,K(e,`env-scale`,e=>{e.uniforms.uA3dEnvScale=n,e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>
68
- uniform float uA3dEnvScale;`).replace(`#include <lights_fragment_maps>`,`#include <lights_fragment_maps>
69
- #if defined( RE_IndirectSpecular ) && defined( RE_IndirectDiffuse )
70
- radiance *= uA3dEnvScale;
71
- clearcoatRadiance *= uA3dEnvScale;
72
- iblIrradiance *= uA3dEnvScale;
73
- #endif`)}),n}var rn=`vec3 a3dSoftClip(vec3 c) { vec3 e = max(c - 1.0, 0.0); return min(c, 1.0) + e / (1.0 + e); }`;function an(e){K(e,`transmission-clamp`,e=>{e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>\n${rn}`).replace(`#include <transmission_fragment>`,ze.transmission_fragment.replace(`material.transmissionAlpha = mix(`,`transmitted.rgb = a3dSoftClip( transmitted.rgb );
74
- material.transmissionAlpha = mix(`))})}function on(e){return(e.transmission??0)>=.5&&(e.ior??1.5)>=1.7&&(e.roughness??.5)<=.15}function sn(e,t){let n={uA3dGemIor:{value:t.ior??2},uA3dGemDisp:{value:Math.min(.12,(t.dispersion??0)*.012)},uA3dGemTint:{value:t.attenuationColor?V(t.attenuationColor):new D(1,1,1)},uA3dGemEnv:nn(e),uA3dGemAmount:{value:Math.min(.85,.45+Math.max(0,(t.ior??2)-1.5)*.45)}};e.userData.gemSparkle=n,K(e,`gem-sparkle`,e=>{Object.assign(e.uniforms,n),e.vertexShader=e.vertexShader.replace(`#include <common>`,`#include <common>
75
- varying vec3 vA3dJ0; varying vec3 vA3dJ1; varying vec3 vA3dJ2;
76
- vec3 a3dGemHash(vec3 p) { p = fract(p * vec3(0.1031, 0.1030, 0.0973)); p += dot(p, p.yxz + 33.33); return fract((p.xxy + p.yxx) * p.zyx); }`).replace(`#include <beginnormal_vertex>`,`#include <beginnormal_vertex>
77
- vec3 a3dOn = floor(objectNormal * 64.0 + 0.5);
78
- vA3dJ0 = normalMatrix * (a3dGemHash(a3dOn + 1.7) - 0.5);
79
- vA3dJ1 = normalMatrix * (a3dGemHash(a3dOn + 9.3) - 0.5);
80
- vA3dJ2 = normalMatrix * (a3dGemHash(a3dOn + 23.1) - 0.5);`),e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>
81
- varying vec3 vA3dJ0; varying vec3 vA3dJ1; varying vec3 vA3dJ2;
82
- uniform float uA3dGemIor; uniform float uA3dGemDisp; uniform vec3 uA3dGemTint; uniform float uA3dGemEnv; uniform float uA3dGemAmount;`).replace(`#include <opaque_fragment>`,`#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_PMREM )
83
- {
84
- vec3 gV = normalize(geometryViewDir);
85
- vec3 gN = normalize(normal);
86
- vec3 sp = vec3(0.0);
87
- vec3 iors = vec3(uA3dGemIor - uA3dGemDisp, uA3dGemIor, uA3dGemIor + uA3dGemDisp);
88
- for (int k = 0; k < 3; k++) {
89
- vec3 J = k == 0 ? vA3dJ0 : (k == 1 ? vA3dJ1 : vA3dJ2);
90
- vec3 fn = normalize(-gN + J * 1.6);
91
- for (int c = 0; c < 3; c++) {
92
- vec3 rd = refract(-gV, gN, 1.0 / iors[c]);
93
- vec3 d = normalize(reflect(rd, fn));
94
- // A second inner bounce off the next fake facet: the exit ray swings a
95
- // lot with the view angle, so faces break into light / dark areas.
96
- vec3 J2 = k == 0 ? vA3dJ1 : (k == 1 ? vA3dJ2 : vA3dJ0);
97
- d = normalize(reflect(d, normalize(d * -0.5 + J2 * 2.0 + gN * 0.3)));
98
- sp[c] += getIBLRadiance(d, d, 0.0)[c];
99
- }
100
- }
101
- sp *= uA3dGemEnv / 3.0;
102
- // Contrast: facets catching bright light flash, the others go dark.
103
- // Relative to the environment's average brightness (its irradiance), so it
104
- // works on a uniformly light softbox as well as on a dark studio.
105
- vec3 avgEnv = (getIBLIrradiance(gN) + getIBLIrradiance(-gN)) / (2.0 * PI) * uA3dGemEnv / max(envMapIntensity, 1e-3);
106
- float la = max(dot(avgEnv, vec3(0.2126, 0.7152, 0.0722)), 1e-3);
107
- float l = dot(sp, vec3(0.2126, 0.7152, 0.0722));
108
- sp *= smoothstep(0.7 * la, 1.6 * la, l) * 1.6;
109
- float F = pow(1.0 - saturate(dot(gN, gV)), 5.0);
110
- outgoingLight = mix(outgoingLight, sp * uA3dGemTint + outgoingLight * 0.25, uA3dGemAmount * (1.0 - F));
111
- }
112
- #endif
113
- #include <opaque_fragment>`)})}var cn=new E;function q(e,t,n,r,i,a){let o=2*Math.PI*i/4,s=Math.max(a-2*i,0),c=Math.PI/4;cn.copy(t),cn[r]=0,cn.normalize();let l=.5*o/(o+s),u=1-cn.angleTo(e)/c;return Math.sign(cn[n])===1?u*l:s/(o+s)+l+l*(1-u)}var ln=class e extends Re{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 E,c=new E,l=new E(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 E,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]=q(m,c,`z`,`y`,i,n),f[a+1]=1-q(m,c,`y`,`z`,i,t);break;case 1:m.set(-1,0,0),f[a+0]=1-q(m,c,`z`,`y`,i,n),f[a+1]=1-q(m,c,`y`,`z`,i,t);break;case 2:m.set(0,1,0),f[a+0]=1-q(m,c,`x`,`z`,i,e),f[a+1]=q(m,c,`z`,`x`,i,n);break;case 3:m.set(0,-1,0),f[a+0]=1-q(m,c,`x`,`z`,i,e),f[a+1]=1-q(m,c,`z`,`x`,i,n);break;case 4:m.set(0,0,1),f[a+0]=1-q(m,c,`x`,`y`,i,e),f[a+1]=1-q(m,c,`y`,`x`,i,t);break;case 5:m.set(0,0,-1),f[a+0]=q(m,c,`x`,`y`,i,e),f[a+1]=1-q(m,c,`y`,`x`,i,t)}}static fromJSON(t){return new e(t.width,t.height,t.depth,t.segments,t.radius)}};function J(e,t=e.data){let n=!1,r=e=>u(e)?(n=!0,l(e,t)):e,i=e=>{if(typeof e==`string`)return u(e)?(n=!0,o(e,t)):e;if(Array.isArray(e)){let t=e.map(i);return t.every((t,n)=>t===e[n])?e:t}if(e&&typeof e==`object`){let t=!1,n={};for(let[r,a]of Object.entries(e)){let e=i(a);e!==a&&(t=!0),e!==void 0&&(n[r]=e)}return t?n:e}return e},a=e=>{let t=e,n=t.kind===`text`?r(t.text):t.text,o=r(t.href),s=t.kind===`generator`&&t.params?i(t.params):t.params,c=e.children?.map(a);return n===t.text&&o===t.href&&s===t.params&&(!c||c.every((t,n)=>t===e.children[n]))?e:{...e,...t.kind===`text`?{text:n}:{},...t.href===void 0?{}:{href:o},...s===t.params?{}:{params:s},...c?{children:c}:{}}},s=e.interactions?.map(e=>{let t=e.do;if(!Array.isArray(t))return e;let n=t.map(e=>{let t=e;return!t||typeof t!=`object`||!u(t.openUrl)?e:{...t,openUrl:r(t.openUrl)}});return n.every((e,n)=>e===t[n])?e:{...e,do:n}}),c=(e.objects??[]).map(a),d=r(e.title),f=r(e.ariaLabel),p=e.ui?.elements?.map(e=>{let t=e,n=r(t.text);return n===t.text?e:{...e,text:n}});return n?{...e,title:d,...e.ariaLabel===void 0?{}:{ariaLabel:f},objects:c,...e.ui&&p?{ui:{...e.ui,elements:p}}:{},...s?{interactions:s}:{}}:e}function un(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(n===`json`)try{let e=JSON.parse(r);e&&typeof e==`object`&&!Array.isArray(e)&&Object.assign(t,e)}catch{}else t[n]=r}return t}var dn=null,fn=null;function pn(){return dn??=s(()=>import(`./shaders-BEznGIct.js`).then(e=>e.SHADER_IMPLS),__vite__mapDeps([0,1]),import.meta.url),dn}function mn(){return fn??=s(()=>import(`./generators-DVX3bAxe.js`).then(e=>e.GENERATOR_IMPLS),__vite__mapDeps([2,3,1,4,5,6]),import.meta.url),fn}function hn(e,t=[0,1,0]){let n=new E(...L(e,t));return n.lengthSq()<1e-9&&n.set(0,1,0),n.normalize()}function gn(e){return rt(e)}var Y=Math.PI*2,_n=(e,t)=>{let n=it(e.effect,`scale`),r=Math.max(B(e.duration,.8),.001),i=it(e.ease,`outBack`),a=n===`fade`?gn(t.object):[];for(let e of a)e.userData.baseOpacity===void 0&&(e.userData.baseOpacity=e.opacity),e.transparent=!0;return{update(e){let o=Math.min(Math.max(e/r,0),1),s=d(i,o),c=t.object;switch(n){case`fade`:for(let e of a)e.opacity=e.userData.baseOpacity*d(`outCubic`,o);break;case`rise`:c.position.y-=(1-s)*1,c.scale.multiplyScalar(Math.max(1e-4,Math.min(1,o*3)));break;case`drop`:c.position.y+=(1-s)*3,o<=0&&(c.visible=!1);break;case`spin`:c.rotation.y+=(1-s)*Y,c.scale.multiplyScalar(Math.max(1e-4,s));break;default:c.scale.multiplyScalar(Math.max(1e-4,s))}}}},vn=(e,t)=>{let n=z(e.lockY,!0),r=new E,i=new E;return{update(){t.object.getWorldPosition(r),t.camera.getWorldPosition(i),n?t.object.rotation.set(0,Math.atan2(i.x-r.x,i.z-r.z),0):t.camera.getWorldQuaternion(t.object.quaternion)}}},yn=(e,t)=>{let n=Math.max(B(e.interval,3),.05),r=B(e.duration,.15),i=z(e.random,!0);return{update(e){let a=Math.floor(e/n),o=i?ot(a+t.object.id)*(n-r)*.8:n-r,s=e-a*n;s>=o&&s<o+r&&(t.object.visible=!1)}}},bn=(e,t)=>{let n=B(e.amount,.04),r=Math.max(B(e.period,4),.1),i=B(e.phase,0),a=B(e.rise,.02);return{update(e){let o=(e/r+i)%1,s=o<.6?.5-.5*Math.cos(o/.6*Math.PI):.5+.5*Math.cos((o-.6)/.4*Math.PI);t.object.scale.x*=1+n*.5*s,t.object.scale.z*=1+n*.5*s,t.object.scale.y*=1+n*s,t.object.position.y+=a*s}}},xn=(e,t)=>{let n=B(e.height,.3),r=B(e.speed,1.5);return{update(e){let i=Math.abs(Math.sin(Math.PI*r*e));t.object.position.y+=n*i;let a=(1-i)*(1-i)*.08;t.object.scale.y*=1-a,t.object.scale.x*=1+a*.5,t.object.scale.z*=1+a*.5}}},Sn=(e,t)=>{let n=B(e.amount,.25),r=-1;return{update(e){if(t.clicked()&&(r=e),r<0)return;let i=e-r;if(i>1.5)return;let a=n*Math.exp(-5*i)*Math.sin(i*22);t.object.scale.y*=1-a,t.object.scale.x*=1+a*.5,t.object.scale.z*=1+a*.5}}};function Cn(e,t,n){if(t<=0||e<=0)return 0;if(n===`pingpong`){let n=e%(2*t);return n<=t?n:2*t-n}return n?e%t:Math.min(e,t)}var wn=new Map;function Tn(e){let t=wn.get(e);if(!t){t=new D;try{t.setStyle(e)}catch{t.set(16777215)}wn.size<1e3&&wn.set(e,t)}return t}var En=/^\s*([+\-*])=\s*(-?\d*\.?\d+(?:e[+-]?\d+)?)\s*$/i;function Dn(e){return typeof e==`string`&&En.test(e)}function X(e,t){if(typeof e==`number`)return e;let n=typeof e==`string`?En.exec(e):null;if(!n)return t;let r=Number(n[2]);return n[1]===`+`?t+r:n[1]===`-`?t-r:t*r}function On(e,t){let n=Array.isArray(t)?t:typeof t==`number`?[t,t,t]:null,r=typeof t==`number`?t:Array.isArray(t)?t[0]:0;return e.map(e=>{let[i,a,o]=e,s;return s=Array.isArray(a)?[X(a[0],n?.[0]??0),X(a[1],n?.[1]??0),X(a[2],n?.[2]??0)]:Dn(a)?n&&Array.isArray(t)?[X(a,n[0]),X(a,n[1]),X(a,n[2])]:X(a,r):a,o===void 0?[i,s]:[i,s,o]})}function kn(e){return Array.isArray(e)?[Number(e[0])||0,Number(e[1])||0,Number(e[2])||0]:typeof e==`number`?[e,e,e]:null}function An(e){let t=Math.cbrt(.4122214708*e.r+.5363325363*e.g+.0514459929*e.b),n=Math.cbrt(.2119034982*e.r+.6806995451*e.g+.1073969566*e.b),r=Math.cbrt(.0883024619*e.r+.2817188376*e.g+.6299787005*e.b);return[.2104542553*t+.793617785*n-.0040720468*r,1.9779984951*t-2.428592205*n+.4505937099*r,.0259040371*t+.7827717662*n-.808675766*r]}function jn(e,t,n,r){let i=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,o=(e-.0894841775*t-1.291485548*n)**3;return r.setRGB(Math.max(0,4.0767416621*i-3.3077115913*a+.2309699292*o),Math.max(0,-1.2684380046*i+2.6097574011*a-.3413193965*o),Math.max(0,-.0041960863*i-.7034186147*a+1.707614701*o),ke)}function Mn(e,t,n,r=`oklch`,i=new D){if(r===`rgb`)return i.copy(e).lerp(t,n);if(r===`oklch`){let r=An(e),a=An(t),o=Math.hypot(r[1],r[2]),s=Math.hypot(a[1],a[2]),c=Math.atan2(r[2],r[1]),l=Math.atan2(a[2],a[1]);o<1e-4&&(c=l),s<1e-4&&(l=c);let u=l-c;u>Math.PI?u-=2*Math.PI:u<-Math.PI&&(u+=2*Math.PI);let d=r[0]+(a[0]-r[0])*n,f=Math.max(0,o+(s-o)*n),p=c+u*n;return jn(d,f*Math.cos(p),f*Math.sin(p),i)}if(r===`hsl`){let r={h:0,s:0,l:0},a={h:0,s:0,l:0};e.getHSL(r),t.getHSL(a),r.s<1e-4&&(r.h=a.h),a.s<1e-4&&(a.h=r.h);let o=a.h-r.h;return o>.5?--o:o<-.5&&(o+=1),i.setHSL(((r.h+o*n)%1+1)%1,r.s+(a.s-r.s)*n,r.l+(a.l-r.l)*n)}let a=An(e),o=An(t);return jn(a[0]+(o[0]-a[0])*n,a[1]+(o[1]-a[1])*n,a[2]+(o[2]-a[2])*n,i)}function Nn(e,t,n,r){if(typeof e==`boolean`||typeof t==`boolean`)return n>=1?t:e;if(typeof e==`number`&&typeof t==`number`)return e+(t-e)*n;if(typeof e==`string`||typeof t==`string`)return Mn(Tn(String(e)),Tn(String(t)),n,r);let i=kn(e),a=kn(t);return[i[0]+(a[0]-i[0])*n,i[1]+(a[1]-i[1])*n,i[2]+(a[2]-i[2])*n]}function Pn(e){return typeof e==`string`?Tn(e).clone():Array.isArray(e)?[e[0],e[1],e[2]]:e}function Fn(e,t,n,r){let i=e;if(!i.length)return;if(t<=i[0][0])return Pn(i[0][1]);let a=i[i.length-1];if(t>=a[0])return Pn(a[1]);for(let e=0;e<i.length-1;e++){let[a,o]=i[e],[s,c,l]=i[e+1];if(t>=a&&t<s)return typeof o==`boolean`||typeof c==`boolean`?o:Nn(o,c,s>a?d(l??n??`linear`,(t-a)/(s-a)):1,r)}return Pn(a[1])}function In(e){let t=e.indexOf(`.`);return t<0?{id:e,path:``}:{id:e.slice(0,t),path:e.slice(t+1)}}function Ln(e,t,n=1){let r=Array.from({length:e},(e,t)=>t);switch(t){case`end`:return r.map(t=>e-1-t);case`center`:{let t=(e-1)/2;return r.map(e=>Math.abs(e-t))}case`edges`:{let t=(e-1)/2;return r.map(e=>t-Math.abs(e-t))}case`random`:{let t=[...r],i=n*2654435761>>>0||1;for(let n=e-1;n>0;n--){i=i*1664525+1013904223>>>0;let e=i%(n+1);[t[n],t[e]]=[t[e],t[n]]}let a=Array(e);return t.forEach((e,t)=>a[e]=t),a}default:return r}}var Rn=(e,t)=>{let n=lt(e.colors,[`#ff006e`,`#8338ec`,`#3a86ff`]).map(e=>V(e)),r=B(e.speed,.5),i=z(e.emissive,!1),a=gn(t.object),o=new D;return{update(e){let s=(e*r%n.length+n.length)%n.length,c=Math.floor(s),l=s-c,u=l*l*(3-2*l);Mn(n[c],n[(c+1)%n.length],u,`oklch`,o);let d=t.object;d.isLight&&d.color.copy(o);for(let e of a){let t=e;t.color?.copy(o),i&&t.emissive&&t.emissive.copy(o)}}}},zn=(e,t)=>{let[n,r,i]=L(e.area,[1,1,1]),a=B(e.speed,.3),o=B(e.seed,1)+t.object.id*.137,s=Array.from({length:6},(e,t)=>ot(o*13.1+t)*Math.PI*2),c=Array.from({length:6},(e,t)=>.6+ot(o*7.7+t*3.3)*.8),l=(e,t)=>.65*Math.sin(t*c[e]+s[e])+.35*Math.sin(t*c[e+3]*2.3+s[e+3]);return{update(e){let o=e*a;t.object.position.x+=n/2*l(0,o),t.object.position.y+=r/2*l(1,o*.9),t.object.position.z+=i/2*l(2,o*1.1)}}};function Bn(e,t){let n=Math.floor(e),r=e-n,i=ot(n+t*31.7);return i+(ot(n+1+t*31.7)-i)*r*r*(3-2*r)}var Vn=(e,t)=>{let n=dt(B(e.amount,.3),0,1),r=B(e.speed,8),i=t.object.id,a=gn(t.object);for(let e of a)e.userData.baseEmissiveIntensity===void 0&&(e.userData.baseEmissiveIntensity=e.emissiveIntensity??1);return{update(e){let o=.6*Bn(e*r,i)+.4*Bn(e*r*2.7,i+3),s=1-n*o,c=t.object;c.isLight&&(c.intensity*=s);for(let e of a)e.emissiveIntensity!==void 0&&(e.emissiveIntensity=e.userData.baseEmissiveIntensity*s)}}},Hn=(e,t)=>{let n=B(e.amplitude,.15),r=B(e.speed,.5),i=B(e.phase,0);return{update:e=>void(t.object.position.y+=n*Math.sin(Y*(r*e+i)))}},Un=(e,t)=>{let n=B(e.strength,.5),r=B(e.smoothing,.9),i=it(e.mode,`rotate`),a=0,o=0;return{update(e,s){let c=H(r,s);a+=(t.pointer.x-a)*c,o+=(t.pointer.y-o)*c,(i===`move`||i===`both`)&&(t.object.position.x+=a*n,t.object.position.y+=o*n),(i===`rotate`||i===`both`)&&(t.object.rotation.y+=a*n*.8,t.object.rotation.x+=-o*n*.8)}}},Wn=(e,t)=>{let n=B(e.height,.2),r=B(e.tilt,10)*R,i=0,a=0,o=0;return{update(e,s){let c=H(.82,s);i+=(+!!t.hovered()-i)*c,a+=(t.pointer.x-a)*c,o+=(t.pointer.y-o)*c,t.object.position.y+=n*i,t.object.rotation.x+=-o*r*i,t.object.rotation.y+=a*r*i}}},Gn=(e,t)=>{let n=B(e.scale,1.15),r=B(e.smoothing,.8),i=1;return{update(e,a){i+=((t.hovered()?n:1)-i)*H(r,a),t.object.scale.multiplyScalar(i)}}},Kn=(e,t)=>{let n=B(e.smoothing,.85),r=z(e.lockY,!1),i=Array.isArray(e.point)&&e.point.length===3?new E(...e.point):null,a=typeof e.target==`string`?e.target:`camera`,o=new N,s=new N,c=new E,l=new E,u=new F,d=new N,f=!0;return{update(e,p){let m=i??(a===`camera`?t.camera:t.find?.(a));m&&(m instanceof E?l.copy(m):m.getWorldPosition(l),t.object.getWorldPosition(c),r&&(l.y=c.y),l.distanceToSquared(c)<1e-10||(u.lookAt(l,c,re.DEFAULT_UP),o.setFromRotationMatrix(u),t.object.parent&&o.premultiply(t.object.parent.getWorldQuaternion(d).invert()),s.slerp(o,f?1:H(n,p)),f=!1,t.object.quaternion.copy(s)))}}},qn=(e,t)=>{let n=B(e.maxAngle,35)*R,r=B(e.smoothing,.85),i=0,a=0;return{update(e,o){let s=H(r,o);i+=(t.pointer.x*n-i)*s,a+=(-t.pointer.y*n-a)*s,t.object.rotation.y+=i,t.object.rotation.x+=a}}},Jn=(e,t)=>{let n=Math.max(B(e.radius,.25),.001),r=B(e.strength,.4),i=new E,a=new E,o=new E,s=new E,c=new E;return{update(e,l){if(a.set(0,0,0),t.pointer.inside){t.object.getWorldPosition(o),s.copy(o).project(t.camera);let e=(t.pointer.x-s.x)/2,i=(t.pointer.y-s.y)/2,l=Math.hypot(e,i);if(l<n){c.set(t.pointer.x,t.pointer.y,s.z).unproject(t.camera),a.copy(c).sub(o);let e=a.length();e>1e-6&&a.multiplyScalar(Math.min(e,r)*(1-l/n)/e)}}i.lerp(a,H(.85,l)),t.object.position.add(i)}}},Yn=(e,t)=>{let[n,r,i]=L(e.amplitude,[.1,.1,.05]),[a,o,s]=L(e.rotation,[3,3,2]),c=B(e.speed,.3),l=B(e.seed,1)*13.37+t.rng.next()*100,u=(e,t)=>at(e*c+l,t*5.17)*.8+at(e*c*2.3+l,t*5.17+2.9)*.2;return{update(e){t.object.position.x+=u(e,0)*n,t.object.position.y+=u(e,1)*r,t.object.position.z+=u(e,2)*i,t.object.rotation.x+=u(e,3)*a*R,t.object.rotation.y+=u(e,4)*o*R,t.object.rotation.z+=u(e,5)*s*R}}},Xn=(e,t)=>{let n=new E(...L(e.center,[0,0,0])),r=B(e.radius,2),i=B(e.speed,30)*R,a=B(e.phase,0)*R,o=hn(e.axis),s=z(e.faceDirection,!1),c=Math.abs(o.y)<.99?new E(0,1,0):new E(1,0,0),l=new E().crossVectors(c,o).normalize(),u=new E().crossVectors(o,l).normalize(),d=new E;return{update(e){let c=a+i*e,f=t.object.position.dot(o)-n.dot(o);if(d.copy(n).addScaledVector(l,Math.cos(c)*r).addScaledVector(u,Math.sin(c)*r).addScaledVector(o,f),t.object.position.copy(d),s){let e=l.clone().multiplyScalar(-Math.sin(c)).addScaledVector(u,Math.cos(c)).multiplyScalar(Math.sign(i)||1),n=new N().setFromUnitVectors(new E(0,0,1),e.normalize());t.object.quaternion.premultiply(n)}}}},Zn=(e,t)=>{let n=B(e.depth,.5),r=B(e.pointer,.3),i=B(e.scroll,0),a=B(e.smoothing,.9),o=0,s=0;return{update(e,c){let l=H(a,c),u=t.pointer.inside?t.pointer.x:0,d=t.pointer.inside?t.pointer.y:0;o+=(u-o)*l,s+=(d-s)*l,t.object.position.x+=o*r*n,t.object.position.y+=s*r*n*.6+(t.scroll()-.5)*i*n}}},Qn=(e,t)=>{let n=(Array.isArray(e.points)?e.points:[]).filter(e=>Array.isArray(e)&&e.length>=3).map(e=>new E(e[0],e[1],e[2])),r=z(e.loop,!0),i=z(e.faceDirection,!0),a=Math.max(B(e.duration,5),.001);if(n.length<2)return{update(){}};let o=new et(n,r,`catmullrom`,.5),s=new E,c=new E(0,0,1);return{update(e){let n=r?e/a%1:Math.min(e/a,1);o.getPointAt(n,t.object.position),i&&(o.getTangentAt(Math.min(n,.9999),s).normalize(),t.object.quaternion.setFromUnitVectors(c,s))}}},$n=(e,t)=>{let n=B(e.amount,.08),r=B(e.speed,1);return{update:e=>void t.object.scale.multiplyScalar(1+n*Math.sin(Y*r*e))}},er=(e,t)=>{let n=hn(e.axis),r=B(e.speed,45)*R;return{update:e=>void t.object.rotateOnAxis(n,r*e)}},tr=(e,t)=>{let[n,r,i]=L(e.offset,[0,2,0]);return{update(){let e=t.scroll();t.object.position.x+=n*e,t.object.position.y+=r*e,t.object.position.z+=i*e}}},nr=(e,t)=>{let n=hn(e.axis),r=B(e.degrees,360)*R;return{update:()=>void t.object.rotateOnAxis(n,r*t.scroll())}},rr=(e,t)=>{let n=hn(e.axis),r=Math.max(B(e.duration,.8),.001),i=e.trigger===`hover`,a=-1,o=!1;return{update(e){let s=a>=0&&e-a<r;if(i){let n=t.hovered();n&&!o&&!s&&(a=e),o=n}else t.clicked()&&!s&&(a=e);if(a<0)return;let c=(e-a)/r;c>=1||t.object.rotateOnAxis(n,Y*d(`inOutCubic`,c))}}};function ir(e,t,n,r,i,a,o=1){let s=Math.min(Math.max(r,0),2);for(;s>1e-9;){let r=Math.min(.004166666666666667,s),c=(-i*(e-n)-a*t)/o;t+=c*r,e+=t*r,s-=r}return[e,t]}var ar={rotate:er,float:Hn,bob:xn,pulse:$n,wobble:(e,t)=>{let n=B(e.amount,.08),r=B(e.speed,2);return{update(e){let i=Math.sin(Y*r*e*.5),a=Math.sin(Y*r*e*.5+Math.PI/2);t.object.scale.x*=1+n*i,t.object.scale.y*=1-n*i,t.object.scale.z*=1+n*a*.5}}},sway:(e,t)=>{let n=hn(e.axis,[0,0,1]),r=B(e.angle,8)*R,i=B(e.speed,.5);return{update:e=>void t.object.rotateOnAxis(n,r*Math.sin(Y*i*e))}},orbit:Xn,path:Qn,followPointer:Un,lookAtPointer:qn,hoverScale:Gn,hoverLift:Wn,clickBounce:Sn,spinOnClick:rr,scrollRotate:nr,scrollMove:tr,drift:zn,blink:yn,colorCycle:Rn,flicker:Vn,billboard:vn,appear:_n,magnet:Jn,spring:(e,t)=>{let n=B(e.strength,.4),r=Math.max(B(e.stiffness,120),1),i=Math.max(B(e.damping,12),0),a=Math.max(B(e.mass,1),.01),o=it(e.mode,`move`),s=B(e.angle,15)*R,c={x:0,vx:0,y:0,vy:0};return{update(e,l){let u=t.pointer.inside?t.pointer.x:0,d=t.pointer.inside?t.pointer.y:0;[c.x,c.vx]=ir(c.x,c.vx,u,l,r,i,a),[c.y,c.vy]=ir(c.y,c.vy,d,l,r,i,a),(o===`move`||o===`both`)&&(t.object.position.x+=c.x*n,t.object.position.y+=c.y*n),(o===`rotate`||o===`both`)&&(t.object.rotation.y+=c.x*s,t.object.rotation.x+=-c.y*s)}}},parallax:Zn,tilt:(e,t)=>{let n=B(e.maxAngle,12)*R,r=B(e.scale,1.04),i=B(e.lift,.1),a=B(e.smoothing,.86),o=z(e.hoverOnly,!0),s=z(e.reverse,!1)?-1:1,c=0,l=0,u=0;return{update(e,d){let f=o?t.hovered():t.pointer.inside,p=H(a,d);u+=(+!!f-u)*p,c+=((f?t.pointer.x:0)-c)*p,l+=((f?t.pointer.y:0)-l)*p,t.object.rotation.y+=c*n*s,t.object.rotation.x+=-l*n*s,t.object.position.z+=i*u,t.object.scale.multiplyScalar(1+(r-1)*u)}}},breathe:bn,noise:Yn,lookAt:Kn},or=new Set([`appear`]),sr=1e6,cr=new Set([`billboard`,`lookAt`]),lr=new Set([`lookAt`,`magnet`,`spring`]),ur=1/30;function dr(e,t,n=ur){let r=[];for(let i=Math.floor(e/n+1e-6)+1;i*n<t-1e-6;i++)r.push(i*n);return r}function fr(e,t,n,r={}){let i=t(e,n),a=e.when??`always`,o=B(e.delay,0),s=0,c=-1;return{def:e,late:cr.has(e.type),stateful:lr.has(e.type),step(t,l){if(r.settled?.()&&or.has(e.type)&&(a===`always`||a===`visible`)){i.update(sr,l);return}let u;switch(a){case`hover`:n.hovered()&&(s+=l),u=s-o;break;case`click`:if(c<0&&n.clicked()&&(c=t),c<0)return;u=t-c-o;break;case`scroll`:u=n.scroll()*10-o;break;default:u=t-o}i.update(Math.max(0,u),l)},dispose(){i.dispose?.()}}}var pr={count:300,area:[10,6,6],size:.08,colors:[`#ffffff`],speed:.3,direction:[0,1,0],spread:.3,lifetime:0,opacity:1,blending:`additive`,shape:`soft`,twinkle:0,wander:.2,spin:0,gravity:[0,0,0],endColor:null,endSize:1,stretch:1,swirl:0},mr={stars:{count:900,area:[40,20,20],size:.09,colors:[`#ffffff`,`#cfe2ff`,`#ffe8c2`],speed:0,wander:0,twinkle:.8,shape:`point`,blending:`additive`},snow:{count:1200,area:[20,12,10],size:.08,colors:[`#ffffff`,`#eef6ff`],speed:.6,direction:[0,-1,0],spread:.3,wander:.35,shape:`soft`,blending:`normal`,opacity:.95},rain:{count:2200,area:[20,12,10],size:.05,colors:[`#c9ddff`,`#a9c4f0`],speed:9,direction:[-.06,-1,0],spread:.04,wander:0,shape:`streak`,stretch:9,blending:`normal`,opacity:.5},fireflies:{count:90,area:[10,4,6],size:.16,colors:[`#fff3a0`,`#d4ff7a`,`#ffe066`],speed:.08,spread:1,wander:.7,twinkle:.9,shape:`point`,blending:`additive`},confetti:{count:320,area:[12,8,6],size:.16,colors:[`#ff006e`,`#ffbe0b`,`#3a86ff`,`#8338ec`,`#06d6a0`,`#fb5607`],speed:1.3,direction:[0,-1,0],spread:.5,wander:.45,spin:.8,shape:`square`,blending:`normal`},sparks:{count:320,area:[.6,.2,.6],size:.035,colors:[`#fff6d0`,`#ffd27a`,`#ff9a3d`],speed:5,direction:[0,1,0],spread:.45,lifetime:1.2,wander:0,gravity:[0,-6,0],endColor:`#ff4d00`,endSize:.5,shape:`streak`,stretch:4,blending:`additive`},dust:{count:450,area:[12,6,8],size:.035,colors:[`#ffffff`,`#fff4dc`],speed:.04,spread:1,wander:.45,twinkle:.35,opacity:.6,shape:`soft`,blending:`additive`},bubbles:{count:160,area:[8,6,4],size:.22,colors:[`#d6f3ff`,`#a9e4ff`],speed:.8,direction:[0,1,0],spread:.25,wander:.18,shape:`bubble`,blending:`normal`,opacity:.85},embers:{count:220,area:[6,.6,4],size:.07,colors:[`#ffb347`,`#ff7b00`,`#ffd27a`],speed:1,direction:[0,1,0],spread:.45,lifetime:3.2,wander:.45,twinkle:.4,endColor:`#c81d00`,endSize:.4,shape:`point`,blending:`additive`},hearts:{count:60,area:[8,4,4],size:.32,colors:[`#ff4d6d`,`#ff8fa3`,`#ff006e`],speed:.6,direction:[0,1,0],spread:.3,lifetime:5,wander:.3,endSize:1.3,shape:`heart`,blending:`normal`},magic:{count:260,area:[6,4,3],size:.13,colors:[`#fff3b0`,`#e9d5ff`,`#a5f3fc`,`#fbcfe8`],speed:.25,direction:[0,1,0],spread:1,lifetime:3.5,wander:.35,twinkle:.9,spin:.15,endSize:.2,shape:`star`,blending:`additive`},smoke:{count:90,area:[1.2,.3,1.2],size:1.1,colors:[`#d9dde3`,`#c3c8d0`,`#eef0f3`],speed:.7,direction:[.12,1,0],spread:.25,lifetime:6,wander:.35,spin:.05,endSize:3.2,endColor:`#f4f5f7`,shape:`smoke`,blending:`normal`,opacity:.4},fire:{count:150,area:[.6,.1,.6],size:.42,colors:[`#ffd27a`,`#ffb347`,`#ff9a3d`],speed:1.9,direction:[0,1,0],spread:.1,lifetime:1,wander:.1,gravity:[0,.6,0],endColor:`#c81d00`,endSize:.12,shape:`smoke`,spin:.2,blending:`additive`,opacity:.5},petals:{count:140,area:[14,8,6],size:.27,colors:[`#ffc2d4`,`#ffb3c6`,`#ffe5ec`,`#ff8fab`],speed:.55,direction:[.35,-1,.1],spread:.4,wander:.6,spin:.35,shape:`petal`,blending:`normal`},leaves:{count:110,area:[14,8,6],size:.26,colors:[`#e76f51`,`#f4a261`,`#e9c46a`,`#bc4b2a`,`#8a9a2b`],speed:.7,direction:[.45,-1,.1],spread:.45,wander:.7,spin:.3,shape:`leaf`,blending:`normal`},galaxyDust:{count:1800,area:[16,2,16],size:.05,colors:[`#a5b4fc`,`#f0abfc`,`#93c5fd`,`#ffffff`],speed:0,wander:.15,twinkle:.5,swirl:.12,opacity:.8,shape:`soft`,blending:`additive`},bokeh:{count:26,area:[16,9,6],size:1.1,colors:[`#ffd6a5`,`#fdffb6`,`#caffbf`,`#9bf6ff`,`#bdb2ff`,`#ffc6ff`],speed:.05,spread:1,wander:.5,twinkle:.3,opacity:.32,shape:`ring`,blending:`additive`}},hr={point:0,square:1,circle:2,star:3,spark:4,heart:5,bubble:6,soft:7,streak:8,smoke:9,petal:10,leaf:11,ring:12},gr=`
114
- uniform float uTime; uniform vec3 uArea; uniform vec3 uVel; uniform float uSpread; uniform float uLife;
115
- uniform float uWander; uniform float uSize; uniform float uViewport; uniform float uTwinkle; uniform float uSpin; uniform float uOpacity;
116
- uniform vec3 uGravity; uniform vec3 uEndColor; uniform float uUseEnd; uniform float uEndSize; uniform float uStretch; uniform float uSwirl;
117
- attribute vec4 aRand;
118
- attribute vec3 color;
119
- varying vec3 vColor; varying float vAlpha; varying float vRot; varying float vFlip; varying float vStretch; varying float vSeed;
120
- void main() {
121
- float speed = length(uVel);
122
- vec3 dir = speed > 0.0 ? uVel / speed : vec3(0.0, 1.0, 0.0);
123
- vec3 jitter = (aRand.xyz - 0.5) * 2.0 * uSpread;
124
- vec3 vel = (dir + jitter) * speed * (0.75 + aRand.w * 0.5);
125
- vec3 hA = uArea * 0.5;
126
- vec3 p;
127
- vec3 v = vel;
128
- float alpha = 1.0;
129
- float age = 0.0;
130
- float t = uTime;
131
- if (uLife > 0.0) {
132
- age = fract(t / uLife + aRand.w);
133
- float life = age * uLife;
134
- p = position * uArea + vel * life + 0.5 * uGravity * life * life;
135
- v = vel + uGravity * life;
136
- alpha = smoothstep(0.0, 0.08, age) * (1.0 - smoothstep(0.6, 1.0, age));
137
- t = life + aRand.x * 50.0;
138
- } else {
139
- p = position * uArea + vel * t;
140
- p = mod(p + hA, max(uArea, vec3(1e-4))) - hA;
141
- }
142
- vec3 ph = aRand.xyz * 6.2831;
143
- p += uWander * vec3(sin(t * (0.5 + aRand.y) + ph.x), 0.6 * sin(t * (0.4 + aRand.z * 0.8) + ph.y), cos(t * (0.45 + aRand.x * 0.7) + ph.z));
144
- if (uLife <= 0.0) {
145
- vec3 q = abs(p) / max(hA, vec3(1e-4));
146
- float edge = max(max(q.x, q.y), q.z);
147
- alpha *= 1.0 - smoothstep(0.85, 1.0, edge);
148
- }
149
- if (uSwirl != 0.0) {
150
- float r = length(p.xz) / max(hA.x, 1e-3);
151
- float a = uSwirl * uTime / (0.25 + r);
152
- float c = cos(a), s = sin(a);
153
- p.xz = mat2(c, s, -s, c) * p.xz;
154
- }
155
- alpha *= 1.0 - uTwinkle * (0.5 + 0.5 * sin(uTime * (1.5 + aRand.x * 4.0) + aRand.y * 6.2831));
156
- vec4 mv = modelViewMatrix * vec4(p, 1.0);
157
- gl_Position = projectionMatrix * mv;
158
- float s = uSize * (0.6 + aRand.z * 0.8) * mix(1.0, uEndSize, age);
159
- float persp = projectionMatrix[3][3] < 0.5 ? 1.0 / max(-mv.z, 1e-3) : 1.0;
160
- float px = s * projectionMatrix[1][1] * uViewport * 0.5 * persp;
161
- // Velocity stretching: orient the sprite along the projected velocity.
162
- vStretch = 1.0;
163
- vRot = uSpin * 6.2831 * uTime * (0.5 + aRand.x) + aRand.y * 6.2831;
164
- if (uStretch > 1.0) {
165
- vec4 c2 = projectionMatrix * (modelViewMatrix * vec4(p + v * 0.03, 1.0));
166
- vec2 d = c2.xy / c2.w - gl_Position.xy / gl_Position.w;
167
- float aspect = projectionMatrix[1][1] / projectionMatrix[0][0];
168
- d *= vec2(uViewport * aspect, uViewport) * 0.5;
169
- vRot = atan(d.y, d.x);
170
- vStretch = clamp(uStretch * clamp(length(d) / max(px, 1.0), 0.3, 1.0), 1.0, uStretch);
171
- px *= vStretch;
172
- }
173
- gl_PointSize = clamp(px, 1.0, 256.0);
174
- vColor = mix(color, uEndColor, uUseEnd * smoothstep(0.1, 0.9, age));
175
- vAlpha = alpha * uOpacity;
176
- vFlip = cos(uSpin * 6.2831 * uTime * (0.4 + aRand.z) + aRand.w * 6.2831);
177
- vSeed = aRand.w * 37.0;
178
- }`,_r=`
179
- uniform int uShape;
180
- varying vec3 vColor; varying float vAlpha; varying float vRot; varying float vFlip; varying float vStretch; varying float vSeed;
181
- float pHash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
182
- float pNoise(vec2 p) { vec2 i = floor(p); vec2 f = fract(p); vec2 u = f * f * (3.0 - 2.0 * f);
183
- return mix(mix(pHash(i), pHash(i + vec2(1.0, 0.0)), u.x), mix(pHash(i + vec2(0.0, 1.0)), pHash(i + vec2(1.0, 1.0)), u.x), u.y); }
184
- void main() {
185
- vec2 uv = gl_PointCoord - 0.5;
186
- uv.y = -uv.y;
187
- float c = cos(vRot), s = sin(vRot);
188
- vec2 r = mat2(c, -s, s, c) * uv;
189
- float a = 0.0;
190
- vec3 col = vColor;
191
- if (uShape == 0) {
192
- float d = length(uv) * 2.0;
193
- a = exp(-d * d * 5.0) * smoothstep(1.0, 0.6, d) + smoothstep(0.22, 0.0, d) * 0.6;
194
- } else if (uShape == 1) {
195
- vec2 q2 = r;
196
- q2.x /= max(abs(vFlip), 0.15);
197
- vec2 q = abs(q2) - vec2(0.32, 0.18);
198
- a = 1.0 - smoothstep(-0.02, 0.02, max(q.x, q.y));
199
- } else if (uShape == 2) {
200
- float d = length(uv);
201
- a = 1.0 - smoothstep(0.36, 0.5, d);
202
- } else if (uShape == 3) {
203
- float c2 = cos(vRot * 0.2), s2 = sin(vRot * 0.2);
204
- vec2 q = mat2(c2, -s2, s2, c2) * uv;
205
- float cr = max(smoothstep(0.07, 0.0, abs(q.x)) * smoothstep(0.5, 0.0, abs(q.y)), smoothstep(0.07, 0.0, abs(q.y)) * smoothstep(0.5, 0.0, abs(q.x)));
206
- float d = length(uv) * 2.0;
207
- a = max(cr, exp(-d * d * 10.0));
208
- } else if (uShape == 4) {
209
- a = smoothstep(0.1, 0.0, abs(uv.x)) * smoothstep(0.5, 0.1, abs(uv.y));
210
- } else if (uShape == 5) {
211
- vec2 h = uv * 2.6;
212
- h.y += 0.15;
213
- float x2 = h.x * h.x, y = h.y;
214
- float f = pow(x2 + y * y - 0.6, 3.0) - x2 * y * y * y * 1.2;
215
- a = 1.0 - smoothstep(-0.02, 0.02, f);
216
- } else if (uShape == 6) {
217
- float d = length(uv);
218
- float ring = smoothstep(0.5, 0.44, d) * smoothstep(0.30, 0.44, d);
219
- float hl = smoothstep(0.12, 0.0, length(uv - vec2(-0.16, 0.16)));
220
- a = max(ring * 0.9 + 0.12 * smoothstep(0.5, 0.0, d), hl);
221
- } else if (uShape == 7) {
222
- // soft round sprite (gaussian)
223
- float d = length(uv) * 2.0;
224
- a = exp(-d * d * 3.5) * smoothstep(1.0, 0.75, d);
225
- } else if (uShape == 8) {
226
- // streak: thin capsule along the velocity, bright head, fading tail
227
- float w = 0.5 / vStretch;
228
- float body = (1.0 - smoothstep(w * 0.35, w, abs(r.y))) * (1.0 - smoothstep(0.38, 0.5, abs(r.x)));
229
- a = body * smoothstep(-0.5, 0.35, r.x);
230
- col += vec3(0.25) * smoothstep(0.2, 0.45, r.x);
231
- } else if (uShape == 9) {
232
- // smoke / flame puff: soft blob broken up by rotating noise
233
- float d = length(uv) * 2.0;
234
- float n = pNoise(r * 3.2 + vSeed) * 0.65 + pNoise(r * 6.5 - vSeed) * 0.35;
235
- a = exp(-d * d * 2.6) * smoothstep(1.0, 0.6, d) * (0.45 + 0.75 * n);
236
- } else if (uShape == 10) {
237
- // petal: rounded teardrop with a notch, lighter centre
238
- vec2 q = vec2(r.x / max(abs(vFlip), 0.25), r.y);
239
- float d = length(vec2(q.x * 1.7, q.y));
240
- float tip = q.y < 0.0 ? length(vec2(q.x * 1.7 * (1.0 + q.y * 1.4), q.y)) : d;
241
- float notch = smoothstep(0.06, 0.0, abs(q.x)) * smoothstep(0.32, 0.44, q.y);
242
- a = (1.0 - smoothstep(0.4, 0.46, tip)) * (1.0 - notch);
243
- col = mix(col * 1.1 + 0.05, col * 0.85, smoothstep(0.0, 0.45, tip));
244
- } else if (uShape == 11) {
245
- // leaf: almond with a midrib
246
- vec2 q = vec2(r.x / max(abs(vFlip), 0.25), r.y);
247
- float d = abs(q.x) * 2.1 + q.y * q.y * 1.6;
248
- a = (1.0 - smoothstep(0.4, 0.45, d)) * (1.0 - smoothstep(0.45, 0.5, abs(q.y)));
249
- col *= 0.85 + 0.25 * smoothstep(0.0, 0.4, d);
250
- col *= 1.0 - 0.35 * smoothstep(0.03, 0.0, abs(q.x)) * step(abs(q.y), 0.4);
251
- } else {
252
- // ring: bokeh disc with a brighter edge
253
- float d = length(uv) * 2.0;
254
- a = (0.55 + 0.3 * smoothstep(0.6, 0.92, d)) * (1.0 - smoothstep(0.82, 1.0, d));
255
- }
256
- a *= vAlpha;
257
- if (a < 0.003) discard;
258
- gl_FragColor = vec4(col, a);
259
- #include <colorspace_fragment>
260
- }`;function vr(e){let t=mr[e.preset??``]??{},n={...pr,...t};return e.count!==void 0&&(n.count=Math.max(1,Math.round(e.count))),e.area&&(n.area=L(e.area,n.area)),e.size!==void 0&&(n.size=e.size),e.color!==void 0&&(n.colors=lt(e.color,n.colors)),e.speed!==void 0&&(n.speed=e.speed),e.direction&&(n.direction=L(e.direction,n.direction)),e.spread!==void 0&&(n.spread=e.spread),e.lifetime!==void 0&&(n.lifetime=e.lifetime),e.opacity!==void 0&&(n.opacity=e.opacity),e.blending&&(n.blending=e.blending),e.shape&&(n.shape=e.shape),n}function yr(e,t){let n=vr(e),r=n.count,i=new Float32Array(r*3),a=new Float32Array(r*4),o=new Float32Array(r*3),s=n.colors.map(e=>V(e));for(let e=0;e<r;e++){i[e*3]=t.next()-.5,i[e*3+1]=t.next()-.5,i[e*3+2]=t.next()-.5;for(let n=0;n<4;n++)a[e*4+n]=t.next();let n=s[Math.floor(t.next()*s.length)%s.length];o[e*3]=n.r,o[e*3+1]=n.g,o[e*3+2]=n.b}let c=new Ae;c.setAttribute(`position`,new Me(i,3)),c.setAttribute(`aRand`,new Me(a,4)),c.setAttribute(`color`,new Me(o,3));let l=new E(...n.direction);l.lengthSq()<1e-9&&l.set(0,1,0),l.normalize().multiplyScalar(n.speed);let u=new E(...n.area).multiplyScalar(.5);c.boundingBox=new A(u.clone().negate(),u.clone()),c.boundingSphere=new Ne(new E,u.length());let d=new P({uniforms:{uTime:{value:0},uArea:{value:new E(...n.area)},uVel:{value:l},uSpread:{value:n.spread},uLife:{value:Math.max(0,n.lifetime)},uWander:{value:n.wander},uSize:{value:n.size},uViewport:{value:600},uTwinkle:{value:n.twinkle},uSpin:{value:n.spin},uOpacity:{value:B(n.opacity,1)},uShape:{value:hr[n.shape]??7},uGravity:{value:new E(...n.gravity)},uEndColor:{value:n.endColor?V(n.endColor).clone():new D(1,1,1)},uUseEnd:{value:+!!n.endColor},uEndSize:{value:n.endSize},uStretch:{value:n.stretch},uSwirl:{value:n.swirl}},vertexShader:gr,fragmentShader:_r,transparent:!0,depthWrite:!1,blending:n.blending===`additive`?2:1});d.toneMapped=!1;let f=new xe(c,d);return f.frustumCulled=!1,f.renderOrder=10,{points:f,update(e){d.uniforms.uTime.value=e},setViewport(e){d.uniforms.uViewport.value=e}}}function br(e){return Array.isArray(e)?e:typeof e==`number`?[e,e,e]:null}function Z(e,t,n=1){let r=e;return t?t!==`x`&&t!==`y`&&t!==`z`?{get:()=>void 0,set:()=>void 0}:{get:()=>r[t]/n,set:e=>{typeof e==`number`&&(r[t]=e*n)}}:{get:()=>[r.x/n,r.y/n,r.z/n],set:t=>{let r=br(t);r&&e.set(r[0]*n,r[1]*n,r[2]*n)}}}function xr(e){return{get:()=>e()?.clone(),set:t=>{let n=e();n&&t instanceof D&&n.copy(t)}}}function Sr(e,t,n=1){return{get:()=>typeof e[t]==`number`?e[t]/n:void 0,set:r=>{typeof r==`number`?e[t]=r*n:typeof r==`boolean`&&typeof e[t]==`boolean`&&(e[t]=r)}}}function Cr(e,t){let n=null,r=()=>n??=rt(e);if(t.startsWith(`uniforms.`)){let e=t.slice(9);return{get(){let t=r()[0]?.uniforms?.[e];if(t)return t.value instanceof D?t.value.clone():t.value instanceof E?[t.value.x,t.value.y,t.value.z]:typeof t.value==`number`?t.value:void 0},set(t){for(let n of r()){let r=n.uniforms?.[e];r&&(t instanceof D?r.value instanceof D&&r.value.copy(t):Array.isArray(t)&&r.value?.set?r.value.set(...t):r.value=t)}}}}if(t===`envMapIntensity`){let e=()=>r().filter(e=>e.isMeshStandardMaterial);return{get:()=>{let t=e()[0];return t?nn(t).value:void 0},set:t=>{if(typeof t==`number`)for(let n of e())nn(n).value=t}}}if(t===`anisotropyRotation`||t===`iridescenceIOR`){let e=t===`anisotropyRotation`?R:1;return{get(){let n=r()[0]?.[t];return typeof n==`number`?n/e:void 0},set(n){if(typeof n==`number`)for(let i of r())t in i&&(i[t]=n*e)}}}return{get(){let e=r()[0]?.[t];return e instanceof D?e.clone():typeof e==`number`||typeof e==`boolean`?e:void 0},set(e){for(let n of r()){let r=n,i=r[t];i instanceof D?e instanceof D&&i.copy(e):(typeof e==`number`||typeof e==`boolean`)&&t in r&&(r[t]=e,t===`opacity`&&typeof e==`number`&&e<1&&!n.transparent&&(n.transparent=!0,n.needsUpdate=!0))}}}}function wr(e,t){let n=null,r=()=>(n||(n=[],e.traverse(e=>{let r=e,i=r.morphTargetDictionary?.[t];r.isMesh&&i!==void 0&&r.morphTargetInfluences&&n.push({m:r,i})})),n);return{get:()=>{let e=r()[0];return e?e.m.morphTargetInfluences[e.i]:void 0},set:e=>{if(typeof e==`number`)for(let t of r())t.m.morphTargetInfluences[t.i]=e}}}var Tr={get:()=>void 0,set:()=>void 0};function Er(e,t,n,r=t){let i=e=>(n.issue(`timeline-target`,e,r),null);if(e===`camera`){let e=n.camera;return e?t.startsWith(`position`)?Z(e.position,t.slice(9)):t.startsWith(`target`)?Z(e.target,t.slice(7)):t===`fov`||t===`zoom`||t===`focus`?Sr(e,t):i(`Camera property "${t}" is not animatable`):null}if(e===`environment`){let e=n.scene;if(!e)return null;switch(t){case`fog.color`:return xr(()=>e.fog?.color);case`fog.near`:case`fog.far`:case`fog.density`:return{get:()=>e.fog?.[t.slice(4)],set:n=>e.fog&&typeof n==`number`&&(e.fog[t.slice(4)]=n)};case`lightingIntensity`:return Sr(e,`environmentIntensity`);case`background`:return xr(()=>e.background instanceof D?e.background:null);case`exposure`:return n.renderer?Sr(n.renderer,`toneMappingExposure`):Tr}return i(`Environment property "${t}" is not animatable`)}if(e===`postfx`){let[e,r]=t.split(`.`),a=n.postfx;if(!e||!r)return i(`Post effect track "${t}" must be "postfx.<type>.<param>"`);let o;return{get:()=>{if(o!==void 0)return o;let t=a?.base(e,r);return typeof t==`number`?t:void 0},set:t=>{o=t,a?.set(e,r,t instanceof D?`#${t.getHexString()}`:t)}}}let a=n.object(e);if(!a)return i(`Timeline track targets unknown object "${e}"`);let[o,...s]=t.split(`.`),c=s.join(`.`);switch(o){case`position`:return Z(a.position,c);case`rotation`:return Z(a.rotation,c,R);case`scale`:return Z(a.scale,c);case`visible`:return{get:()=>a.visible,set:e=>a.visible=typeof e==`boolean`?e:typeof e==`number`?e>.5:a.visible};case`material`:return Cr(a,c);case`morph`:return wr(a,c);case`animation`:{let r=n.clips?.(e),a=s[s.length-1],o=s.slice(0,-1).join(`.`);return r?!o||![`weight`,`speed`,`time`].includes(a)?i(`Animation track "${t}" must be "animation.<clip>.weight|speed|time"`):{get:()=>a===`weight`?0:+(a===`speed`),set:e=>typeof e==`number`&&r[a](o,e)}:i(`"${e}" has no animation clips (animation tracks need a model with clips)`)}case`target`:{let e=a.target;if(e)return Z(e.position,c);break}case`angle`:if(a.isSpotLight)return Sr(a,`angle`,R)}let l=a;return o in l?{get(){let e=l[o];return e instanceof D?e.clone():e instanceof E?Z(e,c).get():typeof e==`number`||typeof e==`boolean`?e:void 0},set(e){let t=l[o];t instanceof D&&e instanceof D?t.copy(e):t instanceof E?Z(t,c).set(e):(typeof t==`number`&&typeof e==`number`||typeof t==`boolean`&&typeof e==`boolean`)&&(l[o]=e)}}:i(`Unknown property "${t}" on "${e}"`)}var Dr=new Set([`camera`,`environment`,`postfx`]);function Or(e,t){return Dr.has(e)?[e]:e.includes(`,`)||e.startsWith(`tag:`)||e.startsWith(`children:`)?t.select?t.select(e):e.split(`,`).map(e=>e.trim()).filter(Boolean):[e]}function kr(e,t){let{id:n,path:r}=In(e.target),i=Or(n,t);if(!i.length)return t.issue(`timeline-target`,`Track selector "${n}" matches no object`,`timeline.tracks[${e.target}]`),[];let a=Ln(i.length,e.staggerFrom,t.seed??1),o=typeof e.stagger==`number`?e.stagger:0,s=[];return i.forEach((n,i)=>{let c=Er(n,r,t,`timeline.tracks[${e.target}]`);if(!c)return;let l=On(e.keys,c.get()),u=o*a[i];u&&(l=l.map(e=>[e[0]+u,e[1],e[2]])),s.push({id:n,keys:l,ease:e.ease,colorSpace:e.colorSpace,set:c.set})}),s}function Ar(e,t){let n=(e.tracks??[]).flatMap(e=>kr(e,t));return{def:e,targets:new Set(n.map(e=>e.id).filter(e=>!Dr.has(e))),animatesCamera:n.some(e=>e.id===`camera`),apply(e){for(let t of n){let n=Fn(t.keys,e,t.ease,t.colorSpace);n!==void 0&&t.set(n)}}}}function jr(e){if(e!==void 0)return typeof e==`object`&&!Array.isArray(e)?`#${e.getHexString()}`:e}var Mr=class{host;list=new Map;constructor(e){this.host=e}get size(){return this.list.size}idsOf(e){return Or(In(e).id,this.host)}set(e,t,n,r=0,i){let{id:a,path:o}=In(e);for(let s of Or(a,this.host)){let a=`${s}.${o}`,c=this.list.get(a),l=c?.acc??Er(s,o,this.host,`interactions:${e}`);if(!l)continue;let u=c?.last??l.get(),[[,d]]=On([[0,t]],u),f=jr(u)??d;this.list.set(a,{acc:l,from:f,to:d,start:n,duration:Math.max(0,r),ease:i,orig:c?c.orig:l.get(),last:u})}}apply(e){for(let t of this.list.values()){let n=t.duration>0?d(t.ease??`outCubic`,(e-t.start)/t.duration):1,r=typeof t.to==`boolean`||typeof t.from==`boolean`?n>=1?t.to:t.from:Nn(t.from,t.to,e<t.start?0:n),i=typeof r==`string`?Nn(r,r,1):r;t.acc.set(i),t.last=i}}reset(){for(let e of this.list.values())e.orig!==void 0&&e.acc.set(e.orig);this.list.clear()}},Nr=new E(0,1,0);function Pr(e){return Array.isArray(e)&&e.length===3&&e.every(e=>typeof e==`number`)?new E(e[0],e[1],e[2]):null}var Fr=new WeakMap;function Ir(e,t){let n=(e.points??[]).map(Pr).filter(e=>!!e);if(!n.length)return null;let r=`${t.x},${t.y},${t.z}`,i=Fr.get(e);if(i&&i.key===r)return i.curve;let a=new et([t.clone(),...n],!1,`centripetal`);return Fr.set(e,{key:r,curve:a}),a}function Lr(e,t,n,r){let i=n.position,a=n.target,o=a.clone().sub(i),s=o.length()||1,c=o.clone().divideScalar(s),l=new E().crossVectors(c,Nr);l.lengthSq()<1e-8&&l.set(1,0,0),l.normalize();let u=typeof e.fov==`number`?e.fov:null;switch(e.type){case`dolly`:case`pushIn`:case`pullOut`:{let n=typeof e.distance==`number`?e.distance:e.type===`pullOut`?s*.33:s*.25;e.type===`pullOut`&&(n=-Math.abs(n)),n=Math.min(n,s-.05),i.addScaledVector(c,n*t);break}case`truck`:{let n=(e.distance??1)*t;i.addScaledVector(l,n),a.addScaledVector(l,n);break}case`pedestal`:{let n=(e.distance??1)*t;i.y+=n,a.y+=n;break}case`crane`:if(i.y+=(e.height??2)*t,typeof e.distance==`number`){let n=new E(c.x,0,c.z);n.lengthSq()>1e-8&&i.addScaledVector(n.normalize(),e.distance*t)}break;case`orbit`:{let n=i.clone().sub(a);if(n.applyAxisAngle(Nr,(e.angle??90)*R*t),e.elevation){let r=new Te().setFromVector3(n);r.phi=Math.min(Math.max(r.phi-e.elevation*R*t,.01),Math.PI-.01),n.setFromSpherical(r)}typeof e.distance==`number`&&n.setLength(Math.max(.05,n.length()+e.distance*t)),i.copy(a).add(n);break}case`move`:{let n=Pr(e.position),r=Pr(e.target);n&&i.lerp(n,t),r&&a.lerp(r,t);break}case`path`:{let n=Ir(e,i);if(!n)break;let o=n.getPointAt(Math.min(Math.max(t,0),1)),s=typeof e.lookAt==`string`?r.objectPosition(e.lookAt):Pr(e.lookAt);if(s)a.lerp(s,Math.min(1,t*4));else{let r=Math.min(Math.max(e.lookAhead??.05,.001),.5),i=Math.min(t+r,1),o=n.getPointAt(i);i>=1&&o.add(n.getTangentAt(1).multiplyScalar(r*n.getLength())),a.lerp(o,Math.min(1,t*6))}i.copy(o);break}case`lookAt`:{let n=e.object?r.objectPosition(e.object):Pr(e.target);n&&a.lerp(n,t);break}case`focus`:{let a=typeof e.focus==`number`?e.focus:null;if(e.object){let t=r.objectPosition(e.object);t&&(a=t.distanceTo(i))}a!==null&&(n.focus=(n.focus??a)+(a-(n.focus??a))*t);break}}u!==null&&(n.fov+=(u-n.fov)*t)}function Rr(e){return[...e??[]].filter(e=>e&&typeof e.at==`number`&&typeof e.duration==`number`).sort((e,t)=>e.at-t.at)}function zr(e,t,n,r){let i={position:n.position.clone(),target:n.target.clone(),fov:n.fov,focus:n.focus};for(let n of e){if(t<n.at)break;let e=n.duration>0?(t-n.at)/n.duration:1;Lr(n,d(n.ease??`inOutCubic`,e),i,r)}return i}var Br=`
261
- vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
262
- vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
263
- vec4 permute(vec4 x) { return mod289(((x * 34.0) + 10.0) * x); }
264
- vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }
265
- float snoise(vec3 v) {
266
- const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);
267
- const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
268
- vec3 i = floor(v + dot(v, C.yyy));
269
- vec3 x0 = v - i + dot(i, C.xxx);
270
- vec3 g = step(x0.yzx, x0.xyz);
271
- vec3 l = 1.0 - g;
272
- vec3 i1 = min(g.xyz, l.zxy);
273
- vec3 i2 = max(g.xyz, l.zxy);
274
- vec3 x1 = x0 - i1 + C.xxx;
275
- vec3 x2 = x0 - i2 + C.yyy;
276
- vec3 x3 = x0 - D.yyy;
277
- i = mod289(i);
278
- vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0)) + i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));
279
- float n_ = 0.142857142857;
280
- vec3 ns = n_ * D.wyz - D.xzx;
281
- vec4 j = p - 49.0 * floor(p * ns.z * ns.z);
282
- vec4 x_ = floor(j * ns.z);
283
- vec4 y_ = floor(j - 7.0 * x_);
284
- vec4 x = x_ * ns.x + ns.yyyy;
285
- vec4 y = y_ * ns.x + ns.yyyy;
286
- vec4 h = 1.0 - abs(x) - abs(y);
287
- vec4 b0 = vec4(x.xy, y.xy);
288
- vec4 b1 = vec4(x.zw, y.zw);
289
- vec4 s0 = floor(b0) * 2.0 + 1.0;
290
- vec4 s1 = floor(b1) * 2.0 + 1.0;
291
- vec4 sh = -step(h, vec4(0.0));
292
- vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
293
- vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
294
- vec3 p0 = vec3(a0.xy, h.x);
295
- vec3 p1 = vec3(a0.zw, h.y);
296
- vec3 p2 = vec3(a1.xy, h.z);
297
- vec3 p3 = vec3(a1.zw, h.w);
298
- vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
299
- p0 *= norm.x;
300
- p1 *= norm.y;
301
- p2 *= norm.z;
302
- p3 *= norm.w;
303
- vec4 m = max(0.5 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);
304
- m = m * m;
305
- return 105.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
306
- }
307
- float fbm(vec3 p) {
308
- float s = 0.0;
309
- float a = 0.5;
310
- for (int i = 0; i < 5; i++) {
311
- s += a * snoise(p);
312
- p = p * 2.02 + vec3(1.7, 9.2, 3.1);
313
- a *= 0.5;
314
- }
315
- return s;
316
- }
317
- `,Vr=`
318
- uniform vec3 uMgColors[6];
319
- uniform int uMgCount;
320
- uniform float uMgScale;
321
- uniform float uMgSeed;
322
- uniform vec2 uMgSpread; // spreads the colour points over wide / tall surfaces
323
- vec3 meshGradient(vec2 p, float t) {
324
- p /= max(uMgScale, 0.05);
325
- vec2 w = vec2(snoise(vec3(p * 1.1, t * 0.17 + uMgSeed)), snoise(vec3(p * 1.1 + 7.3, t * 0.17 + uMgSeed + 3.1)));
326
- p += w * 0.22;
327
- vec3 acc = vec3(0.0);
328
- float wsum = 0.0;
329
- for (int i = 0; i < 6; i++) {
330
- if (i >= uMgCount) break;
331
- float fi = float(i) + uMgSeed * 1.37;
332
- vec2 c = vec2(sin(fi * 2.39996 + 0.4) * 0.62, cos(fi * 3.1199 + 1.1) * 0.48);
333
- c += 0.3 * vec2(sin(t * (0.31 + 0.07 * fi) + fi * 1.9), cos(t * (0.27 + 0.05 * fi) + fi * 2.7));
334
- c *= uMgSpread;
335
- float d2 = dot(p - c, p - c);
336
- float wt = 1.0 / ((d2 + 0.12) * (d2 + 0.12));
337
- acc += uMgColors[i] * wt;
338
- wsum += wt;
339
- }
340
- return acc / max(wsum, 1e-5);
341
- }
342
- float mgGrain(vec2 frag, float t) {
343
- vec3 p = fract(vec3(frag, t * 0.37) * vec3(0.1031, 0.1030, 0.0973));
344
- p += dot(p, p.yzx + 33.33);
345
- return fract((p.x + p.y) * p.z) - 0.5;
346
- }
347
- `,Hr=`
348
- varying vec2 vUv;
349
- void main() { vUv = uv; gl_Position = vec4(position.xy, 0.0, 1.0); }`,Ur=`
350
- uniform sampler2D tDiffuse;
351
- uniform vec2 uDir;
352
- varying vec2 vUv;
353
- void main() {
354
- vec4 s = texture2D(tDiffuse, vUv) * 0.2270270270;
355
- s += texture2D(tDiffuse, vUv + uDir * 1.3846153846) * 0.3162162162;
356
- s += texture2D(tDiffuse, vUv - uDir * 1.3846153846) * 0.3162162162;
357
- s += texture2D(tDiffuse, vUv + uDir * 3.2307692308) * 0.0702702703;
358
- s += texture2D(tDiffuse, vUv - uDir * 3.2307692308) * 0.0702702703;
359
- gl_FragColor = s;
360
- }`,Wr=`
361
- varying vec2 vUv;
362
- void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`,Gr=`
363
- uniform sampler2D tShadow;
364
- uniform vec3 uColor;
365
- uniform float uOpacity;
366
- varying vec2 vUv;
367
- void main() {
368
- // The shadow camera looks up (+Y) with +Z as its up axis: flip V onto the plane.
369
- float a = texture2D(tShadow, vec2(vUv.x, 1.0 - vUv.y)).a;
370
- float fade = 1.0 - smoothstep(0.32, 0.5, length(vUv - 0.5));
371
- gl_FragColor = vec4(uColor, clamp(a, 0.0, 1.0) * uOpacity * fade);
372
- #include <colorspace_fragment>
373
- }`;function Kr(e,t,n,r){let i=r.renderer;if(!i)return null;let a=typeof e==`object`?e:{},o=2**Math.round(Math.log2(Math.max(128,Math.min(2048,B(a.resolution,512))))),s={type:ie,depthBuffer:!0},c=new ye(o,o,s),l=new ye(o,o,{...s,depthBuffer:!1});c.texture.generateMipmaps=l.texture.generateMipmaps=!1;let u=new be;u.name=`__contactShadows`,u.userData.helper=!0;let d=new P({uniforms:{tShadow:{value:c.texture},uColor:{value:V(a.color??`#000000`)},uOpacity:{value:B(a.opacity,.6)}},vertexShader:Wr,fragmentShader:Gr,transparent:!0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-4}),f=new O(new k(1,1),d);f.rotation.x=-Math.PI/2,f.renderOrder=-10,f.userData.helper=!0,u.add(f);let p=new ce(-.5,.5,.5,-.5,0,1);p.rotation.x=Math.PI/2,u.add(p);let m=new $e({depthTest:!0,depthWrite:!0,side:2});m.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(`gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );`,`gl_FragColor = vec4( vec3( 0.0 ), pow( clamp( 1.0 - fragCoordZ, 0.0, 1.0 ), 2.2 ) * 1.6 );`)},m.customProgramCacheKey=()=>`agent3d-contact-depth`;let h=new P({uniforms:{tDiffuse:{value:null},uDir:{value:new C}},vertexShader:Hr,fragmentShader:Ur,depthTest:!1,depthWrite:!1}),g=new O(new k(2,2),h);g.frustumCulled=!1;let _=new Ue;_.add(g);let v=new ce(-1,1,1,-1,0,1),y=B(a.blur,2.5),ee=Math.max(0,Math.round(B(a.frames,0))),b=0,x=!1,S=()=>{x=!0;let e=new A,r=new A;t.updateMatrixWorld(!0);for(let n of t.children)n.userData.helper||n===u||n.isLight||(Qr(n,r),r.isEmpty()||r.getSize(new E).length()>200||e.union(r));e.isEmpty()&&e.set(new E(-1,0,-1),new E(1,1,1));let i=e.getSize(new E),o=e.getCenter(new E),s=a.y??n??e.min.y,c=a.size??Math.max(i.x,i.z,.5)*2.2+.5,l=a.far??Math.max(.3,Math.min(Xr(t,s,Math.max(.05,i.y*.08))??i.y,c)*.9),d=Array.isArray(a.center)?a.center:[o.x,o.z];u.position.set(d[0],s+.001,d[1]),f.scale.set(c,c,1),p.left=-c/2,p.right=c/2,p.top=c/2,p.bottom=-c/2,p.position.y=-Jr,p.near=0,p.far=l+Jr,p.updateProjectionMatrix(),te=s+l*qr,ne=s+.002},te=1/0,ne=-1/0,re=new A,ae=e=>{h.uniforms.tDiffuse.value=c.texture,h.uniforms.uDir.value.set(e/o,0),i.setRenderTarget(l),i.render(_,v),h.uniforms.tDiffuse.value=l.texture,h.uniforms.uDir.value.set(0,e/o),i.setRenderTarget(c),i.render(_,v)};return r.onUpdate(()=>{if(x||S(),ee>0&&b>=ee)return;b++;let e=[];t.updateMatrixWorld(),t.traverse(t=>{t.visible&&(t.userData.helper||t.isPoints||t.isSprite?e.push(t):t.isMesh&&(Yr(t,re),(re.min.y>te||re.max.y<=ne)&&e.push(t)))});for(let t of e)t.visible=!1;let n={target:i.getRenderTarget(),bg:t.background,override:t.overrideMaterial,fog:t.fog,clearAlpha:i.getClearAlpha(),clearColor:i.getClearColor(new D),shadowAuto:i.shadowMap.autoUpdate,xr:i.xr.enabled};t.background=null,t.fog=null,t.overrideMaterial=m,i.shadowMap.autoUpdate=!1,i.setClearColor(0,0),u.updateMatrixWorld(!0),i.setRenderTarget(c),i.clear(),i.render(t,p),t.overrideMaterial=null,ae(y),ae(y*.4),i.setRenderTarget(n.target),i.setClearColor(n.clearColor,n.clearAlpha),i.shadowMap.autoUpdate=n.shadowAuto,t.overrideMaterial=n.override,t.background=n.bg,t.fog=n.fog;for(let t of e)t.visible=!0}),{object:u,dispose(){c.dispose(),l.dispose(),d.dispose(),m.dispose(),h.dispose(),f.geometry.dispose(),g.geometry.dispose()}}}var qr=.6,Jr=.003;function Yr(e,t){if(e.isInstancedMesh){let n=e;return n.boundingBox||n.computeBoundingBox(),t.copy(n.boundingBox).applyMatrix4(n.matrixWorld)}return e.geometry.boundingBox||e.geometry.computeBoundingBox(),t.copy(e.geometry.boundingBox).applyMatrix4(e.matrixWorld)}function Xr(e,t,n){let r,i=new A;return e.updateMatrixWorld(!0),e.traverseVisible(e=>{let a=e;!a.isMesh||!a.geometry||e.userData.helper||e.isPoints||e.isSprite||e.isLine||e.parent&&Zr(e)||(Yr(a,i),i.isEmpty()||i.min.y>t+n||i.max.y-t>200||(r=Math.max(r??0,i.max.y-t)))}),r}function Zr(e){for(let t=e;t;t=t.parent)if(t.userData.helper||t.name===`__contactShadows`)return!0;return!1}function Qr(e,t=new A){t.makeEmpty();let n=new A;e.updateWorldMatrix(!0,!0);let r=e=>{if(!e.visible||e.userData.helper||e.isPoints||e.isSprite||e.isLine)return;let i=e;if(i.isMesh&&i.geometry){if(i.geometry.boundingBox||i.geometry.computeBoundingBox(),i.isInstancedMesh){let e=i;e.boundingBox||e.computeBoundingBox(),n.copy(e.boundingBox).applyMatrix4(e.matrixWorld)}else n.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld);t.union(n)}for(let t of e.children)r(t)};return r(e),t}var $r=`
374
- uniform float uA3dFogHeight;
375
- uniform float uA3dFogFalloff;
376
- varying vec3 vA3dFogWorld;
377
- float a3dHeightFog(float density) {
378
- vec3 ro = cameraPosition;
379
- vec3 d = vA3dFogWorld - ro;
380
- float dist = length(d);
381
- vec3 rd = d / max(dist, 1e-4);
382
- float b = max(uA3dFogFalloff, 1e-4);
383
- float h = ro.y - uA3dFogHeight;
384
- float amount;
385
- if (abs(rd.y) < 1e-4) amount = density * exp(-h * b) * dist;
386
- else amount = (density / b) * exp(-h * b) * (1.0 - exp(-dist * rd.y * b)) / rd.y;
387
- return 1.0 - exp(-max(amount, 0.0));
388
- }
389
- `;function ei(e,t){e.fog&&!e.isShaderMaterial&&K(e,`height-fog`,e=>{Object.assign(e.uniforms,t),e.vertexShader.includes(`#include <fog_vertex>`)&&(e.vertexShader=e.vertexShader.replace(`#include <common>`,`#include <common>
390
- varying vec3 vA3dFogWorld;`).replace(`#include <fog_vertex>`,`#include <fog_vertex>
391
- {
392
- vec4 a3dW = vec4( transformed, 1.0 );
393
- #ifdef USE_INSTANCING
394
- a3dW = instanceMatrix * a3dW;
395
- #endif
396
- vA3dFogWorld = ( modelMatrix * a3dW ).xyz;
397
- }`),e.fragmentShader=e.fragmentShader.replace(`#include <common>`,`#include <common>
398
- `+$r).replace(`#include <fog_fragment>`,`#ifdef USE_FOG
399
- #ifdef FOG_EXP2
400
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, a3dHeightFog( fogDensity ) );
401
- #else
402
- #include <fog_fragment>
403
- #endif
404
- #endif`))})}function ti(e,t){e.traverse(e=>{let n=e.material;if(n)for(let e of Array.isArray(n)?n:[n])e.userData.a3dHeightFog||(e.userData.a3dHeightFog=!0,ei(e,t))})}function ni(e,t){if(e.userData.a3dHeightFog=t,!t||e.userData.a3dHeightFogHook)return;e.userData.a3dHeightFogHook=!0;let n=e.onBeforeRender;e.onBeforeRender=function(...t){let r=e.userData.a3dHeightFog;r&&ti(e,r),n.apply(this,t)}}var ri=null;function ii(){return ri??=s(()=>import(`./RectAreaLightUniformsLib-CZHWO9xf.js`).then(e=>e.RectAreaLightUniformsLib.init()),__vite__mapDeps([7,1]),import.meta.url),ri}var ai={ambient:.4,directional:2.5,point:15,spot:40,hemisphere:.8,rect:6},oi={softness:4,mapSize:2048,pointMapSize:1024};function si(e){let t=e.environment,n=t?.background,r=n&&typeof n==`object`?n.sky:void 0,i=!!r&&(r.physical||r.preset)&&r.sun!==!1&&r.sun?.light!==!1&&r.sun?.castShadow!==!1,a=t?.rig,o=!!a&&(typeof a==`string`||a.castShadow!==!1),s=(e.lights??[]).some(e=>e.castShadow)||!!i||o;return{enabled:e.target?.shadows!==!1&&s,type:t?.shadows?.type===`vsm`?3:1}}function ci(e,t,n){e.castShadow=!0;let r=e.shadow,i=t.shadow??{},a=e instanceof ae,o=B(i.mapSize,B(n?.mapSize,a?oi.pointMapSize:oi.mapSize)),s=2**Math.round(Math.log2(Math.max(256,Math.min(4096,o))));r.mapSize.set(s,s),r.bias=B(i.bias,-4e-4),r.normalBias=B(i.normalBias,.02),r.radius=Math.max(0,B(i.softness,B(n?.softness,oi.softness))),n?.type===`vsm`&&(r.blurSamples=16);let c=i.intensity??n?.intensity;c!==void 0&&(r.intensity=c),e.userData.fixedNormalBias=i.normalBias!==void 0}function li(e){let t=()=>Math.max(1,Math.min(1.6,e.intensity/6)),n=e.color.clone().multiplyScalar(t()),r=new y({color:n,side:2}),i=new O(new k(1,1),r);return i.scale.set(e.width,e.height,1),i.name=`__rectPanel`,i.userData.helper=!0,i.castShadow=!1,i.receiveShadow=!1,i.onBeforeRender=()=>{i.scale.set(e.width,e.height,1),r.color.copy(e.color).multiplyScalar(t())},i}var ui=`
405
- varying float vAlong;
406
- varying vec3 vN;
407
- varying vec3 vV;
408
- varying float vWorldY;
409
- varying float vViewZ;
410
- #include <common>
411
- #include <fog_pars_vertex>
412
- void main() {
413
- vAlong = position.z;
414
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
415
- vN = normalize(normalMatrix * normal);
416
- vV = normalize(-mv.xyz);
417
- vWorldY = (modelMatrix * vec4(position, 1.0)).y;
418
- vViewZ = -mv.z;
419
- gl_Position = projectionMatrix * mv;
420
- #include <fog_vertex>
421
- }`,di=`
422
- uniform vec3 uColor;
423
- uniform float uIntensity;
424
- uniform sampler2D uDepth;
425
- uniform float uUseDepth;
426
- uniform vec2 uViewport;
427
- uniform float uNear;
428
- uniform float uFar;
429
- uniform float uOrtho;
430
- uniform float uGroundY;
431
- uniform float uUseGround;
432
- uniform float uSoft;
433
- varying float vAlong;
434
- varying vec3 vN;
435
- varying vec3 vV;
436
- varying float vWorldY;
437
- varying float vViewZ;
438
- #include <common>
439
- #include <fog_pars_fragment>
440
- float a3dSceneViewZ(float d) {
441
- if (uOrtho > 0.5) return uNear + d * (uFar - uNear);
442
- return uNear * uFar / max(uFar - d * (uFar - uNear), 1e-6);
443
- }
444
- void main() {
445
- float facing = abs(dot(normalize(vN), normalize(vV)));
446
- float edge = pow(facing, 2.2);
447
- float fall = pow(1.0 - clamp(vAlong, 0.0, 1.0), 1.6) * smoothstep(0.0, 0.06, vAlong);
448
- float soft = 1.0;
449
- if (uUseDepth > 0.5) {
450
- float sceneZ = a3dSceneViewZ(texture2D(uDepth, gl_FragCoord.xy / uViewport).x);
451
- soft *= smoothstep(0.0, uSoft, sceneZ - vViewZ);
452
- }
453
- if (uUseGround > 0.5) soft *= smoothstep(0.0, uSoft, vWorldY - uGroundY);
454
- float a = edge * fall * soft * uIntensity * 0.22;
455
- // Pure added light: alpha 0 (premultiplied additive) so the cone never
456
- // writes coverage — in the post-effect pipeline that hid the background
457
- // behind the cone (dark rims along its silhouette).
458
- gl_FragColor = vec4(uColor * a, 0.0);
459
- #include <tonemapping_fragment>
460
- #include <colorspace_fragment>
461
- #ifdef USE_FOG
462
- float fogF = smoothstep( fogNear, fogFar, vFogDepth );
463
- gl_FragColor.rgb *= 1.0 - fogF;
464
- #endif
465
- }`;function fi(e,t){let n=typeof t.volumetric==`object`?t.volumetric:{},r=new S(1,0,1,48,24,!0);r.translate(0,.5,0),r.rotateX(Math.PI/2);let i=new P({uniforms:{...ue.clone(Ge.fog),uColor:{value:V(n.color??t.color??`#ffffff`)},uIntensity:{value:B(n.intensity,1)},uDepth:{value:null},uUseDepth:{value:0},uViewport:{value:new C(1,1)},uNear:{value:.1},uFar:{value:1e3},uOrtho:{value:0},uGroundY:{value:0},uUseGround:{value:0},uSoft:{value:.5}},vertexShader:ui,fragmentShader:di,transparent:!0,depthWrite:!1,blending:2,premultipliedAlpha:!0,side:2,fog:!1}),a=new O(r,i);a.name=`__volumetric`,a.userData.helper=!0,a.castShadow=!1,a.receiveShadow=!1,a.frustumCulled=!1;let o=typeof t.volumetric==`object`?t.volumetric.length:void 0,s=new E,c=new E,l=B(n.intensity,1),u=Math.max(e.intensity,.001),d,f=new E;return a.onBeforeRender=(t,r,p)=>{e.getWorldPosition(s),e.target.getWorldPosition(c);let m=o??Math.max(.5,s.distanceTo(c)*1.25),h=i.uniforms;h.uSoft.value=Math.max(.05,m*.12);let g=r.userData.a3dDepth,_=p;g&&t.getRenderTarget()?(h.uDepth.value=g.texture,h.uUseDepth.value=1,h.uViewport.value.set(g.width,g.height),h.uNear.value=_.near,h.uFar.value=_.far,h.uOrtho.value=+!!_.isOrthographicCamera):(h.uDepth.value=null,h.uUseDepth.value=0),(d===void 0||d&&!d.parent)&&(d=null,r.traverse(e=>{!d&&e.userData.ground&&(d=e)})),d&&d.visible?(d.getWorldPosition(f),h.uGroundY.value=f.y,h.uUseGround.value=1):(h.uGroundY.value=c.y,h.uUseGround.value=+(!o&&c.y<s.y-.1));let v=Math.tan(Math.min(e.angle,1.5))*m,y=new N().setFromUnitVectors(new E(0,0,1),c.clone().sub(s).normalize()),ee=e.getWorldQuaternion(new N).invert();a.quaternion.copy(ee.multiply(y)),a.scale.set(v,v,m),a.position.set(0,0,0),a.updateMatrixWorld(!0),i.uniforms.uColor.value.copy(n.color?V(n.color):e.color),i.uniforms.uIntensity.value=l*Math.min(3,e.intensity/u)},a}async function pi(e,t){let n=V(e.color??`#ffffff`),r=B(e.intensity,ai[e.type]??1),i;switch(e.type){case`ambient`:i=new He(n,r);break;case`hemisphere`:i=new se(V(e.skyColor??e.color??`#ffffff`),V(e.groundColor??`#444444`),r),i.position.set(0,10,0);break;case`point`:i=new ae(n,r,B(e.distance,0),B(e.decay,2));break;case`spot`:i=new I(n,r,B(e.distance,0),B(e.angle,30)*R,B(e.penumbra,.3),B(e.decay,2));break;case`rect`:await ii(),i=new Oe(n,r,B(e.width,2),B(e.height,2));break;default:i=new w(n,r)}let a=e.position??(e.type===`directional`?[5,10,7]:e.type===`spot`?[3,6,4]:[0,3,3]);e.type!==`ambient`&&e.type!==`hemisphere`&&i.position.set(a[0],a[1],a[2]);let o=e.target??[0,0,0];return i instanceof w||i instanceof I?i.target.position.set(o[0],o[1],o[2]):i instanceof Oe&&(i.lookAt(o[0],o[1],o[2]),e.panel&&i.add(li(i))),e.castShadow&&(i instanceof w||i instanceof I||i instanceof ae)&&ci(i,e,t),e.volumetric&&i instanceof I&&i.add(fi(i,e)),i.name=e.id??e.type,i.userData.baseIntensity=r,i.userData.baseColor=n.clone(),i}function mi(e,t){if(t.isEmpty())return;let n=e.shadow.camera;e.updateMatrixWorld(),e.target.updateMatrixWorld();let r=new E().setFromMatrixPosition(e.matrixWorld),i=new E().setFromMatrixPosition(e.target.matrixWorld),a=new F().lookAt(r,i,new E(0,1,0));a.setPosition(r);let o=a.clone().invert(),s=new A,c=new E;for(let e=0;e<8;e++)c.set(e&1?t.max.x:t.min.x,e&2?t.max.y:t.min.y,e&4?t.max.z:t.min.z).applyMatrix4(o),s.expandByPoint(c);let l=.5;n.left=s.min.x-l,n.right=s.max.x+l,n.bottom=s.min.y-l,n.top=s.max.y+l,n.near=Math.max(.01,-s.max.z-l),n.far=-s.min.z+l,n.updateProjectionMatrix();let u=Math.max(n.right-n.left,n.top-n.bottom)/e.shadow.mapSize.x;e.userData.fixedNormalBias||(e.shadow.normalBias=Math.max(.01,u*1.5))}var hi={"studio-3point":[{id:`key`,type:`directional`,position:[4,6,5],color:`#fff1e0`,intensity:2.6,castShadow:!0,shadow:{softness:6}},{id:`fill`,type:`directional`,position:[-5,2.5,3],color:`#dbe6ff`,intensity:.8},{id:`rim`,type:`directional`,position:[-1.5,4,-6],color:`#ffffff`,intensity:2.2},{id:`sky`,type:`hemisphere`,skyColor:`#ffffff`,groundColor:`#3a3f4a`,intensity:.35}],softbox:[{id:`top`,type:`rect`,position:[0,5,1.5],width:5,height:5,color:`#ffffff`,intensity:2.1},{id:`left`,type:`rect`,position:[-4.5,2,2.5],width:2,height:4.5,color:`#fff6ee`,intensity:2.6},{id:`right`,type:`rect`,position:[4.5,2,2.5],width:2,height:4.5,color:`#eef4ff`,intensity:1.7},{id:`shadow`,type:`directional`,position:[1,8,2.5],color:`#ffffff`,intensity:.7,castShadow:!0,shadow:{softness:10,intensity:.75}},{id:`sky`,type:`hemisphere`,skyColor:`#ffffff`,groundColor:`#50555f`,intensity:.3}],"product-top":[{id:`top`,type:`rect`,position:[0,4.5,.5],width:3,height:3,color:`#ffffff`,intensity:6},{id:`stripL`,type:`rect`,position:[-3.2,1.6,1.2],width:.6,height:4.5,color:`#ffffff`,intensity:10},{id:`stripR`,type:`rect`,position:[3.2,1.6,1.2],width:.6,height:4.5,color:`#ffffff`,intensity:10},{id:`shadow`,type:`directional`,position:[.5,8,1.5],color:`#ffffff`,intensity:.9,castShadow:!0,shadow:{softness:8,intensity:.8}},{id:`sky`,type:`hemisphere`,skyColor:`#ffffff`,groundColor:`#30333a`,intensity:.15}],rim:[{id:`rimCool`,type:`directional`,position:[-5,3,-5],color:`#9fc4ff`,intensity:3.2,castShadow:!0,shadow:{softness:5}},{id:`rimWarm`,type:`directional`,position:[5,3,-5],color:`#ffb27a`,intensity:3},{id:`front`,type:`directional`,position:[0,2,6],color:`#ffffff`,intensity:.35},{id:`ambient`,type:`ambient`,color:`#ffffff`,intensity:.1}],dramatic:[{id:`key`,type:`spot`,position:[5,5,3],color:`#ffe2c0`,intensity:90,angle:26,penumbra:.45,castShadow:!0,shadow:{softness:3}},{id:`rim`,type:`directional`,position:[-3,4,-5],color:`#a9c2ff`,intensity:1.3},{id:`sky`,type:`hemisphere`,skyColor:`#8090b0`,groundColor:`#101012`,intensity:.08}],"golden-hour":[{id:`sun`,type:`directional`,position:[6.5,2,3],color:`#ffb46b`,intensity:3.2,castShadow:!0,shadow:{softness:5}},{id:`sky`,type:`hemisphere`,skyColor:`#8fb4ff`,groundColor:`#4a3020`,intensity:.65},{id:`bounce`,type:`directional`,position:[-4,3,4],color:`#ffd9b0`,intensity:.3}],noon:[{id:`sun`,type:`directional`,position:[2,10,3],color:`#fffaf0`,intensity:3.2,castShadow:!0,shadow:{softness:3}},{id:`sky`,type:`hemisphere`,skyColor:`#bcd8ff`,groundColor:`#6b5a45`,intensity:.75}],overcast:[{id:`sky`,type:`hemisphere`,skyColor:`#e8eef5`,groundColor:`#6f6a60`,intensity:1.4},{id:`top`,type:`directional`,position:[1,8,2],color:`#f2f5ff`,intensity:.6,castShadow:!0,shadow:{softness:14,intensity:.6}}],neon:[{id:`magenta`,type:`rect`,position:[-3.5,1.5,1.5],width:1,height:4,color:`#ff2bd6`,intensity:12},{id:`cyan`,type:`rect`,position:[3.5,1.5,1.5],width:1,height:4,color:`#22e4ff`,intensity:12},{id:`back`,type:`point`,position:[0,3,-3],color:`#7a5cff`,intensity:20},{id:`shadow`,type:`directional`,position:[0,6,3],color:`#b9a6ff`,intensity:.35,castShadow:!0,shadow:{softness:6}},{id:`ambient`,type:`ambient`,color:`#1a1030`,intensity:.25}],moonlight:[{id:`moon`,type:`directional`,position:[-4,7,-3],color:`#9db8ff`,intensity:1.6,castShadow:!0,shadow:{softness:6}},{id:`sky`,type:`hemisphere`,skyColor:`#2a3b66`,groundColor:`#0a0c14`,intensity:.5}]};Object.keys(hi);function gi(e,t,n){let r=e=>{let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t.slice(0,6);return[0,2,4].map(e=>parseInt(n.slice(e,e+2),16))};if(!/^#?[0-9a-f]{3,8}$/i.test(e)||!/^#?[0-9a-f]{3,8}$/i.test(t))return e;let i=r(e),a=r(t);return`#`+i.map((e,t)=>Math.round(e+(a[t]-e)*n).toString(16).padStart(2,`0`)).join(``)}function _i(e,t,n){let r=t*Math.PI/180,i=Math.cos(r),a=Math.sin(r);return[(e[0]*i+e[2]*a)*n,e[1]*n,(-e[0]*a+e[2]*i)*n]}function vi(e){if(!e)return[];let t=typeof e==`string`?{preset:e}:e,n=hi[t.preset],r=i.find(e=>e.id===t.preset);if(!n||!r)return[];let a=Ct(r,t),o=a.num(`intensity`),s=a.num(`rotation`),c=a.num(`scale`),l=a.bool(`castShadow`),u=typeof t.color==`string`?t.color:void 0;return n.map(e=>{let t={...e,id:`rig:${e.id}`};return e.position&&(t.position=_i(e.position,s,c)),e.target&&(t.target=_i(e.target,s,c)),e.width&&(t.width=e.width*c),e.height&&(t.height=e.height*c),e.intensity!==void 0&&(t.intensity=e.intensity*o*(e.type===`point`||e.type===`spot`?c*c:1)),u&&(t.color&&=gi(t.color,u,.45),t.skyColor&&=gi(t.skyColor,u,.45)),l||delete t.castShadow,t})}var yi={sunrise:{elevation:2.5,azimuth:70,turbidity:5,rayleigh:2.4,mieCoefficient:.004,mieDirectionalG:.9,exposure:.7,haze:`#f1c1a0`},morning:{elevation:18,azimuth:110,turbidity:2.6,rayleigh:2.4,mieCoefficient:.003,mieDirectionalG:.8,exposure:.2,haze:`#b9cde4`},noon:{elevation:62,azimuth:150,turbidity:2,rayleigh:2.6,mieCoefficient:.003,mieDirectionalG:.8,exposure:.11,haze:`#a9c3e3`},afternoon:{elevation:32,azimuth:220,turbidity:2.4,rayleigh:2.6,mieCoefficient:.003,mieDirectionalG:.8,exposure:.15,haze:`#b4c8de`},"golden-hour":{elevation:6,azimuth:235,turbidity:5,rayleigh:3.6,mieCoefficient:.004,mieDirectionalG:.8,exposure:.36,haze:`#f4c08c`},sunset:{elevation:1.5,azimuth:250,turbidity:8,rayleigh:3,mieCoefficient:.005,mieDirectionalG:.94,exposure:.8,haze:`#e9a07e`},dusk:{elevation:-3,azimuth:255,turbidity:6,rayleigh:3,mieCoefficient:.005,mieDirectionalG:.85,exposure:6,haze:`#5a5f86`}};function bi(e){return!!e&&(e.physical===!0||e.preset!==void 0||e.turbidity!==void 0||e.rayleigh!==void 0)}function xi(e){let t=yi[e.preset??`afternoon`]??yi.afternoon,n=e.sun===!1?void 0:e.sun,r=B(n?.elevation,t.elevation),i=B(n?.azimuth,t.azimuth);if(n?.direction&&n.elevation===void 0&&n.azimuth===void 0){let[e,t,a]=n.direction;r=Math.asin(t/(Math.hypot(e,t,a)||1))*180/Math.PI,i=Math.atan2(e,a)*180/Math.PI}return{elevation:r,azimuth:i,turbidity:B(e.turbidity,t.turbidity),rayleigh:B(e.rayleigh,t.rayleigh),mieCoefficient:B(e.mieCoefficient,t.mieCoefficient),mieDirectionalG:B(e.mieDirectionalG,t.mieDirectionalG),exposure:B(e.exposure,1)*t.exposure,haze:t.haze}}function Si(e,t){let n=e*Math.PI/180,r=t*Math.PI/180;return[Math.cos(n)*Math.sin(r),Math.sin(n),Math.cos(n)*Math.cos(r)]}var Ci=[[-4,`#ff6a3a`,0],[0,`#ff8a4c`,.6],[3,`#ff9a52`,1.5],[8,`#ffb46a`,2.4],[16,`#ffdcb4`,2.8],[30,`#fff0dc`,3.1],[60,`#fff8ee`,3.3]];function wi(e){let t=Ci;if(e<=t[0][0])return{color:V(t[0][1]),intensity:0};for(let n=1;n<t.length;n++){let[r,i,a]=t[n],[o,s,c]=t[n-1];if(e<=r){let t=(e-o)/(r-o);return{color:V(s).lerp(V(i),t),intensity:c+(a-c)*t}}}let n=t[t.length-1];return{color:V(n[1]),intensity:n[2]}}var Ti=null;function Ei(){return Ti??=s(()=>import(`./Sky-C282PFL1.js`).then(e=>e.Sky.SkyShader),__vite__mapDeps([8,1]),import.meta.url),Ti}var Di=`
466
- uniform float uStars;
467
- uniform float uTime;
468
- uniform float uExposure;
469
- uniform vec3 uHaze;
470
- uniform float uHazeAmount;
471
- float a3dHash13(vec3 p) { p = fract(p * 0.1031); p += dot(p, p.zyx + 31.32); return fract((p.x + p.y) * p.z); }
472
- `;async function Oi(e){let t=await Ei(),n=xi(e),r=new E(...Si(n.elevation,n.azimuth)),i=t.fragmentShader.replace(`uniform float mieDirectionalG;`,`uniform float mieDirectionalG;
473
- `+Di).replace(`vec3 sundiscColor = ( 760.0 * sundisc ) * min( vSunE * Fex, 80.0 );`,`vec3 sundiscColor = ( 760.0 * sundisc ) * min( vSunE * Fex, 80.0 );
474
- sundiscColor = sundiscColor / ( 1.0 + dot( sundiscColor, vec3( 0.2126, 0.7152, 0.0722 ) ) / 12.0 );`).replace(`gl_FragColor = vec4( texColor, 1.0 );`,`texColor *= uExposure;
475
- // Below the horizon: darken towards a hazy ground tone.
476
- texColor = mix( texColor, texColor * 0.55, smoothstep( 0.0, -0.25, direction.y ) );
477
- // Stars when the sun is down.
478
- if ( uStars > 0.0 && direction.y > 0.0 ) {
479
- vec3 sp = direction * 120.0;
480
- vec3 cell = floor( sp );
481
- float rnd = a3dHash13( cell );
482
- if ( rnd < uStars ) {
483
- vec3 jitter = vec3( a3dHash13( cell + 1.3 ), a3dHash13( cell + 7.1 ), a3dHash13( cell + 3.7 ) );
484
- float d = length( fract( sp ) - jitter );
485
- float tw = 0.65 + 0.35 * sin( uTime * ( 1.0 + rnd * 40.0 ) + rnd * 100.0 );
486
- float night = 1.0 - smoothstep( -0.12, 0.05, vSunDirection.y );
487
- texColor += vec3( smoothstep( 0.12, 0.0, d ) * tw * night * smoothstep( 0.0, 0.25, direction.y ) ) * 0.8;
488
- }
489
- }
490
- // Horizon haze blends into the fog colour so fogged ground meets the sky.
491
- if ( uHazeAmount > 0.0 ) texColor = mix( texColor, uHaze, uHazeAmount * ( 1.0 - smoothstep( -0.02, 0.22, direction.y ) ) );
492
- gl_FragColor = vec4( texColor, 1.0 );`),a=a=>{let o=ue.clone(t.uniforms);return o.turbidity.value=n.turbidity,o.rayleigh.value=n.rayleigh,o.mieCoefficient.value=n.mieCoefficient,o.mieDirectionalG.value=n.mieDirectionalG,o.sunPosition.value.copy(r).multiplyScalar(45e4),o.showSunDisc.value=+!!a,o.cloudCoverage.value=Math.max(0,Math.min(1,B(e.clouds,0))),o.uStars={value:a?Math.min(.5,B(e.stars,0)/2e4):0},o.uTime={value:0},o.uExposure={value:n.exposure},o.uHaze={value:new D(0,0,0)},o.uHazeAmount={value:0},new P({name:`agent3d-sky`,uniforms:o,vertexShader:t.vertexShader,fragmentShader:i,side:1,depthWrite:!1})},o=a(!0),s=new O(new je(1,48,24),o);return s.scale.setScalar(450),s.frustumCulled=!1,s.renderOrder=-1e3,s.name=`__sky`,s.userData.helper=!0,s.userData.sunDir=r.clone(),s.userData.sunColor=wi(n.elevation).color,s.userData.sunUp=n.elevation>-3,s.onBeforeRender=(e,t,n)=>{s.position.setFromMatrixPosition(n.matrixWorld),s.updateMatrixWorld()},{mesh:s,values:n,sunDir:r,envScene(){let e=new Ue,t=a(!1);t.uniforms.uHaze.value.copy(o.uniforms.uHaze.value),t.uniforms.uHazeAmount.value=o.uniforms.uHazeAmount.value;let n=new O(new je(1,48,24),t);return n.scale.setScalar(50),e.add(n),e},setTime(e){o.uniforms.uTime.value=e,o.uniforms.time.value=e},setHaze(e,t){e&&o.uniforms.uHaze.value.copy(e),o.uniforms.uHazeAmount.value=e?t:0}}}function ki(e,t,n=0,r={}){if(typeof document>`u`)return null;let i=document.createElement(`canvas`);i.width=i.height=512;let a=i.getContext(`2d`);if(!a)return null;let o;if(t===`radial`){let e=(r.center?.[0]??.5)*512,t=(1-(r.center?.[1]??.5))*512;o=a.createRadialGradient(e,t,0,e,t,368.64*(r.radius??1))}else{let e=n*Math.PI/180,t=Math.sin(e),r=-Math.cos(e);o=a.createLinearGradient(256-t*256,256-r*256,256+t*256,256+r*256)}let s=e.length?e:[`#000000`];s.forEach((e,t)=>o.addColorStop(s.length===1?0:t/(s.length-1),e)),a.fillStyle=o,a.fillRect(0,0,512,512);let c=2+Math.max(0,Math.min(1,r.grain??0))*70,l=a.getImageData(0,0,512,512);for(let e=0;e<l.data.length;e+=4){let t=(e*2654435761>>>0)%1e3/1e3-.5;l.data[e]+=t*c,l.data[e+1]+=t*c,l.data[e+2]+=t*c}a.putImageData(l,0,0);let u=new we(i);return u.colorSpace=j,u}function Ai(e,t,n){let r=e.slice(0,6).map(e=>V(e));for(;r.length<6;)r.push(r[r.length-1]?.clone()??new D(0));let i={uMgColors:{value:r},uMgCount:{value:Math.max(1,Math.min(6,e.length))},uMgScale:{value:B(t.scale,1)},uMgSeed:{value:B(t.seed,1)},uTime:{value:0},uGrain:{value:B(t.grain,.035)},uAspect:{value:1},uMgSpread:{value:new C(1,1)}},a=new P({uniforms:i,vertexShader:`varying vec2 vUv;
493
- void main() { vUv = uv; gl_Position = vec4(position.xy, 1.0, 1.0); }`,fragmentShader:`uniform float uTime;\nuniform float uGrain;\nuniform float uAspect;\nvarying vec2 vUv;\n${Br}\n${Vr}
494
- void main() {
495
- vec2 p = (vUv - 0.5) * vec2(max(uAspect, 1.0), max(1.0 / uAspect, 1.0)) * 1.6;
496
- vec3 col = meshGradient(p, uTime);
497
- col += mgGrain(gl_FragCoord.xy, uTime) * uGrain;
498
- gl_FragColor = vec4(col, 1.0);
499
- #include <colorspace_fragment>
500
- }`,depthTest:!1,depthWrite:!1,toneMapped:!1}),o=new O(new k(2,2),a);o.frustumCulled=!1,o.renderOrder=-1e3,o.name=`__background`,o.userData.helper=!0;let s=new C;o.onBeforeRender=e=>{e.getDrawingBufferSize(s),i.uAspect.value=s.x/Math.max(s.y,1),i.uMgSpread.value.set(Math.max(i.uAspect.value,1)*1.6,Math.max(1/i.uAspect.value,1)*1.6)};let c=B(t.speed,.15);return n.onUpdate(e=>i.uTime.value=e*c),o}var ji=`
501
- varying vec3 vDir;
502
- void main() {
503
- vDir = position;
504
- vec4 p = projectionMatrix * vec4(mat3(viewMatrix) * position, 1.0);
505
- gl_Position = p.xyww;
506
- }`,Mi=`
507
- uniform vec3 uTop; uniform vec3 uHorizon; uniform vec3 uBottom;
508
- uniform vec3 uSunDir; uniform vec3 uSunColor; uniform float uSunSize; uniform float uSun;
509
- uniform float uStars; uniform float uTime;
510
- varying vec3 vDir;
511
- float hash13(vec3 p) { p = fract(p * 0.1031); p += dot(p, p.zyx + 31.32); return fract((p.x + p.y) * p.z); }
512
- void main() {
513
- vec3 d = normalize(vDir);
514
- float h = d.y;
515
- vec3 col = h > 0.0 ? mix(uHorizon, uTop, pow(clamp(h, 0.0, 1.0), 0.55)) : mix(uHorizon, uBottom, pow(clamp(-h, 0.0, 1.0), 0.4));
516
- if (uSun > 0.5) {
517
- float cosA = dot(d, normalize(uSunDir));
518
- float r = uSunSize * 0.02;
519
- float disc = smoothstep(cos(r * 1.2), cos(r * 0.9), cosA);
520
- float glow = pow(max(cosA, 0.0), 400.0 / max(uSunSize, 0.2)) * 0.8 + pow(max(cosA, 0.0), 24.0) * 0.12;
521
- col += uSunColor * (disc * 6.0 + glow);
522
- }
523
- if (uStars > 0.0 && h > -0.05) {
524
- vec3 p = d * 120.0;
525
- vec3 cell = floor(p);
526
- float rnd = hash13(cell);
527
- if (rnd < uStars) {
528
- vec3 jitter = vec3(hash13(cell + 1.3), hash13(cell + 7.1), hash13(cell + 3.7));
529
- float dist = length(fract(p) - jitter);
530
- float tw = 0.65 + 0.35 * sin(uTime * (1.0 + rnd * 40.0) + rnd * 100.0);
531
- float star = smoothstep(0.12, 0.0, dist) * tw * smoothstep(-0.05, 0.25, h);
532
- col += vec3(star) * (0.6 + rnd / max(uStars, 1e-4) * 0.8);
533
- }
534
- }
535
- gl_FragColor = vec4(col, 1.0);
536
- #include <tonemapping_fragment>
537
- #include <colorspace_fragment>
538
- }`;function Ni(e,t){let n=e.sun===!1?null:e.sun??{},r=L(n?.direction,[.4,.35,-1]);if(n&&(n.elevation!==void 0||n.azimuth!==void 0)&&!n.direction){let e=B(n.elevation,20)*R,t=B(n.azimuth,180)*R;r=[Math.cos(e)*Math.sin(t),Math.sin(e),Math.cos(e)*Math.cos(t)]}let i=new P({uniforms:{uTop:{value:V(e.top??`#2f6fd6`)},uHorizon:{value:V(e.horizon??`#cfe6ff`)},uBottom:{value:V(e.bottom??e.horizon??`#e8eef5`)},uSunDir:{value:new E(...r).normalize()},uSunColor:{value:V(n?.color??`#fff2d6`)},uSunSize:{value:B(n?.size,1)},uSun:{value:+!!n},uStars:{value:Math.min(.5,B(e.stars,0)/2e4)},uTime:{value:0}},vertexShader:ji,fragmentShader:Mi,side:1,depthWrite:!1,depthTest:!1}),a=new O(new je(1,48,24),i);return a.frustumCulled=!1,a.renderOrder=-1e3,a.name=`__sky`,a.userData.helper=!0,t.onUpdate(e=>i.uniforms.uTime.value=e),a}function Pi(e,t,n,r,i=!0){let a=new Ue,o=new je(10,64,32),s=o.getAttribute(`position`),c=new Float32Array(s.count*3),l=V(e),u=V(t),d=V(n),f=new D;for(let e=0;e<s.count;e++){let t=s.getY(e)/10;t>=0?f.copy(u).lerp(l,t**.6):f.copy(u).lerp(d,(-t)**.5),c[e*3]=f.r,c[e*3+1]=f.g,c[e*3+2]=f.b}if(o.setAttribute(`color`,new Me(c,3)),a.add(new O(o,new y({vertexColors:!0,side:1,toneMapped:!1}))),r){let e=new O(new Ee(r.size,32),new y({color:V(r.color).multiplyScalar(r.power),side:2,toneMapped:!1}));e.position.copy(r.dir.clone().normalize().multiplyScalar(9)),e.lookAt(0,0,0),a.add(e)}if(i){let e=new y({color:V(t).multiplyScalar(1.6),side:2,toneMapped:!1});for(let t=0;t<3;t++){let n=t/3*Math.PI*2+.6,r=new O(new k(5,1.4),e);r.position.set(Math.cos(n)*9,1.5,Math.sin(n)*9),r.lookAt(0,1.5,0),a.add(r)}}return a}function Fi(e){e.traverse(e=>{let t=e;t.geometry?.dispose(),t.material?.dispose()})}async function Ii(e){let t=e.toLowerCase().split(`?`)[0],n;if(t.endsWith(`.hdr`)){let{HDRLoader:t}=await s(async()=>{let{HDRLoader:e}=await import(`./HDRLoader-CkQyrTWY.js`);return{HDRLoader:e}},__vite__mapDeps([9,1]),import.meta.url);n=await new t().loadAsync(e)}else if(t.endsWith(`.exr`)){let{EXRLoader:t}=await s(async()=>{let{EXRLoader:e}=await import(`./EXRLoader-f8U8jnlr.js`);return{EXRLoader:e}},__vite__mapDeps([10,1]),import.meta.url);n=await new t().loadAsync(e)}else n=await xt(e),n.colorSpace=j;return n.mapping=303,n}function Li(e,t){let n=new M({color:e,roughness:t,metalness:0,transparent:!0});return n.onBeforeCompile=e=>{e.vertexShader=`varying vec2 vGroundUv;
539
- `+e.vertexShader.replace(`#include <begin_vertex>`,`#include <begin_vertex>
540
- vGroundUv = uv;`),e.fragmentShader=`varying vec2 vGroundUv;
541
- `+e.fragmentShader.replace(`#include <alphamap_fragment>`,`#include <alphamap_fragment>
542
- diffuseColor.a *= 1.0 - smoothstep(0.3, 0.5, length(vGroundUv - 0.5));`)},n.customProgramCacheKey=()=>`agent3d-ground`,n}var Ri={radial:[.25,.5],screenEdge:.15};function zi(e,t){let n=new De({opacity:t,color:e});return n.onBeforeCompile=e=>{e.vertexShader=`varying vec2 vShadowUv;
543
- varying vec4 vShadowClip;
544
- `+e.vertexShader.replace(`#include <project_vertex>`,`#include <project_vertex>
545
- vShadowUv = uv;
546
- vShadowClip = gl_Position;`),e.fragmentShader=`varying vec2 vShadowUv;
547
- varying vec4 vShadowClip;
548
- `+e.fragmentShader.replace(`#include <tonemapping_fragment>`,`{
549
- \t\tvec2 ndc = vShadowClip.xy / max(vShadowClip.w, 1e-5);
550
- \t\tfloat edge = 1.0 - max(abs(ndc.x), abs(ndc.y));
551
- \t\tgl_FragColor.a *= (1.0 - smoothstep(${Ri.radial[0].toFixed(2)}, ${Ri.radial[1].toFixed(2)}, length(vShadowUv - 0.5))) * smoothstep(0.0, ${Ri.screenEdge.toFixed(2)}, edge);
552
- \t}
553
- \t#include <tonemapping_fragment>`)},n.customProgramCacheKey=()=>`agent3d-shadow-catcher`,n}var Bi=.45;function Vi(e,t){let n=e.background;return e.fog?.color?e.fog.color:t||(n&&typeof n==`object`&&`sky`in n&&n.sky?.horizon?n.sky.horizon:n&&typeof n==`object`&&`meshGradient`in n&&n.meshGradient[0]?n.meshGradient[0]:typeof n==`string`&&n!==`transparent`?n:`#ffffff`)}async function Hi(e,t,n,r,i){let a=[],o=[],c=i.renderer,l=e.background,u=!!n.isOrthographicCamera,d=null,f=0,p=null,m=null,h=null;t.background=null,t.backgroundIntensity=1,t.backgroundRotation.set(0,0,0),t.environmentRotation.set(0,0,0);let g=l&&typeof l==`object`?l:null,_=g&&`sky`in g?g.sky??{}:null;if(_&&bi(_))try{p=await Oi(_)}catch(e){i.issue(`asset-load`,e.message,`environment.background.sky`)}if(!r&&l!==void 0&&l!==`transparent`){if(typeof l==`string`)t.background=V(l);else if(`gradient`in l)t.background=ki(l.gradient,`linear`,B(l.angle,0),{grain:l.grain});else if(`radial`in l)t.background=ki(l.radial,`radial`,0,{center:l.center,radius:l.radius,grain:l.grain});else if(`meshGradient`in l)h=l.meshGradient,a.push(Ai(l.meshGradient,l,i));else if(`sky`in l){let e=l.sky??{};if(p){if(!u){a.push(p.mesh);let e=p;i.onUpdate(t=>e.setTime(t))}}else m=e,u?t.background=ki([e.bottom??e.horizon??`#e8eef5`,e.horizon??`#cfe6ff`,e.top??`#2f6fd6`],`linear`,0):a.push(Ni(e,i))}else if(`hdri`in l)try{if(d=await Ii(i.resolveAsset(l.hdri)),f=B(l.rotation,0)*R,t.backgroundRotation.set(0,f,0),t.backgroundIntensity=B(l.intensity,1),o.push(d),l.groundProjection&&!u){let n=typeof l.groundProjection==`object`?l.groundProjection:{},{GroundedSkybox:r}=await s(async()=>{let{GroundedSkybox:e}=await import(`./GroundedSkybox-BTqmv4fv.js`);return{GroundedSkybox:e}},__vite__mapDeps([11,1]),import.meta.url),i=B(n.height,2),o=B(n.radius,60),c=new r(d,i,o);c.position.y=i-.01+B(e.ground?.y,0),c.rotation.y=f,c.material.color.setScalar(t.backgroundIntensity),c.name=`__groundProjection`,c.userData.helper=!0,c.renderOrder=-999,a.push(c),t.background=V(`#000000`)}else t.background=d,t.backgroundBlurriness=B(l.blur,0)}catch(e){i.issue(`asset-load`,e.message,`environment.background.hdri`)}t.background instanceof me&&t.background!==d&&o.push(t.background)}t.fog=null,ni(t,null);let y=null;e.fog&&(y=V(Vi(e,p?.values.haze)),!e.fog.color&&p&&y.multiplyScalar(.82),`density`in e.fog?(t.fog=new v(y,e.fog.density),e.fog.height!==void 0&&ni(t,{uA3dFogHeight:{value:e.fog.height},uA3dFogFalloff:{value:B(e.fog.falloff,.25)}})):t.fog=new tt(y,B(e.fog.near,10),B(e.fog.far,60)),p?.setHaze(y,.85));let ee=d?{hdri:``}:p?`sky`:`soft`,b=e.lighting??ee;if(t.environment=null,t.environmentIntensity=B(e.lightingIntensity,1),c&&b!==`none`){let n=new qe(c),a=null;try{if(typeof b==`object`){let e=b.hdri?await Ii(i.resolveAsset(b.hdri)):d;e&&(a=n.fromEquirectangular(e)),b.intensity!==void 0&&(t.environmentIntensity=b.intensity),t.environmentRotation.set(0,b.hdri?B(b.rotation,0)*R:b.rotation===void 0?f:b.rotation*R,0),e&&e!==d&&e.dispose()}else if(b===`sky`){if(p){let e=p.envScene();a=n.fromScene(e,0,.1,100),Fi(e)}else if(m){let e=m,t=e.sun===!1?void 0:e.sun,r=Pi(e.top??`#2f6fd6`,e.horizon??`#cfe6ff`,e.bottom??e.horizon??`#e8eef5`,t?{dir:new E(...L(t.direction,[.4,.35,-1])),color:t.color??`#fff2d6`,power:4,size:.9}:void 0,!1);a=n.fromScene(r,.02),Fi(r)}else if(h){let e=h,t=Pi(e[1]??e[0],e[0],e[2]??e[0],void 0,!0);a=n.fromScene(t,.04),Fi(t)}else{let{RoomEnvironment:e}=await s(async()=>{let{RoomEnvironment:e}=await import(`./RoomEnvironment-BsISzuCp.js`);return{RoomEnvironment:e}},__vite__mapDeps([12,1]),import.meta.url),t=new e;a=n.fromScene(t,.06),t.dispose?.()}}else if(b===`studio`||b===`soft`){let{RoomEnvironment:r}=await s(async()=>{let{RoomEnvironment:e}=await import(`./RoomEnvironment-BsISzuCp.js`);return{RoomEnvironment:e}},__vite__mapDeps([12,1]),import.meta.url),i=new r;a=n.fromScene(i,b===`soft`?.06:.02),b===`soft`&&e.lightingIntensity===void 0&&(t.environmentIntensity=.8),i.dispose?.()}else{let e={neutral:[`#d8d8dc`,`#b9b9bd`,`#5a5a60`],sunset:[`#33306e`,`#ff9a5a`,`#3a2531`,{dir:new E(1,.15,-.6),color:`#ffb36b`,power:6,size:1.6}],night:[`#060a1a`,`#1d2a55`,`#05060c`,{dir:new E(-.5,.7,-.5),color:`#cfdcff`,power:3,size:.8}]},t=Pi(...e[b]??e.neutral);a=n.fromScene(t,.03),Fi(t)}}catch(e){i.issue(`asset-load`,e.message,`environment.lighting`)}a&&(t.environment=a.texture,o.push(a),u&&p&&!r&&(t.background=a.texture,t.backgroundBlurriness=0)),n.dispose();let l=e.lightingIntensity!==void 0||typeof b==`object`&&b.intensity!==void 0;e.rig&&!l&&(t.environmentIntensity*=Bi)}let x=[],S=_&&_.sun!==!1?_.sun??{}:null;if(p&&S&&S.light!==!1){let t=wi(p.values.elevation),n=new w(S.color?V(S.color):t.color,B(S.intensity,t.intensity));n.position.copy(p.sunDir).multiplyScalar(30),n.name=`__sun`,n.userData.a3dId=`sun`,S.castShadow!==!1&&n.intensity>0&&ci(n,{type:`directional`,shadow:{softness:3}},e.shadows),x.push(n)}for(let t of vi(e.rig)){let n=await pi(t,e.shadows);x.push(n)}for(let e of x)a.push(e),(e instanceof w||e instanceof I)&&a.push(e.target);let te;if(e.ground){let t=e.ground,n=B(t.size,60),r=B(t.y,0),i=t.shadowOnly?zi(V(t.color??`#000000`),B(t.opacity,.28)):Li(V(t.color??`#d9d9d9`),B(t.roughness,.9));!t.shadowOnly&&t.opacity!==void 0&&(i.opacity=t.opacity);let o=new O(new k(n,n),i);if(o.rotation.x=-Math.PI/2,o.position.y=r,o.receiveShadow=!0,o.name=`__ground`,o.renderOrder=-20,o.userData.helper=!0,o.userData.ground=!0,a.push(o),te=o,t.grid){let e=new ge(n,Math.round(n),V(`#000000`),V(`#000000`)),t=e.material;t.transparent=!0,t.opacity=.12,t.depthWrite=!1,e.position.y=r+.002,e.userData.helper=!0,a.push(e)}}if(e.contactShadows){let n=Kr(e.contactShadows,t,e.ground?B(e.ground.y,0):void 0,i);n&&(a.push(n.object),o.push(n))}return{objects:a,ground:te,dispose(){for(let e of o)e.dispose();for(let e of a)e.traverse(e=>{let t=e;t.geometry?.dispose(),t.material?.dispose?.(),e.shadow?.dispose?.()})}}}function Ui(e){return Array.isArray(e)?e.filter(e=>Array.isArray(e)&&e.length>=2).map(e=>new C(Number(e[0]),Number(e[1]))):[]}function Wi(e){return Array.isArray(e)?e.filter(e=>Array.isArray(e)&&e.length>=3).map(e=>new E(Number(e[0]),Number(e[1]),Number(e[2]))):[]}var Q=(e,t=`segments`,n=32)=>Math.max(3,Math.round(B(e[t],n))),Gi={box:e=>new Re(B(e.width,1),B(e.height,1),B(e.depth,1)),roundedBox:e=>{let t=B(e.width,1),n=B(e.height,1),r=B(e.depth,1),i=Math.min(B(e.radius,.1),Math.min(t,n,r)/2-1e-4);return new ln(t,n,r,Math.max(1,Math.round(B(e.segments,4))),Math.max(0,i))},sphere:e=>new je(B(e.radius,.5),Q(e),Math.max(2,Math.round(B(e.heightSegments,24)))),cylinder:e=>new S(B(e.radiusTop,.5),B(e.radiusBottom,.5),B(e.height,1),Q(e),1,z(e.openEnded,!1)),cone:e=>new Ze(B(e.radius,.5),B(e.height,1),Q(e)),capsule:e=>{let t=Math.max(2,Math.round(B(e.segments,16)));return new Ye(B(e.radius,.3),B(e.length,.6),Math.max(2,Math.round(t/2)),t*2)},torus:e=>new b(B(e.radius,.5),B(e.tube,.15),Math.max(2,Math.round(B(e.radialSegments,24))),Math.max(3,Math.round(B(e.tubularSegments,64))),B(e.arc,360)*R),torusKnot:e=>new de(B(e.radius,.5),B(e.tube,.15),Math.round(B(e.tubularSegments,128)),Math.round(B(e.radialSegments,16)),Math.round(B(e.p,2)),Math.round(B(e.q,3))),plane:e=>new k(B(e.width,1),B(e.height,1),Math.max(1,Math.round(B(e.widthSegments,1))),Math.max(1,Math.round(B(e.heightSegments,1)))),circle:e=>new Ee(B(e.radius,.5),Q(e)),ring:e=>new Ke(B(e.innerRadius,.3),B(e.outerRadius,.5),Q(e)),icosahedron:e=>new We(B(e.radius,.5),Math.round(B(e.detail,0))),dodecahedron:e=>new le(B(e.radius,.5),Math.round(B(e.detail,0))),octahedron:e=>new oe(B(e.radius,.5),Math.round(B(e.detail,0))),tetrahedron:e=>new Qe(B(e.radius,.5),Math.round(B(e.detail,0))),lathe:e=>{let t=Ui(e.points);return t.length<2&&(t=[new C(.5,-.5),new C(.5,.5)]),new Ve(t,Q(e))},extrude:e=>{let t=Ui(e.shape);t.length<3&&(t=[new C(-.5,-.5),new C(.5,-.5),new C(0,.5)]);let n=new Ie(t),r=B(e.depth,.2),i=B(e.bevel,.02),a=new ne(n,{depth:r,bevelEnabled:i>0,bevelSize:i,bevelThickness:i,bevelSegments:3,curveSegments:12});return a.translate(0,0,-r/2),a},tube:e=>{let t=Wi(e.points);t.length<2&&(t=[new E(-1,0,0),new E(1,0,0)]);let n=new et(t,z(e.closed,!1),`catmullrom`,.5);return new _(n,Math.max(2,Math.round(B(e.tubularSegments,64))),B(e.radius,.05),Math.max(3,Math.round(B(e.radialSegments,8))),z(e.closed,!1))}};function Ki(e){let t=Gi[e.type]??Gi.box,n=p.find(t=>t.id===e.type),r=t(nt(n,e));return r.computeBoundingBox(),r.computeBoundingSphere(),r}function qi(e,t){let n=[],r=(e,t=new T,r=new E(1,1,1))=>n.push({position:e,rotation:t,scale:r});switch(e.type){case`grid`:{let[t,n,i]=e.count.map(e=>Math.max(1,Math.round(e))),[a,o,s]=e.spacing;for(let e=0;e<t;e++)for(let c=0;c<n;c++)for(let l=0;l<i;l++)r(new E((e-(t-1)/2)*a,(c-(n-1)/2)*o,(l-(i-1)/2)*s));break}case`scatter`:{let n=B(e.minScale,1),i=B(e.maxScale,1),[a,o,s]=e.area;for(let c=0;c<Math.max(0,Math.round(e.count));c++){let c=new E(t.range(-a/2,a/2),t.range(-o/2,o/2),t.range(-s/2,s/2)),l=e.randomRotation===!1?new T:new T(0,t.range(0,Math.PI*2),0),u=t.range(n,i);r(c,l,new E(u,u,u))}break}case`circle`:{let t=Math.max(1,Math.round(e.count));for(let n=0;n<t;n++){let i=n/t*Math.PI*2;r(new E(Math.cos(i)*e.radius,0,Math.sin(i)*e.radius),new T(0,-i,0))}break}case`list`:for(let t of e.items){let e=t.position??[0,0,0],n=t.rotation??[0,0,0],i=t.scale??1;r(new E(...e),new T(n[0]*R,n[1]*R,n[2]*R),typeof i==`number`?new E(i,i,i):new E(...i))}}return n}function Ji(e,t,n,r,i){let a=qi(e.layout,r),o=new Se(t,n,Math.max(1,a.length));o.count=a.length;let s=new F,c=new N;if(a.forEach((e,t)=>{s.compose(e.position,c.setFromEuler(e.rotation),e.scale),o.setMatrixAt(t,s)}),e.colors?.length){let t=e.layout.type===`scatter`;a.forEach((n,a)=>o.setColorAt(a,i(t?r.pick(e.colors):e.colors[a%e.colors.length]))),o.instanceColor&&(o.instanceColor.needsUpdate=!0)}return o.instanceMatrix.needsUpdate=!0,o.computeBoundingBox(),o.computeBoundingSphere(),o}function Yi(e){let t={position:e.position.clone(),quaternion:e.quaternion.clone(),scale:e.scale.clone(),visible:e.visible},n=e;return n.isLight&&(t.intensity=n.intensity,t.color=n.color.clone()),t}function Xi(e,t){t.position&&e.position.set(t.position[0]??0,t.position[1]??0,t.position[2]??0),t.rotation&&e.rotation.set((t.rotation[0]??0)*R,(t.rotation[1]??0)*R,(t.rotation[2]??0)*R),t.scale!==void 0&&(typeof t.scale==`number`?e.scale.setScalar(t.scale):e.scale.set(t.scale[0]??1,t.scale[1]??1,t.scale[2]??1))}var Zi=new Set([`hoverScale`,`hoverLift`,`clickBounce`,`spinOnClick`]),Qi=class t{def;ctx;scene=new Ue;camera;rig;env=null;entries=new Map;timeline=null;settleEntrances=!1;updaters=[];cameraRest0={position:new E,target:new E,fov:45,zoom:10,focus:void 0};motionHost;overrides;shots=[];focusWritten=!1;postfxParam=null;viewportH=600;input={pointer:{x:0,y:0,inside:!1},scroll:0,hovered:new Set,clicked:new Set,timelineT:null};disposed=!1;constructor(e,t){this.def=e,this.ctx=t,t.onUpdate=e=>this.updaters.push(e)}static async create(e,n,r,i,a=!1){let o=new t(e,n);return await o.build(r,i,a),o}async build(e,t,n){let{def:r,ctx:i}=this;{this.camera=mt(r.camera,e),this.rig=await ut(r.camera,this.camera,t,i.deterministic),this.cameraRest0.position.copy(this.rig.rest.position),this.cameraRest0.target.copy(this.rig.rest.target),this.cameraRest0.fov=this.rig.rest.fov,this.cameraRest0.zoom=this.rig.rest.zoom;let o=r.postfx?.find(e=>e.type===`dof`);this.cameraRest0.focus=o&&typeof o.focus==`number`?o.focus:o?8:void 0,this.rig.rest.focus=this.cameraRest0.focus;let s=Hi(r.environment??{background:`#ffffff`},this.scene,this.camera,!!r.target?.transparent,i),c=Promise.all((r.lights??[]).map((e,t)=>this.addLight(e,t))),l=new Map,u=r.objects??[],d=e=>e.attach===`camera`?this.camera:this.scene;u.some(e=>e.attach===`camera`)&&this.scene.add(this.camera),await Promise.all(u.filter(e=>e.kind===`generator`&&e.generator===`terrain`).map(e=>this.addObject(e,d(e),void 0,l))),$i(l,u),await Promise.all(u.filter(e=>e.kind!==`generator`||e.generator!==`terrain`).map(e=>this.addObject(e,d(e),void 0,l)));let f=new Map(u.map((e,t)=>[e.id,t]));this.scene.children.sort((e,t)=>(f.get(e.userData.a3dId)??-1)-(f.get(t.userData.a3dId)??-1)),this.env=await s;for(let e of this.env.objects)this.scene.add(e);if(await c,this.canonicalOrder(r),n){let e=new ge(20,20,8947848,4473924);e.userData.helper=!0,this.scene.add(e,Object.assign(new Fe(1.5),{userData:{helper:!0}}))}if(this.motionHost={object:e=>this.entries.get(e)?.object??null,select:e=>this.select(e),camera:this.rig.rest,scene:this.scene,renderer:i.renderer,postfx:{set:(e,t,n)=>this.postfxParam?.(e,t,n),base:(e,t)=>{let n=a(r.postfx).find(t=>t.type===e)?.[t];return typeof n==`number`||typeof n==`string`?n:void 0}},clips:e=>this.entries.get(e)?.animator?.control,issue:i.issue,seed:r.seed??1},this.overrides=new Mr(this.motionHost),this.shots=Rr(r.camera?.shots),r.timeline){this.timeline=Ar(r.timeline,this.motionHost);for(let e of this.timeline.targets){let t=this.entries.get(e);t&&(t.animated=!0)}}for(let e of r.interactions??[]){if(e.target&&(e.on===`click`||e.on===`hover`||e.on===`hoverEnd`)){let t=this.entries.get(e.target);t&&(t.interactive=!0)}for(let t of e.do??[]){let e=t.set?.path;if(typeof e==`string`)for(let t of this.overrides.idsOf(e)){let e=this.entries.get(t);e&&(e.animated=!0)}}}this.fitShadows()}}canonicalOrder(e){let t=this.entries,n=new Map,r=e=>{let r=t.get(e);r&&!n.has(e)&&n.set(e,r)};(e.lights??[]).forEach((e,t)=>r(e.id??`light${t}`));let i=e=>{for(let n of e){r(n.id);let e=`${n.id}/`;for(let i of t.keys())i.startsWith(e)&&t.get(i).parentId===n.id&&r(i);if(!n.children?.length)continue;let a=t.get(n.id)?.object;if(a){let e=new Map(n.children.map((e,t)=>[e.id,t]));a.children.sort((t,n)=>(e.get(t.userData.a3dId)??-1)-(e.get(n.userData.a3dId)??-1))}i(n.children)}};i(e.objects??[]);for(let[e,r]of t)n.has(e)||n.set(e,r);this.entries=n}async overrideGeneratorMaterial(e,t,n){let r=Bt(t),i=await en(t,n,{vertexColors:r.type!==`shader`&&r.type!==`normal`&&r.type!==`gradient`&&!r.color&&!r.map}),a=[];e.traverse(e=>{e.isMesh&&e.userData.materialTarget&&a.push(e)});for(let e of a)e.material.dispose(),e.material=i,Kt(i,e.geometry)}rngFor(e,t){return ct(t??pt(this.def.seed??1,e))}behaviourContext(e){let t=this;return{object:e.object,base:{position:e.rest.position,rotation:new T().setFromQuaternion(e.rest.quaternion),scale:e.rest.scale},get pointer(){return t.input.pointer},hovered:()=>t.input.hovered.has(e.id),clicked:()=>t.input.clicked.has(e.id),scroll:()=>t.input.scroll,get camera(){return t.camera},rng:this.rngFor(e.id+`:behaviours`),find:e=>e===`camera`?t.camera:t.entries.get(e)?.object??null}}attachBehaviours(e){let t=e.def.behaviours??[];e.runners=[];for(let n of t){let t=ar[n.type];t?(e.runners.push(fr(n,t,this.behaviourContext(e),{settled:()=>this.settleEntrances})),(Zi.has(n.type)||n.when===`hover`||n.when===`click`)&&(e.interactive=!0)):this.ctx.issue(`unknown-catalog-id`,`Unknown behaviour "${n.type}"`,`objects#${e.id}.behaviours`)}e.runners.length&&(e.animated=!0)}resetBehaviours(){for(let e of this.entries.values()){for(let t of e.runners)t.dispose();e.def.behaviours?.length&&this.attachBehaviours(e),e.animator?.reset?e.animator.reset():e.animator?.mixer.setTime(0)}this.overrides?.reset()}async addLight(e,t){let n=await pi(e,this.def.environment?.shadows),r=e.id??`light${t}`;this.scene.add(n),(n instanceof w||n instanceof I)&&this.scene.add(n.target),n.userData.a3dId=r;let i={id:r,kind:`light`,def:e,object:n,rest:Yi(n),runners:[],animated:!1,topLevel:!1,interactive:!1};this.entries.set(r,i),this.attachBehaviours(i)}async addObject(t,n,r,i){let a=this.ctx,o,c,l,u,d=[],f=t.kind!==`particles`&&t.kind!==`generator`;try{switch(t.kind){case`mesh`:{let e=Ki(t.geometry),n=await en(t.material,a,{defaultColor:`#dddddd`});Kt(n,e),o=new O(e,n);break}case`text`:{let{buildText:e}=await s(async()=>{let{buildText:e}=await import(`./text-5DsJJHcj.js`);return{buildText:e}},__vite__mapDeps([13,1,4,5,3,14]),import.meta.url),n=await a.track(e(t,a));o=n.object,d=n.letters;break}case`svg`:{let{buildSvg:e}=await s(async()=>{let{buildSvg:e}=await import(`./svg-DT8kx37i.js`);return{buildSvg:e}},__vite__mapDeps([15,1,3,4,5,14]),import.meta.url);o=await a.track(e(t,a));break}case`model`:{let{buildModel:e}=await s(async()=>{let{buildModel:e}=await import(`./model-XZSP52pV.js`);return{buildModel:e}},__vite__mapDeps([16,1,3,4,5]),import.meta.url),n=await a.track(e(t,a));o=n.object,l=n.animator;break}case`instances`:{let e=Ki(t.geometry),n=await en(t.material,a,{defaultColor:t.colors?.length?`#ffffff`:`#dddddd`});Kt(n,e),o=Ji(t,e,n,this.rngFor(t.id,t.layout.seed),e=>V(e));break}case`particles`:{u=yr(t,this.rngFor(t.id,t.seed)),u.setViewport(this.viewportH),o=u.points;let e=u;this.updaters.push(t=>e.update(t));break}case`generator`:{let n=(await a.generators())[t.generator];if(!n){a.issue(`unknown-catalog-id`,`Unknown generator "${t.generator}"`,`objects#${t.id}.generator`),o=new be;break}let r=e.find(e=>e.id===t.generator),s=nt(r,t.params??{}),l=t.scale,u={position:[...t.position??[0,0,0]],scale:typeof l==`number`?[l,l,l]:l?[...l]:[1,1,1]},d={...a,siblings:i,rng:this.rngFor(t.id,t.seed),placement:u};if(c=await a.track(Promise.resolve(n(s,d))),o=c.object,c.update){let e=c.update.bind(c);this.updaters.push((t,n)=>e(t,n))}i.set(t.id,c),t.material&&r?.material&&await this.overrideGeneratorMaterial(o,t.material,a);break}default:o=new be}}catch(e){a.issue(t.kind===`model`||t.kind===`text`||t.kind===`svg`?`asset-load`:`build-error`,`${t.id}: ${e.message}`,`objects#${t.id}`),o=new be}if(this.disposed)return null;o.name=t.name??t.id,o.userData={...t.userData??{},...o.userData,a3dId:t.id,tags:t.tags??[]},Xi(o,t),t.visible===!1&&(o.visible=!1);let p=t.castShadow??(f?!0:void 0),m=t.receiveShadow??(f?!0:void 0);(p!==void 0||m!==void 0)&&o.traverse(e=>{e.isMesh&&(p!==void 0&&(e.castShadow=p),m!==void 0&&(e.receiveShadow=m))}),n.add(o);let h={id:t.id,kind:t.kind,def:t,object:o,rest:Yi(o),runners:[],animated:!1,topLevel:n===this.scene||n===this.camera&&!r,parentId:r,built:c,animator:l,particles:u,interactive:!!t.href};this.entries.set(t.id,h),this.attachBehaviours(h);for(let e of d){let n={id:e.id,kind:`text`,def:e.def,object:e.object,rest:Yi(e.object),runners:[],animated:!0,topLevel:!1,parentId:t.id,interactive:!1};e.reveal&&n.runners.push(fr(e.reveal.def,e.reveal.impl,this.behaviourContext(n),{settled:()=>this.settleEntrances})),this.entries.set(e.id,n)}if(t.children?.length){let e=new Map,n=t.children;await Promise.all(n.filter(e=>e.kind===`generator`&&e.generator===`terrain`).map(n=>this.addObject(n,o,t.id,e))),$i(e,n),await Promise.all(n.filter(e=>e.kind!==`generator`||e.generator!==`terrain`).map(n=>this.addObject(n,o,t.id,e)))}return h}removeEntry(e){let t=this.entries.get(e);if(t){t.object.traverse(t=>{let n=t.userData.a3dId;n&&n!==e&&this.entries.delete(n)}),t.object.removeFromParent();for(let e of t.runners)e.dispose();this.entries.delete(e)}}idsFor(e){let t=[];for(let n=e;n;n=n.parent){let e=n.userData?.a3dId;e&&this.entries.has(e)&&t.push(e)}return t}select(e){if(e.startsWith(`tag:`)){let t=e.slice(4),n=[],r=e=>{for(let i of e??[])i.tags?.includes(t)&&this.entries.has(i.id)&&n.push(i.id),r(i.children)};return r(this.def.objects),n}if(e.startsWith(`children:`)){let t=e.slice(9);return[...this.entries.values()].filter(e=>e.parentId===t).map(e=>e.id)}return Or(e,{object:()=>null,camera:null,issue:()=>void 0}).filter(e=>e!==``)}objectPosition(e){let t=this.entries.get(e);return t?t.object.getWorldPosition(new E):null}interactiveRoots(){let e=[];for(let t of this.entries.values())t.interactive&&t.kind!==`light`&&e.push(t.object);return e}fitShadows(){let e=[];if(this.scene.traverse(t=>{t instanceof w&&t.castShadow&&e.push(t)}),!e.length)return;let t=new A,n=new A;this.scene.updateMatrixWorld(!0);for(let e of this.entries.values())e.topLevel&&e.kind!==`particles`&&e.def.attach!==`camera`&&(n.setFromObject(e.object),n.isEmpty()||n.getSize(new E).length()>200||t.union(n));t.isEmpty()&&t.set(new E(-5,-1,-5),new E(5,5,5));let r=this.env?.ground?this.env.ground.position.y:t.min.y;t.expandByPoint(new E(t.min.x,r,t.min.z)),t.expandByPoint(new E(t.max.x,r,t.max.z)),t.expandByScalar(.3);for(let n of e)mi(n,t)}setViewport(e,t,n){this.viewportH=t*n;let r=/^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(this.def.target?.aspect??``),i=r?Number(r[1])/Number(r[2]):void 0;ft(this.camera,this.def.camera,e/Math.max(t,1),i&&Number.isFinite(i)&&i>0?i:void 0);for(let e of this.entries.values())e.particles?.setViewport(this.viewportH)}frame(e,t,n,r){this.input=n;for(let e of this.entries.values()){if(!e.animated)continue;let t=e.object;t.position.copy(e.rest.position),t.quaternion.copy(e.rest.quaternion),t.scale.copy(e.rest.scale),t.visible=e.rest.visible;let n=t;n.isLight&&e.rest.intensity!==void 0&&(n.intensity=e.rest.intensity,e.rest.color&&!this.timeline?.targets.has(e.id)&&n.color.copy(e.rest.color))}let i=this.def.timeline?n.timelineT??0:e;if(this.shots.length||this.timeline?.animatesCamera){let e=this.rig.rest;if(e.position.copy(this.cameraRest0.position),e.target.copy(this.cameraRest0.target),e.fov=this.cameraRest0.fov,e.zoom=this.cameraRest0.zoom,e.focus=this.cameraRest0.focus,this.shots.length){let t=zr(this.shots,i,e,{objectPosition:e=>this.objectPosition(e)});e.position.copy(t.position),e.target.copy(t.target),e.fov=t.fov,e.focus=t.focus}}this.timeline&&n.timelineT!==null&&this.timeline.apply(n.timelineT),this.overrides?.apply(e),this.rig.rest.focus!==void 0&&(this.focusWritten||this.rig.rest.focus!==this.cameraRest0.focus)&&(this.postfxParam?.(`dof`,`focus`,this.rig.rest.focus),this.focusWritten=!0);for(let n of this.entries.values())for(let r of n.runners)r.late||r.step(e,t);for(let e of this.entries.values()){let t=e.object.userData.setPointer?e.object:e.object.children[0],r=t?.userData.setPointer;if(!r)continue;r(n.pointer.x,n.pointer.y);let i=t.userData.setPointerLocal;if(i&&this.camera){let e=this.pointerOnPlane(t,n.pointer.x,n.pointer.y);e&&i(e.x,e.z)}}for(let n of this.updaters)n(e,t);for(let e of this.entries.values())e.animator?.mixer.update(t);let a=this.def.camera?.lookAt;this.rig.update(e,t,{pointer:n.pointer,scroll:n.scroll,followTarget:r,lookAt:a?this.objectPosition(a):null}),this.camera.updateMatrixWorld();for(let n of this.entries.values())for(let r of n.runners)r.late&&r.step(e,t)}hasStatefulMotion(){if(this.def.camera?.controls===`follow`&&this.def.camera.follow)return!0;for(let e of this.entries.values())for(let t of e.runners)if(t.stateful)return!0;return!1}pointerRay=new g;pointerOnPlane(e,t,n){e.updateWorldMatrix(!0,!1),this.camera.updateMatrixWorld(),this.pointerRay.setFromCamera(new C(t,n),this.camera);let r=e.matrixWorld.clone().invert(),i=this.pointerRay.ray.clone().applyMatrix4(r);if(Math.abs(i.direction.y)<1e-6)return null;let a=-i.origin.y/i.direction.y;return a<0?null:i.origin.addScaledVector(i.direction,a)}dispose(){this.disposed=!0;for(let e of this.entries.values()){for(let t of e.runners)t.dispose();e.built?.dispose?.()}this.rig?.dispose(),this.env?.dispose(),st(this.scene);let e=this.scene.environment;e&&e.dispose();let t=this.scene.background;t&&t.isTexture&&t.dispose(),this.scene.traverse(e=>e.shadow?.dispose?.()),this.entries.clear()}};function $i(e,t){let n=[...e.entries()],r=new Map(t.map((e,t)=>[e.id,t]));n.sort((e,t)=>(r.get(e[0])??1/0)-(r.get(t[0])??1/0)),e.clear();for(let[t,r]of n)e.set(t,r)}var ea=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Space`,`PageUp`,`PageDown`,`Home`,`End`]);function ta(){return{pointer:{x:0,y:0,inside:!1,down:!1,justPressed:!1},keys:new Set,pressed:new Set,swipe:null,clicks:[],scroll:0}}function na(e){e.pressed.clear(),e.pointer.justPressed=!1,e.swipe=null,e.clicks.length=0}function ra(e,t,n){n?(e.keys.has(t)||e.pressed.add(t),e.keys.add(t)):e.keys.delete(t)}function ia(e,t,n){let r=e.ownerDocument.defaultView??window,i=!1,a=!1,o=null,s=t=>{let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/Math.max(n.width,1)*2-1,y:-((t.clientY-n.top)/Math.max(n.height,1)*2-1)}},c=e=>{let r=s(e);t.pointer.x=r.x,t.pointer.y=r.y,t.pointer.inside=!0,n.onPointerMove?.()},l=()=>{a=!0,t.pointer.inside=!0},u=()=>{a=!1,t.pointer.inside=!1,t.pointer.down=!1},d=e=>{i=!0;let n=s(e);t.pointer.x=n.x,t.pointer.y=n.y,t.pointer.down=!0,t.pointer.justPressed=!0,o={x:n.x,y:n.y,t:performance.now(),px:e.clientX,py:e.clientY}},f=e=>{if(t.pointer.down=!1,!o)return;let n=e.clientX-o.px,r=e.clientY-o.py,i=Math.hypot(n,r);i<8?t.clicks.push(s(e)):i>30&&performance.now()-o.t<600&&(t.swipe=Math.abs(n)>Math.abs(r)?n>0?`right`:`left`:r>0?`down`:`up`),o=null},p=()=>i||a||e.contains(e.ownerDocument.activeElement),m=e=>{if(!p())return;let r=e.target;(!r||r.tagName!==`INPUT`&&r.tagName!==`TEXTAREA`&&!r.isContentEditable)&&(ra(t,e.code,e.type===`keydown`),n.game&&ea.has(e.code)&&e.preventDefault())},h=()=>t.keys.clear(),g=t=>{e.contains(t.target)||(i=!1)};return e.addEventListener(`pointermove`,c),e.addEventListener(`pointerenter`,l),e.addEventListener(`pointerleave`,u),e.addEventListener(`pointerdown`,d),r.addEventListener(`pointerup`,f),r.addEventListener(`keydown`,m,{passive:!1}),r.addEventListener(`keyup`,m),r.addEventListener(`blur`,h),r.document.addEventListener(`pointerdown`,g,!0),n.game&&(e.style.touchAction=`none`,e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`0`)),{dispose(){e.removeEventListener(`pointermove`,c),e.removeEventListener(`pointerenter`,l),e.removeEventListener(`pointerleave`,u),e.removeEventListener(`pointerdown`,d),r.removeEventListener(`pointerup`,f),r.removeEventListener(`keydown`,m),r.removeEventListener(`keyup`,m),r.removeEventListener(`blur`,h),r.document.removeEventListener(`pointerdown`,g,!0)}}}function aa(e){let t=e.ownerDocument.defaultView;if(!t)return 0;let n=e.getBoundingClientRect(),r=t.innerHeight||1,i=(r-n.top)/(r+n.height);return i<0?0:i>1?1:i}var $=(e,t,n)=>e<t?t:e>n?n:e;function oa(e,t,n){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`&&t&&typeof t[e]==`number`?t[e]:n}function sa(e,t){let n=Math.max(e.duration||0,.001);if(t===`timeline`)return{from:0,to:n,loop:e.loop,speed:1};let r=e.segments?.[t];if(!r)return null;let i=Array.isArray(r)?{from:r[0],to:r[1]}:r;return{from:$(oa(i.from,e.markers,0),0,n),to:$(oa(i.to,e.markers,n),0,n),loop:i.loop??!1,speed:typeof i.speed==`number`&&i.speed>0?i.speed:1}}function ca(e,t,n){let r=Math.abs(e.to-e.from),i=e.to>=e.from?1:-1,a=n===void 0?0:Math.abs(n-e.from),o=r<=0?0:Cn(Math.max(0,t*e.speed+a),r,e.loop);return e.from+i*o}function la(e,t,n){let r=Math.max(e.duration||0,.001),i=n&&n!==`seek`&&n!==`timeline`&&e.segments?.[n]?n:``;if(!i)for(let n of Object.keys(e.segments??{})){let a=sa(e,n);if(!a)continue;let o=Math.min(a.from,a.to),s=Math.max(a.from,a.to);if(t>=o&&(t<s||s>=r-1e-6&&t<=s)){i=n;break}}let a=``,o=-1/0;for(let[n,r]of Object.entries(e.markers??{}))typeof r==`number`&&r<=t+1e-6&&r>=o&&(o=r,a=n);return{time:t,duration:r,progress:$(t/r,0,1),segment:i,marker:a}}var ua=class{def;hoverClock=0;clickAt=-1;active=null;toggled=new Map;prevLocal=null;lastLocal=0;lastT=0;pending=[];constructor(e){this.def=e}get duration(){return Math.max(this.def.duration||0,.001)}reset(){this.hoverClock=0,this.clickAt=-1,this.active=null,this.toggled.clear(),this.prevLocal=null,this.lastLocal=0,this.lastT=0,this.pending=[]}get local(){return this.lastLocal}play(e,t,n={}){let r=sa(this.def,e);if(!r)return!1;let i=n.reverse?{...r,from:r.to,to:r.from}:r;return this.active={...i,name:e,start:t},this.toggled.set(e,!n.reverse),!0}toggle(e,t){let n=sa(this.def,e);if(!n)return!1;let r=!this.toggled.get(e),i=r?n:{...n,from:n.to,to:n.from},a=this.active?.name===e?this.lastLocal:void 0,o=a!==void 0&&a>=Math.min(n.from,n.to)&&a<=Math.max(n.from,n.to);return this.active={...i,loop:!1,name:e,start:t,startLocal:o?a:void 0},this.toggled.set(e,r),!0}seek(e,t){let n=$(oa(e,this.def.markers,0),0,this.duration);this.active={name:`seek`,from:n,to:n,loop:!1,speed:1,start:t}}autoRange(){let e=typeof this.def.autoplay==`string`?this.def.autoplay:null,t=e?sa(this.def,e):null,n=typeof this.def.speed==`number`&&this.def.speed>0?this.def.speed:1;return t?{...t,speed:t.speed*n}:{from:0,to:this.duration,loop:this.def.loop,speed:n}}autoLocal(e){let t=this.autoRange(),n=this.def.trigger??`visible`;if(e.staticMotion)return typeof this.def.autoplay==`string`?t.to:ca({...t,speed:1},e.posterTime??0);if(n===`manual`||this.def.autoplay===!1)return t.from;if(n===`scroll`)return t.from+(t.to-t.from)*$(e.scroll,0,1);if(e.deterministic)return ca(t,e.t);switch(n){case`hover`:{this.hoverClock+=e.hovered?e.dt:t.loop?0:-e.dt;let n=Math.abs(t.to-t.from)/t.speed;return t.loop||(this.hoverClock=$(this.hoverClock,0,n)),ca(t,this.hoverClock)}case`click`:return e.clicked&&(this.clickAt=e.t),this.clickAt<0?t.from:ca(t,e.t-this.clickAt);default:return ca(t,e.t)}}update(e){let t;return t=this.active&&!e.staticMotion?ca(this.active,Math.max(0,e.t-this.active.start),this.active.startLocal):this.autoLocal(e),t=$(t,0,this.duration),this.collectMarkers(this.prevLocal,t,e.t<this.lastT),this.prevLocal=t,this.lastLocal=t,this.lastT=e.t,t}collectMarkers(e,t,n){let r=this.def.markers;if(r&&!n)for(let[n,i]of Object.entries(r)){if(typeof i!=`number`)continue;let r;r=e===null?i<=t:t>e?i>e&&i<=t:t<e?this.isLoopingForward()?i>e||i<=t:i<e&&i>=t:!1,r&&this.pending.push({name:n,time:i})}}isLoopingForward(){let e=this.active??this.autoRange();return!!e.loop&&e.loop!==`pingpong`&&e.to>=e.from}info(){return la(this.def,this.lastLocal,this.active?.name)}drainMarkers(){let e=this.pending;return this.pending=[],e}};function da(e,t){if(typeof e!=`string`||!e.trim())return null;try{let n=new URL(e.trim(),t);return n.protocol===`http:`||n.protocol===`https:`?n.href:null}catch{return null}}var fa=new Set([`click`,`key`]),pa=class{defs;host;hoverPrev=new Set;insidePrev=!1;scrollPrev=null;visibleFired=!1;fired=new Set;queue=[];constructor(e,t){this.defs=e,this.host=t}targets(){let e=new Set;for(let t of this.defs)t.target&&(t.on===`click`||t.on===`hover`||t.on===`hoverEnd`)&&e.add(t.target);return e}reset(){this.hoverPrev.clear(),this.insidePrev=!1,this.scrollPrev=null,this.visibleFired=!1,this.fired.clear(),this.queue=[]}event(e,t){this.queue.length<64&&this.queue.push({name:e,payload:t})}fire(e,t,n){let r=0;return this.defs.forEach((i,a)=>{if(i.on===e&&!(e===`key`?i.key!==t:e===`event`?i.event!==t:(i.target??void 0)!==t)&&!(i.once&&this.fired.has(a))){this.fired.add(a),r++;for(let t of i.do??[])this.run(t,n&&fa.has(e))}}),r}step(e){for(let t of this.targets()){let n=e.hovered.has(t),r=this.hoverPrev.has(t);n&&!r&&this.fire(`hover`,t,!1),!n&&r&&this.fire(`hoverEnd`,t,!1)}this.hoverPrev=new Set([...e.hovered].filter(e=>this.isTarget(e))),e.pointerInside!==this.insidePrev&&this.fire(e.pointerInside?`hover`:`hoverEnd`,void 0,!1),this.insidePrev=e.pointerInside;for(let t of e.clicked)this.fire(`click`,t,e.userGesture);e.canvasClicked&&this.fire(`click`,void 0,e.userGesture);for(let t of e.pressed)this.fire(`key`,t,e.userGesture);e.visible&&!this.visibleFired&&(this.visibleFired=!0,this.fire(`visible`,void 0,!1)),this.scrollPrev!==null&&e.scroll!==this.scrollPrev&&this.defs.forEach((t,n)=>{if(t.on===`scroll`&&typeof t.at==`number`&&!(!(this.scrollPrev<t.at&&e.scroll>=t.at)||t.once&&this.fired.has(n))){this.fired.add(n);for(let e of t.do??[])this.run(e,!1)}}),this.scrollPrev=e.scroll,this.flush()}flush(){for(let e=0;this.queue.length&&e<16;e++){let e=this.queue;this.queue=[];for(let t of e)this.fire(`event`,t.name,!1)}this.queue=[]}isTarget(e){return this.defs.some(t=>t.target===e)}run(e,t){let n=e;if(typeof n.play==`string`)this.host.play(n.play,n.reverse===!0);else if(typeof n.toggle==`string`)this.host.toggle(n.toggle);else if(typeof n.seek==`number`||typeof n.seek==`string`)this.host.seek(n.seek);else if(n.set&&typeof n.set==`object`){let e=n.set;typeof e.path==`string`&&e.value!==void 0&&this.host.set(e.path,e.value,typeof n.duration==`number`?n.duration:0,typeof n.ease==`string`?n.ease:void 0)}else typeof n.emit==`string`?this.host.emit(n.emit,n.payload):typeof n.openUrl==`string`?t?this.host.openUrl(n.openUrl,typeof n.newTab==`boolean`?n.newTab:void 0):this.host.emit(`openUrl`,{url:n.openUrl,blocked:!0}):n.playClip!==void 0&&typeof n.target==`string`&&this.host.playClip(n.target,n.playClip,{loop:n.loop,speed:n.speed,crossfade:n.crossfade})}},ma=`top bottom`,ha=`bottom top`;function ga(e,t){return e===`top`?0:e===`center`?t/2:e===`bottom`?t:e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:e.endsWith(`px`)?Number(e.slice(0,-2)):null}function _a(e,t,n){let r=e.trim().split(/\s+/);if(r.length!==2)return null;let i=ga(r[0],t),a=ga(r[1],n);return i===null||a===null?null:i-a}function va(e,t,n,r=ma,i=ha){let a=_a(r,t,n)??-n,o=_a(i,t,n)??t,s=0-e;if(Math.abs(o-a)<1e-6)return+(s>=o);let c=(s-a)/(o-a);return c<0?0:c>1?1:c}var ya=8e3;function ba(e,t,n=ya){let r=[],i=0;if(e.traverseVisible(e=>{let t=e;if(!(t.isMesh||e.isLine)||e.isPoints)return;let n=t.geometry?.getAttribute(`position`);if(!n)return;let a=t.isInstancedMesh?t.count:1;a&&(r.push(t),i+=n.count*a)}),!r.length||!i)return null;let a=Math.max(1,Math.ceil(i/n)),o=new E,s=new F,c=new F,l=0,u=0;for(let e of r){let n=e.geometry.getAttribute(`position`),r=e,i=e.isSkinnedMesh?e:null,d=r.isInstancedMesh?r.count:1;for(let f=0;f<d;f++){r.isInstancedMesh?c.multiplyMatrices(e.matrixWorld,(r.getMatrixAt(f,s),s)):c.copy(e.matrixWorld);for(let e=f%a;e<n.count;e+=a)if(o.fromBufferAttribute(n,e),i&&i.applyBoneTransform(e,o),o.applyMatrix4(c),t.containsPoint(o)?l++:u++,l&&u)return`partial`}}return!l&&!u?null:u?`partial`:`full`}function xa(e,t,n){if(n!==`parts`){let r=e.worldToLocal(t.clone()),i=n.heightAt(r.x,r.z);return Number.isFinite(i)&&r.y<i}let r=new A,i=new F,a=!1;return e.traverseVisible(e=>{let n=e;if(a||!n.isMesh||!n.geometry)return;n.geometry.boundingBox||n.geometry.computeBoundingBox();let o=n.geometry.boundingBox,s=e;if(s.isInstancedMesh)for(let e=0;e<s.count&&!a;e++)s.getMatrixAt(e,i),r.copy(o).applyMatrix4(i.premultiply(s.matrixWorld)).containsPoint(t)&&(a=Ca(n,t,r,e));else r.copy(o).applyMatrix4(n.matrixWorld).containsPoint(t)&&(a=Ca(n,t,r))}),a}var Sa=[new E(1,0,0),new E(-1,0,0),new E(0,1,0),new E(0,-1,0),new E(0,0,1),new E(0,0,-1)];function Ca(e,t,n,r){let i=(Array.isArray(e.material)?e.material:[e.material]).filter(Boolean),a=i.map(e=>e.side);for(let e of i)e.side=2;try{let i=new g;return i.far=n.getSize(new E).length()+.001,Sa.every(n=>(i.set(t,n),i.intersectObject(e,!1).some(e=>r===void 0||e.instanceId===r)))}finally{i.forEach((e,t)=>e.side=a[t])}}var wa={none:0,aces:4,agx:6,neutral:7,reinhard:2};function Ta(e){if(e.scripts?.length||e.ui?.elements?.length||e.physics||e.audio)return!0;let t=e=>!!e?.some(e=>!!e.body||t(e.children));return t(e.objects)}function Ea(e){let t=/^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(e.target?.aspect??``);return t&&Number(t[1])>0&&Number(t[2])>0?Number(t[1])/Number(t[2]):16/9}var Da=8,Oa=2e4,ka=new Set;function Aa(e){for(;ka.size>=Da;){let t=null;for(let n of ka)n!==e&&n.releasable()&&(!t||n.lastSeen<t.lastSeen)&&(t=n);if(!t)return;t.release()}}function ja(){return ka.size}var Ma=class{container;options;scene;canvas;lastSeen=0;released=!1;releaseTimer=null;placeholder=null;readyCalled=!1;ready;issues=[];input;renderer=null;world=null;game=null;postfx=null;quality=h(`high`);qualityAuto=!1;perfClock=0;slowFor=0;renderSamples=1;inputState=ta();inputBinding=null;resolveAsset;deterministic;t=0;tl=null;interactions=null;eventListeners=new Map;scrollOverride=null;tlScroll=null;raf=0;playing=!1;visible=!0;started=!1;timeScale=1;staticMotion=!1;lastNow=0;fps=0;building=null;rebuilding=!1;disposed=!1;hovered=new Set;resizeObs=null;interObs=null;readyResolve;readyReject;raycaster=new g;width=1;height=1;lastStats={triangles:0,drawCalls:0,geometries:0,textures:0};onVisibility=()=>this.updateRunning();editor;overlay=null;worldListeners=new Set;constructor(e,t,n){this.container=e,this.options=n,this.scene=t,this.deterministic=!!n.deterministic,this.resolveAsset=gt(n),this.ready=new Promise((e,t)=>{this.readyResolve=e,this.readyReject=t}),this.ready.catch(()=>void 0);let r=e.ownerDocument;this.canvas=r.createElement(`canvas`),this.canvas.style.cssText=`display:block;width:100%;height:100%;outline:none;touch-action:manipulation;`;let i=r.defaultView?.getComputedStyle(e).position;i&&i!==`static`||(e.style.position=`relative`);let a=this;n.editor&&(this.editor={world:()=>a.world,renderer:()=>a.renderer,setOverlay:e=>{a.overlay=e},render:()=>a.render(),onWorld:e=>(a.worldListeners.add(e),()=>a.worldListeners.delete(e)),running:()=>!!a.raf}),this.input={pointer(e,t){a.inputState.pointer.x=e,a.inputState.pointer.y=t,a.inputState.pointer.inside=!0,a.inputInteractions()},key(e,t){ra(a.inputState,e,t),a.inputInteractions()},click(e,t){let n=e??a.inputState.pointer.x,r=t??a.inputState.pointer.y;a.inputState.pointer.x=n,a.inputState.pointer.y=r,a.inputState.pointer.inside=!0,a.inputState.pointer.justPressed=!0,a.inputState.clicks.push({x:n,y:r}),a.inputInteractions()},down(e,t){let n=a.inputState.pointer;e!==void 0&&t!==void 0&&(n.x=e,n.y=t),n.inside=!0,n.justPressed=!n.down,n.down=!0},up(e,t){let n=a.inputState.pointer;e!==void 0&&t!==void 0&&(n.x=e,n.y=t),n.down=!1},swipe(e){a.inputState.swipe=e},scroll(e){a.setScrollProgress(e),a.inputInteractions()}},e.appendChild(this.canvas),this.inputBinding=ia(e,this.inputState,{game:t.target?.kind===`game`}),this.measure(),typeof ResizeObserver<`u`&&(this.resizeObs=new ResizeObserver(()=>this.resize()),this.resizeObs.observe(e));let o=t.target??{},s=n.reducedMotion??(typeof matchMedia<`u`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches),c=o.reducedMotion??(o.kind===`game`?`ignore`:`static`);s&&!this.deterministic&&(c===`static`?this.staticMotion=!0:c===`slow`&&(this.timeScale=.5)),this.deterministic||o.lazy===!1||typeof IntersectionObserver>`u`?this.start():(this.visible=!1,this.interObs=new IntersectionObserver(e=>{let t=e.some(e=>e.isIntersecting);this.visible=t,this.lastSeen=performance.now(),this.releaseTimer&&clearTimeout(this.releaseTimer),this.releaseTimer=null,t?this.start():this.releasable()&&(this.releaseTimer=setTimeout(()=>this.release(),Oa)),this.updateRunning()},{rootMargin:`200px 0px`}),this.interObs.observe(e),this.armStartFallback()),r.addEventListener(`visibilitychange`,this.onVisibility)}fallbackCleanup=null;armStartFallback(){let e=this.container.ownerDocument,t=e.defaultView;if(!t)return;let n=()=>{if(this.started||this.disposed)return a();if(e.visibilityState===`hidden`||!this.container.isConnected)return;let n=this.container.getBoundingClientRect(),r=t.innerHeight||e.documentElement.clientHeight,i=t.innerWidth||e.documentElement.clientWidth;n.bottom>=-200&&n.top<=r+200&&n.right>=0&&n.left<=i&&(n.width>0||n.height>0)&&(this.visible=!0,this.lastSeen=performance.now(),this.start(),this.updateRunning(),a())},r=[setTimeout(n,500),setTimeout(n,2e3)],i=t.requestAnimationFrame(()=>i=t.requestAnimationFrame(n)),a=()=>{for(let e of r)clearTimeout(e);t.cancelAnimationFrame(i),t.removeEventListener(`load`,n),t.removeEventListener(`scroll`,n),e.removeEventListener(`visibilitychange`,n),this.fallbackCleanup=null};t.addEventListener(`load`,n),t.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`visibilitychange`,n),this.fallbackCleanup=a}createRenderer(){let e=this.scene.target??{},t=new Pe({canvas:this.canvas,antialias:e.antialias!==!1,alpha:!!e.transparent,premultipliedAlpha:!0,powerPreference:`high-performance`,preserveDrawingBuffer:this.deterministic});if(!t.getContext())throw Error(`no context`);return this.configureRenderer(t),t.info.autoReset=!1,t}configureRenderer(e){let t=this.scene.target??{};e.outputColorSpace=j,e.toneMapping=wa[t.toneMapping??`aces`]??4,e.toneMappingExposure=t.exposure??1,this.quality=h(m(t.quality,this.deviceHints(e))),this.qualityAuto=(t.quality??`auto`)===`auto`&&!this.deterministic&&!this.options.editor,this.perfClock=this.slowFor=0;let n=this.options.pixelRatio??Math.min(globalThis.devicePixelRatio||1,t.maxDpr??2,this.quality.dprCap);e.setPixelRatio(n);let r=si(this.scene);if(e.shadowMap.enabled=r.enabled,e.shadowMap.type=r.type,t.transparent)e.setClearColor(0,0);else{let t=this.scene.environment?.background;e.setClearColor(typeof t==`string`&&t!==`transparent`?V(t):new D(0),1)}}start(){if(!(this.started||this.disposed)){if(this.started=!0,Aa(this),this.released){let e=this.container.ownerDocument.createElement(`canvas`);e.style.cssText=this.canvas.style.cssText,this.canvas.replaceWith(e),this.canvas=e,this.released=!1}try{this.renderer=this.createRenderer(),ka.add(this)}catch(e){this.report({code:`webgl-unavailable`,message:`WebGL is not available: ${e.message}`}),this.readyReject(Error(`webgl-unavailable`));return}this.measure(),this.renderer.setSize(this.width,this.height,!1),this.building=this.buildAll().then(()=>{this.disposed||(this.deterministic?(this.t=0,this.frame(0)):this.staticMotion?(this.t=this.scene.target?.posterTime??0,this.game?.advanceTo(this.t),this.frame(0),this.renderStill()):(this.frame(0),this.playing=!0,this.updateRunning()),this.placeholder?.remove(),this.placeholder=null,this.readyResolve(),this.readyCalled||this.options.onReady?.(this),this.readyCalled=!0)}).catch(e=>{this.report({code:`build-error`,message:e.message}),this.readyReject(e)})}}makeContext(e){return{scene:this.scene,rng:ct(this.scene.seed??1),siblings:new Map,color:e=>V(e),resolveAsset:this.resolveAsset,renderer:this.renderer,deterministic:this.deterministic,quality:this.quality.tier,track:t=>(e.push(t.catch(()=>void 0)),this.trackProgress(t),t),onUpdate:()=>void 0,issue:(e,t,n)=>this.report({code:e,message:t,path:n}),shaders:pn,generators:mn}}async buildWorld(){let e=[],t=this.makeContext(e),n=await Qi.create(J(this.scene),t,this.width/Math.max(this.height,1),this.canvas,!!this.options.editor);return await Promise.all(e),await Promise.all(e),n.setViewport(this.width,this.height,this.renderer.getPixelRatio()),n}async attachWorld(e){this.world=e,this.attachMotion(e),e.settleEntrances=this.staticMotion,await this.buildPostFx(e),this.renderer?.shadowMap&&(this.renderer.shadowMap.needsUpdate=!0);for(let e of this.worldListeners)try{e()}catch{}}async buildAll(){let e=await this.buildWorld();if(this.disposed)e.dispose();else{if(await this.attachWorld(e),Ta(this.scene)){let{GameHost:t}=await s(async()=>{let{GameHost:e}=await import(`./game-Dv5s4eMN.js`);return{GameHost:e}},__vite__mapDeps([17,1,3,4,5]),import.meta.url);this.game=await t.create({scene:J(this.scene),container:this.container,input:this.inputState,resolveAsset:this.resolveAsset,scriptSources:this.options.scriptSources,deterministic:this.deterministic,issue:e=>this.report(e),rebuild:async()=>{let e=this.world,t=await this.buildWorld();return e?.dispose(),await this.attachWorld(t),t}},e);let n=this.game,r=n.emit.bind(n);n.emit=(e,t)=>{r(e,t),this.notify(e,t),this.dispatchMotionEvent(e,t)}}try{this.renderer?.compile(e.scene,e.camera)}catch{}}}loadTotal=0;loadDone=0;trackProgress(e){if(!this.options.onProgress)return;this.loadTotal++;let t=()=>{this.loadDone++;try{this.options.onProgress?.(this.loadDone,this.loadTotal)}catch{}};e.then(t,t)}notify(e,t){try{this.options.onEvent?.(e,t)}catch{}}emit(e,t){if(this.game)return this.game.emit(e,t);this.notify(e,t),this.dispatchMotionEvent(e,t)}dispatchMotionEvent(e,t){for(let n of this.eventListeners.get(e)??[])try{n(t)}catch{}this.interactions?.event(e,t)}report(e){this.issues.push(e);try{this.options.onError?.(e)}catch{}this.options.onError||console.warn(`[agent3d] ${e.code}: ${e.message}`)}updateRunning(){let e=this.container.ownerDocument.visibilityState===`hidden`,t=this.scene.target?.pauseOffscreen!==!1,n=this.playing&&!this.disposed&&!e&&(this.visible||!t)&&!!this.world;if(n&&!this.raf){this.lastNow=performance.now();let e=t=>{this.raf=requestAnimationFrame(e);let n=Math.min(Math.max((t-this.lastNow)/1e3,0),.1);this.lastNow=t,n>.002&&(this.fps=this.fps?this.fps*.9+1/n*.1:1/n),this.qualityAuto&&this.adaptQuality(n),this.tick(n*this.timeScale)};this.raf=requestAnimationFrame(e)}else!n&&this.raf&&(cancelAnimationFrame(this.raf),this.raf=0)}tick(e){this.world&&!this.rebuilding&&(this.game?.pendingRestart?(this.rebuilding=!0,this.game.restart().then(()=>{this.rebuilding=!1,this.t=0,this.resetMotion()})):(e=Math.max(e,0),this.t=Math.max(this.t+e,0),this.game?.advance(e),this.frame(e)))}attachMotion(e){this.tl=this.scene.timeline?new ua(this.scene.timeline):null,this.tlScroll=null,e.postfxParam=(e,t,n)=>this.postfx?.setParam?.(e,t,n);let t=this.scene.interactions??[];this.interactions=t.length?new pa(t,{play:(e,t)=>this.playSegment(e,{reverse:t}),toggle:e=>{this.tl?.toggle(e,this.t)||this.unknownSegment(e)},seek:e=>this.tl?.seek(e,this.t),set:(t,n,r,i)=>e.overrides.set(t,n,this.t,r,i),emit:(e,t)=>this.emit(e,t),openUrl:(e,t)=>this.openUrl(e,t),playClip:(t,n,r)=>{let i=e.entries.get(t)?.animator;i?i.play(n,r):this.report({code:`interaction`,message:`playClip: "${t}" is not a model with animation clips`,path:`interactions`})}}):null}handledClicks=0;handledKeys=new Set;inputInteractions(){let e=this.world;if(!this.deterministic||!this.interactions||!e)return;let t=this.inputState,n=e.interactiveRoots(),r=new Set(t.pointer.inside?this.pickIds(t.pointer.x,t.pointer.y,n):[]),i=new Set;for(let e of t.clicks.slice(this.handledClicks))for(let t of this.pickIds(e.x,e.y,n))i.add(t);let a=new Set([...t.pressed].filter(e=>!this.handledKeys.has(e)));this.interactions.step({hovered:r,pointerInside:t.pointer.inside,clicked:i,canvasClicked:t.clicks.length>this.handledClicks,pressed:a,scroll:this.scrollValue(),visible:!0,userGesture:!1}),this.handledClicks=t.clicks.length;for(let e of a)this.handledKeys.add(e)}resetMotion(){this.tl?.reset(),this.interactions?.reset(),this.tlScroll=null}unknownSegment(e){this.report({code:`interaction`,message:`Unknown timeline segment "${e}"`,path:`timeline.segments`})}timelineLocal(e,t,n){let r=this.scene.timeline;return!r||!this.world?.timeline||!this.tl?null:this.tl.update({t:this.t,dt:e,deterministic:this.deterministic,staticMotion:this.staticMotion,posterTime:this.scene.target?.posterTime,hovered:t,clicked:n,scroll:r.trigger===`scroll`?this.timelineScroll(e):0})}timelineScroll(e){let t=this.scene.timeline;if(this.scrollOverride!==null)return this.scrollOverride;if(this.deterministic||this.staticMotion)return this.scrollValue();let n=this.container.ownerDocument.defaultView,r=this.container.getBoundingClientRect(),i=va(r.top,r.height,n?.innerHeight||1,t.scroll?.start,t.scroll?.end),a=Math.min(Math.max(t.scroll?.smoothing??.8,0),.99);return this.tlScroll===null||a<=0?this.tlScroll=i:this.tlScroll+=(i-this.tlScroll)*(1-a**(Math.max(e,0)*60)),Math.abs(i-this.tlScroll)<1e-4&&(this.tlScroll=i),this.tlScroll}scrollValue(){if(this.scrollOverride!==null)return this.scrollOverride;if(this.deterministic||this.staticMotion){let e=this.scene.timeline,t=e?.trigger===`scroll`&&e.duration>0?e.duration:4;return Math.min(Math.max(this.t/t,0),1)}return aa(this.container)}openUrl(e,t){let n=this.container.ownerDocument.defaultView,r=n?da(e,n.location.href):null;if(this.emit(`openUrl`,{url:r??e,blocked:!r||this.deterministic}),!r||!n||this.deterministic)return;let i=new URL(r).origin!==n.location.origin;t??i?n.open(r,`_blank`,`noopener,noreferrer`):n.location.assign(r)}playSegment(e,t={}){this.tl?.play(e,this.t,t)||this.unknownSegment(e)}trigger(e,t){this.interactions?.fire(e,t,!this.deterministic),this.interactions?.flush()}on(e,t){let n=this.eventListeners.get(e);return n||this.eventListeners.set(e,n=new Set),n.add(t),()=>n.delete(t)}setScrollProgress(e){this.scrollOverride=e===null||!Number.isFinite(e)?null:Math.min(Math.max(e,0),1)}pickIds(e,t,n){if(!this.world||!n.length)return[];this.raycaster.setFromCamera(new C(e,t),this.world.camera);let r=this.raycaster.intersectObjects(n,!0).find(e=>e.object.visible&&!e.object.isPoints);return r?this.world.idsFor(r.object):[]}frame(e){let t=this.world;if(!t)return;let n=this.inputState,r=t.interactiveRoots();this.hovered=new Set(n.pointer.inside?this.pickIds(n.pointer.x,n.pointer.y,r):[]);let i=new Set;for(let e of n.clicks){let n=this.pickIds(e.x,e.y,r);for(let e of n)i.add(e);if(this.options.onClick){let r=[...t.entries.values()].filter(e=>e.topLevel&&e.kind!==`light`).map(e=>e.object),i=n[0]??this.pickIds(e.x,e.y,r)[0]??null;try{this.options.onClick(i,{x:e.x,y:e.y})}catch{}}let a=n.map(e=>t.entries.get(e)?.def).find(e=>e&&`href`in e&&e.href);a?.href&&!this.deterministic&&this.navigate(a.href)}let a=[...this.hovered].some(e=>!!t.entries.get(e)?.def?.href)||[...this.hovered].some(e=>t.entries.get(e)?.interactive)?`pointer`:``;this.canvas.style.cursor!==a&&(this.canvas.style.cursor=a);let o=this.scrollValue(),s=i;if(this.handledClicks){s=new Set;for(let e of n.clicks.slice(this.handledClicks))for(let t of this.pickIds(e.x,e.y,r))s.add(t)}this.interactions?.step({hovered:this.hovered,pointerInside:n.pointer.inside,clicked:s,canvasClicked:n.clicks.length>this.handledClicks,pressed:this.handledKeys.size?new Set([...n.pressed].filter(e=>!this.handledKeys.has(e))):n.pressed,scroll:o,visible:!0,userGesture:!this.deterministic});let c={pointer:n.pointer,scroll:o,hovered:this.hovered,clicked:i,timelineT:this.timelineLocal(e,n.pointer.inside,n.clicks.length>0)};for(let e of this.tl?.drainMarkers()??[])this.emit(e.name,{marker:e.name,time:e.time});this.interactions?.flush();let l=this.scene.camera?.follow?.target;t.frame(this.t,e,c,l?t.entries.get(l)?.object:null),this.game?.hud?.setTimeline(this.tl&&c.timelineT!==null?this.tl.info():null),this.game?.afterFrame(),this.render(),na(n),this.handledClicks=0,this.handledKeys.clear()}navigate(e){let t=this.container.ownerDocument.defaultView;if(!t)return;let n=da(e,t.location.href);if(!n)return;let r=new URL(n);r.origin===t.location.origin?t.location.assign(r.href):t.open(r.href,`_blank`,`noopener,noreferrer`)}render(e=!0){let t=this.renderer,n=this.world;if(!t||!n)return;let r=e?this.overlay:null,i=r?.viewCamera?.()??null,a=n.camera,o=i&&i!==a?{p:a.position.clone(),q:a.quaternion.clone(),proj:a.projectionMatrix.clone(),inv:a.projectionMatrixInverse.clone(),near:a.near,far:a.far}:null;if(i&&o){i.updateMatrixWorld(),i.matrixWorld.decompose(a.position,a.quaternion,new E),a.projectionMatrix.copy(i.projectionMatrix),a.projectionMatrixInverse.copy(i.projectionMatrixInverse);let e=i;typeof e.near==`number`&&(a.near=e.near,a.far=e.far),a.updateMatrixWorld(!0)}if(t.info.reset(),this.postfx?this.postfx.render(this.t,{samples:this.renderSamples}):t.render(n.scene,n.camera),this.renderSamples===1&&(this.lastStats={triangles:t.info.render.triangles,drawCalls:t.info.render.calls,geometries:t.info.memory.geometries,textures:t.info.memory.textures}),r)try{r.draw(t,a)}catch(e){this.report({code:`editor-overlay`,message:e.message}),this.overlay=null}o&&(a.position.copy(o.p),a.quaternion.copy(o.q),a.projectionMatrix.copy(o.proj),a.projectionMatrixInverse.copy(o.inv),a.near=o.near,a.far=o.far,a.updateMatrixWorld(!0))}releasable(){return!!this.renderer&&!!this.world&&!this.game&&!this.deterministic&&!this.options.editor&&!this.visible&&!this.disposed&&!this.released&&!Ta(this.scene)}release(){if(!this.releasable())return;this.releaseTimer&&clearTimeout(this.releaseTimer),this.releaseTimer=null;let e=``;try{this.render(),e=this.canvas.toDataURL(`image/webp`,.85)}catch{}if(e&&e.length>32){let t=this.container.ownerDocument.createElement(`img`);t.alt=``,t.setAttribute(`aria-hidden`,`true`),t.style.cssText=`position:absolute;inset:0;width:100%;height:100%;pointer-events:none;`,t.src=e,this.placeholder?.remove(),this.placeholder=t,this.canvas.after(t)}this.raf&&cancelAnimationFrame(this.raf),this.raf=0,this.postfx?.dispose(),this.postfx=null,this.world?.dispose(),this.world=null,this.renderer?.dispose(),this.renderer?.forceContextLoss(),this.renderer=null,ka.delete(this),this.released=!0,this.started=!1,this.building=null}play(){this.playing=!0,this.start(),this.updateRunning()}pause(){this.playing=!1,this.updateRunning(),this.deterministic||this.renderStill()}async seek(e){if(this.started||this.start(),await this.building,!this.world)return;let t=Math.max(0,e);t<this.t-1e-9&&(this.game?await this.game.restart():this.world.resetBehaviours(),this.t=0,this.resetMotion(),this.world.frame(0,0,{pointer:this.inputState.pointer,scroll:0,hovered:new Set,clicked:new Set,timelineT:this.world.timeline?0:null})),this.advanceMotionGrid(t);let n=t-this.t;this.t=t,this.game?.advanceTo(t),this.frame(n)}advanceMotionGrid(e){let t=this.world;if(!t||!this.deterministic||this.game||!t.hasStatefulMotion())return;let n=this.scene.camera?.follow?.target,r=n?t.entries.get(n)?.object:null;for(let n of dr(this.t,e)){let e=n-this.t;this.t=n;let i=this.inputState,a=t.interactiveRoots(),o=new Set(i.pointer.inside?this.pickIds(i.pointer.x,i.pointer.y,a):[]);t.frame(this.t,e,{pointer:i.pointer,scroll:this.scrollValue(),hovered:o,clicked:new Set,timelineT:this.timelineLocal(e,i.pointer.inside,!1)},r)}}time(){return this.t}async update(e){if(await this.building,this.scene=e,!this.renderer)return;this.renderer&&this.configureRenderer(this.renderer),this.game?.dispose(),this.game=null;let t=this.world;this.world=null,t?.dispose(),this.postfx?.dispose(),this.postfx=null,this.building=this.buildAll(),await this.building,this.frame(0)}measure(){let e=Math.max(1,this.container.clientWidth||this.canvas.clientWidth||300),t=this.container.clientHeight;t||=Math.round(e/Ea(this.scene)),this.width=e,this.height=Math.max(1,t)}resize(){this.renderer&&(this.measure(),this.renderer.setSize(this.width,this.height,!1),this.world?.setViewport(this.width,this.height,this.renderer.getPixelRatio()),this.postfx?.setSize(this.width,this.height),this.world&&(!this.raf||this.deterministic)&&this.render())}stats(){return{...this.lastStats,fps:this.deterministic?void 0:Math.round(this.fps)||void 0}}inspect(){let e=this.world,t=e?.camera,n={objects:[],camera:{position:[0,0,0],target:[0,0,0]}};if(!e||!t)return n;e.scene.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let r=new ve().setFromProjectionMatrix(new F().multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse)),i=t.getWorldPosition(new E),a=new A,o=new E,s;for(let c of e.entries.values()){if(!c.topLevel)continue;if(a.setFromObject(c.object),c.particles){let e=c.object.geometry;e.boundingBox&&a.copy(e.boundingBox).applyMatrix4(c.object.matrixWorld)}if(a.isEmpty())continue;let e=0,l=1/0,u=1/0,d=-1/0,f=-1/0;for(let n=0;n<8;n++)o.set(n&1?a.max.x:a.min.x,n&2?a.max.y:a.min.y,n&4?a.max.z:a.min.z),r.containsPoint(o)&&e++,o.project(t),l=Math.min(l,o.x),d=Math.max(d,o.x),u=Math.min(u,o.y),f=Math.max(f,o.y);let p=e===8?`full`:r.intersectsBox(a)?`partial`:`none`;p===`partial`&&!c.particles&&(p=ba(c.object,r)??p);let m=Math.max(-1,l),h=Math.min(1,d),g=Math.max(-1,u),_=Math.min(1,f),v=p===`none`||a.containsPoint(i)?+!!a.containsPoint(i):Math.max(0,h-m)*Math.max(0,_-g)/4;!s&&c.kind!==`particles`&&a.containsPoint(i)&&(c.kind!==`generator`||xa(c.object,i,c.def.generator===`terrain`&&c.built?.heightAt?{heightAt:c.built.heightAt}:`parts`))&&(s=c.id),n.objects.push({id:c.id,min:[a.min.x,a.min.y,a.min.z],max:[a.max.x,a.max.y,a.max.z],inView:p,screenCoverage:Math.round(Math.min(1,v)*1e3)/1e3})}let c=e.rig.orbit?e.rig.orbit.target:e.rig.rest.target;return n.camera={position:[i.x,i.y,i.z],target:[c.x,c.y,c.z]},s&&(n.camera.insideObject=s),n}snapshot(e=`image/png`,t){this.renderSamples=this.deterministic&&this.postfx?.stillSamples||1;try{this.render(!1)}finally{this.renderSamples=1}return this.canvas.toDataURL(e,t)}async snapshotHighQuality(e=16,t=`image/png`,n){this.started||this.start(),await this.building;let r=this.renderer,i=this.world;if(!r||!i)return this.canvas.toDataURL(t,n);let a=Math.max(1,Math.min(64,Math.round(e))),o=null;if(!this.postfx){let{createPostFx:e}=await s(async()=>{let{createPostFx:e}=await import(`./postfx-BWWXb8i8.js`);return{createPostFx:e}},__vite__mapDeps([18,1,4,5,3]),import.meta.url);o=e([],{renderer:r,scene:i.scene,camera:i.camera,width:this.width,height:this.height,quality:h(`ultra`),antialias:this.scene.target?.antialias!==!1},()=>void 0)}let c=this.postfx??o;try{return c.render(this.t,{samples:a}),this.canvas.toDataURL(t,n)}finally{o?.dispose()}}deviceHints(e){let t=globalThis.navigator??{},n;try{let t=e.getContext(),r=t.getExtension(`WEBGL_debug_renderer_info`);n=String(t.getParameter(r?r.UNMASKED_RENDERER_WEBGL:t.RENDERER)??``)}catch{}let r=t.userAgent??``;return{deterministic:this.deterministic,mobile:t.userAgentData?.mobile??/Mobi|Android|iPhone|iPad|iPod/i.test(r),cores:t.hardwareConcurrency,memoryGb:t.deviceMemory,gpu:n}}async buildPostFx(e,t=!1){if(t||(this.postfx?.dispose(),this.postfx=null),!this.scene.postfx?.length||!this.renderer)return;let{createPostFx:n}=await s(async()=>{let{createPostFx:e}=await import(`./postfx-BWWXb8i8.js`);return{createPostFx:e}},__vite__mapDeps([18,1,4,5,3]),import.meta.url);if(this.world!==e||!this.renderer)return;let r=n(this.scene.postfx,{renderer:this.renderer,scene:e.scene,camera:e.camera,width:this.width,height:this.height,quality:this.quality,antialias:this.scene.target?.antialias!==!1},e=>this.report({code:`unknown-catalog-id`,message:`Unknown post effect "${e}"`,path:`postfx`}));if(await r.ready,this.world!==e)return r.dispose();this.postfx?.dispose(),this.postfx=r}renderStill(){let e=this.postfx?.stillSamples??0;if(!(e<2||!this.world)){this.renderSamples=e;try{this.render()}finally{this.renderSamples=1}}}adaptQuality(e){let t=this.renderer;if(!t||!this.world||this.rebuilding||(this.perfClock+=e,this.perfClock<2)||(this.fps<40?this.slowFor+=e:this.slowFor=Math.max(0,this.slowFor-e),this.slowFor<3))return;if(this.slowFor=0,this.perfClock=0,this.options.pixelRatio===void 0&&t.getPixelRatio()>1.01){t.setPixelRatio(Math.max(1,t.getPixelRatio()*.75)),this.resize();return}let n=f(this.quality.tier);n?(this.quality=h(n),this.scene.postfx?.length&&this.buildPostFx(this.world,!0)):this.qualityAuto=!1}pick(e,t){let n=this.world;if(!n)return null;let r=[...n.entries.values()].filter(e=>e.topLevel&&e.kind!==`light`).map(e=>e.object);return this.pickIds(e,t,r)[0]??null}state(){return this.game?.state??{}}dispose(){this.disposed||(this.disposed=!0,this.raf&&cancelAnimationFrame(this.raf),this.raf=0,this.resizeObs?.disconnect(),this.interObs?.disconnect(),this.fallbackCleanup?.(),this.container.ownerDocument.removeEventListener(`visibilitychange`,this.onVisibility),this.inputBinding?.dispose(),this.overlay=null,this.worldListeners.clear(),this.game?.dispose(),this.postfx?.dispose(),this.world?.dispose(),this.renderer?.dispose(),this.renderer?.forceContextLoss(),ka.delete(this),this.releaseTimer&&clearTimeout(this.releaseTimer),this.placeholder?.remove(),this.canvas.remove())}};function Na(e,t,n={}){let r=new Ma(e,t,n);return r.canvas.isConnected&&r.resize(),r}var Pa=typeof HTMLElement<`u`?HTMLElement:class{},Fa=`
554
- :host{display:block;position:relative;width:100%;overflow:hidden;background:var(--agent3d-background,transparent);contain:layout paint;-webkit-tap-highlight-color:transparent}
555
- :host([hidden]){display:none}
556
- :host([interactive="false"]) ::slotted(*){pointer-events:none}
557
- ::slotted(script){display:none}
558
- .poster,.print{position:absolute;inset:0;width:100%;height:100%;z-index:1;pointer-events:none;transition:opacity var(--agent3d-fade,.4s) ease;border:0;overflow:hidden}
559
- .poster img,::slotted([slot="poster"]),.print{object-fit:var(--agent3d-poster-fit,cover);display:block;width:100%;height:100%}
560
- .poster[hidden],.print{display:none}
561
- :host([status="ready"]) .poster{opacity:0}
562
- .loading{position:absolute;left:0;right:0;bottom:0;height:3px;z-index:2;pointer-events:none;opacity:0;transition:opacity .3s ease .4s;overflow:hidden}
563
- :host([status="loading"]) .loading{opacity:1}
564
- .bar{height:100%;width:30%;background:var(--agent3d-loading-color,currentColor);opacity:.55;border-radius:0 2px 2px 0;transition:width .25s ease}
565
- .loading.indeterminate .bar{animation:a3d-slide 1.2s ease-in-out infinite}
566
- @keyframes a3d-slide{0%{transform:translateX(-100%)}100%{transform:translateX(340%)}}
567
- .fallback{position:absolute;inset:0;z-index:1;display:none;align-items:center;justify-content:center;text-align:center;padding:12px;font:14px/1.4 system-ui,sans-serif;color:inherit;opacity:.75}
568
- :host([status="unsupported"]) .fallback.show,:host([status="error"]) .fallback.show{display:flex}
569
- :host([status="unsupported"]) .poster,:host([status="error"]) .poster{opacity:1}
570
- @media (prefers-reduced-motion:reduce){.loading.indeterminate .bar{animation:none;width:100%;opacity:.3}.poster{transition:none}}
571
- @media print{::slotted(canvas),::slotted(img){visibility:hidden}.print{display:block}.loading{display:none}.poster{opacity:1}}
572
- `,Ia=null;function La(e){try{return`adoptedStyleSheets`in e&&typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`}catch{return!1}}function Ra(e){let t=/^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(e??``);return!t||!(Number(t[1])>0)||!(Number(t[2])>0)?null:`${t[1]} / ${t[2]}`}function za(){let e=typeof navigator<`u`?navigator:{};if(e.connection?.saveData)return`low`;let t=e.hardwareConcurrency??8,n=e.deviceMemory??8;return t<=2||n<=2?`low`:t<=4||n<=4?`medium`:`high`}function Ba(e,t){let n=e;if(t.data&&Object.keys(t.data).length&&(n={...n,data:{...n.data??{},...t.data}}),t.loop!=null&&n.timeline){let e=t.loop.trim().toLowerCase(),r=e===`pingpong`?`pingpong`:e!==`false`&&e!==`0`&&e!==`no`;n={...n,timeline:{...n.timeline,loop:r}}}let r=t.quality?t.quality===`auto`?za():t.quality:null;if((t.quality===`low`||t.quality===`medium`||t.quality===`high`||t.quality===`ultra`)&&(n={...n,target:{...n.target,quality:t.quality}}),r===`low`||r===`medium`||r===`high`){let e=r===`low`?1:r===`medium`?1.5:2,t={...n.target,maxDpr:Math.min(n.target?.maxDpr??2,e)};r===`low`&&Object.assign(t,{antialias:!1,shadows:!1}),n={...n,target:t,...r===`low`?{postfx:void 0}:{}}}return J(n)}var Va=class extends Pa{static get observedAttributes(){return[`src`,`poster`,`aspect`,`alt`,`paused`,`loop`,`quality`,`library-base`]}player=null;ready;resolveReady;root=null;posterEl=null;posterBox=null;printEl=null;loadingEl=null;barEl=null;fallbackEl=null;sizeStyle=null;sizeSheet=null;sizeCssText=``;loadToken=0;connected=!1;source=null;dataOverrides={};dataObserver=null;interObs=null;inView=!0;lostTimer=null;wantPlay=null;autoAriaLabel=null;constructor(){super(),this.resetReady()}readySettled=!1;resetReady(){this.readySettled=!1,this.ready=new Promise(e=>this.resolveReady=e)}connectedCallback(){this.connected=!0,this.ensureShadow(),this.updatePoster(),this.applyAspect(null),this.ownerDocument.defaultView?.addEventListener(`beforeprint`,this.onBeforePrint),this.addEventListener(`webglcontextlost`,this.onContextLost,!0),this.addEventListener(`webglcontextrestored`,this.onContextRestored,!0),typeof MutationObserver<`u`&&(this.dataObserver=new MutationObserver(e=>{e.some(e=>e.attributeName?.startsWith(`data-`))&&this.refreshData()}),this.dataObserver.observe(this,{attributes:!0})),typeof IntersectionObserver<`u`&&(this.interObs=new IntersectionObserver(e=>this.inView=e.some(e=>e.isIntersecting)),this.interObs.observe(this)),this.load()}disconnectedCallback(){this.connected=!1,this.loadToken++,this.ownerDocument.defaultView?.removeEventListener(`beforeprint`,this.onBeforePrint),this.removeEventListener(`webglcontextlost`,this.onContextLost,!0),this.removeEventListener(`webglcontextrestored`,this.onContextRestored,!0),this.dataObserver?.disconnect(),this.dataObserver=null,this.interObs?.disconnect(),this.interObs=null,this.lostTimer&&clearTimeout(this.lostTimer),this.lostTimer=null,this.player?.dispose(),this.player=null,this.setStatus(`idle`)}attributeChangedCallback(e,t,n){this.connected&&t!==n&&(e===`poster`||e===`alt`?this.updatePoster():e===`aspect`?this.applyAspect(this.source):e===`paused`?n===null?this.getAttribute(`status`)===`ready`&&this.player?.play():this.player?.pause():e===`src`?(this.source=null,this.load()):this.rebuild())}play(){this.wantPlay=!0,this.hasAttribute(`paused`)&&this.removeAttribute(`paused`),this.player?.play()}pause(){this.wantPlay=!1,this.player?.pause()}async seek(e){await(this.player??await this.ready).seek(e)}get data(){return{...this.source?.data??{},...this.attrData(),...this.dataOverrides}}async setData(e,t={}){this.dataOverrides=t.replace?{...e}:{...this.dataOverrides,...e},await this.rebuild()}trigger(e,t){this.player?.emit?this.player.emit(e,t):this.ready.then(n=>n.emit?.(e,t))}reload(){return this.source=null,this.load()}ensureShadow(){if(this.root||typeof this.attachShadow!=`function`)return;let e=this.ownerDocument;this.root=this.shadowRoot??this.attachShadow({mode:`open`});let t=[];if(La(this.root))Ia||(Ia=new CSSStyleSheet,Ia.replaceSync(Fa)),this.sizeSheet=new CSSStyleSheet,this.root.adoptedStyleSheets=[Ia,this.sizeSheet];else{let n=e.createElement(`style`);n.textContent=Fa,this.sizeStyle=e.createElement(`style`),t=[n,this.sizeStyle]}let n=e.createElement(`slot`);this.posterBox=e.createElement(`div`),this.posterBox.className=`poster`,this.posterBox.setAttribute(`part`,`poster`);let r=e.createElement(`slot`);r.name=`poster`,this.posterEl=e.createElement(`img`),this.posterEl.setAttribute(`part`,`poster-image`),this.posterEl.decoding=`async`,r.appendChild(this.posterEl),this.posterBox.appendChild(r),this.printEl=e.createElement(`img`),this.printEl.className=`print`,this.printEl.alt=``,this.loadingEl=e.createElement(`div`),this.loadingEl.className=`loading indeterminate`,this.loadingEl.setAttribute(`part`,`loading`),this.loadingEl.setAttribute(`aria-hidden`,`true`),this.barEl=e.createElement(`div`),this.barEl.className=`bar`,this.barEl.setAttribute(`part`,`loading-bar`),this.loadingEl.appendChild(this.barEl),this.fallbackEl=e.createElement(`div`),this.fallbackEl.className=`fallback`,this.fallbackEl.setAttribute(`part`,`fallback`);let i=e.createElement(`slot`);i.name=`fallback`,this.fallbackEl.appendChild(i),this.root.append(...t,n,this.posterBox,this.printEl,this.loadingEl,this.fallbackEl)}updatePoster(){let e=this.posterEl;if(!e)return;let t=this.getAttribute(`poster`);e.alt=this.getAttribute(`alt`)??this.getAttribute(`aria-label`)??``,t?e.getAttribute(`src`)!==t&&(e.src=t):e.removeAttribute(`src`),this.posterBox&&(this.posterBox.hidden=!this.posterSrc()),this.updateFallbackText()}posterSrc(){let e=this.querySelector(`[slot="poster"]`),t=e?.tagName===`IMG`?e:e?.querySelector(`img`);return t?.currentSrc||t?.getAttribute(`src`)||this.getAttribute(`poster`)}updateFallbackText(){let e=this.fallbackEl;if(!e)return;let t=e.querySelector(`slot`),n=!!this.querySelector(`[slot="fallback"]`),r=!!this.posterSrc();e.classList.toggle(`show`,n||!r),t&&!n&&(t.textContent=this.getAttribute(`alt`)??this.getAttribute(`aria-label`)??``)}setStatus(e){e===`idle`?this.removeAttribute(`status`):this.setAttribute(`status`,e),(e===`unsupported`||e===`error`)&&this.updateFallbackText()}progress(e,t){this.loadingEl&&this.barEl&&t>0&&(this.loadingEl.classList.remove(`indeterminate`),this.barEl.style.width=`${Math.round(Math.min(e,t)/t*100)}%`),this.emit(`agent3d:progress`,{loaded:e,total:t})}emit(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}fail(e){this.emit(`agent3d:error`,e),this.emit(`agent3d-error`,e)}onBeforePrint=()=>{let e=this.printEl;if(!e)return;let t=``;try{this.player&&this.getAttribute(`status`)===`ready`&&(t=this.player.snapshot(`image/png`))}catch{}(!t||t.length<32)&&(t=this.posterSrc()??``),t?e.src=t:e.removeAttribute(`src`)};onContextLost=e=>{this.player&&this.inView&&this.getAttribute(`status`)===`ready`&&(e.preventDefault(),this.fail({code:`context-lost`,message:`The WebGL context was lost; restoring.`}),this.setStatus(`loading`),this.lostTimer&&clearTimeout(this.lostTimer),this.lostTimer=setTimeout(()=>{this.lostTimer=null,this.rebuild(!0)},3e3))};onContextRestored=()=>{this.lostTimer&&clearTimeout(this.lostTimer),this.lostTimer=null;let e=this.player;e&&e.update(e.scene).then(()=>this.setStatus(`ready`),()=>void this.rebuild(!0))};childJson(e){let t=this.querySelector(e);if(t?.textContent)try{return JSON.parse(t.textContent)}catch(e){this.fail({code:`invalid-scene`,message:`Invalid inline JSON: ${e.message}`});return}}attrData(){return un(this.dataset??{})}refreshData(){this.source&&this.rebuild()}base(){let e=this.getAttribute(`src`);return e?new URL(`.`,new URL(e,this.ownerDocument.baseURI)).href:this.ownerDocument.baseURI}async fetchScene(){let e=this.childJson(`script[type="application/json"]:not([data-assets])`);if(e)return e;let t=this.getAttribute(`src`);if(!t)return;let n=new URL(t,this.ownerDocument.baseURI).href,r=await fetch(n);if(!r.ok)throw Error(`HTTP ${r.status}`);return await r.json()}async load(){let e=++this.loadToken;if(!this.source){this.setStatus(`loading`);let t;try{if(t=await this.fetchScene(),!t&&this.ownerDocument.readyState===`loading`){if(await new Promise(e=>this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>e(),{once:!0})),e!==this.loadToken)return;t=await this.fetchScene()}}catch(t){if(e!==this.loadToken)return;this.setStatus(`error`),this.fail({code:`scene-load`,message:`Cannot load ${this.getAttribute(`src`)}: ${t.message}`,path:this.getAttribute(`src`)??void 0});return}if(e!==this.loadToken)return;if(!t){this.setStatus(`idle`);return}this.source=t}await this.mount(e)}async rebuild(e=!1){if(!this.connected||!this.source)return;let t=this.player;if(t&&!e&&this.getAttribute(`status`)===`ready`&&this.getAttribute(`library-base`)===this.mountedLibraryBase){let e=this.sceneForMount();this.applySizing(e),await t.update(e)}else await this.mount(++this.loadToken)}sceneForMount(){return Ba(this.source,{data:{...this.attrData(),...this.dataOverrides},loop:this.getAttribute(`loop`),quality:this.getAttribute(`quality`)})}mountedLibraryBase=null;async mount(e){this.player?.dispose(),this.player=null,this.readySettled&&this.resetReady(),this.setStatus(`loading`);let t=this.sceneForMount();this.applySizing(t);let n=this.childJson(`script[data-assets]`),r={};this.querySelectorAll(`script[type="text/agent3d-script"][data-path]`).forEach(e=>{r[e.getAttribute(`data-path`)]=e.textContent??``});let i=this.getAttribute(`library-base`);this.mountedLibraryBase=i;let a=Na(this,t,{assetBase:this.base(),libraryBase:i?new URL(i,this.ownerDocument.baseURI).href:void 0,assetUrls:n,scriptSources:Object.keys(r).length?r:void 0,onError:t=>{e===this.loadToken&&(t.code===`webgl-unavailable`&&this.setStatus(`unsupported`),this.fail(t))},onEvent:(t,n)=>e===this.loadToken&&this.emit(`agent3d:event`,{name:t,payload:n}),onClick:(t,n)=>e===this.loadToken&&this.emit(`agent3d:click`,{id:t,x:n.x,y:n.y}),onProgress:(t,n)=>e===this.loadToken&&this.progress(t,n)});this.player=a;try{await a.ready}catch{e===this.loadToken&&this.getAttribute(`status`)!==`unsupported`&&this.setStatus(`error`);return}if(e!==this.loadToken)return;let o=(this.getAttribute(`autoplay`)??``).toLowerCase();(this.hasAttribute(`paused`)||this.wantPlay===!1||this.wantPlay!==!0&&(o===`false`||o===`0`||o===`no`))&&a.pause(),this.setStatus(`ready`),this.readySettled=!0,this.resolveReady(a),this.emit(`agent3d:ready`,{player:a}),this.emit(`agent3d-ready`,{player:a})}applyAspect(e){if(!this.sizeStyle&&!this.sizeSheet)return;let t=e?.target,n;n=t?.height?`:host{height:${t.height}}`:t?.kind===`fullscreen`?`:host{height:100vh;height:100dvh}`:`:host{aspect-ratio:${Ra(e?t?.aspect??this.getAttribute(`aspect`):this.getAttribute(`aspect`)??`16:9`)??`16 / 9`}}`,this.sizeCssText!==n&&(this.sizeCssText=n,this.sizeSheet?this.sizeSheet.replaceSync(n):this.sizeStyle&&(this.sizeStyle.textContent=n))}applySizing(e){if(this.sizeStyle||this.sizeSheet)this.applyAspect(e);else{this.style.display||(this.style.display=`block`),this.style.width||(this.style.width=`100%`),this.style.position||(this.style.position=`relative`);let t=Ra(e.target?.aspect)??`16 / 9`;e.target?.height?this.style.height=e.target.height:this.style.aspectRatio=t}let t=e.target?.kind===`game`;this.setAttribute(`role`,t?`application`:`img`);let n=this.getAttribute(`aria-label`);(n===null||n===this.autoAriaLabel)&&(this.autoAriaLabel=e.ariaLabel||e.title||`3D scene`,this.setAttribute(`aria-label`,this.autoAriaLabel)),t&&!this.hasAttribute(`tabindex`)&&(this.tabIndex=0),this.updatePoster()}};function Ha(e=`agent3d-scene`){typeof customElements<`u`&&(customElements.get(e)||customElements.define(e,Va))}var Ua=_e({Agent3DSceneElement:()=>Va,bindSceneData:()=>J,liveContextCount:()=>ja,mountScene:()=>Na,version:()=>c});Ha();var Wa=globalThis;Wa.Agent3D||={mountScene:Na,version:c,bindSceneData:J,liveContexts:ja};export{Va as Agent3DSceneElement,en as a,J as bindSceneData,zt as c,yt as d,vt as f,ln as i,Tt as l,ja as liveContextCount,Na as mountScene,Vr as n,tn as o,Br as r,Bt as s,Ua as t,Et as u,c as version};