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.
- package/dist/{elements-dJUvIMDN.d.cts → elements-ycVyIlYL.d.cts} +93 -3
- package/dist/{elements-dJUvIMDN.d.ts → elements-ycVyIlYL.d.ts} +93 -3
- package/dist/elements.cjs +5 -5
- package/dist/elements.d.cts +1 -1
- package/dist/elements.d.ts +1 -1
- package/dist/elements.js +5 -5
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +75 -3
- package/dist/index.d.ts +75 -3
- package/dist/index.js +5 -5
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlyphSceneHandle, a as GlyphCamera, b as GlyphDirectionalLight, c as GlyphAmbientLight, d as GlyphShadowOptions } from './elements-
|
|
2
|
-
export { e as GlyphHotspotElement, f as GlyphHotspotHandle, g as GlyphHotspotOptions, h as GlyphMapControlsElement, i as GlyphMeshElement, j as GlyphMeshHandle, k as GlyphMeshTransform, l as GlyphOrbitControlsElement, m as GlyphOrthographicCameraElement, n as GlyphOrthographicCameraHandle, o as GlyphOrthographicCameraOptions, p as GlyphPerspectiveCameraElement, q as GlyphPerspectiveCameraHandle, r as GlyphPerspectiveCameraOptions, s as GlyphSceneElement, t as GlyphSceneOptions, u as createGlyphCamera, v as createGlyphOrthographicCamera, w as createGlyphPerspectiveCamera, x as createGlyphScene } from './elements-
|
|
3
|
-
import { Hotspot, HotspotCell, GridSize, Polygon, WireframeEdge, RenderMode, CharRamp } from '@glyphcss/core';
|
|
1
|
+
import { G as GlyphSceneHandle, a as GlyphCamera, b as GlyphDirectionalLight, c as GlyphAmbientLight, d as GlyphShadowOptions } from './elements-ycVyIlYL.cjs';
|
|
2
|
+
export { D as DEFAULT_PERSPECTIVE, e as GlyphHotspotElement, f as GlyphHotspotHandle, g as GlyphHotspotOptions, h as GlyphMapControlsElement, i as GlyphMeshElement, j as GlyphMeshHandle, k as GlyphMeshTransform, l as GlyphOrbitControlsElement, m as GlyphOrthographicCameraElement, n as GlyphOrthographicCameraHandle, o as GlyphOrthographicCameraOptions, p as GlyphPerspectiveCameraElement, q as GlyphPerspectiveCameraHandle, r as GlyphPerspectiveCameraOptions, s as GlyphSceneElement, t as GlyphSceneOptions, u as createGlyphCamera, v as createGlyphOrthographicCamera, w as createGlyphPerspectiveCamera, x as createGlyphScene } from './elements-ycVyIlYL.cjs';
|
|
3
|
+
import { Hotspot, HotspotCell, GridSize, Polygon, WireframeEdge, RenderMode, TextureSampler, CharRamp } from '@glyphcss/core';
|
|
4
4
|
export * from '@glyphcss/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -203,11 +203,45 @@ interface RasterizeContextOptions {
|
|
|
203
203
|
* shading; `180` smooths every shared vertex. Default `60`.
|
|
204
204
|
*/
|
|
205
205
|
creaseAngle?: number;
|
|
206
|
+
/**
|
|
207
|
+
* Render both faces of every polygon (no backface culling). Default `false`
|
|
208
|
+
* (cull back faces — correct + faster for closed meshes). Set `true` for
|
|
209
|
+
* single-sided surfaces whose winding isn't guaranteed to face the camera —
|
|
210
|
+
* e.g. level geometry imported from a BSP — matching how a CSS/DOM renderer
|
|
211
|
+
* (polycss) shows both sides. Without it, "back-wound" faces vanish.
|
|
212
|
+
*/
|
|
213
|
+
doubleSided?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Supersampled anti-aliasing factor (solid mode). `1` (default) = off. `2`/`3`
|
|
216
|
+
* rasterize at N× the grid resolution and box-average down, removing the
|
|
217
|
+
* motion crawl where sub-cell-sized surfaces flip their per-cell winner
|
|
218
|
+
* frame-to-frame. Cost scales ~N². Use `2` for a big stability win at ~4× cost.
|
|
219
|
+
*/
|
|
220
|
+
supersample?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Temporal anti-aliasing: exponential blend of this frame with the previous
|
|
223
|
+
* one, weight in [0,1) (history weight). `0` (default) = off. Smooths the
|
|
224
|
+
* frame-to-frame crawl of edges that move faster than spatial supersampling
|
|
225
|
+
* can cover, at the cost of motion ghosting. Needs `temporalHistory` retained
|
|
226
|
+
* across renders (the scene does this).
|
|
227
|
+
*/
|
|
228
|
+
temporalBlend?: number;
|
|
206
229
|
shadow?: GlyphShadowOptions;
|
|
207
230
|
/** Per-polygon cast flag (parallel to `polygons` array). True = this poly's mesh has castShadow. */
|
|
208
231
|
castShadowFlags?: boolean[];
|
|
209
232
|
/** Per-polygon receive flag (parallel to `polygons` array). True = this poly's mesh has receiveShadow. */
|
|
210
233
|
receiveShadowFlags?: boolean[];
|
|
234
|
+
/** Per-polygon relative depth bias (parallel to `polygons`). `pixelDepth *= 1 + bias`. */
|
|
235
|
+
depthBiases?: number[];
|
|
236
|
+
/**
|
|
237
|
+
* Global depth-test deadband (0 = exact, the default). A polygon replaces the
|
|
238
|
+
* current cell only when nearer by more than this relative fraction, so
|
|
239
|
+
* near-coplanar surfaces (overlapping brushes, decals, a translucent plane
|
|
240
|
+
* over its backing face) keep a STABLE winner instead of z-fighting per-cell
|
|
241
|
+
* as the camera moves. A CSS/DOM renderer gets this for free from stacking
|
|
242
|
+
* order; a projection-painted depth buffer needs the deadband. Typical 0.002–0.01.
|
|
243
|
+
*/
|
|
244
|
+
depthEpsilon?: number;
|
|
211
245
|
}
|
|
212
246
|
/**
|
|
213
247
|
* Cross-frame per-triangle shading cache. The Lambert intensities and lit
|
|
@@ -223,6 +257,29 @@ interface ShadeCache {
|
|
|
223
257
|
iC: number[];
|
|
224
258
|
lit: (string | null)[];
|
|
225
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Retained previous-frame buffer for temporal anti-aliasing. Per output cell:
|
|
262
|
+
* blended ramp index + RGB. The scene keeps one and reuses it across renders;
|
|
263
|
+
* `rasterize` resets it when the grid size changes.
|
|
264
|
+
*/
|
|
265
|
+
interface TemporalHistory {
|
|
266
|
+
idx: Float32Array;
|
|
267
|
+
r: Float32Array;
|
|
268
|
+
g: Float32Array;
|
|
269
|
+
b: Float32Array;
|
|
270
|
+
cols: number;
|
|
271
|
+
rows: number;
|
|
272
|
+
/** Snapshot of the camera that produced the stored frame (for reprojection). */
|
|
273
|
+
cam: {
|
|
274
|
+
rotX: number;
|
|
275
|
+
rotY: number;
|
|
276
|
+
target: [number, number, number];
|
|
277
|
+
zoom: number;
|
|
278
|
+
perspective: number;
|
|
279
|
+
distance: number;
|
|
280
|
+
stretch: number;
|
|
281
|
+
} | null;
|
|
282
|
+
}
|
|
226
283
|
interface RasterizeContext {
|
|
227
284
|
camera: GlyphCamera;
|
|
228
285
|
grid: GridSize;
|
|
@@ -236,11 +293,26 @@ interface RasterizeContext {
|
|
|
236
293
|
useColors: boolean;
|
|
237
294
|
smoothShading: boolean;
|
|
238
295
|
creaseAngle: number;
|
|
296
|
+
doubleSided: boolean;
|
|
297
|
+
supersample: number;
|
|
298
|
+
temporalBlend: number;
|
|
239
299
|
shadow: GlyphShadowOptions | undefined;
|
|
240
300
|
castShadowFlags: boolean[];
|
|
241
301
|
receiveShadowFlags: boolean[];
|
|
302
|
+
depthBiases?: number[];
|
|
303
|
+
/** Global depth-test deadband — see {@link RasterizeContextOptions.depthEpsilon}. */
|
|
304
|
+
depthEpsilon?: number;
|
|
242
305
|
/** Optional cross-frame shading cache (see {@link ShadeCache}). */
|
|
243
306
|
shadeCache?: ShadeCache | null;
|
|
307
|
+
/**
|
|
308
|
+
* Decoded texture pixel samplers keyed by texture URL. When a polygon has a
|
|
309
|
+
* texture + UVs and its sampler is present here, the solid rasterizer samples
|
|
310
|
+
* the texture per cell (full image, glyph-resolution) instead of using the
|
|
311
|
+
* flat baked `poly.color`. Built by the scene via `buildTextureSamplers`.
|
|
312
|
+
*/
|
|
313
|
+
textureSamplers?: Map<string, TextureSampler> | null;
|
|
314
|
+
/** Optional retained previous-frame buffer for temporal AA. */
|
|
315
|
+
temporalHistory?: TemporalHistory | null;
|
|
244
316
|
}
|
|
245
317
|
declare function buildRasterizeContext(opts: RasterizeContextOptions): RasterizeContext;
|
|
246
318
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlyphSceneHandle, a as GlyphCamera, b as GlyphDirectionalLight, c as GlyphAmbientLight, d as GlyphShadowOptions } from './elements-
|
|
2
|
-
export { e as GlyphHotspotElement, f as GlyphHotspotHandle, g as GlyphHotspotOptions, h as GlyphMapControlsElement, i as GlyphMeshElement, j as GlyphMeshHandle, k as GlyphMeshTransform, l as GlyphOrbitControlsElement, m as GlyphOrthographicCameraElement, n as GlyphOrthographicCameraHandle, o as GlyphOrthographicCameraOptions, p as GlyphPerspectiveCameraElement, q as GlyphPerspectiveCameraHandle, r as GlyphPerspectiveCameraOptions, s as GlyphSceneElement, t as GlyphSceneOptions, u as createGlyphCamera, v as createGlyphOrthographicCamera, w as createGlyphPerspectiveCamera, x as createGlyphScene } from './elements-
|
|
3
|
-
import { Hotspot, HotspotCell, GridSize, Polygon, WireframeEdge, RenderMode, CharRamp } from '@glyphcss/core';
|
|
1
|
+
import { G as GlyphSceneHandle, a as GlyphCamera, b as GlyphDirectionalLight, c as GlyphAmbientLight, d as GlyphShadowOptions } from './elements-ycVyIlYL.js';
|
|
2
|
+
export { D as DEFAULT_PERSPECTIVE, e as GlyphHotspotElement, f as GlyphHotspotHandle, g as GlyphHotspotOptions, h as GlyphMapControlsElement, i as GlyphMeshElement, j as GlyphMeshHandle, k as GlyphMeshTransform, l as GlyphOrbitControlsElement, m as GlyphOrthographicCameraElement, n as GlyphOrthographicCameraHandle, o as GlyphOrthographicCameraOptions, p as GlyphPerspectiveCameraElement, q as GlyphPerspectiveCameraHandle, r as GlyphPerspectiveCameraOptions, s as GlyphSceneElement, t as GlyphSceneOptions, u as createGlyphCamera, v as createGlyphOrthographicCamera, w as createGlyphPerspectiveCamera, x as createGlyphScene } from './elements-ycVyIlYL.js';
|
|
3
|
+
import { Hotspot, HotspotCell, GridSize, Polygon, WireframeEdge, RenderMode, TextureSampler, CharRamp } from '@glyphcss/core';
|
|
4
4
|
export * from '@glyphcss/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -203,11 +203,45 @@ interface RasterizeContextOptions {
|
|
|
203
203
|
* shading; `180` smooths every shared vertex. Default `60`.
|
|
204
204
|
*/
|
|
205
205
|
creaseAngle?: number;
|
|
206
|
+
/**
|
|
207
|
+
* Render both faces of every polygon (no backface culling). Default `false`
|
|
208
|
+
* (cull back faces — correct + faster for closed meshes). Set `true` for
|
|
209
|
+
* single-sided surfaces whose winding isn't guaranteed to face the camera —
|
|
210
|
+
* e.g. level geometry imported from a BSP — matching how a CSS/DOM renderer
|
|
211
|
+
* (polycss) shows both sides. Without it, "back-wound" faces vanish.
|
|
212
|
+
*/
|
|
213
|
+
doubleSided?: boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Supersampled anti-aliasing factor (solid mode). `1` (default) = off. `2`/`3`
|
|
216
|
+
* rasterize at N× the grid resolution and box-average down, removing the
|
|
217
|
+
* motion crawl where sub-cell-sized surfaces flip their per-cell winner
|
|
218
|
+
* frame-to-frame. Cost scales ~N². Use `2` for a big stability win at ~4× cost.
|
|
219
|
+
*/
|
|
220
|
+
supersample?: number;
|
|
221
|
+
/**
|
|
222
|
+
* Temporal anti-aliasing: exponential blend of this frame with the previous
|
|
223
|
+
* one, weight in [0,1) (history weight). `0` (default) = off. Smooths the
|
|
224
|
+
* frame-to-frame crawl of edges that move faster than spatial supersampling
|
|
225
|
+
* can cover, at the cost of motion ghosting. Needs `temporalHistory` retained
|
|
226
|
+
* across renders (the scene does this).
|
|
227
|
+
*/
|
|
228
|
+
temporalBlend?: number;
|
|
206
229
|
shadow?: GlyphShadowOptions;
|
|
207
230
|
/** Per-polygon cast flag (parallel to `polygons` array). True = this poly's mesh has castShadow. */
|
|
208
231
|
castShadowFlags?: boolean[];
|
|
209
232
|
/** Per-polygon receive flag (parallel to `polygons` array). True = this poly's mesh has receiveShadow. */
|
|
210
233
|
receiveShadowFlags?: boolean[];
|
|
234
|
+
/** Per-polygon relative depth bias (parallel to `polygons`). `pixelDepth *= 1 + bias`. */
|
|
235
|
+
depthBiases?: number[];
|
|
236
|
+
/**
|
|
237
|
+
* Global depth-test deadband (0 = exact, the default). A polygon replaces the
|
|
238
|
+
* current cell only when nearer by more than this relative fraction, so
|
|
239
|
+
* near-coplanar surfaces (overlapping brushes, decals, a translucent plane
|
|
240
|
+
* over its backing face) keep a STABLE winner instead of z-fighting per-cell
|
|
241
|
+
* as the camera moves. A CSS/DOM renderer gets this for free from stacking
|
|
242
|
+
* order; a projection-painted depth buffer needs the deadband. Typical 0.002–0.01.
|
|
243
|
+
*/
|
|
244
|
+
depthEpsilon?: number;
|
|
211
245
|
}
|
|
212
246
|
/**
|
|
213
247
|
* Cross-frame per-triangle shading cache. The Lambert intensities and lit
|
|
@@ -223,6 +257,29 @@ interface ShadeCache {
|
|
|
223
257
|
iC: number[];
|
|
224
258
|
lit: (string | null)[];
|
|
225
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Retained previous-frame buffer for temporal anti-aliasing. Per output cell:
|
|
262
|
+
* blended ramp index + RGB. The scene keeps one and reuses it across renders;
|
|
263
|
+
* `rasterize` resets it when the grid size changes.
|
|
264
|
+
*/
|
|
265
|
+
interface TemporalHistory {
|
|
266
|
+
idx: Float32Array;
|
|
267
|
+
r: Float32Array;
|
|
268
|
+
g: Float32Array;
|
|
269
|
+
b: Float32Array;
|
|
270
|
+
cols: number;
|
|
271
|
+
rows: number;
|
|
272
|
+
/** Snapshot of the camera that produced the stored frame (for reprojection). */
|
|
273
|
+
cam: {
|
|
274
|
+
rotX: number;
|
|
275
|
+
rotY: number;
|
|
276
|
+
target: [number, number, number];
|
|
277
|
+
zoom: number;
|
|
278
|
+
perspective: number;
|
|
279
|
+
distance: number;
|
|
280
|
+
stretch: number;
|
|
281
|
+
} | null;
|
|
282
|
+
}
|
|
226
283
|
interface RasterizeContext {
|
|
227
284
|
camera: GlyphCamera;
|
|
228
285
|
grid: GridSize;
|
|
@@ -236,11 +293,26 @@ interface RasterizeContext {
|
|
|
236
293
|
useColors: boolean;
|
|
237
294
|
smoothShading: boolean;
|
|
238
295
|
creaseAngle: number;
|
|
296
|
+
doubleSided: boolean;
|
|
297
|
+
supersample: number;
|
|
298
|
+
temporalBlend: number;
|
|
239
299
|
shadow: GlyphShadowOptions | undefined;
|
|
240
300
|
castShadowFlags: boolean[];
|
|
241
301
|
receiveShadowFlags: boolean[];
|
|
302
|
+
depthBiases?: number[];
|
|
303
|
+
/** Global depth-test deadband — see {@link RasterizeContextOptions.depthEpsilon}. */
|
|
304
|
+
depthEpsilon?: number;
|
|
242
305
|
/** Optional cross-frame shading cache (see {@link ShadeCache}). */
|
|
243
306
|
shadeCache?: ShadeCache | null;
|
|
307
|
+
/**
|
|
308
|
+
* Decoded texture pixel samplers keyed by texture URL. When a polygon has a
|
|
309
|
+
* texture + UVs and its sampler is present here, the solid rasterizer samples
|
|
310
|
+
* the texture per cell (full image, glyph-resolution) instead of using the
|
|
311
|
+
* flat baked `poly.color`. Built by the scene via `buildTextureSamplers`.
|
|
312
|
+
*/
|
|
313
|
+
textureSamplers?: Map<string, TextureSampler> | null;
|
|
314
|
+
/** Optional retained previous-frame buffer for temporal AA. */
|
|
315
|
+
temporalHistory?: TemporalHistory | null;
|
|
244
316
|
}
|
|
245
317
|
declare function buildRasterizeContext(opts: RasterizeContextOptions): RasterizeContext;
|
|
246
318
|
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var at=Math.PI/180;function ct(t,n,e){let o=t[1],r=t[0],s=t[2],l=e*at,i=Math.cos(l),u=Math.sin(l),d=o*i-r*u,h=o*u+r*i,c=s,f=n*at,g=Math.cos(f),y=Math.sin(f),w=h*g-c*y,M=h*y+c*g;return[d,w,M]}function ve(t={}){let n={rotX:t.rotX??65,rotY:t.rotY??45,distance:t.distance??6,zoom:t.zoom??.65,stretch:t.stretch??1,target:[0,0,0],eyeMode:!1,focal:1},[e,o]=t.center??[.5,.5];return{kind:"perspective",get rotX(){return n.rotX},set rotX(r){n.rotX=r},get rotY(){return n.rotY},set rotY(r){n.rotY=r},get distance(){return n.distance},set distance(r){n.distance=r},get zoom(){return n.zoom},set zoom(r){n.zoom=r},get stretch(){return n.stretch},set stretch(r){n.stretch=r},get target(){return n.target},set target(r){n.target=r},get eyeMode(){return n.eyeMode},set eyeMode(r){n.eyeMode=r},project(r,s,l,i){let d=50/i,h=[r[0]-n.target[0],r[1]-n.target[1],r[2]-n.target[2]],c=ct(h,n.rotX,n.rotY);if(n.eyeMode){if(c[2]>=-.001)return[NaN,NaN,c[2]];let v=n.focal/-c[2],E=c[0]*v*n.zoom*50,L=c[1]*v*n.zoom*50,a=s*e+E/d*n.stretch,m=l*o+L/50;return[a,m,c[2]]}let f=.001,g=n.distance-c[2];if(g<f)return[NaN,NaN,c[2]];let y=n.distance/g,w=c[0]*y*n.zoom*50,M=c[1]*y*n.zoom*50,_=s*e+w/d*n.stretch,G=l*o+M/50;return[_,G,c[2]]}}}function Me(t={}){let n={rotX:t.rotX??65,rotY:t.rotY??45,distance:0,zoom:t.zoom??.65,stretch:1,target:[0,0,0]},[e,o]=t.center??[.5,.5];return{kind:"orthographic",get rotX(){return n.rotX},set rotX(r){n.rotX=r},get rotY(){return n.rotY},set rotY(r){n.rotY=r},get distance(){return n.distance},set distance(r){n.distance=r},get zoom(){return n.zoom},set zoom(r){n.zoom=r},get stretch(){return n.stretch},set stretch(r){n.stretch=r},get target(){return n.target},set target(r){n.target=r},get eyeMode(){return!1},set eyeMode(r){},project(r,s,l,i){let d=50/i,h=[r[0]-n.target[0],r[1]-n.target[1],r[2]-n.target[2]],c=ct(h,n.rotX,n.rotY),f=c[0]*n.zoom*50,g=c[1]*n.zoom*50,y=s*e+f/d,w=l*o+g/50;return[y,w,c[2]]}}}var Lt=Me;var _t={direction:[-.5,-.7,-.5],intensity:1},Ht={intensity:.4};function Pt(t){let n=new Set,e=[];for(let o of t){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],u=`${l[0]},${l[1]},${l[2]}`,d=`${i[0]},${i[1]},${i[2]}`,h=u<d?`${u}|${d}`:`${d}|${u}`;if(n.has(h))continue;n.add(h);let c={from:l,to:i,weight:2};o.color&&(c.color=o.color),e.push(c)}}return e}function Be(t){let n=t.polygons??[],e=t.mode??(n.length?"solid":"wireframe"),o=t.wireframe??(e==="wireframe"?Pt(n):[]);return{camera:t.camera,grid:t.grid,polygons:n,wireframe:o,mode:e,directionalLight:t.directionalLight??_t,ambientLight:t.ambientLight??Ht,glyphPalette:t.glyphPalette??"default",useColors:t.useColors??!0,smoothShading:t.smoothShading??!1,creaseAngle:t.creaseAngle??60,shadow:t.shadow,castShadowFlags:t.castShadowFlags??[],receiveShadowFlags:t.receiveShadowFlags??[]}}var Tt=" .:-=+*#%@".split(""),zt=" .:-=+*#%@".split(""),xe={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("")}},Ot=xe.default;function Ae(t){return xe[t]??xe.default}function Ge(t){let{camera:n,grid:e,wireframe:o,mode:r}=t,{cols:s,rows:l,cellAspect:i}=e;if(r==="solid")return It(t,s,l,i);let u=Ae(t.glyphPalette),d=new Uint8Array(s*l),h=t.useColors?new Array(s*l).fill(null):null;for(let c of o){let f=n.project(c.from,s,l,i),g=n.project(c.to,s,l,i);f[0]!==f[0]||g[0]!==g[0]||Nt(d,h,f[0]|0,f[1]|0,g[0]|0,g[1]|0,c.weight??2,c.color??null,s,l)}return Vt(d,h,s,l,u)}function It(t,n,e,o){let{camera:r,polygons:s,directionalLight:l,ambientLight:i,smoothShading:u,creaseAngle:d,castShadowFlags:h,receiveShadowFlags:c}=t,f=Ae(t.glyphPalette).solid,g=f.length-1,y=new Array(n*e).fill(" "),w=t.useColors,M=w?new Array(n*e).fill(null):null,_=new Float64Array(n*e).fill(-1/0),G=l.direction,P=Math.hypot(G[0],G[1],G[2])||1,v=G[0]/P,E=G[1]/P,L=G[2]/P,a=l.intensity??1,m=i.intensity??.4,b=Ee(l.color??"#ffffff"),C=Ee(i.color??"#ffffff"),p=u&&d>0?Dt(s,d):null,x=new Map,S=t.shadow,T=S!=null&&h.length>0?Ft(s,h,v,E,L):null,H=S?.opacity??.25,I=S?.lift??.05,R=S?.color??"#000000",q=T?Ee(R):[0,0,0],z=globalThis.__glyphPerfDetail,U=z?performance.now():0,Y=[],O=t.shadeCache??null,k=-1;for(let re=0;re<s.length;re++){let fe=s[re],D=fe.vertices;if(!(D.length<3)){for(let B=0;B<D.length;B++)Y[B]=r.project(D[B],n,e,o);for(let B=1;B<D.length-1;B++){k++;let ye=0,N=B,K=B+1,Z=D[ye],oe=D[N],ie=D[K],F=Y[ye],X=Y[N],V=Y[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 A=oe[0]-Z[0],le=oe[1]-Z[1],ae=oe[2]-Z[2],ce=ie[0]-Z[0],nt=ie[1]-Z[1],rt=ie[2]-Z[2],ot=le*rt-ae*nt,it=ae*ce-A*rt,st=A*nt-le*ce,He=Math.hypot(ot,it,st)||1,yt=ot/He,gt=it/He,bt=st/He,Pe,Te,ze,Oe,Ie,Re,ke,Fe,Ye;if(p){let ge=p[re],ee=ge[ye],ue=ge[N],be=ge[K];Pe=ee[0],Te=ee[1],ze=ee[2],Oe=ue[0],Ie=ue[1],Re=ue[2],ke=be[0],Fe=be[1],Ye=be[2]}else Pe=Oe=ke=yt,Te=Ie=Fe=gt,ze=Re=Ye=bt;let vt=Math.max(0,-(Pe*v+Te*E+ze*L)),Et=Math.max(0,-(Oe*v+Ie*E+Re*L)),wt=Math.max(0,-(ke*v+Fe*E+Ye*L));if($=Math.min(1,m+vt*a),J=Math.min(1,m+Et*a),Q=Math.min(1,m+wt*a),w){let ge=($+J+Q)/3,ee=Math.max(0,ge-m),ue=fe.color??"#ffffff",be=ee*255|0,lt=`${ue}:${be}`,Ce=x.get(lt);if(Ce===void 0){let De=Ee(ue),Ct=m*C[0]/255+ee*b[0]/255,Mt=m*C[1]/255+ee*b[1]/255,xt=m*C[2]/255+ee*b[2]/255,At=Math.min(255,De[0]*Ct),Gt=Math.min(255,De[1]*Mt),St=Math.min(255,De[2]*xt);Ce=`#${he(At)}${he(Gt)}${he(St)}`,x.set(lt,Ce)}se=Ce}O!==null&&(O.iA[k]=$,O.iB[k]=J,O.iC[k]=Q,O.lit[k]=se)}let _e=c[re]??!1,we=null;if(T!==null&&_e){let A=T,le=de(Z,A.right[0],A.right[1],A.right[2],A.up[0],A.up[1],A.up[2],A.dir[0],A.dir[1],A.dir[2],A.uMin,A.uMax,A.vMin,A.vMax),ae=de(oe,A.right[0],A.right[1],A.right[2],A.up[0],A.up[1],A.up[2],A.dir[0],A.dir[1],A.dir[2],A.uMin,A.uMax,A.vMin,A.vMax),ce=de(ie,A.right[0],A.right[1],A.right[2],A.up[0],A.up[1],A.up[2],A.dir[0],A.dir[1],A.dir[2],A.uMin,A.uMax,A.vMin,A.vMax);we={map:A,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:H,shadowColorRgb:q,shadowColorHex:R,litCache:x}}Yt(F[0],F[1],F[2],$,X[0],X[1],X[2],J,V[0],V[1],V[2],Q,f,g,se,y,M,_,n,e,we)}}}z&&(z.loop??(z.loop=[])).push(performance.now()-U);let ne=z?performance.now():0,me=Bt(y,M,n,e);return z&&(z.string??(z.string=[])).push(performance.now()-ne),me}var Rt=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(t,n,e,o,r,s,l,i,u,d,h,c,f,g){let y=n*t[0]+e*t[1]+o*t[2],w=r*t[0]+s*t[1]+l*t[2],M=-(i*t[0]+u*t[1]+d*t[2]),_=(y-h)/(c-h)*(W-1),G=(w-f)/(g-f)*(W-1);return[_,G,M]}function kt(t,n,e,o){let r=n[0],s=n[1],l=n[2],i=e[0],u=e[1],d=e[2],h=o[0],c=o[1],f=o[2],g=(i-r)*(c-s)-(u-s)*(h-r);if(g===0)return;let y=1/g,w=r<i?r:i;h<w&&(w=h);let M=r>i?r:i;h>M&&(M=h);let _=s<u?s:u;c<_&&(_=c);let G=s>u?s:u;c>G&&(G=c);let P=Math.max(0,Math.ceil(w)),v=Math.min(W-1,Math.floor(M)),E=Math.max(0,Math.ceil(_)),L=Math.min(W-1,Math.floor(G));if(P>v||E>L)return;let a=g>0;for(let m=E;m<=L;m++)for(let b=P;b<=v;b++){let C=b,p=m,x=(i-C)*(c-p)-(u-p)*(h-C),S=(h-C)*(s-p)-(c-p)*(r-C),T=(r-C)*(u-p)-(s-p)*(i-C);if(a?x<0||S<0||T<0:x>0||S>0||T>0)continue;let H=(x*l+S*d+T*f)*y,I=m*W+b;H>t[I]&&(t[I]=H)}}function Ft(t,n,e,o,r){let s,l,i;Math.abs(e)<.9?(s=0,l=r,i=-o):(s=-r,l=0,i=e);let u=Math.hypot(s,l,i);s/=u,l/=u,i/=u;let d=l*r-i*o,h=i*e-s*r,c=s*o-l*e,f=1/0,g=-1/0,y=1/0,w=-1/0,M=!1;for(let v=0;v<t.length;v++)if(n[v]){M=!0;for(let E of t[v].vertices){let L=s*E[0]+l*E[1]+i*E[2],a=d*E[0]+h*E[1]+c*E[2];L<f&&(f=L),L>g&&(g=L),a<y&&(y=a),a>w&&(w=a)}}if(!M)return null;let _=(g-f)*.05+.01,G=(w-y)*.05+.01;f-=_,g+=_,y-=G,w+=G;let P=new Float64Array(W*W).fill(-1/0);for(let v=0;v<t.length;v++){if(!n[v])continue;let E=t[v].vertices;if(!(E.length<3))for(let L=1;L<E.length-1;L++){let a=E[0],m=E[L],b=E[L+1],C=de(a,s,l,i,d,h,c,e,o,r,f,g,y,w),p=de(m,s,l,i,d,h,c,e,o,r,f,g,y,w),x=de(b,s,l,i,d,h,c,e,o,r,f,g,y,w);kt(P,C,p,x)}}return{buf:P,right:[s,l,i],up:[d,h,c],dir:[e,o,r],uMin:f,uMax:g,vMin:y,vMax:w}}function Yt(t,n,e,o,r,s,l,i,u,d,h,c,f,g,y,w,M,_,G,P,v){let E=(r-t)*(d-n)-(s-n)*(u-t);if(E===0||E>0)return;let L=1/E,a=E>0,m=t<r?t:r;u<m&&(m=u);let b=t>r?t:r;u>b&&(b=u);let C=n<s?n:s;d<C&&(C=d);let p=n>s?n:s;d>p&&(p=d);let x=Math.max(0,Math.ceil(m)),S=Math.min(G-1,Math.floor(b)),T=Math.max(0,Math.ceil(C)),H=Math.min(P-1,Math.floor(p));if(!(x>S||T>H))for(let I=T;I<=H;I++){let R=I;for(let q=x;q<=S;q++){let z=q,U=(r-z)*(d-R)-(s-R)*(u-z),Y=(u-z)*(n-R)-(d-R)*(t-z),O=(t-z)*(s-R)-(n-R)*(r-z);if(a?U<0||Y<0||O<0:U>0||Y>0||O>0)continue;let k=(U*e+Y*l+O*h)*L,ne=I*G+q;if(k>_[ne]){_[ne]=k;let me=(U*o+Y*i+O*c)*L,fe=(me<0?0:me>1?1:me)*g,D=fe|0,B=fe-D,ye=Rt[(I&3)*4+(q&3)],N=B>ye&&D<g?D+1:D;N>g&&(N=g);let K=y;if(v!==null){let Z=(U*v.luA+Y*v.luB+O*v.luC)*L,oe=(U*v.lvA+Y*v.lvB+O*v.lvC)*L,ie=(U*v.ldA+Y*v.ldB+O*v.ldC)*L,F=Z|0,X=oe|0;if(F>=0&&F<W&&X>=0&&X<W){let V=v.map.buf[X*W+F];if(V>-1/0&&ie+v.lift<V&&(N=Math.max(0,N-Math.round(v.opacity*g)),K!==null)){let Le=`shadow:${K}:${N}`,$=v.litCache.get(Le);if($===void 0){let J=Ee(K),Q=v.shadowColorRgb,se=Math.round(J[0]*(1-v.opacity)+Q[0]*v.opacity),_e=Math.round(J[1]*(1-v.opacity)+Q[1]*v.opacity),we=Math.round(J[2]*(1-v.opacity)+Q[2]*v.opacity);$=`#${he(se)}${he(_e)}${he(we)}`,v.litCache.set(Le,$)}K=$}}}w[ne]=f[N],M&&(M[ne]=K)}}}}function Dt(t,n){let e=t.length,o=new Array(e);for(let i=0;i<e;i++){let u=t[i].vertices;if(u.length<3){o[i]=[0,0,0];continue}let d=u[0],h=u[1],c=u[2],f=h[0]-d[0],g=h[1]-d[1],y=h[2]-d[2],w=c[0]-d[0],M=c[1]-d[1],_=c[2]-d[2],G=g*_-y*M,P=y*w-f*_,v=f*M-g*w,E=Math.hypot(G,P,v)||1;o[i]=[G/E,P/E,v/E]}let r=new Map;for(let i=0;i<e;i++){let u=t[i].vertices;for(let d=0;d<u.length;d++){let h=u[d],c=`${h[0]},${h[1]},${h[2]}`,f=r.get(c);f||(f=[],r.set(c,f)),(f.length===0||f[f.length-1]!==i)&&f.push(i)}}let s=Math.cos(n*Math.PI/180),l=new Array(e);for(let i=0;i<e;i++){let u=t[i].vertices,d=o[i],h=new Array(u.length);for(let c=0;c<u.length;c++){let f=u[c],g=r.get(`${f[0]},${f[1]},${f[2]}`),y=0,w=0,M=0;for(let G=0;G<g.length;G++){let P=g[G],v=o[P];d[0]*v[0]+d[1]*v[1]+d[2]*v[2]>=s&&(y+=v[0],w+=v[1],M+=v[2])}let _=Math.hypot(y,w,M)||1;h[c]=[y/_,w/_,M/_]}l[i]=h}return l}function Bt(t,n,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 u=0;u<o;u++){for(let d=0;d<e;d++){let h=u*e+d,c=t[h],f=n&&c!==" "?n[h]??null:null;f!==s&&(i(),s=f),l+=c}i(),s=null,u<o-1&&r.push(`
|
|
2
|
-
`)}return r.join("")}function
|
|
3
|
-
`)}return
|
|
1
|
+
import{buildTextureSamplers as wn}from"@glyphcss/core";var zt=Math.PI/180,Ht=.01,Ft=32e3,Zt=Ht*1.01;function ct(n,t,e){let o=n[1],r=n[0],i=n[2],l=e*zt,s=Math.cos(l),c=Math.sin(l),u=o*s-r*c,p=o*c+r*s,d=i,h=t*zt,m=Math.cos(h),f=Math.sin(h),v=p*m-d*f,C=p*f+d*m;return[u,v,C]}function Pe(n={}){let t={rotX:n.rotX??65,rotY:n.rotY??45,distance:n.distance??6,perspective:n.perspective??Ft,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 i=ct([r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],t.rotX,t.rotY),l=.001*1.01;if(t.eyeMode)return-i[2]-l;if(t.perspective>0){let s=i[2]*t.zoom*50-t.distance;return t.perspective-s-t.perspective*Zt}return t.distance-i[2]-l},project(r,i,l,s){let u=50/s,p=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],d=ct(p,t.rotX,t.rotY);if(t.eyeMode){if(d[2]>=-.001)return[NaN,NaN,d[2],NaN];let b=t.focal/-d[2],S=d[0]*b*t.zoom*50,P=d[1]*b*t.zoom*50,y=i*e+S/u*t.stretch,E=l*o+P/50;return[y,E,d[2],-1/d[2]]}if(t.perspective>0){let M=t.perspective,b=d[0]*t.zoom*50,S=d[1]*t.zoom*50,P=d[2]*t.zoom*50-t.distance,y=M-P,E=M*Ht;if(y<E)return[NaN,NaN,P,NaN];let A=M/y,L=i*e+b*A/u*t.stretch*t.fovScale,a=l*o+S*A/50*t.fovScale;return[L,a,P,1/y]}let h=.001,m=t.distance-d[2];if(m<h)return[NaN,NaN,d[2],NaN];let f=t.distance/m,v=d[0]*f*t.zoom*50,C=d[1]*f*t.zoom*50,T=i*e+v/u*t.stretch*t.fovScale,G=l*o+C/50*t.fovScale;return[T,G,d[2],1/m]}}}function qe(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,i,l,s){let u=50/s,p=[r[0]-t.target[0],r[1]-t.target[1],r[2]-t.target[2]],d=ct(p,t.rotX,t.rotY),h=d[0]*t.zoom*50,m=d[1]*t.zoom*50,f=i*e+h/u*t.fovScale,v=l*o+m/50*t.fovScale;return[f,v,d[2]]}}}var Jt=qe;var Qt={direction:[-.5,-.7,-.5],intensity:1},en={intensity:.4};function tn(n){let t=new Set,e=[];for(let o of n){let r=o.vertices;if(!(r.length<2))for(let i=0;i<r.length;i++){let l=r[i],s=r[(i+1)%r.length],c=`${l[0]},${l[1]},${l[2]}`,u=`${s[0]},${s[1]},${s[2]}`,p=c<u?`${c}|${u}`:`${u}|${c}`;if(t.has(p))continue;t.add(p);let d={from:l,to:s,weight:2};o.color&&(d.color=o.color),e.push(d)}}return e}function ut(n){let t=n.polygons??[],e=n.mode??(t.length?"solid":"wireframe"),o=n.wireframe??(e==="wireframe"?tn(t):[]);return{camera:n.camera,grid:n.grid,polygons:t,wireframe:o,mode:e,directionalLight:n.directionalLight??Qt,ambientLight:n.ambientLight??en,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}:{}}}import{sampleTexel as sn,polygonTexture as ln}from"@glyphcss/core";var nn=" .:-=+*#%@".split(""),rn=" .:-=+*#%@".split(""),Ue={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("")}},on=Ue.default;function Ke(n){return Ue[n]??Ue.default}function Ze(n){let{camera:t,grid:e,wireframe:o,mode:r}=n,{cols:i,rows:l,cellAspect:s}=e;if(r==="solid"){let d=n.supersample&&n.supersample>1?Math.floor(n.supersample):1;return an(n,i,l,s,d)}let c=Ke(n.glyphPalette),u=new Uint8Array(i*l),p=n.useColors?new Array(i*l).fill(null):null;for(let d of o){let h=t.project(d.from,i,l,s),m=t.project(d.to,i,l,s);h[0]!==h[0]||m[0]!==m[0]||gn(u,p,h[0]|0,h[1]|0,m[0]|0,m[1]|0,d.weight??2,d.color??null,i,l)}return bn(u,p,i,l,c)}function an(n,t,e,o,r){let i=t*r,l=e*r,{camera:s,polygons:c,directionalLight:u,ambientLight:p,smoothShading:d,creaseAngle:h,doubleSided:m,castShadowFlags:f,receiveShadowFlags:v}=n,C=n.depthBiases,T=n.depthEpsilon??0,G=r>1?{zoom:s.zoom,eyeDepth:R=>s.eyeDepth(R),project:(R,V,X,D)=>{let x=s.project(R,V,X,D);return[V*.5+(x[0]-V*.5)*r,X*.5+(x[1]-X*.5)*r,x[2],x[3]]}}:s,M=Ke(n.glyphPalette).solid,b=M.length-1,S=new Array(i*l).fill(" "),P=n.useColors,y=P?new Array(i*l).fill(null):null,E=new Float64Array(i*l).fill(-1/0),A=n.temporalBlend>0&&!!n.temporalHistory,L=A?new Float32Array(i*l*3).fill(NaN):null,a=u.direction,w=Math.hypot(a[0],a[1],a[2])||1,g=a[0]/w,_=a[1]/w,H=a[2]/w,F=u.intensity??1,z=p.intensity??.4,W=ze(u.color??"#ffffff"),B=ze(p.color??"#ffffff"),j=d&&h>0?mn(c,h):null,k=new Map,re=n.textureSamplers??null,N=n.shadow,q=N!=null&&f.length>0?hn(c,f,g,_,H):null,oe=N?.opacity??.25,K=N?.lift??.05,Z=N?.color??"#000000",ie=q?ze(Z):[0,0,0],I=globalThis.__glyphPerfDetail,Ye=I?performance.now():0,ye=[],J=n.shadeCache??null,Q=-1,ve=(R,V,X,D)=>{if(q===null||!D)return null;let x=q,O=Ie(R,x.right[0],x.right[1],x.right[2],x.up[0],x.up[1],x.up[2],x.dir[0],x.dir[1],x.dir[2],x.uMin,x.uMax,x.vMin,x.vMax),ee=Ie(V,x.right[0],x.right[1],x.right[2],x.up[0],x.up[1],x.up[2],x.dir[0],x.dir[1],x.dir[2],x.uMin,x.uMax,x.vMin,x.vMax),de=Ie(X,x.right[0],x.right[1],x.right[2],x.up[0],x.up[1],x.up[2],x.dir[0],x.dir[1],x.dir[2],x.uMin,x.uMax,x.vMin,x.vMax);return{map:x,luA:O[0],lvA:O[1],ldA:O[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:k}};for(let R=0;R<c.length;R++){let V=c[R],X=V.vertices;if(X.length<3)continue;let D=V.uvs,x=null;if(re!==null&&D&&D.length>=X.length){let O=ln(V);O&&(x=re.get(O)??null)}for(let O=0;O<X.length;O++)ye[O]=G.project(X[O],i,l,o);for(let O=1;O<X.length-1;O++){Q++;let ee=0,de=O,Ee=O+1,se=X[ee],pe=X[de],we=X[Ee],ae=ye[ee],ge=ye[de],xe=ye[Ee],et=(ae[0]!==ae[0]?1:0)+(ge[0]!==ge[0]?1:0)+(xe[0]!==xe[0]?1:0);if(et===3||et===0&&!m&&(ge[0]-ae[0])*(xe[1]-ae[1])-(ge[1]-ae[1])*(xe[0]-ae[0])>0)continue;let Ge,Le,Te,Be=null;if(J!==null&&J.iA[Q]!==void 0)Ge=J.iA[Q],Le=J.iB[Q],Te=J.iC[Q],Be=J.lit[Q];else{let $=pe[0]-se[0],he=pe[1]-se[1],Ae=pe[2]-se[2],me=we[0]-se[0],Xe=we[1]-se[1],$e=we[2]-se[2],We=he*$e-Ae*Xe,ke=Ae*me-$*$e,U=$*Xe-he*me,Y=Math.hypot(We,ke,U)||1,te=We/Y,fe=ke/Y,le=U/Y,ce,_e,tt,nt,rt,ot,it,st,lt;if(j){let Ne=j[R],Ce=Ne[ee],Oe=Ne[de],De=Ne[Ee];ce=Ce[0],_e=Ce[1],tt=Ce[2],nt=Oe[0],rt=Oe[1],ot=Oe[2],it=De[0],st=De[1],lt=De[2]}else ce=nt=it=te,_e=rt=st=fe,tt=ot=lt=le;let Lt=ce*g+_e*_+tt*H,Tt=nt*g+rt*_+ot*H,_t=it*g+st*_+lt*H,Yt=m?Math.abs(Lt):Math.max(0,-Lt),Vt=m?Math.abs(Tt):Math.max(0,-Tt),Xt=m?Math.abs(_t):Math.max(0,-_t);if(Ge=Math.min(1,z+Yt*F),Le=Math.min(1,z+Vt*F),Te=Math.min(1,z+Xt*F),P){let Ne=(Ge+Le+Te)/3,Ce=Math.max(0,Ne-z),Oe=V.color??"#ffffff",De=Ce*255|0,Pt=`${Oe}:${De}`,je=k.get(Pt);if(je===void 0){let at=ze(Oe),$t=z*B[0]/255+Ce*W[0]/255,Wt=z*B[1]/255+Ce*W[1]/255,jt=z*B[2]/255+Ce*W[2]/255,qt=Math.min(255,at[0]*$t),Ut=Math.min(255,at[1]*Wt),Kt=Math.min(255,at[2]*jt);je=`#${ne(qt)}${ne(Ut)}${ne(Kt)}`,k.set(Pt,je)}Be=je}J!==null&&(J.iA[Q]=Ge,J.iB[Q]=Le,J.iC[Q]=Te,J.lit[Q]=Be)}let Mt=v[R]??!1,Fe=1+(C?.[R]??0),Gt=null;if(x!==null&&D){let $=D[ee],he=D[de],Ae=D[Ee],me=Math.max(0,(Ge+Le+Te)/3-z);Gt={sampler:x,ua:$[0],va:$[1],ub:he[0],vb:he[1],uc:Ae[0],vc:Ae[1],tintR:z*B[0]/255+me*W[0]/255,tintG:z*B[1]/255+me*W[1]/255,tintB:z*B[2]/255+me*W[2]/255}}if(et===0)Ot(ae[0],ae[1],(ae[3]??ae[2])*Fe,Ge,ge[0],ge[1],(ge[3]??ge[2])*Fe,Le,xe[0],xe[1],(xe[3]??xe[2])*Fe,Te,M,b,Be,S,y,E,i,l,ve(se,pe,we,Mt),m,se,pe,we,L,T,Gt);else{let $=[],he=[],Ae=[se,pe,we],me=[Ge,Le,Te],Xe=G.eyeDepth(se),$e=G.eyeDepth(pe),We=G.eyeDepth(we),ke=[Xe,$e,We];for(let U=0;U<3;U++){let Y=(U+1)%3,te=ke[U],fe=ke[Y];if(te>0&&($.push(Ae[U]),he.push(me[U])),te>0!=fe>0){let le=te/(te-fe),ce=Ae[U],_e=Ae[Y];$.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[Y]-me[U]))}}if($.length>=3){let U=$.map(Y=>G.project(Y,i,l,o));for(let Y=1;Y<$.length-1;Y++){let te=U[0],fe=U[Y],le=U[Y+1],ce=(fe[0]-te[0])*(le[1]-te[1])-(fe[1]-te[1])*(le[0]-te[0]);!m&&ce>0||Ot(te[0],te[1],(te[3]??te[2])*Fe,he[0],fe[0],fe[1],(fe[3]??fe[2])*Fe,he[Y],le[0],le[1],(le[3]??le[2])*Fe,he[Y+1],M,b,Be,S,y,E,i,l,ve($[0],$[Y],$[Y+1],Mt),m,$[0],$[Y],$[Y+1],L,T,null)}}}}}I&&(I.loop??(I.loop=[])).push(performance.now()-Ye);let Ct=I?performance.now():0,He=S,Se=y,Ve=L;if(r>1){let R=un(S,y,E,L,t,e,r,M);He=R.glyphBuf,Se=R.colorBuf,Ve=R.worldPos}A&&cn(He,Se,Ve,t,e,o,M,n.temporalBlend,n.temporalHistory,s);let Qe=fn(He,Se,t,e);return I&&(I.string??(I.string=[])).push(performance.now()-Ct),Qe}function cn(n,t,e,o,r,i,l,s,c,u){let p=o*r,d=l.length-1,h=new Map;for(let M=0;M<l.length;M++)h.set(l[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=Pe({rotX:m.rotX,rotY:m.rotY,distance:m.distance,perspective:m.perspective,zoom:m.zoom,stretch:m.stretch});M.target=m.target,f=b=>M.project(b,o,r,i)}let v=new Float32Array(p),C=new Float32Array(p),T=new Float32Array(p),G=new Float32Array(p);for(let M=0;M<r;M++)for(let b=0;b<o;b++){let S=M*o+b,P=h.get(n[S])??0,y=0,E=0,A=0,L=t?t[S]:null;if(L){let N=ze(L);y=N[0],E=N[1],A=N[2]}let a=0,w=0,g=0,_=0,H=0,F=e[S*3];if(f&&F===F){let N=f([F,e[S*3+1],e[S*3+2]]),q=Math.round(N[0]),oe=Math.round(N[1]);if(N[0]===N[0]&&q>=0&&q<o&&oe>=0&&oe<r){let K=oe*o+q;w=c.idx[K],g=c.r[K],_=c.g[K],H=c.b[K],a=s}}let z=1-a,W=z*P+a*w,B=z*y+a*g,j=z*E+a*_,k=z*A+a*H;v[S]=W,C[S]=B,T[S]=j,G[S]=k;let re=Math.round(W);re<0?re=0:re>d&&(re=d),n[S]=l[re],t&&(t[S]=re===0?null:`#${ne(B)}${ne(j)}${ne(k)}`)}c.idx=v,c.r=C,c.g=T,c.b=G,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 un(n,t,e,o,r,i,l,s){let c=new Map;for(let v=0;v<s.length;v++)c.set(s[v],v);let u=s.length-1,p=r*l,d=new Array(r*i).fill(" "),h=t?new Array(r*i).fill(null):null,m=o?new Float32Array(r*i*3).fill(NaN):null,f=1/(l*l);for(let v=0;v<i;v++)for(let C=0;C<r;C++){let T=0,G=0,M=0,b=0,S=0,P=0,y=0,E=0;for(let a=0;a<l;a++){let w=(v*l+a)*p+C*l;for(let g=0;g<l;g++){let _=w+g;if(e[_]!==-1/0){if(T+=c.get(n[_])??0,G++,h){let H=t[_];if(H){let F=ze(H);M+=F[0],b+=F[1],S+=F[2]}}m&&(P+=o[_*3],y+=o[_*3+1],E+=o[_*3+2])}}}let A=v*r+C;if(G===0)continue;let L=Math.round(T*f);L<0?L=0:L>u&&(L=u),d[A]=s[L],h&&(h[A]=`#${ne(M/G)}${ne(b/G)}${ne(S/G)}`),m&&(m[A*3]=P/G,m[A*3+1]=y/G,m[A*3+2]=E/G)}return{glyphBuf:d,colorBuf:h,worldPos:m}}var dn=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 Ie(n,t,e,o,r,i,l,s,c,u,p,d,h,m){let f=t*n[0]+e*n[1]+o*n[2],v=r*n[0]+i*n[1]+l*n[2],C=-(s*n[0]+c*n[1]+u*n[2]),T=(f-p)/(d-p)*(be-1),G=(v-h)/(m-h)*(be-1);return[T,G,C]}function pn(n,t,e,o){let r=t[0],i=t[1],l=t[2],s=e[0],c=e[1],u=e[2],p=o[0],d=o[1],h=o[2],m=(s-r)*(d-i)-(c-i)*(p-r);if(m===0)return;let f=1/m,v=r<s?r:s;p<v&&(v=p);let C=r>s?r:s;p>C&&(C=p);let T=i<c?i:c;d<T&&(T=d);let G=i>c?i:c;d>G&&(G=d);let M=Math.max(0,Math.ceil(v)),b=Math.min(be-1,Math.floor(C)),S=Math.max(0,Math.ceil(T)),P=Math.min(be-1,Math.floor(G));if(M>b||S>P)return;let y=m>0;for(let E=S;E<=P;E++)for(let A=M;A<=b;A++){let L=A,a=E,w=(s-L)*(d-a)-(c-a)*(p-L),g=(p-L)*(i-a)-(d-a)*(r-L),_=(r-L)*(c-a)-(i-a)*(s-L);if(y?w<0||g<0||_<0:w>0||g>0||_>0)continue;let H=(w*l+g*u+_*h)*f,F=E*be+A;H>n[F]&&(n[F]=H)}}function hn(n,t,e,o,r){let i,l,s;Math.abs(e)<.9?(i=0,l=r,s=-o):(i=-r,l=0,s=e);let c=Math.hypot(i,l,s);i/=c,l/=c,s/=c;let u=l*r-s*o,p=s*e-i*r,d=i*o-l*e,h=1/0,m=-1/0,f=1/0,v=-1/0,C=!1;for(let b=0;b<n.length;b++)if(t[b]){C=!0;for(let S of n[b].vertices){let P=i*S[0]+l*S[1]+s*S[2],y=u*S[0]+p*S[1]+d*S[2];P<h&&(h=P),P>m&&(m=P),y<f&&(f=y),y>v&&(v=y)}}if(!C)return null;let T=(m-h)*.05+.01,G=(v-f)*.05+.01;h-=T,m+=T,f-=G,v+=G;let M=new Float64Array(be*be).fill(-1/0);for(let b=0;b<n.length;b++){if(!t[b])continue;let S=n[b].vertices;if(!(S.length<3))for(let P=1;P<S.length-1;P++){let y=S[0],E=S[P],A=S[P+1],L=Ie(y,i,l,s,u,p,d,e,o,r,h,m,f,v),a=Ie(E,i,l,s,u,p,d,e,o,r,h,m,f,v),w=Ie(A,i,l,s,u,p,d,e,o,r,h,m,f,v);pn(M,L,a,w)}}return{buf:M,right:[i,l,s],up:[u,p,d],dir:[e,o,r],uMin:h,uMax:m,vMin:f,vMax:v}}function Ot(n,t,e,o,r,i,l,s,c,u,p,d,h,m,f,v,C,T,G,M,b,S,P,y,E,A,L,a){let w=(r-n)*(u-t)-(i-t)*(c-n);if(w===0||!S&&w>0)return;let g=1/w,_=w>0,H=n<r?n:r;c<H&&(H=c);let F=n>r?n:r;c>F&&(F=c);let z=t<i?t:i;u<z&&(z=u);let W=t>i?t:i;u>W&&(W=u);let B=Math.max(0,Math.ceil(H)),j=Math.min(G-1,Math.floor(F)),k=Math.max(0,Math.ceil(z)),re=Math.min(M-1,Math.floor(W));if(!(B>j||k>re))for(let N=k;N<=re;N++){let q=N;for(let oe=B;oe<=j;oe++){let K=oe,Z=(r-K)*(u-q)-(i-q)*(c-K),ie=(c-K)*(t-q)-(u-q)*(n-K),I=(n-K)*(i-q)-(t-q)*(r-K);if(_?Z<0||ie<0||I<0:Z>0||ie>0||I>0)continue;let Ye=(Z*e+ie*l+I*p)*g,ye=N*G+oe,J=T[ye];if(Ye>(J>0?J*(1-L):J)){if(T[ye]=Ye,A!==null){let V=ye*3;A[V]=(Z*P[0]+ie*y[0]+I*E[0])*g,A[V+1]=(Z*P[1]+ie*y[1]+I*E[1])*g,A[V+2]=(Z*P[2]+ie*y[2]+I*E[2])*g}let Q=(Z*o+ie*s+I*d)*g,ve=f;if(a!==null){let V=(Z*a.ua+ie*a.ub+I*a.uc)*g,X=(Z*a.va+ie*a.vb+I*a.vc)*g,D=sn(a.sampler,V,X);if(D!==null&&D.a>8){let x=D.r*a.tintR|0;x>255&&(x=255);let O=D.g*a.tintG|0;O>255&&(O=255);let ee=D.b*a.tintB|0;ee>255&&(ee=255),ve=`#${ne(x)}${ne(O)}${ne(ee)}`,Q*=(.299*D.r+.587*D.g+.114*D.b)/255}}let He=(Q<0?0:Q>1?1:Q)*m,Se=He|0,Ve=He-Se,Qe=dn[(N&3)*4+(oe&3)],R=Ve>Qe&&Se<m?Se+1:Se;if(R>m&&(R=m),b!==null){let V=(Z*b.luA+ie*b.luB+I*b.luC)*g,X=(Z*b.lvA+ie*b.lvB+I*b.lvC)*g,D=(Z*b.ldA+ie*b.ldB+I*b.ldC)*g,x=V|0,O=X|0;if(x>=0&&x<be&&O>=0&&O<be){let ee=b.map.buf[O*be+x];if(ee>-1/0&&D+b.lift<ee&&(R=Math.max(0,R-Math.round(b.opacity*m)),ve!==null)){let de=`shadow:${ve}:${R}`,Ee=b.litCache.get(de);if(Ee===void 0){let se=ze(ve),pe=b.shadowColorRgb,we=Math.round(se[0]*(1-b.opacity)+pe[0]*b.opacity),ae=Math.round(se[1]*(1-b.opacity)+pe[1]*b.opacity),ge=Math.round(se[2]*(1-b.opacity)+pe[2]*b.opacity);Ee=`#${ne(we)}${ne(ae)}${ne(ge)}`,b.litCache.set(de,Ee)}ve=Ee}}}v[ye]=h[R],C&&(C[ye]=ve)}}}}function mn(n,t){let e=n.length,o=new Array(e);for(let s=0;s<e;s++){let c=n[s].vertices;if(c.length<3){o[s]=[0,0,0];continue}let u=c[0],p=c[1],d=c[2],h=p[0]-u[0],m=p[1]-u[1],f=p[2]-u[2],v=d[0]-u[0],C=d[1]-u[1],T=d[2]-u[2],G=m*T-f*C,M=f*v-h*T,b=h*C-m*v,S=Math.hypot(G,M,b)||1;o[s]=[G/S,M/S,b/S]}let r=new Map;for(let s=0;s<e;s++){let c=n[s].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]!==s)&&h.push(s)}}let i=Math.cos(t*Math.PI/180),l=new Array(e);for(let s=0;s<e;s++){let c=n[s].vertices,u=o[s],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,v=0,C=0;for(let G=0;G<m.length;G++){let M=m[G],b=o[M];u[0]*b[0]+u[1]*b[1]+u[2]*b[2]>=i&&(f+=b[0],v+=b[1],C+=b[2])}let T=Math.hypot(f,v,C)||1;p[d]=[f/T,v/T,C/T]}l[s]=p}return l}function fn(n,t,e,o){let r=[],i=null,l="",s=()=>{l&&(i!==null?r.push(`<span style="color:${i}">${l}</span>`):r.push(l),l="")};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!==i&&(s(),i=h),l+=d}s(),i=null,c<o-1&&r.push(`
|
|
2
|
+
`)}return r.join("")}function yn(n,t,e="y"){let{camera:o}=n,r=e==="y"?o.rotY:o.rotX,i=new Array(t);for(let l=0;l<t;l++){let s=r+l/t*Math.PI*2;e==="y"?o.rotY=s:o.rotX=s,i[l]=Ze(n)}return e==="y"?o.rotY=r:o.rotX=r,i}function gn(n,t,e,o,r,i,l,s,c,u){let p=Math.abs(r-e),d=-Math.abs(i-o),h=e<r?1:-1,m=o<i?1:-1,f=p+d;for(;;){if(e>=0&&e<c&&o>=0&&o<u){let C=o*c+e;n[C]<l&&(n[C]=l,t&&(t[C]=s))}if(e===r&&o===i)break;let v=2*f;v>=d&&(f+=d,e+=h),v<=p&&(f+=p,o+=m)}}function bn(n,t,e,o,r){let i=[],l=null,s="",c=()=>{s&&(l!==null?i.push(`<span style="color:${l}">${s}</span>`):i.push(s),s="")};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!==l&&(c(),l=f),s+=m}c(),l=null,u<o-1&&i.push(`
|
|
3
|
+
`)}return i.join("")}var It=new Map;function ze(n){let t=It.get(n);if(t!==void 0)return t;let e=vn(n);return It.set(n,e),e}function vn(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 Rt="glyph-styles";function dt(n){let t=n??(typeof document<"u"?document:void 0);if(!t||t.getElementById(Rt))return;let e=t.createElement("style");e.id=Rt,e.textContent=En,t.head.appendChild(e)}var En=`
|
|
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 @@ var at=Math.PI/180;function ct(t,n,e){let o=t[1],r=t[0],s=t[2],l=e*at,i=Math.cos
|
|
|
59
59
|
the content from the 3D vertex being labelled. */
|
|
60
60
|
transform: translate(-50%, -50%);
|
|
61
61
|
}
|
|
62
|
-
`;function
|
|
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 v(){let a=t.clientWidth,m=t.clientHeight;if(!a||!m)return;let b=P(),C=Math.max(20,Math.floor(a/b.w)),p=Math.max(8,Math.floor(m/b.h)),x=b.h/b.w,S=!1;e.cols!==C&&(e.cols=C,S=!0),e.rows!==p&&(e.rows=p,S=!0),Math.abs(e.cellAspect-x)>.01&&(e.cellAspect=x,S=!0),S&&c()}let E=null;e.autoSize&&typeof ResizeObserver<"u"&&(E=new ResizeObserver(()=>v()),E.observe(t),v());function L(){E&&(E.disconnect(),E=null),l.clear(),t.contains(o)&&t.removeChild(o)}return c(),{get host(){return t},get output(){return r},get camera(){return e.camera},add:y,addHotspot:w,rerender:M,setOptions:_,getOptions:G,fit:v,destroy:L}}function $e(t,n={}){let e=t.host,o=n.drag??!0,r=n.wheel??!0,s=ht(n.invert),l=n.clampPitch??!0,i=n.animate??!1,u=!1,d=!1,h=null,c=null,f=null,g={x:0,y:0},y=t.camera;function w(m){if(!(!o||u)&&f===null&&m.isPrimary!==!1){m.preventDefault(),f=m.pointerId,g={x:m.clientX,y:m.clientY},e.style.cursor="grabbing";try{m.target.setPointerCapture(m.pointerId)}catch{}i&&i.pauseOnInteraction!==!1&&(d=!0)}}function M(m){if(f===null||m.pointerId!==f||!o||u)return;m.preventDefault();let b=m.clientX-g.x,C=m.clientY-g.y;g={x:m.clientX,y:m.clientY};let p=s,x=1/4;y.rotY=y.rotY-b*x*p;let S=y.rotX-C*x*p;y.rotX=l?Math.max(-90,Math.min(90,S)):S,t.rerender()}function _(m){if(f===m.pointerId){f=null,e.style.cursor=o&&!u?"grab":"";try{m.target.releasePointerCapture(m.pointerId)}catch{}i&&(d=!1)}}function G(m){if(!r||u)return;m.preventDefault();let b=m.deltaY*.001;y.zoom=Math.max(.1,Math.min(500,y.zoom*(1-b))),t.rerender()}function P(m){if(!(u||!i)){if(!d){let b=c!==null?Math.min(m-c,50):16.67,C=typeof i=="object"&&i.speed?i.speed:.3,p=typeof i=="object"&&i.axis?i.axis:"y",x=C*(b/16.67);p==="y"?y.rotY=y.rotY+x:y.rotX=y.rotX+x,t.rerender()}c=m,h=requestAnimationFrame(P)}}function v(){h===null&&typeof requestAnimationFrame<"u"&&i&&(h=requestAnimationFrame(P))}function E(){h!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(h),h=null),c=null}function L(){e.addEventListener("pointerdown",w),e.addEventListener("pointermove",M),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 a(){e.removeEventListener("pointerdown",w),e.removeEventListener("pointermove",M),e.removeEventListener("pointerup",_),e.removeEventListener("pointercancel",_),e.removeEventListener("wheel",G),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return L(),v(),{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,!u&&f===null&&(e.style.cursor=o?"grab":"");let C=!!i;b&&!C?E():!b&&C&&v()},pause(){u||(u=!0,a(),E(),f=null,d=!1)},resume(){u&&(u=!1,L(),v())},destroy(){u||a(),E(),u=!0}}}function ht(t){return t===void 0||t===!1?1:t===!0?-1:t}function We(t,n={}){let e=t.host,o=n.drag??!0,r=n.wheel??!0,s=pt(n.invert),l=n.animate??!1,i=!1,u=!1,d=null,h=null,c=null,f={x:0,y:0},g=!1,y=t.camera,w=1/4,M=.02;function _(p){if(!(!o||i)&&c===null&&p.isPrimary!==!1){p.preventDefault(),c=p.pointerId,f={x:p.clientX,y:p.clientY},g=p.button===2,e.style.cursor="grabbing";try{p.target.setPointerCapture(p.pointerId)}catch{}l&&l.pauseOnInteraction!==!1&&(u=!0)}}function G(p){if(c===null||p.pointerId!==c||!o||i)return;p.preventDefault();let x=p.clientX-f.x,S=p.clientY-f.y;f={x:p.clientX,y:p.clientY};let T=s;if(g||p.shiftKey)y.rotY=y.rotY-x*w*T,y.rotX=Math.max(-90,Math.min(90,y.rotX+S*w*T));else{let H=y.target;y.target=[H[0]-x*M/y.zoom,H[1]-S*M/y.zoom,H[2]]}t.rerender()}function P(p){if(c===p.pointerId){c=null,g=!1,e.style.cursor=o&&!i?"grab":"";try{p.target.releasePointerCapture(p.pointerId)}catch{}l&&(u=!1)}}function v(p){p.preventDefault()}function E(p){if(!r||i)return;p.preventDefault();let x=p.deltaY*.001;y.zoom=Math.max(.1,Math.min(500,y.zoom*(1-x))),t.rerender()}function L(p){if(!(i||!l)){if(!u){let x=h!==null?Math.min(p-h,50):16.67,S=typeof l=="object"&&l.speed?l.speed:.3,T=typeof l=="object"&&l.axis?l.axis:"y",H=S*(x/16.67);T==="y"?y.rotY=y.rotY+H:y.rotX=y.rotX+H,t.rerender()}h=p,d=requestAnimationFrame(L)}}function a(){d===null&&typeof requestAnimationFrame<"u"&&l&&(d=requestAnimationFrame(L))}function m(){d!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(d),d=null),h=null}function b(){e.addEventListener("pointerdown",_),e.addEventListener("pointermove",G),e.addEventListener("pointerup",P),e.addEventListener("pointercancel",P),e.addEventListener("contextmenu",v),e.addEventListener("wheel",E,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function C(){e.removeEventListener("pointerdown",_),e.removeEventListener("pointermove",G),e.removeEventListener("pointerup",P),e.removeEventListener("pointercancel",P),e.removeEventListener("contextmenu",v),e.removeEventListener("wheel",E),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return b(),a(),{update(p){let x=!!l;o=p.drag??o,r=p.wheel??r,s=pt(p.invert),l=p.animate??l,!i&&c===null&&(e.style.cursor=o?"grab":"");let S=!!l;x&&!S?m():!x&&S&&a()},pause(){i||(i=!0,C(),m(),c=null,u=!1)},resume(){i&&(i=!1,b(),a())},destroy(){i||C(),m(),i=!0}}}function pt(t){return t===void 0||t===!1?1:t===!0?-1:t}function Ut(t,n={}){if(t.camera.kind!=="perspective")throw new Error("glyphcss: GlyphFirstPersonControls requires a perspective camera. Use <GlyphPerspectiveCamera> (not <GlyphOrthographicCamera> / <GlyphCamera>).");t.camera.eyeMode=!0;let e=t.host,o=n.drag??!0,r=n.keyboard??!0,s=n.moveSpeed??.05,l=n.lookSpeed??.15,i=mt(n.invert),u=!1,d=null,h={x:0,y:0},c=new Set,f=null,g=t.camera;function y(a){if(!(!o||u)&&d===null){a.preventDefault(),d=a.pointerId,h={x:a.clientX,y:a.clientY};try{a.target.setPointerCapture(a.pointerId)}catch{}}}function w(a){if(d===null||a.pointerId!==d||!o||u)return;a.preventDefault();let m=a.clientX-h.x,b=a.clientY-h.y;h={x:a.clientX,y:a.clientY},g.rotY=g.rotY-m*l*i,g.rotX=Math.max(-90,Math.min(90,g.rotX+b*l*i)),t.rerender()}function M(a){if(d===a.pointerId){d=null;try{a.target.releasePointerCapture(a.pointerId)}catch{}}}function _(a){r&&!u&&c.add(a.key.toLowerCase())}function G(a){c.delete(a.key.toLowerCase())}function P(){if(u||!r||c.size===0)return;let a=g.target,m=g.rotY*Math.PI/180,b=Math.cos(m),C=Math.sin(m),p=!1;(c.has("w")||c.has("arrowup"))&&(g.target=[a[0]-C*s,a[1]-b*s,a[2]],p=!0),(c.has("s")||c.has("arrowdown"))&&(g.target=[a[0]+C*s,a[1]+b*s,a[2]],p=!0),(c.has("a")||c.has("arrowleft"))&&(g.target=[a[0]-b*s,a[1]+C*s,a[2]],p=!0),(c.has("d")||c.has("arrowright"))&&(g.target=[a[0]+b*s,a[1]-C*s,a[2]],p=!0),p&&t.rerender()}function v(){u||(P(),f=requestAnimationFrame(v))}function E(){e.addEventListener("pointerdown",y),e.addEventListener("pointermove",w),e.addEventListener("pointerup",M),e.addEventListener("pointercancel",M),r&&(e.ownerDocument?.addEventListener("keydown",_),e.ownerDocument?.addEventListener("keyup",G)),e.style.touchAction="none",e.style.userSelect="none",typeof requestAnimationFrame<"u"&&(f=requestAnimationFrame(v))}function L(){e.removeEventListener("pointerdown",y),e.removeEventListener("pointermove",w),e.removeEventListener("pointerup",M),e.removeEventListener("pointercancel",M),e.ownerDocument?.removeEventListener("keydown",_),e.ownerDocument?.removeEventListener("keyup",G),e.style.touchAction="",e.style.userSelect="",f!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(f),f=null),c.clear(),t.camera.eyeMode=!1}return E(),{update(a){o=a.drag??o,r=a.keyboard??r,s=a.moveSpeed??s,l=a.lookSpeed??l,i=mt(a.invert)},pause(){u||(u=!0,L(),d=null)},resume(){u&&(u=!1,E())},destroy(){u||L(),u=!0}}}function mt(t){return t===void 0||t===!1?1:t===!0?-1:t}function Kt(t,n){let e=t.querySelector(`[data-glyph-mesh-id="${CSS.escape(n)}"]`);return e instanceof HTMLElement?e:null}function ft(t,n,e){let o=t.getBoundingClientRect();return o.width<=0||o.height<=0?!1:n>=o.left&&n<=o.right&&e>=o.top&&e<=o.bottom}function Zt(t,n,e){let o=(t instanceof Document,t),r=Array.from(o.querySelectorAll(".glyph-mesh"));for(let s of r)if(ft(s,n,e))return s;return null}var Jt=typeof HTMLElement<"u"?HTMLElement:class{},Qt=["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(t){if(t==null)return;let n=parseFloat(t);return Number.isFinite(n)?n:void 0}function en(t){if(t==="wireframe"||t==="solid"||t==="voxel")return t}function tn(t){if(t!==null){if(t==="false")return!1;if(t==="true"||t==="")return!0}}var je=class extends Jt{constructor(){super(...arguments);this._scene=null}static get observedAttributes(){return[...Qt]}getScene(){return this._scene}_readOptions(){let e={},o=en(this.getAttribute("mode"));o!==void 0&&(e.mode=o);let r=this.getAttribute("glyph-palette");r&&(e.glyphPalette=r);let s=tn(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 u=te(this.getAttribute("cell-aspect"));u!==void 0&&(e.cellAspect=u);let d=te(this.getAttribute("directional-intensity"));d!==void 0&&(e.directionalLight={direction:[-.5,-.7,-.5],intensity:d});let h=te(this.getAttribute("ambient-intensity"));if(h!==void 0&&(e.ambientLight={intensity:h}),this.hasAttribute("auto-size")&&(e.autoSize=!0),this.hasAttribute("shadow")){let c={color:"#000000",opacity:.25,lift:.05,maxExtend:2e3},f=this.getAttribute("shadow-color");f&&(c.color=f);let g=te(this.getAttribute("shadow-opacity"));g!==void 0&&(c.opacity=g);let y=te(this.getAttribute("shadow-lift"));y!==void 0&&(c.lift=y);let w=te(this.getAttribute("shadow-max-extend"));w!==void 0&&(c.maxExtend=w),e.shadow=c}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=Ve(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())}};import{loadMesh as nn,resolveGeometry as rn,computeSceneBbox as on}from"@glyphcss/core";var sn=typeof HTMLElement<"u"?HTMLElement:class{},ln=["src","geometry","size","color","position","scale","rotation","normalize","cast-shadow","receive-shadow"];function an(t){let n=on(t),e=(n.min[0]+n.max[0])/2,o=(n.min[1]+n.max[1])/2,r=(n.min[2]+n.max[2])/2,l=2/(Math.max(n.max[0]-n.min[0],n.max[1]-n.min[1],n.max[2]-n.min[2])||1);return t.map(i=>({...i,vertices:i.vertices.map(u=>[(u[0]-e)*l,(u[1]-o)*l,(u[2]-r)*l])}))}function qe(t){if(!t)return;let n=t.split(",").map(e=>parseFloat(e.trim()));if(!(n.length!==3||n.some(e=>!Number.isFinite(e))))return[n[0],n[1],n[2]]}function cn(t){if(t){if(!t.includes(",")){let n=parseFloat(t);return Number.isFinite(n)?n:void 0}return qe(t)}}function un(t){return t.closest("glyph-scene")??null}var Ue=class extends sn{constructor(){super(...arguments);this._handle=null;this._loadToken=0}static get observedAttributes(){return[...ln]}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:cn(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=un(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 nn(e)}catch(h){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:h,bubbles:!0}));return}if(s!==this._loadToken){try{l.dispose()}catch{}return}let i=r.getScene();if(!i){try{l.dispose()}catch{}return}let d=this.hasAttribute("normalize")?an(l.polygons):l.polygons;this._handle=i.add(d,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:d},bubbles:!0}));return}if(o){let s=r.getScene();if(!s)return;let l=this.getAttribute("size"),i=l!==null?parseFloat(l):1,u=this.getAttribute("color")??void 0,d;try{d=rn(o,{size:Number.isFinite(i)?i:1,color:u})}catch(h){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:h,bubbles:!0}));return}this._handle=s.add(d,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:d},bubbles:!0}))}}}};var dn=typeof HTMLElement<"u"?HTMLElement:class{};function hn(t){if(!t)return;let n=t.split(",").map(e=>parseFloat(e.trim()));if(!(n.length!==3||n.some(e=>!Number.isFinite(e))))return[n[0],n[1],n[2]]}function pn(t){if(!t)return;let n=t.split(",").map(e=>parseFloat(e.trim()));if(!(n.length!==2||n.some(e=>!Number.isFinite(e))))return[n[0],n[1]]}function mn(t){return t.closest("glyph-scene")??null}var Ke=class extends dn{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=mn(this);if(!o)return;if(!o.getScene()){let u=()=>{o.removeEventListener("glyphcss:scene-ready",u),this._register()};o.addEventListener("glyphcss:scene-ready",u);return}let r=o.getScene();if(!r)return;let s=this.getAttribute("hotspot-id")??this.getAttribute("id")??String(Math.random()),l=pn(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 fn=typeof HTMLElement<"u"?HTMLElement:class{};function j(t){if(t==null)return;let n=parseFloat(t);return Number.isFinite(n)?n:void 0}var Ze=class extends fn{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","distance","zoom","stretch"]}getCamera(){return this._camera}connectedCallback(){this._camera=ve({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")),u=j(this.getAttribute("distance")),d=j(this.getAttribute("zoom")),h=j(this.getAttribute("stretch")),c=!1;l!==void 0&&s.rotX!==l&&(s.rotX=l,c=!0),i!==void 0&&s.rotY!==i&&(s.rotY=i,c=!0),u!==void 0&&s.distance!==u&&(s.distance=u,c=!0),d!==void 0&&s.zoom!==d&&(s.zoom=d,c=!0),h!==void 0&&s.stretch!==h&&(s.stretch=h,c=!0),c&&this.querySelector("glyph-scene")?.rerender?.()}};var yn=typeof HTMLElement<"u"?HTMLElement:class{};function pe(t){if(t==null)return;let n=parseFloat(t);return Number.isFinite(n)?n:void 0}var Je=class extends yn{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","zoom"]}getCamera(){return this._camera}connectedCallback(){this._camera=Me({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")),u=pe(this.getAttribute("zoom")),d=!1;l!==void 0&&s.rotX!==l&&(s.rotX=l,d=!0),i!==void 0&&s.rotY!==i&&(s.rotY=i,d=!0),u!==void 0&&s.zoom!==u&&(s.zoom=u,d=!0),d&&this.querySelector("glyph-scene")?.rerender?.()}};var gn=typeof HTMLElement<"u"?HTMLElement:class{};function bn(t){if(t==null)return;let n=parseFloat(t);return Number.isFinite(n)?n:void 0}function Se(t){if(t!==null){if(t==="false")return!1;if(t==="true"||t==="")return!0}}function vn(t){return t.closest("glyph-scene")??null}var Qe=class extends gn{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=Se(this.getAttribute("drag")),o=Se(this.getAttribute("wheel")),r=Se(this.getAttribute("invert")),s=Se(this.getAttribute("clamp-pitch")),l=bn(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=vn(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=$e(o,this._readOptions())}};var En=typeof HTMLElement<"u"?HTMLElement:class{};function et(t){if(t!==null){if(t==="false")return!1;if(t==="true"||t==="")return!0}}function wn(t){return t.closest("glyph-scene")??null}var tt=class extends En{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=et(this.getAttribute("drag")),o=et(this.getAttribute("wheel")),r=et(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=wn(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=We(o,this._readOptions())}};export*from"@glyphcss/core";export{Tt as DEFAULT_RAMP,Ke as GlyphHotspotElement,tt as GlyphMapControlsElement,Ue as GlyphMeshElement,Qe as GlyphOrbitControlsElement,Je as GlyphOrthographicCameraElement,Ze as GlyphPerspectiveCameraElement,je as GlyphSceneElement,zt as SOLID_RAMP,Ot as WIREFRAME_GLYPHS,xe as WIREFRAME_PALETTES,Xt as bakeFrames,Be as buildRasterizeContext,Lt as createGlyphCamera,Ut as createGlyphFirstPersonControls,We as createGlyphMapControls,$e as createGlyphOrbitControls,Me as createGlyphOrthographicCamera,ve as createGlyphPerspectiveCamera,Ve as createGlyphScene,Kt as findGlyphMeshHandle,Zt as findMeshUnderPoint,Ae as getWireframeGlyphs,Xe as injectGlyphBaseStyles,ft as pointInMeshElement,Ne as projectHotspots,Ge as rasterize};
|
|
62
|
+
`;function pt(n,t,e,o,r){return n.map(i=>{let[l,s,c]=t.project(i.at,e,o,r),u=c>-3&&l>=0&&l<e&&s>=0&&s<o;return{id:i.id,col:l,row:s,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[i,l,s]=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],v=h*d,C=m*d,T=f*d,G=Math.cos(v),M=Math.sin(v),b=Math.cos(C),S=Math.sin(C),P=Math.cos(T),y=Math.sin(T);function E(A){let L=A[0]*c,a=A[1]*u,w=A[2]*p,g=P*L-y*a,_=y*L+P*a,H=w;return L=b*g+S*H,a=_,w=-S*g+b*H,g=L,_=G*a-M*w,H=M*a+G*w,[g+i,_+l,H+s]}return n.map(A=>({...A,vertices:A.vertices.map(E)}))}function ht(n,t={}){dt(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??Pe(),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 i=n.ownerDocument.createElement("div");i.className="glyph-hotspot-layer",o.appendChild(r),o.appendChild(i),n.appendChild(o);let l=new Map,s=[],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 a=[];for(let g of l.values())for(let _ of g.polygons)(_.texture||_.material?.texture)&&a.push(_);if(a.length===0){h&&(h=null,v());return}let w=++m;wn(a).then(g=>{w===m&&(h=g.size>0?g:null,v())})}function v(){c||(c=!0,Promise.resolve().then(()=>{c=!1,C()}))}function C(){let a=[],w=[],g=[],_=[],H=!1;for(let k of l.values()){let re=Sn(k.polygons,k.transform),N=k.transform.castShadow??!1,q=k.transform.receiveShadow??!1,oe=k.transform.depthBias??0;oe!==0&&(H=!0);for(let K of re)a.push(K),w.push(N),g.push(q),_.push(oe)}let F=ut({camera:e.camera,grid:{cols:e.cols,rows:e.rows,cellAspect:e.cellAspect},polygons:a,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:w,receiveShadowFlags:g,depthBiases:H?_:void 0});F.shadeCache=u,F.textureSamplers=h,F.temporalHistory=p;let z=globalThis.__glyphPerf,W=z?performance.now():0,B=Ze(F),j=z?performance.now():0;if(e.useColors?r.innerHTML=B:r.textContent=B,z){let k=performance.now();(z.raster??(z.raster=[])).push(j-W),(z.dom??(z.dom=[])).push(k-j),(z.polys??(z.polys=[])).push(a.length)}T()}function T(){let{cols:a,rows:w,cellAspect:g,camera:_}=e,H=pt(s.map(B=>B.hotspot),_,a,w,g),F=r.getBoundingClientRect(),z=a>0?F.width/a:8,W=w>0?F.height/w:16;for(let B=0;B<s.length;B++){let{el:j}=s[B],k=H[B];k.visible?(j.style.display="",j.style.left=`${(k.col+.5)*z}px`,j.style.top=`${(k.row+.5)*W}px`,j.style.zIndex=String(Math.round(k.depth*1e3))):j.style.display="none"}}function G(a,w={}){let g=An++;return l.set(g,{id:g,polygons:a,transform:w}),d(),f(),v(),{get id(){return g},get name(){return l.get(g)?.transform.id},get polygons(){return a},setTransform(_){let H=l.get(g);H&&(H.transform=_,d(),v())},dispose(){l.delete(g),d(),f(),v()}}}function M(a,w){let g=n.ownerDocument.createElement("div");g.className="glyph-hotspot",g.setAttribute("data-hotspot-id",a.id);let[_,H]=a.size??[1,1];g.style.position="absolute",g.style.width=`${_}ch`,g.style.height=`${H*e.cellAspect}ch`,w&&g.addEventListener("click",w),i.appendChild(g);let F={hotspot:{id:a.id,at:a.at,size:a.size},el:g,onClick:w};return s.push(F),v(),{get el(){return g},remove(){let z=s.indexOf(F);z>=0&&s.splice(z,1),w&&g.removeEventListener("click",w),i.removeChild(g),v()}}}function b(){C()}function S(a){a.mode!==void 0&&(e.mode=a.mode),a.glyphPalette!==void 0&&(e.glyphPalette=a.glyphPalette),a.useColors!==void 0&&(e.useColors=a.useColors),a.cols!==void 0&&(e.cols=a.cols),a.rows!==void 0&&(e.rows=a.rows),a.cellAspect!==void 0&&(e.cellAspect=a.cellAspect),a.directionalLight!==void 0&&(e.directionalLight=a.directionalLight),a.ambientLight!==void 0&&(e.ambientLight=a.ambientLight),a.camera!==void 0&&(e.camera=a.camera),a.smoothShading!==void 0&&(e.smoothShading=a.smoothShading),a.creaseAngle!==void 0&&(e.creaseAngle=a.creaseAngle),"shadow"in a&&(e.shadow=a.shadow),a.autoSize!==void 0&&(e.autoSize=a.autoSize,e.autoSize&&!A&&typeof ResizeObserver<"u"?(A=new ResizeObserver(()=>E()),A.observe(n),E()):!e.autoSize&&A&&(A.disconnect(),A=null)),(a.mode!==void 0||a.useColors!==void 0||a.directionalLight!==void 0||a.ambientLight!==void 0||a.smoothShading!==void 0||a.creaseAngle!==void 0||a.glyphPalette!==void 0)&&d(),v()}function P(){return{...e}}function y(){let w=n.ownerDocument.createElement("span");w.textContent=Array(20).fill("M").join(`
|
|
63
|
+
`),w.style.cssText="position:absolute;visibility:hidden;font-family:inherit;font-size:inherit;line-height:inherit;white-space:pre;padding:0;margin:0",r.appendChild(w);let g=w.getBoundingClientRect();return w.remove(),{w:g.width||8,h:g.height?g.height/20:16}}function E(){let a=n.clientWidth,w=n.clientHeight;if(!a||!w)return;let g=y(),_=Math.max(20,Math.floor(a/g.w)),H=Math.max(8,Math.floor(w/g.h)),F=g.h/g.w,z=!1;e.cols!==_&&(e.cols=_,z=!0),e.rows!==H&&(e.rows=H,z=!0),Math.abs(e.cellAspect-F)>.01&&(e.cellAspect=F,z=!0),z&&v()}let A=null;e.autoSize&&typeof ResizeObserver<"u"&&(A=new ResizeObserver(()=>E()),A.observe(n),E());function L(){A&&(A.disconnect(),A=null),l.clear(),n.contains(o)&&n.removeChild(o)}return v(),{get host(){return n},get output(){return r},get camera(){return e.camera},add:G,addHotspot:M,rerender:b,setOptions:S,getOptions:P,fit:E,destroy:L}}function mt(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,i=Bt(t.invert),l=t.clampPitch??!0,s=t.animate??!1,c=!1,u=!1,p=null,d=null,h=null,m={x:0,y:0},f=n.camera;function v(E){if(!(!o||c)&&h===null&&E.isPrimary!==!1){E.preventDefault(),h=E.pointerId,m={x:E.clientX,y:E.clientY},e.style.cursor="grabbing";try{E.target.setPointerCapture(E.pointerId)}catch{}s&&s.pauseOnInteraction!==!1&&(u=!0)}}function C(E){if(h===null||E.pointerId!==h||!o||c)return;E.preventDefault();let A=E.clientX-m.x,L=E.clientY-m.y;m={x:E.clientX,y:E.clientY};let a=i,w=1/4;f.rotY=f.rotY-A*w*a;let g=f.rotX-L*w*a;f.rotX=l?Math.max(-90,Math.min(90,g)):g,n.rerender()}function T(E){if(h===E.pointerId){h=null,e.style.cursor=o&&!c?"grab":"";try{E.target.releasePointerCapture(E.pointerId)}catch{}s&&(u=!1)}}function G(E){if(!r||c)return;E.preventDefault();let A=E.deltaY*.001;f.zoom=Math.max(.1,Math.min(500,f.zoom*(1-A))),n.rerender()}function M(E){if(!(c||!s)){if(!u){let A=d!==null?Math.min(E-d,50):16.67,L=typeof s=="object"&&s.speed?s.speed:.3,a=typeof s=="object"&&s.axis?s.axis:"y",w=L*(A/16.67);a==="y"?f.rotY=f.rotY+w:f.rotX=f.rotX+w,n.rerender()}d=E,p=requestAnimationFrame(M)}}function b(){p===null&&typeof requestAnimationFrame<"u"&&s&&(p=requestAnimationFrame(M))}function S(){p!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(p),p=null),d=null}function P(){e.addEventListener("pointerdown",v),e.addEventListener("pointermove",C),e.addEventListener("pointerup",T),e.addEventListener("pointercancel",T),e.addEventListener("wheel",G,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function y(){e.removeEventListener("pointerdown",v),e.removeEventListener("pointermove",C),e.removeEventListener("pointerup",T),e.removeEventListener("pointercancel",T),e.removeEventListener("wheel",G),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return P(),b(),{update(E){let A=!!s;o=E.drag??o,r=E.wheel??r,i=Bt(E.invert),E.clampPitch!==void 0&&(l=E.clampPitch),s=E.animate??s,!c&&h===null&&(e.style.cursor=o?"grab":"");let L=!!s;A&&!L?S():!A&&L&&b()},pause(){c||(c=!0,y(),S(),h=null,u=!1)},resume(){c&&(c=!1,P(),b())},destroy(){c||y(),S(),c=!0}}}function Bt(n){return n===void 0||n===!1?1:n===!0?-1:n}function ft(n,t={}){let e=n.host,o=t.drag??!0,r=t.wheel??!0,i=kt(t.invert),l=t.animate??!1,s=!1,c=!1,u=null,p=null,d=null,h={x:0,y:0},m=!1,f=n.camera,v=1/4,C=.02;function T(a){if(!(!o||s)&&d===null&&a.isPrimary!==!1){a.preventDefault(),d=a.pointerId,h={x:a.clientX,y:a.clientY},m=a.button===2,e.style.cursor="grabbing";try{a.target.setPointerCapture(a.pointerId)}catch{}l&&l.pauseOnInteraction!==!1&&(c=!0)}}function G(a){if(d===null||a.pointerId!==d||!o||s)return;a.preventDefault();let w=a.clientX-h.x,g=a.clientY-h.y;h={x:a.clientX,y:a.clientY};let _=i;if(m||a.shiftKey)f.rotY=f.rotY-w*v*_,f.rotX=Math.max(-90,Math.min(90,f.rotX+g*v*_));else{let H=f.target;f.target=[H[0]-w*C/f.zoom,H[1]-g*C/f.zoom,H[2]]}n.rerender()}function M(a){if(d===a.pointerId){d=null,m=!1,e.style.cursor=o&&!s?"grab":"";try{a.target.releasePointerCapture(a.pointerId)}catch{}l&&(c=!1)}}function b(a){a.preventDefault()}function S(a){if(!r||s)return;a.preventDefault();let w=a.deltaY*.001;f.zoom=Math.max(.1,Math.min(500,f.zoom*(1-w))),n.rerender()}function P(a){if(!(s||!l)){if(!c){let w=p!==null?Math.min(a-p,50):16.67,g=typeof l=="object"&&l.speed?l.speed:.3,_=typeof l=="object"&&l.axis?l.axis:"y",H=g*(w/16.67);_==="y"?f.rotY=f.rotY+H:f.rotX=f.rotX+H,n.rerender()}p=a,u=requestAnimationFrame(P)}}function y(){u===null&&typeof requestAnimationFrame<"u"&&l&&(u=requestAnimationFrame(P))}function E(){u!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(u),u=null),p=null}function A(){e.addEventListener("pointerdown",T),e.addEventListener("pointermove",G),e.addEventListener("pointerup",M),e.addEventListener("pointercancel",M),e.addEventListener("contextmenu",b),e.addEventListener("wheel",S,{passive:!1}),e.style.cursor=o?"grab":"",e.style.touchAction="none",e.style.userSelect="none"}function L(){e.removeEventListener("pointerdown",T),e.removeEventListener("pointermove",G),e.removeEventListener("pointerup",M),e.removeEventListener("pointercancel",M),e.removeEventListener("contextmenu",b),e.removeEventListener("wheel",S),e.style.cursor="",e.style.touchAction="",e.style.userSelect=""}return A(),y(),{update(a){let w=!!l;o=a.drag??o,r=a.wheel??r,i=kt(a.invert),l=a.animate??l,!s&&d===null&&(e.style.cursor=o?"grab":"");let g=!!l;w&&!g?E():!w&&g&&y()},pause(){s||(s=!0,L(),E(),d=null,c=!1)},resume(){s&&(s=!1,A(),y())},destroy(){s||L(),E(),s=!0}}}function kt(n){return n===void 0||n===!1?1:n===!0?-1:n}function xn(n,t={}){if(n.camera.kind!=="perspective")throw new Error("glyphcss: GlyphFirstPersonControls requires a perspective camera. Use <GlyphPerspectiveCamera> (not <GlyphOrthographicCamera> / <GlyphCamera>).");n.camera.eyeMode=!0;let e=n.host,o=t.drag??!0,r=t.keyboard??!0,i=t.moveSpeed??.05,l=t.lookSpeed??.15,s=Nt(t.invert),c=!1,u=null,p={x:0,y:0},d=new Set,h=null,m=n.camera;function f(y){if(!(!o||c)&&u===null){y.preventDefault(),u=y.pointerId,p={x:y.clientX,y:y.clientY};try{y.target.setPointerCapture(y.pointerId)}catch{}}}function v(y){if(u===null||y.pointerId!==u||!o||c)return;y.preventDefault();let E=y.clientX-p.x,A=y.clientY-p.y;p={x:y.clientX,y:y.clientY},m.rotY=m.rotY-E*l*s,m.rotX=Math.max(-90,Math.min(90,m.rotX+A*l*s)),n.rerender()}function C(y){if(u===y.pointerId){u=null;try{y.target.releasePointerCapture(y.pointerId)}catch{}}}function T(y){r&&!c&&d.add(y.key.toLowerCase())}function G(y){d.delete(y.key.toLowerCase())}function M(){if(c||!r||d.size===0)return;let y=m.target,E=m.rotY*Math.PI/180,A=Math.cos(E),L=Math.sin(E),a=!1;(d.has("w")||d.has("arrowup"))&&(m.target=[y[0]-L*i,y[1]-A*i,y[2]],a=!0),(d.has("s")||d.has("arrowdown"))&&(m.target=[y[0]+L*i,y[1]+A*i,y[2]],a=!0),(d.has("a")||d.has("arrowleft"))&&(m.target=[y[0]-A*i,y[1]+L*i,y[2]],a=!0),(d.has("d")||d.has("arrowright"))&&(m.target=[y[0]+A*i,y[1]-L*i,y[2]],a=!0),a&&n.rerender()}function b(){c||(M(),h=requestAnimationFrame(b))}function S(){e.addEventListener("pointerdown",f),e.addEventListener("pointermove",v),e.addEventListener("pointerup",C),e.addEventListener("pointercancel",C),r&&(e.ownerDocument?.addEventListener("keydown",T),e.ownerDocument?.addEventListener("keyup",G)),e.style.touchAction="none",e.style.userSelect="none",typeof requestAnimationFrame<"u"&&(h=requestAnimationFrame(b))}function P(){e.removeEventListener("pointerdown",f),e.removeEventListener("pointermove",v),e.removeEventListener("pointerup",C),e.removeEventListener("pointercancel",C),e.ownerDocument?.removeEventListener("keydown",T),e.ownerDocument?.removeEventListener("keyup",G),e.style.touchAction="",e.style.userSelect="",h!==null&&(typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(h),h=null),d.clear(),n.camera.eyeMode=!1}return S(),{update(y){o=y.drag??o,r=y.keyboard??r,i=y.moveSpeed??i,l=y.lookSpeed??l,s=Nt(y.invert)},pause(){c||(c=!0,P(),u=null)},resume(){c&&(c=!1,S())},destroy(){c||P(),c=!0}}}function Nt(n){return n===void 0||n===!1?1:n===!0?-1:n}function Cn(n,t){let e=n.querySelector(`[data-glyph-mesh-id="${CSS.escape(t)}"]`);return e instanceof HTMLElement?e:null}function Dt(n,t,e){let o=n.getBoundingClientRect();return o.width<=0||o.height<=0?!1:t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom}function Mn(n,t,e){let o=(n instanceof Document,n),r=Array.from(o.querySelectorAll(".glyph-mesh"));for(let i of r)if(Dt(i,t,e))return i;return null}var Gn=typeof HTMLElement<"u"?HTMLElement:class{},Ln=["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 Me(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function Tn(n){if(n==="wireframe"||n==="solid"||n==="voxel")return n}function _n(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}var yt=class extends Gn{constructor(){super(...arguments);this._scene=null}static get observedAttributes(){return[...Ln]}getScene(){return this._scene}_readOptions(){let e={},o=Tn(this.getAttribute("mode"));o!==void 0&&(e.mode=o);let r=this.getAttribute("glyph-palette");r&&(e.glyphPalette=r);let i=_n(this.getAttribute("use-colors"));i!==void 0&&(e.useColors=i);let l=Me(this.getAttribute("cols"));l!==void 0&&(e.cols=l);let s=Me(this.getAttribute("rows"));s!==void 0&&(e.rows=s);let c=Me(this.getAttribute("cell-aspect"));c!==void 0&&(e.cellAspect=c);let u=Me(this.getAttribute("directional-intensity"));u!==void 0&&(e.directionalLight={direction:[-.5,-.7,-.5],intensity:u});let p=Me(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=Me(this.getAttribute("shadow-opacity"));m!==void 0&&(d.opacity=m);let f=Me(this.getAttribute("shadow-lift"));f!==void 0&&(d.lift=f);let v=Me(this.getAttribute("shadow-max-extend"));v!==void 0&&(d.maxExtend=v),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=ht(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())}};import{loadMesh as Pn,resolveGeometry as zn,recenterPolygons as Hn}from"@glyphcss/core";var Fn=typeof HTMLElement<"u"?HTMLElement:class{},On=["src","geometry","size","color","position","scale","rotation","auto-center","cast-shadow","receive-shadow"];function gt(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 In(n){if(n){if(!n.includes(",")){let t=parseFloat(n);return Number.isFinite(t)?t:void 0}return gt(n)}}function Rn(n){return n.closest("glyph-scene")??null}var bt=class extends Fn{constructor(){super(...arguments);this._handle=null;this._loadToken=0}static get observedAttributes(){return[...On]}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:gt(this.getAttribute("position")),scale:In(this.getAttribute("scale")),rotation:gt(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=Rn(this);if(r){if(!r.getScene()){let i=()=>{r.removeEventListener("glyphcss:scene-ready",i),this._maybeLoad()};r.addEventListener("glyphcss:scene-ready",i);return}if(e){let i=++this._loadToken,l;try{l=await Pn(e)}catch(p){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:p,bubbles:!0}));return}if(i!==this._loadToken){try{l.dispose()}catch{}return}let s=r.getScene();if(!s){try{l.dispose()}catch{}return}let u=this.hasAttribute("auto-center")?Hn(l.polygons):l.polygons;this._handle=s.add(u,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:u},bubbles:!0}));return}if(o){let i=r.getScene();if(!i)return;let l=this.getAttribute("size"),s=l!==null?parseFloat(l):1,c=this.getAttribute("color")??void 0,u;try{u=zn(o,{size:Number.isFinite(s)?s:1,color:c})}catch(p){this.dispatchEvent(new CustomEvent("glyphcss:error",{detail:p,bubbles:!0}));return}this._handle=i.add(u,this._readTransform()),this.dispatchEvent(new CustomEvent("glyphcss:loaded",{detail:{polygons:u},bubbles:!0}))}}}};var Bn=typeof HTMLElement<"u"?HTMLElement:class{};function kn(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 Nn(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 Dn(n){return n.closest("glyph-scene")??null}var vt=class extends Bn{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=kn(this.getAttribute("at"));if(!e)return;let o=Dn(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 i=this.getAttribute("hotspot-id")??this.getAttribute("id")??String(Math.random()),l=Nn(this.getAttribute("size"));this._handle=r.addHotspot({id:i,at:e,size:l},()=>this.dispatchEvent(new CustomEvent("glyphcss:hotspot-click",{detail:{id:i},bubbles:!0})));let s=this._handle.el;for(;this.firstChild;)s.appendChild(this.firstChild)}};var Yn=typeof HTMLElement<"u"?HTMLElement:class{};function ue(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var Et=class extends Yn{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=Pe({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 i=this._camera;if(!i)return;let l=ue(this.getAttribute("rot-x")),s=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;l!==void 0&&i.rotX!==l&&(i.rotX=l,h=!0),s!==void 0&&i.rotY!==s&&(i.rotY=s,h=!0),c!==void 0&&i.distance!==c&&(i.distance=c,h=!0),u!==void 0&&i.perspective!==u&&(i.perspective=u,h=!0),p!==void 0&&i.zoom!==p&&(i.zoom=p,h=!0),d!==void 0&&i.stretch!==d&&(i.stretch=d,h=!0),h&&this.querySelector("glyph-scene")?.rerender?.()}};var Vn=typeof HTMLElement<"u"?HTMLElement:class{};function Re(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}var wt=class extends Vn{constructor(){super(...arguments);this._camera=null}static get observedAttributes(){return["rot-x","rot-y","zoom"]}getCamera(){return this._camera}connectedCallback(){this._camera=qe({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 i=this._camera;if(!i)return;let l=Re(this.getAttribute("rot-x")),s=Re(this.getAttribute("rot-y")),c=Re(this.getAttribute("zoom")),u=!1;l!==void 0&&i.rotX!==l&&(i.rotX=l,u=!0),s!==void 0&&i.rotY!==s&&(i.rotY=s,u=!0),c!==void 0&&i.zoom!==c&&(i.zoom=c,u=!0),u&&this.querySelector("glyph-scene")?.rerender?.()}};var Xn=typeof HTMLElement<"u"?HTMLElement:class{};function $n(n){if(n==null)return;let t=parseFloat(n);return Number.isFinite(t)?t:void 0}function Je(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function Wn(n){return n.closest("glyph-scene")??null}var At=class extends Xn{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=Je(this.getAttribute("drag")),o=Je(this.getAttribute("wheel")),r=Je(this.getAttribute("invert")),i=Je(this.getAttribute("clamp-pitch")),l=$n(this.getAttribute("animate-speed")),s=this.getAttribute("animate-axis")==="x"?"x":"y";return{...e!==void 0?{drag:e}:{},...o!==void 0?{wheel:o}:{},...r!==void 0?{invert:r}:{},...i!==void 0?{clampPitch:i}:{},...l!==void 0?{animate:{speed:l,axis:s}}:{}}}_attach(){if(this._controls)return;let e=Wn(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())}};var jn=typeof HTMLElement<"u"?HTMLElement:class{};function St(n){if(n!==null){if(n==="false")return!1;if(n==="true"||n==="")return!0}}function qn(n){return n.closest("glyph-scene")??null}var xt=class extends jn{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=St(this.getAttribute("drag")),o=St(this.getAttribute("wheel")),r=St(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=qn(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())}};export*from"@glyphcss/core";export{Ft as DEFAULT_PERSPECTIVE,nn as DEFAULT_RAMP,vt as GlyphHotspotElement,xt as GlyphMapControlsElement,bt as GlyphMeshElement,At as GlyphOrbitControlsElement,wt as GlyphOrthographicCameraElement,Et as GlyphPerspectiveCameraElement,yt as GlyphSceneElement,rn as SOLID_RAMP,on as WIREFRAME_GLYPHS,Ue as WIREFRAME_PALETTES,yn as bakeFrames,ut as buildRasterizeContext,Jt as createGlyphCamera,xn as createGlyphFirstPersonControls,ft as createGlyphMapControls,mt as createGlyphOrbitControls,qe as createGlyphOrthographicCamera,Pe as createGlyphPerspectiveCamera,ht as createGlyphScene,Cn as findGlyphMeshHandle,Mn as findMeshUnderPoint,Ke as getWireframeGlyphs,dt as injectGlyphBaseStyles,Dt as pointInMeshElement,pt as projectHotspots,Ze as rasterize};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glyphcss",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Glyphcss — ASCII paint backend with glyphcss's scene-composition API. Renders 3D meshes as ASCII art in a <pre> element.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@glyphcss/core": "^0.0.
|
|
36
|
+
"@glyphcss/core": "^0.0.6"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"tsup": "^8.0.1",
|