glyphcss 0.0.2 → 0.0.4

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.
@@ -1,27 +1,16 @@
1
1
  import { Vec3, Polygon, RenderMode } from '@glyphcss/core';
2
2
 
3
- /**
4
- * createGlyphPerspectiveCamera / createGlyphOrthographicCamera — vanilla camera
5
- * factories for glyphcss.
6
- *
7
- * These mirror the asciss camera factories and provide a `GlyphCamera`
8
- * handle with a `project()` method that maps world-space vertices to
9
- * [col, row, depth] in character-cell grid space.
10
- *
11
- * Public names use the Glyph prefix per glyphcss naming convention.
12
- * The internal camera algorithms are byte-identical to asciss's createCamera.ts.
13
- *
14
- * `createGlyphCamera` is the ergonomic default alias — it creates an
15
- * orthographic camera, matching the voxel/iso identity of glyphcss.
16
- */
17
-
18
3
  interface GlyphCamera {
19
4
  readonly kind: "perspective" | "orthographic";
20
5
  rotX: number;
21
6
  rotY: number;
22
- /** Distance from origin along the view axis. Only meaningful for perspective cameras. */
7
+ /** Distance from target along the view axis. For perspective cameras: world units. Default 0. */
23
8
  distance: number;
24
- /** Camera zoom — mesh size in the viewport (fraction of `min(cols, rows)`). */
9
+ /**
10
+ * Camera zoom — CSS scale multiplier (same semantic as voxcss).
11
+ * `zoom = 1` → one world unit = BASE_TILE (50) virtual pixels.
12
+ * Larger values zoom in; smaller zoom out. NOT a fraction of viewport.
13
+ */
25
14
  zoom: number;
26
15
  /** Extra horizontal stretch on top of `cellAspect`. */
27
16
  stretch: number;
@@ -33,7 +22,7 @@ interface GlyphCamera {
33
22
  /**
34
23
  * Eye-at-origin projection mode. When true, the perspective camera uses a
35
24
  * first-person formulation: `target` is treated as the eye position and
36
- * vertices behind the eye (`r[2] >= 0`) are NaN-culled. Toggled by
25
+ * vertices behind the eye (`rz2 >= 0`) are NaN-culled. Toggled by
37
26
  * `createGlyphFirstPersonControls` at attach / detach time.
38
27
  */
39
28
  eyeMode: boolean;
@@ -41,16 +30,25 @@ interface GlyphCamera {
41
30
  project(v: Vec3, cols: number, rows: number, cellAspect: number): [number, number, number];
42
31
  }
43
32
  interface GlyphPerspectiveCameraOptions {
44
- /** Y rotation (radians). The "spin" axis. Default 0. */
45
- rotY?: number;
46
- /** X rotation (radians). The "tilt" axis. Default 0. */
33
+ /**
34
+ * X rotation in **degrees** (tilt). Default 65.
35
+ * Matches voxcss / three.js convention.
36
+ */
47
37
  rotX?: number;
48
38
  /**
49
- * Perspective distance. Larger = flatter (less foreshortening); smaller =
50
- * more dramatic. Default 3.
39
+ * Y rotation in **degrees** (spin). Default 45.
40
+ * Matches voxcss / three.js convention.
41
+ */
42
+ rotY?: number;
43
+ /**
44
+ * Perspective distance in world units. Larger = flatter (less foreshortening);
45
+ * smaller = more dramatic. Default 6.
51
46
  */
52
47
  distance?: number;
53
- /** Camera zoom — mesh size in the viewport (fraction of `min(cols, rows)`). Default 0.4. */
48
+ /**
49
+ * Camera zoom — CSS scale multiplier. Default 0.3.
50
+ * `zoom = 1` → BASE_TILE (50) virtual px per world unit.
51
+ */
54
52
  zoom?: number;
55
53
  /**
56
54
  * Extra horizontal scale on top of `cellAspect`. Use to counteract
@@ -61,9 +59,16 @@ interface GlyphPerspectiveCameraOptions {
61
59
  center?: [number, number];
62
60
  }
63
61
  interface GlyphOrthographicCameraOptions {
64
- rotY?: number;
62
+ /** X rotation in **degrees** (tilt). Default 65. */
65
63
  rotX?: number;
64
+ /** Y rotation in **degrees** (spin). Default 45. */
65
+ rotY?: number;
66
+ /**
67
+ * Camera zoom — CSS scale multiplier. Default 0.3.
68
+ * `zoom = 1` → BASE_TILE (50) virtual px per world unit.
69
+ */
66
70
  zoom?: number;
71
+ /** Center of projection in normalized grid coords. Default `[0.5, 0.5]`. */
67
72
  center?: [number, number];
68
73
  }
69
74
  /** Handle alias — same surface as `GlyphCamera`, names matched to glyphcss. */
@@ -92,12 +97,34 @@ interface GlyphAmbientLight {
92
97
  /** Hex color (#rrggbb). Tints the unlit-side fill. Default white. */
93
98
  color?: string;
94
99
  }
100
+ /** Shadow configuration for the ASCII rasterizer (shadow-map technique). */
101
+ interface GlyphShadowOptions {
102
+ /** Shadow tint color. Default "#000000". */
103
+ color?: string;
104
+ /** Shadow darkness 0..1 — how much the shadowed color darkens toward `color`. Default 0.25. */
105
+ opacity?: number;
106
+ /**
107
+ * Depth bias added to the interpolated surface depth before comparing against
108
+ * the shadow map. Eliminates self-shadow acne on flat lit surfaces. Default 0.05.
109
+ */
110
+ lift?: number;
111
+ /**
112
+ * Maximum world-space extent for the shadow-map ortho projection.
113
+ * Kept for API parity with polycss. Used as the half-extent of the light-space
114
+ * projection volume when larger than the computed scene bounds. Default 2000.
115
+ */
116
+ maxExtend?: number;
117
+ }
95
118
  interface GlyphMeshTransform {
96
119
  /** String identifier for the mesh — surfaced as `GlyphMeshHandle.name`. */
97
120
  id?: string;
98
121
  position?: Vec3;
99
122
  scale?: number | Vec3;
100
123
  rotation?: Vec3;
124
+ /** This mesh casts shadows onto receiveShadow surfaces. Default false. */
125
+ castShadow?: boolean;
126
+ /** This mesh receives (displays) shadows from castShadow meshes. Default false. */
127
+ receiveShadow?: boolean;
101
128
  }
102
129
 
103
130
  /**
@@ -166,6 +193,8 @@ interface GlyphSceneOptions {
166
193
  * (default 80×24) is the predictable choice for tests and SSR.
167
194
  */
168
195
  autoSize?: boolean;
196
+ /** Shadow-map configuration. `undefined` (default) = no shadows. */
197
+ shadow?: GlyphShadowOptions;
169
198
  }
170
199
  interface GlyphHotspotOptions {
171
200
  id: string;
@@ -310,4 +339,4 @@ declare class GlyphMapControlsElement extends ELEMENT_BASE {
310
339
  private _attach;
311
340
  }
312
341
 
313
- export { type GlyphSceneHandle as G, type GlyphCamera as a, type GlyphDirectionalLight as b, type GlyphAmbientLight as c, GlyphHotspotElement as d, type GlyphHotspotHandle as e, type GlyphHotspotOptions as f, GlyphMapControlsElement as g, GlyphMeshElement as h, type GlyphMeshHandle as i, type GlyphMeshTransform as j, GlyphOrbitControlsElement as k, GlyphOrthographicCameraElement as l, type GlyphOrthographicCameraHandle as m, type GlyphOrthographicCameraOptions as n, GlyphPerspectiveCameraElement as o, type GlyphPerspectiveCameraHandle as p, type GlyphPerspectiveCameraOptions as q, GlyphSceneElement as r, type GlyphSceneOptions as s, createGlyphCamera as t, createGlyphOrthographicCamera as u, createGlyphPerspectiveCamera as v, createGlyphScene as w };
342
+ export { type GlyphSceneHandle as G, type GlyphCamera as a, type GlyphDirectionalLight as b, type GlyphAmbientLight as c, type GlyphShadowOptions as d, GlyphHotspotElement as e, type GlyphHotspotHandle as f, type GlyphHotspotOptions as g, GlyphMapControlsElement as h, GlyphMeshElement as i, type GlyphMeshHandle as j, type GlyphMeshTransform as k, GlyphOrbitControlsElement as l, GlyphOrthographicCameraElement as m, type GlyphOrthographicCameraHandle as n, type GlyphOrthographicCameraOptions as o, GlyphPerspectiveCameraElement as p, type GlyphPerspectiveCameraHandle as q, type GlyphPerspectiveCameraOptions as r, GlyphSceneElement as s, type GlyphSceneOptions as t, createGlyphCamera as u, createGlyphOrthographicCamera as v, createGlyphPerspectiveCamera as w, createGlyphScene as x };
@@ -1,27 +1,16 @@
1
1
  import { Vec3, Polygon, RenderMode } from '@glyphcss/core';
2
2
 
3
- /**
4
- * createGlyphPerspectiveCamera / createGlyphOrthographicCamera — vanilla camera
5
- * factories for glyphcss.
6
- *
7
- * These mirror the asciss camera factories and provide a `GlyphCamera`
8
- * handle with a `project()` method that maps world-space vertices to
9
- * [col, row, depth] in character-cell grid space.
10
- *
11
- * Public names use the Glyph prefix per glyphcss naming convention.
12
- * The internal camera algorithms are byte-identical to asciss's createCamera.ts.
13
- *
14
- * `createGlyphCamera` is the ergonomic default alias — it creates an
15
- * orthographic camera, matching the voxel/iso identity of glyphcss.
16
- */
17
-
18
3
  interface GlyphCamera {
19
4
  readonly kind: "perspective" | "orthographic";
20
5
  rotX: number;
21
6
  rotY: number;
22
- /** Distance from origin along the view axis. Only meaningful for perspective cameras. */
7
+ /** Distance from target along the view axis. For perspective cameras: world units. Default 0. */
23
8
  distance: number;
24
- /** Camera zoom — mesh size in the viewport (fraction of `min(cols, rows)`). */
9
+ /**
10
+ * Camera zoom — CSS scale multiplier (same semantic as voxcss).
11
+ * `zoom = 1` → one world unit = BASE_TILE (50) virtual pixels.
12
+ * Larger values zoom in; smaller zoom out. NOT a fraction of viewport.
13
+ */
25
14
  zoom: number;
26
15
  /** Extra horizontal stretch on top of `cellAspect`. */
27
16
  stretch: number;
@@ -33,7 +22,7 @@ interface GlyphCamera {
33
22
  /**
34
23
  * Eye-at-origin projection mode. When true, the perspective camera uses a
35
24
  * first-person formulation: `target` is treated as the eye position and
36
- * vertices behind the eye (`r[2] >= 0`) are NaN-culled. Toggled by
25
+ * vertices behind the eye (`rz2 >= 0`) are NaN-culled. Toggled by
37
26
  * `createGlyphFirstPersonControls` at attach / detach time.
38
27
  */
39
28
  eyeMode: boolean;
@@ -41,16 +30,25 @@ interface GlyphCamera {
41
30
  project(v: Vec3, cols: number, rows: number, cellAspect: number): [number, number, number];
42
31
  }
43
32
  interface GlyphPerspectiveCameraOptions {
44
- /** Y rotation (radians). The "spin" axis. Default 0. */
45
- rotY?: number;
46
- /** X rotation (radians). The "tilt" axis. Default 0. */
33
+ /**
34
+ * X rotation in **degrees** (tilt). Default 65.
35
+ * Matches voxcss / three.js convention.
36
+ */
47
37
  rotX?: number;
48
38
  /**
49
- * Perspective distance. Larger = flatter (less foreshortening); smaller =
50
- * more dramatic. Default 3.
39
+ * Y rotation in **degrees** (spin). Default 45.
40
+ * Matches voxcss / three.js convention.
41
+ */
42
+ rotY?: number;
43
+ /**
44
+ * Perspective distance in world units. Larger = flatter (less foreshortening);
45
+ * smaller = more dramatic. Default 6.
51
46
  */
52
47
  distance?: number;
53
- /** Camera zoom — mesh size in the viewport (fraction of `min(cols, rows)`). Default 0.4. */
48
+ /**
49
+ * Camera zoom — CSS scale multiplier. Default 0.3.
50
+ * `zoom = 1` → BASE_TILE (50) virtual px per world unit.
51
+ */
54
52
  zoom?: number;
55
53
  /**
56
54
  * Extra horizontal scale on top of `cellAspect`. Use to counteract
@@ -61,9 +59,16 @@ interface GlyphPerspectiveCameraOptions {
61
59
  center?: [number, number];
62
60
  }
63
61
  interface GlyphOrthographicCameraOptions {
64
- rotY?: number;
62
+ /** X rotation in **degrees** (tilt). Default 65. */
65
63
  rotX?: number;
64
+ /** Y rotation in **degrees** (spin). Default 45. */
65
+ rotY?: number;
66
+ /**
67
+ * Camera zoom — CSS scale multiplier. Default 0.3.
68
+ * `zoom = 1` → BASE_TILE (50) virtual px per world unit.
69
+ */
66
70
  zoom?: number;
71
+ /** Center of projection in normalized grid coords. Default `[0.5, 0.5]`. */
67
72
  center?: [number, number];
68
73
  }
69
74
  /** Handle alias — same surface as `GlyphCamera`, names matched to glyphcss. */
@@ -92,12 +97,34 @@ interface GlyphAmbientLight {
92
97
  /** Hex color (#rrggbb). Tints the unlit-side fill. Default white. */
93
98
  color?: string;
94
99
  }
100
+ /** Shadow configuration for the ASCII rasterizer (shadow-map technique). */
101
+ interface GlyphShadowOptions {
102
+ /** Shadow tint color. Default "#000000". */
103
+ color?: string;
104
+ /** Shadow darkness 0..1 — how much the shadowed color darkens toward `color`. Default 0.25. */
105
+ opacity?: number;
106
+ /**
107
+ * Depth bias added to the interpolated surface depth before comparing against
108
+ * the shadow map. Eliminates self-shadow acne on flat lit surfaces. Default 0.05.
109
+ */
110
+ lift?: number;
111
+ /**
112
+ * Maximum world-space extent for the shadow-map ortho projection.
113
+ * Kept for API parity with polycss. Used as the half-extent of the light-space
114
+ * projection volume when larger than the computed scene bounds. Default 2000.
115
+ */
116
+ maxExtend?: number;
117
+ }
95
118
  interface GlyphMeshTransform {
96
119
  /** String identifier for the mesh — surfaced as `GlyphMeshHandle.name`. */
97
120
  id?: string;
98
121
  position?: Vec3;
99
122
  scale?: number | Vec3;
100
123
  rotation?: Vec3;
124
+ /** This mesh casts shadows onto receiveShadow surfaces. Default false. */
125
+ castShadow?: boolean;
126
+ /** This mesh receives (displays) shadows from castShadow meshes. Default false. */
127
+ receiveShadow?: boolean;
101
128
  }
102
129
 
103
130
  /**
@@ -166,6 +193,8 @@ interface GlyphSceneOptions {
166
193
  * (default 80×24) is the predictable choice for tests and SSR.
167
194
  */
168
195
  autoSize?: boolean;
196
+ /** Shadow-map configuration. `undefined` (default) = no shadows. */
197
+ shadow?: GlyphShadowOptions;
169
198
  }
170
199
  interface GlyphHotspotOptions {
171
200
  id: string;
@@ -310,4 +339,4 @@ declare class GlyphMapControlsElement extends ELEMENT_BASE {
310
339
  private _attach;
311
340
  }
312
341
 
313
- export { type GlyphSceneHandle as G, type GlyphCamera as a, type GlyphDirectionalLight as b, type GlyphAmbientLight as c, GlyphHotspotElement as d, type GlyphHotspotHandle as e, type GlyphHotspotOptions as f, GlyphMapControlsElement as g, GlyphMeshElement as h, type GlyphMeshHandle as i, type GlyphMeshTransform as j, GlyphOrbitControlsElement as k, GlyphOrthographicCameraElement as l, type GlyphOrthographicCameraHandle as m, type GlyphOrthographicCameraOptions as n, GlyphPerspectiveCameraElement as o, type GlyphPerspectiveCameraHandle as p, type GlyphPerspectiveCameraOptions as q, GlyphSceneElement as r, type GlyphSceneOptions as s, createGlyphCamera as t, createGlyphOrthographicCamera as u, createGlyphPerspectiveCamera as v, createGlyphScene as w };
342
+ export { type GlyphSceneHandle as G, type GlyphCamera as a, type GlyphDirectionalLight as b, type GlyphAmbientLight as c, type GlyphShadowOptions as d, GlyphHotspotElement as e, type GlyphHotspotHandle as f, type GlyphHotspotOptions as g, GlyphMapControlsElement as h, GlyphMeshElement as i, type GlyphMeshHandle as j, type GlyphMeshTransform as k, GlyphOrbitControlsElement as l, GlyphOrthographicCameraElement as m, type GlyphOrthographicCameraHandle as n, type GlyphOrthographicCameraOptions as o, GlyphPerspectiveCameraElement as p, type GlyphPerspectiveCameraHandle as q, type GlyphPerspectiveCameraOptions as r, GlyphSceneElement as s, type GlyphSceneOptions as t, createGlyphCamera as u, createGlyphOrthographicCamera as v, createGlyphPerspectiveCamera as w, createGlyphScene as x };
package/dist/elements.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var ve=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var ot=(n,t)=>{for(var e in t)ve(n,e,{get:t[e],enumerable:!0})},it=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of nt(t))!rt.call(n,r)&&r!==e&&ve(n,r,{get:()=>t[r],enumerable:!(o=tt(t,r))||o.enumerable});return n};var st=n=>it(ve({},"__esModule",{value:!0}),n);var Xt={};ot(Xt,{GlyphHotspotElement:()=>te,GlyphMapControlsElement:()=>oe,GlyphMeshElement:()=>ee,GlyphOrbitControlsElement:()=>re,GlyphOrthographicCameraElement:()=>j,GlyphPerspectiveCameraElement:()=>ne,GlyphSceneElement:()=>Q});module.exports=st(Xt);function He(n,t,e){let o=Math.cos(t),r=Math.sin(t),a=o*n[1]-r*n[0],i=r*n[1]+o*n[0],s=n[2],c=Math.cos(e),l=Math.sin(e),p=c*i-l*s,h=l*i+c*s;return[a,p,h]}function le(n={}){let t={rotX:n.rotX??0,rotY:n.rotY??0,distance:n.distance??3,zoom:n.zoom??.4,stretch:n.stretch??1,target:[0,0,0],eyeMode:!1,focal:5},[e,o]=n.center??[.5,.5];return{kind:"perspective",get rotX(){return t.rotX},set rotX(r){t.rotX=r},get rotY(){return t.rotY},set rotY(r){t.rotY=r},get distance(){return t.distance},set distance(r){t.distance=r},get zoom(){return t.zoom},set zoom(r){t.zoom=r},get stretch(){return t.stretch},set stretch(r){t.stretch=r},get target(){return t.target},set target(r){t.target=r},get eyeMode(){return t.eyeMode},set eyeMode(r){t.eyeMode=r},project(r,a,i,s){let c=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],l=He(c,t.rotY,t.rotX);if(t.eyeMode){if(l[2]>=-.001)return[NaN,NaN,l[2]];let C=t.focal/-l[2],d=Math.min(a,i)*t.zoom*C,b=a*e+l[0]*d*s*t.stretch,u=i*o+l[1]*d;return[b,u,l[2]]}let p=30,h=1.5,f=l[2]*p,y=.001,g=1-f/t.distance;if(g<y)return[NaN,NaN,l[2]];let L=1/g,E=Math.min(a,i)*t.zoom*h*L,w=a*e+l[0]*E*s*t.stretch,x=i*o+l[1]*E;return[w,x,l[2]]}}}function Pe(n={}){let t={rotX:n.rotX??0,rotY:n.rotY??0,distance:0,zoom:n.zoom??.4,stretch:1,target:[0,0,0]},[e,o]=n.center??[.5,.5];return{kind:"orthographic",get rotX(){return t.rotX},set rotX(r){t.rotX=r},get rotY(){return t.rotY},set rotY(r){t.rotY=r},get distance(){return t.distance},set distance(r){t.distance=r},get zoom(){return t.zoom},set zoom(r){t.zoom=r},get stretch(){return t.stretch},set stretch(r){t.stretch=r},get target(){return t.target},set target(r){t.target=r},get eyeMode(){return!1},set eyeMode(r){},project(r,a,i,s){let c=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],l=He(c,t.rotY,t.rotX),h=Math.min(a,i)*t.zoom*1.5,f=a*e+l[0]*h*s*t.stretch,y=i*o+l[1]*h;return[f,y,l[2]]}}}var lt={direction:[.5,.7,.5],intensity:1},at={intensity:.4};function ct(n){let t=new Set,e=[];for(let o of n){let r=o.vertices;if(!(r.length<2))for(let a=0;a<r.length;a++){let i=r[a],s=r[(a+1)%r.length],c=`${i[0]},${i[1]},${i[2]}`,l=`${s[0]},${s[1]},${s[2]}`,p=c<l?`${c}|${l}`:`${l}|${c}`;if(t.has(p))continue;t.add(p);let h={from:i,to:s,weight:2};o.color&&(h.color=o.color),e.push(h)}}return e}function Oe(n){let t=n.polygons??[],e=n.mode??(t.length?"solid":"wireframe"),o=n.wireframe??(e==="wireframe"?ct(t):[]);return{camera:n.camera,grid:n.grid,polygons:t,wireframe:o,mode:e,directionalLight:n.directionalLight??lt,ambientLight:n.ambientLight??at,glyphPalette:n.glyphPalette??"default",useColors:n.useColors??!0,smoothShading:n.smoothShading??!1,creaseAngle:n.creaseAngle??60}}var Bt=" .:-=+*#%@".split(""),$t=" .:-=+*#%@".split(""),Ee={default:{thin:"\xB7\u22C5\u2219\u02D9\xB7\u22C5\u2219".split(""),normal:"\u254B\u256C\u253C\u2573\u25C6\u25C7\u25CA\u25B2\u25B3\u25BC\u25BD\u25C8\u2B21\u2B22\u2234\u2235\u22A5\u2295\u2297\u2299\u229A\u229B".split(""),core:"\u2726\u2727\u2729\u25C9\u2299\u25CE".split(""),solid:" .:-=+*#%@".split("")},ascii:{thin:".'".split(""),normal:"+*x".split(""),core:"#@".split(""),solid:" .,:;!+=*xX#@".split("")},dots:{thin:"\xB7\u22C5".split(""),normal:"\u2022\u25CF".split(""),core:"\u25C9\u25CE".split(""),solid:" \xB7\u22C5\u2218\u2022\u25CF\u25C9\u25CE\u2B24".split("")},lines:{thin:"\u2500\u2502".split(""),normal:"\u2550\u2551".split(""),core:"\u2588".split(""),solid:" \u2500\u2550\u256C\u2551\u2588\u2593\u2592\u2591".split("")},blocks:{thin:"\u2591\u2581".split(""),normal:"\u2592\u2593\u258C\u2590\u2580\u2584".split(""),core:"\u2588".split(""),solid:" \u2591\u2592\u2593\u258C\u2590\u2588\u2580\u2584\u25A0".split("")},stars:{thin:"\xB7\u22C6".split(""),normal:"\u2726\u2727\u2729\u272A".split(""),core:"\u272B\u272C\u272D\u2605".split(""),solid:" \xB7\u22C6\u2217\u2726\u2727\u2729\u272A\u272B\u2605".split("")},arrows:{thin:"\xB7\u2219".split(""),normal:"\u2190\u2191\u2192\u2193".split(""),core:"\u2196\u2197\u2198\u2199\u2921\u2922".split(""),solid:" \xB7\u2219\u2191\u2197\u2192\u2198\u2193\u2199\u2190\u2196".split("")},braille:{thin:"\u2801\u2802\u2804\u2808".split(""),normal:"\u2803\u2805\u2806\u2809\u280A\u280B\u280C\u280D\u280E\u280F".split(""),core:"\u283F\u28FF".split(""),solid:" \u2801\u2803\u2807\u2827\u2837\u283F\u287F\u28FF".split("")},runes:{thin:".\xB7".split(""),normal:"\u16A0\u16A1\u16A2\u16A3\u16A4\u16A6\u16A8\u16B1\u16B2\u16B3\u16B7\u16B9\u16C3\u16C7\u16C9".split(""),core:"\u16DE\u16DF\u16E1\u16E2\u16E3".split(""),solid:" \xB7\u16A0\u16A3\u16A4\u16A8\u16B1\u16B7\u16DE\u16E2".split("")},math:{thin:"\u2219\u2218".split(""),normal:"\u2211\u220F\u222B\u221A\u221E\u2248\u2260\u2264\u2265\u2282\u2283\u2286\u2287".split(""),core:"\u222E\u222F\u2230\u2202".split(""),solid:" \u2219\u2218\u2211\u222B\u221A\u221E\u2248\u2295\u2297".split("")},binary:{thin:"\xB7.".split(""),normal:"01".split(""),core:"\u2588".split(""),solid:" .:01\u2588\u2588".split("")},hex:{thin:"\xB7\u2219".split(""),normal:"0123456789ABCDEF".split(""),core:"FFAA".split(""),solid:" 0123456789AF".split("")}},Wt=Ee.default;function Me(n){return Ee[n]??Ee.default}function Re(n){let{camera:t,grid:e,wireframe:o,mode:r}=n,{cols:a,rows:i,cellAspect:s}=e;if(r==="solid")return ut(n,a,i,s);let c=Me(n.glyphPalette),l=new Uint8Array(a*i),p=n.useColors?new Array(a*i).fill(null):null;for(let h of o){let f=t.project(h.from,a,i,s),y=t.project(h.to,a,i,s);f[0]!==f[0]||y[0]!==y[0]||ft(l,p,f[0]|0,f[1]|0,y[0]|0,y[1]|0,h.weight??2,h.color??null,a,i)}return yt(l,p,a,i,c)}function ut(n,t,e,o){let{camera:r,polygons:a,directionalLight:i,ambientLight:s,smoothShading:c,creaseAngle:l}=n,p=Me(n.glyphPalette).solid,h=p.length-1,f=new Array(t*e).fill(" "),y=n.useColors,g=y?new Array(t*e).fill(null):null,L=new Float64Array(t*e).fill(-1/0),E=i.direction,w=Math.hypot(E[0],E[1],E[2])||1,x=E[0]/w,M=E[1]/w,C=E[2]/w,d=i.intensity??1,b=s.intensity??.4,u=Ae(i.color??"#ffffff"),v=Ae(s.color??"#ffffff"),A=c&&l>0?pt(a,l):null;for(let G=0;G<a.length;G++){let m=a[G],_=m.vertices;if(!(_.length<3))for(let S=1;S<_.length-1;S++){let z=S,I=S+1,H=_[0],P=_[z],N=_[I],O=r.project(H,t,e,o),R=r.project(P,t,e,o),Y=r.project(N,t,e,o);if(O[0]!==O[0]||R[0]!==R[0]||Y[0]!==Y[0])continue;let X=P[0]-H[0],B=P[1]-H[1],ae=P[2]-H[2],U=N[0]-H[0],F=N[1]-H[1],ie=N[2]-H[2],se=B*ie-ae*F,q=ae*U-X*ie,we=X*F-B*U,ce=Math.hypot(se,q,we)||1,Be=se/ce,$e=q/ce,We=we/ce,ue,de,he,pe,me,fe,ye,ge,be;if(A){let Z=A[G],D=Z[0],V=Z[z],K=Z[I];ue=D[0],de=D[1],he=D[2],pe=V[0],me=V[1],fe=V[2],ye=K[0],ge=K[1],be=K[2]}else ue=pe=ye=Be,de=me=ge=$e,he=fe=be=We;let je=ue*x+de*M+he*C,Ue=pe*x+me*M+fe*C,qe=ye*x+ge*M+be*C,_e=Math.min(1,b+Math.max(0,je)*d),Se=Math.min(1,b+Math.max(0,Ue)*d),ze=Math.min(1,b+Math.max(0,qe)*d),Te=null;if(y){let Z=(_e+Se+ze)/3,D=Math.max(0,Z-b),V=m.color?Ae(m.color):[255,255,255],K=b*v[0]/255+D*u[0]/255,Ze=b*v[1]/255+D*u[1]/255,Ke=b*v[2]/255+D*u[2]/255,Je=Math.min(255,V[0]*K),Qe=Math.min(255,V[1]*Ze),et=Math.min(255,V[2]*Ke);Te=`#${Ce(Je)}${Ce(Qe)}${Ce(et)}`}ht(O[0],O[1],O[2],_e,R[0],R[1],R[2],Se,Y[0],Y[1],Y[2],ze,p,h,Te,f,g,L,t,e)}}return mt(f,g,t,e)}var dt=new Float64Array([(0+.5)/16,(8+.5)/16,(2+.5)/16,(10+.5)/16,(12+.5)/16,(4+.5)/16,(14+.5)/16,(6+.5)/16,(3+.5)/16,(11+.5)/16,(1+.5)/16,(9+.5)/16,(15+.5)/16,(7+.5)/16,(13+.5)/16,(5+.5)/16]);function ht(n,t,e,o,r,a,i,s,c,l,p,h,f,y,g,L,E,w,x,M){let C=(r-n)*(l-t)-(a-t)*(c-n);if(C===0||C>0)return;let d=1/C,b=C>0,u=n<r?n:r;c<u&&(u=c);let v=n>r?n:r;c>v&&(v=c);let A=t<a?t:a;l<A&&(A=l);let G=t>a?t:a;l>G&&(G=l);let m=Math.max(0,Math.ceil(u)),_=Math.min(x-1,Math.floor(v)),S=Math.max(0,Math.ceil(A)),T=Math.min(M-1,Math.floor(G));if(!(m>_||S>T))for(let z=S;z<=T;z++){let I=z;for(let H=m;H<=_;H++){let P=H,N=(r-P)*(l-I)-(a-I)*(c-P),O=(c-P)*(t-I)-(l-I)*(n-P),R=(n-P)*(a-I)-(t-I)*(r-P);if(b?N<0||O<0||R<0:N>0||O>0||R>0)continue;let Y=(N*e+O*i+R*p)*d,X=z*x+H;if(Y>w[X]){w[X]=Y;let B=(N*o+O*s+R*h)*d,U=(B<0?0:B>1?1:B)*y,F=U|0,ie=U-F,se=dt[(z&3)*4+(H&3)],q=ie>se&&F<y?F+1:F;L[X]=f[q>y?y:q],E&&(E[X]=g)}}}}function pt(n,t){let e=n.length,o=new Array(e);for(let s=0;s<e;s++){let c=n[s].vertices;if(c.length<3){o[s]=[0,0,0];continue}let l=c[0],p=c[1],h=c[2],f=p[0]-l[0],y=p[1]-l[1],g=p[2]-l[2],L=h[0]-l[0],E=h[1]-l[1],w=h[2]-l[2],x=y*w-g*E,M=g*L-f*w,C=f*E-y*L,d=Math.hypot(x,M,C)||1;o[s]=[x/d,M/d,C/d]}let r=new Map;for(let s=0;s<e;s++){let c=n[s].vertices;for(let l=0;l<c.length;l++){let p=c[l],h=`${p[0]},${p[1]},${p[2]}`,f=r.get(h);f||(f=[],r.set(h,f)),(f.length===0||f[f.length-1]!==s)&&f.push(s)}}let a=Math.cos(t*Math.PI/180),i=new Array(e);for(let s=0;s<e;s++){let c=n[s].vertices,l=o[s],p=new Array(c.length);for(let h=0;h<c.length;h++){let f=c[h],y=r.get(`${f[0]},${f[1]},${f[2]}`),g=0,L=0,E=0;for(let x=0;x<y.length;x++){let M=y[x],C=o[M];l[0]*C[0]+l[1]*C[1]+l[2]*C[2]>=a&&(g+=C[0],L+=C[1],E+=C[2])}let w=Math.hypot(g,L,E)||1;p[h]=[g/w,L/w,E/w]}i[s]=p}return i}function mt(n,t,e,o){let r=[],a=null,i="",s=()=>{i&&(a!==null?r.push(`<span style="color:${a}">${i}</span>`):r.push(i),i="")};for(let c=0;c<o;c++){for(let l=0;l<e;l++){let p=c*e+l,h=n[p],f=t&&h!==" "?t[p]??null:null;f!==a&&(s(),a=f),i+=h}s(),a=null,c<o-1&&r.push(`
2
- `)}return r.join("")}function ft(n,t,e,o,r,a,i,s,c,l){let p=Math.abs(r-e),h=-Math.abs(a-o),f=e<r?1:-1,y=o<a?1:-1,g=p+h;for(;;){if(e>=0&&e<c&&o>=0&&o<l){let E=o*c+e;n[E]<i&&(n[E]=i,t&&(t[E]=s))}if(e===r&&o===a)break;let L=2*g;L>=h&&(g+=h,e+=f),L<=p&&(g+=p,o+=y)}}function yt(n,t,e,o,r){let a=[],i=null,s="",c=()=>{s&&(i!==null?a.push(`<span style="color:${i}">${s}</span>`):a.push(s),s="")};for(let l=0;l<o;l++){for(let p=0;p<e;p++){let h=l*e+p,f=n[h],y,g;f===0?(y=" ",g=null):(y=f===1?r.thin[Math.random()*r.thin.length|0]:f===2?r.normal[Math.random()*r.normal.length|0]:r.core[Math.random()*r.core.length|0],g=t?t[h]??null:null),g!==i&&(c(),i=g),s+=y}c(),i=null,l<o-1&&a.push(`
3
- `)}return a.join("")}function Ae(n){let t=n.startsWith("#")?n.slice(1):n;if(t.length===3){let e=parseInt(t[0]+t[0],16),o=parseInt(t[1]+t[1],16),r=parseInt(t[2]+t[2],16);return[e||0,o||0,r||0]}if(t.length===6){let e=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return[e||0,o||0,r||0]}return[255,255,255]}function Ce(n){let t=Math.max(0,Math.min(255,n|0)).toString(16);return t.length===1?"0"+t:t}var ke="glyph-styles";function Ie(n){let t=n??(typeof document<"u"?document:void 0);if(!t||t.getElementById(ke))return;let e=t.createElement("style");e.id=ke,e.textContent=gt,t.head.appendChild(e)}var gt=`
1
+ "use strict";var $e=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var Tt=Object.prototype.hasOwnProperty;var zt=(n,t)=>{for(var e in t)$e(n,e,{get:t[e],enumerable:!0})},Ht=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _t(t))!Tt.call(n,r)&&r!==e&&$e(n,r,{get:()=>t[r],enumerable:!(o=Lt(t,r))||o.enumerable});return n};var Pt=n=>Ht($e({},"__esModule",{value:!0}),n);var yn={};zt(yn,{GlyphHotspotElement:()=>Me,GlyphMapControlsElement:()=>Ge,GlyphMeshElement:()=>Ae,GlyphOrbitControlsElement:()=>Se,GlyphOrthographicCameraElement:()=>fe,GlyphPerspectiveCameraElement:()=>xe,GlyphSceneElement:()=>Ce});module.exports=Pt(yn);var nt=Math.PI/180;function rt(n,t,e){let o=n[1],r=n[0],s=n[2],l=e*nt,i=Math.cos(l),c=Math.sin(l),u=o*i-r*c,d=o*c+r*i,a=s,f=t*nt,v=Math.cos(f),g=Math.sin(f),w=d*v-a*g,x=d*g+a*v;return[u,w,x]}function Te(n={}){let t={rotX:n.rotX??65,rotY:n.rotY??45,distance:n.distance??6,zoom:n.zoom??.65,stretch:n.stretch??1,target:[0,0,0],eyeMode:!1,focal:1},[e,o]=n.center??[.5,.5];return{kind:"perspective",get rotX(){return t.rotX},set rotX(r){t.rotX=r},get rotY(){return t.rotY},set rotY(r){t.rotY=r},get distance(){return t.distance},set distance(r){t.distance=r},get zoom(){return t.zoom},set zoom(r){t.zoom=r},get stretch(){return t.stretch},set stretch(r){t.stretch=r},get target(){return t.target},set target(r){t.target=r},get eyeMode(){return t.eyeMode},set eyeMode(r){t.eyeMode=r},project(r,s,l,i){let u=50/i,d=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],a=rt(d,t.rotX,t.rotY);if(t.eyeMode){if(a[2]>=-.001)return[NaN,NaN,a[2]];let y=t.focal/-a[2],E=a[0]*y*t.zoom*50,L=a[1]*y*t.zoom*50,p=s*e+E/u*t.stretch,m=l*o+L/50;return[p,m,a[2]]}let f=.001,v=t.distance-a[2];if(v<f)return[NaN,NaN,a[2]];let g=t.distance/v,w=a[0]*g*t.zoom*50,x=a[1]*g*t.zoom*50,_=s*e+w/u*t.stretch,G=l*o+x/50;return[_,G,a[2]]}}}function ot(n={}){let t={rotX:n.rotX??65,rotY:n.rotY??45,distance:0,zoom:n.zoom??.65,stretch:1,target:[0,0,0]},[e,o]=n.center??[.5,.5];return{kind:"orthographic",get rotX(){return t.rotX},set rotX(r){t.rotX=r},get rotY(){return t.rotY},set rotY(r){t.rotY=r},get distance(){return t.distance},set distance(r){t.distance=r},get zoom(){return t.zoom},set zoom(r){t.zoom=r},get stretch(){return t.stretch},set stretch(r){t.stretch=r},get target(){return t.target},set target(r){t.target=r},get eyeMode(){return!1},set eyeMode(r){},project(r,s,l,i){let u=50/i,d=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],a=rt(d,t.rotX,t.rotY),f=a[0]*t.zoom*50,v=a[1]*t.zoom*50,g=s*e+f/u,w=l*o+v/50;return[g,w,a[2]]}}}var Ot={direction:[-.5,-.7,-.5],intensity:1},It={intensity:.4};function Rt(n){let t=new Set,e=[];for(let o of n){let r=o.vertices;if(!(r.length<2))for(let s=0;s<r.length;s++){let l=r[s],i=r[(s+1)%r.length],c=`${l[0]},${l[1]},${l[2]}`,u=`${i[0]},${i[1]},${i[2]}`,d=c<u?`${c}|${u}`:`${u}|${c}`;if(t.has(d))continue;t.add(d);let a={from:l,to:i,weight:2};o.color&&(a.color=o.color),e.push(a)}}return e}function it(n){let t=n.polygons??[],e=n.mode??(t.length?"solid":"wireframe"),o=n.wireframe??(e==="wireframe"?Rt(t):[]);return{camera:n.camera,grid:n.grid,polygons:t,wireframe:o,mode:e,directionalLight:n.directionalLight??Ot,ambientLight:n.ambientLight??It,glyphPalette:n.glyphPalette??"default",useColors:n.useColors??!0,smoothShading:n.smoothShading??!1,creaseAngle:n.creaseAngle??60,shadow:n.shadow,castShadowFlags:n.castShadowFlags??[],receiveShadowFlags:n.receiveShadowFlags??[]}}var wn=" .:-=+*#%@".split(""),Cn=" .:-=+*#%@".split(""),We={default:{thin:"\xB7\u22C5\u2219\u02D9\xB7\u22C5\u2219".split(""),normal:"\u254B\u256C\u253C\u2573\u25C6\u25C7\u25CA\u25B2\u25B3\u25BC\u25BD\u25C8\u2B21\u2B22\u2234\u2235\u22A5\u2295\u2297\u2299\u229A\u229B".split(""),core:"\u2726\u2727\u2729\u25C9\u2299\u25CE".split(""),solid:" .:-=+*#%@".split("")},ascii:{thin:".'".split(""),normal:"+*x".split(""),core:"#@".split(""),solid:" .,:;!+=*xX#@".split("")},dots:{thin:"\xB7\u22C5".split(""),normal:"\u2022\u25CF".split(""),core:"\u25C9\u25CE".split(""),solid:" \xB7\u22C5\u2218\u2022\u25CF\u25C9\u25CE\u2B24".split("")},lines:{thin:"\u2500\u2502".split(""),normal:"\u2550\u2551".split(""),core:"\u2588".split(""),solid:" \u2500\u2550\u256C\u2551\u2588\u2593\u2592\u2591".split("")},blocks:{thin:"\u2591\u2581".split(""),normal:"\u2592\u2593\u258C\u2590\u2580\u2584".split(""),core:"\u2588".split(""),solid:" \u2591\u2592\u2593\u258C\u2590\u2588\u2580\u2584\u25A0".split("")},stars:{thin:"\xB7\u22C6".split(""),normal:"\u2726\u2727\u2729\u272A".split(""),core:"\u272B\u272C\u272D\u2605".split(""),solid:" \xB7\u22C6\u2217\u2726\u2727\u2729\u272A\u272B\u2605".split("")},arrows:{thin:"\xB7\u2219".split(""),normal:"\u2190\u2191\u2192\u2193".split(""),core:"\u2196\u2197\u2198\u2199\u2921\u2922".split(""),solid:" \xB7\u2219\u2191\u2197\u2192\u2198\u2193\u2199\u2190\u2196".split("")},braille:{thin:"\u2801\u2802\u2804\u2808".split(""),normal:"\u2803\u2805\u2806\u2809\u280A\u280B\u280C\u280D\u280E\u280F".split(""),core:"\u283F\u28FF".split(""),solid:" \u2801\u2803\u2807\u2827\u2837\u283F\u287F\u28FF".split("")},runes:{thin:".\xB7".split(""),normal:"\u16A0\u16A1\u16A2\u16A3\u16A4\u16A6\u16A8\u16B1\u16B2\u16B3\u16B7\u16B9\u16C3\u16C7\u16C9".split(""),core:"\u16DE\u16DF\u16E1\u16E2\u16E3".split(""),solid:" \xB7\u16A0\u16A3\u16A4\u16A8\u16B1\u16B7\u16DE\u16E2".split("")},math:{thin:"\u2219\u2218".split(""),normal:"\u2211\u220F\u222B\u221A\u221E\u2248\u2260\u2264\u2265\u2282\u2283\u2286\u2287".split(""),core:"\u222E\u222F\u2230\u2202".split(""),solid:" \u2219\u2218\u2211\u222B\u221A\u221E\u2248\u2295\u2297".split("")},binary:{thin:"\xB7.".split(""),normal:"01".split(""),core:"\u2588".split(""),solid:" .:01\u2588\u2588".split("")},hex:{thin:"\xB7\u2219".split(""),normal:"0123456789ABCDEF".split(""),core:"FFAA".split(""),solid:" 0123456789AF".split("")}},An=We.default;function je(n){return We[n]??We.default}function lt(n){let{camera:t,grid:e,wireframe:o,mode:r}=n,{cols:s,rows:l,cellAspect:i}=e;if(r==="solid")return kt(n,s,l,i);let c=je(n.glyphPalette),u=new Uint8Array(s*l),d=n.useColors?new Array(s*l).fill(null):null;for(let a of o){let f=t.project(a.from,s,l,i),v=t.project(a.to,s,l,i);f[0]!==f[0]||v[0]!==v[0]||Vt(u,d,f[0]|0,f[1]|0,v[0]|0,v[1]|0,a.weight??2,a.color??null,s,l)}return $t(u,d,s,l,c)}function kt(n,t,e,o){let{camera:r,polygons:s,directionalLight:l,ambientLight:i,smoothShading:c,creaseAngle:u,castShadowFlags:d,receiveShadowFlags:a}=n,f=je(n.glyphPalette).solid,v=f.length-1,g=new Array(t*e).fill(" "),w=n.useColors,x=w?new Array(t*e).fill(null):null,_=new Float64Array(t*e).fill(-1/0),G=l.direction,z=Math.hypot(G[0],G[1],G[2])||1,y=G[0]/z,E=G[1]/z,L=G[2]/z,p=l.intensity??1,m=i.intensity??.4,b=we(l.color??"#ffffff"),A=we(i.color??"#ffffff"),h=c&&u>0?Xt(s,u):null,C=new Map,S=n.shadow,H=S!=null&&d.length>0?Yt(s,d,y,E,L):null,T=S?.opacity??.25,I=S?.lift??.05,R=S?.color??"#000000",q=H?we(R):[0,0,0],P=globalThis.__glyphPerfDetail,U=P?performance.now():0,B=[],O=n.shadeCache??null,k=-1;for(let re=0;re<s.length;re++){let ye=s[re],Y=ye.vertices;if(!(Y.length<3)){for(let N=0;N<Y.length;N++)B[N]=r.project(Y[N],t,e,o);for(let N=1;N<Y.length-1;N++){k++;let be=0,D=N,K=N+1,Z=Y[be],oe=Y[D],ie=Y[K],F=B[be],X=B[D],V=B[K];if(F[0]!==F[0]||X[0]!==X[0]||V[0]!==V[0]||(X[0]-F[0])*(V[1]-F[1])-(X[1]-F[1])*(V[0]-F[0])>0)continue;let $,J,Q,se=null;if(O!==null&&O.iA[k]!==void 0)$=O.iA[k],J=O.iB[k],Q=O.iC[k],se=O.lit[k];else{let M=oe[0]-Z[0],le=oe[1]-Z[1],ae=oe[2]-Z[2],ce=ie[0]-Z[0],Ke=ie[1]-Z[1],Ze=ie[2]-Z[2],Je=le*Ze-ae*Ke,Qe=ae*ce-M*Ze,et=M*Ke-le*ce,Oe=Math.hypot(Je,Qe,et)||1,gt=Je/Oe,yt=Qe/Oe,bt=et/Oe,Ie,Re,ke,Fe,Be,Ye,Ne,Xe,De;if(h){let ve=h[re],ee=ve[be],ue=ve[D],Ee=ve[K];Ie=ee[0],Re=ee[1],ke=ee[2],Fe=ue[0],Be=ue[1],Ye=ue[2],Ne=Ee[0],Xe=Ee[1],De=Ee[2]}else Ie=Fe=Ne=gt,Re=Be=Xe=yt,ke=Ye=De=bt;let vt=Math.max(0,-(Ie*y+Re*E+ke*L)),Et=Math.max(0,-(Fe*y+Be*E+Ye*L)),wt=Math.max(0,-(Ne*y+Xe*E+De*L));if($=Math.min(1,m+vt*p),J=Math.min(1,m+Et*p),Q=Math.min(1,m+wt*p),w){let ve=($+J+Q)/3,ee=Math.max(0,ve-m),ue=ye.color??"#ffffff",Ee=ee*255|0,tt=`${ue}:${Ee}`,_e=C.get(tt);if(_e===void 0){let Ve=we(ue),Ct=m*A[0]/255+ee*b[0]/255,At=m*A[1]/255+ee*b[1]/255,Mt=m*A[2]/255+ee*b[2]/255,xt=Math.min(255,Ve[0]*Ct),St=Math.min(255,Ve[1]*At),Gt=Math.min(255,Ve[2]*Mt);_e=`#${he(xt)}${he(St)}${he(Gt)}`,C.set(tt,_e)}se=_e}O!==null&&(O.iA[k]=$,O.iB[k]=J,O.iC[k]=Q,O.lit[k]=se)}let Pe=a[re]??!1,Le=null;if(H!==null&&Pe){let M=H,le=de(Z,M.right[0],M.right[1],M.right[2],M.up[0],M.up[1],M.up[2],M.dir[0],M.dir[1],M.dir[2],M.uMin,M.uMax,M.vMin,M.vMax),ae=de(oe,M.right[0],M.right[1],M.right[2],M.up[0],M.up[1],M.up[2],M.dir[0],M.dir[1],M.dir[2],M.uMin,M.uMax,M.vMin,M.vMax),ce=de(ie,M.right[0],M.right[1],M.right[2],M.up[0],M.up[1],M.up[2],M.dir[0],M.dir[1],M.dir[2],M.uMin,M.uMax,M.vMin,M.vMax);Le={map:M,luA:le[0],lvA:le[1],ldA:le[2],luB:ae[0],lvB:ae[1],ldB:ae[2],luC:ce[0],lvC:ce[1],ldC:ce[2],lift:I,opacity:T,shadowColorRgb:q,shadowColorHex:R,litCache:C}}Nt(F[0],F[1],F[2],$,X[0],X[1],X[2],J,V[0],V[1],V[2],Q,f,v,se,g,x,_,t,e,Le)}}}P&&(P.loop??(P.loop=[])).push(performance.now()-U);let ne=P?performance.now():0,ge=Dt(g,x,t,e);return P&&(P.string??(P.string=[])).push(performance.now()-ne),ge}var Ft=new Float64Array([(0+.5)/16,(8+.5)/16,(2+.5)/16,(10+.5)/16,(12+.5)/16,(4+.5)/16,(14+.5)/16,(6+.5)/16,(3+.5)/16,(11+.5)/16,(1+.5)/16,(9+.5)/16,(15+.5)/16,(7+.5)/16,(13+.5)/16,(5+.5)/16]),W=256;function de(n,t,e,o,r,s,l,i,c,u,d,a,f,v){let g=t*n[0]+e*n[1]+o*n[2],w=r*n[0]+s*n[1]+l*n[2],x=-(i*n[0]+c*n[1]+u*n[2]),_=(g-d)/(a-d)*(W-1),G=(w-f)/(v-f)*(W-1);return[_,G,x]}function Bt(n,t,e,o){let r=t[0],s=t[1],l=t[2],i=e[0],c=e[1],u=e[2],d=o[0],a=o[1],f=o[2],v=(i-r)*(a-s)-(c-s)*(d-r);if(v===0)return;let g=1/v,w=r<i?r:i;d<w&&(w=d);let x=r>i?r:i;d>x&&(x=d);let _=s<c?s:c;a<_&&(_=a);let G=s>c?s:c;a>G&&(G=a);let z=Math.max(0,Math.ceil(w)),y=Math.min(W-1,Math.floor(x)),E=Math.max(0,Math.ceil(_)),L=Math.min(W-1,Math.floor(G));if(z>y||E>L)return;let p=v>0;for(let m=E;m<=L;m++)for(let b=z;b<=y;b++){let A=b,h=m,C=(i-A)*(a-h)-(c-h)*(d-A),S=(d-A)*(s-h)-(a-h)*(r-A),H=(r-A)*(c-h)-(s-h)*(i-A);if(p?C<0||S<0||H<0:C>0||S>0||H>0)continue;let T=(C*l+S*u+H*f)*g,I=m*W+b;T>n[I]&&(n[I]=T)}}function Yt(n,t,e,o,r){let s,l,i;Math.abs(e)<.9?(s=0,l=r,i=-o):(s=-r,l=0,i=e);let c=Math.hypot(s,l,i);s/=c,l/=c,i/=c;let u=l*r-i*o,d=i*e-s*r,a=s*o-l*e,f=1/0,v=-1/0,g=1/0,w=-1/0,x=!1;for(let y=0;y<n.length;y++)if(t[y]){x=!0;for(let E of n[y].vertices){let L=s*E[0]+l*E[1]+i*E[2],p=u*E[0]+d*E[1]+a*E[2];L<f&&(f=L),L>v&&(v=L),p<g&&(g=p),p>w&&(w=p)}}if(!x)return null;let _=(v-f)*.05+.01,G=(w-g)*.05+.01;f-=_,v+=_,g-=G,w+=G;let z=new Float64Array(W*W).fill(-1/0);for(let y=0;y<n.length;y++){if(!t[y])continue;let E=n[y].vertices;if(!(E.length<3))for(let L=1;L<E.length-1;L++){let p=E[0],m=E[L],b=E[L+1],A=de(p,s,l,i,u,d,a,e,o,r,f,v,g,w),h=de(m,s,l,i,u,d,a,e,o,r,f,v,g,w),C=de(b,s,l,i,u,d,a,e,o,r,f,v,g,w);Bt(z,A,h,C)}}return{buf:z,right:[s,l,i],up:[u,d,a],dir:[e,o,r],uMin:f,uMax:v,vMin:g,vMax:w}}function Nt(n,t,e,o,r,s,l,i,c,u,d,a,f,v,g,w,x,_,G,z,y){let E=(r-n)*(u-t)-(s-t)*(c-n);if(E===0||E>0)return;let L=1/E,p=E>0,m=n<r?n:r;c<m&&(m=c);let b=n>r?n:r;c>b&&(b=c);let A=t<s?t:s;u<A&&(A=u);let h=t>s?t:s;u>h&&(h=u);let C=Math.max(0,Math.ceil(m)),S=Math.min(G-1,Math.floor(b)),H=Math.max(0,Math.ceil(A)),T=Math.min(z-1,Math.floor(h));if(!(C>S||H>T))for(let I=H;I<=T;I++){let R=I;for(let q=C;q<=S;q++){let P=q,U=(r-P)*(u-R)-(s-R)*(c-P),B=(c-P)*(t-R)-(u-R)*(n-P),O=(n-P)*(s-R)-(t-R)*(r-P);if(p?U<0||B<0||O<0:U>0||B>0||O>0)continue;let k=(U*e+B*l+O*d)*L,ne=I*G+q;if(k>_[ne]){_[ne]=k;let ge=(U*o+B*i+O*a)*L,ye=(ge<0?0:ge>1?1:ge)*v,Y=ye|0,N=ye-Y,be=Ft[(I&3)*4+(q&3)],D=N>be&&Y<v?Y+1:Y;D>v&&(D=v);let K=g;if(y!==null){let Z=(U*y.luA+B*y.luB+O*y.luC)*L,oe=(U*y.lvA+B*y.lvB+O*y.lvC)*L,ie=(U*y.ldA+B*y.ldB+O*y.ldC)*L,F=Z|0,X=oe|0;if(F>=0&&F<W&&X>=0&&X<W){let V=y.map.buf[X*W+F];if(V>-1/0&&ie+y.lift<V&&(D=Math.max(0,D-Math.round(y.opacity*v)),K!==null)){let He=`shadow:${K}:${D}`,$=y.litCache.get(He);if($===void 0){let J=we(K),Q=y.shadowColorRgb,se=Math.round(J[0]*(1-y.opacity)+Q[0]*y.opacity),Pe=Math.round(J[1]*(1-y.opacity)+Q[1]*y.opacity),Le=Math.round(J[2]*(1-y.opacity)+Q[2]*y.opacity);$=`#${he(se)}${he(Pe)}${he(Le)}`,y.litCache.set(He,$)}K=$}}}w[ne]=f[D],x&&(x[ne]=K)}}}}function Xt(n,t){let e=n.length,o=new Array(e);for(let i=0;i<e;i++){let c=n[i].vertices;if(c.length<3){o[i]=[0,0,0];continue}let u=c[0],d=c[1],a=c[2],f=d[0]-u[0],v=d[1]-u[1],g=d[2]-u[2],w=a[0]-u[0],x=a[1]-u[1],_=a[2]-u[2],G=v*_-g*x,z=g*w-f*_,y=f*x-v*w,E=Math.hypot(G,z,y)||1;o[i]=[G/E,z/E,y/E]}let r=new Map;for(let i=0;i<e;i++){let c=n[i].vertices;for(let u=0;u<c.length;u++){let d=c[u],a=`${d[0]},${d[1]},${d[2]}`,f=r.get(a);f||(f=[],r.set(a,f)),(f.length===0||f[f.length-1]!==i)&&f.push(i)}}let s=Math.cos(t*Math.PI/180),l=new Array(e);for(let i=0;i<e;i++){let c=n[i].vertices,u=o[i],d=new Array(c.length);for(let a=0;a<c.length;a++){let f=c[a],v=r.get(`${f[0]},${f[1]},${f[2]}`),g=0,w=0,x=0;for(let G=0;G<v.length;G++){let z=v[G],y=o[z];u[0]*y[0]+u[1]*y[1]+u[2]*y[2]>=s&&(g+=y[0],w+=y[1],x+=y[2])}let _=Math.hypot(g,w,x)||1;d[a]=[g/_,w/_,x/_]}l[i]=d}return l}function Dt(n,t,e,o){let r=[],s=null,l="",i=()=>{l&&(s!==null?r.push(`<span style="color:${s}">${l}</span>`):r.push(l),l="")};for(let c=0;c<o;c++){for(let u=0;u<e;u++){let d=c*e+u,a=n[d],f=t&&a!==" "?t[d]??null:null;f!==s&&(i(),s=f),l+=a}i(),s=null,c<o-1&&r.push(`
2
+ `)}return r.join("")}function Vt(n,t,e,o,r,s,l,i,c,u){let d=Math.abs(r-e),a=-Math.abs(s-o),f=e<r?1:-1,v=o<s?1:-1,g=d+a;for(;;){if(e>=0&&e<c&&o>=0&&o<u){let x=o*c+e;n[x]<l&&(n[x]=l,t&&(t[x]=i))}if(e===r&&o===s)break;let w=2*g;w>=a&&(g+=a,e+=f),w<=d&&(g+=d,o+=v)}}function $t(n,t,e,o,r){let s=[],l=null,i="",c=()=>{i&&(l!==null?s.push(`<span style="color:${l}">${i}</span>`):s.push(i),i="")};for(let u=0;u<o;u++){for(let d=0;d<e;d++){let a=u*e+d,f=n[a],v,g;f===0?(v=" ",g=null):(v=f===1?r.thin[Math.random()*r.thin.length|0]:f===2?r.normal[Math.random()*r.normal.length|0]:r.core[Math.random()*r.core.length|0],g=t?t[a]??null:null),g!==l&&(c(),l=g),i+=v}c(),l=null,u<o-1&&s.push(`
3
+ `)}return s.join("")}var st=new Map;function we(n){let t=st.get(n);if(t!==void 0)return t;let e=Wt(n);return st.set(n,e),e}function Wt(n){let t=n.startsWith("#")?n.slice(1):n;if(t.length===3){let e=parseInt(t[0]+t[0],16),o=parseInt(t[1]+t[1],16),r=parseInt(t[2]+t[2],16);return[e||0,o||0,r||0]}if(t.length===6){let e=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);return[e||0,o||0,r||0]}return[255,255,255]}function he(n){let t=Math.max(0,Math.min(255,n|0)).toString(16);return t.length===1?"0"+t:t}var at="glyph-styles";function ct(n){let t=n??(typeof document<"u"?document:void 0);if(!t||t.getElementById(at))return;let e=t.createElement("style");e.id=at,e.textContent=jt,t.head.appendChild(e)}var jt=`
4
4
  /* \u2500\u2500 React / Vue host wrapper \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
5
5
 
6
6
  .glyph-host {
@@ -59,4 +59,5 @@
59
59
  the content from the 3D vertex being labelled. */
60
60
  transform: translate(-50%, -50%);
61
61
  }
62
- `;function Ne(n,t,e,o,r){return n.map(a=>{let[i,s,c]=t.project(a.at,e,o,r),l=c>-3&&i>=0&&i<e&&s>=0&&s<o;return{id:a.id,col:i,row:s,depth:c,visible:l}})}var bt=1;function vt(n,t){let{position:e,scale:o,rotation:r}=t;if(!e&&!o&&!r)return n;let[a,i,s]=e??[0,0,0],c=1,l=1,p=1;o!==void 0&&(typeof o=="number"?c=l=p=o:[c,l,p]=o);let[h,f,y]=r??[0,0,0],g=Math.cos(h),L=Math.sin(h),E=Math.cos(f),w=Math.sin(f),x=Math.cos(y),M=Math.sin(y);function C(d){let b=d[0]*c,u=d[1]*l,v=d[2]*p,A=x*b-M*u,G=M*b+x*u,m=v;return b=E*A+w*m,u=G,v=-w*A+E*m,A=b,G=g*u-L*v,m=L*u+g*v,[A+a,G+i,m+s]}return n.map(d=>({...d,vertices:d.vertices.map(C)}))}function Ye(n,t={}){Ie(n.ownerDocument??void 0);let e={mode:t.mode??"solid",glyphPalette:t.glyphPalette??"default",useColors:t.useColors??!0,cols:t.cols??80,rows:t.rows??24,cellAspect:t.cellAspect??2,directionalLight:t.directionalLight??{direction:[.5,.7,.5],intensity:1},ambientLight:t.ambientLight??{intensity:.4},camera:t.camera??le(),smoothShading:t.smoothShading??!1,creaseAngle:t.creaseAngle??60,autoSize:t.autoSize??!1},o=n.ownerDocument.createElement("div");o.className="glyph-scene";let r=n.ownerDocument.createElement("pre");r.className="glyph-output";let a=n.ownerDocument.createElement("div");a.className="glyph-hotspot-layer",o.appendChild(r),o.appendChild(a),n.appendChild(o);let i=new Map,s=[],c=!1;function l(){c||(c=!0,Promise.resolve().then(()=>{c=!1,p()}))}function p(){let d=[];for(let v of i.values()){let A=vt(v.polygons,v.transform);for(let G of A)d.push(G)}let b=Oe({camera:e.camera,grid:{cols:e.cols,rows:e.rows,cellAspect:e.cellAspect},polygons:d,mode:e.mode,directionalLight:e.directionalLight,ambientLight:e.ambientLight,glyphPalette:e.glyphPalette,useColors:e.useColors,smoothShading:e.smoothShading,creaseAngle:e.creaseAngle}),u=Re(b);e.useColors?r.innerHTML=u:r.textContent=u,h()}function h(){let{cols:d,rows:b,cellAspect:u,camera:v}=e,A=Ne(s.map(S=>S.hotspot),v,d,b,u),G=r.getBoundingClientRect(),m=d>0?G.width/d:8,_=b>0?G.height/b:16;for(let S=0;S<s.length;S++){let{el:T}=s[S],z=A[S];z.visible?(T.style.display="",T.style.left=`${(z.col+.5)*m}px`,T.style.top=`${(z.row+.5)*_}px`,T.style.zIndex=String(Math.round(z.depth*1e3))):T.style.display="none"}}function f(d,b={}){let u=bt++;return i.set(u,{id:u,polygons:d,transform:b}),l(),{get id(){return u},get name(){return i.get(u)?.transform.id},get polygons(){return d},setTransform(v){let A=i.get(u);A&&(A.transform=v,l())},dispose(){i.delete(u),l()}}}function y(d,b){let u=n.ownerDocument.createElement("div");u.className="glyph-hotspot",u.setAttribute("data-hotspot-id",d.id);let[v,A]=d.size??[1,1];u.style.position="absolute",u.style.width=`${v}ch`,u.style.height=`${A*e.cellAspect}ch`,b&&u.addEventListener("click",b),a.appendChild(u);let G={hotspot:{id:d.id,at:d.at,size:d.size},el:u,onClick:b};return s.push(G),l(),{get el(){return u},remove(){let m=s.indexOf(G);m>=0&&s.splice(m,1),b&&u.removeEventListener("click",b),a.removeChild(u),l()}}}function g(){p()}function L(d){d.mode!==void 0&&(e.mode=d.mode),d.glyphPalette!==void 0&&(e.glyphPalette=d.glyphPalette),d.useColors!==void 0&&(e.useColors=d.useColors),d.cols!==void 0&&(e.cols=d.cols),d.rows!==void 0&&(e.rows=d.rows),d.cellAspect!==void 0&&(e.cellAspect=d.cellAspect),d.directionalLight!==void 0&&(e.directionalLight=d.directionalLight),d.ambientLight!==void 0&&(e.ambientLight=d.ambientLight),d.camera!==void 0&&(e.camera=d.camera),d.smoothShading!==void 0&&(e.smoothShading=d.smoothShading),d.creaseAngle!==void 0&&(e.creaseAngle=d.creaseAngle),d.autoSize!==void 0&&(e.autoSize=d.autoSize,e.autoSize&&!M&&typeof ResizeObserver<"u"?(M=new ResizeObserver(()=>x()),M.observe(n),x()):!e.autoSize&&M&&(M.disconnect(),M=null)),l()}function E(){return{...e}}function w(){let d=n.ownerDocument.createElement("span");d.textContent="M",d.style.cssText="position:absolute;visibility:hidden;font-family:inherit;font-size:inherit;line-height:inherit;white-space:pre;padding:0;margin:0",r.appendChild(d);let b=d.getBoundingClientRect();return d.remove(),{w:b.width||8,h:b.height||16}}function x(){let d=n.clientWidth,b=n.clientHeight;if(!d||!b)return;let u=w(),v=Math.max(20,Math.floor(d/u.w)),A=Math.max(8,Math.floor(b/u.h)),G=u.h/u.w,m=!1;e.cols!==v&&(e.cols=v,m=!0),e.rows!==A&&(e.rows=A,m=!0),Math.abs(e.cellAspect-G)>.01&&(e.cellAspect=G,m=!0),m&&l()}let M=null;e.autoSize&&typeof ResizeObserver<"u"&&(M=new ResizeObserver(()=>x()),M.observe(n),x());function C(){M&&(M.disconnect(),M=null),i.clear(),n.contains(o)&&n.removeChild(o)}return l(),{get host(){return n},get output(){return r},get camera(){return e.camera},add:f,addHotspot:y,rerender:g,setOptions:L,getOptions:E,fit:x,destroy:C}}var Et=typeof HTMLElement<"u"?HTMLElement:class{},Mt=["mode","glyph-palette","use-colors","cols","rows","cell-aspect","directional-direction","directional-intensity","ambient-intensity","auto-size"];function J(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function At(n){if(n==="wireframe"||n==="solid"||n==="voxel")return n}function Ct(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}var Q=class extends Et{constructor(){super(...arguments);this._scene=null}static get observedAttributes(){return[...Mt]}getScene(){return this._scene}_readOptions(){let e={},o=At(this.getAttribute("mode"));o!==void 0&&(e.mode=o);let r=this.getAttribute("glyph-palette");r&&(e.glyphPalette=r);let a=Ct(this.getAttribute("use-colors"));a!==void 0&&(e.useColors=a);let i=J(this.getAttribute("cols"));i!==void 0&&(e.cols=i);let s=J(this.getAttribute("rows"));s!==void 0&&(e.rows=s);let c=J(this.getAttribute("cell-aspect"));c!==void 0&&(e.cellAspect=c);let l=J(this.getAttribute("directional-intensity"));l!==void 0&&(e.directionalLight={direction:[.5,.7,.5],intensity:l});let p=J(this.getAttribute("ambient-intensity"));return p!==void 0&&(e.ambientLight={intensity:p}),this.hasAttribute("auto-size")&&(e.autoSize=!0),e}_findCameraAncestor(){let e=this.parentElement;for(;e;){let o=e.tagName.toLowerCase();if(o==="glyph-perspective-camera"||o==="glyph-orthographic-camera")return e;e=e.parentElement}return null}_initScene(e){let o=typeof e.getCamera=="function"?e.getCamera():void 0,r=this._readOptions();o&&(r.camera=o),this._scene=Ye(this,r),this.dispatchEvent(new CustomEvent("glyphcss:scene-ready",{bubbles:!1}))}connectedCallback(){if(this._scene)return;let e=this._findCameraAncestor();if(!e)throw new Error("glyphcss: <glyph-scene> must be placed inside a <glyph-perspective-camera> or <glyph-orthographic-camera>.");if((typeof e.getCamera=="function"?e.getCamera():null)!==null)this._initScene(e);else{let r=()=>{e.removeEventListener("glyph:camera-ready",r),this._scene||this._initScene(e)};e.addEventListener("glyph:camera-ready",r)}}rerender(){this._scene?.rerender()}disconnectedCallback(){this._scene&&(this._scene.destroy(),this._scene=null)}attributeChangedCallback(e,o,r){o!==r&&this._scene&&this._scene.setOptions(this._readOptions())}};var $=require("@glyphcss/core"),Gt=typeof HTMLElement<"u"?HTMLElement:class{},xt=["src","geometry","size","color","position","scale","rotation","normalize"];function Lt(n){let t=(0,$.computeSceneBbox)(n),e=(t.min[0]+t.max[0])/2,o=(t.min[1]+t.max[1])/2,r=(t.min[2]+t.max[2])/2,i=2/(Math.max(t.max[0]-t.min[0],t.max[1]-t.min[1],t.max[2]-t.min[2])||1);return n.map(s=>({...s,vertices:s.vertices.map(c=>[(c[0]-e)*i,(c[1]-o)*i,(c[2]-r)*i])}))}function Ge(n){if(!n)return;let t=n.split(",").map(e=>parseFloat(e.trim()));if(!(t.length!==3||t.some(e=>!Number.isFinite(e))))return[t[0],t[1],t[2]]}function wt(n){if(n){if(!n.includes(",")){let t=parseFloat(n);return Number.isFinite(t)?t:void 0}return Ge(n)}}function _t(n){return n.closest("glyph-scene")??null}var ee=class extends Gt{constructor(){super(...arguments);this._handle=null;this._loadToken=0}static get observedAttributes(){return[...xt]}getMeshHandle(){return this._handle}connectedCallback(){this._maybeLoad()}disconnectedCallback(){this._tearDown()}attributeChangedCallback(e,o,r){if(o!==r){if(e==="src"||e==="geometry"||e==="size"||e==="color"){this._tearDown(),this._maybeLoad();return}this._handle&&this._handle.setTransform(this._readTransform())}}_readTransform(){return{position:Ge(this.getAttribute("position")),scale:wt(this.getAttribute("scale")),rotation:Ge(this.getAttribute("rotation"))}}_tearDown(){if(this._loadToken+=1,this._handle){try{this._handle.dispose()}catch{}this._handle=null}}async _maybeLoad(){let e=this.getAttribute("src"),o=this.getAttribute("geometry"),r=_t(this);if(r){if(!r.getScene()){let a=()=>{r.removeEventListener("glyphcss:scene-ready",a),this._maybeLoad()};r.addEventListener("glyphcss:scene-ready",a);return}if(e){let a=++this._loadToken,i;try{i=await(0,$.loadMesh)(e)}catch(p){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:p,bubbles:!0}));return}if(a!==this._loadToken){try{i.dispose()}catch{}return}let s=r.getScene();if(!s){try{i.dispose()}catch{}return}let l=this.hasAttribute("normalize")?Lt(i.polygons):i.polygons;this._handle=s.add(l,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:l},bubbles:!0}));return}if(o){let a=r.getScene();if(!a)return;let i=this.getAttribute("size"),s=i!==null?parseFloat(i):1,c=this.getAttribute("color")??void 0,l;try{l=(0,$.resolveGeometry)(o,{size:Number.isFinite(s)?s:1,color:c})}catch(p){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:p,bubbles:!0}));return}this._handle=a.add(l,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:l},bubbles:!0}))}}}};var St=typeof HTMLElement<"u"?HTMLElement:class{};function zt(n){if(!n)return;let t=n.split(",").map(e=>parseFloat(e.trim()));if(!(t.length!==3||t.some(e=>!Number.isFinite(e))))return[t[0],t[1],t[2]]}function Tt(n){if(!n)return;let t=n.split(",").map(e=>parseFloat(e.trim()));if(!(t.length!==2||t.some(e=>!Number.isFinite(e))))return[t[0],t[1]]}function Ht(n){return n.closest("glyph-scene")??null}var te=class extends St{constructor(){super(...arguments);this._handle=null}static get observedAttributes(){return["at","size","hotspot-id"]}connectedCallback(){this._register()}disconnectedCallback(){this._handle&&this._unregister()}attributeChangedCallback(e,o,r){o!==r&&(this._handle&&this._unregister(),this._register())}_unregister(){if(!this._handle)return;let e=this._handle.el;for(;e.firstChild;)this.appendChild(e.firstChild);this._handle.remove(),this._handle=null}_register(){let e=zt(this.getAttribute("at"));if(!e)return;let o=Ht(this);if(!o)return;if(!o.getScene()){let c=()=>{o.removeEventListener("glyphcss:scene-ready",c),this._register()};o.addEventListener("glyphcss:scene-ready",c);return}let r=o.getScene();if(!r)return;let a=this.getAttribute("hotspot-id")??this.getAttribute("id")??String(Math.random()),i=Tt(this.getAttribute("size"));this._handle=r.addHotspot({id:a,at:e,size:i},()=>this.dispatchEvent(new CustomEvent("glyphcss:hotspot-click",{detail:{id:a},bubbles:!0})));let s=this._handle.el;for(;this.firstChild;)s.appendChild(this.firstChild)}};var Pt=typeof HTMLElement<"u"?HTMLElement:class{};function k(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var ne=class extends Pt{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","distance","zoom","stretch"]}getCamera(){return this._camera}connectedCallback(){this._camera=le({rotX:k(this.getAttribute("rot-x")),rotY:k(this.getAttribute("rot-y")),distance:k(this.getAttribute("distance")),zoom:k(this.getAttribute("zoom")),stretch:k(this.getAttribute("stretch"))}),this.dispatchEvent(new CustomEvent("glyph:camera-ready",{bubbles:!1}))}disconnectedCallback(){this._camera=null}attributeChangedCallback(e,o,r){if(o===r)return;let a=this._camera;if(!a)return;let i=k(this.getAttribute("rot-x")),s=k(this.getAttribute("rot-y")),c=k(this.getAttribute("distance")),l=k(this.getAttribute("zoom")),p=k(this.getAttribute("stretch")),h=!1;i!==void 0&&a.rotX!==i&&(a.rotX=i,h=!0),s!==void 0&&a.rotY!==s&&(a.rotY=s,h=!0),c!==void 0&&a.distance!==c&&(a.distance=c,h=!0),l!==void 0&&a.zoom!==l&&(a.zoom=l,h=!0),p!==void 0&&a.stretch!==p&&(a.stretch=p,h=!0),h&&this.querySelector("glyph-scene")?.rerender?.()}};var Ot=typeof HTMLElement<"u"?HTMLElement:class{};function W(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var j=class extends Ot{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","zoom"]}getCamera(){return this._camera}connectedCallback(){this._camera=Pe({rotX:W(this.getAttribute("rot-x")),rotY:W(this.getAttribute("rot-y")),zoom:W(this.getAttribute("zoom"))}),this.dispatchEvent(new CustomEvent("glyph:camera-ready",{bubbles:!1}))}disconnectedCallback(){this._camera=null}attributeChangedCallback(e,o,r){if(o===r)return;let a=this._camera;if(!a)return;let i=W(this.getAttribute("rot-x")),s=W(this.getAttribute("rot-y")),c=W(this.getAttribute("zoom")),l=!1;i!==void 0&&a.rotX!==i&&(a.rotX=i,l=!0),s!==void 0&&a.rotY!==s&&(a.rotY=s,l=!0),c!==void 0&&a.zoom!==c&&(a.zoom=c,l=!0),l&&this.querySelector("glyph-scene")?.rerender?.()}};function Fe(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,a=Xe(t.invert),i=t.animate??!1,s=!1,c=!1,l=null,p=null,h=null,f={x:0,y:0},y=n.camera;function g(u){if(!(!o||s)&&h===null&&u.isPrimary!==!1){u.preventDefault(),h=u.pointerId,f={x:u.clientX,y:u.clientY},e.style.cursor="grabbing";try{u.target.setPointerCapture(u.pointerId)}catch{}i&&i.pauseOnInteraction!==!1&&(c=!0)}}function L(u){if(h===null||u.pointerId!==h||!o||s)return;u.preventDefault();let v=u.clientX-f.x,A=u.clientY-f.y;f={x:u.clientX,y:u.clientY};let G=a,_=1/4*Math.PI/180;y.rotY=y.rotY-v*_*G,y.rotX=Math.max(-Math.PI/2,Math.min(Math.PI/2,y.rotX-A*_*G)),n.rerender()}function E(u){if(h===u.pointerId){h=null,e.style.cursor=o&&!s?"grab":"";try{u.target.releasePointerCapture(u.pointerId)}catch{}i&&(c=!1)}}function w(u){if(!r||s)return;u.preventDefault();let v=u.deltaY*.001;y.zoom=Math.max(.05,Math.min(10,y.zoom*(1-v))),n.rerender()}function x(u){if(!(s||!i)){if(!c){let v=p!==null?Math.min(u-p,50):16.67,A=typeof i=="object"&&i.speed?i.speed:.3,G=typeof i=="object"&&i.axis?i.axis:"y",m=A*(Math.PI/180)*(v/16.67);G==="y"?y.rotY=y.rotY+m:y.rotX=y.rotX+m,n.rerender()}p=u,l=requestAnimationFrame(x)}}function M(){l===null&&typeof requestAnimationFrame<"u"&&i&&(l=requestAnimationFrame(x))}function C(){l!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(l),l=null),p=null}function d(){e.addEventListener("pointerdown",g),e.addEventListener("pointermove",L),e.addEventListener("pointerup",E),e.addEventListener("pointercancel",E),e.addEventListener("wheel",w,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function b(){e.removeEventListener("pointerdown",g),e.removeEventListener("pointermove",L),e.removeEventListener("pointerup",E),e.removeEventListener("pointercancel",E),e.removeEventListener("wheel",w),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return d(),M(),{update(u){let v=!!i;o=u.drag??o,r=u.wheel??r,a=Xe(u.invert),i=u.animate??i,!s&&h===null&&(e.style.cursor=o?"grab":"");let A=!!i;v&&!A?C():!v&&A&&M()},pause(){s||(s=!0,b(),C(),h=null,c=!1)},resume(){s&&(s=!1,d(),M())},destroy(){s||b(),C(),s=!0}}}function Xe(n){return n===void 0||n===!1?1:n===!0?-1:n}var Rt=typeof HTMLElement<"u"?HTMLElement:class{};function kt(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function xe(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function It(n){return n.closest("glyph-scene")??null}var re=class extends Rt{constructor(){super(...arguments);this._controls=null}static get observedAttributes(){return["drag","wheel","invert","animate-speed","animate-axis"]}connectedCallback(){this._attach()}disconnectedCallback(){this._controls&&(this._controls.destroy(),this._controls=null)}attributeChangedCallback(e,o,r){o!==r&&this._controls?.update(this._readOptions())}_readOptions(){let e=xe(this.getAttribute("drag")),o=xe(this.getAttribute("wheel")),r=xe(this.getAttribute("invert")),a=kt(this.getAttribute("animate-speed")),i=this.getAttribute("animate-axis")==="x"?"x":"y";return{...e!==void 0?{drag:e}:{},...o!==void 0?{wheel:o}:{},...r!==void 0?{invert:r}:{},...a!==void 0?{animate:{speed:a,axis:i}}:{}}}_attach(){if(this._controls)return;let e=It(this);if(!e)return;let o=e.getScene();if(!o){let r=()=>{e.removeEventListener("glyphcss:scene-ready",r),this._attach()};e.addEventListener("glyphcss:scene-ready",r);return}this._controls=Fe(o,this._readOptions())}};function Ve(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,a=De(t.invert),i=t.animate??!1,s=!1,c=!1,l=null,p=null,h=null,f={x:0,y:0},y=!1,g=n.camera,L=1/4*Math.PI/180,E=.02;function w(m){if(!(!o||s)&&h===null&&m.isPrimary!==!1){m.preventDefault(),h=m.pointerId,f={x:m.clientX,y:m.clientY},y=m.button===2,e.style.cursor="grabbing";try{m.target.setPointerCapture(m.pointerId)}catch{}i&&i.pauseOnInteraction!==!1&&(c=!0)}}function x(m){if(h===null||m.pointerId!==h||!o||s)return;m.preventDefault();let _=m.clientX-f.x,S=m.clientY-f.y;f={x:m.clientX,y:m.clientY};let T=a;if(y||m.shiftKey)g.rotY=g.rotY-_*L*T,g.rotX=Math.max(-Math.PI/2,Math.min(Math.PI/2,g.rotX+S*L*T));else{let z=g.target;g.target=[z[0]-_*E/g.zoom,z[1]-S*E/g.zoom,z[2]]}n.rerender()}function M(m){if(h===m.pointerId){h=null,y=!1,e.style.cursor=o&&!s?"grab":"";try{m.target.releasePointerCapture(m.pointerId)}catch{}i&&(c=!1)}}function C(m){m.preventDefault()}function d(m){if(!r||s)return;m.preventDefault();let _=m.deltaY*.001;g.zoom=Math.max(.05,Math.min(10,g.zoom*(1-_))),n.rerender()}function b(m){if(!(s||!i)){if(!c){let _=p!==null?Math.min(m-p,50):16.67,S=typeof i=="object"&&i.speed?i.speed:.3,T=typeof i=="object"&&i.axis?i.axis:"y",z=S*(Math.PI/180)*(_/16.67);T==="y"?g.rotY=g.rotY+z:g.rotX=g.rotX+z,n.rerender()}p=m,l=requestAnimationFrame(b)}}function u(){l===null&&typeof requestAnimationFrame<"u"&&i&&(l=requestAnimationFrame(b))}function v(){l!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(l),l=null),p=null}function A(){e.addEventListener("pointerdown",w),e.addEventListener("pointermove",x),e.addEventListener("pointerup",M),e.addEventListener("pointercancel",M),e.addEventListener("contextmenu",C),e.addEventListener("wheel",d,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function G(){e.removeEventListener("pointerdown",w),e.removeEventListener("pointermove",x),e.removeEventListener("pointerup",M),e.removeEventListener("pointercancel",M),e.removeEventListener("contextmenu",C),e.removeEventListener("wheel",d),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return A(),u(),{update(m){let _=!!i;o=m.drag??o,r=m.wheel??r,a=De(m.invert),i=m.animate??i,!s&&h===null&&(e.style.cursor=o?"grab":"");let S=!!i;_&&!S?v():!_&&S&&u()},pause(){s||(s=!0,G(),v(),h=null,c=!1)},resume(){s&&(s=!1,A(),u())},destroy(){s||G(),v(),s=!0}}}function De(n){return n===void 0||n===!1?1:n===!0?-1:n}var Nt=typeof HTMLElement<"u"?HTMLElement:class{};function Le(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function Yt(n){return n.closest("glyph-scene")??null}var oe=class extends Nt{constructor(){super(...arguments);this._controls=null}static get observedAttributes(){return["drag","wheel","invert"]}connectedCallback(){this._attach()}disconnectedCallback(){this._controls&&(this._controls.destroy(),this._controls=null)}attributeChangedCallback(e,o,r){o!==r&&this._controls?.update(this._readOptions())}_readOptions(){let e=Le(this.getAttribute("drag")),o=Le(this.getAttribute("wheel")),r=Le(this.getAttribute("invert"));return{...e!==void 0?{drag:e}:{},...o!==void 0?{wheel:o}:{},...r!==void 0?{invert:r}:{}}}_attach(){if(this._controls)return;let e=Yt(this);if(!e)return;let o=e.getScene();if(!o){let r=()=>{e.removeEventListener("glyphcss:scene-ready",r),this._attach()};e.addEventListener("glyphcss:scene-ready",r);return}this._controls=Ve(o,this._readOptions())}};if(typeof customElements<"u"){if(customElements.get("glyph-scene")||customElements.define("glyph-scene",Q),customElements.get("glyph-mesh")||customElements.define("glyph-mesh",ee),customElements.get("glyph-hotspot")||customElements.define("glyph-hotspot",te),customElements.get("glyph-perspective-camera")||customElements.define("glyph-perspective-camera",ne),customElements.get("glyph-orthographic-camera")||customElements.define("glyph-orthographic-camera",j),!customElements.get("glyph-camera")){class n extends j{}customElements.define("glyph-camera",n)}customElements.get("glyph-orbit-controls")||customElements.define("glyph-orbit-controls",re),customElements.get("glyph-map-controls")||customElements.define("glyph-map-controls",oe)}0&&(module.exports={GlyphHotspotElement,GlyphMapControlsElement,GlyphMeshElement,GlyphOrbitControlsElement,GlyphOrthographicCameraElement,GlyphPerspectiveCameraElement,GlyphSceneElement});
62
+ `;function ut(n,t,e,o,r){return n.map(s=>{let[l,i,c]=t.project(s.at,e,o,r),u=c>-3&&l>=0&&l<e&&i>=0&&i<o;return{id:s.id,col:l,row:i,depth:c,visible:u}})}var qt=1;function Ut(n,t){let{position:e,scale:o,rotation:r}=t;if(!e&&!o&&!r)return n;let[s,l,i]=e??[0,0,0],c=1,u=1,d=1;o!==void 0&&(typeof o=="number"?c=u=d=o:[c,u,d]=o);let a=Math.PI/180,[f,v,g]=r??[0,0,0],w=f*a,x=v*a,_=g*a,G=Math.cos(w),z=Math.sin(w),y=Math.cos(x),E=Math.sin(x),L=Math.cos(_),p=Math.sin(_);function m(b){let A=b[0]*c,h=b[1]*u,C=b[2]*d,S=L*A-p*h,H=p*A+L*h,T=C;return A=y*S+E*T,h=H,C=-E*S+y*T,S=A,H=G*h-z*C,T=z*h+G*C,[S+s,H+l,T+i]}return n.map(b=>({...b,vertices:b.vertices.map(m)}))}function dt(n,t={}){ct(n.ownerDocument??void 0);let e={mode:t.mode??"solid",glyphPalette:t.glyphPalette??"default",useColors:t.useColors??!0,cols:t.cols??80,rows:t.rows??24,cellAspect:t.cellAspect??2,directionalLight:t.directionalLight??{direction:[-.5,-.7,-.5],intensity:1},ambientLight:t.ambientLight??{intensity:.4},camera:t.camera??Te(),smoothShading:t.smoothShading??!1,creaseAngle:t.creaseAngle??60,autoSize:t.autoSize??!1,shadow:t.shadow},o=n.ownerDocument.createElement("div");o.className="glyph-scene";let r=n.ownerDocument.createElement("pre");r.className="glyph-output";let s=n.ownerDocument.createElement("div");s.className="glyph-hotspot-layer",o.appendChild(r),o.appendChild(s),n.appendChild(o);let l=new Map,i=[],c=!1,u={iA:[],iB:[],iC:[],lit:[]};function d(){u.iA.length=0,u.iB.length=0,u.iC.length=0,u.lit.length=0}function a(){c||(c=!0,Promise.resolve().then(()=>{c=!1,f()}))}function f(){let p=[],m=[],b=[];for(let T of l.values()){let I=Ut(T.polygons,T.transform),R=T.transform.castShadow??!1,q=T.transform.receiveShadow??!1;for(let P of I)p.push(P),m.push(R),b.push(q)}let A=it({camera:e.camera,grid:{cols:e.cols,rows:e.rows,cellAspect:e.cellAspect},polygons:p,mode:e.mode,directionalLight:e.directionalLight,ambientLight:e.ambientLight,glyphPalette:e.glyphPalette,useColors:e.useColors,smoothShading:e.smoothShading,creaseAngle:e.creaseAngle,shadow:e.shadow,castShadowFlags:m,receiveShadowFlags:b});A.shadeCache=u;let h=globalThis.__glyphPerf,C=h?performance.now():0,S=lt(A),H=h?performance.now():0;if(e.useColors?r.innerHTML=S:r.textContent=S,h){let T=performance.now();(h.raster??(h.raster=[])).push(H-C),(h.dom??(h.dom=[])).push(T-H),(h.polys??(h.polys=[])).push(p.length)}v()}function v(){let{cols:p,rows:m,cellAspect:b,camera:A}=e,h=ut(i.map(T=>T.hotspot),A,p,m,b),C=r.getBoundingClientRect(),S=p>0?C.width/p:8,H=m>0?C.height/m:16;for(let T=0;T<i.length;T++){let{el:I}=i[T],R=h[T];R.visible?(I.style.display="",I.style.left=`${(R.col+.5)*S}px`,I.style.top=`${(R.row+.5)*H}px`,I.style.zIndex=String(Math.round(R.depth*1e3))):I.style.display="none"}}function g(p,m={}){let b=qt++;return l.set(b,{id:b,polygons:p,transform:m}),d(),a(),{get id(){return b},get name(){return l.get(b)?.transform.id},get polygons(){return p},setTransform(A){let h=l.get(b);h&&(h.transform=A,d(),a())},dispose(){l.delete(b),d(),a()}}}function w(p,m){let b=n.ownerDocument.createElement("div");b.className="glyph-hotspot",b.setAttribute("data-hotspot-id",p.id);let[A,h]=p.size??[1,1];b.style.position="absolute",b.style.width=`${A}ch`,b.style.height=`${h*e.cellAspect}ch`,m&&b.addEventListener("click",m),s.appendChild(b);let C={hotspot:{id:p.id,at:p.at,size:p.size},el:b,onClick:m};return i.push(C),a(),{get el(){return b},remove(){let S=i.indexOf(C);S>=0&&i.splice(S,1),m&&b.removeEventListener("click",m),s.removeChild(b),a()}}}function x(){f()}function _(p){p.mode!==void 0&&(e.mode=p.mode),p.glyphPalette!==void 0&&(e.glyphPalette=p.glyphPalette),p.useColors!==void 0&&(e.useColors=p.useColors),p.cols!==void 0&&(e.cols=p.cols),p.rows!==void 0&&(e.rows=p.rows),p.cellAspect!==void 0&&(e.cellAspect=p.cellAspect),p.directionalLight!==void 0&&(e.directionalLight=p.directionalLight),p.ambientLight!==void 0&&(e.ambientLight=p.ambientLight),p.camera!==void 0&&(e.camera=p.camera),p.smoothShading!==void 0&&(e.smoothShading=p.smoothShading),p.creaseAngle!==void 0&&(e.creaseAngle=p.creaseAngle),"shadow"in p&&(e.shadow=p.shadow),p.autoSize!==void 0&&(e.autoSize=p.autoSize,e.autoSize&&!E&&typeof ResizeObserver<"u"?(E=new ResizeObserver(()=>y()),E.observe(n),y()):!e.autoSize&&E&&(E.disconnect(),E=null)),(p.mode!==void 0||p.useColors!==void 0||p.directionalLight!==void 0||p.ambientLight!==void 0||p.smoothShading!==void 0||p.creaseAngle!==void 0||p.glyphPalette!==void 0)&&d(),a()}function G(){return{...e}}function z(){let m=n.ownerDocument.createElement("span");m.textContent=Array(20).fill("M").join(`
63
+ `),m.style.cssText="position:absolute;visibility:hidden;font-family:inherit;font-size:inherit;line-height:inherit;white-space:pre;padding:0;margin:0",r.appendChild(m);let b=m.getBoundingClientRect();return m.remove(),{w:b.width||8,h:b.height?b.height/20:16}}function y(){let p=n.clientWidth,m=n.clientHeight;if(!p||!m)return;let b=z(),A=Math.max(20,Math.floor(p/b.w)),h=Math.max(8,Math.floor(m/b.h)),C=b.h/b.w,S=!1;e.cols!==A&&(e.cols=A,S=!0),e.rows!==h&&(e.rows=h,S=!0),Math.abs(e.cellAspect-C)>.01&&(e.cellAspect=C,S=!0),S&&a()}let E=null;e.autoSize&&typeof ResizeObserver<"u"&&(E=new ResizeObserver(()=>y()),E.observe(n),y());function L(){E&&(E.disconnect(),E=null),l.clear(),n.contains(o)&&n.removeChild(o)}return a(),{get host(){return n},get output(){return r},get camera(){return e.camera},add:g,addHotspot:w,rerender:x,setOptions:_,getOptions:G,fit:y,destroy:L}}var Kt=typeof HTMLElement<"u"?HTMLElement:class{},Zt=["mode","glyph-palette","use-colors","cols","rows","cell-aspect","directional-direction","directional-intensity","ambient-intensity","auto-size","shadow","shadow-color","shadow-opacity","shadow-lift","shadow-max-extend"];function te(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function Jt(n){if(n==="wireframe"||n==="solid"||n==="voxel")return n}function Qt(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}var Ce=class extends Kt{constructor(){super(...arguments);this._scene=null}static get observedAttributes(){return[...Zt]}getScene(){return this._scene}_readOptions(){let e={},o=Jt(this.getAttribute("mode"));o!==void 0&&(e.mode=o);let r=this.getAttribute("glyph-palette");r&&(e.glyphPalette=r);let s=Qt(this.getAttribute("use-colors"));s!==void 0&&(e.useColors=s);let l=te(this.getAttribute("cols"));l!==void 0&&(e.cols=l);let i=te(this.getAttribute("rows"));i!==void 0&&(e.rows=i);let c=te(this.getAttribute("cell-aspect"));c!==void 0&&(e.cellAspect=c);let u=te(this.getAttribute("directional-intensity"));u!==void 0&&(e.directionalLight={direction:[-.5,-.7,-.5],intensity:u});let d=te(this.getAttribute("ambient-intensity"));if(d!==void 0&&(e.ambientLight={intensity:d}),this.hasAttribute("auto-size")&&(e.autoSize=!0),this.hasAttribute("shadow")){let a={color:"#000000",opacity:.25,lift:.05,maxExtend:2e3},f=this.getAttribute("shadow-color");f&&(a.color=f);let v=te(this.getAttribute("shadow-opacity"));v!==void 0&&(a.opacity=v);let g=te(this.getAttribute("shadow-lift"));g!==void 0&&(a.lift=g);let w=te(this.getAttribute("shadow-max-extend"));w!==void 0&&(a.maxExtend=w),e.shadow=a}return e}_findCameraAncestor(){let e=this.parentElement;for(;e;){let o=e.tagName.toLowerCase();if(o==="glyph-perspective-camera"||o==="glyph-orthographic-camera"||o==="glyph-camera")return e;e=e.parentElement}return null}_initScene(e){let o=typeof e.getCamera=="function"?e.getCamera():void 0,r=this._readOptions();o&&(r.camera=o),this._scene=dt(this,r),this.dispatchEvent(new CustomEvent("glyphcss:scene-ready",{bubbles:!1}))}connectedCallback(){if(this._scene)return;let e=this._findCameraAncestor();if(!e)throw new Error("glyphcss: <glyph-scene> must be placed inside a <glyph-camera>, <glyph-perspective-camera>, or <glyph-orthographic-camera>.");if((typeof e.getCamera=="function"?e.getCamera():null)!==null)this._initScene(e);else{let r=()=>{e.removeEventListener("glyph:camera-ready",r),this._scene||this._initScene(e)};e.addEventListener("glyph:camera-ready",r)}}rerender(){this._scene?.rerender()}disconnectedCallback(){this._scene&&(this._scene.destroy(),this._scene=null)}attributeChangedCallback(e,o,r){o!==r&&this._scene&&this._scene.setOptions(this._readOptions())}};var me=require("@glyphcss/core"),en=typeof HTMLElement<"u"?HTMLElement:class{},tn=["src","geometry","size","color","position","scale","rotation","normalize","cast-shadow","receive-shadow"];function nn(n){let t=(0,me.computeSceneBbox)(n),e=(t.min[0]+t.max[0])/2,o=(t.min[1]+t.max[1])/2,r=(t.min[2]+t.max[2])/2,l=2/(Math.max(t.max[0]-t.min[0],t.max[1]-t.min[1],t.max[2]-t.min[2])||1);return n.map(i=>({...i,vertices:i.vertices.map(c=>[(c[0]-e)*l,(c[1]-o)*l,(c[2]-r)*l])}))}function qe(n){if(!n)return;let t=n.split(",").map(e=>parseFloat(e.trim()));if(!(t.length!==3||t.some(e=>!Number.isFinite(e))))return[t[0],t[1],t[2]]}function rn(n){if(n){if(!n.includes(",")){let t=parseFloat(n);return Number.isFinite(t)?t:void 0}return qe(n)}}function on(n){return n.closest("glyph-scene")??null}var Ae=class extends en{constructor(){super(...arguments);this._handle=null;this._loadToken=0}static get observedAttributes(){return[...tn]}getMeshHandle(){return this._handle}connectedCallback(){this._maybeLoad()}disconnectedCallback(){this._tearDown()}attributeChangedCallback(e,o,r){if(o!==r){if(e==="src"||e==="geometry"||e==="size"||e==="color"){this._tearDown(),this._maybeLoad();return}this._handle&&this._handle.setTransform(this._readTransform())}}_readTransform(){return{position:qe(this.getAttribute("position")),scale:rn(this.getAttribute("scale")),rotation:qe(this.getAttribute("rotation")),castShadow:this.hasAttribute("cast-shadow"),receiveShadow:this.hasAttribute("receive-shadow")}}_tearDown(){if(this._loadToken+=1,this._handle){try{this._handle.dispose()}catch{}this._handle=null}}async _maybeLoad(){let e=this.getAttribute("src"),o=this.getAttribute("geometry"),r=on(this);if(r){if(!r.getScene()){let s=()=>{r.removeEventListener("glyphcss:scene-ready",s),this._maybeLoad()};r.addEventListener("glyphcss:scene-ready",s);return}if(e){let s=++this._loadToken,l;try{l=await(0,me.loadMesh)(e)}catch(d){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:d,bubbles:!0}));return}if(s!==this._loadToken){try{l.dispose()}catch{}return}let i=r.getScene();if(!i){try{l.dispose()}catch{}return}let u=this.hasAttribute("normalize")?nn(l.polygons):l.polygons;this._handle=i.add(u,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:u},bubbles:!0}));return}if(o){let s=r.getScene();if(!s)return;let l=this.getAttribute("size"),i=l!==null?parseFloat(l):1,c=this.getAttribute("color")??void 0,u;try{u=(0,me.resolveGeometry)(o,{size:Number.isFinite(i)?i:1,color:c})}catch(d){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:d,bubbles:!0}));return}this._handle=s.add(u,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:u},bubbles:!0}))}}}};var sn=typeof HTMLElement<"u"?HTMLElement:class{};function ln(n){if(!n)return;let t=n.split(",").map(e=>parseFloat(e.trim()));if(!(t.length!==3||t.some(e=>!Number.isFinite(e))))return[t[0],t[1],t[2]]}function an(n){if(!n)return;let t=n.split(",").map(e=>parseFloat(e.trim()));if(!(t.length!==2||t.some(e=>!Number.isFinite(e))))return[t[0],t[1]]}function cn(n){return n.closest("glyph-scene")??null}var Me=class extends sn{constructor(){super(...arguments);this._handle=null}static get observedAttributes(){return["at","size","hotspot-id"]}connectedCallback(){this._register()}disconnectedCallback(){this._handle&&this._unregister()}attributeChangedCallback(e,o,r){o!==r&&(this._handle&&this._unregister(),this._register())}_unregister(){if(!this._handle)return;let e=this._handle.el;for(;e.firstChild;)this.appendChild(e.firstChild);this._handle.remove(),this._handle=null}_register(){let e=ln(this.getAttribute("at"));if(!e)return;let o=cn(this);if(!o)return;if(!o.getScene()){let c=()=>{o.removeEventListener("glyphcss:scene-ready",c),this._register()};o.addEventListener("glyphcss:scene-ready",c);return}let r=o.getScene();if(!r)return;let s=this.getAttribute("hotspot-id")??this.getAttribute("id")??String(Math.random()),l=an(this.getAttribute("size"));this._handle=r.addHotspot({id:s,at:e,size:l},()=>this.dispatchEvent(new CustomEvent("glyphcss:hotspot-click",{detail:{id:s},bubbles:!0})));let i=this._handle.el;for(;this.firstChild;)i.appendChild(this.firstChild)}};var un=typeof HTMLElement<"u"?HTMLElement:class{};function j(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var xe=class extends un{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","distance","zoom","stretch"]}getCamera(){return this._camera}connectedCallback(){this._camera=Te({rotX:j(this.getAttribute("rot-x")),rotY:j(this.getAttribute("rot-y")),distance:j(this.getAttribute("distance")),zoom:j(this.getAttribute("zoom")),stretch:j(this.getAttribute("stretch"))}),this.dispatchEvent(new CustomEvent("glyph:camera-ready",{bubbles:!1}))}disconnectedCallback(){this._camera=null}attributeChangedCallback(e,o,r){if(o===r)return;let s=this._camera;if(!s)return;let l=j(this.getAttribute("rot-x")),i=j(this.getAttribute("rot-y")),c=j(this.getAttribute("distance")),u=j(this.getAttribute("zoom")),d=j(this.getAttribute("stretch")),a=!1;l!==void 0&&s.rotX!==l&&(s.rotX=l,a=!0),i!==void 0&&s.rotY!==i&&(s.rotY=i,a=!0),c!==void 0&&s.distance!==c&&(s.distance=c,a=!0),u!==void 0&&s.zoom!==u&&(s.zoom=u,a=!0),d!==void 0&&s.stretch!==d&&(s.stretch=d,a=!0),a&&this.querySelector("glyph-scene")?.rerender?.()}};var dn=typeof HTMLElement<"u"?HTMLElement:class{};function pe(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var fe=class extends dn{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","zoom"]}getCamera(){return this._camera}connectedCallback(){this._camera=ot({rotX:pe(this.getAttribute("rot-x")),rotY:pe(this.getAttribute("rot-y")),zoom:pe(this.getAttribute("zoom"))}),this.dispatchEvent(new CustomEvent("glyph:camera-ready",{bubbles:!1}))}disconnectedCallback(){this._camera=null}attributeChangedCallback(e,o,r){if(o===r)return;let s=this._camera;if(!s)return;let l=pe(this.getAttribute("rot-x")),i=pe(this.getAttribute("rot-y")),c=pe(this.getAttribute("zoom")),u=!1;l!==void 0&&s.rotX!==l&&(s.rotX=l,u=!0),i!==void 0&&s.rotY!==i&&(s.rotY=i,u=!0),c!==void 0&&s.zoom!==c&&(s.zoom=c,u=!0),u&&this.querySelector("glyph-scene")?.rerender?.()}};function mt(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,s=ht(t.invert),l=t.clampPitch??!0,i=t.animate??!1,c=!1,u=!1,d=null,a=null,f=null,v={x:0,y:0},g=n.camera;function w(m){if(!(!o||c)&&f===null&&m.isPrimary!==!1){m.preventDefault(),f=m.pointerId,v={x:m.clientX,y:m.clientY},e.style.cursor="grabbing";try{m.target.setPointerCapture(m.pointerId)}catch{}i&&i.pauseOnInteraction!==!1&&(u=!0)}}function x(m){if(f===null||m.pointerId!==f||!o||c)return;m.preventDefault();let b=m.clientX-v.x,A=m.clientY-v.y;v={x:m.clientX,y:m.clientY};let h=s,C=1/4;g.rotY=g.rotY-b*C*h;let S=g.rotX-A*C*h;g.rotX=l?Math.max(-90,Math.min(90,S)):S,n.rerender()}function _(m){if(f===m.pointerId){f=null,e.style.cursor=o&&!c?"grab":"";try{m.target.releasePointerCapture(m.pointerId)}catch{}i&&(u=!1)}}function G(m){if(!r||c)return;m.preventDefault();let b=m.deltaY*.001;g.zoom=Math.max(.1,Math.min(500,g.zoom*(1-b))),n.rerender()}function z(m){if(!(c||!i)){if(!u){let b=a!==null?Math.min(m-a,50):16.67,A=typeof i=="object"&&i.speed?i.speed:.3,h=typeof i=="object"&&i.axis?i.axis:"y",C=A*(b/16.67);h==="y"?g.rotY=g.rotY+C:g.rotX=g.rotX+C,n.rerender()}a=m,d=requestAnimationFrame(z)}}function y(){d===null&&typeof requestAnimationFrame<"u"&&i&&(d=requestAnimationFrame(z))}function E(){d!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(d),d=null),a=null}function L(){e.addEventListener("pointerdown",w),e.addEventListener("pointermove",x),e.addEventListener("pointerup",_),e.addEventListener("pointercancel",_),e.addEventListener("wheel",G,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function p(){e.removeEventListener("pointerdown",w),e.removeEventListener("pointermove",x),e.removeEventListener("pointerup",_),e.removeEventListener("pointercancel",_),e.removeEventListener("wheel",G),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return L(),y(),{update(m){let b=!!i;o=m.drag??o,r=m.wheel??r,s=ht(m.invert),m.clampPitch!==void 0&&(l=m.clampPitch),i=m.animate??i,!c&&f===null&&(e.style.cursor=o?"grab":"");let A=!!i;b&&!A?E():!b&&A&&y()},pause(){c||(c=!0,p(),E(),f=null,u=!1)},resume(){c&&(c=!1,L(),y())},destroy(){c||p(),E(),c=!0}}}function ht(n){return n===void 0||n===!1?1:n===!0?-1:n}var hn=typeof HTMLElement<"u"?HTMLElement:class{};function mn(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function ze(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function pn(n){return n.closest("glyph-scene")??null}var Se=class extends hn{constructor(){super(...arguments);this._controls=null}static get observedAttributes(){return["drag","wheel","invert","clamp-pitch","animate-speed","animate-axis"]}connectedCallback(){this._attach()}disconnectedCallback(){this._controls&&(this._controls.destroy(),this._controls=null)}attributeChangedCallback(e,o,r){o!==r&&this._controls?.update(this._readOptions())}_readOptions(){let e=ze(this.getAttribute("drag")),o=ze(this.getAttribute("wheel")),r=ze(this.getAttribute("invert")),s=ze(this.getAttribute("clamp-pitch")),l=mn(this.getAttribute("animate-speed")),i=this.getAttribute("animate-axis")==="x"?"x":"y";return{...e!==void 0?{drag:e}:{},...o!==void 0?{wheel:o}:{},...r!==void 0?{invert:r}:{},...s!==void 0?{clampPitch:s}:{},...l!==void 0?{animate:{speed:l,axis:i}}:{}}}_attach(){if(this._controls)return;let e=pn(this);if(!e)return;let o=e.getScene();if(!o){let r=()=>{e.removeEventListener("glyphcss:scene-ready",r),this._attach()};e.addEventListener("glyphcss:scene-ready",r);return}this._controls=mt(o,this._readOptions())}};function ft(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,s=pt(t.invert),l=t.animate??!1,i=!1,c=!1,u=null,d=null,a=null,f={x:0,y:0},v=!1,g=n.camera,w=1/4,x=.02;function _(h){if(!(!o||i)&&a===null&&h.isPrimary!==!1){h.preventDefault(),a=h.pointerId,f={x:h.clientX,y:h.clientY},v=h.button===2,e.style.cursor="grabbing";try{h.target.setPointerCapture(h.pointerId)}catch{}l&&l.pauseOnInteraction!==!1&&(c=!0)}}function G(h){if(a===null||h.pointerId!==a||!o||i)return;h.preventDefault();let C=h.clientX-f.x,S=h.clientY-f.y;f={x:h.clientX,y:h.clientY};let H=s;if(v||h.shiftKey)g.rotY=g.rotY-C*w*H,g.rotX=Math.max(-90,Math.min(90,g.rotX+S*w*H));else{let T=g.target;g.target=[T[0]-C*x/g.zoom,T[1]-S*x/g.zoom,T[2]]}n.rerender()}function z(h){if(a===h.pointerId){a=null,v=!1,e.style.cursor=o&&!i?"grab":"";try{h.target.releasePointerCapture(h.pointerId)}catch{}l&&(c=!1)}}function y(h){h.preventDefault()}function E(h){if(!r||i)return;h.preventDefault();let C=h.deltaY*.001;g.zoom=Math.max(.1,Math.min(500,g.zoom*(1-C))),n.rerender()}function L(h){if(!(i||!l)){if(!c){let C=d!==null?Math.min(h-d,50):16.67,S=typeof l=="object"&&l.speed?l.speed:.3,H=typeof l=="object"&&l.axis?l.axis:"y",T=S*(C/16.67);H==="y"?g.rotY=g.rotY+T:g.rotX=g.rotX+T,n.rerender()}d=h,u=requestAnimationFrame(L)}}function p(){u===null&&typeof requestAnimationFrame<"u"&&l&&(u=requestAnimationFrame(L))}function m(){u!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(u),u=null),d=null}function b(){e.addEventListener("pointerdown",_),e.addEventListener("pointermove",G),e.addEventListener("pointerup",z),e.addEventListener("pointercancel",z),e.addEventListener("contextmenu",y),e.addEventListener("wheel",E,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function A(){e.removeEventListener("pointerdown",_),e.removeEventListener("pointermove",G),e.removeEventListener("pointerup",z),e.removeEventListener("pointercancel",z),e.removeEventListener("contextmenu",y),e.removeEventListener("wheel",E),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return b(),p(),{update(h){let C=!!l;o=h.drag??o,r=h.wheel??r,s=pt(h.invert),l=h.animate??l,!i&&a===null&&(e.style.cursor=o?"grab":"");let S=!!l;C&&!S?m():!C&&S&&p()},pause(){i||(i=!0,A(),m(),a=null,c=!1)},resume(){i&&(i=!1,b(),p())},destroy(){i||A(),m(),i=!0}}}function pt(n){return n===void 0||n===!1?1:n===!0?-1:n}var fn=typeof HTMLElement<"u"?HTMLElement:class{};function Ue(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function gn(n){return n.closest("glyph-scene")??null}var Ge=class extends fn{constructor(){super(...arguments);this._controls=null}static get observedAttributes(){return["drag","wheel","invert"]}connectedCallback(){this._attach()}disconnectedCallback(){this._controls&&(this._controls.destroy(),this._controls=null)}attributeChangedCallback(e,o,r){o!==r&&this._controls?.update(this._readOptions())}_readOptions(){let e=Ue(this.getAttribute("drag")),o=Ue(this.getAttribute("wheel")),r=Ue(this.getAttribute("invert"));return{...e!==void 0?{drag:e}:{},...o!==void 0?{wheel:o}:{},...r!==void 0?{invert:r}:{}}}_attach(){if(this._controls)return;let e=gn(this);if(!e)return;let o=e.getScene();if(!o){let r=()=>{e.removeEventListener("glyphcss:scene-ready",r),this._attach()};e.addEventListener("glyphcss:scene-ready",r);return}this._controls=ft(o,this._readOptions())}};if(typeof customElements<"u"){if(customElements.get("glyph-scene")||customElements.define("glyph-scene",Ce),customElements.get("glyph-mesh")||customElements.define("glyph-mesh",Ae),customElements.get("glyph-hotspot")||customElements.define("glyph-hotspot",Me),customElements.get("glyph-perspective-camera")||customElements.define("glyph-perspective-camera",xe),customElements.get("glyph-orthographic-camera")||customElements.define("glyph-orthographic-camera",fe),!customElements.get("glyph-camera")){class n extends fe{}customElements.define("glyph-camera",n)}customElements.get("glyph-orbit-controls")||customElements.define("glyph-orbit-controls",Se),customElements.get("glyph-map-controls")||customElements.define("glyph-map-controls",Ge)}0&&(module.exports={GlyphHotspotElement,GlyphMapControlsElement,GlyphMeshElement,GlyphOrbitControlsElement,GlyphOrthographicCameraElement,GlyphPerspectiveCameraElement,GlyphSceneElement});
@@ -1,2 +1,2 @@
1
- export { d as GlyphHotspotElement, g as GlyphMapControlsElement, h as GlyphMeshElement, k as GlyphOrbitControlsElement, l as GlyphOrthographicCameraElement, o as GlyphPerspectiveCameraElement, r as GlyphSceneElement } from './elements-DVWVBIG0.cjs';
1
+ export { e as GlyphHotspotElement, h as GlyphMapControlsElement, i as GlyphMeshElement, l as GlyphOrbitControlsElement, m as GlyphOrthographicCameraElement, p as GlyphPerspectiveCameraElement, s as GlyphSceneElement } from './elements-dJUvIMDN.cjs';
2
2
  import '@glyphcss/core';
@@ -1,2 +1,2 @@
1
- export { d as GlyphHotspotElement, g as GlyphMapControlsElement, h as GlyphMeshElement, k as GlyphOrbitControlsElement, l as GlyphOrthographicCameraElement, o as GlyphPerspectiveCameraElement, r as GlyphSceneElement } from './elements-DVWVBIG0.js';
1
+ export { e as GlyphHotspotElement, h as GlyphMapControlsElement, i as GlyphMeshElement, l as GlyphOrbitControlsElement, m as GlyphOrthographicCameraElement, p as GlyphPerspectiveCameraElement, s as GlyphSceneElement } from './elements-dJUvIMDN.js';
2
2
  import '@glyphcss/core';