3d-spinner 0.9.2 → 0.9.3

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 (97) hide show
  1. package/README.md +66 -4
  2. package/dist/animation-label.d.ts +8 -0
  3. package/dist/animation-label.js +47 -0
  4. package/dist/animation.d.ts +2 -0
  5. package/dist/animations/charged-orb.d.ts +55 -0
  6. package/dist/animations/charged-orb.js +229 -0
  7. package/dist/animations/grid-assembly.d.ts +67 -0
  8. package/dist/animations/grid-assembly.js +268 -0
  9. package/dist/animations/object-motion.d.ts +19 -7
  10. package/dist/animations/object-motion.js +38 -32
  11. package/dist/animations/particles.d.ts +110 -0
  12. package/dist/animations/particles.js +209 -0
  13. package/dist/cjs/animations/charged-orb.cjs +1334 -0
  14. package/dist/cjs/animations/grid-assembly.cjs +1498 -0
  15. package/dist/cjs/animations/object-motion.cjs +124 -43
  16. package/dist/cjs/animations/particles.cjs +1940 -0
  17. package/dist/cjs/animations/spin.cjs +4 -3
  18. package/dist/cjs/composite-animation.cjs +58 -0
  19. package/dist/cjs/engines/little-3d-engine/little-3d-engine.cjs +131 -22
  20. package/dist/cjs/engines/little-3d-engine/loaders/obj.cjs +30 -1
  21. package/dist/cjs/engines/little-3d-engine/renderers/canvas2d-textured.cjs +345 -0
  22. package/dist/cjs/engines/little-3d-engine/renderers/webgl-textured.cjs +528 -0
  23. package/dist/cjs/engines/little-3d-engine/renderers/webgpu-textured.cjs +712 -0
  24. package/dist/cjs/prefabs/prefabs.cjs +3450 -0
  25. package/dist/composite-animation.d.ts +18 -0
  26. package/dist/composite-animation.js +39 -0
  27. package/dist/engines/little-3d-engine/little-3d-engine.d.ts +17 -12
  28. package/dist/engines/little-3d-engine/little-3d-engine.js +13 -8
  29. package/dist/engines/little-3d-engine/loaders/obj.d.ts +12 -4
  30. package/dist/engines/little-3d-engine/loaders/obj.js +44 -5
  31. package/dist/engines/little-3d-engine/renderer.d.ts +7 -1
  32. package/dist/engines/little-3d-engine/renderer.js +2 -0
  33. package/dist/engines/little-3d-engine/renderers/canvas2d-textured.d.ts +20 -0
  34. package/dist/engines/little-3d-engine/renderers/canvas2d-textured.js +135 -0
  35. package/dist/engines/little-3d-engine/renderers/textured-helpers.d.ts +9 -0
  36. package/dist/engines/little-3d-engine/renderers/textured-helpers.js +35 -0
  37. package/dist/engines/little-3d-engine/renderers/webgl-textured.d.ts +43 -0
  38. package/dist/engines/little-3d-engine/renderers/webgl-textured.js +211 -0
  39. package/dist/engines/little-3d-engine/renderers/webgpu-textured.d.ts +45 -0
  40. package/dist/engines/little-3d-engine/renderers/webgpu-textured.js +300 -0
  41. package/dist/engines/little-3d-engine/renderers/webgpu.d.ts +11 -6
  42. package/dist/engines/little-3d-engine/shapes/complex/plane.d.ts +3 -0
  43. package/dist/engines/little-3d-engine/shapes/complex/plane.js +33 -0
  44. package/dist/engines/little-3d-engine/shapes/{cube.d.ts → primitives/cube.d.ts} +1 -1
  45. package/dist/engines/little-3d-engine/shapes/{octahedron.d.ts → primitives/octahedron.d.ts} +1 -1
  46. package/dist/engines/little-3d-engine/shapes/{pyramid.d.ts → primitives/pyramid.d.ts} +1 -1
  47. package/dist/engines/little-3d-engine/shapes/primitives/quad.d.ts +9 -0
  48. package/dist/engines/little-3d-engine/shapes/primitives/quad.js +18 -0
  49. package/dist/engines/little-3d-engine/shapes/{cube-sphere.d.ts → primitives/spheres/cube-sphere.d.ts} +1 -1
  50. package/dist/engines/little-3d-engine/shapes/{icosphere.d.ts → primitives/spheres/icosphere.d.ts} +1 -1
  51. package/dist/engines/little-3d-engine/shapes/{icosphere.js → primitives/spheres/icosphere.js} +1 -1
  52. package/dist/engines/little-3d-engine/shapes/{octa-sphere.d.ts → primitives/spheres/octa-sphere.d.ts} +1 -1
  53. package/dist/engines/little-3d-engine/shapes/{octa-sphere.js → primitives/spheres/octa-sphere.js} +1 -1
  54. package/dist/engines/little-3d-engine/shapes/{uv-sphere.d.ts → primitives/spheres/uv-sphere.d.ts} +1 -1
  55. package/dist/engines/little-3d-engine/shapes/{tetrahedron.d.ts → primitives/tetrahedron.d.ts} +1 -1
  56. package/dist/engines/little-3d-engine/textures/dynamic/canvas-texture.d.ts +1 -0
  57. package/dist/engines/little-3d-engine/textures/dynamic/canvas-texture.js +8 -0
  58. package/dist/engines/little-3d-engine/textures/dynamic/shine.d.ts +2 -0
  59. package/dist/engines/little-3d-engine/textures/dynamic/shine.js +14 -0
  60. package/dist/engines/little-3d-engine/textures/dynamic/star.d.ts +2 -0
  61. package/dist/engines/little-3d-engine/textures/dynamic/star.js +16 -0
  62. package/dist/engines/little-3d-engine/textures/dynamic/streak.d.ts +5 -0
  63. package/dist/engines/little-3d-engine/textures/dynamic/streak.js +20 -0
  64. package/dist/index.d.ts +2 -1
  65. package/dist/prefabs/charged-orb.d.ts +17 -0
  66. package/dist/prefabs/charged-orb.js +37 -0
  67. package/dist/prefabs/crystal-comet.d.ts +4 -0
  68. package/dist/prefabs/crystal-comet.js +41 -0
  69. package/dist/prefabs/ghost-train.d.ts +9 -0
  70. package/dist/prefabs/ghost-train.js +44 -0
  71. package/dist/prefabs/grid-assembly.d.ts +13 -0
  72. package/dist/prefabs/grid-assembly.js +15 -0
  73. package/dist/prefabs/monochrome-streak.d.ts +4 -0
  74. package/dist/prefabs/monochrome-streak.js +25 -0
  75. package/dist/prefabs/plane-star-trail.d.ts +4 -0
  76. package/dist/prefabs/plane-star-trail.js +40 -0
  77. package/dist/prefabs/prefabs.d.ts +10 -0
  78. package/dist/prefabs/prefabs.js +9 -0
  79. package/dist/prefabs/pulsing-starfield.d.ts +4 -0
  80. package/dist/prefabs/pulsing-starfield.js +27 -0
  81. package/dist/prefabs/rocket-launch.d.ts +8 -0
  82. package/dist/prefabs/rocket-launch.js +59 -0
  83. package/dist/prefabs/spinner.d.ts +7 -0
  84. package/dist/prefabs/spinner.js +17 -0
  85. package/dist/prefabs/star-swarm.d.ts +4 -0
  86. package/dist/prefabs/star-swarm.js +27 -0
  87. package/dist/prefabs/types.d.ts +46 -0
  88. package/dist/prefabs/types.js +1 -0
  89. package/dist/umd/spinner.global.js +3055 -1251
  90. package/dist/umd/spinner.global.min.js +60 -5
  91. package/package.json +42 -1
  92. /package/dist/engines/little-3d-engine/shapes/{cube.js → primitives/cube.js} +0 -0
  93. /package/dist/engines/little-3d-engine/shapes/{octahedron.js → primitives/octahedron.js} +0 -0
  94. /package/dist/engines/little-3d-engine/shapes/{pyramid.js → primitives/pyramid.js} +0 -0
  95. /package/dist/engines/little-3d-engine/shapes/{cube-sphere.js → primitives/spheres/cube-sphere.js} +0 -0
  96. /package/dist/engines/little-3d-engine/shapes/{uv-sphere.js → primitives/spheres/uv-sphere.js} +0 -0
  97. /package/dist/engines/little-3d-engine/shapes/{tetrahedron.js → primitives/tetrahedron.js} +0 -0
@@ -1,4 +1,4 @@
1
- var Spinner3D=(()=>{var me=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var jt=Object.prototype.hasOwnProperty;var P=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var Q=(n,e)=>{for(var t in e)me(n,t,{get:e[t],enumerable:!0})},Bt=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rt(e))!jt.call(n,i)&&i!==t&&me(n,i,{get:()=>e[i],enumerable:!(r=Ft(e,i))||r.enumerable});return n};var kt=n=>Bt(me({},"__esModule",{value:!0}),n);function nt(n,e,t){return{x:n,y:e,z:t}}function O(n,e){return{x:n.x-e.x,y:n.y-e.y,z:n.z-e.z}}function z(n,e){return{x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x}}function L(n,e){return n.x*e.x+n.y*e.y+n.z*e.z}function A(n,e){return{x:n.x*e,y:n.y*e,z:n.z*e}}function M(n){let e=Math.hypot(n.x,n.y,n.z);return e===0?{x:0,y:0,z:0}:{x:n.x/e,y:n.y/e,z:n.z/e}}function T(n,e){let t=new Array(16);for(let r=0;r<4;r++)for(let i=0;i<4;i++){let o=0;for(let s=0;s<4;s++)o+=n[s*4+i]*e[r*4+s];t[r*4+i]=o}return t}function N(n,e,t){return[1,0,0,0,0,1,0,0,0,0,1,0,n,e,t,1]}function rt(n){return[n,0,0,0,0,n,0,0,0,0,n,0,0,0,0,1]}function X(n){let e=Math.cos(n),t=Math.sin(n);return[1,0,0,0,0,e,t,0,0,-t,e,0,0,0,0,1]}function Z(n){let e=Math.cos(n),t=Math.sin(n);return[e,0,-t,0,0,1,0,0,t,0,e,0,0,0,0,1]}function K(n){let e=Math.cos(n),t=Math.sin(n);return[e,t,0,0,-t,e,0,0,0,0,1,0,0,0,0,1]}function it(n,e,t,r){let i=1/Math.tan(n/2),o=1/(t-r);return[i/e,0,0,0,0,i,0,0,0,0,(r+t)*o,-1,0,0,2*r*t*o,0]}function ot(n,e){let t=n[0]*e.x+n[4]*e.y+n[8]*e.z+n[12],r=n[1]*e.x+n[5]*e.y+n[9]*e.z+n[13],i=n[2]*e.x+n[6]*e.y+n[10]*e.z+n[14],o=n[3]*e.x+n[7]*e.y+n[11]*e.z+n[15]||1;return{x:t/o,y:r/o,z:i/o}}function $(n,e){return{x:n[0]*e.x+n[4]*e.y+n[8]*e.z+n[12],y:n[1]*e.x+n[5]*e.y+n[9]*e.z+n[13],z:n[2]*e.x+n[6]*e.y+n[10]*e.z+n[14]}}var I=P(()=>{"use strict"});function V(n){let e=n.trim().replace("#",""),t=e.length===3?e.split("").map(i=>i+i).join(""):e,r=parseInt(t,16);return[r>>16&255,r>>8&255,r&255]}function j(n){let e=0;for(let s of n.faces)e+=Math.max(0,s.indices.length-2);let t=new Float32Array(e*9),r=new Float32Array(e*9),i=new Float32Array(e*9),o=0;for(let s of n.faces){let a=n.vertices[s.indices[0]],c=n.vertices[s.indices[1]],m=n.vertices[s.indices[2]],u=M(z(O(c,a),O(m,a))),[h,l,p]=V(s.color),d=h/255,x=l/255,b=p/255;for(let y=1;y<s.indices.length-1;y++){let g=[s.indices[0],s.indices[y],s.indices[y+1]];for(let v of g){let E=n.vertices[v];t[o]=E.x,t[o+1]=E.y,t[o+2]=E.z,r[o]=u.x,r[o+1]=u.y,r[o+2]=u.z,i[o]=d,i[o+1]=x,i[o+2]=b,o+=3}}}return{positions:t,normals:r,colors:i,count:t.length/3}}function de(n,e){return{x:(n.x+e.x)/2,y:(n.y+e.y)/2,z:(n.z+e.z)/2}}function J(n,e,t,r,i){let o=t/2,s=e.map(u=>u.map(h=>M(n[h]))),a=Math.max(0,Math.floor(r)-1);for(let u=0;u<a;u++){let h=[];for(let[l,p,d]of s){let x=M(de(l,p)),b=M(de(p,d)),y=M(de(d,l));h.push([l,x,y],[p,b,x],[d,y,b],[x,b,y])}s=h}let c=[],m=s.map((u,h)=>{let l=c.length;return c.push(A(u[0],o),A(u[1],o),A(u[2],o)),{indices:[l,l+1,l+2],color:i[h%i.length]}});return{vertices:c,faces:m}}var w=P(()=>{"use strict";I()});function Gt(n){return Math.min(1,Math.max(0,n))}function fe(n,e,t){let r=Math.max(0,L(n,t.toLight)),i=Gt(t.ambient+t.intensity*r),[o,s,a]=V(e);return`rgb(${Math.round(o*i)}, ${Math.round(s*i)}, ${Math.round(a*i)})`}var Nt,B,ee=P(()=>{"use strict";I();w();Nt={direction:{x:-.4,y:-.7,z:-.6},intensity:.85,ambient:.25};B=class{constructor(e){this.options={...Nt,...e},this.params={toLight:M(A(this.options.direction,-1)),intensity:this.options.intensity,ambient:this.options.ambient}}shade(e,t){return fe(e,t,this.params)}}});var at={};Q(at,{WebGLRenderer:()=>be});function st(n,e,t){let r=n.createShader(e);if(n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw new Error(`3d-spinner: shader compile failed: ${n.getShaderInfoLog(r)}`);return r}function qt(n){let e=n.createProgram();if(n.attachShader(e,st(n,n.VERTEX_SHADER,Ht)),n.attachShader(e,st(n,n.FRAGMENT_SHADER,Wt)),n.linkProgram(e),!n.getProgramParameter(e,n.LINK_STATUS))throw new Error(`3d-spinner: program link failed: ${n.getProgramInfoLog(e)}`);return e}var Ht,Wt,be,ct=P(()=>{"use strict";w();D();Ht=`#version 300 es
1
+ var Spinner3D=(()=>{var nt=Object.defineProperty;var qn=Object.getOwnPropertyDescriptor;var Qn=Object.getOwnPropertyNames;var Kn=Object.prototype.hasOwnProperty;var _=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(r){throw t=[r],r}};var te=(n,e)=>{for(var t in e)nt(n,t,{get:e[t],enumerable:!0})},Zn=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qn(e))!Kn.call(n,i)&&i!==t&&nt(n,i,{get:()=>e[i],enumerable:!(r=qn(e,i))||r.enumerable});return n};var $n=n=>Zn(nt({},"__esModule",{value:!0}),n);function Qt(n,e,t){return{x:n,y:e,z:t}}function L(n,e){return{x:n.x-e.x,y:n.y-e.y,z:n.z-e.z}}function A(n,e){return{x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x}}function ne(n,e){return n.x*e.x+n.y*e.y+n.z*e.z}function R(n,e){return{x:n.x*e,y:n.y*e,z:n.z*e}}function v(n){let e=Math.hypot(n.x,n.y,n.z);return e===0?{x:0,y:0,z:0}:{x:n.x/e,y:n.y/e,z:n.z/e}}function S(n,e){let t=new Array(16);for(let r=0;r<4;r++)for(let i=0;i<4;i++){let o=0;for(let s=0;s<4;s++)o+=n[s*4+i]*e[r*4+s];t[r*4+i]=o}return t}function ge(n,e,t){return[1,0,0,0,0,1,0,0,0,0,1,0,n,e,t,1]}function Kt(n){return[n,0,0,0,0,n,0,0,0,0,n,0,0,0,0,1]}function Pe(n){let e=Math.cos(n),t=Math.sin(n);return[1,0,0,0,0,e,t,0,0,-t,e,0,0,0,0,1]}function Ee(n){let e=Math.cos(n),t=Math.sin(n);return[e,0,-t,0,0,1,0,0,t,0,e,0,0,0,0,1]}function Le(n){let e=Math.cos(n),t=Math.sin(n);return[e,t,0,0,-t,e,0,0,0,0,1,0,0,0,0,1]}function Zt(n,e,t,r){let i=1/Math.tan(n/2),o=1/(t-r);return[i/e,0,0,0,0,i,0,0,0,0,(r+t)*o,-1,0,0,2*r*t*o,0]}function Ie(n,e){let t=n[0]*e.x+n[4]*e.y+n[8]*e.z+n[12],r=n[1]*e.x+n[5]*e.y+n[9]*e.z+n[13],i=n[2]*e.x+n[6]*e.y+n[10]*e.z+n[14],o=n[3]*e.x+n[7]*e.y+n[11]*e.z+n[15]||1;return{x:t/o,y:r/o,z:i/o}}function ae(n,e){return{x:n[0]*e.x+n[4]*e.y+n[8]*e.z+n[12],y:n[1]*e.x+n[5]*e.y+n[9]*e.z+n[13],z:n[2]*e.x+n[6]*e.y+n[10]*e.z+n[14]}}var k=_(()=>{"use strict"});function re(n){let e=n.trim().replace("#",""),t=e.length===3?e.split("").map(i=>i+i).join(""):e,r=parseInt(t,16);return[r>>16&255,r>>8&255,r&255]}function U(n){let e=0;for(let s of n.faces)e+=Math.max(0,s.indices.length-2);let t=new Float32Array(e*9),r=new Float32Array(e*9),i=new Float32Array(e*9),o=0;for(let s of n.faces){let a=n.vertices[s.indices[0]],c=n.vertices[s.indices[1]],l=n.vertices[s.indices[2]],u=v(A(L(c,a),L(l,a))),[p,m,d]=re(s.color),h=p/255,y=m/255,f=d/255;for(let b=1;b<s.indices.length-1;b++){let x=[s.indices[0],s.indices[b],s.indices[b+1]];for(let M of x){let O=n.vertices[M];t[o]=O.x,t[o+1]=O.y,t[o+2]=O.z,r[o]=u.x,r[o+1]=u.y,r[o+2]=u.z,i[o]=h,i[o+1]=y,i[o+2]=f,o+=3}}}return{positions:t,normals:r,colors:i,count:t.length/3}}function rt(n,e){return{x:(n.x+e.x)/2,y:(n.y+e.y)/2,z:(n.z+e.z)/2}}function ze(n,e,t,r,i){let o=t/2,s=e.map(u=>u.map(p=>v(n[p]))),a=Math.max(0,Math.floor(r)-1);for(let u=0;u<a;u++){let p=[];for(let[m,d,h]of s){let y=v(rt(m,d)),f=v(rt(d,h)),b=v(rt(h,m));p.push([m,y,b],[d,f,y],[h,b,f],[y,f,b])}s=p}let c=[],l=s.map((u,p)=>{let m=c.length;return c.push(R(u[0],o),R(u[1],o),R(u[2],o)),{indices:[m,m+1,m+2],color:i[p%i.length]}});return{vertices:c,faces:l}}var X=_(()=>{"use strict";k()});function rr(n){return Math.min(1,Math.max(0,n))}function it(n,e,t){let r=Math.max(0,ne(n,t.toLight)),i=rr(t.ambient+t.intensity*r),[o,s,a]=re(e);return`rgb(${Math.round(o*i)}, ${Math.round(s*i)}, ${Math.round(a*i)})`}var nr,ue,Ce=_(()=>{"use strict";k();X();nr={direction:{x:-.4,y:-.7,z:-.6},intensity:.85,ambient:.25};ue=class{constructor(e){this.options={...nr,...e},this.params={toLight:v(R(this.options.direction,-1)),intensity:this.options.intensity,ambient:this.options.ambient}}shade(e,t){return it(e,t,this.params)}}});var Jt={};te(Jt,{WebGLRenderer:()=>Me});function $t(n,e,t){let r=n.createShader(e);if(n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw new Error(`3d-spinner: shader compile failed: ${n.getShaderInfoLog(r)}`);return r}function sr(n){let e=n.createProgram();if(n.attachShader(e,$t(n,n.VERTEX_SHADER,ir)),n.attachShader(e,$t(n,n.FRAGMENT_SHADER,or)),n.linkProgram(e),!n.getProgramParameter(e,n.LINK_STATUS))throw new Error(`3d-spinner: program link failed: ${n.getProgramInfoLog(e)}`);return e}var ir,or,Me,ot=_(()=>{"use strict";X();Y();ir=`#version 300 es
2
2
  in vec3 aPos;
3
3
  in vec3 aNormal;
4
4
  in vec3 aColor;
@@ -10,7 +10,7 @@ void main() {
10
10
  vNormal = mat3(uModel) * aNormal;
11
11
  vColor = aColor;
12
12
  gl_Position = uViewProj * uModel * vec4(aPos, 1.0);
13
- }`,Wt=`#version 300 es
13
+ }`,or=`#version 300 es
14
14
  precision mediump float;
15
15
  in vec3 vNormal;
16
16
  in vec3 vColor;
@@ -23,7 +23,7 @@ void main() {
23
23
  float lambert = max(dot(normalize(vNormal), normalize(uToLight)), 0.0);
24
24
  float brightness = clamp(uAmbient + uIntensity * lambert, 0.0, 1.0);
25
25
  fragColor = vec4(vColor * brightness, uOpacity);
26
- }`;be=class{constructor(e={}){this.cache=new Map;if(e.background){let[t,r,i]=V(e.background);this.clearColor=[t/255,r/255,i/255,1]}else this.clearColor=[0,0,0,0]}init(e){let t=e.getContext("webgl2");if(!t)throw new Error("3d-spinner: WebGL2 is not supported in this browser.");this.gl=t,this.program=qt(t),this.locations={aPos:t.getAttribLocation(this.program,"aPos"),aNormal:t.getAttribLocation(this.program,"aNormal"),aColor:t.getAttribLocation(this.program,"aColor"),uViewProj:t.getUniformLocation(this.program,"uViewProj"),uModel:t.getUniformLocation(this.program,"uModel"),uToLight:t.getUniformLocation(this.program,"uToLight"),uIntensity:t.getUniformLocation(this.program,"uIntensity"),uAmbient:t.getUniformLocation(this.program,"uAmbient"),uOpacity:t.getUniformLocation(this.program,"uOpacity")},t.enable(t.DEPTH_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.frontFace(t.CCW)}resize(){let e=this.gl;if(!e)return;let t=e.canvas;e.viewport(0,0,t.width,t.height)}buffers(e){let t=this.cache.get(e);if(t)return t;let r=this.gl,i=this.locations,o=j(e),s=r.createVertexArray();r.bindVertexArray(s);let a=(m,u)=>{if(m<0)return;let h=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,h),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),r.enableVertexAttribArray(m),r.vertexAttribPointer(m,3,r.FLOAT,!1,0,0)};a(i.aPos,o.positions),a(i.aNormal,o.normals),a(i.aColor,o.colors),r.bindVertexArray(null);let c={vao:s,count:o.count};return this.cache.set(e,c),c}render(e){let t=this.gl,r=this.locations;if(!(!t||!this.program||!r)){t.clearColor(...this.clearColor),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.useProgram(this.program),t.uniformMatrix4fv(r.uViewProj,!1,new Float32Array(e.viewProjection)),t.uniform3f(r.uToLight,e.light.toLight.x,e.light.toLight.y,e.light.toLight.z),t.uniform1f(r.uIntensity,e.light.intensity),t.uniform1f(r.uAmbient,e.light.ambient),t.disable(t.BLEND),t.depthMask(!0),t.cullFace(t.BACK);for(let i of e.items){if(i.transparency)continue;let o=this.buffers(i.mesh);t.uniformMatrix4fv(r.uModel,!1,new Float32Array(i.model)),t.uniform1f(r.uOpacity,1),t.bindVertexArray(o.vao),t.drawArrays(t.TRIANGLES,0,o.count)}t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.depthMask(!1);for(let i of e.items){let o=i.transparency;if(!o)continue;let s=this.buffers(i.mesh);if(t.uniformMatrix4fv(r.uModel,!1,new Float32Array(i.model)),t.bindVertexArray(s.vao),o.mode==="two-sided"){let a=k(o);t.cullFace(t.FRONT),t.uniform1f(r.uOpacity,a.back),t.drawArrays(t.TRIANGLES,0,s.count),t.cullFace(t.BACK),t.uniform1f(r.uOpacity,a.front),t.drawArrays(t.TRIANGLES,0,s.count)}else t.cullFace(t.BACK),t.uniform1f(r.uOpacity,C(o.opacity,.35)),t.drawArrays(t.TRIANGLES,0,s.count)}t.depthMask(!0),t.disable(t.BLEND),t.cullFace(t.BACK),t.bindVertexArray(null)}}destroy(){let e=this.gl;if(e){for(let t of this.cache.values())e.deleteVertexArray(t.vao);this.program&&e.deleteProgram(this.program)}this.cache.clear(),this.gl=void 0,this.program=void 0,this.locations=void 0}}});var ut={};Q(ut,{WebGPURenderer:()=>ye});var Yt,Qt,ne,ye,pt=P(()=>{"use strict";w();I();D();Yt=`
26
+ }`;Me=class{constructor(e={}){this.cache=new Map;if(e.background){let[t,r,i]=re(e.background);this.clearColor=[t/255,r/255,i/255,1]}else this.clearColor=[0,0,0,0]}init(e){let t=e.getContext("webgl2");if(!t)throw new Error("3d-spinner: WebGL2 is not supported in this browser.");this.gl=t,this.program=sr(t),this.locations={aPos:t.getAttribLocation(this.program,"aPos"),aNormal:t.getAttribLocation(this.program,"aNormal"),aColor:t.getAttribLocation(this.program,"aColor"),uViewProj:t.getUniformLocation(this.program,"uViewProj"),uModel:t.getUniformLocation(this.program,"uModel"),uToLight:t.getUniformLocation(this.program,"uToLight"),uIntensity:t.getUniformLocation(this.program,"uIntensity"),uAmbient:t.getUniformLocation(this.program,"uAmbient"),uOpacity:t.getUniformLocation(this.program,"uOpacity")},t.enable(t.DEPTH_TEST),t.enable(t.CULL_FACE),t.cullFace(t.BACK),t.frontFace(t.CCW)}resize(){let e=this.gl;if(!e)return;let t=e.canvas;e.viewport(0,0,t.width,t.height)}buffers(e){let t=this.cache.get(e);if(t)return t;let r=this.gl,i=this.locations,o=U(e),s=r.createVertexArray();r.bindVertexArray(s);let a=(l,u)=>{if(l<0)return;let p=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,p),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),r.enableVertexAttribArray(l),r.vertexAttribPointer(l,3,r.FLOAT,!1,0,0)};a(i.aPos,o.positions),a(i.aNormal,o.normals),a(i.aColor,o.colors),r.bindVertexArray(null);let c={vao:s,count:o.count};return this.cache.set(e,c),c}render(e){let t=this.gl,r=this.locations;if(!(!t||!this.program||!r)){t.clearColor(...this.clearColor),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),t.useProgram(this.program),t.uniformMatrix4fv(r.uViewProj,!1,new Float32Array(e.viewProjection)),t.uniform3f(r.uToLight,e.light.toLight.x,e.light.toLight.y,e.light.toLight.z),t.uniform1f(r.uIntensity,e.light.intensity),t.uniform1f(r.uAmbient,e.light.ambient),t.disable(t.BLEND),t.depthMask(!0),t.cullFace(t.BACK);for(let i of e.items){if(i.transparency)continue;let o=this.buffers(i.mesh);t.uniformMatrix4fv(r.uModel,!1,new Float32Array(i.model)),t.uniform1f(r.uOpacity,1),t.bindVertexArray(o.vao),t.drawArrays(t.TRIANGLES,0,o.count)}t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),t.depthMask(!1);for(let i of e.items){let o=i.transparency;if(!o)continue;let s=this.buffers(i.mesh);if(t.uniformMatrix4fv(r.uModel,!1,new Float32Array(i.model)),t.bindVertexArray(s.vao),o.mode==="two-sided"){let a=G(o);t.cullFace(t.FRONT),t.uniform1f(r.uOpacity,a.back),t.drawArrays(t.TRIANGLES,0,s.count),t.cullFace(t.BACK),t.uniform1f(r.uOpacity,a.front),t.drawArrays(t.TRIANGLES,0,s.count)}else t.cullFace(t.BACK),t.uniform1f(r.uOpacity,I(o.opacity,.35)),t.drawArrays(t.TRIANGLES,0,s.count)}t.depthMask(!0),t.disable(t.BLEND),t.cullFace(t.BACK),t.bindVertexArray(null)}}destroy(){let e=this.gl;if(e){for(let t of this.cache.values())e.deleteVertexArray(t.vao);this.program&&e.deleteProgram(this.program)}this.cache.clear(),this.gl=void 0,this.program=void 0,this.locations=void 0}}});var en={};te(en,{WebGPURenderer:()=>ve});var ar,cr,we,ve,st=_(()=>{"use strict";X();k();Y();ar=`
27
27
  struct Uniforms {
28
28
  viewProj: mat4x4<f32>,
29
29
  model: mat4x4<f32>,
@@ -54,5 +54,60 @@ fn fs(in: VSOut) -> @location(0) vec4<f32> {
54
54
  let brightness = clamp(u.params.y + u.params.x * lambert, 0.0, 1.0);
55
55
  return vec4<f32>(in.color * brightness, u.params.z);
56
56
  }
57
- `,Qt=[1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1],ne=256,ye=class{constructor(e={}){this.uniformCapacity=0;this.depthSize="";this.destroyed=!1;this.cache=new Map;if(e.background){let[t,r,i]=V(e.background);this.clearValue={r:t/255,g:r/255,b:i/255,a:1},this.alphaMode="opaque"}else this.clearValue={r:0,g:0,b:0,a:0},this.alphaMode="premultiplied"}async init(e){let t=navigator.gpu;if(!t)throw new Error("3d-spinner: WebGPU is not supported in this browser.");let r=await t.requestAdapter();if(!r)throw new Error("3d-spinner: no WebGPU adapter is available.");let i=await r.requestDevice();if(this.destroyed){i.destroy?.();return}let o=e.getContext("webgpu");if(!o)throw new Error("3d-spinner: could not get a WebGPU canvas context.");let s=t.getPreferredCanvasFormat();o.configure({device:i,format:s,alphaMode:this.alphaMode});let a=i.createShaderModule({code:Yt}),c=globalThis.GPUShaderStage,m=i.createBindGroupLayout({entries:[{binding:0,visibility:c.VERTEX|c.FRAGMENT,buffer:{type:"uniform",hasDynamicOffset:!0,minBindingSize:160}}]}),u=d=>({arrayStride:12,attributes:[{shaderLocation:d,offset:0,format:"float32x3"}]}),h=i.createPipelineLayout({bindGroupLayouts:[m]}),l={color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},p=(d,x)=>i.createRenderPipeline({layout:h,vertex:{module:a,entryPoint:"vs",buffers:[u(0),u(1),u(2)]},fragment:{module:a,entryPoint:"fs",targets:[{format:s,...x?{blend:l}:{}}]},primitive:{topology:"triangle-list",cullMode:d,frontFace:"ccw"},depthStencil:{format:"depth24plus",depthWriteEnabled:!x,depthCompare:"less"}});this.pipeline=p("back",!1),this.transparentBackPipeline=p("front",!0),this.transparentFrontPipeline=p("back",!0),this.canvas=e,this.device=i,this.context=o}resize(){this.ensureDepth()}ensureDepth(){let e=this.canvas;if(!this.device||!e)return;let t=Math.max(1,e.width),r=Math.max(1,e.height),i=`${t}x${r}`;i===this.depthSize&&this.depthTexture||(this.depthTexture?.destroy?.(),this.depthTexture=this.device.createTexture({size:{width:t,height:r},format:"depth24plus",usage:globalThis.GPUTextureUsage.RENDER_ATTACHMENT}),this.depthSize=i)}buffers(e){let t=this.cache.get(e);if(t)return t;let r=j(e),i=globalThis.GPUBufferUsage.VERTEX|globalThis.GPUBufferUsage.COPY_DST,o=a=>{let c=this.device.createBuffer({size:a.byteLength,usage:i});return this.device.queue.writeBuffer(c,0,a),c},s={position:o(r.positions),normal:o(r.normals),color:o(r.colors),count:r.count};return this.cache.set(e,s),s}ensureUniformCapacity(e){e<=this.uniformCapacity&&this.uniformBuffer||(this.uniformBuffer?.destroy?.(),this.uniformBuffer=this.device.createBuffer({size:Math.max(1,e)*ne,usage:globalThis.GPUBufferUsage.UNIFORM|globalThis.GPUBufferUsage.COPY_DST}),this.uniformCapacity=e)}render(e){if(this.destroyed||!this.device||!this.context||!this.pipeline||e.width===0||e.height===0||e.items.length===0)return;this.ensureDepth();let t=[];for(let c of e.items)c.transparency||t.push({item:c,opacity:1,pipeline:this.pipeline});for(let c of e.items){let m=c.transparency;if(m)if(m.mode==="two-sided"){let u=k(m);t.push({item:c,opacity:u.back,pipeline:this.transparentBackPipeline}),t.push({item:c,opacity:u.front,pipeline:this.transparentFrontPipeline})}else t.push({item:c,opacity:C(m.opacity,.35),pipeline:this.transparentFrontPipeline})}this.ensureUniformCapacity(t.length);let r=T(Qt,e.viewProjection),i=this.pipeline.getBindGroupLayout(0),o=this.device.createBindGroup({layout:i,entries:[{binding:0,resource:{buffer:this.uniformBuffer,offset:0,size:160}}]});t.forEach((c,m)=>{let u=new Float32Array(ne/4);u.set(r,0),u.set(c.item.model,16),u.set([e.light.toLight.x,e.light.toLight.y,e.light.toLight.z,0],32),u.set([e.light.intensity,e.light.ambient,c.opacity,0],36),this.device.queue.writeBuffer(this.uniformBuffer,m*ne,u)});let s=this.device.createCommandEncoder(),a=s.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:this.clearValue,loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:this.depthTexture.createView(),depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}});t.forEach((c,m)=>{let u=this.buffers(c.item.mesh);a.setPipeline(c.pipeline),a.setBindGroup(0,o,[m*ne]),a.setVertexBuffer(0,u.position),a.setVertexBuffer(1,u.normal),a.setVertexBuffer(2,u.color),a.draw(u.count)}),a.end(),this.device.queue.submit([s.finish()])}destroy(){this.destroyed=!0;for(let e of this.cache.values())e.position.destroy?.(),e.normal.destroy?.(),e.color.destroy?.();this.cache.clear(),this.uniformBuffer?.destroy?.(),this.depthTexture?.destroy?.(),this.device?.destroy?.(),this.device=void 0,this.context=void 0,this.pipeline=void 0,this.transparentBackPipeline=void 0,this.transparentFrontPipeline=void 0,this.uniformBuffer=void 0,this.depthTexture=void 0,this.canvas=void 0}}});var ht={};Q(ht,{Canvas2DRenderer:()=>xe});var xe,lt=P(()=>{"use strict";ee();I();D();xe=class{constructor(e={}){this.options=e;this.dpr=1}init(e){this.ctx=e.getContext("2d")??void 0}resize(e,t,r){this.dpr=r,this.ctx?.setTransform(r,0,0,r,0,0)}render(e){let t=this.ctx;if(!t)return;this.options.background?(t.fillStyle=this.options.background,t.fillRect(0,0,e.width,e.height)):t.clearRect(0,0,e.width,e.height);let r=[];for(let i of e.items){let o=i.mesh.vertices.map(a=>$(i.model,a)),s=i.transparency?.mode==="two-sided"?k(i.transparency):void 0;for(let a of i.mesh.faces){let c=o[a.indices[0]],m=o[a.indices[1]],u=o[a.indices[2]],h=M(z(O(m,c),O(u,c))),l=L(h,O(e.eye,c))>0,p=i.transparency;if(!l&&p?.mode!=="two-sided")continue;let d=1;p?.mode==="one-sided"?d=C(p.opacity,.35):s&&(d=l?s.front:s.back);let x=a.indices.map(y=>{let g=ot(e.viewProjection,o[y]);return{x:(g.x*.5+.5)*e.width,y:(1-(g.y*.5+.5))*e.height}}),b=0;for(let y of a.indices){let g=O(o[y],e.eye);b+=L(g,g)}b/=a.indices.length,r.push({points:x,color:fe(h,a.color,e.light),depth:b,opacity:d})}}r.sort((i,o)=>o.depth-i.depth);for(let i of r)if(!(i.points.length<3)){t.beginPath(),t.moveTo(i.points[0].x,i.points[0].y);for(let o=1;o<i.points.length;o++)t.lineTo(i.points[o].x,i.points[o].y);t.closePath(),t.fillStyle=i.color,t.strokeStyle=i.color,t.lineWidth=1,t.globalAlpha=i.opacity,t.fill(),t.stroke()}t.globalAlpha=1}destroy(){this.ctx=void 0}}});function C(n,e){return Math.max(0,Math.min(1,n??e))}function k(n){let e=C(n.frontOpacity??n.opacity,.56),t=n.opacity===void 0?.84:e*(2/3);return{front:e,back:C(n.backOpacity,t)}}function re(n,e){let t=[],r=[];for(let i of n)(i.transparency?r:t).push(i);return r.sort((i,o)=>{let s=i.model[12]-e.x,a=i.model[13]-e.y,c=i.model[14]-e.z,m=o.model[12]-e.x,u=o.model[13]-e.y,h=o.model[14]-e.z;return m*m+u*u+h*h-(s*s+a*a+c*c)}),t.concat(r)}async function mt(n,e={}){switch(n){case"webgl":return new(await Promise.resolve().then(()=>(ct(),at))).WebGLRenderer(e);case"webgpu":return new(await Promise.resolve().then(()=>(pt(),ut))).WebGPURenderer(e);default:return new(await Promise.resolve().then(()=>(lt(),ht))).Canvas2DRenderer(e)}}var D=P(()=>{"use strict"});var kn={};Q(kn,{Camera:()=>R,Light:()=>B,Little3dEngine:()=>F,LittleTweenEngine:()=>et,ObjectMotionAnimation:()=>$e,SpinAnimation:()=>Qe,centerAndScaleMesh:()=>Ct,circleMotion:()=>Pt,createSpinner:()=>_t,cross:()=>z,cube:()=>ie,cubeSphere:()=>Mt,cubic:()=>ve,dot:()=>L,ease:()=>ce,easeInBack:()=>ke,easeInBounce:()=>He,easeInCirc:()=>Re,easeInCubic:()=>oe,easeInElastic:()=>Ue,easeInExpo:()=>we,easeInOutBack:()=>_e,easeInOutBounce:()=>We,easeInOutCirc:()=>Be,easeInOutCubic:()=>Ie,easeInOutElastic:()=>Ge,easeInOutExpo:()=>Fe,easeInOutQuad:()=>Ee,easeInOutQuart:()=>Pe,easeInOutQuint:()=>Ve,easeInOutSine:()=>Se,easeInQuad:()=>U,easeInQuart:()=>se,easeInQuint:()=>ae,easeInSine:()=>ze,easeOutBack:()=>De,easeOutBounce:()=>_,easeOutCirc:()=>je,easeOutCubic:()=>W,easeOutElastic:()=>Ne,easeOutExpo:()=>q,easeOutQuad:()=>H,easeOutQuart:()=>Ce,easeOutQuint:()=>Le,easeOutSine:()=>Ae,easeTypes:()=>qe,enterFromObjectDirection:()=>yn,expandToTriangles:()=>j,figureEightMotion:()=>Vt,grow:()=>Xe,icosphere:()=>xt,leaveInObjectDirection:()=>xn,linear:()=>ge,normalize:()=>M,octaSphere:()=>gt,octahedron:()=>ft,orderRenderItems:()=>re,parseObj:()=>Bn,pyramid:()=>bt,quadratic:()=>Me,quartic:()=>Oe,quintic:()=>Te,scale:()=>A,shrink:()=>Ze,squareMotion:()=>Lt,subtract:()=>O,tetrahedron:()=>dt,transform:()=>te,uvSphere:()=>yt,vec3:()=>nt,wanderMotion:()=>wt});function tt(n){return Number.isNaN(n)?0:Math.min(1,Math.max(0,n))}function Dt(n,e,t){return n+(e-n)*t}function _t(n,e){if(!(n instanceof HTMLElement))throw new Error("3d-spinner: createSpinner requires a target HTMLElement.");let{animation:t}=e,r=e.type==="indeterminate";if(r&&e.periodMs!==void 0&&(!Number.isFinite(e.periodMs)||e.periodMs<=0))throw new RangeError("3d-spinner: periodMs must be a finite number greater than zero.");t.mount(n);let i=performance.now(),o=0,s=!1,a=!1,c=!1,m=!1,u=0,h=0,l=1/0;if(!r){let v=e;typeof v.progress=="number"&&(u=tt(v.progress),h=u),typeof v.timeout=="number"&&(l=Math.min(l,i+v.timeout)),v.until instanceof Date&&(l=Math.min(l,v.until.getTime()))}function p(v){if(!r)return v>=l&&(h=1),u=Dt(u,h,.12),Math.abs(h-u)<5e-4&&(u=h),u;let E=e,he=E.periodMs??2e3,Y=(v-i)/he;if((E.loop??"bounce")==="restart")return Y-Math.floor(Y);let le=Y-2*Math.floor(Y/2);return le<=1?le:2-le}function d(v){if(s)return;let E=p(v);!c&&(r||E>0)&&(t.enter(v),c=!0),!m&&c&&!r&&E>=1&&h>=1&&(t.exit(v),m=!0);let he=r?E:h;if(t.render(v,{progress:E,targetProgress:he,indeterminate:r}),m&&t.isFinished()){x();return}o=requestAnimationFrame(d)}function x(){s||(s=!0,o&&cancelAnimationFrame(o),o=0)}function b(v){r||(h=tt(v))}function y(){if(!(s||m)){if(!c){x();return}t.exit(performance.now()),m=!0}}function g(){a||(a=!0,x(),t.destroy())}return o=requestAnimationFrame(d),{setProgress:b,stop:y,destroy:g}}I();var Ut={position:{x:0,y:0,z:4},fov:55*Math.PI/180,near:.1,far:100},R=class{constructor(e){this.options={...Ut,...e}}toView(e){let{position:t}=this.options;return $(N(-t.x,-t.y,-t.z),e)}viewProjection(e){let{position:t,fov:r,near:i,far:o}=this.options,s=N(-t.x,-t.y,-t.z),a=it(r,e,i,o);return T(a,s)}toScreen(e,t,r){return{x:(e.x*.5+.5)*t,y:(1-(e.y*.5+.5))*r}}};ee();I();function te(n){return{position:n?.position??{x:0,y:0,z:0},rotation:n?.rotation??{x:0,y:0,z:0},scale:n?.scale??1}}D();ee();var Xt=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"];function ie(n=1,e=Xt){let t=n/2,r=[{x:-t,y:-t,z:t},{x:t,y:-t,z:t},{x:t,y:t,z:t},{x:-t,y:t,z:t},{x:-t,y:-t,z:-t},{x:t,y:-t,z:-t},{x:t,y:t,z:-t},{x:-t,y:t,z:-t}],i=[{indices:[0,1,2,3],color:e[0%e.length]},{indices:[5,4,7,6],color:e[1%e.length]},{indices:[3,2,6,7],color:e[2%e.length]},{indices:[4,5,1,0],color:e[3%e.length]},{indices:[1,5,6,2],color:e[4%e.length]},{indices:[4,0,3,7],color:e[5%e.length]}];return{vertices:r,faces:i}}var Zt=["#3b82f6","#8b5cf6","#ec4899","#f59e0b"];function dt(n=1,e=Zt){let t=n/2,r=[{x:t,y:t,z:t},{x:t,y:-t,z:-t},{x:-t,y:t,z:-t},{x:-t,y:-t,z:t}],i=[{indices:[0,1,2],color:e[0%e.length]},{indices:[0,3,1],color:e[1%e.length]},{indices:[0,2,3],color:e[2%e.length]},{indices:[1,3,2],color:e[3%e.length]}];return{vertices:r,faces:i}}var Kt=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444","#06b6d4","#eab308"];function ft(n=1,e=Kt){let t=n/2,r=[{x:t,y:0,z:0},{x:-t,y:0,z:0},{x:0,y:t,z:0},{x:0,y:-t,z:0},{x:0,y:0,z:t},{x:0,y:0,z:-t}],i=[{indices:[4,0,2],color:e[0%e.length]},{indices:[4,2,1],color:e[1%e.length]},{indices:[4,1,3],color:e[2%e.length]},{indices:[4,3,0],color:e[3%e.length]},{indices:[5,2,0],color:e[4%e.length]},{indices:[5,1,2],color:e[5%e.length]},{indices:[5,3,1],color:e[6%e.length]},{indices:[5,0,3],color:e[7%e.length]}];return{vertices:r,faces:i}}var $t=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981"];function bt(n=1,e=$t){let t=n/2,r=[{x:-t,y:-t,z:t},{x:t,y:-t,z:t},{x:t,y:-t,z:-t},{x:-t,y:-t,z:-t},{x:0,y:t,z:0}],i=[{indices:[0,3,2,1],color:e[0%e.length]},{indices:[4,0,1],color:e[1%e.length]},{indices:[4,1,2],color:e[2%e.length]},{indices:[4,2,3],color:e[3%e.length]},{indices:[4,3,0],color:e[4%e.length]}];return{vertices:r,faces:i}}var Jt=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"];function yt(n=1,e=1,t=Jt){let r=n/2,i=Math.max(1,Math.floor(e)),o=Math.max(4,i*4),s=Math.max(2,i*2),a=[{x:0,y:r,z:0}],c=(p,d)=>1+(p-1)*o+d;for(let p=1;p<s;p++){let d=Math.PI*p/s,x=r*Math.cos(d),b=r*Math.sin(d);for(let y=0;y<o;y++){let g=2*Math.PI*y/o;a.push({x:b*Math.cos(g),y:x,z:b*Math.sin(g)})}}let m=a.length;a.push({x:0,y:-r,z:0});let u=[],h=0,l=()=>t[h++%t.length];for(let p=0;p<o;p++)u.push({indices:[0,c(1,(p+1)%o),c(1,p)],color:l()});for(let p=1;p<s-1;p++)for(let d=0;d<o;d++){let x=(d+1)%o;u.push({indices:[c(p,d),c(p,x),c(p+1,x),c(p+1,d)],color:l()})}for(let p=0;p<o;p++)u.push({indices:[m,c(s-1,p),c(s-1,(p+1)%o)],color:l()});return{vertices:a,faces:u}}w();var en=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"],S=(1+Math.sqrt(5))/2,tn=[{x:-1,y:S,z:0},{x:1,y:S,z:0},{x:-1,y:-S,z:0},{x:1,y:-S,z:0},{x:0,y:-1,z:S},{x:0,y:1,z:S},{x:0,y:-1,z:-S},{x:0,y:1,z:-S},{x:S,y:0,z:-1},{x:S,y:0,z:1},{x:-S,y:0,z:-1},{x:-S,y:0,z:1}],nn=[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]];function xt(n=1,e=1,t=en){return J(tn,nn,n,e,t)}w();var rn=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"],on=[{x:1,y:0,z:0},{x:-1,y:0,z:0},{x:0,y:1,z:0},{x:0,y:-1,z:0},{x:0,y:0,z:1},{x:0,y:0,z:-1}],sn=[[4,0,2],[4,2,1],[4,1,3],[4,3,0],[5,2,0],[5,1,2],[5,3,1],[5,0,3]];function gt(n=1,e=1,t=rn){return J(on,sn,n,e,t)}var an=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"],cn=[{normal:[0,0,1],right:[1,0,0],up:[0,1,0]},{normal:[0,0,-1],right:[-1,0,0],up:[0,1,0]},{normal:[1,0,0],right:[0,0,-1],up:[0,1,0]},{normal:[-1,0,0],right:[0,0,1],up:[0,1,0]},{normal:[0,1,0],right:[1,0,0],up:[0,0,-1]},{normal:[0,-1,0],right:[1,0,0],up:[0,0,1]}];function Mt(n=1,e=1,t=an){let r=n/2,i=Math.max(1,Math.floor(e)),o=[],s=[],a=0;for(let c of cn){let m=o.length;for(let h=0;h<=i;h++)for(let l=0;l<=i;l++){let p=-1+2*h/i,d=-1+2*l/i,x=c.normal[0]+p*c.right[0]+d*c.up[0],b=c.normal[1]+p*c.right[1]+d*c.up[1],y=c.normal[2]+p*c.right[2]+d*c.up[2],g=Math.hypot(x,b,y);o.push({x:x/g*r,y:b/g*r,z:y/g*r})}let u=(h,l)=>m+h*(i+1)+l;for(let h=0;h<i;h++)for(let l=0;l<i;l++)s.push({indices:[u(h,l),u(h+1,l),u(h+1,l+1),u(h,l+1)],color:t[a++%t.length]})}return{vertices:o,faces:s}}w();D();I();function un(n){let e=T(K(n.rotation.z),T(Z(n.rotation.y),X(n.rotation.x)));return T(N(n.position.x,n.position.y,n.position.z),T(e,rt(n.scale)))}var F=class{constructor(e={}){this.scene=[];this.cssWidth=0;this.cssHeight=0;this.ready=!1;this.generation=0;this.rafId=0;this.running=!1;this.camera=new R(e.camera),this.light=new B(e.light),this.backend=e.backend??"canvas2d",this.background=e.background}async mount(e){let t=document.createElement("canvas");t.style.display="block",t.style.width="100%",t.style.height="100%",e.appendChild(t),this.canvas=t,this.observer=new ResizeObserver(()=>this.resize()),this.observer.observe(t),this.resize();let r=this.generation,i=()=>{this.canvas===t&&(this.observer?.disconnect(),this.observer=void 0,t.remove(),this.canvas=void 0)};try{let o=await mt(this.backend,{background:this.background});if(r!==this.generation){o.destroy(),i();return}if(await o.init(t),r!==this.generation){o.destroy(),i();return}this.renderer=o,this.resize(),this.ready=!0}catch(o){throw i(),o}}add(e,t){let r={mesh:e,transform:te(t),transparency:t?.transparency,remove:()=>{let i=this.scene.indexOf(r);i>=0&&this.scene.splice(i,1)}};return this.scene.push(r),r}resize(){let e=this.canvas;if(!e)return;let t=window.devicePixelRatio||1;this.cssWidth=e.clientWidth||e.parentElement?.clientWidth||0,this.cssHeight=e.clientHeight||e.parentElement?.clientHeight||0,e.width=Math.max(1,Math.round(this.cssWidth*t)),e.height=Math.max(1,Math.round(this.cssHeight*t)),this.renderer?.resize(this.cssWidth,this.cssHeight,t)}render(){if(!this.ready||!this.renderer)return;let e=this.cssWidth,t=this.cssHeight;if(e===0||t===0)return;let r=this.scene.map(o=>({mesh:o.mesh,model:un(o.transform),transparency:o.transparency})),i=this.camera.options.position;this.renderer.render({items:re(r,i),viewProjection:this.camera.viewProjection(e/t),eye:i,light:this.light.params,width:e,height:t})}start(){if(this.running)return;this.running=!0;let e=()=>{this.running&&(this.render(),this.rafId=requestAnimationFrame(e))};this.rafId=requestAnimationFrame(e)}stop(){this.running=!1,this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0}destroy(){this.generation++,this.ready=!1,this.stop(),this.observer?.disconnect(),this.observer=void 0,this.renderer?.destroy(),this.renderer=void 0,this.canvas?.remove(),this.canvas=void 0}};function f(n,e){return Number.isNaN(n)?0:e?n:Math.min(1,Math.max(0,n))}function ge(n,e=!1){return f(n,e)}function Me(n,e=!1){return U(n,e)}function ve(n,e=!1){return oe(n,e)}function Oe(n,e=!1){return se(n,e)}function Te(n,e=!1){return ae(n,e)}function ze(n,e=!1){let t=f(n,e);return 1-Math.cos(t*Math.PI/2)}function Ae(n,e=!1){let t=f(n,e);return Math.sin(t*Math.PI/2)}function Se(n,e=!1){let t=f(n,e);return-(Math.cos(Math.PI*t)-1)/2}function U(n,e=!1){let t=f(n,e);return t*t}function H(n,e=!1){let t=f(n,e);return 1-(1-t)*(1-t)}function Ee(n,e=!1){let t=f(n,e);return t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2}function oe(n,e=!1){let t=f(n,e);return t*t*t}function W(n,e=!1){let t=f(n,e);return 1-Math.pow(1-t,3)}function Ie(n,e=!1){let t=f(n,e);return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function se(n,e=!1){let t=f(n,e);return t*t*t*t}function Ce(n,e=!1){let t=f(n,e);return 1-Math.pow(1-t,4)}function Pe(n,e=!1){let t=f(n,e);return t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2}function ae(n,e=!1){let t=f(n,e);return t*t*t*t*t}function Le(n,e=!1){let t=f(n,e);return 1-Math.pow(1-t,5)}function Ve(n,e=!1){let t=f(n,e);return t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2}function we(n,e=!1){let t=f(n,e);return t===0?0:Math.pow(2,10*t-10)}function q(n,e=!1){let t=f(n,e);return t===1?1:1-Math.pow(2,-10*t)}function Fe(n,e=!1){let t=f(n,e);return t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}function Re(n,e=!1){let t=f(n,e);return 1-Math.sqrt(1-Math.pow(t,2))}function je(n,e=!1){let t=f(n,e);return Math.sqrt(1-Math.pow(t-1,2))}function Be(n,e=!1){let t=f(n,e);return t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2}function ke(n,e=!1){let t=f(n,e),r=1.70158;return(r+1)*t*t*t-r*t*t}function De(n,e=!1){let t=f(n,e),r=1.70158;return 1+(r+1)*Math.pow(t-1,3)+r*Math.pow(t-1,2)}function _e(n,e=!1){let t=f(n,e),i=1.70158*1.525;return t<.5?Math.pow(2*t,2)*((i+1)*2*t-i)/2:(Math.pow(2*t-2,2)*((i+1)*(t*2-2)+i)+2)/2}function Ue(n,e=!1){let t=f(n,e),r=2*Math.PI/3;return t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*r)}function Ne(n,e=!1){let t=f(n,e),r=2*Math.PI/3;return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*r)+1}function Ge(n,e=!1){let t=f(n,e),r=2*Math.PI/4.5;return t===0?0:t===1?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*r))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*r)/2+1}function He(n,e=!1){let t=f(n,e);return 1-_(1-t,!0)}function _(n,e=!1){let t=f(n,e),r=7.5625,i=2.75;return t<1/i?r*t*t:t<2/i?(t-=1.5/i,r*t*t+.75):t<2.5/i?(t-=2.25/i,r*t*t+.9375):(t-=2.625/i,r*t*t+.984375)}function We(n,e=!1){let t=f(n,e);return t<.5?(1-_(1-2*t,!0))/2:(1+_(2*t-1,!0))/2}var qe={linear:ge,quadratic:Me,cubic:ve,quartic:Oe,quintic:Te,easeInSine:ze,easeOutSine:Ae,easeInOutSine:Se,easeInQuad:U,easeOutQuad:H,easeInOutQuad:Ee,easeInCubic:oe,easeOutCubic:W,easeInOutCubic:Ie,easeInQuart:se,easeOutQuart:Ce,easeInOutQuart:Pe,easeInQuint:ae,easeOutQuint:Le,easeInOutQuint:Ve,easeInExpo:we,easeOutExpo:q,easeInOutExpo:Fe,easeInCirc:Re,easeOutCirc:je,easeInOutCirc:Be,easeInBack:ke,easeOutBack:De,easeInOutBack:_e,easeInElastic:Ue,easeOutElastic:Ne,easeInOutElastic:Ge,easeInBounce:He,easeOutBounce:_,easeInOutBounce:We};function ce(n,e,t=!1){return qe[n](e,t)}function pn(n={}){return{popDurationMs:n.popDurationMs??500,overextend:n.overextend??.2,startSnapRatio:n.startSnapRatio??.2,loadingText:n.loadingText===void 0?"loading":n.loadingText,doneText:n.doneText??"done",doneFadeDurationMs:n.doneFadeDurationMs??2e3,removeOnComplete:n.removeOnComplete??!1}}function Ye(n,e,t){return t<=0?1:Math.min(1,Math.max(0,(n-e)/t))}var ue=class{constructor(e={}){this.phase="idle";this.phaseStart=0;this.activeProgress=0;this.popTarget=0;this.doneFadeStart=0;this.options=pn(e)}enter(e){this.phase==="idle"&&(this.phase="startPop",this.phaseStart=e,this.activeProgress=0,this.popTarget=0)}exit(e){this.phase!=="startPop"&&this.phase!=="active"||(this.phase="endPop",this.phaseStart=e)}isFinished(){return this.phase==="finished"}update(e,t,r){let{popDurationMs:i,overextend:o,startSnapRatio:s,loadingText:a,doneText:c,doneFadeDurationMs:m,removeOnComplete:u}=this.options,h=r??t;(this.phase==="startPop"||this.phase==="active")&&(this.activeProgress=t,this.phase==="startPop"&&(this.popTarget=Math.max(this.popTarget,h,t)));let l=0,p=null,d=0,x=!1;if(this.phase==="startPop"){let b=Ye(e,this.phaseStart,i),y=this.popTarget*(1+o);if(b<s){let g=s>0?b/s:1;l=y*q(g)}else{let g=s<1?(b-s)/(1-s):1;l=y+(this.activeProgress-y)*W(g)}b>=1&&(this.phase="active")}else if(this.phase==="active")l=this.activeProgress;else if(this.phase==="endPop"){let b=Ye(e,this.phaseStart,i),y=1+o;b<.5?l=1+(y-1)*H(b*2):l=y*(1-U((b-.5)*2)),b>=1&&(this.phase="done",this.doneFadeStart=e,l=0)}if(this.phase==="startPop"||this.phase==="active")a!==!1&&(p=a,d=.65);else if(this.phase==="endPop")p=c,d=.65;else if(this.phase==="done"){let b=Ye(e,this.doneFadeStart,m);b>=1?(u&&(x=!0),this.phase="finished"):(p=c,d=.65*(1-b))}return{scale:l,text:p,textOpacity:d,hidden:x}}};var hn=["position:absolute","inset:0","display:flex","align-items:center","justify-content:center","pointer-events:none","font:600 1.1rem/1.2 system-ui,sans-serif","letter-spacing:0.06em","text-transform:lowercase","color:rgba(255,255,255,0.65)","z-index:1"].join(";");function ln(n){return n?typeof n=="function"?n():n:ie()}function mn(n,e){if(e===void 0||Array.isArray(e)&&e.length===0)return n;let t=Array.isArray(e)?r=>e[r%e.length]:()=>e;return{vertices:n.vertices,faces:n.faces.map((r,i)=>({...r,color:t(i)}))}}var Qe=class{constructor(e={}){this.exited=!1;this.mesh=mn(ln(e.shape),e.color),this.spinX=e.spinX??7e-4,this.spinY=e.spinY??.0011,this.backend=e.backend,this.transparency=e.transparency,this.progress=e.progressAnimation?new ue(e.progressAnimation):void 0}mount(e){e.style.position="relative";let t=new F({backend:this.backend,camera:{position:{x:0,y:0,z:2.8}}});if(this.handle=t.add(this.mesh,{transparency:this.transparency}),this.engine=t,t.mount(e).catch(r=>{e.textContent=r instanceof Error?r.message:String(r)}),this.progress){let r=document.createElement("div");r.style.cssText=hn,r.setAttribute("aria-hidden","true"),r.hidden=!0,e.appendChild(r),this.label=r}}enter(e){this.progress?.enter(e)}exit(e){this.exited=!0,this.progress?.exit(e)}isFinished(){return this.progress?this.progress.isFinished():this.exited}render(e,t){if(!this.engine||!this.handle)return;let r=this.handle.transform.rotation;if(r.x=e*this.spinX,r.y=e*this.spinY,this.progress){let i=this.progress.update(e,t.progress,t.targetProgress);this.handle.transform.scale=i.hidden?0:i.scale,this.applyLabel(i)}else this.handle.transform.scale=1;this.engine.render()}destroy(){this.label?.remove(),this.label=void 0,this.engine?.destroy(),this.engine=void 0,this.handle=void 0}applyLabel(e){if(this.label){if(e.hidden||e.text==null){this.label.hidden=!0,this.label.textContent="";return}this.label.hidden=!1,this.label.textContent=e.text,this.label.style.opacity=String(e.textOpacity)}}};I();function vt(n,e){return{x:n.x+e.x,y:n.y+e.y,z:n.z+e.z}}function pe(n,e){return{x:n.x*e,y:n.y*e,z:n.z*e}}function Ot(n){return Math.hypot(n.x,n.y,n.z)}function dn(n){let e=Ot(n);return e<1e-6?{x:1,y:0,z:0}:pe(n,1/e)}function fn(n,e){return dn(e??n.direction??n.velocity??{x:1,y:0,z:0})}function bn(n){let t=n-1;return 1+(1.70158+1)*t*t*t+1.70158*t*t}function Tt(n,e,t){let r=n.velocity?Ot(n.velocity):0;if(n.velocity&&r>1e-6&&!e.direction)return n.velocity;let i=e.distance??3.5;return pe(fn(n,e.direction),i/t)}function yn(n={}){return e=>{let t=Math.max(1,e.durationMs),r=Tt(e,n,t),i=t-e.elapsedMs;return{position:vt(e.position,pe(r,-i))}}}function xn(n={}){return e=>{let t=Math.max(1,e.durationMs),r=Tt(e,n,t);return{position:vt(e.position,pe(r,e.elapsedMs))}}}function Xe(){return n=>({size:(n.size??1)*bn(n.delta)})}function Ze(){return n=>({size:(n.size??1)*(1-n.delta*n.delta)})}var gn=["position:absolute","inset:0","display:flex","align-items:center","justify-content:center","pointer-events:none","font:700 1.6rem/1 system-ui,sans-serif","letter-spacing:0.02em","color:rgba(255,255,255,0.9)","text-shadow:0 1px 10px rgba(0,0,0,0.6)","z-index:1"].join(";"),Mn={x:0,y:1,z:0},vn=2100,On=2100,Tn=26,zt=.7,zn=.12,Ke=8,An={"+x":n=>n,"-x":n=>({x:-n.x,y:n.y,z:-n.z}),"+z":n=>({x:n.z,y:n.y,z:-n.x}),"-z":n=>({x:-n.z,y:n.y,z:n.x}),"+y":n=>({x:n.y,y:-n.x,z:n.z}),"-y":n=>({x:-n.y,y:n.x,z:n.z})};function Sn(n,e){return{x:n.x+e.x,y:n.y+e.y,z:n.z+e.z}}function En(n){return typeof n=="function"?n():n}function In(n,e){return{vertices:n.vertices,faces:n.faces.map(t=>({...t,color:e}))}}function Cn(n,e){if(e==="+x")return n;let t=An[e];return{vertices:n.vertices.map(t),faces:n.faces}}function Ct(n,e){let t=1/0,r=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let p of n.vertices)t=Math.min(t,p.x),r=Math.min(r,p.y),i=Math.min(i,p.z),o=Math.max(o,p.x),s=Math.max(s,p.y),a=Math.max(a,p.z);let c=(t+o)/2,m=(r+s)/2,u=(i+a)/2,h=Math.max(o-t,s-r,a-i)||1,l=e/h;return{vertices:n.vertices.map(p=>({x:(p.x-c)*l,y:(p.y-m)*l,z:(p.z-u)*l})),faces:n.faces}}function Pn(n,e){let t=M(n),r=z(t,Mn);Math.hypot(r.x,r.y,r.z)<1e-4&&(r={x:0,y:0,z:1}),r=M(r);let i=z(r,t),o=Sn(A(i,Math.cos(e)),A(r,Math.sin(e))),s=M(z(t,o));return{x:Math.atan2(z(s,t).z,s.z),y:Math.asin(Math.max(-1,Math.min(1,-t.z))),z:Math.atan2(t.y,t.x)}}function At(n,e,t){return T(K(t),T(Z(e),X(n)))}function Ln(n){return Math.hypot(n[0],n[1])>1e-6?{x:Math.atan2(n[9],n[10]),y:Math.asin(Math.max(-1,Math.min(1,-n[8]))),z:Math.atan2(n[4],n[0])}:{x:Math.atan2(-n[6],n[5]),y:Math.asin(Math.max(-1,Math.min(1,-n[8]))),z:0}}function Vn(n,e){return Ln(T(At(n.x,n.y,n.z),At(e.x,e.y,e.z)))}function wn(n){return Math.max(0,Math.min(1,n))}function St(n,e){return A(O(n.positionAt(e+1),n.positionAt(e-1)),.5)}function Et(n,e){return Math.hypot(n.x,n.y,n.z)>1e-6?M(n):e}function It(n,e,t){return n?typeof n=="function"?{transition:n,durationMs:t}:{transition:n.transition,durationMs:Math.max(0,n.durationMs??t)}:{transition:e,durationMs:t}}var $e=class{constructor(e){this.handles=[];this.banks=[];this.headings=[];this.started=!1;this.finished=!1;this.introStart=0;this.outroStart=1/0;this.outroPosition={x:0,y:0,z:0};this.outroVelocity={x:0,y:0,z:0};this.outroDirection={x:1,y:0,z:0};let t=Ct(En(e.mesh),e.size??1),r=Cn(t,e.facing??"+x");this.mesh=In(r,e.color??"#cbd5e1"),this.motion=e.motion,this.backend=e.backend,this.transparency=e.transparency,this.labelText=e.label,this.tailCount=Math.max(0,Math.floor(e.tail?.count??0)),this.tailGap=Math.max(0,e.tail?.gapMs??0),this.intro=It(e.intro,Xe(),vn),this.outro=It(e.outro,Ze(),On);let i=e.rotation;this.rotationOffset={x:i?.x??0,y:i?.y??0,z:i?.z??0},this.rotationSpin={x:i?.spinX??0,y:i?.spinY??0,z:i?.spinZ??0},this.hasExtraRotation=this.rotationOffset.x!==0||this.rotationOffset.y!==0||this.rotationOffset.z!==0||this.rotationSpin.x!==0||this.rotationSpin.y!==0||this.rotationSpin.z!==0}mount(e){e.style.position="relative";let t=new F({backend:this.backend,camera:{position:{x:0,y:0,z:3}}});for(let i=0;i<=this.tailCount;i++)this.handles.push(t.add(this.mesh,{transparency:this.transparency})),this.banks.push(0),this.headings.push({x:1,y:0,z:0});this.engine=t,t.mount(e).catch(i=>{e.textContent=i instanceof Error?i.message:String(i)});let r=document.createElement("div");r.style.cssText=gn,r.setAttribute("role","status"),e.appendChild(r),this.label=r}enter(e){this.started||(this.started=!0,this.introStart=e)}exit(e){!this.started||this.outroStart!==1/0||(this.outroPosition=this.motion.positionAt(e),this.outroVelocity=St(this.motion,e),this.outroDirection=Et(this.outroVelocity,this.headings[0]),this.outroStart=e)}isFinished(){return this.finished}render(e,t){if(!(!this.engine||!this.label)){this.outroStart!==1/0&&e>=this.outroStart+this.outro.durationMs+this.tailCount*this.tailGap&&(this.finished=!0);for(let r=0;r<this.handles.length;r++){let i=this.handles[r].transform,o=e-r*this.tailGap,s=this.sampleAt(o);if(!s){i.scale=0;continue}i.scale=s.size;let a=s.orientation;if(!a){let c=O(this.positionAt(o+Ke)??s.position,s.position);Math.hypot(c.x,c.y,c.z)>1e-5&&(this.headings[r]=M(c));let m=this.aheadAt(o)??this.headings[r],u=Math.max(-zt,Math.min(zt,z(this.headings[r],m).y*Tn));this.banks[r]+=(u-this.banks[r])*zn,a=Pn(this.headings[r],this.banks[r])}this.hasExtraRotation&&(a=Vn(a,{x:this.rotationOffset.x+this.rotationSpin.x*o,y:this.rotationOffset.y+this.rotationSpin.y*o,z:this.rotationOffset.z+this.rotationSpin.z*o})),i.position.x=s.position.x,i.position.y=s.position.y,i.position.z=s.position.z,i.rotation.x=a.x,i.rotation.y=a.y,i.rotation.z=a.z}this.label.textContent=t.indeterminate?this.labelText??"":`${Math.round(t.progress*100)}%`,this.engine.render()}}destroy(){this.label?.remove(),this.label=void 0,this.engine?.destroy(),this.engine=void 0,this.handles.length=0}aheadAt(e){let t=this.positionAt(e+Ke),r=this.positionAt(e+2*Ke);if(!t||!r)return;let i=O(r,t);if(!(Math.hypot(i.x,i.y,i.z)<=1e-5))return M(i)}positionAt(e){return this.sampleAt(e)?.position}sampleAt(e){if(!(!this.started||e<this.introStart)){if(e<this.introStart+this.intro.durationMs)return this.transitionSample("intro",e,this.intro,this.introStart);if(this.outroStart!==1/0){if(e>this.outroStart+this.outro.durationMs)return;if(e>=this.outroStart)return this.transitionSample("outro",e,this.outro,this.outroStart)}return{position:this.motion.positionAt(e),size:1}}}transitionSample(e,t,r,i){let o=Math.max(0,t-i),s=r.durationMs===0?1:wn(o/r.durationMs),a=this.transitionInput(e,s,o,r.durationMs,i),c=r.transition(a);return this.applyTransitionOutput(a,c)}transitionInput(e,t,r,i,o){if(e==="intro"){let s=o+i,a=St(this.motion,s);return{delta:t,position:this.motion.positionAt(s),direction:Et(a,{x:1,y:0,z:0}),velocity:a,size:1,durationMs:i,elapsedMs:r,phase:e}}return{delta:t,position:this.outroPosition,direction:this.outroDirection,velocity:this.outroVelocity,size:1,durationMs:i,elapsedMs:r,phase:e}}applyTransitionOutput(e,t){return{position:t.position??e.position,size:t.size??e.size??1,orientation:t.orientation}}};function Pt(n={}){let e=n.radius??1.3,t=n.periodMs??3e3,r=n.tilt??.5,i=n.direction??1,o=Math.cos(r),s=Math.sin(r);return{positionAt(a){let c=i*a/t*Math.PI*2,m=e*Math.cos(c),u=e*Math.sin(c);return{x:m,y:u*o,z:u*s}}}}function Lt(n={}){let e=(n.size??2.4)/2,t=n.periodMs??4e3,r=n.tilt??.45,i=n.direction??1,o=Math.cos(r),s=Math.sin(r);return{positionAt(a){let c=i*a/t,m=(c-Math.floor(c))*4,u=Math.floor(m),h=m-u,l,p;return u===0?(l=-e+2*e*h,p=-e):u===1?(l=e,p=-e+2*e*h):u===2?(l=e-2*e*h,p=e):(l=-e,p=e-2*e*h),{x:l,y:p*o,z:p*s}}}}function Vt(n={}){let e=n.size??1,t=n.periodMs??3600;return{positionAt(r){let i=r/t*Math.PI*2;return{x:e*1.5*Math.sin(i),y:e*1*Math.sin(i)*Math.cos(i),z:e*1.05*Math.cos(i)}}}}function Fn(n){let e=n>>>0;return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function Je(n,e,t){let r=[0,1,2].map(()=>({freq:.5+n()*1.4,phase:n()*Math.PI*2,weight:.5+n()})),i=r.reduce((o,s)=>o+s.weight,0);return o=>{let s=0;for(let a of r)s+=a.weight*Math.sin(e*a.freq*o+a.phase);return s/i*t}}function wt(n={}){let e=n.bounds?.x??1.4,t=n.bounds?.y??1,r=n.bounds?.z??.6,i=n.periodMs??9e3,o=n.seed??Math.random()*1e9|0,s=Fn(o),a=2*Math.PI/i,c=Je(s,a,e),m=Je(s,a,t),u=Je(s,a,r);return{positionAt(h){return{x:c(h),y:m(h),z:u(h)}}}}var Rn=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"];function jn(n,e){let t=parseInt(n,10);return t<0?e+t:t-1}function Bn(n,e={}){let t=e.colors??Rn,r=[],i=[];for(let o of n.split(`
58
- `)){let s=o.trim();if(s===""||s.startsWith("#"))continue;let a=s.split(/\s+/),c=a[0];if(c==="v")r.push({x:parseFloat(a[1]),y:parseFloat(a[2]),z:parseFloat(a[3])});else if(c==="f"){let m=[];for(let u=1;u<a.length;u++){let h=a[u].split("/")[0];m.push(jn(h,r.length))}m.length>=3&&i.push({indices:m,color:t[i.length%t.length]})}}return{vertices:r,faces:i}}var et=class{constructor(e={}){this.type=e.type??"linear",this.overextend=e.overextend??!1}value(e,t=this.type,r=this.overextend){return ce(t,e,r)}};return kt(kn);})();
57
+ `,cr=[1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1],we=256,ve=class{constructor(e={}){this.uniformCapacity=0;this.depthSize="";this.destroyed=!1;this.cache=new Map;if(e.background){let[t,r,i]=re(e.background);this.clearValue={r:t/255,g:r/255,b:i/255,a:1},this.alphaMode="opaque"}else this.clearValue={r:0,g:0,b:0,a:0},this.alphaMode="premultiplied"}async init(e){let t=navigator.gpu;if(!t)throw new Error("3d-spinner: WebGPU is not supported in this browser.");let r=await t.requestAdapter();if(!r)throw new Error("3d-spinner: no WebGPU adapter is available.");let i=await r.requestDevice();if(this.destroyed){i.destroy?.();return}let o=e.getContext("webgpu");if(!o)throw new Error("3d-spinner: could not get a WebGPU canvas context.");let s=t.getPreferredCanvasFormat();o.configure({device:i,format:s,alphaMode:this.alphaMode});let a=i.createShaderModule({code:ar}),c=globalThis.GPUShaderStage,l=i.createBindGroupLayout({entries:[{binding:0,visibility:c.VERTEX|c.FRAGMENT,buffer:{type:"uniform",hasDynamicOffset:!0,minBindingSize:160}}]}),u=h=>({arrayStride:12,attributes:[{shaderLocation:h,offset:0,format:"float32x3"}]}),p=i.createPipelineLayout({bindGroupLayouts:[l]}),m={color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},d=(h,y)=>i.createRenderPipeline({layout:p,vertex:{module:a,entryPoint:"vs",buffers:[u(0),u(1),u(2)]},fragment:{module:a,entryPoint:"fs",targets:[{format:s,...y?{blend:m}:{}}]},primitive:{topology:"triangle-list",cullMode:h,frontFace:"ccw"},depthStencil:{format:"depth24plus",depthWriteEnabled:!y,depthCompare:"less"}});this.pipeline=d("back",!1),this.transparentBackPipeline=d("front",!0),this.transparentFrontPipeline=d("back",!0),this.canvas=e,this.device=i,this.context=o}resize(){this.ensureDepth()}ensureDepth(){let e=this.canvas;if(!this.device||!e)return;let t=Math.max(1,e.width),r=Math.max(1,e.height),i=`${t}x${r}`;i===this.depthSize&&this.depthTexture||(this.depthTexture?.destroy?.(),this.depthTexture=this.device.createTexture({size:{width:t,height:r},format:"depth24plus",usage:globalThis.GPUTextureUsage.RENDER_ATTACHMENT}),this.depthSize=i)}buffers(e){let t=this.cache.get(e);if(t)return t;let r=U(e),i=globalThis.GPUBufferUsage.VERTEX|globalThis.GPUBufferUsage.COPY_DST,o=a=>{let c=this.device.createBuffer({size:a.byteLength,usage:i});return this.device.queue.writeBuffer(c,0,a),c},s={position:o(r.positions),normal:o(r.normals),color:o(r.colors),count:r.count};return this.cache.set(e,s),s}ensureUniformCapacity(e){e<=this.uniformCapacity&&this.uniformBuffer||(this.uniformBuffer?.destroy?.(),this.uniformBuffer=this.device.createBuffer({size:Math.max(1,e)*we,usage:globalThis.GPUBufferUsage.UNIFORM|globalThis.GPUBufferUsage.COPY_DST}),this.uniformCapacity=e)}render(e){if(this.destroyed||!this.device||!this.context||!this.pipeline||e.width===0||e.height===0||e.items.length===0)return;this.ensureDepth();let t=[];for(let c of e.items)c.transparency||t.push({item:c,opacity:1,pipeline:this.pipeline});for(let c of e.items){let l=c.transparency;if(l)if(l.mode==="two-sided"){let u=G(l);t.push({item:c,opacity:u.back,pipeline:this.transparentBackPipeline}),t.push({item:c,opacity:u.front,pipeline:this.transparentFrontPipeline})}else t.push({item:c,opacity:I(l.opacity,.35),pipeline:this.transparentFrontPipeline})}this.ensureUniformCapacity(t.length);let r=S(cr,e.viewProjection),i=this.pipeline.getBindGroupLayout(0),o=this.device.createBindGroup({layout:i,entries:[{binding:0,resource:{buffer:this.uniformBuffer,offset:0,size:160}}]});t.forEach((c,l)=>{let u=new Float32Array(we/4);u.set(r,0),u.set(c.item.model,16),u.set([e.light.toLight.x,e.light.toLight.y,e.light.toLight.z,0],32),u.set([e.light.intensity,e.light.ambient,c.opacity,0],36),this.device.queue.writeBuffer(this.uniformBuffer,l*we,u)});let s=this.device.createCommandEncoder(),a=s.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:this.clearValue,loadOp:"clear",storeOp:"store"}],depthStencilAttachment:{view:this.depthTexture.createView(),depthClearValue:1,depthLoadOp:"clear",depthStoreOp:"store"}});t.forEach((c,l)=>{let u=this.buffers(c.item.mesh);a.setPipeline(c.pipeline),a.setBindGroup(0,o,[l*we]),a.setVertexBuffer(0,u.position),a.setVertexBuffer(1,u.normal),a.setVertexBuffer(2,u.color),a.draw(u.count)}),a.end(),this.device.queue.submit([s.finish()])}destroy(){this.destroyed=!0;for(let e of this.cache.values())e.position.destroy?.(),e.normal.destroy?.(),e.color.destroy?.();this.cache.clear(),this.uniformBuffer?.destroy?.(),this.depthTexture?.destroy?.(),this.device?.destroy?.(),this.device=void 0,this.context=void 0,this.pipeline=void 0,this.transparentBackPipeline=void 0,this.transparentFrontPipeline=void 0,this.uniformBuffer=void 0,this.depthTexture=void 0,this.canvas=void 0}}});var tn={};te(tn,{Canvas2DRenderer:()=>Oe});var Oe,at=_(()=>{"use strict";Ce();k();Y();Oe=class{constructor(e={}){this.options=e;this.dpr=1}init(e){this.ctx=e.getContext("2d")??void 0}resize(e,t,r){this.dpr=r,this.ctx?.setTransform(r,0,0,r,0,0)}render(e){let t=this.ctx;if(!t)return;this.options.background?(t.fillStyle=this.options.background,t.fillRect(0,0,e.width,e.height)):t.clearRect(0,0,e.width,e.height);let r=[];for(let i of e.items){let o=i.mesh.vertices.map(a=>ae(i.model,a)),s=i.transparency?.mode==="two-sided"?G(i.transparency):void 0;for(let a of i.mesh.faces){let c=o[a.indices[0]],l=o[a.indices[1]],u=o[a.indices[2]],p=v(A(L(l,c),L(u,c))),m=ne(p,L(e.eye,c))>0,d=i.transparency;if(!m&&d?.mode!=="two-sided")continue;let h=1;d?.mode==="one-sided"?h=I(d.opacity,.35):s&&(h=m?s.front:s.back);let y=a.indices.map(b=>{let x=Ie(e.viewProjection,o[b]);return{x:(x.x*.5+.5)*e.width,y:(1-(x.y*.5+.5))*e.height}}),f=0;for(let b of a.indices){let x=L(o[b],e.eye);f+=ne(x,x)}f/=a.indices.length,r.push({points:y,color:it(p,a.color,e.light),depth:f,opacity:h})}}r.sort((i,o)=>o.depth-i.depth);for(let i of r)if(!(i.points.length<3)){t.beginPath(),t.moveTo(i.points[0].x,i.points[0].y);for(let o=1;o<i.points.length;o++)t.lineTo(i.points[o].x,i.points[o].y);t.closePath(),t.fillStyle=i.color,t.strokeStyle=i.color,t.lineWidth=1,t.globalAlpha=i.opacity,t.fill(),t.stroke()}t.globalAlpha=1}destroy(){this.ctx=void 0}}});function I(n,e){return Math.max(0,Math.min(1,n??e))}function G(n){let e=I(n.frontOpacity??n.opacity,.56),t=n.opacity===void 0?.84:e*(2/3);return{front:e,back:I(n.backOpacity,t)}}function Fe(n,e){let t=[],r=[];for(let i of n)(i.transparency?r:t).push(i);return r.sort((i,o)=>{let s=i.model[12]-e.x,a=i.model[13]-e.y,c=i.model[14]-e.z,l=o.model[12]-e.x,u=o.model[13]-e.y,p=o.model[14]-e.z;return l*l+u*u+p*p-(s*s+a*a+c*c)}),t.concat(r)}async function nn(n,e={}){if(typeof n=="function")return n(e);switch(n){case"webgl":return new(await Promise.resolve().then(()=>(ot(),Jt))).WebGLRenderer(e);case"webgpu":return new(await Promise.resolve().then(()=>(st(),en))).WebGPURenderer(e);default:return new(await Promise.resolve().then(()=>(at(),tn))).Canvas2DRenderer(e)}}var Y=_(()=>{"use strict"});function He(n){let e=1/0,t=1/0,r=-1/0,i=-1/0;for(let u of n.vertices)e=Math.min(e,u.x),t=Math.min(t,u.y),r=Math.max(r,u.x),i=Math.max(i,u.y);let o=r-e||1,s=i-t||1,a=0;for(let u of n.faces)a+=Math.max(0,u.indices.length-2);let c=new Float32Array(a*6),l=0;for(let u of n.faces)for(let p=1;p<u.indices.length-1;p++)for(let m of[u.indices[0],u.indices[p],u.indices[p+1]]){let d=n.vertices[m];c[l]=(d.x-e)/o,c[l+1]=1-(d.y-t)/s,l+=2}return c}var Dt=_(()=>{"use strict"});var bn={};te(bn,{WebGPUTexturedRenderer:()=>Xe});function Kr(n){return n?n.mode==="two-sided"?G(n).front:I(n.opacity,.35):1}var qr,Qr,We,Xe,Bt=_(()=>{"use strict";X();k();Y();Dt();st();qr=`
58
+ struct Uniforms {
59
+ viewProj: mat4x4<f32>,
60
+ model: mat4x4<f32>,
61
+ params: vec4<f32>,
62
+ };
63
+ @group(0) @binding(0) var<uniform> u: Uniforms;
64
+ @group(0) @binding(1) var tex: texture_2d<f32>;
65
+ @group(0) @binding(2) var samp: sampler;
66
+
67
+ struct VSOut {
68
+ @builtin(position) position: vec4<f32>,
69
+ @location(0) uv: vec2<f32>,
70
+ @location(1) color: vec3<f32>,
71
+ };
72
+
73
+ @vertex
74
+ fn vs(@location(0) pos: vec3<f32>, @location(1) uv: vec2<f32>, @location(2) color: vec3<f32>) -> VSOut {
75
+ var out: VSOut;
76
+ out.uv = uv;
77
+ out.color = color;
78
+ out.position = u.viewProj * u.model * vec4<f32>(pos, 1.0);
79
+ return out;
80
+ }
81
+
82
+ @fragment
83
+ fn fs(in: VSOut) -> @location(0) vec4<f32> {
84
+ let t = textureSample(tex, samp, in.uv);
85
+ return vec4<f32>(t.rgb * in.color, t.a * u.params.x);
86
+ }
87
+ `,Qr=[1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1],We=256;Xe=class extends ve{constructor(){super(...arguments);this.texturedCapacity=0;this.sources=new Map;this.textures=new Map;this.retired=[];this.texturedBuffers=new Map;this.bindGroups=new Map}setTexture(t,r){this.sources.set(t,r)}async init(t){await super.init(t);let r=this.device;if(!r)return;let i=navigator.gpu.getPreferredCanvasFormat(),o=r.createShaderModule({code:qr}),s=globalThis.GPUShaderStage,a=r.createBindGroupLayout({entries:[{binding:0,visibility:s.VERTEX|s.FRAGMENT,buffer:{type:"uniform",hasDynamicOffset:!0,minBindingSize:144}},{binding:1,visibility:s.FRAGMENT,texture:{}},{binding:2,visibility:s.FRAGMENT,sampler:{}}]}),c=(l,u)=>({arrayStride:u*4,attributes:[{shaderLocation:l,offset:0,format:`float32x${u}`}]});this.texturedPipeline=r.createRenderPipeline({layout:r.createPipelineLayout({bindGroupLayouts:[a]}),vertex:{module:o,entryPoint:"vs",buffers:[c(0,3),c(1,2),c(2,3)]},fragment:{module:o,entryPoint:"fs",targets:[{format:i,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"back",frontFace:"ccw"},depthStencil:{format:"depth24plus",depthWriteEnabled:!1,depthCompare:"less"}}),this.sampler=r.createSampler({magFilter:"linear",minFilter:"linear"})}textureFor(t){let r=this.textures.get(t);if(r)return r;let i=this.device,o=globalThis.GPUTextureUsage,s=i.createTexture({size:{width:1,height:1},format:"rgba8unorm",usage:o.TEXTURE_BINDING|o.COPY_DST});i.queue.writeTexture({texture:s},new Uint8Array([255,255,255,255]),{},{width:1,height:1}),this.textures.set(t,s);let a=async l=>{let u=l instanceof HTMLImageElement?await createImageBitmap(l):l;if(this.destroyed||!this.device||this.textures.get(t)!==s)return;let p=u.width||1,m=u.height||1,d=this.device.createTexture({size:{width:p,height:m},format:"rgba8unorm",usage:o.TEXTURE_BINDING|o.COPY_DST|o.RENDER_ATTACHMENT});this.device.queue.copyExternalImageToTexture({source:u},{texture:d},{width:p,height:m}),this.retired.push(s),this.textures.set(t,d),this.bindGroups.delete(t)},c=this.sources.get(t);if(typeof c=="string"){let l=new Image;l.onload=()=>{a(l)},l.src=c}else a(c);return this.textures.get(t)}buffersFor(t){let r=this.texturedBuffers.get(t);if(r)return r;let i=U(t),o=globalThis.GPUBufferUsage.VERTEX|globalThis.GPUBufferUsage.COPY_DST,s=c=>{let l=this.device.createBuffer({size:c.byteLength,usage:o});return this.device.queue.writeBuffer(l,0,c),l},a={position:s(i.positions),uv:s(He(t)),color:s(i.colors),count:i.count};return this.texturedBuffers.set(t,a),a}bindGroupFor(t){let r=this.textureFor(t),i=this.bindGroups.get(t);if(i&&i.buffer===this.texturedUniforms&&i.texture===r)return i.group;let o=this.device.createBindGroup({layout:this.texturedPipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.texturedUniforms,offset:0,size:144}},{binding:1,resource:r.createView()},{binding:2,resource:this.sampler}]});return this.bindGroups.set(t,{group:o,buffer:this.texturedUniforms,texture:r}),o}render(t){let r=[],i=[];for(let l of t.items)(this.sources.has(l.mesh)?i:r).push(l);if(super.render(i.length?{...t,items:r}:t),!i.length||this.destroyed||!this.device||!this.context||!this.texturedPipeline||t.width===0||t.height===0)return;this.ensureDepth(),(i.length>this.texturedCapacity||!this.texturedUniforms)&&(this.texturedUniforms?.destroy?.(),this.texturedUniforms=this.device.createBuffer({size:i.length*We,usage:globalThis.GPUBufferUsage.UNIFORM|globalThis.GPUBufferUsage.COPY_DST}),this.texturedCapacity=i.length);let o=S(Qr,t.viewProjection);i.forEach((l,u)=>{let p=new Float32Array(We/4);p.set(o,0),p.set(l.model,16),p.set([Kr(l.transparency),0,0,0],32),this.device.queue.writeBuffer(this.texturedUniforms,u*We,p)});let s=r.length>0,a=this.device.createCommandEncoder(),c=a.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:this.clearValue,loadOp:s?"load":"clear",storeOp:"store"}],depthStencilAttachment:{view:this.depthTexture.createView(),depthClearValue:1,depthLoadOp:s?"load":"clear",depthStoreOp:"store"}});c.setPipeline(this.texturedPipeline),i.forEach((l,u)=>{let p=this.buffersFor(l.mesh);c.setBindGroup(0,this.bindGroupFor(l.mesh),[u*We]),c.setVertexBuffer(0,p.position),c.setVertexBuffer(1,p.uv),c.setVertexBuffer(2,p.color),c.draw(p.count)}),c.end(),this.device.queue.submit([a.finish()])}destroy(){for(let t of this.textures.values())t.destroy?.();for(let t of this.retired.splice(0))t.destroy?.();for(let t of this.texturedBuffers.values())t.position.destroy?.(),t.uv.destroy?.(),t.color.destroy?.();this.textures.clear(),this.texturedBuffers.clear(),this.bindGroups.clear(),this.sources.clear(),this.texturedUniforms?.destroy?.(),this.texturedUniforms=void 0,this.texturedPipeline=void 0,this.sampler=void 0,super.destroy()}}});var xn={};te(xn,{WebGLTexturedRenderer:()=>Ye});function yn(n,e,t){let r=n.createShader(e);if(n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw new Error(`3d-spinner: shader compile failed: ${n.getShaderInfoLog(r)}`);return r}function Jr(n){let e=n.createProgram();if(n.attachShader(e,yn(n,n.VERTEX_SHADER,Zr)),n.attachShader(e,yn(n,n.FRAGMENT_SHADER,$r)),n.linkProgram(e),!n.getProgramParameter(e,n.LINK_STATUS))throw new Error(`3d-spinner: program link failed: ${n.getProgramInfoLog(e)}`);return e}function ei(n){return n?n.mode==="two-sided"?G(n).front:I(n.opacity,.35):1}var Zr,$r,Ye,Ut=_(()=>{"use strict";X();Y();Dt();ot();Zr=`#version 300 es
88
+ in vec3 aPos;
89
+ in vec2 aUV;
90
+ in vec3 aColor;
91
+ uniform mat4 uViewProj;
92
+ uniform mat4 uModel;
93
+ out vec2 vUV;
94
+ out vec3 vColor;
95
+ void main() {
96
+ vUV = aUV;
97
+ vColor = aColor;
98
+ gl_Position = uViewProj * uModel * vec4(aPos, 1.0);
99
+ }`,$r=`#version 300 es
100
+ precision mediump float;
101
+ in vec2 vUV;
102
+ in vec3 vColor;
103
+ uniform sampler2D uTexture;
104
+ uniform float uOpacity;
105
+ out vec4 fragColor;
106
+ void main() {
107
+ vec4 t = texture(uTexture, vUV);
108
+ fragColor = vec4(t.rgb * vColor, t.a * uOpacity);
109
+ }`;Ye=class{constructor(e={}){this.sources=new Map;this.textures=new Map;this.buffers=new Map;this.inner=new Me(e)}setTexture(e,t){this.sources.set(e,t)}init(e){this.inner.init(e);let t=e.getContext("webgl2");this.gl=t,this.program=Jr(t),this.locations={aPos:t.getAttribLocation(this.program,"aPos"),aUV:t.getAttribLocation(this.program,"aUV"),aColor:t.getAttribLocation(this.program,"aColor"),uViewProj:t.getUniformLocation(this.program,"uViewProj"),uModel:t.getUniformLocation(this.program,"uModel"),uTexture:t.getUniformLocation(this.program,"uTexture"),uOpacity:t.getUniformLocation(this.program,"uOpacity")}}resize(){this.inner.resize()}textureFor(e){let t=this.textures.get(e);if(t)return t;let r=this.gl,i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,255,255,255])),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),this.textures.set(e,i);let o=a=>{!this.gl||this.textures.get(e)!==i||(this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,a))},s=this.sources.get(e);if(typeof s=="string"){let a=new Image;a.onload=()=>o(a),a.src=s}else o(s);return i}buffersFor(e){let t=this.buffers.get(e);if(t)return t;let r=this.gl,i=this.locations,o=U(e),s=r.createVertexArray();r.bindVertexArray(s);let a=(l,u,p)=>{if(l<0)return;let m=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,m),r.bufferData(r.ARRAY_BUFFER,u,r.STATIC_DRAW),r.enableVertexAttribArray(l),r.vertexAttribPointer(l,p,r.FLOAT,!1,0,0)};a(i.aPos,o.positions,3),a(i.aColor,o.colors,3),a(i.aUV,He(e),2),r.bindVertexArray(null);let c={vao:s,count:o.count};return this.buffers.set(e,c),c}render(e){let t=[],r=[];for(let s of e.items)(this.sources.has(s.mesh)?r:t).push(s);if(this.inner.render(r.length?{...e,items:t}:e),!r.length)return;let i=this.gl,o=this.locations;if(!(!i||!this.program||!o)){i.useProgram(this.program),i.uniformMatrix4fv(o.uViewProj,!1,new Float32Array(e.viewProjection)),i.uniform1i(o.uTexture,0),i.activeTexture(i.TEXTURE0),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),i.depthMask(!1);for(let s of r){let a=this.buffersFor(s.mesh);i.bindTexture(i.TEXTURE_2D,this.textureFor(s.mesh)),i.uniformMatrix4fv(o.uModel,!1,new Float32Array(s.model)),i.uniform1f(o.uOpacity,ei(s.transparency)),i.bindVertexArray(a.vao),i.drawArrays(i.TRIANGLES,0,a.count)}i.depthMask(!0),i.disable(i.BLEND),i.bindVertexArray(null)}}destroy(){let e=this.gl;if(e){for(let t of this.textures.values())e.deleteTexture(t);for(let t of this.buffers.values())e.deleteVertexArray(t.vao);this.program&&e.deleteProgram(this.program)}this.textures.clear(),this.buffers.clear(),this.sources.clear(),this.gl=void 0,this.program=void 0,this.locations=void 0,this.inner.destroy()}}});var vn={};te(vn,{Canvas2DTexturedRenderer:()=>Gt});function gn(n){if(n instanceof HTMLImageElement)return n.complete&&n.naturalWidth>0?{width:n.naturalWidth,height:n.naturalHeight}:void 0;if(n instanceof HTMLVideoElement)return n.readyState>=2?{width:n.videoWidth,height:n.videoHeight}:void 0;if(n instanceof SVGImageElement){let t=n.width.baseVal.value,r=n.height.baseVal.value;return t>0&&r>0?{width:t,height:r}:void 0}if(typeof VideoFrame<"u"&&n instanceof VideoFrame)return{width:n.displayWidth,height:n.displayHeight};let e=n;return e.width>0&&e.height>0?{width:e.width,height:e.height}:void 0}function Mn(n,e,t,r){let[i,o,s]=t,[a,c,l]=r,u=i.x*(o.y-s.y)+o.x*(s.y-i.y)+s.x*(i.y-o.y);if(Math.abs(u)<1e-8)return;let p=(a.x*(o.y-s.y)+c.x*(s.y-i.y)+l.x*(i.y-o.y))/u,m=(a.x*(s.x-o.x)+c.x*(i.x-s.x)+l.x*(o.x-i.x))/u,d=(a.x*(o.x*s.y-s.x*o.y)+c.x*(s.x*i.y-i.x*s.y)+l.x*(i.x*o.y-o.x*i.y))/u,h=(a.y*(o.y-s.y)+c.y*(s.y-i.y)+l.y*(i.y-o.y))/u,y=(a.y*(s.x-o.x)+c.y*(i.x-s.x)+l.y*(o.x-i.x))/u,f=(a.y*(o.x*s.y-s.x*o.y)+c.y*(s.x*i.y-i.x*s.y)+l.y*(i.x*o.y-o.x*i.y))/u;n.save(),n.beginPath(),n.moveTo(a.x,a.y),n.lineTo(c.x,c.y),n.lineTo(l.x,l.y),n.closePath(),n.clip(),n.transform(p,h,m,y,d,f),n.drawImage(e,0,0),n.restore()}var Gt,On=_(()=>{"use strict";k();Y();at();Gt=class{constructor(e={}){this.sources=new Map;this.loaded=new Map;this.dpr=1;this.inner=new Oe(e)}setTexture(e,t){if(this.sources.set(e,t),typeof t=="string"&&!this.loaded.has(t)){let r=new Image;r.src=t,this.loaded.set(t,r)}}init(e){this.inner.init(e),this.ctx=e.getContext("2d")??void 0}resize(e,t,r){this.dpr=r,this.inner.resize(e,t,r)}drawable(e){let t=this.sources.get(e);return typeof t=="string"?this.loaded.get(t):t}render(e){let t=e.items.filter(o=>{if(!this.sources.has(o.mesh))return!0;let s=this.drawable(o.mesh);return!s||!gn(s)});this.inner.render({...e,items:t});let r=this.ctx;if(!r)return;r.setTransform(this.dpr,0,0,this.dpr,0,0);let i=new Map;for(let o of e.items){let s=this.drawable(o.mesh);if(!s)continue;let a=gn(s);if(!a)continue;let c=i.get(o.mesh);if(!c){c=document.createElement("canvas"),c.width=a.width,c.height=a.height;let f=c.getContext("2d");if(!f)continue;f.drawImage(s,0,0,a.width,a.height),f.globalCompositeOperation="source-in",f.fillStyle=o.mesh.faces[0]?.color??"#ffffff",f.fillRect(0,0,a.width,a.height),i.set(o.mesh,c)}let u=o.mesh.vertices.map(f=>ae(o.model,f)).map(f=>{let b=Ie(e.viewProjection,f);return{x:(b.x*.5+.5)*e.width,y:(1-(b.y*.5+.5))*e.height}}),p=o.mesh.faces[0];if(!p||p.indices.length!==4)continue;let[m,d,h,y]=p.indices.map(f=>u[f]);r.globalAlpha=o.transparency?.mode==="one-sided"?I(o.transparency.opacity,.35):1,Mn(r,c,[{x:0,y:a.height},{x:a.width,y:a.height},{x:a.width,y:0}],[m,d,h]),Mn(r,c,[{x:0,y:a.height},{x:a.width,y:0},{x:0,y:0}],[m,h,y])}r.globalAlpha=1}destroy(){this.inner.destroy(),this.ctx=void 0,this.sources.clear(),this.loaded.clear()}}});var Fi={};te(Fi,{Camera:()=>ce,ChargedOrbAnimation:()=>Ae,CompositeAnimation:()=>C,GridAssemblyAnimation:()=>Se,Light:()=>ue,Little3dEngine:()=>z,LittleTweenEngine:()=>Yt,ObjectMotionAnimation:()=>B,ParticlesAnimation:()=>T,SpinAnimation:()=>Vt,WebGLTexturedRenderer:()=>Ye,WebGPUTexturedRenderer:()=>Xe,centerAndScaleMesh:()=>hn,chargedOrb:()=>Dn,circleMotion:()=>et,createSpinner:()=>er,cross:()=>A,crystalComet:()=>Bn,cube:()=>K,cubeSphere:()=>sn,cubic:()=>lt,dot:()=>ne,ease:()=>Ue,easeInBack:()=>Pt,easeInBounce:()=>Ct,easeInCirc:()=>Tt,easeInCubic:()=>H,easeInElastic:()=>Lt,easeInExpo:()=>vt,easeInOutBack:()=>Et,easeInOutBounce:()=>Rt,easeInOutCirc:()=>St,easeInOutCubic:()=>se,easeInOutElastic:()=>zt,easeInOutExpo:()=>Ot,easeInOutQuad:()=>bt,easeInOutQuart:()=>xt,easeInOutQuint:()=>Mt,easeInOutSine:()=>ht,easeInQuad:()=>$,easeInQuart:()=>De,easeInQuint:()=>Be,easeInSine:()=>mt,easeOutBack:()=>fe,easeOutBounce:()=>me,easeOutCirc:()=>At,easeOutCubic:()=>q,easeOutElastic:()=>It,easeOutExpo:()=>Te,easeOutQuad:()=>oe,easeOutQuart:()=>yt,easeOutQuint:()=>gt,easeOutSine:()=>ft,easeTypes:()=>wt,enterFromObjectDirection:()=>jt,expandToTriangles:()=>U,figureEightMotion:()=>xe,ghostTrain:()=>Un,gridAssembly:()=>Gn,grow:()=>Rr,icosphere:()=>ie,leaveInObjectDirection:()=>_t,linear:()=>ct,monochromeStreak:()=>Nn,normalize:()=>v,octaSphere:()=>on,octahedron:()=>je,orderRenderItems:()=>Fe,parseObj:()=>wi,particleField:()=>Pn,planeMesh:()=>_e,planeStarTrail:()=>Hn,pulsingStarfield:()=>Wn,pyramid:()=>pe,quad:()=>Ve,quadratic:()=>ut,quartic:()=>pt,quintic:()=>dt,rocketLaunch:()=>Xn,scale:()=>R,shineTexture:()=>N,shrink:()=>wr,squareMotion:()=>Je,starSwarm:()=>Yn,starTexture:()=>Z,streakTexture:()=>ke,subtract:()=>L,tetrahedron:()=>le,transform:()=>Re,uvSphere:()=>rn,vec3:()=>Qt,wanderMotion:()=>tt});function qt(n){return Number.isNaN(n)?0:Math.min(1,Math.max(0,n))}function Jn(n,e,t){return n+(e-n)*t}function er(n,e){if(!(n instanceof HTMLElement))throw new Error("3d-spinner: createSpinner requires a target HTMLElement.");let{animation:t}=e,r=e.type==="indeterminate";if(r&&e.periodMs!==void 0&&(!Number.isFinite(e.periodMs)||e.periodMs<=0))throw new RangeError("3d-spinner: periodMs must be a finite number greater than zero.");t.mount(n);let i=performance.now(),o=0,s=!1,a=!1,c=!1,l=!1,u=0,p=0,m=1/0;if(!r){let M=e;typeof M.progress=="number"&&(u=qt(M.progress),p=u),typeof M.timeout=="number"&&(m=Math.min(m,i+M.timeout)),M.until instanceof Date&&(m=Math.min(m,M.until.getTime()))}function d(M){if(!r)return M>=m&&(p=1),u=Jn(u,p,.12),Math.abs(p-u)<5e-4&&(u=p),u;let O=e,V=O.periodMs??2e3,j=(M-i)/V;if((O.loop??"bounce")==="restart")return j-Math.floor(j);let Q=j-2*Math.floor(j/2);return Q<=1?Q:2-Q}function h(M){if(s)return;let O=d(M);!c&&(r||O>0)&&(t.enter(M),c=!0),!l&&c&&!r&&O>=1&&p>=1&&(t.exit(M),l=!0);let V=r?O:p;if(t.render(M,{progress:O,targetProgress:V,indeterminate:r}),l&&t.isFinished()){y();return}o=requestAnimationFrame(h)}function y(){s||(s=!0,o&&cancelAnimationFrame(o),o=0)}function f(M){r||(p=qt(M))}function b(){if(!(s||l)){if(!c){y();return}t.exit(performance.now()),l=!0}}function x(){a||(a=!0,y(),t.destroy())}return o=requestAnimationFrame(h),{setProgress:f,stop:b,destroy:x}}k();var tr={position:{x:0,y:0,z:4},fov:55*Math.PI/180,near:.1,far:100},ce=class{constructor(e){this.options={...tr,...e}}toView(e){let{position:t}=this.options;return ae(ge(-t.x,-t.y,-t.z),e)}viewProjection(e){let{position:t,fov:r,near:i,far:o}=this.options,s=ge(-t.x,-t.y,-t.z),a=Zt(r,e,i,o);return S(a,s)}toScreen(e,t,r){return{x:(e.x*.5+.5)*t,y:(1-(e.y*.5+.5))*r}}};Ce();k();function Re(n){return{position:n?.position??{x:0,y:0,z:0},rotation:n?.rotation??{x:0,y:0,z:0},scale:n?.scale??1}}Y();Ce();var ur=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"];function K(n=1,e=ur){let t=n/2,r=[{x:-t,y:-t,z:t},{x:t,y:-t,z:t},{x:t,y:t,z:t},{x:-t,y:t,z:t},{x:-t,y:-t,z:-t},{x:t,y:-t,z:-t},{x:t,y:t,z:-t},{x:-t,y:t,z:-t}],i=[{indices:[0,1,2,3],color:e[0%e.length]},{indices:[5,4,7,6],color:e[1%e.length]},{indices:[3,2,6,7],color:e[2%e.length]},{indices:[4,5,1,0],color:e[3%e.length]},{indices:[1,5,6,2],color:e[4%e.length]},{indices:[4,0,3,7],color:e[5%e.length]}];return{vertices:r,faces:i}}var lr=["#3b82f6"];function Ve(n=1,e=lr){let t=n/2;return{vertices:[{x:-t,y:-t,z:0},{x:t,y:-t,z:0},{x:t,y:t,z:0},{x:-t,y:t,z:0}],faces:[{indices:[0,1,2,3],color:e[0]}]}}var pr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b"];function le(n=1,e=pr){let t=n/2,r=[{x:t,y:t,z:t},{x:t,y:-t,z:-t},{x:-t,y:t,z:-t},{x:-t,y:-t,z:t}],i=[{indices:[0,1,2],color:e[0%e.length]},{indices:[0,3,1],color:e[1%e.length]},{indices:[0,2,3],color:e[2%e.length]},{indices:[1,3,2],color:e[3%e.length]}];return{vertices:r,faces:i}}var dr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444","#06b6d4","#eab308"];function je(n=1,e=dr){let t=n/2,r=[{x:t,y:0,z:0},{x:-t,y:0,z:0},{x:0,y:t,z:0},{x:0,y:-t,z:0},{x:0,y:0,z:t},{x:0,y:0,z:-t}],i=[{indices:[4,0,2],color:e[0%e.length]},{indices:[4,2,1],color:e[1%e.length]},{indices:[4,1,3],color:e[2%e.length]},{indices:[4,3,0],color:e[3%e.length]},{indices:[5,2,0],color:e[4%e.length]},{indices:[5,1,2],color:e[5%e.length]},{indices:[5,3,1],color:e[6%e.length]},{indices:[5,0,3],color:e[7%e.length]}];return{vertices:r,faces:i}}var mr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981"];function pe(n=1,e=mr){let t=n/2,r=[{x:-t,y:-t,z:t},{x:t,y:-t,z:t},{x:t,y:-t,z:-t},{x:-t,y:-t,z:-t},{x:0,y:t,z:0}],i=[{indices:[0,3,2,1],color:e[0%e.length]},{indices:[4,0,1],color:e[1%e.length]},{indices:[4,1,2],color:e[2%e.length]},{indices:[4,2,3],color:e[3%e.length]},{indices:[4,3,0],color:e[4%e.length]}];return{vertices:r,faces:i}}var fr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"];function rn(n=1,e=1,t=fr){let r=n/2,i=Math.max(1,Math.floor(e)),o=Math.max(4,i*4),s=Math.max(2,i*2),a=[{x:0,y:r,z:0}],c=(d,h)=>1+(d-1)*o+h;for(let d=1;d<s;d++){let h=Math.PI*d/s,y=r*Math.cos(h),f=r*Math.sin(h);for(let b=0;b<o;b++){let x=2*Math.PI*b/o;a.push({x:f*Math.cos(x),y,z:f*Math.sin(x)})}}let l=a.length;a.push({x:0,y:-r,z:0});let u=[],p=0,m=()=>t[p++%t.length];for(let d=0;d<o;d++)u.push({indices:[0,c(1,(d+1)%o),c(1,d)],color:m()});for(let d=1;d<s-1;d++)for(let h=0;h<o;h++){let y=(h+1)%o;u.push({indices:[c(d,h),c(d,y),c(d+1,y),c(d+1,h)],color:m()})}for(let d=0;d<o;d++)u.push({indices:[l,c(s-1,d),c(s-1,(d+1)%o)],color:m()});return{vertices:a,faces:u}}X();var hr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"],w=(1+Math.sqrt(5))/2,br=[{x:-1,y:w,z:0},{x:1,y:w,z:0},{x:-1,y:-w,z:0},{x:1,y:-w,z:0},{x:0,y:-1,z:w},{x:0,y:1,z:w},{x:0,y:-1,z:-w},{x:0,y:1,z:-w},{x:w,y:0,z:-1},{x:w,y:0,z:1},{x:-w,y:0,z:-1},{x:-w,y:0,z:1}],yr=[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]];function ie(n=1,e=1,t=hr){return ze(br,yr,n,e,t)}X();var xr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"],gr=[{x:1,y:0,z:0},{x:-1,y:0,z:0},{x:0,y:1,z:0},{x:0,y:-1,z:0},{x:0,y:0,z:1},{x:0,y:0,z:-1}],Mr=[[4,0,2],[4,2,1],[4,1,3],[4,3,0],[5,2,0],[5,1,2],[5,3,1],[5,0,3]];function on(n=1,e=1,t=xr){return ze(gr,Mr,n,e,t)}var vr=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"],Or=[{normal:[0,0,1],right:[1,0,0],up:[0,1,0]},{normal:[0,0,-1],right:[-1,0,0],up:[0,1,0]},{normal:[1,0,0],right:[0,0,-1],up:[0,1,0]},{normal:[-1,0,0],right:[0,0,1],up:[0,1,0]},{normal:[0,1,0],right:[1,0,0],up:[0,0,-1]},{normal:[0,-1,0],right:[1,0,0],up:[0,0,1]}];function sn(n=1,e=1,t=vr){let r=n/2,i=Math.max(1,Math.floor(e)),o=[],s=[],a=0;for(let c of Or){let l=o.length;for(let p=0;p<=i;p++)for(let m=0;m<=i;m++){let d=-1+2*p/i,h=-1+2*m/i,y=c.normal[0]+d*c.right[0]+h*c.up[0],f=c.normal[1]+d*c.right[1]+h*c.up[1],b=c.normal[2]+d*c.right[2]+h*c.up[2],x=Math.hypot(y,f,b);o.push({x:y/x*r,y:f/x*r,z:b/x*r})}let u=(p,m)=>l+p*(i+1)+m;for(let p=0;p<i;p++)for(let m=0;m<i;m++)s.push({indices:[u(p,m),u(p+1,m),u(p+1,m+1),u(p,m+1)],color:t[a++%t.length]})}return{vertices:o,faces:s}}var P=["#e0f2fe","#7dd3fc","#38bdf8","#f8fafc"];function _e(n=P){return{vertices:[{x:.9,y:0,z:0},{x:-.2,y:0,z:.82},{x:-.55,y:0,z:.16},{x:-.72,y:0,z:0},{x:-.55,y:0,z:-.16},{x:-.2,y:0,z:-.82},{x:-.08,y:.12,z:0},{x:-.08,y:-.1,z:0},{x:-.52,y:.38,z:0}],faces:[{indices:[6,1,0],color:n[0]??P[0]},{indices:[6,2,1],color:n[3]??P[3]},{indices:[6,3,2],color:n[1]??P[1]},{indices:[6,4,3],color:n[2]??P[2]},{indices:[6,5,4],color:n[3]??P[3]},{indices:[6,0,5],color:n[0]??P[0]},{indices:[7,0,1],color:n[1]??P[1]},{indices:[7,1,2],color:n[2]??P[2]},{indices:[7,2,3],color:n[1]??P[1]},{indices:[7,3,4],color:n[2]??P[2]},{indices:[7,4,5],color:n[1]??P[1]},{indices:[7,5,0],color:n[2]??P[2]},{indices:[3,6,8],color:n[0]??P[0]},{indices:[3,8,6],color:n[1]??P[1]}]}}function de(n,e=96){let t=document.createElement("canvas");t.width=t.height=e;let r=t.getContext("2d");return r&&n(r),t}function Z(){return de(n=>{n.translate(48,48),n.fillStyle="#fff",n.beginPath();for(let e=0;e<10;e++){let t=e%2===0?43:16,r=e*Math.PI/5-Math.PI/2;n.lineTo(t*Math.cos(r),t*Math.sin(r))}n.closePath(),n.fill()})}function N(){return de(n=>{let e=n.createRadialGradient(48,48,1,48,48,46);e.addColorStop(0,"rgba(255,255,255,1)"),e.addColorStop(.08,"rgba(255,255,255,1)"),e.addColorStop(.22,"rgba(210,240,255,0.7)"),e.addColorStop(.55,"rgba(120,200,255,0.22)"),e.addColorStop(1,"rgba(80,160,255,0)"),n.fillStyle=e,n.fillRect(0,0,96,96)})}function ke(){return de(n=>{let e=n.createLinearGradient(5,0,91,0);e.addColorStop(0,"rgba(255,255,255,0)"),e.addColorStop(.7,"rgba(255,255,255,0.4)"),e.addColorStop(1,"rgba(255,255,255,1)"),n.strokeStyle=e,n.lineWidth=3.5,n.lineCap="round",n.beginPath(),n.moveTo(5,48),n.lineTo(91,48),n.stroke()})}X();Y();k();function Tr(n){let e=S(Le(n.rotation.z),S(Ee(n.rotation.y),Pe(n.rotation.x)));return S(ge(n.position.x,n.position.y,n.position.z),S(e,Kt(n.scale)))}var z=class{constructor(e={}){this.scene=[];this.cssWidth=0;this.cssHeight=0;this.ready=!1;this.generation=0;this.rafId=0;this.running=!1;this.camera=new ce(e.camera),this.light=new ue(e.light),this.backend=e.backend??"canvas2d",this.background=e.background}async mount(e){let t=document.createElement("canvas");t.style.display="block",t.style.width="100%",t.style.height="100%",e.appendChild(t),this.canvas=t,this.observer=new ResizeObserver(()=>this.resize()),this.observer.observe(t),this.resize();let r=this.generation,i=()=>{this.canvas===t&&(this.observer?.disconnect(),this.observer=void 0,t.remove(),this.canvas=void 0)};try{let o=await nn(this.backend,{background:this.background});if(r!==this.generation){o.destroy(),i();return}if(await o.init(t),r!==this.generation){o.destroy(),i();return}this.renderer=o,this.resize(),this.ready=!0}catch(o){throw i(),o}}add(e,t){let r={mesh:e,transform:Re(t),transparency:t?.transparency,remove:()=>{let i=this.scene.indexOf(r);i>=0&&this.scene.splice(i,1)}};return this.scene.push(r),r}resize(){let e=this.canvas;if(!e)return;let t=window.devicePixelRatio||1;this.cssWidth=e.clientWidth||e.parentElement?.clientWidth||0,this.cssHeight=e.clientHeight||e.parentElement?.clientHeight||0,e.width=Math.max(1,Math.round(this.cssWidth*t)),e.height=Math.max(1,Math.round(this.cssHeight*t)),this.renderer?.resize(this.cssWidth,this.cssHeight,t)}render(){if(!this.ready||!this.renderer)return;let e=this.cssWidth,t=this.cssHeight;if(e===0||t===0)return;let r=this.scene.map(o=>({mesh:o.mesh,model:Tr(o.transform),transparency:o.transparency})),i=this.camera.options.position;this.renderer.render({items:Fe(r,i),viewProjection:this.camera.viewProjection(e/t),eye:i,light:this.light.params,width:e,height:t})}start(){if(this.running)return;this.running=!0;let e=()=>{this.running&&(this.render(),this.rafId=requestAnimationFrame(e))};this.rafId=requestAnimationFrame(e)}stop(){this.running=!1,this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=0}destroy(){this.generation++,this.ready=!1,this.stop(),this.observer?.disconnect(),this.observer=void 0,this.renderer?.destroy(),this.renderer=void 0,this.canvas?.remove(),this.canvas=void 0}};function g(n,e){return Number.isNaN(n)?0:e?n:Math.min(1,Math.max(0,n))}function ct(n,e=!1){return g(n,e)}function ut(n,e=!1){return $(n,e)}function lt(n,e=!1){return H(n,e)}function pt(n,e=!1){return De(n,e)}function dt(n,e=!1){return Be(n,e)}function mt(n,e=!1){let t=g(n,e);return 1-Math.cos(t*Math.PI/2)}function ft(n,e=!1){let t=g(n,e);return Math.sin(t*Math.PI/2)}function ht(n,e=!1){let t=g(n,e);return-(Math.cos(Math.PI*t)-1)/2}function $(n,e=!1){let t=g(n,e);return t*t}function oe(n,e=!1){let t=g(n,e);return 1-(1-t)*(1-t)}function bt(n,e=!1){let t=g(n,e);return t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2}function H(n,e=!1){let t=g(n,e);return t*t*t}function q(n,e=!1){let t=g(n,e);return 1-Math.pow(1-t,3)}function se(n,e=!1){let t=g(n,e);return t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2}function De(n,e=!1){let t=g(n,e);return t*t*t*t}function yt(n,e=!1){let t=g(n,e);return 1-Math.pow(1-t,4)}function xt(n,e=!1){let t=g(n,e);return t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2}function Be(n,e=!1){let t=g(n,e);return t*t*t*t*t}function gt(n,e=!1){let t=g(n,e);return 1-Math.pow(1-t,5)}function Mt(n,e=!1){let t=g(n,e);return t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2}function vt(n,e=!1){let t=g(n,e);return t===0?0:Math.pow(2,10*t-10)}function Te(n,e=!1){let t=g(n,e);return t===1?1:1-Math.pow(2,-10*t)}function Ot(n,e=!1){let t=g(n,e);return t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}function Tt(n,e=!1){let t=g(n,e);return 1-Math.sqrt(1-Math.pow(t,2))}function At(n,e=!1){let t=g(n,e);return Math.sqrt(1-Math.pow(t-1,2))}function St(n,e=!1){let t=g(n,e);return t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2}function Pt(n,e=!1){let t=g(n,e),r=1.70158;return(r+1)*t*t*t-r*t*t}function fe(n,e=!1){let t=g(n,e),r=1.70158;return 1+(r+1)*Math.pow(t-1,3)+r*Math.pow(t-1,2)}function Et(n,e=!1){let t=g(n,e),i=1.70158*1.525;return t<.5?Math.pow(2*t,2)*((i+1)*2*t-i)/2:(Math.pow(2*t-2,2)*((i+1)*(t*2-2)+i)+2)/2}function Lt(n,e=!1){let t=g(n,e),r=2*Math.PI/3;return t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*r)}function It(n,e=!1){let t=g(n,e),r=2*Math.PI/3;return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*r)+1}function zt(n,e=!1){let t=g(n,e),r=2*Math.PI/4.5;return t===0?0:t===1?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*r))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*r)/2+1}function Ct(n,e=!1){let t=g(n,e);return 1-me(1-t,!0)}function me(n,e=!1){let t=g(n,e),r=7.5625,i=2.75;return t<1/i?r*t*t:t<2/i?(t-=1.5/i,r*t*t+.75):t<2.5/i?(t-=2.25/i,r*t*t+.9375):(t-=2.625/i,r*t*t+.984375)}function Rt(n,e=!1){let t=g(n,e);return t<.5?(1-me(1-2*t,!0))/2:(1+me(2*t-1,!0))/2}var wt={linear:ct,quadratic:ut,cubic:lt,quartic:pt,quintic:dt,easeInSine:mt,easeOutSine:ft,easeInOutSine:ht,easeInQuad:$,easeOutQuad:oe,easeInOutQuad:bt,easeInCubic:H,easeOutCubic:q,easeInOutCubic:se,easeInQuart:De,easeOutQuart:yt,easeInOutQuart:xt,easeInQuint:Be,easeOutQuint:gt,easeInOutQuint:Mt,easeInExpo:vt,easeOutExpo:Te,easeInOutExpo:Ot,easeInCirc:Tt,easeOutCirc:At,easeInOutCirc:St,easeInBack:Pt,easeOutBack:fe,easeInOutBack:Et,easeInElastic:Lt,easeOutElastic:It,easeInOutElastic:zt,easeInBounce:Ct,easeOutBounce:me,easeInOutBounce:Rt};function Ue(n,e,t=!1){return wt[n](e,t)}function Ar(n={}){return{popDurationMs:n.popDurationMs??500,overextend:n.overextend??.2,startSnapRatio:n.startSnapRatio??.2,loadingText:n.loadingText===void 0?"loading":n.loadingText,doneText:n.doneText??"done",doneFadeDurationMs:n.doneFadeDurationMs??2e3,removeOnComplete:n.removeOnComplete??!1}}function Ft(n,e,t){return t<=0?1:Math.min(1,Math.max(0,(n-e)/t))}var Ge=class{constructor(e={}){this.phase="idle";this.phaseStart=0;this.activeProgress=0;this.popTarget=0;this.doneFadeStart=0;this.options=Ar(e)}enter(e){this.phase==="idle"&&(this.phase="startPop",this.phaseStart=e,this.activeProgress=0,this.popTarget=0)}exit(e){this.phase!=="startPop"&&this.phase!=="active"||(this.phase="endPop",this.phaseStart=e)}isFinished(){return this.phase==="finished"}update(e,t,r){let{popDurationMs:i,overextend:o,startSnapRatio:s,loadingText:a,doneText:c,doneFadeDurationMs:l,removeOnComplete:u}=this.options,p=r??t;(this.phase==="startPop"||this.phase==="active")&&(this.activeProgress=t,this.phase==="startPop"&&(this.popTarget=Math.max(this.popTarget,p,t)));let m=0,d=null,h=0,y=!1;if(this.phase==="startPop"){let f=Ft(e,this.phaseStart,i),b=this.popTarget*(1+o);if(f<s){let x=s>0?f/s:1;m=b*Te(x)}else{let x=s<1?(f-s)/(1-s):1;m=b+(this.activeProgress-b)*q(x)}f>=1&&(this.phase="active")}else if(this.phase==="active")m=this.activeProgress;else if(this.phase==="endPop"){let f=Ft(e,this.phaseStart,i),b=1+o;f<.5?m=1+(b-1)*oe(f*2):m=b*(1-$((f-.5)*2)),f>=1&&(this.phase="done",this.doneFadeStart=e,m=0)}if(this.phase==="startPop"||this.phase==="active")a!==!1&&(d=a,h=.65);else if(this.phase==="endPop")d=c,h=.65;else if(this.phase==="done"){let f=Ft(e,this.doneFadeStart,l);f>=1?(u&&(y=!0),this.phase="finished"):(d=c,h=.65*(1-f))}return{scale:m,text:d,textOpacity:h,hidden:y}}};var Sr=["position:absolute","inset:0","display:flex","align-items:center","justify-content:center","pointer-events:none","font:600 1.1rem/1.2 system-ui,sans-serif","letter-spacing:0.06em","text-transform:lowercase","color:rgba(255,255,255,0.65)","z-index:1"].join(";");function Pr(n){return n?typeof n=="function"?n():n:K()}function Er(n,e){if(e===void 0||Array.isArray(e)&&e.length===0)return n;let t=Array.isArray(e)?r=>e[r%e.length]:()=>e;return{vertices:n.vertices,faces:n.faces.map((r,i)=>({...r,color:t(i)}))}}var Vt=class{constructor(e={}){this.exited=!1;this.mesh=Er(Pr(e.shape),e.color),this.spinX=e.spinX??7e-4,this.spinY=e.spinY??.0011,this.backend=e.backend,this.transparency=e.transparency,this.progress=e.progressAnimation?new Ge(e.progressAnimation):void 0}mount(e){e.style.position="relative";let t=new z({backend:this.backend,camera:{position:{x:0,y:0,z:2.8}}});if(this.handle=t.add(this.mesh,{transparency:this.transparency}),this.engine=t,t.mount(e).catch(r=>{e.textContent=r instanceof Error?r.message:String(r)}),this.progress){let r=document.createElement("div");r.style.cssText=Sr,r.setAttribute("aria-hidden","true"),r.hidden=!0,e.appendChild(r),this.label=r}}enter(e){this.progress?.enter(e)}exit(e){this.exited=!0,this.progress?.exit(e)}isFinished(){return this.progress?this.progress.isFinished():this.exited}render(e,t){if(!this.engine||!this.handle)return;let r=this.handle.transform.rotation;if(r.x=e*this.spinX,r.y=e*this.spinY,this.progress){let i=this.progress.update(e,t.progress,t.targetProgress);this.handle.transform.scale=i.hidden?0:i.scale,this.applyLabel(i)}else this.handle.transform.scale=1;this.engine.render()}destroy(){this.label?.remove(),this.label=void 0,this.engine?.destroy(),this.engine=void 0,this.handle=void 0}applyLabel(e){if(this.label){if(e.hidden||e.text==null){this.label.hidden=!0,this.label.textContent="";return}this.label.hidden=!1,this.label.textContent=e.text,this.label.style.opacity=String(e.textOpacity)}}};var Lr=["position:absolute","inset:0","display:flex","align-items:center","justify-content:center","pointer-events:none","font:700 1.6rem/1 system-ui,sans-serif","letter-spacing:0.02em","color:rgba(255,255,255,0.9)","text-shadow:0 1px 10px rgba(0,0,0,0.6)","z-index:1"].join(";");function he(n,e,t,r,i){if(e===1/0)return 0;let o=t<=0?1:Math.max(0,Math.min(1,(n-e)/t)),s=r===1/0?1:i<=0?0:Math.max(0,Math.min(1,1-(n-r)/i));return Math.min(o,s)}function be(n,e){var r;let t=document.createElement("div");return t.style.cssText=Lr,t.setAttribute("role","status"),typeof e=="string"?t.textContent=e:e&&((r=e.style).pointerEvents||(r.pointerEvents="auto"),t.appendChild(e)),n.appendChild(t),{container:t,setText(i){typeof e!="object"&&(t.textContent=i)},setOpacity(i){t.style.opacity=String(i)}}}k();function an(n,e){return{x:n.x+e.x,y:n.y+e.y,z:n.z+e.z}}function Ne(n,e){return{x:n.x*e,y:n.y*e,z:n.z*e}}function cn(n){return Math.hypot(n.x,n.y,n.z)}function Ir(n){let e=cn(n);return e<1e-6?{x:1,y:0,z:0}:Ne(n,1/e)}function zr(n,e){return Ir(e??n.direction??n.velocity??{x:1,y:0,z:0})}function Cr(n){let t=n-1;return 1+(1.70158+1)*t*t*t+1.70158*t*t}function un(n,e,t){let r=n.velocity?cn(n.velocity):0;if(n.velocity&&r>1e-6&&!e.direction)return n.velocity;let i=e.distance??3.5;return Ne(zr(n,e.direction),i/t)}function jt(n={}){return e=>{let t=Math.max(1,e.durationMs),r=un(e,n,t),i=t-e.elapsedMs;return{position:an(e.position,Ne(r,-i))}}}function _t(n={}){return e=>{let t=Math.max(1,e.durationMs),r=un(e,n,t);return{position:an(e.position,Ne(r,e.elapsedMs))}}}function Rr(){return n=>({size:(n.size??1)*Cr(n.delta)})}function wr(){return n=>({size:(n.size??1)*(1-n.delta*n.delta)})}var Fr={x:0,y:1,z:0},Vr=2100,jr=2100,_r=26,ln=.7,kr=.12,kt=8,Dr={"+x":n=>n,"-x":n=>({x:-n.x,y:n.y,z:-n.z}),"+z":n=>({x:n.z,y:n.y,z:-n.x}),"-z":n=>({x:-n.z,y:n.y,z:n.x}),"+y":n=>({x:n.y,y:-n.x,z:n.z}),"-y":n=>({x:-n.y,y:n.x,z:n.z})};function Br(n,e){return{x:n.x+e.x,y:n.y+e.y,z:n.z+e.z}}function Ur(n){return typeof n=="function"?n():n}function Gr(n,e){return e===void 0?n:{vertices:n.vertices,faces:n.faces.map(t=>({...t,color:e}))}}function Nr(n,e){if(e==="+x")return n;let t=Dr[e];return{vertices:n.vertices.map(t),faces:n.faces}}function hn(n,e){let t=1/0,r=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0;for(let d of n.vertices)t=Math.min(t,d.x),r=Math.min(r,d.y),i=Math.min(i,d.z),o=Math.max(o,d.x),s=Math.max(s,d.y),a=Math.max(a,d.z);let c=(t+o)/2,l=(r+s)/2,u=(i+a)/2,p=Math.max(o-t,s-r,a-i)||1,m=e/p;return{vertices:n.vertices.map(d=>({x:(d.x-c)*m,y:(d.y-l)*m,z:(d.z-u)*m})),faces:n.faces}}function Hr(n,e){let t=v(n),r=A(t,Fr);Math.hypot(r.x,r.y,r.z)<1e-4&&(r={x:0,y:0,z:1}),r=v(r);let i=A(r,t),o=Br(R(i,Math.cos(e)),R(r,Math.sin(e))),s=v(A(t,o));return{x:Math.atan2(A(s,t).z,s.z),y:Math.asin(Math.max(-1,Math.min(1,-t.z))),z:Math.atan2(t.y,t.x)}}function pn(n,e,t){return S(Le(t),S(Ee(e),Pe(n)))}function Wr(n){return Math.hypot(n[0],n[1])>1e-6?{x:Math.atan2(n[9],n[10]),y:Math.asin(Math.max(-1,Math.min(1,-n[8]))),z:Math.atan2(n[4],n[0])}:{x:Math.atan2(-n[6],n[5]),y:Math.asin(Math.max(-1,Math.min(1,-n[8]))),z:0}}function Xr(n,e){return Wr(S(pn(n.x,n.y,n.z),pn(e.x,e.y,e.z)))}function Yr(n){return Math.max(0,Math.min(1,n))}function dn(n,e){return R(L(n.positionAt(e+1),n.positionAt(e-1)),.5)}function mn(n,e){return Math.hypot(n.x,n.y,n.z)>1e-6?v(n):e}function fn(n,e,t){return n?typeof n=="function"?{transition:n,durationMs:t}:{transition:n.transition,durationMs:Math.max(0,n.durationMs??t)}:{transition:e,durationMs:t}}var B=class{constructor(e){this.handles=[];this.banks=[];this.headings=[];this.started=!1;this.finished=!1;this.introStart=0;this.outroStart=1/0;this.outroPosition={x:0,y:0,z:0};this.outroVelocity={x:0,y:0,z:0};this.outroDirection={x:1,y:0,z:0};let t=hn(Ur(e.mesh),e.size??1),r=Nr(t,e.facing??"+x");this.mesh=Gr(r,e.color),this.motion=e.motion,this.backend=e.backend,this.transparency=e.transparency,this.labelContent=e.label,this.fadeLabel=e.fadeLabel??!0,this.tailCount=Math.max(0,Math.floor(e.tail?.count??0)),this.tailGap=Math.max(0,e.tail?.gapMs??0),this.intro=fn(e.intro,jt(),Vr),this.outro=fn(e.outro,_t(),jr);let i=e.rotation;this.rotationOffset={x:i?.x??0,y:i?.y??0,z:i?.z??0},this.rotationSpin={x:i?.spinX??0,y:i?.spinY??0,z:i?.spinZ??0},this.hasExtraRotation=this.rotationOffset.x!==0||this.rotationOffset.y!==0||this.rotationOffset.z!==0||this.rotationSpin.x!==0||this.rotationSpin.y!==0||this.rotationSpin.z!==0}mount(e){e.style.position||(e.style.position="relative");let t=new z({backend:this.backend,camera:{position:{x:0,y:0,z:3}}});for(let r=0;r<=this.tailCount;r++)this.handles.push(t.add(this.mesh,{transparency:this.transparency})),this.banks.push(0),this.headings.push({x:1,y:0,z:0});this.engine=t,t.mount(e).catch(r=>{e.textContent=r instanceof Error?r.message:String(r)}),this.label=be(e,this.labelContent),this.fadeLabel&&this.label.setOpacity(0)}enter(e){this.started||(this.started=!0,this.introStart=e)}exit(e){!this.started||this.outroStart!==1/0||(this.outroPosition=this.motion.positionAt(e),this.outroVelocity=dn(this.motion,e),this.outroDirection=mn(this.outroVelocity,this.headings[0]),this.outroStart=e)}isFinished(){return this.finished}get outroDurationMs(){return this.outro.durationMs}trailEmitter(){return{positionAt:e=>this.sampleAt(e)?.position??this.motion.positionAt(e)}}render(e,t){if(!(!this.engine||!this.label)){this.outroStart!==1/0&&e>=this.outroStart+this.outro.durationMs+this.tailCount*this.tailGap&&(this.finished=!0);for(let r=0;r<this.handles.length;r++){let i=this.handles[r].transform,o=e-r*this.tailGap,s=this.sampleAt(o);if(!s){i.scale=0;continue}i.scale=s.size;let a=s.orientation;if(!a){let c=L(this.positionAt(o+kt)??s.position,s.position);Math.hypot(c.x,c.y,c.z)>1e-5&&(this.headings[r]=v(c));let l=this.aheadAt(o)??this.headings[r],u=Math.max(-ln,Math.min(ln,A(this.headings[r],l).y*_r));this.banks[r]+=(u-this.banks[r])*kr,a=Hr(this.headings[r],this.banks[r])}this.hasExtraRotation&&(a=Xr(a,{x:this.rotationOffset.x+this.rotationSpin.x*o,y:this.rotationOffset.y+this.rotationSpin.y*o,z:this.rotationOffset.z+this.rotationSpin.z*o})),i.position.x=s.position.x,i.position.y=s.position.y,i.position.z=s.position.z,i.rotation.x=a.x,i.rotation.y=a.y,i.rotation.z=a.z}this.label.setText(t.indeterminate?typeof this.labelContent=="string"?this.labelContent:"":`${Math.round(t.progress*100)}%`),this.fadeLabel&&this.label.setOpacity(he(e,this.started?this.introStart:1/0,this.intro.durationMs,this.outroStart,this.outro.durationMs)),this.engine.render()}}destroy(){this.label?.container.remove(),this.label=void 0,this.engine?.destroy(),this.engine=void 0,this.handles.length=0}aheadAt(e){let t=this.positionAt(e+kt),r=this.positionAt(e+2*kt);if(!t||!r)return;let i=L(r,t);if(!(Math.hypot(i.x,i.y,i.z)<=1e-5))return v(i)}positionAt(e){return this.sampleAt(e)?.position}sampleAt(e){if(!(!this.started||e<this.introStart)){if(e<this.introStart+this.intro.durationMs)return this.transitionSample("intro",e,this.intro,this.introStart);if(this.outroStart!==1/0){if(e>this.outroStart+this.outro.durationMs)return;if(e>=this.outroStart)return this.transitionSample("outro",e,this.outro,this.outroStart)}return{position:this.motion.positionAt(e),size:1}}}transitionSample(e,t,r,i){let o=Math.max(0,t-i),s=r.durationMs===0?1:Yr(o/r.durationMs),a=this.transitionInput(e,s,o,r.durationMs,i),c=r.transition(a);return this.applyTransitionOutput(a,c,e,t)}transitionInput(e,t,r,i,o){if(e==="intro"){let s=o+i,a=dn(this.motion,s);return{delta:t,position:this.motion.positionAt(s),direction:mn(a,{x:1,y:0,z:0}),velocity:a,size:1,durationMs:i,elapsedMs:r,phase:e}}return{delta:t,position:this.outroPosition,direction:this.outroDirection,velocity:this.outroVelocity,size:1,durationMs:i,elapsedMs:r,phase:e}}applyTransitionOutput(e,t,r,i){return{position:t.position??(r==="intro"?this.motion.positionAt(i):e.position),size:t.size??e.size??1,orientation:t.orientation}}};var ti=["#fde047","#fb923c","#f472b6","#60a5fa"],Sn=.15,ni=.6;function ye(n,e,t){let r=(n^Math.imul(e+1,2654435769)^Math.imul(t+1,2246822507))>>>0;return r=Math.imul(r^r>>>16,73244475),r=Math.imul(r^r>>>16,73244475),r^=r>>>16,(r>>>0)/4294967296}function Tn(n,e,t){let r=Math.max(0,Math.min(1,(t-n)/(e-n)));return r*r*(3-2*r)}function An(n,e){if(!Number.isFinite(n)||n<=0)throw new RangeError(`3d-spinner: ${e} must be a finite number greater than zero.`);return n}function ri(n){let e=v(n),t=Math.abs(e.y)<.99?{x:0,y:1,z:0}:{x:1,y:0,z:0},r=v(A(t,e));return{d:e,right:r,up:A(e,r)}}function Pn(n={}){let e=An(n.rate??20,"rate"),t=An(n.lifeMs??1800,"lifeMs"),r=n.size??.16,i=n.speed??.6,o=n.gravity,s=n.spread??.5,a=Math.max(0,Math.min(1,n.opacity??.9)),c=n.spin??.002,l=n.alignToMotion??!1,u=n.seed??1,p=n.direction&&ri(n.direction),m=1e3/e,d=h=>{let y=ye(u,h,0),f=2*Math.PI*ye(u,h,1);if(!p){let j=2*y-1,Q=Math.sqrt(Math.max(0,1-j*j));return{x:Q*Math.cos(f),y:Q*Math.sin(f),z:j}}let b=1-y*(1-Math.cos(s)),x=Math.sqrt(Math.max(0,1-b*b)),{d:M,right:O,up:V}=p;return{x:M.x*b+(O.x*Math.cos(f)+V.x*Math.sin(f))*x,y:M.y*b+(O.y*Math.cos(f)+V.y*Math.sin(f))*x,z:M.z*b+(O.z*Math.cos(f)+V.z*Math.sin(f))*x}};return{maxLive:Math.ceil(t*e/1e3)+1,spawnGapMs:m,lifeMs:t,sample(h,y){if(h<0)return;let f=y-h*m;if(f<0||f>=t)return;let b=f/1e3,x=d(h),M=i*(.6+.8*ye(u,h,2)),O=M*b,V=o?.5*b*b:0,j=f/t,Q=l?Math.atan2(x.y*M+(o?.y??0)*b,x.x*M+(o?.x??0)*b):2*Math.PI*ye(u,h,3)+(2*ye(u,h,4)-1)*c*f;return{position:{x:x.x*O+(o?o.x*V:0),y:x.y*O+(o?o.y*V:0),z:x.z*O+(o?o.z*V:0)},roll:Q,size:r*(.7+.6*ye(u,h,5)),opacity:a*Tn(0,Sn,j)*(1-Tn(ni,1,j))}}}}var T=class{constructor(e={}){this.handles=[];this.fades=[];this.enterAt=1/0;this.exitAt=1/0;this.finished=!1;this.field=Pn(e),this.colors=e.colors??ti,this.backend=e.backend,this.texture=e.texture,this.labelContent=e.label,this.fadeLabel=e.fadeLabel??!0,this.emitter=e.emitter,this.outroMs=Math.max(0,e.outroMs??0)}mount(e){e.style.position||(e.style.position="relative");let t=this.colors.map(s=>Ve(1,[s])),r=this.texture,i=r?async s=>{let a=this.backend==="webgpu"?new(await Promise.resolve().then(()=>(Bt(),bn))).WebGPUTexturedRenderer(s):this.backend==="webgl"?new(await Promise.resolve().then(()=>(Ut(),xn))).WebGLTexturedRenderer(s):new(await Promise.resolve().then(()=>(On(),vn))).Canvas2DTexturedRenderer(s);for(let c of t)a.setTexture(c,r);return a}:this.backend,o=new z({backend:i,camera:{position:{x:0,y:0,z:3}},light:{intensity:0,ambient:1}});for(let s=0;s<this.field.maxLive;s++){let a={mode:"one-sided",opacity:0};this.fades.push(a),this.handles.push(o.add(t[s%t.length],{scale:0,transparency:a}))}this.engine=o,o.mount(e).catch(s=>{e.textContent=s instanceof Error?s.message:String(s)}),this.label=be(e,this.labelContent),this.fadeLabel&&this.label.setOpacity(0)}enter(e){this.enterAt===1/0&&(this.enterAt=e)}exit(e){this.exitAt===1/0&&(this.exitAt=e)}isFinished(){return this.finished}render(e,t){if(!(!this.engine||!this.label)){this.exitAt!==1/0&&e>=this.exitAt+this.outroMs+this.field.lifeMs&&(this.finished=!0);for(let r of this.handles)r.transform.scale=0;if(this.enterAt!==1/0){let r=e-this.enterAt,i=this.field.spawnGapMs,o=Math.max(0,Math.ceil((r-this.field.lifeMs)/i)),s=Math.floor(r/i);this.exitAt!==1/0&&(s=Math.min(s,Math.floor((this.exitAt-this.enterAt+this.outroMs)/i))),o=Math.max(o,s-this.field.maxLive+1);for(let a=o;a<=s;a++){let c=this.field.sample(a,r);if(!c)continue;let l=a%this.handles.length,u=this.handles[l].transform,p=this.emitter?.positionAt(this.enterAt+a*i);u.position.x=c.position.x+(p?.x??0),u.position.y=c.position.y+(p?.y??0),u.position.z=c.position.z+(p?.z??0),u.rotation.z=c.roll,u.scale=c.size,this.fades[l].opacity=c.opacity}}this.label.setText(t.indeterminate?typeof this.labelContent=="string"?this.labelContent:"":`${Math.round(t.progress*100)}%`),this.fadeLabel&&this.label.setOpacity(he(e,this.enterAt,this.field.lifeMs*Sn,this.exitAt,this.field.lifeMs)),this.engine.render()}}destroy(){this.label?.container.remove(),this.label=void 0,this.engine?.destroy(),this.engine=void 0,this.handles.length=0,this.fades.length=0}};var F=10,ii=3,En=.76,oi=.36,si={mode:"two-sided",frontOpacity:.68,backOpacity:.87},Ln=1.2,In=.8,Nt=Math.PI*2,ai=500,ci=550,ui=2.5,li=250,Ht=250,Wt=1300,Rn=600,wn=45,zn=Rn+(F-1)*wn+150,pi=420,di={x:0,y:0,z:50},mi=["#67e8f9","#22d3ee","#0ea5e9","#38bdf8","#7dd3fc"],Cn=[["#e0f2fe","#bae6fd","#7dd3fc"],["#c7d2fe","#a5b4fc","#818cf8"],["#a5f3fc","#67e8f9","#22d3ee"]];function qe(n){return Math.max(0,Math.min(1,n))}var Ae=class{constructor(e={}){this.minis=[];this.blends=new Array(F).fill(0);this.offsets=new Array(F).fill(0);this.enterAt=1/0;this.exitAt=1/0;this.allOutAt=1/0;this.lastNow=0;this.finished=!1;this.orbitPeriodMs=e.orbitPeriodMs??6e3,this.backend=e.backend}mount(e){e.style.position||(e.style.position="relative");let t=new z({backend:this.backend,camera:{position:{x:0,y:0,z:ii}}});this.center=t.add(ie(1,2,mi),{scale:0});for(let r=0;r<F;r++){let i=ie(1,1,Cn[r%Cn.length]);this.minis.push(t.add(i,{scale:0,transparency:{...si}}))}this.engine=t,t.mount(e).catch(r=>{e.textContent=r instanceof Error?r.message:String(r)})}enter(e){this.enterAt===1/0&&(this.enterAt=e)}exit(e){this.exitAt===1/0&&(this.exitAt=e)}isFinished(){return this.finished}get outroEmitMs(){return Ht+Wt+zn}satelliteEmitter(e){return{positionAt:t=>{let r=[];for(let o=0;o<F;o++){let s=this.miniSample(o,t);s&&r.push(s.position)}if(r.length===0)return di;let i=Math.abs(Math.floor(t/e))%r.length;return r[i]}}}render(e,t){if(!this.engine||!this.center)return;if(this.enterAt===1/0){this.center.transform.scale=0;for(let o of this.minis)o.transform.scale=0;this.engine.render();return}let r=this.lastNow===0?16:Math.min(50,e-this.lastNow);this.lastNow=e,this.updateBlends(r,t.progress,e),this.updateSpread(r);let i=e-this.enterAt;this.center.transform.scale=this.centerScale(e,i),this.center.transform.rotation.x=i*2e-4,this.center.transform.rotation.y=i*5e-4;for(let o=0;o<F;o++){let s=this.minis[o].transform,a=this.miniSample(o,e);if(!a){s.scale=0;continue}s.position.x=a.position.x,s.position.y=a.position.y,s.position.z=a.position.z,s.scale=a.scale,s.rotation.y=i*.0012}this.engine.render()}destroy(){this.engine?.destroy(),this.engine=void 0,this.center=void 0,this.minis.length=0}updateBlends(e,t,r){let i=this.exitAt!==1/0,o=i?F:Math.min(F,Math.floor(t*F+1e-9)),s=e/ci*(i?ui:1);for(let a=0;a<F;a++){let c=a<o?1:0,l=this.blends[a];c>l&&(a===0||this.blends[a-1]>=.6)?(this.blends[a]=Math.min(1,l+s),l===0&&(this.offsets[a]=this.slotAngle(a))):c<l&&(a===F-1||this.blends[a+1]<=.4)&&(this.blends[a]=Math.max(0,l-s))}i&&this.allOutAt===1/0&&this.blends.every(a=>a>=1)&&(this.allOutAt=r)}updateSpread(e){let t=1-Math.exp(-e/li);for(let r=0;r<F;r++)this.blends[r]<=0||(this.offsets[r]+=(this.slotAngle(r)-this.offsets[r])*t)}slotAngle(e){let t=Math.max(1,this.blends.filter(r=>r>0).length);return Nt*Math.min(e,t-1)/t}baseAngleAt(e){let t=-Nt*(e-this.enterAt)/this.orbitPeriodMs;if(this.allOutAt!==1/0){let r=qe((e-this.allOutAt-Ht)/Wt);t-=Nt*se(r)}return t}reenterStart(){return this.allOutAt+Ht+Wt}miniSample(e,t){let r=this.blends[e];if(r<=0)return;let i=q(r),o=oi*fe(r);if(this.allOutAt!==1/0){let c=this.reenterStart()+e*wn,l=H(qe((t-c)/Rn));if(l>=1)return;i*=1-l,o*=1-l}let s=this.baseAngleAt(t)+this.offsets[e],a=Math.sin(s)*Ln*i;return{position:{x:Math.cos(s)*Ln*i,y:a*Math.cos(In),z:a*Math.sin(In)},scale:o}}centerScale(e,t){if(this.allOutAt!==1/0){let r=qe((e-this.reenterStart()-zn)/pi);if(r>=1)return this.finished=!0,0;if(r>0)return En*(r<.35?1+.18*oe(r/.35):1.18*(1-$((r-.35)/.65)))}return En*fe(qe(t/ai))}};var $e=5,E=$e*$e,Fn=4,Vn=55*Math.PI/180,J=Math.PI*2,fi=900,hi=60,bi=.35,yi=.65,xi=2.5,gi=2e3,jn=380,Mi=80,vi=1e3,Qe=700,_n=170,Oi=600,Ti=[()=>K(1,["#60a5fa","#3b82f6","#2563eb","#38bdf8","#0ea5e9","#1d4ed8"]),()=>le(1,["#f472b6","#ec4899","#db2777","#f9a8d4"]),()=>je(1,["#34d399","#10b981","#059669","#6ee7b7","#a7f3d0","#047857","#4ade80","#065f46"]),()=>pe(1,["#fbbf24","#f59e0b","#d97706","#fde68a","#fcd34d"]),()=>ie(1,1,["#a78bfa","#8b5cf6","#7c3aed","#c4b5fd"])];function Ze(n){return Math.max(0,Math.min(1,n))}function Ai(n){let e=Ze(n);return e*e*(3-2*e)}function Si(n){return typeof n=="function"?n():n}function kn(n){let e=n-J*Math.floor(n/J);return e>Math.PI?e-J:e}function Ke(n,e){let t=(Math.imul(n+1,2654435769)^Math.imul(e+1,2246822507))>>>0;return t=Math.imul(t^t>>>16,73244475),t^=t>>>16,(t>>>0)/4294967296}var Se=class{constructor(e={}){this.handles=[];this.blends=new Array(E).fill(0);this.dockedAt=new Array(E).fill(1/0);this.tumbleX=[];this.tumbleY=[];this.fades=[];this.slots=[];this.aspect=16/9;this.enterAt=1/0;this.exitAt=1/0;this.allDockedAt=1/0;this.collapseAt=1/0;this.lastNow=0;this.popFading=!1;this.finished=!1;let t=e.meshes&&e.meshes.length>0?e.meshes:Ti;this.meshes=t.map(Si),this.size=e.size??.34,this.orbitPeriodMs=e.orbitPeriodMs??9e3,this.dockMs=e.dockMs??800,this.backend=e.backend,this.labelContent=e.label,this.fadeLabel=e.fadeLabel??!0;let r=this.size+(e.gap??.12);for(let i=0;i<E;i++){let o=Math.floor(i/$e),s=i%$e;this.slots.push({x:(s-2)*r,y:(2-o)*r,z:0}),this.tumbleX.push(J*Ke(i,2)-Math.PI),this.tumbleY.push(J*Ke(i,4)-Math.PI)}}mount(e){e.style.position||(e.style.position="relative");let t=new z({backend:this.backend,camera:{position:{x:0,y:0,z:Fn},fov:Vn}});for(let i=0;i<E;i++)this.fades.push({mode:"one-sided",opacity:1}),this.handles.push(t.add(this.meshes[i%this.meshes.length],{scale:0}));this.engine=t,t.mount(e).catch(i=>{e.textContent=i instanceof Error?i.message:String(i)});let r=()=>{e.clientWidth>0&&e.clientHeight>0&&(this.aspect=e.clientWidth/e.clientHeight)};r(),this.observer=new ResizeObserver(r),this.observer.observe(e),this.label=be(e,this.labelContent),this.fadeLabel&&this.label.setOpacity(0)}enter(e){this.enterAt===1/0&&(this.enterAt=e)}exit(e){this.exitAt===1/0&&(this.exitAt=e)}isFinished(){return this.finished}render(e,t){if(!this.engine||!this.label)return;if(this.enterAt===1/0){for(let i of this.handles)i.transform.scale=0;this.engine.render();return}let r=this.lastNow===0?16:Math.min(50,e-this.lastNow);this.lastNow=e,this.updateBlends(r,t.progress,e),this.exitAt!==1/0&&this.allDockedAt!==1/0&&this.collapseAt===1/0&&(this.collapseAt=Math.max(this.exitAt,this.allDockedAt)+vi),e>=this.collapseAt?this.renderCollapse(e):this.renderStory(e,r),this.label.setText(t.indeterminate?typeof this.labelContent=="string"?this.labelContent:"":`${Math.round(t.progress*100)}%`),this.fadeLabel&&this.label.setOpacity(he(e,this.enterAt,Oi,this.collapseAt,Qe)),this.collapseAt!==1/0&&e>=this.collapseAt+Qe+_n&&(this.finished=!0),this.engine.render()}destroy(){this.observer?.disconnect(),this.observer=void 0,this.label?.container.remove(),this.label=void 0,this.engine?.destroy(),this.engine=void 0,this.handles.length=0,this.fades.length=0}updateBlends(e,t,r){let i=this.exitAt!==1/0,o=i?E:Math.min(E,Math.floor(t*E+1e-9)),s=e/this.dockMs*(i?xi:1);for(let c=0;c<E;c++){let l=c<o?1:0,u=this.blends[c];l>u&&(c===0||this.blends[c-1]>=bi)?this.blends[c]=Math.min(1,u+s):l<u&&(c===E-1||this.blends[c+1]<=yi)&&(this.blends[c]=Math.max(0,u-s)),this.blends[c]>=1?this.dockedAt[c]===1/0&&(this.dockedAt[c]=r):this.dockedAt[c]=1/0}o===E&&this.blends.every(c=>c>=1)?this.allDockedAt===1/0&&(this.allDockedAt=r):i||(this.allDockedAt=1/0)}renderStory(e,t){let r=e-this.enterAt,i=Math.tan(Vn/2)*Fn,o=i*this.aspect,s=Math.max(.6,Math.min(o,i)-this.size*.55),a=(Math.max(o,i)*1.25+this.size*2)/s;for(let c=0;c<E;c++){let l=this.handles[c].transform,u=Ai(this.blends[c]),p=Ze((r-c*hi)/fi),m=1+(a-1)*(1-q(p)),d=Math.PI/2-c/E*J-r/this.orbitPeriodMs*J,h=Math.cos(d)*s*m,y=Math.sin(d)*s*m,f=this.slots[c];if(l.position.x=h+(f.x-h)*u,l.position.y=y+(f.y-y)*u,l.position.z=0,l.scale=this.size,this.blends[c]===0&&(this.tumbleX[c]=kn(this.tumbleX[c]+(4e-4+8e-4*Ke(c,1))*t),this.tumbleY[c]=kn(this.tumbleY[c]+(6e-4+.001*Ke(c,3))*t)),l.rotation.z=0,this.blends[c]>=1){let b=(r+c*Mi)%gi,x=b<jn&&e-b>=this.dockedAt[c];l.rotation.x=0,l.rotation.y=x?J*se(b/jn):0}else{let b=1-u;l.rotation.x=this.tumbleX[c]*b,l.rotation.y=this.tumbleY[c]*b}}}renderCollapse(e){this.captured||(this.captured=this.handles.map(i=>({...i.transform.position})));let t=Ze((e-this.collapseAt)/Qe),r=H(t);for(let i=0;i<E;i++){let o=this.handles[i].transform,s=this.captured[i];o.position.x=s.x*(1-r),o.position.y=s.y*(1-r),o.position.z=s.z*(1-r),o.scale=this.size*(1-.99*r)}if(t>=1){if(!this.popFading){this.popFading=!0;for(let o=0;o<E;o++)this.handles[o].transparency=this.fades[o]}let i=Ze((e-this.collapseAt-Qe)/_n);for(let o=0;o<E;o++)this.fades[o].opacity=1-i,this.handles[o].transform.scale=i>=1?0:this.size*.01*(1+1.6*Math.sin(Math.PI*i))}}};var C=class{constructor(e){this.elements=[];this.layers=e.map(t=>"animation"in t?t:{animation:t})}mount(e){e.style.position="relative";for(let[t,r]of this.layers.entries()){let i=document.createElement("div");i.style.cssText=`position:absolute;inset:0;z-index:${r.zIndex??t}`,e.appendChild(i),this.elements.push(i),r.animation.mount(i)}}enter(e){for(let t of this.layers)t.animation.enter(e)}exit(e){for(let t of this.layers)t.animation.exit(e)}render(e,t){for(let r of this.layers)r.animation.render(e,t)}isFinished(){return this.layers.every(e=>e.animation.isFinished())}destroy(){for(let e of this.layers)e.animation.destroy();for(let e of this.elements)e.remove();this.elements.length=0}};function W(n,e){return{type:"indeterminate",animation:n,loop:e.loop,periodMs:e.periodMs}}function ee(n,e){return{type:"progress",animation:n,progress:e.progress??.001,timeout:e.timeout,until:e.until}}function Dn(n={}){let e=n.particles??{},t=e.rate??60,r=new Ae({backend:n.backend,...n.orb}),i=new T({rate:t,lifeMs:1200,size:.12,speed:.05,colors:["#ffffff","#a5f3fc","#818cf8"],texture:e.texture??N(),emitter:r.satelliteEmitter(1e3/t),outroMs:r.outroEmitMs,seed:5,backend:n.backend,...e,label:n.label??e.label,fadeLabel:n.fadeLabel??e.fadeLabel});return ee(new C([r,i]),n)}function xe(n={}){let e=n.size??1,t=n.periodMs??3600;return{positionAt(r){let i=r/t*Math.PI*2;return{x:e*1.5*Math.sin(i),y:e*1*Math.sin(i)*Math.cos(i),z:e*1.05*Math.cos(i)}}}}function Bn(n={}){let e=n.object?.motion??xe({size:.66,periodMs:7200}),t=n.particles??{},r=new B({mesh:()=>le(1,["#f0f9ff","#7dd3fc","#818cf8","#e879f9"]),motion:e,size:.42,rotation:{spinX:.002,spinY:.003},backend:n.backend,...n.object,label:n.object?.label}),i=new C([new T({rate:44,lifeMs:2300,size:.25,speed:.08,colors:["#ffffff","#bae6fd","#818cf8"],texture:t.texture??N(),emitter:r.trailEmitter(),outroMs:r.outroDurationMs,seed:28,backend:n.backend,...t,label:n.label??t.label??"Polishing pixels",fadeLabel:n.fadeLabel??t.fadeLabel}),r]);return W(i,n)}function Je(n={}){let e=(n.size??2.4)/2,t=n.periodMs??4e3,r=n.tilt??.45,i=n.direction??1,o=Math.cos(r),s=Math.sin(r);return{positionAt(a){let c=i*a/t,l=(c-Math.floor(c))*4,u=Math.floor(l),p=l-u,m,d;return u===0?(m=-e+2*e*p,d=-e):u===1?(m=e,d=-e+2*e*p):u===2?(m=e-2*e*p,d=e):(m=-e,d=e-2*e*p),{x:m,y:d*o,z:d*s}}}}function Un(n={}){let e=n.object?.motion??Je({size:1.7,periodMs:6800,tilt:.5}),t=n.particles??{},r=new B({mesh:()=>K(1,["#bae6fd","#7dd3fc","#38bdf8","#0ea5e9","#a5f3fc","#e0f2fe"]),motion:e,size:.3,transparency:{mode:"two-sided",opacity:.55},tail:{count:4,gapMs:240},backend:n.backend,...n.object,label:n.object?.label}),i=new T({rate:30,lifeMs:1700,size:.13,speed:.07,colors:["#e0f2fe","#a5f3fc","#c4b5fd"],texture:t.texture??Z(),emitter:r.trailEmitter(),outroMs:r.outroDurationMs,seed:17,backend:n.backend,...t,label:n.label??t.label,fadeLabel:n.fadeLabel??t.fadeLabel});return ee(new C([i,r]),n)}function Gn(n={}){return ee(new Se({backend:n.backend,label:n.label,fadeLabel:n.fadeLabel,...n.assembly}),n)}function Nn(n={}){let e=n.particles??{};return W(new T({rate:70,lifeMs:2800,size:.38,speed:1.35,direction:{x:0,y:1,z:0},spread:.62,gravity:{x:0,y:-1.45,z:0},colors:["#fff","#000"],texture:e.texture??ke(),spin:0,alignToMotion:!0,seed:37,backend:n.backend,...e,label:n.label??e.label??"Loading...",fadeLabel:n.fadeLabel??e.fadeLabel}),n)}function Hn(n={}){let e=n.object?.motion??xe({size:.72,periodMs:6200}),t=n.particles??{},r=new B({mesh:_e,motion:e,size:.48,backend:n.backend,...n.object,label:n.object?.label}),i=new C([new T({rate:34,lifeMs:1900,size:.16,speed:.11,colors:["#fde047","#f472b6","#7dd3fc"],texture:t.texture??Z(),emitter:r.trailEmitter(),outroMs:r.outroDurationMs,seed:11,backend:n.backend,...t,label:n.label??t.label??"Flying in...",fadeLabel:n.fadeLabel??t.fadeLabel}),r]);return W(i,n)}function Pi(){let n=document.createElement("div");return n.innerHTML=`<style>
110
+ @keyframes spinner-prefab-pulse { 0%,100% { color:#fff; transform:scale(1); } 50% { color:#93c5fd; transform:scale(1.06); } }
111
+ </style><div style="animation:spinner-prefab-pulse 2.4s ease-in-out infinite;font-size:2rem">Loading the good stuff</div>`,n}function Wn(n={}){let e=n.particles??{};return W(new T({rate:48,lifeMs:4200,size:.3,speed:.34,colors:["#ffffff","#dbeafe","#93c5fd","#c4b5fd"],texture:e.texture??N(),seed:71,backend:n.backend,...e,label:n.label??e.label??Pi(),fadeLabel:n.fadeLabel??e.fadeLabel}),n)}function et(n={}){let e=n.radius??1.3,t=n.periodMs??3e3,r=n.tilt??.5,i=n.direction??1,o=Math.cos(r),s=Math.sin(r);return{positionAt(a){let c=i*a/t*Math.PI*2,l=e*Math.cos(c),u=e*Math.sin(c);return{x:l,y:u*o,z:u*s}}}}var Ei=({delta:n,position:e,velocity:t,durationMs:r})=>{let i=r*n*(1-.5*n),o=5.5*H(n);return{position:{x:e.x+(t?.x??0)*i,y:e.y+(t?.y??0)*i+o,z:e.z+(t?.z??0)*i}}};function Xn(n={}){let e=n.object?.motion??et({radius:.55,periodMs:7e3,tilt:.15}),t=n.particles??{},r=new B({mesh:()=>pe(1,["#e2e8f0","#f8fafc","#cbd5e1","#94a3b8","#e2e8f0"]),motion:e,size:.44,facing:"+y",outro:{transition:Ei,durationMs:1300},backend:n.backend,...n.object,label:n.object?.label}),i=new T({rate:46,lifeMs:1100,size:.18,speed:.5,direction:{x:0,y:-1,z:0},spread:.3,gravity:{x:0,y:-.6,z:0},colors:["#fde047","#fb923c","#ef4444","#fef3c7"],texture:t.texture??N(),emitter:r.trailEmitter(),outroMs:r.outroDurationMs,seed:9,backend:n.backend,...t,label:n.label??t.label,fadeLabel:n.fadeLabel??t.fadeLabel});return ee(new C([i,r]),n)}function Li(n){let e=n>>>0;return()=>{e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function Xt(n,e,t){let r=[0,1,2].map(()=>({freq:.5+n()*1.4,phase:n()*Math.PI*2,weight:.5+n()})),i=r.reduce((o,s)=>o+s.weight,0);return o=>{let s=0;for(let a of r)s+=a.weight*Math.sin(e*a.freq*o+a.phase);return s/i*t}}function tt(n={}){let e=n.bounds?.x??1.4,t=n.bounds?.y??1,r=n.bounds?.z??.6,i=n.periodMs??9e3,o=n.seed??Math.random()*1e9|0,s=Li(o),a=2*Math.PI/i,c=Xt(s,a,e),l=Xt(s,a,t),u=Xt(s,a,r);return{positionAt(p){return{x:c(p),y:l(p),z:u(p)}}}}function Yn(n={}){let e=n.particles??{},t=e.emitter??tt({bounds:{x:1.1,y:.72,z:.35},periodMs:7200,seed:19});return W(new T({rate:38,lifeMs:2600,size:.15,speed:.17,colors:["#fef08a","#f9a8d4","#a5f3fc"],texture:e.texture??Z(),emitter:t,seed:91,backend:n.backend,...e,label:n.label??e.label??"Loading...",fadeLabel:n.fadeLabel??e.fadeLabel}),n)}Ut();Bt();var Ii=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#ef4444"];function zi(n){let e=Number.parseFloat(n);if(Number.isFinite(e))return Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,"0")}function Ci(n){let e=new Map,t;for(let r of n.split(`
112
+ `)){let i=r.trim();if(i===""||i.startsWith("#"))continue;let o=i.split(/\s+/);if(o[0]==="newmtl")t=o.slice(1).join(" ");else if(o[0]==="Kd"&&t){let s=o.slice(1,4).map(zi);s.length===3&&s.every(a=>a!==void 0)&&e.set(t,`#${s.join("")}`)}}return e}function Ri(n,e){let t=parseInt(n,10);return t<0?e+t:t-1}function wi(n,e={}){let t=e.colors??Ii,r=e.useMtlColors&&e.mtl?Ci(e.mtl):void 0,i=[],o=[],s;for(let a of n.split(`
113
+ `)){let c=a.trim();if(c===""||c.startsWith("#"))continue;let l=c.split(/\s+/),u=l[0];if(u==="v")i.push({x:parseFloat(l[1]),y:parseFloat(l[2]),z:parseFloat(l[3])});else if(u==="usemtl")s=l.slice(1).join(" ");else if(u==="f"){let p=[];for(let m=1;m<l.length;m++){let d=l[m].split("/")[0];p.push(Ri(d,i.length))}if(p.length>=3){let d=(s?r?.get(s):void 0)??(r?t[0]??"#888888":t[o.length%t.length]);o.push({indices:p,color:d})}}}return{vertices:i,faces:o}}var Yt=class{constructor(e={}){this.type=e.type??"linear",this.overextend=e.overextend??!1}value(e,t=this.type,r=this.overextend){return Ue(t,e,r)}};return $n(Fi);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3d-spinner",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "A lightweight, zero-dependency 3D spinner, loader, and progress indicator for JavaScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.cjs",
@@ -25,6 +25,31 @@
25
25
  "import": "./dist/animations/object-motion.js",
26
26
  "require": "./dist/cjs/animations/object-motion.cjs"
27
27
  },
28
+ "./animations/particles": {
29
+ "types": "./dist/animations/particles.d.ts",
30
+ "import": "./dist/animations/particles.js",
31
+ "require": "./dist/cjs/animations/particles.cjs"
32
+ },
33
+ "./animations/charged-orb": {
34
+ "types": "./dist/animations/charged-orb.d.ts",
35
+ "import": "./dist/animations/charged-orb.js",
36
+ "require": "./dist/cjs/animations/charged-orb.cjs"
37
+ },
38
+ "./animations/grid-assembly": {
39
+ "types": "./dist/animations/grid-assembly.d.ts",
40
+ "import": "./dist/animations/grid-assembly.js",
41
+ "require": "./dist/cjs/animations/grid-assembly.cjs"
42
+ },
43
+ "./composite-animation": {
44
+ "types": "./dist/composite-animation.d.ts",
45
+ "import": "./dist/composite-animation.js",
46
+ "require": "./dist/cjs/composite-animation.cjs"
47
+ },
48
+ "./prefabs": {
49
+ "types": "./dist/prefabs/prefabs.d.ts",
50
+ "import": "./dist/prefabs/prefabs.js",
51
+ "require": "./dist/cjs/prefabs/prefabs.cjs"
52
+ },
28
53
  "./motion": {
29
54
  "types": "./dist/motion/motion.d.ts",
30
55
  "import": "./dist/motion/motion.js",
@@ -40,6 +65,21 @@
40
65
  "import": "./dist/engines/little-3d-engine/little-3d-engine.js",
41
66
  "require": "./dist/cjs/engines/little-3d-engine/little-3d-engine.cjs"
42
67
  },
68
+ "./engines/little-3d-engine/renderers/webgl-textured": {
69
+ "types": "./dist/engines/little-3d-engine/renderers/webgl-textured.d.ts",
70
+ "import": "./dist/engines/little-3d-engine/renderers/webgl-textured.js",
71
+ "require": "./dist/cjs/engines/little-3d-engine/renderers/webgl-textured.cjs"
72
+ },
73
+ "./engines/little-3d-engine/renderers/canvas2d-textured": {
74
+ "types": "./dist/engines/little-3d-engine/renderers/canvas2d-textured.d.ts",
75
+ "import": "./dist/engines/little-3d-engine/renderers/canvas2d-textured.js",
76
+ "require": "./dist/cjs/engines/little-3d-engine/renderers/canvas2d-textured.cjs"
77
+ },
78
+ "./engines/little-3d-engine/renderers/webgpu-textured": {
79
+ "types": "./dist/engines/little-3d-engine/renderers/webgpu-textured.d.ts",
80
+ "import": "./dist/engines/little-3d-engine/renderers/webgpu-textured.js",
81
+ "require": "./dist/cjs/engines/little-3d-engine/renderers/webgpu-textured.cjs"
82
+ },
43
83
  "./engines/little-3d-engine/loaders/obj": {
44
84
  "types": "./dist/engines/little-3d-engine/loaders/obj.d.ts",
45
85
  "import": "./dist/engines/little-3d-engine/loaders/obj.js",
@@ -66,6 +106,7 @@
66
106
  "prepublishOnly": "npm run build"
67
107
  },
68
108
  "keywords": [
109
+ "3d-spinner",
69
110
  "spinner",
70
111
  "loader",
71
112
  "loading",