glyphcss 0.0.4 → 0.0.6

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,11 +1,24 @@
1
1
  import { Vec3, Polygon, RenderMode } from '@glyphcss/core';
2
2
 
3
+ /**
4
+ * Default CSS-perspective distance in virtual pixels — mirrors voxcss/polycss
5
+ * `DEFAULT_PERSPECTIVE`. Large enough that perspective foreshortening is gentle
6
+ * (a normal scene only spans a few hundred px), so the on-screen result matches
7
+ * polycss out of the box.
8
+ */
9
+ declare const DEFAULT_PERSPECTIVE = 32000;
3
10
  interface GlyphCamera {
4
11
  readonly kind: "perspective" | "orthographic";
5
12
  rotX: number;
6
13
  rotY: number;
7
14
  /** Distance from target along the view axis. For perspective cameras: world units. Default 0. */
8
15
  distance: number;
16
+ /**
17
+ * CSS-perspective distance in virtual pixels (voxcss parity). When > 0, the
18
+ * camera projects with the browser's `P / (P − z)` CSS-perspective math.
19
+ * Default 0 (disabled).
20
+ */
21
+ perspective: number;
9
22
  /**
10
23
  * Camera zoom — CSS scale multiplier (same semantic as voxcss).
11
24
  * `zoom = 1` → one world unit = BASE_TILE (50) virtual pixels.
@@ -14,6 +27,16 @@ interface GlyphCamera {
14
27
  zoom: number;
15
28
  /** Extra horizontal stretch on top of `cellAspect`. */
16
29
  stretch: number;
30
+ /**
31
+ * Isotropic field-of-view scale applied to the projected screen offset (around
32
+ * the center), independent of the perspective divide. `1` = off. Use it to
33
+ * decouple the FOV from the grid resolution: when the grid grows (e.g. a
34
+ * smaller line-height adds rows), the FOV would otherwise widen — set
35
+ * `fovScale` proportional to the resolution change to keep it fixed. Unlike
36
+ * `zoom`, it does NOT alter perspective foreshortening (zoom scales `cssZ`,
37
+ * shifting the `P/(P−z)` divide; this only scales the post-divide offset).
38
+ */
39
+ fovScale: number;
17
40
  /**
18
41
  * Camera target offset in world space — shifts the point the camera orbits around.
19
42
  * Subtracted from world coords before projection so the mesh appears to pan without re-baking.
@@ -26,8 +49,27 @@ interface GlyphCamera {
26
49
  * `createGlyphFirstPersonControls` at attach / detach time.
27
50
  */
28
51
  eyeMode: boolean;
29
- /** Project a world-space vector to `[col, row, depth]`. Same projection used by the renderer and the hit layer. */
30
- project(v: Vec3, cols: number, rows: number, cellAspect: number): [number, number, number];
52
+ /**
53
+ * Project a world-space vector to `[col, row, depth, zbuf?]`. `depth` is the
54
+ * linear eye-space `cssZ` (the public contract, used by the hit layer). The
55
+ * optional 4th element `zbuf` is the **screen-space-linear** depth (`1/denom`)
56
+ * for perspective cameras — the renderer's z-buffer must use it (not `depth`)
57
+ * so the depth test is perspective-correct: interpolating linear `cssZ` with
58
+ * screen-space barycentric weights misorders overlapping triangles, which
59
+ * shows the wrong (farther) surface in some cells and flickers under motion.
60
+ * Orthographic cameras omit it (their linear `depth` is already screen-linear).
61
+ */
62
+ project(v: Vec3, cols: number, rows: number, cellAspect: number): [number, number, number, number?];
63
+ /**
64
+ * Signed distance of a world vertex past the near plane: `> 0` is visible
65
+ * (in front of the near plane), `<= 0` is culled (at/behind the eye). The
66
+ * near plane sits at `eyeDepth = 0`, so an edge crossing the near plane is
67
+ * found by linear interpolation where `eyeDepth` changes sign. The renderer
68
+ * uses this for near-plane clipping; `eyeDepth` is affine in `v`, so the
69
+ * world-space crossing point interpolates linearly. Orthographic cameras
70
+ * return `+Infinity` (never clipped).
71
+ */
72
+ eyeDepth(v: Vec3): number;
31
73
  }
32
74
  interface GlyphPerspectiveCameraOptions {
33
75
  /**
@@ -45,6 +87,17 @@ interface GlyphPerspectiveCameraOptions {
45
87
  * smaller = more dramatic. Default 6.
46
88
  */
47
89
  distance?: number;
90
+ /**
91
+ * CSS-perspective distance in **virtual pixels**, matching voxcss/polycss
92
+ * `createPolyPerspectiveCamera({ perspective })`. When > 0, the camera projects
93
+ * with the same `P / (P − z)` pinhole math the browser applies for CSS
94
+ * `perspective: Npx` — so identical camera params (rotX/rotY/target/zoom/
95
+ * distance/perspective) produce the same on-screen projection as polycss, and
96
+ * a first-person view falls out naturally (no `eyeMode` needed). Default
97
+ * {@link DEFAULT_PERSPECTIVE} (32000), matching voxcss. Set to 0 to disable
98
+ * (→ legacy orbit projection using `distance` in world units).
99
+ */
100
+ perspective?: number;
48
101
  /**
49
102
  * Camera zoom — CSS scale multiplier. Default 0.3.
50
103
  * `zoom = 1` → BASE_TILE (50) virtual px per world unit.
@@ -55,6 +108,8 @@ interface GlyphPerspectiveCameraOptions {
55
108
  * over-stretching when monospace cells are taller than wide. Default 1.0.
56
109
  */
57
110
  stretch?: number;
111
+ /** Isotropic FOV scale on the projected offset (resolution-independent FOV). Default 1. */
112
+ fovScale?: number;
58
113
  /** Center of projection in normalized grid coords. Default `[0.5, 0.5]`. */
59
114
  center?: [number, number];
60
115
  }
@@ -125,6 +180,15 @@ interface GlyphMeshTransform {
125
180
  castShadow?: boolean;
126
181
  /** This mesh receives (displays) shadows from castShadow meshes. Default false. */
127
182
  receiveShadow?: boolean;
183
+ /**
184
+ * Relative depth bias (0 = off). Nudges this mesh toward (positive) or away
185
+ * from (negative) the camera in the depth test via `pixelDepth *= 1 + depthBias`
186
+ * — resolving z-fighting against coplanar/coincident geometry. A CSS/DOM
187
+ * renderer decides coincident surfaces by stacking order for free; a
188
+ * projection-painted depth buffer fights, so a tiny bias (e.g. 0.002) lets a
189
+ * dynamic surface (a door/platform flush into a wall/floor) win cleanly.
190
+ */
191
+ depthBias?: number;
128
192
  }
129
193
 
130
194
  /**
@@ -184,6 +248,32 @@ interface GlyphSceneOptions {
184
248
  * Default `60`.
185
249
  */
186
250
  creaseAngle?: number;
251
+ /**
252
+ * Render both faces of every polygon (no backface culling). Default `false`.
253
+ * Set `true` for single-sided surfaces whose winding isn't guaranteed to face
254
+ * the camera — e.g. BSP level geometry — so "back-wound" faces don't vanish,
255
+ * matching how a CSS/DOM renderer shows both sides.
256
+ */
257
+ doubleSided?: boolean;
258
+ /**
259
+ * Supersampled anti-aliasing (solid mode). `1` (default) = off; `2`/`3`
260
+ * rasterize at N× resolution and average down, removing the motion crawl of
261
+ * sub-cell-sized surfaces. Cost ~N².
262
+ */
263
+ supersample?: number;
264
+ /**
265
+ * Global depth-test deadband (0 = exact, default). A polygon replaces a cell
266
+ * only when nearer by more than this relative fraction, so near-coplanar
267
+ * surfaces keep a stable winner instead of z-fighting per-cell as the camera
268
+ * moves (the tearing a CSS/DOM renderer avoids via stacking order). 0.002–0.01.
269
+ */
270
+ depthEpsilon?: number;
271
+ /**
272
+ * Temporal anti-aliasing — exponential blend with the previous frame, weight
273
+ * in [0,1). `0` (default) = off. Smooths fast frame-to-frame edge crawl that
274
+ * supersampling can't cover, at the cost of motion ghosting.
275
+ */
276
+ temporalBlend?: number;
187
277
  /**
188
278
  * Auto-size the character grid to fill the host element. When `true`, the
189
279
  * scene measures one monospace character's pixel size from the live `<pre>`
@@ -339,4 +429,4 @@ declare class GlyphMapControlsElement extends ELEMENT_BASE {
339
429
  private _attach;
340
430
  }
341
431
 
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 };
432
+ export { DEFAULT_PERSPECTIVE as D, 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,11 +1,24 @@
1
1
  import { Vec3, Polygon, RenderMode } from '@glyphcss/core';
2
2
 
3
+ /**
4
+ * Default CSS-perspective distance in virtual pixels — mirrors voxcss/polycss
5
+ * `DEFAULT_PERSPECTIVE`. Large enough that perspective foreshortening is gentle
6
+ * (a normal scene only spans a few hundred px), so the on-screen result matches
7
+ * polycss out of the box.
8
+ */
9
+ declare const DEFAULT_PERSPECTIVE = 32000;
3
10
  interface GlyphCamera {
4
11
  readonly kind: "perspective" | "orthographic";
5
12
  rotX: number;
6
13
  rotY: number;
7
14
  /** Distance from target along the view axis. For perspective cameras: world units. Default 0. */
8
15
  distance: number;
16
+ /**
17
+ * CSS-perspective distance in virtual pixels (voxcss parity). When > 0, the
18
+ * camera projects with the browser's `P / (P − z)` CSS-perspective math.
19
+ * Default 0 (disabled).
20
+ */
21
+ perspective: number;
9
22
  /**
10
23
  * Camera zoom — CSS scale multiplier (same semantic as voxcss).
11
24
  * `zoom = 1` → one world unit = BASE_TILE (50) virtual pixels.
@@ -14,6 +27,16 @@ interface GlyphCamera {
14
27
  zoom: number;
15
28
  /** Extra horizontal stretch on top of `cellAspect`. */
16
29
  stretch: number;
30
+ /**
31
+ * Isotropic field-of-view scale applied to the projected screen offset (around
32
+ * the center), independent of the perspective divide. `1` = off. Use it to
33
+ * decouple the FOV from the grid resolution: when the grid grows (e.g. a
34
+ * smaller line-height adds rows), the FOV would otherwise widen — set
35
+ * `fovScale` proportional to the resolution change to keep it fixed. Unlike
36
+ * `zoom`, it does NOT alter perspective foreshortening (zoom scales `cssZ`,
37
+ * shifting the `P/(P−z)` divide; this only scales the post-divide offset).
38
+ */
39
+ fovScale: number;
17
40
  /**
18
41
  * Camera target offset in world space — shifts the point the camera orbits around.
19
42
  * Subtracted from world coords before projection so the mesh appears to pan without re-baking.
@@ -26,8 +49,27 @@ interface GlyphCamera {
26
49
  * `createGlyphFirstPersonControls` at attach / detach time.
27
50
  */
28
51
  eyeMode: boolean;
29
- /** Project a world-space vector to `[col, row, depth]`. Same projection used by the renderer and the hit layer. */
30
- project(v: Vec3, cols: number, rows: number, cellAspect: number): [number, number, number];
52
+ /**
53
+ * Project a world-space vector to `[col, row, depth, zbuf?]`. `depth` is the
54
+ * linear eye-space `cssZ` (the public contract, used by the hit layer). The
55
+ * optional 4th element `zbuf` is the **screen-space-linear** depth (`1/denom`)
56
+ * for perspective cameras — the renderer's z-buffer must use it (not `depth`)
57
+ * so the depth test is perspective-correct: interpolating linear `cssZ` with
58
+ * screen-space barycentric weights misorders overlapping triangles, which
59
+ * shows the wrong (farther) surface in some cells and flickers under motion.
60
+ * Orthographic cameras omit it (their linear `depth` is already screen-linear).
61
+ */
62
+ project(v: Vec3, cols: number, rows: number, cellAspect: number): [number, number, number, number?];
63
+ /**
64
+ * Signed distance of a world vertex past the near plane: `> 0` is visible
65
+ * (in front of the near plane), `<= 0` is culled (at/behind the eye). The
66
+ * near plane sits at `eyeDepth = 0`, so an edge crossing the near plane is
67
+ * found by linear interpolation where `eyeDepth` changes sign. The renderer
68
+ * uses this for near-plane clipping; `eyeDepth` is affine in `v`, so the
69
+ * world-space crossing point interpolates linearly. Orthographic cameras
70
+ * return `+Infinity` (never clipped).
71
+ */
72
+ eyeDepth(v: Vec3): number;
31
73
  }
32
74
  interface GlyphPerspectiveCameraOptions {
33
75
  /**
@@ -45,6 +87,17 @@ interface GlyphPerspectiveCameraOptions {
45
87
  * smaller = more dramatic. Default 6.
46
88
  */
47
89
  distance?: number;
90
+ /**
91
+ * CSS-perspective distance in **virtual pixels**, matching voxcss/polycss
92
+ * `createPolyPerspectiveCamera({ perspective })`. When > 0, the camera projects
93
+ * with the same `P / (P − z)` pinhole math the browser applies for CSS
94
+ * `perspective: Npx` — so identical camera params (rotX/rotY/target/zoom/
95
+ * distance/perspective) produce the same on-screen projection as polycss, and
96
+ * a first-person view falls out naturally (no `eyeMode` needed). Default
97
+ * {@link DEFAULT_PERSPECTIVE} (32000), matching voxcss. Set to 0 to disable
98
+ * (→ legacy orbit projection using `distance` in world units).
99
+ */
100
+ perspective?: number;
48
101
  /**
49
102
  * Camera zoom — CSS scale multiplier. Default 0.3.
50
103
  * `zoom = 1` → BASE_TILE (50) virtual px per world unit.
@@ -55,6 +108,8 @@ interface GlyphPerspectiveCameraOptions {
55
108
  * over-stretching when monospace cells are taller than wide. Default 1.0.
56
109
  */
57
110
  stretch?: number;
111
+ /** Isotropic FOV scale on the projected offset (resolution-independent FOV). Default 1. */
112
+ fovScale?: number;
58
113
  /** Center of projection in normalized grid coords. Default `[0.5, 0.5]`. */
59
114
  center?: [number, number];
60
115
  }
@@ -125,6 +180,15 @@ interface GlyphMeshTransform {
125
180
  castShadow?: boolean;
126
181
  /** This mesh receives (displays) shadows from castShadow meshes. Default false. */
127
182
  receiveShadow?: boolean;
183
+ /**
184
+ * Relative depth bias (0 = off). Nudges this mesh toward (positive) or away
185
+ * from (negative) the camera in the depth test via `pixelDepth *= 1 + depthBias`
186
+ * — resolving z-fighting against coplanar/coincident geometry. A CSS/DOM
187
+ * renderer decides coincident surfaces by stacking order for free; a
188
+ * projection-painted depth buffer fights, so a tiny bias (e.g. 0.002) lets a
189
+ * dynamic surface (a door/platform flush into a wall/floor) win cleanly.
190
+ */
191
+ depthBias?: number;
128
192
  }
129
193
 
130
194
  /**
@@ -184,6 +248,32 @@ interface GlyphSceneOptions {
184
248
  * Default `60`.
185
249
  */
186
250
  creaseAngle?: number;
251
+ /**
252
+ * Render both faces of every polygon (no backface culling). Default `false`.
253
+ * Set `true` for single-sided surfaces whose winding isn't guaranteed to face
254
+ * the camera — e.g. BSP level geometry — so "back-wound" faces don't vanish,
255
+ * matching how a CSS/DOM renderer shows both sides.
256
+ */
257
+ doubleSided?: boolean;
258
+ /**
259
+ * Supersampled anti-aliasing (solid mode). `1` (default) = off; `2`/`3`
260
+ * rasterize at N× resolution and average down, removing the motion crawl of
261
+ * sub-cell-sized surfaces. Cost ~N².
262
+ */
263
+ supersample?: number;
264
+ /**
265
+ * Global depth-test deadband (0 = exact, default). A polygon replaces a cell
266
+ * only when nearer by more than this relative fraction, so near-coplanar
267
+ * surfaces keep a stable winner instead of z-fighting per-cell as the camera
268
+ * moves (the tearing a CSS/DOM renderer avoids via stacking order). 0.002–0.01.
269
+ */
270
+ depthEpsilon?: number;
271
+ /**
272
+ * Temporal anti-aliasing — exponential blend with the previous frame, weight
273
+ * in [0,1). `0` (default) = off. Smooths fast frame-to-frame edge crawl that
274
+ * supersampling can't cover, at the cost of motion ghosting.
275
+ */
276
+ temporalBlend?: number;
187
277
  /**
188
278
  * Auto-size the character grid to fill the host element. When `true`, the
189
279
  * scene measures one monospace character's pixel size from the live `<pre>`
@@ -339,4 +429,4 @@ declare class GlyphMapControlsElement extends ELEMENT_BASE {
339
429
  private _attach;
340
430
  }
341
431
 
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 };
432
+ export { DEFAULT_PERSPECTIVE as D, 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 $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=`
1
+ "use strict";var mt=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var en=Object.prototype.hasOwnProperty;var tn=(n,t)=>{for(var e in t)mt(n,e,{get:t[e],enumerable:!0})},nn=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Qt(t))!en.call(n,r)&&r!==e&&mt(n,r,{get:()=>t[r],enumerable:!(o=Jt(t,r))||o.enumerable});return n};var rn=n=>nn(mt({},"__esModule",{value:!0}),n);var Xn={};tn(Xn,{GlyphHotspotElement:()=>We,GlyphMapControlsElement:()=>Ue,GlyphMeshElement:()=>$e,GlyphOrbitControlsElement:()=>qe,GlyphOrthographicCameraElement:()=>Ne,GlyphPerspectiveCameraElement:()=>je,GlyphSceneElement:()=>Ve});module.exports=rn(Xn);var Bt=require("@glyphcss/core");var Gt=Math.PI/180,Lt=.01,on=32e3,sn=Lt*1.01;function ft(n,t,e){let o=n[1],r=n[0],l=n[2],a=e*Gt,i=Math.cos(a),c=Math.sin(a),u=o*i-r*c,p=o*c+r*i,d=l,h=t*Gt,m=Math.cos(h),f=Math.sin(h),b=p*m-d*f,C=p*f+d*m;return[u,b,C]}function Ie(n={}){let t={rotX:n.rotX??65,rotY:n.rotY??45,distance:n.distance??6,perspective:n.perspective??on,zoom:n.zoom??.65,stretch:n.stretch??1,fovScale:n.fovScale??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 perspective(){return t.perspective},set perspective(r){t.perspective=r},get zoom(){return t.zoom},set zoom(r){t.zoom=r},get stretch(){return t.stretch},set stretch(r){t.stretch=r},get fovScale(){return t.fovScale},set fovScale(r){t.fovScale=r},get target(){return t.target},set target(r){t.target=r},get eyeMode(){return t.eyeMode},set eyeMode(r){t.eyeMode=r},eyeDepth(r){let l=ft([r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],t.rotX,t.rotY),a=.001*1.01;if(t.eyeMode)return-l[2]-a;if(t.perspective>0){let i=l[2]*t.zoom*50-t.distance;return t.perspective-i-t.perspective*sn}return t.distance-l[2]-a},project(r,l,a,i){let u=50/i,p=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],d=ft(p,t.rotX,t.rotY);if(t.eyeMode){if(d[2]>=-.001)return[NaN,NaN,d[2],NaN];let y=t.focal/-d[2],w=d[0]*y*t.zoom*50,P=d[1]*y*t.zoom*50,H=l*e+w/u*t.stretch,v=a*o+P/50;return[H,v,d[2],-1/d[2]]}if(t.perspective>0){let M=t.perspective,y=d[0]*t.zoom*50,w=d[1]*t.zoom*50,P=d[2]*t.zoom*50-t.distance,H=M-P,v=M*Lt;if(H<v)return[NaN,NaN,P,NaN];let A=M/H,L=l*e+y*A/u*t.stretch*t.fovScale,s=a*o+w*A/50*t.fovScale;return[L,s,P,1/H]}let h=.001,m=t.distance-d[2];if(m<h)return[NaN,NaN,d[2],NaN];let f=t.distance/m,b=d[0]*f*t.zoom*50,C=d[1]*f*t.zoom*50,_=l*e+b/u*t.stretch*t.fovScale,x=a*o+C/50*t.fovScale;return[_,x,d[2],1/m]}}}function Tt(n={}){let t={rotX:n.rotX??65,rotY:n.rotY??45,distance:0,zoom:n.zoom??.65,stretch:1,fovScale: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 perspective(){return 0},set perspective(r){},get zoom(){return t.zoom},set zoom(r){t.zoom=r},get stretch(){return t.stretch},set stretch(r){t.stretch=r},get fovScale(){return t.fovScale},set fovScale(r){t.fovScale=r},get target(){return t.target},set target(r){t.target=r},get eyeMode(){return!1},set eyeMode(r){},eyeDepth(r){return Number.POSITIVE_INFINITY},project(r,l,a,i){let u=50/i,p=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],d=ft(p,t.rotX,t.rotY),h=d[0]*t.zoom*50,m=d[1]*t.zoom*50,f=l*e+h/u*t.fovScale,b=a*o+m/50*t.fovScale;return[f,b,d[2]]}}}var ln={direction:[-.5,-.7,-.5],intensity:1},an={intensity:.4};function cn(n){let t=new Set,e=[];for(let o of n){let r=o.vertices;if(!(r.length<2))for(let l=0;l<r.length;l++){let a=r[l],i=r[(l+1)%r.length],c=`${a[0]},${a[1]},${a[2]}`,u=`${i[0]},${i[1]},${i[2]}`,p=c<u?`${c}|${u}`:`${u}|${c}`;if(t.has(p))continue;t.add(p);let d={from:a,to:i,weight:2};o.color&&(d.color=o.color),e.push(d)}}return e}function _t(n){let t=n.polygons??[],e=n.mode??(t.length?"solid":"wireframe"),o=n.wireframe??(e==="wireframe"?cn(t):[]);return{camera:n.camera,grid:n.grid,polygons:t,wireframe:o,mode:e,directionalLight:n.directionalLight??ln,ambientLight:n.ambientLight??an,glyphPalette:n.glyphPalette??"default",useColors:n.useColors??!0,smoothShading:n.smoothShading??!1,creaseAngle:n.creaseAngle??60,doubleSided:n.doubleSided??!1,supersample:n.supersample??1,temporalBlend:n.temporalBlend??0,shadow:n.shadow,castShadowFlags:n.castShadowFlags??[],receiveShadowFlags:n.receiveShadowFlags??[],...n.depthBiases?{depthBiases:n.depthBiases}:{},...n.depthEpsilon?{depthEpsilon:n.depthEpsilon}:{}}}var nt=require("@glyphcss/core");var jn=" .:-=+*#%@".split(""),qn=" .:-=+*#%@".split(""),gt={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("")}},Un=gt.default;function yt(n){return gt[n]??gt.default}function Ht(n){let{camera:t,grid:e,wireframe:o,mode:r}=n,{cols:l,rows:a,cellAspect:i}=e;if(r==="solid"){let d=n.supersample&&n.supersample>1?Math.floor(n.supersample):1;return un(n,l,a,i,d)}let c=yt(n.glyphPalette),u=new Uint8Array(l*a),p=n.useColors?new Array(l*a).fill(null):null;for(let d of o){let h=t.project(d.from,l,a,i),m=t.project(d.to,l,a,i);h[0]!==h[0]||m[0]!==m[0]||bn(u,p,h[0]|0,h[1]|0,m[0]|0,m[1]|0,d.weight??2,d.color??null,l,a)}return vn(u,p,l,a,c)}function un(n,t,e,o,r){let l=t*r,a=e*r,{camera:i,polygons:c,directionalLight:u,ambientLight:p,smoothShading:d,creaseAngle:h,doubleSided:m,castShadowFlags:f,receiveShadowFlags:b}=n,C=n.depthBiases,_=n.depthEpsilon??0,x=r>1?{zoom:i.zoom,eyeDepth:B=>i.eyeDepth(B),project:(B,X,V,Y)=>{let S=i.project(B,X,V,Y);return[X*.5+(S[0]-X*.5)*r,V*.5+(S[1]-V*.5)*r,S[2],S[3]]}}:i,M=yt(n.glyphPalette).solid,y=M.length-1,w=new Array(l*a).fill(" "),P=n.useColors,H=P?new Array(l*a).fill(null):null,v=new Float64Array(l*a).fill(-1/0),A=n.temporalBlend>0&&!!n.temporalHistory,L=A?new Float32Array(l*a*3).fill(NaN):null,s=u.direction,E=Math.hypot(s[0],s[1],s[2])||1,g=s[0]/E,G=s[1]/E,z=s[2]/E,F=u.intensity??1,T=p.intensity??.4,W=ze(u.color??"#ffffff"),R=ze(p.color??"#ffffff"),j=d&&h>0?gn(c,h):null,N=new Map,re=n.textureSamplers??null,k=n.shadow,q=k!=null&&f.length>0?fn(c,f,g,G,z):null,oe=k?.opacity??.25,K=k?.lift??.05,Z=k?.color??"#000000",ie=q?ze(Z):[0,0,0],O=globalThis.__glyphPerfDetail,Ke=O?performance.now():0,ge=[],J=n.shadeCache??null,Q=-1,ve=(B,X,V,Y)=>{if(q===null||!Y)return null;let S=q,I=Oe(B,S.right[0],S.right[1],S.right[2],S.up[0],S.up[1],S.up[2],S.dir[0],S.dir[1],S.dir[2],S.uMin,S.uMax,S.vMin,S.vMax),ee=Oe(X,S.right[0],S.right[1],S.right[2],S.up[0],S.up[1],S.up[2],S.dir[0],S.dir[1],S.dir[2],S.uMin,S.uMax,S.vMin,S.vMax),de=Oe(V,S.right[0],S.right[1],S.right[2],S.up[0],S.up[1],S.up[2],S.dir[0],S.dir[1],S.dir[2],S.uMin,S.uMax,S.vMin,S.vMax);return{map:S,luA:I[0],lvA:I[1],ldA:I[2],luB:ee[0],lvB:ee[1],ldB:ee[2],luC:de[0],lvC:de[1],ldC:de[2],lift:K,opacity:oe,shadowColorRgb:ie,shadowColorHex:Z,litCache:N}};for(let B=0;B<c.length;B++){let X=c[B],V=X.vertices;if(V.length<3)continue;let Y=X.uvs,S=null;if(re!==null&&Y&&Y.length>=V.length){let I=(0,nt.polygonTexture)(X);I&&(S=re.get(I)??null)}for(let I=0;I<V.length;I++)ge[I]=x.project(V[I],l,a,o);for(let I=1;I<V.length-1;I++){Q++;let ee=0,de=I,Ee=I+1,se=V[ee],pe=V[de],we=V[Ee],ae=ge[ee],ye=ge[de],Me=ge[Ee],it=(ae[0]!==ae[0]?1:0)+(ye[0]!==ye[0]?1:0)+(Me[0]!==Me[0]?1:0);if(it===3||it===0&&!m&&(ye[0]-ae[0])*(Me[1]-ae[1])-(ye[1]-ae[1])*(Me[0]-ae[0])>0)continue;let Ge,Le,Te,ke=null;if(J!==null&&J.iA[Q]!==void 0)Ge=J.iA[Q],Le=J.iB[Q],Te=J.iC[Q],ke=J.lit[Q];else{let $=pe[0]-se[0],he=pe[1]-se[1],Ae=pe[2]-se[2],me=we[0]-se[0],Je=we[1]-se[1],Qe=we[2]-se[2],et=he*Qe-Ae*Je,Ye=Ae*me-$*Qe,U=$*Je-he*me,D=Math.hypot(et,Ye,U)||1,te=et/D,fe=Ye/D,le=U/D,ce,_e,st,lt,at,ct,ut,dt,pt;if(j){let De=j[B],xe=De[ee],Fe=De[de],Xe=De[Ee];ce=xe[0],_e=xe[1],st=xe[2],lt=Fe[0],at=Fe[1],ct=Fe[2],ut=Xe[0],dt=Xe[1],pt=Xe[2]}else ce=lt=ut=te,_e=at=dt=fe,st=ct=pt=le;let St=ce*g+_e*G+st*z,Mt=lt*g+at*G+ct*z,xt=ut*g+dt*G+pt*z,Xt=m?Math.abs(St):Math.max(0,-St),Vt=m?Math.abs(Mt):Math.max(0,-Mt),$t=m?Math.abs(xt):Math.max(0,-xt);if(Ge=Math.min(1,T+Xt*F),Le=Math.min(1,T+Vt*F),Te=Math.min(1,T+$t*F),P){let De=(Ge+Le+Te)/3,xe=Math.max(0,De-T),Fe=X.color??"#ffffff",Xe=xe*255|0,Ct=`${Fe}:${Xe}`,tt=N.get(Ct);if(tt===void 0){let ht=ze(Fe),Wt=T*R[0]/255+xe*W[0]/255,jt=T*R[1]/255+xe*W[1]/255,qt=T*R[2]/255+xe*W[2]/255,Ut=Math.min(255,ht[0]*Wt),Kt=Math.min(255,ht[1]*jt),Zt=Math.min(255,ht[2]*qt);tt=`#${ne(Ut)}${ne(Kt)}${ne(Zt)}`,N.set(Ct,tt)}ke=tt}J!==null&&(J.iA[Q]=Ge,J.iB[Q]=Le,J.iC[Q]=Te,J.lit[Q]=ke)}let wt=b[B]??!1,He=1+(C?.[B]??0),At=null;if(S!==null&&Y){let $=Y[ee],he=Y[de],Ae=Y[Ee],me=Math.max(0,(Ge+Le+Te)/3-T);At={sampler:S,ua:$[0],va:$[1],ub:he[0],vb:he[1],uc:Ae[0],vc:Ae[1],tintR:T*R[0]/255+me*W[0]/255,tintG:T*R[1]/255+me*W[1]/255,tintB:T*R[2]/255+me*W[2]/255}}if(it===0)zt(ae[0],ae[1],(ae[3]??ae[2])*He,Ge,ye[0],ye[1],(ye[3]??ye[2])*He,Le,Me[0],Me[1],(Me[3]??Me[2])*He,Te,M,y,ke,w,H,v,l,a,ve(se,pe,we,wt),m,se,pe,we,L,_,At);else{let $=[],he=[],Ae=[se,pe,we],me=[Ge,Le,Te],Je=x.eyeDepth(se),Qe=x.eyeDepth(pe),et=x.eyeDepth(we),Ye=[Je,Qe,et];for(let U=0;U<3;U++){let D=(U+1)%3,te=Ye[U],fe=Ye[D];if(te>0&&($.push(Ae[U]),he.push(me[U])),te>0!=fe>0){let le=te/(te-fe),ce=Ae[U],_e=Ae[D];$.push([ce[0]+le*(_e[0]-ce[0]),ce[1]+le*(_e[1]-ce[1]),ce[2]+le*(_e[2]-ce[2])]),he.push(me[U]+le*(me[D]-me[U]))}}if($.length>=3){let U=$.map(D=>x.project(D,l,a,o));for(let D=1;D<$.length-1;D++){let te=U[0],fe=U[D],le=U[D+1],ce=(fe[0]-te[0])*(le[1]-te[1])-(fe[1]-te[1])*(le[0]-te[0]);!m&&ce>0||zt(te[0],te[1],(te[3]??te[2])*He,he[0],fe[0],fe[1],(fe[3]??fe[2])*He,he[D],le[0],le[1],(le[3]??le[2])*He,he[D+1],M,y,ke,w,H,v,l,a,ve($[0],$[D],$[D+1],wt),m,$[0],$[D],$[D+1],L,_,null)}}}}}O&&(O.loop??(O.loop=[])).push(performance.now()-Ke);let Et=O?performance.now():0,Pe=w,Se=H,Ze=L;if(r>1){let B=pn(w,H,v,L,t,e,r,M);Pe=B.glyphBuf,Se=B.colorBuf,Ze=B.worldPos}A&&dn(Pe,Se,Ze,t,e,o,M,n.temporalBlend,n.temporalHistory,i);let ot=yn(Pe,Se,t,e);return O&&(O.string??(O.string=[])).push(performance.now()-Et),ot}function dn(n,t,e,o,r,l,a,i,c,u){let p=o*r,d=a.length-1,h=new Map;for(let M=0;M<a.length;M++)h.set(a[M],M);let m=c.cam;(c.cols!==o||c.rows!==r||c.idx.length!==p)&&(c.cols=o,c.rows=r,c.idx=new Float32Array(p),c.r=new Float32Array(p),c.g=new Float32Array(p),c.b=new Float32Array(p),m=null);let f=null;if(m){let M=Ie({rotX:m.rotX,rotY:m.rotY,distance:m.distance,perspective:m.perspective,zoom:m.zoom,stretch:m.stretch});M.target=m.target,f=y=>M.project(y,o,r,l)}let b=new Float32Array(p),C=new Float32Array(p),_=new Float32Array(p),x=new Float32Array(p);for(let M=0;M<r;M++)for(let y=0;y<o;y++){let w=M*o+y,P=h.get(n[w])??0,H=0,v=0,A=0,L=t?t[w]:null;if(L){let k=ze(L);H=k[0],v=k[1],A=k[2]}let s=0,E=0,g=0,G=0,z=0,F=e[w*3];if(f&&F===F){let k=f([F,e[w*3+1],e[w*3+2]]),q=Math.round(k[0]),oe=Math.round(k[1]);if(k[0]===k[0]&&q>=0&&q<o&&oe>=0&&oe<r){let K=oe*o+q;E=c.idx[K],g=c.r[K],G=c.g[K],z=c.b[K],s=i}}let T=1-s,W=T*P+s*E,R=T*H+s*g,j=T*v+s*G,N=T*A+s*z;b[w]=W,C[w]=R,_[w]=j,x[w]=N;let re=Math.round(W);re<0?re=0:re>d&&(re=d),n[w]=a[re],t&&(t[w]=re===0?null:`#${ne(R)}${ne(j)}${ne(N)}`)}c.idx=b,c.r=C,c.g=_,c.b=x,c.cam={rotX:u.rotX,rotY:u.rotY,target:[u.target[0],u.target[1],u.target[2]],zoom:u.zoom,perspective:u.perspective,distance:u.distance,stretch:u.stretch}}function pn(n,t,e,o,r,l,a,i){let c=new Map;for(let b=0;b<i.length;b++)c.set(i[b],b);let u=i.length-1,p=r*a,d=new Array(r*l).fill(" "),h=t?new Array(r*l).fill(null):null,m=o?new Float32Array(r*l*3).fill(NaN):null,f=1/(a*a);for(let b=0;b<l;b++)for(let C=0;C<r;C++){let _=0,x=0,M=0,y=0,w=0,P=0,H=0,v=0;for(let s=0;s<a;s++){let E=(b*a+s)*p+C*a;for(let g=0;g<a;g++){let G=E+g;if(e[G]!==-1/0){if(_+=c.get(n[G])??0,x++,h){let z=t[G];if(z){let F=ze(z);M+=F[0],y+=F[1],w+=F[2]}}m&&(P+=o[G*3],H+=o[G*3+1],v+=o[G*3+2])}}}let A=b*r+C;if(x===0)continue;let L=Math.round(_*f);L<0?L=0:L>u&&(L=u),d[A]=i[L],h&&(h[A]=`#${ne(M/x)}${ne(y/x)}${ne(w/x)}`),m&&(m[A*3]=P/x,m[A*3+1]=H/x,m[A*3+2]=v/x)}return{glyphBuf:d,colorBuf:h,worldPos:m}}var hn=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]),be=256;function Oe(n,t,e,o,r,l,a,i,c,u,p,d,h,m){let f=t*n[0]+e*n[1]+o*n[2],b=r*n[0]+l*n[1]+a*n[2],C=-(i*n[0]+c*n[1]+u*n[2]),_=(f-p)/(d-p)*(be-1),x=(b-h)/(m-h)*(be-1);return[_,x,C]}function mn(n,t,e,o){let r=t[0],l=t[1],a=t[2],i=e[0],c=e[1],u=e[2],p=o[0],d=o[1],h=o[2],m=(i-r)*(d-l)-(c-l)*(p-r);if(m===0)return;let f=1/m,b=r<i?r:i;p<b&&(b=p);let C=r>i?r:i;p>C&&(C=p);let _=l<c?l:c;d<_&&(_=d);let x=l>c?l:c;d>x&&(x=d);let M=Math.max(0,Math.ceil(b)),y=Math.min(be-1,Math.floor(C)),w=Math.max(0,Math.ceil(_)),P=Math.min(be-1,Math.floor(x));if(M>y||w>P)return;let H=m>0;for(let v=w;v<=P;v++)for(let A=M;A<=y;A++){let L=A,s=v,E=(i-L)*(d-s)-(c-s)*(p-L),g=(p-L)*(l-s)-(d-s)*(r-L),G=(r-L)*(c-s)-(l-s)*(i-L);if(H?E<0||g<0||G<0:E>0||g>0||G>0)continue;let z=(E*a+g*u+G*h)*f,F=v*be+A;z>n[F]&&(n[F]=z)}}function fn(n,t,e,o,r){let l,a,i;Math.abs(e)<.9?(l=0,a=r,i=-o):(l=-r,a=0,i=e);let c=Math.hypot(l,a,i);l/=c,a/=c,i/=c;let u=a*r-i*o,p=i*e-l*r,d=l*o-a*e,h=1/0,m=-1/0,f=1/0,b=-1/0,C=!1;for(let y=0;y<n.length;y++)if(t[y]){C=!0;for(let w of n[y].vertices){let P=l*w[0]+a*w[1]+i*w[2],H=u*w[0]+p*w[1]+d*w[2];P<h&&(h=P),P>m&&(m=P),H<f&&(f=H),H>b&&(b=H)}}if(!C)return null;let _=(m-h)*.05+.01,x=(b-f)*.05+.01;h-=_,m+=_,f-=x,b+=x;let M=new Float64Array(be*be).fill(-1/0);for(let y=0;y<n.length;y++){if(!t[y])continue;let w=n[y].vertices;if(!(w.length<3))for(let P=1;P<w.length-1;P++){let H=w[0],v=w[P],A=w[P+1],L=Oe(H,l,a,i,u,p,d,e,o,r,h,m,f,b),s=Oe(v,l,a,i,u,p,d,e,o,r,h,m,f,b),E=Oe(A,l,a,i,u,p,d,e,o,r,h,m,f,b);mn(M,L,s,E)}}return{buf:M,right:[l,a,i],up:[u,p,d],dir:[e,o,r],uMin:h,uMax:m,vMin:f,vMax:b}}function zt(n,t,e,o,r,l,a,i,c,u,p,d,h,m,f,b,C,_,x,M,y,w,P,H,v,A,L,s){let E=(r-n)*(u-t)-(l-t)*(c-n);if(E===0||!w&&E>0)return;let g=1/E,G=E>0,z=n<r?n:r;c<z&&(z=c);let F=n>r?n:r;c>F&&(F=c);let T=t<l?t:l;u<T&&(T=u);let W=t>l?t:l;u>W&&(W=u);let R=Math.max(0,Math.ceil(z)),j=Math.min(x-1,Math.floor(F)),N=Math.max(0,Math.ceil(T)),re=Math.min(M-1,Math.floor(W));if(!(R>j||N>re))for(let k=N;k<=re;k++){let q=k;for(let oe=R;oe<=j;oe++){let K=oe,Z=(r-K)*(u-q)-(l-q)*(c-K),ie=(c-K)*(t-q)-(u-q)*(n-K),O=(n-K)*(l-q)-(t-q)*(r-K);if(G?Z<0||ie<0||O<0:Z>0||ie>0||O>0)continue;let Ke=(Z*e+ie*a+O*p)*g,ge=k*x+oe,J=_[ge];if(Ke>(J>0?J*(1-L):J)){if(_[ge]=Ke,A!==null){let X=ge*3;A[X]=(Z*P[0]+ie*H[0]+O*v[0])*g,A[X+1]=(Z*P[1]+ie*H[1]+O*v[1])*g,A[X+2]=(Z*P[2]+ie*H[2]+O*v[2])*g}let Q=(Z*o+ie*i+O*d)*g,ve=f;if(s!==null){let X=(Z*s.ua+ie*s.ub+O*s.uc)*g,V=(Z*s.va+ie*s.vb+O*s.vc)*g,Y=(0,nt.sampleTexel)(s.sampler,X,V);if(Y!==null&&Y.a>8){let S=Y.r*s.tintR|0;S>255&&(S=255);let I=Y.g*s.tintG|0;I>255&&(I=255);let ee=Y.b*s.tintB|0;ee>255&&(ee=255),ve=`#${ne(S)}${ne(I)}${ne(ee)}`,Q*=(.299*Y.r+.587*Y.g+.114*Y.b)/255}}let Pe=(Q<0?0:Q>1?1:Q)*m,Se=Pe|0,Ze=Pe-Se,ot=hn[(k&3)*4+(oe&3)],B=Ze>ot&&Se<m?Se+1:Se;if(B>m&&(B=m),y!==null){let X=(Z*y.luA+ie*y.luB+O*y.luC)*g,V=(Z*y.lvA+ie*y.lvB+O*y.lvC)*g,Y=(Z*y.ldA+ie*y.ldB+O*y.ldC)*g,S=X|0,I=V|0;if(S>=0&&S<be&&I>=0&&I<be){let ee=y.map.buf[I*be+S];if(ee>-1/0&&Y+y.lift<ee&&(B=Math.max(0,B-Math.round(y.opacity*m)),ve!==null)){let de=`shadow:${ve}:${B}`,Ee=y.litCache.get(de);if(Ee===void 0){let se=ze(ve),pe=y.shadowColorRgb,we=Math.round(se[0]*(1-y.opacity)+pe[0]*y.opacity),ae=Math.round(se[1]*(1-y.opacity)+pe[1]*y.opacity),ye=Math.round(se[2]*(1-y.opacity)+pe[2]*y.opacity);Ee=`#${ne(we)}${ne(ae)}${ne(ye)}`,y.litCache.set(de,Ee)}ve=Ee}}}b[ge]=h[B],C&&(C[ge]=ve)}}}}function gn(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],p=c[1],d=c[2],h=p[0]-u[0],m=p[1]-u[1],f=p[2]-u[2],b=d[0]-u[0],C=d[1]-u[1],_=d[2]-u[2],x=m*_-f*C,M=f*b-h*_,y=h*C-m*b,w=Math.hypot(x,M,y)||1;o[i]=[x/w,M/w,y/w]}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 p=c[u],d=`${p[0]},${p[1]},${p[2]}`,h=r.get(d);h||(h=[],r.set(d,h)),(h.length===0||h[h.length-1]!==i)&&h.push(i)}}let l=Math.cos(t*Math.PI/180),a=new Array(e);for(let i=0;i<e;i++){let c=n[i].vertices,u=o[i],p=new Array(c.length);for(let d=0;d<c.length;d++){let h=c[d],m=r.get(`${h[0]},${h[1]},${h[2]}`),f=0,b=0,C=0;for(let x=0;x<m.length;x++){let M=m[x],y=o[M];u[0]*y[0]+u[1]*y[1]+u[2]*y[2]>=l&&(f+=y[0],b+=y[1],C+=y[2])}let _=Math.hypot(f,b,C)||1;p[d]=[f/_,b/_,C/_]}a[i]=p}return a}function yn(n,t,e,o){let r=[],l=null,a="",i=()=>{a&&(l!==null?r.push(`<span style="color:${l}">${a}</span>`):r.push(a),a="")};for(let c=0;c<o;c++){for(let u=0;u<e;u++){let p=c*e+u,d=n[p],h=t&&d!==" "?t[p]??null:null;h!==l&&(i(),l=h),a+=d}i(),l=null,c<o-1&&r.push(`
2
+ `)}return r.join("")}function bn(n,t,e,o,r,l,a,i,c,u){let p=Math.abs(r-e),d=-Math.abs(l-o),h=e<r?1:-1,m=o<l?1:-1,f=p+d;for(;;){if(e>=0&&e<c&&o>=0&&o<u){let C=o*c+e;n[C]<a&&(n[C]=a,t&&(t[C]=i))}if(e===r&&o===l)break;let b=2*f;b>=d&&(f+=d,e+=h),b<=p&&(f+=p,o+=m)}}function vn(n,t,e,o,r){let l=[],a=null,i="",c=()=>{i&&(a!==null?l.push(`<span style="color:${a}">${i}</span>`):l.push(i),i="")};for(let u=0;u<o;u++){for(let p=0;p<e;p++){let d=u*e+p,h=n[d],m,f;h===0?(m=" ",f=null):(m=h===1?r.thin[Math.random()*r.thin.length|0]:h===2?r.normal[Math.random()*r.normal.length|0]:r.core[Math.random()*r.core.length|0],f=t?t[d]??null:null),f!==a&&(c(),a=f),i+=m}c(),a=null,u<o-1&&l.push(`
3
+ `)}return l.join("")}var Pt=new Map;function ze(n){let t=Pt.get(n);if(t!==void 0)return t;let e=En(n);return Pt.set(n,e),e}function En(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 ne(n){let t=Math.max(0,Math.min(255,n|0)).toString(16);return t.length===1?"0"+t:t}var Ft="glyph-styles";function It(n){let t=n??(typeof document<"u"?document:void 0);if(!t||t.getElementById(Ft))return;let e=t.createElement("style");e.id=Ft,e.textContent=wn,t.head.appendChild(e)}var wn=`
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,5 +59,5 @@
59
59
  the content from the 3D vertex being labelled. */
60
60
  transform: translate(-50%, -50%);
61
61
  }
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});
62
+ `;function Ot(n,t,e,o,r){return n.map(l=>{let[a,i,c]=t.project(l.at,e,o,r),u=c>-3&&a>=0&&a<e&&i>=0&&i<o;return{id:l.id,col:a,row:i,depth:c,visible:u}})}var An=1;function Sn(n,t){let{position:e,scale:o,rotation:r}=t;if(!e&&!o&&!r)return n;let[l,a,i]=e??[0,0,0],c=1,u=1,p=1;o!==void 0&&(typeof o=="number"?c=u=p=o:[c,u,p]=o);let d=Math.PI/180,[h,m,f]=r??[0,0,0],b=h*d,C=m*d,_=f*d,x=Math.cos(b),M=Math.sin(b),y=Math.cos(C),w=Math.sin(C),P=Math.cos(_),H=Math.sin(_);function v(A){let L=A[0]*c,s=A[1]*u,E=A[2]*p,g=P*L-H*s,G=H*L+P*s,z=E;return L=y*g+w*z,s=G,E=-w*g+y*z,g=L,G=x*s-M*E,z=M*s+x*E,[g+l,G+a,z+i]}return n.map(A=>({...A,vertices:A.vertices.map(v)}))}function Rt(n,t={}){It(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??Ie(),smoothShading:t.smoothShading??!1,creaseAngle:t.creaseAngle??60,doubleSided:t.doubleSided??!1,supersample:t.supersample??1,depthEpsilon:t.depthEpsilon??0,temporalBlend:t.temporalBlend??0,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 l=n.ownerDocument.createElement("div");l.className="glyph-hotspot-layer",o.appendChild(r),o.appendChild(l),n.appendChild(o);let a=new Map,i=[],c=!1,u={iA:[],iB:[],iC:[],lit:[]},p={idx:new Float32Array(0),r:new Float32Array(0),g:new Float32Array(0),b:new Float32Array(0),cols:0,rows:0,cam:null};function d(){u.iA.length=0,u.iB.length=0,u.iC.length=0,u.lit.length=0}let h=null,m=0;function f(){let s=[];for(let g of a.values())for(let G of g.polygons)(G.texture||G.material?.texture)&&s.push(G);if(s.length===0){h&&(h=null,b());return}let E=++m;(0,Bt.buildTextureSamplers)(s).then(g=>{E===m&&(h=g.size>0?g:null,b())})}function b(){c||(c=!0,Promise.resolve().then(()=>{c=!1,C()}))}function C(){let s=[],E=[],g=[],G=[],z=!1;for(let N of a.values()){let re=Sn(N.polygons,N.transform),k=N.transform.castShadow??!1,q=N.transform.receiveShadow??!1,oe=N.transform.depthBias??0;oe!==0&&(z=!0);for(let K of re)s.push(K),E.push(k),g.push(q),G.push(oe)}let F=_t({camera:e.camera,grid:{cols:e.cols,rows:e.rows,cellAspect:e.cellAspect},polygons:s,mode:e.mode,directionalLight:e.directionalLight,ambientLight:e.ambientLight,glyphPalette:e.glyphPalette,useColors:e.useColors,smoothShading:e.smoothShading,creaseAngle:e.creaseAngle,doubleSided:e.doubleSided,supersample:e.supersample,depthEpsilon:e.depthEpsilon,temporalBlend:e.temporalBlend,shadow:e.shadow,castShadowFlags:E,receiveShadowFlags:g,depthBiases:z?G:void 0});F.shadeCache=u,F.textureSamplers=h,F.temporalHistory=p;let T=globalThis.__glyphPerf,W=T?performance.now():0,R=Ht(F),j=T?performance.now():0;if(e.useColors?r.innerHTML=R:r.textContent=R,T){let N=performance.now();(T.raster??(T.raster=[])).push(j-W),(T.dom??(T.dom=[])).push(N-j),(T.polys??(T.polys=[])).push(s.length)}_()}function _(){let{cols:s,rows:E,cellAspect:g,camera:G}=e,z=Ot(i.map(R=>R.hotspot),G,s,E,g),F=r.getBoundingClientRect(),T=s>0?F.width/s:8,W=E>0?F.height/E:16;for(let R=0;R<i.length;R++){let{el:j}=i[R],N=z[R];N.visible?(j.style.display="",j.style.left=`${(N.col+.5)*T}px`,j.style.top=`${(N.row+.5)*W}px`,j.style.zIndex=String(Math.round(N.depth*1e3))):j.style.display="none"}}function x(s,E={}){let g=An++;return a.set(g,{id:g,polygons:s,transform:E}),d(),f(),b(),{get id(){return g},get name(){return a.get(g)?.transform.id},get polygons(){return s},setTransform(G){let z=a.get(g);z&&(z.transform=G,d(),b())},dispose(){a.delete(g),d(),f(),b()}}}function M(s,E){let g=n.ownerDocument.createElement("div");g.className="glyph-hotspot",g.setAttribute("data-hotspot-id",s.id);let[G,z]=s.size??[1,1];g.style.position="absolute",g.style.width=`${G}ch`,g.style.height=`${z*e.cellAspect}ch`,E&&g.addEventListener("click",E),l.appendChild(g);let F={hotspot:{id:s.id,at:s.at,size:s.size},el:g,onClick:E};return i.push(F),b(),{get el(){return g},remove(){let T=i.indexOf(F);T>=0&&i.splice(T,1),E&&g.removeEventListener("click",E),l.removeChild(g),b()}}}function y(){C()}function w(s){s.mode!==void 0&&(e.mode=s.mode),s.glyphPalette!==void 0&&(e.glyphPalette=s.glyphPalette),s.useColors!==void 0&&(e.useColors=s.useColors),s.cols!==void 0&&(e.cols=s.cols),s.rows!==void 0&&(e.rows=s.rows),s.cellAspect!==void 0&&(e.cellAspect=s.cellAspect),s.directionalLight!==void 0&&(e.directionalLight=s.directionalLight),s.ambientLight!==void 0&&(e.ambientLight=s.ambientLight),s.camera!==void 0&&(e.camera=s.camera),s.smoothShading!==void 0&&(e.smoothShading=s.smoothShading),s.creaseAngle!==void 0&&(e.creaseAngle=s.creaseAngle),"shadow"in s&&(e.shadow=s.shadow),s.autoSize!==void 0&&(e.autoSize=s.autoSize,e.autoSize&&!A&&typeof ResizeObserver<"u"?(A=new ResizeObserver(()=>v()),A.observe(n),v()):!e.autoSize&&A&&(A.disconnect(),A=null)),(s.mode!==void 0||s.useColors!==void 0||s.directionalLight!==void 0||s.ambientLight!==void 0||s.smoothShading!==void 0||s.creaseAngle!==void 0||s.glyphPalette!==void 0)&&d(),b()}function P(){return{...e}}function H(){let E=n.ownerDocument.createElement("span");E.textContent=Array(20).fill("M").join(`
63
+ `),E.style.cssText="position:absolute;visibility:hidden;font-family:inherit;font-size:inherit;line-height:inherit;white-space:pre;padding:0;margin:0",r.appendChild(E);let g=E.getBoundingClientRect();return E.remove(),{w:g.width||8,h:g.height?g.height/20:16}}function v(){let s=n.clientWidth,E=n.clientHeight;if(!s||!E)return;let g=H(),G=Math.max(20,Math.floor(s/g.w)),z=Math.max(8,Math.floor(E/g.h)),F=g.h/g.w,T=!1;e.cols!==G&&(e.cols=G,T=!0),e.rows!==z&&(e.rows=z,T=!0),Math.abs(e.cellAspect-F)>.01&&(e.cellAspect=F,T=!0),T&&b()}let A=null;e.autoSize&&typeof ResizeObserver<"u"&&(A=new ResizeObserver(()=>v()),A.observe(n),v());function L(){A&&(A.disconnect(),A=null),a.clear(),n.contains(o)&&n.removeChild(o)}return b(),{get host(){return n},get output(){return r},get camera(){return e.camera},add:x,addHotspot:M,rerender:y,setOptions:w,getOptions:P,fit:v,destroy:L}}var Mn=typeof HTMLElement<"u"?HTMLElement:class{},xn=["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 Ce(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function Cn(n){if(n==="wireframe"||n==="solid"||n==="voxel")return n}function Gn(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}var Ve=class extends Mn{constructor(){super(...arguments);this._scene=null}static get observedAttributes(){return[...xn]}getScene(){return this._scene}_readOptions(){let e={},o=Cn(this.getAttribute("mode"));o!==void 0&&(e.mode=o);let r=this.getAttribute("glyph-palette");r&&(e.glyphPalette=r);let l=Gn(this.getAttribute("use-colors"));l!==void 0&&(e.useColors=l);let a=Ce(this.getAttribute("cols"));a!==void 0&&(e.cols=a);let i=Ce(this.getAttribute("rows"));i!==void 0&&(e.rows=i);let c=Ce(this.getAttribute("cell-aspect"));c!==void 0&&(e.cellAspect=c);let u=Ce(this.getAttribute("directional-intensity"));u!==void 0&&(e.directionalLight={direction:[-.5,-.7,-.5],intensity:u});let p=Ce(this.getAttribute("ambient-intensity"));if(p!==void 0&&(e.ambientLight={intensity:p}),this.hasAttribute("auto-size")&&(e.autoSize=!0),this.hasAttribute("shadow")){let d={color:"#000000",opacity:.25,lift:.05,maxExtend:2e3},h=this.getAttribute("shadow-color");h&&(d.color=h);let m=Ce(this.getAttribute("shadow-opacity"));m!==void 0&&(d.opacity=m);let f=Ce(this.getAttribute("shadow-lift"));f!==void 0&&(d.lift=f);let b=Ce(this.getAttribute("shadow-max-extend"));b!==void 0&&(d.maxExtend=b),e.shadow=d}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=Rt(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 Be=require("@glyphcss/core"),Ln=typeof HTMLElement<"u"?HTMLElement:class{},Tn=["src","geometry","size","color","position","scale","rotation","auto-center","cast-shadow","receive-shadow"];function bt(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 _n(n){if(n){if(!n.includes(",")){let t=parseFloat(n);return Number.isFinite(t)?t:void 0}return bt(n)}}function zn(n){return n.closest("glyph-scene")??null}var $e=class extends Ln{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:bt(this.getAttribute("position")),scale:_n(this.getAttribute("scale")),rotation:bt(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=zn(this);if(r){if(!r.getScene()){let l=()=>{r.removeEventListener("glyphcss:scene-ready",l),this._maybeLoad()};r.addEventListener("glyphcss:scene-ready",l);return}if(e){let l=++this._loadToken,a;try{a=await(0,Be.loadMesh)(e)}catch(p){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:p,bubbles:!0}));return}if(l!==this._loadToken){try{a.dispose()}catch{}return}let i=r.getScene();if(!i){try{a.dispose()}catch{}return}let u=this.hasAttribute("auto-center")?(0,Be.recenterPolygons)(a.polygons):a.polygons;this._handle=i.add(u,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:u},bubbles:!0}));return}if(o){let l=r.getScene();if(!l)return;let a=this.getAttribute("size"),i=a!==null?parseFloat(a):1,c=this.getAttribute("color")??void 0,u;try{u=(0,Be.resolveGeometry)(o,{size:Number.isFinite(i)?i:1,color:c})}catch(p){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:p,bubbles:!0}));return}this._handle=l.add(u,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:u},bubbles:!0}))}}}};var Pn=typeof HTMLElement<"u"?HTMLElement:class{};function Hn(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 Fn(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 In(n){return n.closest("glyph-scene")??null}var We=class extends Pn{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=Hn(this.getAttribute("at"));if(!e)return;let o=In(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 l=this.getAttribute("hotspot-id")??this.getAttribute("id")??String(Math.random()),a=Fn(this.getAttribute("size"));this._handle=r.addHotspot({id:l,at:e,size:a},()=>this.dispatchEvent(new CustomEvent("glyphcss:hotspot-click",{detail:{id:l},bubbles:!0})));let i=this._handle.el;for(;this.firstChild;)i.appendChild(this.firstChild)}};var On=typeof HTMLElement<"u"?HTMLElement:class{};function ue(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var je=class extends On{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","distance","perspective","zoom","stretch"]}getCamera(){return this._camera}connectedCallback(){this._camera=Ie({rotX:ue(this.getAttribute("rot-x")),rotY:ue(this.getAttribute("rot-y")),distance:ue(this.getAttribute("distance")),perspective:ue(this.getAttribute("perspective")),zoom:ue(this.getAttribute("zoom")),stretch:ue(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 l=this._camera;if(!l)return;let a=ue(this.getAttribute("rot-x")),i=ue(this.getAttribute("rot-y")),c=ue(this.getAttribute("distance")),u=ue(this.getAttribute("perspective")),p=ue(this.getAttribute("zoom")),d=ue(this.getAttribute("stretch")),h=!1;a!==void 0&&l.rotX!==a&&(l.rotX=a,h=!0),i!==void 0&&l.rotY!==i&&(l.rotY=i,h=!0),c!==void 0&&l.distance!==c&&(l.distance=c,h=!0),u!==void 0&&l.perspective!==u&&(l.perspective=u,h=!0),p!==void 0&&l.zoom!==p&&(l.zoom=p,h=!0),d!==void 0&&l.stretch!==d&&(l.stretch=d,h=!0),h&&this.querySelector("glyph-scene")?.rerender?.()}};var Bn=typeof HTMLElement<"u"?HTMLElement:class{};function Re(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var Ne=class extends Bn{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","zoom"]}getCamera(){return this._camera}connectedCallback(){this._camera=Tt({rotX:Re(this.getAttribute("rot-x")),rotY:Re(this.getAttribute("rot-y")),zoom:Re(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 l=this._camera;if(!l)return;let a=Re(this.getAttribute("rot-x")),i=Re(this.getAttribute("rot-y")),c=Re(this.getAttribute("zoom")),u=!1;a!==void 0&&l.rotX!==a&&(l.rotX=a,u=!0),i!==void 0&&l.rotY!==i&&(l.rotY=i,u=!0),c!==void 0&&l.zoom!==c&&(l.zoom=c,u=!0),u&&this.querySelector("glyph-scene")?.rerender?.()}};function kt(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,l=Nt(t.invert),a=t.clampPitch??!0,i=t.animate??!1,c=!1,u=!1,p=null,d=null,h=null,m={x:0,y:0},f=n.camera;function b(v){if(!(!o||c)&&h===null&&v.isPrimary!==!1){v.preventDefault(),h=v.pointerId,m={x:v.clientX,y:v.clientY},e.style.cursor="grabbing";try{v.target.setPointerCapture(v.pointerId)}catch{}i&&i.pauseOnInteraction!==!1&&(u=!0)}}function C(v){if(h===null||v.pointerId!==h||!o||c)return;v.preventDefault();let A=v.clientX-m.x,L=v.clientY-m.y;m={x:v.clientX,y:v.clientY};let s=l,E=1/4;f.rotY=f.rotY-A*E*s;let g=f.rotX-L*E*s;f.rotX=a?Math.max(-90,Math.min(90,g)):g,n.rerender()}function _(v){if(h===v.pointerId){h=null,e.style.cursor=o&&!c?"grab":"";try{v.target.releasePointerCapture(v.pointerId)}catch{}i&&(u=!1)}}function x(v){if(!r||c)return;v.preventDefault();let A=v.deltaY*.001;f.zoom=Math.max(.1,Math.min(500,f.zoom*(1-A))),n.rerender()}function M(v){if(!(c||!i)){if(!u){let A=d!==null?Math.min(v-d,50):16.67,L=typeof i=="object"&&i.speed?i.speed:.3,s=typeof i=="object"&&i.axis?i.axis:"y",E=L*(A/16.67);s==="y"?f.rotY=f.rotY+E:f.rotX=f.rotX+E,n.rerender()}d=v,p=requestAnimationFrame(M)}}function y(){p===null&&typeof requestAnimationFrame<"u"&&i&&(p=requestAnimationFrame(M))}function w(){p!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(p),p=null),d=null}function P(){e.addEventListener("pointerdown",b),e.addEventListener("pointermove",C),e.addEventListener("pointerup",_),e.addEventListener("pointercancel",_),e.addEventListener("wheel",x,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function H(){e.removeEventListener("pointerdown",b),e.removeEventListener("pointermove",C),e.removeEventListener("pointerup",_),e.removeEventListener("pointercancel",_),e.removeEventListener("wheel",x),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return P(),y(),{update(v){let A=!!i;o=v.drag??o,r=v.wheel??r,l=Nt(v.invert),v.clampPitch!==void 0&&(a=v.clampPitch),i=v.animate??i,!c&&h===null&&(e.style.cursor=o?"grab":"");let L=!!i;A&&!L?w():!A&&L&&y()},pause(){c||(c=!0,H(),w(),h=null,u=!1)},resume(){c&&(c=!1,P(),y())},destroy(){c||H(),w(),c=!0}}}function Nt(n){return n===void 0||n===!1?1:n===!0?-1:n}var Rn=typeof HTMLElement<"u"?HTMLElement:class{};function Nn(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function rt(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function kn(n){return n.closest("glyph-scene")??null}var qe=class extends Rn{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=rt(this.getAttribute("drag")),o=rt(this.getAttribute("wheel")),r=rt(this.getAttribute("invert")),l=rt(this.getAttribute("clamp-pitch")),a=Nn(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}:{},...l!==void 0?{clampPitch:l}:{},...a!==void 0?{animate:{speed:a,axis:i}}:{}}}_attach(){if(this._controls)return;let e=kn(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=kt(o,this._readOptions())}};function Dt(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,l=Yt(t.invert),a=t.animate??!1,i=!1,c=!1,u=null,p=null,d=null,h={x:0,y:0},m=!1,f=n.camera,b=1/4,C=.02;function _(s){if(!(!o||i)&&d===null&&s.isPrimary!==!1){s.preventDefault(),d=s.pointerId,h={x:s.clientX,y:s.clientY},m=s.button===2,e.style.cursor="grabbing";try{s.target.setPointerCapture(s.pointerId)}catch{}a&&a.pauseOnInteraction!==!1&&(c=!0)}}function x(s){if(d===null||s.pointerId!==d||!o||i)return;s.preventDefault();let E=s.clientX-h.x,g=s.clientY-h.y;h={x:s.clientX,y:s.clientY};let G=l;if(m||s.shiftKey)f.rotY=f.rotY-E*b*G,f.rotX=Math.max(-90,Math.min(90,f.rotX+g*b*G));else{let z=f.target;f.target=[z[0]-E*C/f.zoom,z[1]-g*C/f.zoom,z[2]]}n.rerender()}function M(s){if(d===s.pointerId){d=null,m=!1,e.style.cursor=o&&!i?"grab":"";try{s.target.releasePointerCapture(s.pointerId)}catch{}a&&(c=!1)}}function y(s){s.preventDefault()}function w(s){if(!r||i)return;s.preventDefault();let E=s.deltaY*.001;f.zoom=Math.max(.1,Math.min(500,f.zoom*(1-E))),n.rerender()}function P(s){if(!(i||!a)){if(!c){let E=p!==null?Math.min(s-p,50):16.67,g=typeof a=="object"&&a.speed?a.speed:.3,G=typeof a=="object"&&a.axis?a.axis:"y",z=g*(E/16.67);G==="y"?f.rotY=f.rotY+z:f.rotX=f.rotX+z,n.rerender()}p=s,u=requestAnimationFrame(P)}}function H(){u===null&&typeof requestAnimationFrame<"u"&&a&&(u=requestAnimationFrame(P))}function v(){u!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(u),u=null),p=null}function A(){e.addEventListener("pointerdown",_),e.addEventListener("pointermove",x),e.addEventListener("pointerup",M),e.addEventListener("pointercancel",M),e.addEventListener("contextmenu",y),e.addEventListener("wheel",w,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function L(){e.removeEventListener("pointerdown",_),e.removeEventListener("pointermove",x),e.removeEventListener("pointerup",M),e.removeEventListener("pointercancel",M),e.removeEventListener("contextmenu",y),e.removeEventListener("wheel",w),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return A(),H(),{update(s){let E=!!a;o=s.drag??o,r=s.wheel??r,l=Yt(s.invert),a=s.animate??a,!i&&d===null&&(e.style.cursor=o?"grab":"");let g=!!a;E&&!g?v():!E&&g&&H()},pause(){i||(i=!0,L(),v(),d=null,c=!1)},resume(){i&&(i=!1,A(),H())},destroy(){i||L(),v(),i=!0}}}function Yt(n){return n===void 0||n===!1?1:n===!0?-1:n}var Yn=typeof HTMLElement<"u"?HTMLElement:class{};function vt(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function Dn(n){return n.closest("glyph-scene")??null}var Ue=class extends Yn{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=vt(this.getAttribute("drag")),o=vt(this.getAttribute("wheel")),r=vt(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=Dn(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=Dt(o,this._readOptions())}};if(typeof customElements<"u"){if(customElements.get("glyph-scene")||customElements.define("glyph-scene",Ve),customElements.get("glyph-mesh")||customElements.define("glyph-mesh",$e),customElements.get("glyph-hotspot")||customElements.define("glyph-hotspot",We),customElements.get("glyph-perspective-camera")||customElements.define("glyph-perspective-camera",je),customElements.get("glyph-orthographic-camera")||customElements.define("glyph-orthographic-camera",Ne),!customElements.get("glyph-camera")){class n extends Ne{}customElements.define("glyph-camera",n)}customElements.get("glyph-orbit-controls")||customElements.define("glyph-orbit-controls",qe),customElements.get("glyph-map-controls")||customElements.define("glyph-map-controls",Ue)}0&&(module.exports={GlyphHotspotElement,GlyphMapControlsElement,GlyphMeshElement,GlyphOrbitControlsElement,GlyphOrthographicCameraElement,GlyphPerspectiveCameraElement,GlyphSceneElement});
@@ -1,2 +1,2 @@
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';
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-ycVyIlYL.cjs';
2
2
  import '@glyphcss/core';
@@ -1,2 +1,2 @@
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';
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-ycVyIlYL.js';
2
2
  import '@glyphcss/core';