three-text 0.4.11 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/LICENSE +5 -660
  2. package/LICENSE_THIRD_PARTY +15 -49
  3. package/README.md +265 -44
  4. package/dist/index.cjs +3424 -3450
  5. package/dist/index.d.ts +163 -9
  6. package/dist/index.js +3420 -3451
  7. package/dist/index.min.cjs +718 -676
  8. package/dist/index.min.js +721 -679
  9. package/dist/index.umd.js +3561 -3579
  10. package/dist/index.umd.min.js +803 -756
  11. package/dist/p5/index.cjs +2738 -5
  12. package/dist/p5/index.js +2738 -5
  13. package/dist/patterns/index.js +0 -4
  14. package/dist/slug/index.cjs +380 -0
  15. package/dist/slug/index.d.ts +62 -0
  16. package/dist/slug/index.js +374 -0
  17. package/dist/three/index.cjs +50 -35
  18. package/dist/three/index.js +50 -35
  19. package/dist/three/react.cjs +5 -2
  20. package/dist/three/react.d.ts +66 -120
  21. package/dist/three/react.js +6 -3
  22. package/dist/types/core/Text.d.ts +3 -10
  23. package/dist/types/core/cache/sharedCaches.d.ts +2 -1
  24. package/dist/types/core/shaping/DrawCallbacks.d.ts +11 -3
  25. package/dist/types/core/shaping/TextShaper.d.ts +1 -5
  26. package/dist/types/core/types.d.ts +84 -0
  27. package/dist/types/index.d.ts +7 -3
  28. package/dist/types/{core/cache → mesh}/GlyphContourCollector.d.ts +4 -4
  29. package/dist/types/{core/cache → mesh}/GlyphGeometryBuilder.d.ts +5 -5
  30. package/dist/types/mesh/MeshGeometryBuilder.d.ts +18 -0
  31. package/dist/types/{core → mesh}/geometry/BoundaryClusterer.d.ts +1 -1
  32. package/dist/types/{core → mesh}/geometry/Extruder.d.ts +1 -1
  33. package/dist/types/{core → mesh}/geometry/PathOptimizer.d.ts +1 -1
  34. package/dist/types/{core → mesh}/geometry/Polygonizer.d.ts +1 -1
  35. package/dist/types/{core → mesh}/geometry/Tessellator.d.ts +1 -1
  36. package/dist/types/react/utils.d.ts +2 -0
  37. package/dist/types/vector/GlyphOutlineCollector.d.ts +25 -0
  38. package/dist/types/vector/GlyphVectorGeometryBuilder.d.ts +26 -0
  39. package/dist/types/vector/LoopBlinnGeometry.d.ts +68 -0
  40. package/dist/types/vector/index.d.ts +29 -0
  41. package/dist/types/vector/loopBlinnTSL.d.ts +11 -0
  42. package/dist/types/vector/react.d.ts +24 -0
  43. package/dist/types/vector/webgl/index.d.ts +7 -0
  44. package/dist/types/vector/webgpu/index.d.ts +11 -0
  45. package/dist/vector/index.cjs +1458 -0
  46. package/dist/vector/index.d.ts +122 -0
  47. package/dist/vector/index.js +1434 -0
  48. package/dist/vector/react.cjs +153 -0
  49. package/dist/vector/react.d.ts +317 -0
  50. package/dist/vector/react.js +132 -0
  51. package/dist/vector/types/slug-lib/src/SlugPacker.d.ts +17 -0
  52. package/dist/vector/types/slug-lib/src/WebGL2Renderer.d.ts +21 -0
  53. package/dist/vector/types/slug-lib/src/WebGPURenderer.d.ts +16 -0
  54. package/dist/vector/types/slug-lib/src/index.d.ts +15 -0
  55. package/dist/vector/types/slug-lib/src/shaderStrings.d.ts +9 -0
  56. package/dist/vector/types/slug-lib/src/types.d.ts +34 -0
  57. package/dist/vector/types/src/core/types.d.ts +381 -0
  58. package/dist/vector/types/src/hyphenation/HyphenationPatternLoader.d.ts +2 -0
  59. package/dist/vector/types/src/hyphenation/index.d.ts +7 -0
  60. package/dist/vector/types/src/hyphenation/types.d.ts +6 -0
  61. package/dist/vector/types/src/utils/Cache.d.ts +14 -0
  62. package/dist/vector/types/src/utils/vectors.d.ts +75 -0
  63. package/dist/vector/types/src/vector/VectorDataBuilder.d.ts +30 -0
  64. package/dist/vector/types/src/vector/VectorThreeAdapter.d.ts +27 -0
  65. package/dist/vector/types/src/vector/index.d.ts +15 -0
  66. package/dist/vector/webgl/index.cjs +229 -0
  67. package/dist/vector/webgl/index.d.ts +53 -0
  68. package/dist/vector/webgl/index.js +227 -0
  69. package/dist/vector/webgpu/index.cjs +321 -0
  70. package/dist/vector/webgpu/index.d.ts +57 -0
  71. package/dist/vector/webgpu/index.js +319 -0
  72. package/dist/webgl-vector/index.cjs +243 -0
  73. package/dist/webgl-vector/index.d.ts +34 -0
  74. package/dist/webgl-vector/index.js +241 -0
  75. package/dist/webgpu-vector/index.cjs +336 -0
  76. package/dist/webgpu-vector/index.d.ts +38 -0
  77. package/dist/webgpu-vector/index.js +334 -0
  78. package/package.json +49 -4
  79. package/dist/patterns/cs.cjs +0 -14
  80. package/dist/patterns/cs.d.ts +0 -28
  81. package/dist/patterns/cs.js +0 -14
  82. package/dist/patterns/cs.umd.js +0 -14
  83. package/dist/patterns/id.cjs +0 -14
  84. package/dist/patterns/id.d.ts +0 -28
  85. package/dist/patterns/id.js +0 -14
  86. package/dist/patterns/id.umd.js +0 -14
  87. package/dist/patterns/mk.cjs +0 -14
  88. package/dist/patterns/mk.d.ts +0 -28
  89. package/dist/patterns/mk.js +0 -14
  90. package/dist/patterns/mk.umd.js +0 -14
  91. package/dist/patterns/sr-cyrl.cjs +0 -14
  92. package/dist/patterns/sr-cyrl.d.ts +0 -28
  93. package/dist/patterns/sr-cyrl.js +0 -14
  94. package/dist/patterns/sr-cyrl.umd.js +0 -14
@@ -1,90 +1,107 @@
1
1
  /*!
2
- * three-text v0.4.11
3
- * Copyright (C) 2025 Countertype LLC
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * See LICENSE file for full terms: <https://www.gnu.org/licenses/>
11
- *
12
- * This software includes third-party code - see LICENSE_THIRD_PARTY for details.
2
+ * @license
3
+ * three-text v0.5.0
4
+ * Copyright © 2025-2026 Jeremy Tribby, Countertype LLC
5
+ * SPDX-License-Identifier: MIT
13
6
  */
14
7
  function t(t){if(!t||0===Object.keys(t).length)return
15
- const e=At.get(t)
8
+ const e=bt.get(t)
16
9
  if(void 0!==e)return e??void 0
17
10
  const i=[]
18
- for(const[e,s]of Object.entries(t))/^[a-zA-Z0-9]{4}$/.test(e)?!1===s||0===s?i.push(e+"=0"):!0===s||1===s?i.push(e):"number"==typeof s&&s>1?i.push(`${e}=${Math.floor(s)}`):st.warn(`Invalid value for feature "${e}": ${s}. Expected boolean or positive number.`):st.warn(`Invalid OpenType feature tag: "${e}". Tags must be exactly 4 alphanumeric characters.`)
11
+ for(const[e,s]of Object.entries(t))/^[a-zA-Z0-9]{4}$/.test(e)?!1===s||0===s?i.push(e+"=0"):!0===s||1===s?i.push(e):"number"==typeof s&&s>1?i.push(`${e}=${Math.floor(s)}`):nt.warn(`Invalid value for feature "${e}": ${s}. Expected boolean or positive number.`):nt.warn(`Invalid OpenType feature tag: "${e}". Tags must be exactly 4 alphanumeric characters.`)
19
12
  const s=i.length>0?i.join(","):void 0
20
- return At.set(t,s??null),s}function e(t){const e=t.getUint16(4),i=new Map
13
+ return bt.set(t,s??null),s}function e(t){const e=t.getUint16(4),i=new Map
21
14
  for(let s=0;e>s;s++){const e=12+16*s
22
15
  if(e+16>t.byteLength)break
23
16
  const n=t.getUint32(e),r=t.getUint32(e+4),o=t.getUint32(e+8),h=t.getUint32(e+12)
24
- i.set(n,{tag:n,t:r,offset:o,length:h})}return i}async function i(t,e){if(!jt.test(t))throw Error(`Invalid hyphenation language code "${t}". Expected e.g. "en-us".`)
25
- if(!e&&!Ut.has(t))throw Error(`Unsupported hyphenation language "${t}". Use a built-in language (e.g. "en-us") or register patterns via Text.registerPattern("${t}", pattern).`)
17
+ i.set(n,{tag:n,t:r,offset:o,length:h})}return i}async function i(t,e){if(!Ut.test(t))throw Error(`Invalid hyphenation language code "${t}". Expected e.g. "en-us".`)
18
+ if(!e&&!Vt.has(t))throw Error(`Unsupported hyphenation language "${t}". Use a built-in language (e.g. "en-us") or register patterns via Text.registerPattern("${t}", pattern).`)
26
19
  try{if(e)return(await import(`${e}${t}.js`)).default
27
- if("string"==typeof("undefined"==typeof document?require("url").pathToFileURL(__filename).href:et&&"SCRIPT"===et.tagName.toUpperCase()&&et.src||new URL("index.min.cjs",document.baseURI).href)){const e=new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:et&&"SCRIPT"===et.tagName.toUpperCase()&&et.src||new URL("index.min.cjs",document.baseURI).href).href,i=new URL(`./patterns/${t}.js`,e).href
28
- return(await import(i)).default}return(await import(`./patterns/${t}.js`)).default}catch(e){throw Error(`Failed to load hyphenation patterns for ${t}. Consider using static imports: import pattern from 'three-text/patterns/${t}'; Text.registerPattern('${t}', pattern);`)}}function s(t,e,i,s){return`${t}_${e}_${Math.round(1e3*i)/1e3}_${s}`}function n(t,e){return t.s===e.s&&t.i===e.i}function r(t,e){return e.s>t.s||t.s===e.s&&e.i>=t.i}function o(t,e){return e.i>t.i||t.i===e.i&&e.s>=t.s}function h(t){return r(t.h.o,t.o)}function a(t){return r(t.o,t.h.o)}function l(t,e){return Math.abs(t.s-e.s)+Math.abs(t.i-e.i)}function c(t,e,i){let s=e.s-t.s,n=i.s-e.s
29
- return s+n>0?n>s?e.i-t.i+s/(s+n)*(t.i-i.i):e.i-i.i+n/(s+n)*(i.i-t.i):0}function u(t,e,i){let s=e.s-t.s,n=i.s-e.s
30
- return s+n>0?(e.i-i.i)*s+(e.i-t.i)*n:0}function f(t,e,i){let s=e.i-t.i,n=i.i-e.i
31
- return s+n>0?n>s?e.s-t.s+s/(s+n)*(t.s-i.s):e.s-i.s+n/(s+n)*(i.s-t.s):0}function d(t,e,i){let s=e.i-t.i,n=i.i-e.i
32
- return s+n>0?(e.s-i.s)*s+(e.s-t.s)*n:0}function y(t,e,i,s){return(t=0>t?0:t)>(i=0>i?0:i)?s+i/(t+i)*(e-s):0===i?(e+s)/2:e+t/(t+i)*(s-e)}function p(t,e,i){const s=t.event,n=e.l,o=i.l
33
- return n.h.o===s?o.h.o===s?r(n.o,o.o)?0>=u(o.h.o,n.o,o.o):u(n.h.o,o.o,n.o)>=0:0>=u(o.h.o,s,o.o):o.h.o===s?u(n.h.o,s,n.o)>=0:c(n.h.o,s,n.o)>=c(o.h.o,s,o.o)}function w(t){return t.u}function g(t){return t.next}function m(t,e){t.p+=e.p,t.h.p+=e.h.p}function v(t,e){e.l.N=null,t.m.delete(e)}function x(t,e,i){t.A.delete(e.l),e.I=0,e.l=i,i.N=e}function A(t,e){let i,s=e.l.o
34
- do{e=g(e)}while(e.l.o===s)
35
- return e.I&&(i=t.A.connect(w(e).l.h,e.l.O),x(t,e,i),e=g(e)),e}function b(t){let e=t.l.h.o
36
- do{t=g(t)}while(t.l.h.o===e)
37
- return t}function E(t,e,i){const s=new ie
38
- return s.l=i,t.m.insertBefore(e,s),s.I=0,s.v=0,s.T=0,i.N=s,s}function T(t,e){switch(t.M){case Qt.ODD:return!!(1&e)
39
- case Qt.NONZERO:return 0!==e
40
- case Qt.POSITIVE:return e>0
41
- case Qt.NEGATIVE:return 0>e
42
- case Qt.ABS_GEQ_TWO:return e>=2||-2>=e}throw Error("Invalid winding rule")}function I(t,e){const i=e.l,s=i.D
43
- s._=e._,s.L=i,v(t,e)}function S(t,e,i){let s,n=null,r=e,o=e.l
44
- for(;r!==i;){if(r.I=0,n=w(r),s=n.l,s.o!=o.o){if(!n.I){I(t,r)
45
- break}s=t.A.connect(o.C.h,s.h),x(t,n,s)}o.C!==s&&(t.A.splice(s.h.O,s),t.A.splice(o,s)),I(t,r),o=n.l,r=n}return o}function F(t,e,i,s,n,r){let o,h,a,l,c=1
20
+ if("string"==typeof("undefined"==typeof document?require("url").pathToFileURL(__filename).href:it&&"SCRIPT"===it.tagName.toUpperCase()&&it.src||new URL("index.min.cjs",document.baseURI).href)){const e=new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:it&&"SCRIPT"===it.tagName.toUpperCase()&&it.src||new URL("index.min.cjs",document.baseURI).href).href,i=new URL(`./patterns/${t}.js`,e).href
21
+ return(await import(i)).default}return(await import(`./patterns/${t}.js`)).default}catch(e){throw Error(`Failed to load hyphenation patterns for ${t}. Consider using static imports: import pattern from 'three-text/patterns/${t}'; Text.registerPattern('${t}', pattern);`)}}async function s(t){try{const e=await fetch(t)
22
+ if(!e.ok)throw Error("HTTP "+e.status)
23
+ return await e.arrayBuffer()}catch(e){const i=globalThis.require
24
+ if("function"!=typeof i)throw Error(`Failed to fetch ${t}: ${e}`)
25
+ try{const e=i("fs"),s=i("path")
26
+ let n=t
27
+ if("undefined"!=typeof window&&"file:"===window.location?.protocol){const e=s.i(window.location.pathname)
28
+ n=s.join(e,t)}const r=e.o(n)
29
+ return r instanceof ArrayBuffer?r:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch(i){throw Error(`Failed to load ${t}: fetch failed (${e}), fs.readFileSync failed (${i})`)}}}function n(t){return t&&t.h&&{}.hasOwnProperty.call(t,"default")?t.default:t}function r(t){if(t.h)return t
30
+ var e=t.default
31
+ if("function"==typeof e){var i=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)}
32
+ i.prototype=e.prototype}else i={}
33
+ return Object.defineProperty(i,"h",{value:!0}),Object.keys(t).forEach(e=>{var s=Object.getOwnPropertyDescriptor(t,e)
34
+ Object.defineProperty(i,e,s.get?s:{enumerable:!0,get(){return t[e]}})}),i}function o(t,e,i,s){return`${t}_${e}_${Math.round(1e3*i)/1e3}_${s}`}
35
+ /**
36
+ * @license
37
+ * libtess-ts - TypeScript port of the SGI GLU tessellator
38
+ * Original Code: OpenGL Sample Implementation, Version 1.2.1,
39
+ * released January 26, 2000. Copyright (c) 1991-2000 Silicon Graphics, Inc.
40
+ * Copyright 2012, Google Inc. All Rights Reserved.
41
+ * Copyright 2026, Countertype LLC. All Rights Reserved.
42
+ * SGI Free Software License B (Version 2.0)
43
+ * http://oss.sgi.com/projects/FreeB/
44
+ */
45
+ function h(t,e){return t.s===e.s&&t.l===e.l}function a(t,e){return e.s>t.s||t.s===e.s&&e.l>=t.l}function l(t,e){return e.l>t.l||t.l===e.l&&e.s>=t.s}function c(t){return a(t.p.u,t.u)}function u(t){return a(t.u,t.p.u)}function f(t,e){return Math.abs(t.s-e.s)+Math.abs(t.l-e.l)}function d(t,e,i){let s=e.s-t.s,n=i.s-e.s
46
+ return s+n>0?n>s?e.l-t.l+s/(s+n)*(t.l-i.l):e.l-i.l+n/(s+n)*(i.l-t.l):0}function y(t,e,i){let s=e.s-t.s,n=i.s-e.s
47
+ return s+n>0?(e.l-i.l)*s+(e.l-t.l)*n:0}function p(t,e,i){let s=e.l-t.l,n=i.l-e.l
48
+ return s+n>0?n>s?e.s-t.s+s/(s+n)*(t.s-i.s):e.s-i.s+n/(s+n)*(i.s-t.s):0}function w(t,e,i){let s=e.l-t.l,n=i.l-e.l
49
+ return s+n>0?(e.s-i.s)*s+(e.s-t.s)*n:0}function g(t,e,i,s){return(t=0>t?0:t)>(i=0>i?0:i)?s+i/(t+i)*(e-s):0===i?(e+s)/2:e+t/(t+i)*(s-e)}function m(t,e,i){const s=t.event,n=e.m,r=i.m
50
+ return n.p.u===s?r.p.u===s?a(n.u,r.u)?0>=y(r.p.u,n.u,r.u):y(n.p.u,r.u,n.u)>=0:0>=y(r.p.u,s,r.u):r.p.u===s?y(n.p.u,s,n.u)>=0:d(n.p.u,s,n.u)>=d(r.p.u,s,r.u)}function v(t){return t.v}function x(t){return t.next}function A(t,e){t._+=e._,t.p._+=e.p._}function b(t,e){e.m.N=null,t.k.delete(e)}function E(t,e,i){t.A.delete(e.m),e.I=0,e.m=i,i.N=e}function T(t,e){let i,s=e.m.u
51
+ do{e=x(e)}while(e.m.u===s)
52
+ return e.I&&(i=t.A.connect(v(e).m.p,e.m.O),E(t,e,i),e=x(e)),e}function I(t){let e=t.m.p.u
53
+ do{t=x(t)}while(t.m.p.u===e)
54
+ return t}function S(t,e,i){const s=new we
55
+ return s.m=i,t.k.insertBefore(e,s),s.I=0,s.j=0,s.T=0,i.N=s,s}function F(t,e){switch(t.M){case fe.ODD:return!!(1&e)
56
+ case fe.NONZERO:return 0!==e
57
+ case fe.POSITIVE:return e>0
58
+ case fe.NEGATIVE:return 0>e
59
+ case fe.ABS_GEQ_TWO:return e>=2||-2>=e}throw Error("Invalid winding rule")}function M(t,e){const i=e.m,s=i.D
60
+ s.q=e.q,s.L=i,b(t,e)}function _(t,e,i){let s,n=null,r=e,o=e.m
61
+ for(;r!==i;){if(r.I=0,n=v(r),s=n.m,s.u!=o.u){if(!n.I){M(t,r)
62
+ break}s=t.A.connect(o.C.p,s.p),E(t,n,s)}o.C!==s&&(t.A.splice(s.p.O,s),t.A.splice(o,s)),M(t,r),o=n.m,r=n}return o}function O(t,e,i,s,n,r){let o,h,a,l,c=1
46
63
  a=i
47
- do{E(t,e,a.h),a=a.C}while(a!==s)
48
- for(null===n&&(n=w(e).l.h.C),h=e,l=n;o=w(h),a=o.l.h,a.o===l.o;)a.C!==l&&(t.A.splice(a.h.O,a),t.A.splice(l.h.O,a)),o.G=h.G-a.p,o._=T(t,o.G),h.T=1,!c&&C(t,h)&&(m(a,l),v(t,h),t.A.delete(l)),c=0,h=o,l=a
49
- h.T=1,r&&L(t,h)}function M(t,e,i,s,n){e.data=null,t.R&&(ye[0]=e.coords[0],ye[1]=e.coords[1],ye[2]=e.coords[2],e.data=t.R(ye,i,s,t.k)),null===e.data&&(n?(t.j(100156),t.U=1):e.data=i[0])}function _(t,e,i){t.R&&(de[0]=e.o.data,de[1]=i.o.data,de[2]=null,de[3]=null,fe[0]=.5,fe[1]=.5,fe[2]=0,fe[3]=0,M(t,e.o,de,fe,0)),t.A.splice(e,i)}function O(t,e,i,s,n){let r=l(e,t),o=l(i,t),h=.5*o/(r+o),a=.5*r/(r+o)
50
- void 0!==s&&void 0!==n&&(s[n]=h,s[n+1]=a),t.coords[0]+=h*e.coords[0]+a*i.coords[0],t.coords[1]+=h*e.coords[1]+a*i.coords[1],t.coords[2]+=h*e.coords[2]+a*i.coords[2]}function C(t,e){let i=w(e)
51
- const s=e.l,r=i.l
52
- if(r.o.s>s.o.s||s.o.s===r.o.s&&r.o.i>=s.o.i){if(u(r.h.o,s.o,r.o)>0)return 0
53
- n(s.o,r.o)?s.o!==r.o&&(t.S.delete(s.o.B),_(t,r.h.O,s)):(t.A.V(r.h),t.A.splice(s,r.h.O),e.T=i.T=1)}else{if(0>u(s.h.o,r.o,s.o))return 0
54
- g(e).T=e.T=1,t.A.V(s.h),t.A.splice(r.h.O,s)}return 1}function k(t,e){let i=w(e)
55
- const s=e.l,n=i.l
64
+ do{S(t,e,a.p),a=a.C}while(a!==s)
65
+ for(null===n&&(n=v(e).m.p.C),h=e,l=n;o=v(h),a=o.m.p,a.u===l.u;)a.C!==l&&(t.A.splice(a.p.O,a),t.A.splice(l.p.O,a)),o.G=h.G-a._,o.q=F(t,o.G),h.T=1,!c&&B(t,h)&&(A(a,l),b(t,h),t.A.delete(l)),c=0,h=o,l=a
66
+ h.T=1,r&&P(t,h)}function C(t,e,i,s,n){e.data=null,t.R&&(Me[0]=e.coords[0],Me[1]=e.coords[1],Me[2]=e.coords[2],e.data=t.R(Me,i,s,t.tt)),null===e.data&&(n?(t.et(100156),t.U=1):e.data=i[0])}function k(t,e,i){t.R&&(Fe[0]=e.u.data,Fe[1]=i.u.data,Fe[2]=null,Fe[3]=null,Se[0]=.5,Se[1]=.5,Se[2]=0,Se[3]=0,C(t,e.u,Fe,Se,0)),t.A.splice(e,i)}function L(t,e,i,s,n){let r=f(e,t),o=f(i,t),h=.5*o/(r+o),a=.5*r/(r+o)
67
+ void 0!==s&&void 0!==n&&(s[n]=h,s[n+1]=a),t.coords[0]+=h*e.coords[0]+a*i.coords[0],t.coords[1]+=h*e.coords[1]+a*i.coords[1],t.coords[2]+=h*e.coords[2]+a*i.coords[2]}function B(t,e){let i=v(e)
68
+ const s=e.m,n=i.m
69
+ if(n.u.s>s.u.s||s.u.s===n.u.s&&n.u.l>=s.u.l){if(y(n.p.u,s.u,n.u)>0)return 0
70
+ h(s.u,n.u)?s.u!==n.u&&(t.S.delete(s.u.B),k(t,n.p.O,s)):(t.A.V(n.p),t.A.splice(s,n.p.O),e.T=i.T=1)}else{if(0>y(s.p.u,n.u,s.u))return 0
71
+ x(e).T=e.T=1,t.A.V(s.p),t.A.splice(n.p.O,s)}return 1}function D(t,e){let i=v(e)
72
+ const s=e.m,n=i.m
56
73
  let r
57
- if(n.h.o.s>s.h.o.s||s.h.o.s===n.h.o.s&&n.h.o.i>=s.h.o.i){if(0>u(s.h.o,n.h.o,s.o))return 0
58
- g(e).T=e.T=1,r=t.A.V(s),t.A.splice(n.h,r),r.D._=e._}else{if(u(n.h.o,s.h.o,n.o)>0)return 0
59
- e.T=i.T=1,r=t.A.V(n),t.A.splice(s.O,n.h),r.h.D._=e._}return 1}function B(t,e){let i=w(e),s=e.l,h=i.l
60
- const a=s.o,l=h.o
61
- let p,m,v=s.h.o,x=h.h.o
62
- const E=ce||(ce=new ne)
63
- let T,I
64
- if(a===l)return 0
65
- if(p=Math.min(a.i,v.i),m=Math.max(l.i,x.i),p>m)return 0
66
- if(r(a,l)){if(u(x,a,l)>0)return 0}else if(0>u(v,l,a))return 0
67
- return((t,e,i,s,n)=>{let h,a,l
68
- r(t,e)||(l=t,t=e,e=l),r(i,s)||(l=i,i=s,s=l),r(t,i)||(l=t,t=i,i=l,l=e,e=s,s=l),r(i,e)?r(e,s)?(h=c(t,i,e),a=c(i,e,s),0>h+a&&(h=-h,a=-a),n.s=y(h,i.s,a,e.s)):(h=u(t,i,e),a=-u(t,s,e),0>h+a&&(h=-h,a=-a),n.s=y(h,i.s,a,s.s)):n.s=.5*(i.s+e.s),o(t,e)||(l=t,t=e,e=l),o(i,s)||(l=i,i=s,s=l),o(t,i)||(l=t,t=i,i=l,l=e,e=s,s=l),o(i,e)?o(e,s)?(h=f(t,i,e),a=f(i,e,s),0>h+a&&(h=-h,a=-a),n.i=y(h,i.i,a,e.i)):(h=d(t,i,e),a=-d(t,s,e),0>h+a&&(h=-h,a=-a),n.i=y(h,i.i,a,s.i)):n.i=.5*(i.i+e.i)})(v,a,x,l,E),(t.event.s>E.s||E.s===t.event.s&&t.event.i>=E.i)&&(E.s=t.event.s,E.i=t.event.i),T=l.s>a.s||a.s===l.s&&l.i>=a.i?a:l,(E.s>T.s||T.s===E.s&&E.i>=T.i)&&(E.s=T.s,E.i=T.i),n(E,a)||n(E,l)?(C(t,e),0):!n(v,t.event)&&u(v,t.event,E)>=0||!n(x,t.event)&&0>=u(x,t.event,E)?x===t.event?(t.A.V(s.h),t.A.splice(h.h,s),s=w(e=A(t,e)).l,S(t,w(e),i),F(t,e,s.h.O,s,s,1),1):v===t.event?(t.A.V(h.h),t.A.splice(s.O,h.h.O),i=e,I=w(e=b(e)).l.h.C,i.l=h.h.O,h=S(t,i,null),F(t,e,h.C,s.h.C,I,1),1):(0>u(v,t.event,E)||(g(e).T=e.T=1,t.A.V(s.h),s.o.s=t.event.s,s.o.i=t.event.i),u(x,t.event,E)>0||(e.T=i.T=1,t.A.V(h.h),h.o.s=t.event.s,h.o.i=t.event.i),0):(t.A.V(s.h),t.A.V(h.h),t.A.splice(h.h.O,s),s.o.s=E.s,s.o.i=E.i,s.o.B=t.S.P(s.o),((t,e,i,s,n,r)=>{fe[0]=0,fe[1]=0,fe[2]=0,fe[3]=0,de[0]=i.data,de[1]=s.data,de[2]=n.data,de[3]=r.data,e.coords[0]=e.coords[1]=e.coords[2]=0,O(e,i,s,fe,0),O(e,n,r,fe,2),M(t,e,de,fe,1)})(t,s.o,a,v,l,x),g(e).T=e.T=i.T=1,0)}function L(t,e){let i,s,n=w(e)
69
- for(;;){for(;n.T;)e=n,n=w(n)
70
- if(!e.T&&(n=e,null===(e=g(e))||!e.T))return
71
- if(e.T=0,i=e.l,s=n.l,i.h.o!==s.h.o&&k(t,e)&&(n.I?(v(t,n),t.A.delete(s),n=w(e),s=n.l):e.I&&(v(t,e),t.A.delete(i),i=(e=g(n)).l)),i.o!==s.o)if(i.h.o===s.h.o||e.I||n.I||i.h.o!==t.event&&s.h.o!==t.event)C(t,e)
72
- else if(B(t,e))return
73
- i.o===s.o&&i.h.o===s.h.o&&(m(s,i),v(t,e),t.A.delete(i),e=g(n))}}function D(t,e){let i,s,o,a,l,c
74
- const f=ue||(ue=new ie)
75
- f.l=e.L.h,i=t.m.search(f),s=w(i),s&&(a=i.l,l=s.l,0!==u(a.h.o,e,a.o)?(o=r(l.h.o,a.h.o)?i:s,i._||o.I?(c=o===i?t.A.connect(e.L.h,a.O):t.A.connect(l.h.C.h,e.L).h,o.I?x(t,o,c):((t,e)=>{e.G=g(e).G+e.l.p,e._=T(t,e.G)})(t,E(t,i,c)),N(t,e)):F(t,i,e.L,e.L,null,1)):((t,e,i)=>{let s,r,o,a,l
76
- if(s=e.l,n(s.o,i))_(t,s,i.L)
77
- else{if(!n(s.h.o,i))return t.A.V(s.h),e.I&&(t.A.delete(s.C),e.I=0),t.A.splice(i.L,s),void N(t,i)
78
- l=w(e=b(e)),o=l.l.h,r=a=o.C,l.I&&(v(t,l),t.A.delete(o),o=r.h.O),t.A.splice(i.L,o),h(r)||(r=null),F(t,e,o.C,a,r,1)}})(t,i,e))}function N(t,e){t.event=e
74
+ if(n.p.u.s>s.p.u.s||s.p.u.s===n.p.u.s&&n.p.u.l>=s.p.u.l){if(0>y(s.p.u,n.p.u,s.u))return 0
75
+ x(e).T=e.T=1,r=t.A.V(s),t.A.splice(n.p,r),r.D.q=e.q}else{if(y(n.p.u,s.p.u,n.u)>0)return 0
76
+ e.T=i.T=1,r=t.A.V(n),t.A.splice(s.O,n.p),r.p.D.q=e.q}return 1}function N(t,e){let i=v(e),s=e.m,n=i.m
77
+ const r=s.u,o=n.u
78
+ let c,u,f=s.p.u,m=n.p.u
79
+ const A=Te||(Te=new me)
80
+ let b,E
81
+ if(r===o)return 0
82
+ if(c=Math.min(r.l,f.l),u=Math.max(o.l,m.l),c>u)return 0
83
+ if(a(r,o)){if(y(m,r,o)>0)return 0}else if(0>y(f,o,r))return 0
84
+ return((t,e,i,s,n)=>{let r,o,h
85
+ a(t,e)||(h=t,t=e,e=h),a(i,s)||(h=i,i=s,s=h),a(t,i)||(h=t,t=i,i=h,h=e,e=s,s=h),a(i,e)?a(e,s)?(r=d(t,i,e),o=d(i,e,s),0>r+o&&(r=-r,o=-o),n.s=g(r,i.s,o,e.s)):(r=y(t,i,e),o=-y(t,s,e),0>r+o&&(r=-r,o=-o),n.s=g(r,i.s,o,s.s)):n.s=.5*(i.s+e.s),l(t,e)||(h=t,t=e,e=h),l(i,s)||(h=i,i=s,s=h),l(t,i)||(h=t,t=i,i=h,h=e,e=s,s=h),l(i,e)?l(e,s)?(r=p(t,i,e),o=p(i,e,s),0>r+o&&(r=-r,o=-o),n.l=g(r,i.l,o,e.l)):(r=w(t,i,e),o=-w(t,s,e),0>r+o&&(r=-r,o=-o),n.l=g(r,i.l,o,s.l)):n.l=.5*(i.l+e.l)})(f,r,m,o,A),(t.event.s>A.s||A.s===t.event.s&&t.event.l>=A.l)&&(A.s=t.event.s,A.l=t.event.l),b=o.s>r.s||r.s===o.s&&o.l>=r.l?r:o,(A.s>b.s||b.s===A.s&&A.l>=b.l)&&(A.s=b.s,A.l=b.l),h(A,r)||h(A,o)?(B(t,e),0):!h(f,t.event)&&y(f,t.event,A)>=0||!h(m,t.event)&&0>=y(m,t.event,A)?m===t.event?(t.A.V(s.p),t.A.splice(n.p,s),s=v(e=T(t,e)).m,_(t,v(e),i),O(t,e,s.p.O,s,s,1),1):f===t.event?(t.A.V(n.p),t.A.splice(s.O,n.p.O),i=e,E=v(e=I(e)).m.p.C,i.m=n.p.O,n=_(t,i,null),O(t,e,n.C,s.p.C,E,1),1):(0>y(f,t.event,A)||(x(e).T=e.T=1,t.A.V(s.p),s.u.s=t.event.s,s.u.l=t.event.l),y(m,t.event,A)>0||(e.T=i.T=1,t.A.V(n.p),n.u.s=t.event.s,n.u.l=t.event.l),0):(t.A.V(s.p),t.A.V(n.p),t.A.splice(n.p.O,s),s.u.s=A.s,s.u.l=A.l,s.u.B=t.S.P(s.u),((t,e,i,s,n,r)=>{Se[0]=0,Se[1]=0,Se[2]=0,Se[3]=0,Fe[0]=i.data,Fe[1]=s.data,Fe[2]=n.data,Fe[3]=r.data,e.coords[0]=e.coords[1]=e.coords[2]=0,L(e,i,s,Se,0),L(e,n,r,Se,2),C(t,e,Fe,Se,1)})(t,s.u,r,f,o,m),x(e).T=e.T=i.T=1,0)}function P(t,e){let i,s,n=v(e)
86
+ for(;;){for(;n.T;)e=n,n=v(n)
87
+ if(!e.T&&(n=e,null===(e=x(e))||!e.T))return
88
+ if(e.T=0,i=e.m,s=n.m,i.p.u!==s.p.u&&D(t,e)&&(n.I?(b(t,n),t.A.delete(s),n=v(e),s=n.m):e.I&&(b(t,e),t.A.delete(i),i=(e=x(n)).m)),i.u!==s.u)if(i.p.u===s.p.u||e.I||n.I||i.p.u!==t.event&&s.p.u!==t.event)B(t,e)
89
+ else if(N(t,e))return
90
+ i.u===s.u&&i.p.u===s.p.u&&(A(s,i),b(t,e),t.A.delete(i),e=x(n))}}function $(t,e){let i,s,n,r,o,l
91
+ const u=Ie||(Ie=new we)
92
+ u.m=e.L.p,i=t.k.search(u),s=v(i),s&&(r=i.m,o=s.m,0!==y(r.p.u,e,r.u)?(n=a(o.p.u,r.p.u)?i:s,i.q||n.I?(l=n===i?t.A.connect(e.L.p,r.O):t.A.connect(o.p.C.p,e.L).p,n.I?E(t,n,l):((t,e)=>{e.G=x(e).G+e.m._,e.q=F(t,e.G)})(t,S(t,i,l)),G(t,e)):O(t,i,e.L,e.L,null,1)):((t,e,i)=>{let s,n,r,o,a
93
+ if(s=e.m,h(s.u,i))k(t,s,i.L)
94
+ else{if(!h(s.p.u,i))return t.A.V(s.p),e.I&&(t.A.delete(s.C),e.I=0),t.A.splice(i.L,s),void G(t,i)
95
+ a=v(e=I(e)),r=a.m.p,n=o=r.C,a.I&&(b(t,a),t.A.delete(r),r=n.p.O),t.A.splice(i.L,r),c(n)||(n=null),O(t,e,r.C,o,n,1)}})(t,i,e))}function G(t,e){t.event=e
79
96
  let i=e.L
80
- for(;null===i.N;)if(i=i.C,i===e.L)return void D(t,e)
81
- let s=A(t,i.N),o=w(s)
82
- const h=o.l
83
- let a=S(t,o,null)
84
- a.C===h?((t,e,i)=>{let s,o=i.C,h=w(e),a=e.l,l=h.l,c=0
85
- a.h.o!==l.h.o&&B(t,e),n(a.o,t.event)&&(t.A.splice(o.h.O,a),o=w(e=A(t,e)).l,S(t,w(e),h),c=1),n(l.o,t.event)&&(t.A.splice(i,l.h.O),i=S(t,h,null),c=1),c?F(t,e,i.C,o,o,1):(s=r(l.o,a.o)?l.h.O:a,s=t.A.connect(i.C.h,s),F(t,e,s,s.C,s.C,0),s.h.N.I=1,L(t,e))})(t,s,a):F(t,s,a.C,h,h,1)}function P(t,e,i,s){const n=new ie
97
+ for(;null===i.N;)if(i=i.C,i===e.L)return void $(t,e)
98
+ let s=T(t,i.N),n=v(s)
99
+ const r=n.m
100
+ let o=_(t,n,null)
101
+ o.C===r?((t,e,i)=>{let s,n=i.C,r=v(e),o=e.m,l=r.m,c=0
102
+ o.p.u!==l.p.u&&N(t,e),h(o.u,t.event)&&(t.A.splice(n.p.O,o),n=v(e=T(t,e)).m,_(t,v(e),r),c=1),h(l.u,t.event)&&(t.A.splice(i,l.p.O),i=_(t,r,null),c=1),c?O(t,e,i.C,n,n,1):(s=a(l.u,o.u)?l.p.O:o,s=t.A.connect(i.C.p,s),O(t,e,s,s.C,s.C,0),s.p.N.I=1,P(t,e))})(t,s,o):O(t,s,o.C,r,r,1)}function R(t,e,i,s){const n=new we
86
103
  let r=t.A.F()
87
- r.o.s=i,r.o.i=s,r.h.o.s=e,r.h.o.i=s,t.event=r.h.o,n.l=r,n.G=0,n._=0,n.I=0,n.v=1,n.T=0,t.m.P(n)}function $(t,e){const i=t.Y
104
+ r.u.s=i,r.u.l=s,r.p.u.s=e,r.p.u.l=s,t.event=r.p.u,n.m=r,n.G=0,n.q=0,n.I=0,n.j=1,n.T=0,t.k.P(n)}function z(t,e){const i=t.Y
88
105
  let s=i.next,n=s.coords[0],r=s.coords[1],o=s.coords[2],h=n,a=r,l=o,c=s,u=s,f=s,d=s,y=s,p=s
89
106
  for(s=i.next;s!==i;s=s.next){const t=s.coords[0],e=s.coords[1],i=s.coords[2]
90
107
  n>t&&(n=t,c=s),t>h&&(h=t,d=s),r>e&&(r=e,u=s),e>a&&(a=e,y=s),o>i&&(o=i,f=s),i>l&&(l=i,p=s)}let w=0,g=h-n
@@ -96,65 +113,102 @@ v=u,x=y}else{if(o>=l)return e[0]=0,e[1]=0,void(e[2]=1)
96
113
  v=f,x=p}const A=v.coords[0]-x.coords[0],b=v.coords[1]-x.coords[1],E=v.coords[2]-x.coords[2]
97
114
  let T=0
98
115
  for(s=i.next;s!==i;s=s.next){const t=s.coords[0]-x.coords[0],i=s.coords[1]-x.coords[1],n=s.coords[2]-x.coords[2],r=b*n-E*i,o=E*t-A*n,h=A*i-b*t,a=r*r+o*o+h*h
99
- a>T&&(T=a,e[0]=r,e[1]=o,e[2]=h)}T>0||(e[0]=e[1]=e[2]=0,Math.abs(b)>Math.abs(A)?e[Math.abs(E)>Math.abs(b)?2:1]=1:e[Math.abs(E)>Math.abs(A)?2:0]=1)}function G(t,e){let i,s,n,r=t.q,o=t.Y,h=0
100
- for(i=r.next;i!==r;i=i.next)if(n=i.L,n.p>0)do{h+=(n.o.s-n.h.o.s)*(n.o.i+n.h.o.i),n=n.O}while(n!==i.L)
101
- if(0>h){for(s=o.next;s!==o;s=s.next)s.i=-s.i
102
- e[0]=-e[0],e[1]=-e[1],e[2]=-e[2]}}function z(t,e){let i=0
103
- for(let s=e.q.next;s!==e.q;s=s.next)s._&&(i||(t.H(4),i=1),W(s,t))
104
- i&&t.tt()}function R(t,e,i,s){0>e.s*(i.i-s.i)+i.s*(s.i-e.i)+s.s*(e.i-i.i)?(t.W(e.data),t.W(s.data),t.W(i.data)):(t.W(e.data),t.W(i.data),t.W(s.data))}function W(t,e){let i=0,s=t.L
105
- do{we[i++]=s.o,s=s.O}while(s!==t.L)
116
+ a>T&&(T=a,e[0]=r,e[1]=o,e[2]=h)}T>0||(e[0]=e[1]=e[2]=0,Math.abs(b)>Math.abs(A)?e[Math.abs(E)>Math.abs(b)?2:1]=1:e[Math.abs(E)>Math.abs(A)?2:0]=1)}function W(t,e){let i,s,n,r=t.it,o=t.Y,h=0
117
+ for(i=r.next;i!==r;i=i.next)if(n=i.L,n._>0)do{h+=(n.u.s-n.p.u.s)*(n.u.l+n.p.u.l),n=n.O}while(n!==i.L)
118
+ if(0>h){for(s=o.next;s!==o;s=s.next)s.l=-s.l
119
+ e[0]=-e[0],e[1]=-e[1],e[2]=-e[2]}}function j(t,e){let i=0
120
+ for(let s=e.it.next;s!==e.it;s=s.next)s.q&&(i||(t.H(4),i=1),V(s,t))
121
+ i&&t.st()}function U(t,e,i,s){0>e.s*(i.l-s.l)+i.s*(s.l-e.l)+s.s*(e.l-i.l)?(t.W(e.data),t.W(s.data),t.W(i.data)):(t.W(e.data),t.W(i.data),t.W(s.data))}function V(t,e){let i=0,s=t.L
122
+ do{Oe[i++]=s.u,s=s.O}while(s!==t.L)
106
123
  if(3>i)return
107
- if(3===i)return void R(e,we[0],we[1],we[2]);(t=>{if(t>ge.length){const e=2*t
108
- ge=new Int8Array(e),me=new Int32Array(e),ve=new Int32Array(e)}})(i)
109
- let n=0,o=0
110
- for(let t=1;i>t;t++)r(we[t],we[n])||(n=t),r(we[t],we[o])&&(o=t)
111
- if(n===o)return
112
- let h=0
113
- me[h]=n,ge[h]=1,h++
114
- let a=(n+1)%i,l=(n+i-1)%i
115
- for(;a!==o||l!==o;){let t
116
- t=a===o?0:l===o?1:!r(we[a],we[l]),t?(me[h]=a,ge[h]=1,h++,a=(a+1)%i):(me[h]=l,ge[h]=0,h++,l=(l+i-1)%i)}me[h]=o,ge[h]=1,h++
124
+ if(3===i)return void U(e,Oe[0],Oe[1],Oe[2]);(t=>{if(t>Ce.length){const e=2*t
125
+ Ce=new Int8Array(e),ke=new Int32Array(e),Le=new Int32Array(e)}})(i)
126
+ let n=0,r=0
127
+ for(let t=1;i>t;t++)a(Oe[t],Oe[n])||(n=t),a(Oe[t],Oe[r])&&(r=t)
128
+ if(n===r)return
129
+ let o=0
130
+ ke[o]=n,Ce[o]=1,o++
131
+ let h=(n+1)%i,l=(n+i-1)%i
132
+ for(;h!==r||l!==r;){let t
133
+ t=h===r?0:l===r?1:!a(Oe[h],Oe[l]),t?(ke[o]=h,Ce[o]=1,o++,h=(h+1)%i):(ke[o]=l,Ce[o]=0,o++,l=(l+i-1)%i)}ke[o]=r,Ce[o]=1,o++
117
134
  let c=0
118
- ve[c++]=0,ve[c++]=1
119
- for(let t=2;h-1>t;t++)if(ge[t]!==ge[ve[c-1]]){for(;c>1;){const i=ve[--c]
120
- R(e,we[me[t]],we[me[i]],we[me[ve[c-1]]])}--c,ve[c++]=t-1,ve[c++]=t}else{let i=ve[--c]
121
- for(;c>0;){const s=we[me[t]],n=we[me[i]],r=we[me[ve[c-1]]],o=s.s*(n.i-r.i)+n.s*(r.i-s.i)+r.s*(s.i-n.i)
122
- if(!(1===ge[t]?0>=o:o>=0))break
123
- R(e,s,n,r),i=ve[--c]}ve[c++]=i,ve[c++]=t}for(;c>1;){const t=ve[--c]
124
- R(e,we[me[h-1]],we[me[t]],we[me[ve[c-1]]])}}function j(t,e){let i
125
- for(let s=t.Z.next;s!==t.Z;s=i)i=s.next,s.h.D._!==s.D._?s.p=s.D._?e:-e:t.delete(s)}function U(t,e){let i=0,s=-1
126
- for(let n=e.q.u;n!==e.q;n=n.u){if(!n._)continue
135
+ Le[c++]=0,Le[c++]=1
136
+ for(let t=2;o-1>t;t++)if(Ce[t]!==Ce[Le[c-1]]){for(;c>1;){const i=Le[--c]
137
+ U(e,Oe[ke[t]],Oe[ke[i]],Oe[ke[Le[c-1]]])}--c,Le[c++]=t-1,Le[c++]=t}else{let i=Le[--c]
138
+ for(;c>0;){const s=Oe[ke[t]],n=Oe[ke[i]],r=Oe[ke[Le[c-1]]],o=s.s*(n.l-r.l)+n.s*(r.l-s.l)+r.s*(s.l-n.l)
139
+ if(!(1===Ce[t]?0>=o:o>=0))break
140
+ U(e,s,n,r),i=Le[--c]}Le[c++]=i,Le[c++]=t}for(;c>1;){const t=Le[--c]
141
+ U(e,Oe[ke[o-1]],Oe[ke[t]],Oe[ke[Le[c-1]]])}}function H(t,e){let i
142
+ for(let s=t.Z.next;s!==t.Z;s=i)i=s.next,s.p.D.q!==s.D.q?s._=s.D.q?e:-e:t.delete(s)}function q(t,e){let i=0,s=-1
143
+ for(let n=e.it.v;n!==e.it;n=n.v){if(!n.q)continue
127
144
  i||(t.H(4),i=1)
128
145
  let e=n.L
129
- do{{const i=e.h&&e.h.D&&e.h.D._?0:1
130
- s!==i&&(s=i,t.K(!!s))}t.W(e.o.data),e=e.O}while(e!==n.L)}i&&t.tt()}function V(t,e){for(let i=e.q.next;i!==e.q;i=i.next){if(!i._)continue
146
+ do{{const i=e.p&&e.p.D&&e.p.D.q?0:1
147
+ s!==i&&(s=i,t.K(!!s))}t.W(e.u.data),e=e.O}while(e!==n.L)}i&&t.st()}function Y(t,e){for(let i=e.it.next;i!==e.it;i=i.next){if(!i.q)continue
131
148
  t.H(2)
132
149
  let e=i.L
133
- do{t.W(e.o.data),e=e.O}while(e!==i.L)
134
- t.tt()}}function H(t,e,i,s){const n=t[s],r=i[n]
150
+ do{t.W(e.u.data),e=e.O}while(e!==i.L)
151
+ t.st()}}function J(t,e,i,s){const n=t[s],r=i[n]
135
152
  for(;s>0;){const n=s-1>>1,o=t[n]
136
153
  if(r>=i[o])break
137
- t[s]=o,e[o]=s,s=n}t[s]=n,e[n]=s}function q(t,e,i,s,n){const r=t[s],o=i[r],h=n>>1
154
+ t[s]=o,e[o]=s,s=n}t[s]=n,e[n]=s}function K(t,e,i,s,n){const r=t[s],o=i[r],h=n>>1
138
155
  for(;h>s;){let r=1+(s<<1),h=t[r],a=i[h]
139
156
  const l=r+1
140
157
  if(n>l){const e=t[l],s=i[e]
141
158
  a>s&&(r=l,h=e,a=s)}if(a>=o)break
142
- t[s]=h,e[h]=s,s=r}t[s]=r,e[r]=s}function Y(t,e,i,s,n){const r=t[i]*(e[s]-e[n])+t[s]*(e[n]-e[i])+t[n]*(e[i]-e[s])
143
- return 0>r?-r:r}function J(t,e){Pe.push(new Vt(t,e))}function K(t,e,i,s,n,r,o){if(o>ze)return
159
+ t[s]=h,e[h]=s,s=r}t[s]=r,e[r]=s}function X(t,e,i,s,n){const r=t[i]*(e[s]-e[n])+t[s]*(e[n]-e[i])+t[n]*(e[i]-e[s])
160
+ return 0>r?-r:r}
161
+ /**
162
+ * @license
163
+ * Anti-Grain Geometry - Version 2.4
164
+ * Copyright (C) 2002-2005 Maxim Shemanarev (McSeem)
165
+ *
166
+ * This software is a partial port of the AGG library, specifically the adaptive
167
+ * subdivision algorithm for polygonization. The original software was available
168
+ * at http://www.antigrain.com and was distributed under the BSD 3-Clause License
169
+ *
170
+ * Redistribution and use in source and binary forms, with or without
171
+ * modification, are permitted provided that the following conditions
172
+ * are met:
173
+ *
174
+ * 1. Redistributions of source code must retain the above copyright
175
+ * notice, this list of conditions and the following disclaimer.
176
+ *
177
+ * 2. Redistributions in binary form must reproduce the above copyright
178
+ * notice, this list of conditions and the following disclaimer in
179
+ * the documentation and/or other materials provided with the
180
+ * distribution.
181
+ *
182
+ * 3. The name of the author may not be used to endorse or promote
183
+ * products derived from this software without specific prior
184
+ * written permission.
185
+ *
186
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
187
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
188
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
189
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
190
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
191
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
192
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
193
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
194
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
195
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
196
+ * POSSIBILITY OF SUCH DAMAGE.
197
+ */function Q(t,e){Xe.push(new Ht(t,e))}function Z(t,e,i,s,n,r,o){if(o>ti)return
144
198
  const h=.5*(t+i),a=.5*(e+s),l=.5*(i+n),c=.5*(s+r),u=.5*(h+l),f=.5*(a+c),d=n-t,y=r-e
145
199
  let p=Math.abs((i-n)*y-(s-r)*d)
146
- if(p>Ge){if($e*(d*d+y*y)>=p*p){if(0>=Re)return void J(u,f)
200
+ if(p>Ze){if(Qe*(d*d+y*y)>=p*p){if(0>=ei)return void Q(u,f)
147
201
  {const o=i-t,h=s-e,a=n-i,l=r-s,c=o*l-h*a,d=o*a+h*l
148
- if(d>0&&We*d*d>c*c)return void J(u,f)}}}else{let o=d*d+y*y
202
+ if(d>0&&ii*d*d>c*c)return void Q(u,f)}}}else{let o=d*d+y*y
149
203
  if(0===o)p=(i-t)*(i-t)+(s-e)*(s-e)
150
204
  else{if(p=((i-t)*d+(s-e)*y)/o,p>0&&1>p)return
151
205
  if(p>0)if(1>p){const n=t+p*d,r=e+p*y
152
206
  p=(i-n)*(i-n)+(s-r)*(s-r)}else p=(i-n)*(i-n)+(s-r)*(s-r)
153
- else p=(i-t)*(i-t)+(s-e)*(s-e)}if($e>p)return void J(i,s)}const w=o+1
154
- K(t,e,h,a,u,f,w),K(u,f,l,c,n,r,w)}function X(t,e,i,s,n,r,o,h,a){if(a>ze)return
207
+ else p=(i-t)*(i-t)+(s-e)*(s-e)}if(Qe>p)return void Q(i,s)}const w=o+1
208
+ Z(t,e,h,a,u,f,w),Z(u,f,l,c,n,r,w)}function tt(t,e,i,s,n,r,o,h,a){if(a>ti)return
155
209
  const l=.5*(t+i),c=.5*(e+s),u=.5*(i+n),f=.5*(s+r),d=.5*(n+o),y=.5*(r+h),p=.5*(l+u),w=.5*(c+f),g=.5*(u+d),m=.5*(f+y),v=.5*(p+g),x=.5*(w+m),A=o-t,b=h-e
156
210
  let E=Math.abs((i-o)*b-(s-h)*A),T=Math.abs((n-o)*b-(r-h)*A)
157
- switch((E>Ge?2:0)+(T>Ge?1:0)){case 0:{let a=A*A+b*b
211
+ switch((E>Ze?2:0)+(T>Ze?1:0)){case 0:{let a=A*A+b*b
158
212
  if(0===a)E=(i-t)*(i-t)+(s-e)*(s-e),T=(n-t)*(n-t)+(r-e)*(r-e)
159
213
  else{a=1/a
160
214
  let l=i-t,c=s-e
@@ -164,71 +218,61 @@ E=(i-n)*(i-n)+(s-r)*(s-r)}else E=(i-o)*(i-o)+(s-h)*(s-h)
164
218
  else E=(i-t)*(i-t)+(s-e)*(s-e)
165
219
  if(T>0)if(1>T){const i=t+T*A,s=e+T*b
166
220
  T=(n-i)*(n-i)+(r-s)*(r-s)}else T=(n-o)*(n-o)+(r-h)*(r-h)
167
- else T=(n-t)*(n-t)+(r-e)*(r-e)}if(E>T){if($e>E)return void J(i,s)}else if($e>T)return void J(n,r)
168
- break}case 1:if($e*(A*A+b*b)>=T*T){if(0>=Re)return void J(u,f)
221
+ else T=(n-t)*(n-t)+(r-e)*(r-e)}if(E>T){if(Qe>E)return void Q(i,s)}else if(Qe>T)return void Q(n,r)
222
+ break}case 1:if(Qe*(A*A+b*b)>=T*T){if(0>=ei)return void Q(u,f)
169
223
  {const t=n-i,e=r-s,a=o-n,l=h-r,c=t*l-e*a,u=t*a+e*l
170
- if(u>0&&We*u*u>c*c)return J(i,s),void J(n,r)
171
- if(je>0&&(0>=u||c*c>Ue*u*u))return void J(n,r)}}break
172
- case 2:if($e*(A*A+b*b)>=E*E){if(0>=Re)return void J(u,f)
224
+ if(u>0&&ii*u*u>c*c)return Q(i,s),void Q(n,r)
225
+ if(si>0&&(0>=u||c*c>ni*u*u))return void Q(n,r)}}break
226
+ case 2:if(Qe*(A*A+b*b)>=E*E){if(0>=ei)return void Q(u,f)
173
227
  {const o=i-t,h=s-e,a=n-i,l=r-s,c=o*l-h*a,u=o*a+h*l
174
- if(u>0&&We*u*u>c*c)return J(i,s),void J(n,r)
175
- if(je>0&&(0>=u||c*c>Ue*u*u))return void J(i,s)}}break
176
- case 3:if($e*(A*A+b*b)>=(E+T)*(E+T)){if(0>=Re)return void J(u,f)
228
+ if(u>0&&ii*u*u>c*c)return Q(i,s),void Q(n,r)
229
+ if(si>0&&(0>=u||c*c>ni*u*u))return void Q(i,s)}}break
230
+ case 3:if(Qe*(A*A+b*b)>=(E+T)*(E+T)){if(0>=ei)return void Q(u,f)
177
231
  {const a=i-t,l=s-e,c=n-i,d=r-s,y=a*d-l*c,p=a*c+l*d,w=o-n,g=h-r,m=c*g-d*w,v=c*w+d*g
178
232
  if(p>0&&v>0){const t=0>y?-y:y,e=0>m?-m:m,i=t*v+e*p,s=p*v-t*e
179
- if(s>0&&We*s*s>i*i)return void J(u,f)}if(je>0){if(0>=p||y*y>Ue*p*p)return void J(i,s)
180
- if(0>=v||m*m>Ue*v*v)return void J(n,r)}}}}const I=a+1
181
- X(t,e,l,c,p,w,v,x,I),X(v,x,g,m,d,y,o,h,I)}async function Q(t){try{const e=await fetch(t)
182
- if(!e.ok)throw Error("HTTP "+e.status)
183
- return await e.arrayBuffer()}catch(e){const i=globalThis.require
184
- if("function"!=typeof i)throw Error(`Failed to fetch ${t}: ${e}`)
185
- try{const e=i("fs"),s=i("path")
186
- let n=t
187
- if("undefined"!=typeof window&&"file:"===window.location?.protocol){const e=s.et(window.location.pathname)
188
- n=s.join(e,t)}const r=e.it(n)
189
- return r instanceof ArrayBuffer?r:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch(i){throw Error(`Failed to load ${t}: fetch failed (${e}), fs.readFileSync failed (${i})`)}}}function Z(t){return t&&t.st&&{}.hasOwnProperty.call(t,"default")?t.default:t}function tt(t){if(t.st)return t
190
- var e=t.default
191
- if("function"==typeof e){var i=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)}
192
- i.prototype=e.prototype}else i={}
193
- return Object.defineProperty(i,"st",{value:!0}),Object.keys(t).forEach(e=>{var s=Object.getOwnPropertyDescriptor(t,e)
194
- Object.defineProperty(i,e,s.get?s:{enumerable:!0,get(){return t[e]}})}),i}var et="undefined"!=typeof document?document.currentScript:null
195
- const it=!("undefined"==typeof window||!window.THREE_TEXT_LOG)||"undefined"!=typeof globalThis&&"true"===globalThis.process?.nt?.THREE_TEXT_LOG,st=new class{warn(t,...e){}error(t,...e){console.error(t,...e)}log(t,...e){}}
196
- new class{constructor(){this.rt=[],this.ot=new Map}start(t,e){if(!it)return
233
+ if(s>0&&ii*s*s>i*i)return void Q(u,f)}if(si>0){if(0>=p||y*y>ni*p*p)return void Q(i,s)
234
+ if(0>=v||m*m>ni*v*v)return void Q(n,r)}}}}const I=a+1
235
+ tt(t,e,l,c,p,w,v,x,I),tt(v,x,g,m,d,y,o,h,I)}function et(t){const e=t.module,i=ai.get(e)
236
+ if(i)return i
237
+ const s=new hi
238
+ return ai.set(e,s),s}var it="undefined"!=typeof document?document.currentScript:null
239
+ const st=!("undefined"==typeof window||!window.THREE_TEXT_LOG)||"undefined"!=typeof globalThis&&"true"===globalThis.process?.nt?.THREE_TEXT_LOG,nt=new class{warn(t,...e){}error(t,...e){console.error(t,...e)}log(t,...e){}}
240
+ new class{constructor(){this.rt=[],this.ot=new Map}start(t,e){if(!st)return
197
241
  const i=performance.now()
198
- this.ot.set(`${t}_${i}`,i),this.rt.push({name:t,startTime:i,metadata:e})}end(t){if(!it)return null
242
+ this.ot.set(`${t}_${i}`,i),this.rt.push({name:t,startTime:i,metadata:e})}end(t){if(!st)return null
199
243
  const e=performance.now()
200
244
  let i,s
201
245
  for(const[e,n]of Array.from(this.ot.entries()).reverse())if(e.startsWith(t+"_")){i=e,s=n
202
- break}if(void 0===s||!i)return st.warn(`Performance timer "${t}" was not started`),null
246
+ break}if(void 0===s||!i)return nt.warn(`Performance timer "${t}" was not started`),null
203
247
  const n=e-s
204
248
  this.ot.delete(i)
205
249
  for(let i=this.rt.length-1;i>=0;i--){const r=this.rt[i]
206
250
  if(r.name===t&&r.startTime===s&&!r.endTime){r.endTime=e,r.duration=n
207
- break}}return n.toFixed(2),n}ht(){if(!it)return{}
251
+ break}}return n.toFixed(2),n}ht(){if(!st)return{}
208
252
  const t={}
209
253
  for(const e of this.rt){if(!e.duration)continue
210
254
  const i=t[e.name]
211
- i?(i.count++,i.lt+=e.duration,i.ct=i.lt/i.count,i.ut=e.duration):t[e.name]={count:1,ct:e.duration,lt:e.duration,ut:e.duration}}return t}ft(){if(!it)return
255
+ i?(i.count++,i.lt+=e.duration,i.ct=i.lt/i.count,i.ut=e.duration):t[e.name]={count:1,ct:e.duration,lt:e.duration,ut:e.duration}}return t}ft(){if(!st)return
212
256
  const t=this.ht()
213
- console.table(t),Object.keys(t).sort().join(", ")}dt(){if(!it)return
257
+ console.table(t),Object.keys(t).sort().join(", ")}dt(){if(!st)return
214
258
  const t=this.ht()
215
- Object.entries(t).forEach(([t,e])=>{e.ct.toFixed(2)})}clear(){it&&(this.rt.length=0,this.ot.clear())}time(t,e,i){if(!it)return e()
259
+ Object.entries(t).forEach(([t,e])=>{e.ct.toFixed(2)})}clear(){st&&(this.rt.length=0,this.ot.clear())}time(t,e,i){if(!st)return e()
216
260
  this.start(t,i)
217
- try{return e()}finally{this.end(t)}}async yt(t,e,i){if(!it)return e()
261
+ try{return e()}finally{this.end(t)}}async yt(t,e,i){if(!st)return e()
218
262
  this.start(t,i)
219
263
  try{return await e()}finally{this.end(t)}}}
220
- const nt=800,rt=100,ot=0,ht=1/3
221
- var at,lt;(t=>{t[t.BOX=0]="BOX",t[t.GLUE=1]="GLUE",t[t.PENALTY=2]="PENALTY",t[t.DISCRETIONARY=3]="DISCRETIONARY"})(at||(at={})),(t=>{t[t.VERY_LOOSE=0]="VERY_LOOSE",t[t.LOOSE=1]="LOOSE",t[t.DECENT=2]="DECENT",t[t.TIGHT=3]="TIGHT"})(lt||(lt={}))
222
- class ct{constructor(){this.wt=new Map,this.gt=[]}getKey(t,e){return t<<2|e}vt(t){const e=this.getKey(t.position,t.xt),i=this.wt.get(e)
264
+ const rt=800,ot=100,ht=0,at=1/3
265
+ var lt,ct;(t=>{t[t.BOX=0]="BOX",t[t.GLUE=1]="GLUE",t[t.PENALTY=2]="PENALTY",t[t.DISCRETIONARY=3]="DISCRETIONARY"})(lt||(lt={})),(t=>{t[t.VERY_LOOSE=0]="VERY_LOOSE",t[t.LOOSE=1]="LOOSE",t[t.DECENT=2]="DECENT",t[t.TIGHT=3]="TIGHT"})(ct||(ct={}))
266
+ class ut{constructor(){this.wt=new Map,this.gt=[]}getKey(t,e){return t<<2|e}vt(t){const e=this.getKey(t.position,t.xt),i=this.wt.get(e)
223
267
  return i?i.bt>t.bt&&(i.bt=t.bt,i._t=t._t,i.kt=t.kt,i.line=t.line,i.zt=t.zt,i.jt=t.jt,i.qt=t.qt,!0):(t.active=!0,t.te=this.gt.length,this.gt.push(t),this.wt.set(e,t),!0)}ee(t){if(!t.active)return
224
268
  t.active=!1
225
269
  const e=t.te,i=this.gt.length-1
226
270
  if(e!==i){const t=this.gt[i]
227
- this.gt[e]=t,t.te=e}this.gt.pop()}ie(){return this.gt}size(){return this.gt.length}}const ut=50,ft=50,dt=1e4,yt=5e3,pt=10,wt=1e4,gt=2,mt=3,vt=-1e4
228
- class xt{static se(t,e){if(0===t)return 0
271
+ this.gt[e]=t,t.te=e}this.gt.pop()}ie(){return this.gt}size(){return this.gt.length}}const ft=50,dt=50,yt=1e4,pt=5e3,wt=10,gt=1e4,mt=2,vt=3,xt=-1e4
272
+ class At{static se(t,e){if(0===t)return 0
229
273
  if(0>=e)return 10001
230
274
  const i=Math.abs(t/e)
231
- return i>10?10001:Math.min(Math.round(100*i**3),1e4)}static ne(t){return-.5>t?lt.TIGHT:.5>t?lt.DECENT:1>t?lt.LOOSE:lt.VERY_LOOSE}static re(t,e="en-us",i,s=gt,n=mt){let r
275
+ return i>10?10001:Math.min(Math.round(100*i**3),1e4)}static ne(t){return-.5>t?ct.TIGHT:.5>t?ct.DECENT:1>t?ct.LOOSE:ct.VERY_LOOSE}static re(t,e="en-us",i,s=mt,n=vt){let r
232
276
  if(!i||!i[e])return[]
233
277
  if(r=i[e],!r)return[]
234
278
  const o=`.${t.toLowerCase()}.`,h=Array(o.length).fill(0)
@@ -238,8 +282,8 @@ if(!e.children||!e.children[s])break
238
282
  if(e=e.children[s],e.oe)for(let i=0;e.oe.length>i;i++){const s=t+i
239
283
  h.length>s&&(h[s]=Math.max(h[s],e.oe[i]))}}}const a=[]
240
284
  for(let t=2;o.length-2>t;t++)h[t]%2==1&&a.push(t-1)
241
- return a.filter(e=>e>=s&&t.length-e>=n)}static he(t,e,i,s=!1,n="en-us",r,o=gt,h=mt,a,l){const c=[]
242
- return c.push(...this.ae(t,e,i,s,n,r,o,h,a,l)),c.push({type:at.GLUE,width:0,stretch:1e7,le:0,text:"",ce:t.length}),c.push({type:at.PENALTY,width:0,ue:vt,text:"",ce:t.length}),c}static fe(t){const e=t.codePointAt(0)
285
+ return a.filter(e=>e>=s&&t.length-e>=n)}static he(t,e,i,s=!1,n="en-us",r,o=mt,h=vt,a,l){const c=[]
286
+ return c.push(...this.ae(t,e,i,s,n,r,o,h,a,l)),c.push({type:lt.GLUE,width:0,stretch:1e7,le:0,text:"",ce:t.length}),c.push({type:lt.PENALTY,width:0,ue:xt,text:"",ce:t.length}),c}static fe(t){const e=t.codePointAt(0)
243
287
  return void 0!==e&&(e>=19968&&40959>=e||e>=13312&&19903>=e||e>=131072&&173791>=e||e>=173824&&177983>=e||e>=177984&&178207>=e||e>=178208&&183983>=e||e>=63744&&64255>=e||e>=12352&&12447>=e||e>=12448&&12543>=e||e>=44032&&55215>=e||e>=4352&&4607>=e||e>=12592&&12687>=e||e>=43360&&43391>=e||e>=55216&&55295>=e||e>=65440&&65500>=e)}static de(t){const e=t.charCodeAt(0)
244
288
  return 12289===e||12290===e||65292===e||65294===e||65306===e||65307===e||65281===e||65311===e||65289===e||12305===e||65373===e||12301===e||12303===e||12297===e||12299===e||12309===e||12311===e||12313===e||12315===e||12540===e||8212===e||8230===e||8229===e}static ye(t){const e=t.charCodeAt(0)
245
289
  return 65288===e||12304===e||65371===e||12300===e||12302===e||12296===e||12298===e||12308===e||12310===e||12312===e||12314===e}static pe(t){return this.de(t)||this.ye(t)}static we(t,e,i,s,n=0,r){const o=[],h=Array.from(t),a=i?i(t):null
@@ -248,11 +292,11 @@ if(r)l=r.width,c=r.stretch,u=r.le
248
292
  else{const t=e("字")
249
293
  l=0,c=.04*t,u=.04*t}for(let t=0;h.length>t;t++){const i=h[t],s=h.length-1>t?h[t+1]:null
250
294
  if(/\s/.test(i)){const s=a?a[t]??e(i):e(i)
251
- o.push({type:at.GLUE,width:s,stretch:.5*s,le:s*ht,text:i,ce:f}),f+=i.length
252
- continue}if(o.push({type:at.BOX,width:a?a[t]??e(i):e(i),text:i,ce:f}),f+=i.length,s&&!/\s/.test(s)){let t=!0
295
+ o.push({type:lt.GLUE,width:s,stretch:.5*s,le:s*at,text:i,ce:f}),f+=i.length
296
+ continue}if(o.push({type:lt.BOX,width:a?a[t]??e(i):e(i),text:i,ce:f}),f+=i.length,s&&!/\s/.test(s)){let t=!0
253
297
  this.de(s)&&(t=!1),this.ye(i)&&(t=!1)
254
298
  const e=this.pe(i)&&this.pe(s)
255
- t&&!e&&o.push({type:at.GLUE,width:l,stretch:c,le:u,text:"",ce:f})}}return o}static ae(t,e,i,s,n,r,o,h,a,l){const c=[],u=Array.from(t)
299
+ t&&!e&&o.push({type:lt.GLUE,width:l,stretch:c,le:u,text:"",ce:f})}}return o}static ae(t,e,i,s,n,r,o,h,a,l){const c=[],u=Array.from(t)
256
300
  let f,d="",y=0,p=null,w=0
257
301
  const g=()=>{0!==d.length&&("cjk"===p?c.push(...this.we(d,e,i,a,y,(()=>{if(!f){const t=e("字")
258
302
  f={width:0,stretch:.04*t,le:.04*t}}return f})())):c.push(...this.ge(d,y,e,s,n,r,o,h,a,l)),d="",p=null)}
@@ -261,30 +305,30 @@ null!==p&&p!==i&&(g(),y=w),null===p&&(p=i,y=w),d+=e,w+=e.length}return g(),c}sta
261
305
  let f=0
262
306
  for(const t of u){const u=e+f
263
307
  if(/\s+/.test(t)){const e=i(t)
264
- c.push({type:at.GLUE,width:e,stretch:.5*e,le:e*ht,text:t,ce:u}),f+=t.length}else{if(l&&t.includes("-")&&!t.includes("­")&&i(t)>l){const e=Array.from(t)
265
- for(let t=0;e.length>t;t++)c.push({type:at.BOX,width:i(e[t]),text:e[t],ce:u+t}),e.length-1>t&&c.push({type:at.PENALTY,width:0,ue:5e3,ce:u+t+1})
308
+ c.push({type:lt.GLUE,width:e,stretch:.5*e,le:e*at,text:t,ce:u}),f+=t.length}else{if(l&&t.includes("-")&&!t.includes("­")&&i(t)>l){const e=Array.from(t)
309
+ for(let t=0;e.length>t;t++)c.push({type:lt.BOX,width:i(e[t]),text:e[t],ce:u+t}),e.length-1>t&&c.push({type:lt.PENALTY,width:0,ue:5e3,ce:u+t+1})
266
310
  f+=t.length
267
311
  continue}const e=t.split(/(-)/)
268
312
  let d=u
269
- for(const t of e)if(t){if("-"===t)c.push({type:at.DISCRETIONARY,width:i("-"),me:"-",ve:"",xe:"-",Ae:i("-"),ue:a?.be??ft,Ee:!0,text:"-",ce:d}),d+=1
313
+ for(const t of e)if(t){if("-"===t)c.push({type:lt.DISCRETIONARY,width:i("-"),me:"-",ve:"",xe:"-",Ae:i("-"),ue:a?.be??dt,Ee:!0,text:"-",ce:d}),d+=1
270
314
  else if(t.includes("­")){const e=t.split("­")
271
315
  let s=0
272
316
  for(let t=0;e.length>t;t++){const n=e[t]
273
- n.length>0&&(c.push({type:at.BOX,width:i(n),text:n,ce:d+s}),s+=n.length),e.length-1>t&&(c.push({type:at.DISCRETIONARY,width:0,me:"-",ve:"",xe:"",Ae:i("-"),ue:a?.Te??ut,Ee:!0,text:"",ce:d+s}),s+=1)}}else if(s&&t.length>=o+h&&/^\p{L}+$/u.test(t)){const e=this.re(t,n,r,o,h)
317
+ n.length>0&&(c.push({type:lt.BOX,width:i(n),text:n,ce:d+s}),s+=n.length),e.length-1>t&&(c.push({type:lt.DISCRETIONARY,width:0,me:"-",ve:"",xe:"",Ae:i("-"),ue:a?.Te??ft,Ee:!0,text:"",ce:d+s}),s+=1)}}else if(s&&t.length>=o+h&&/^\p{L}+$/u.test(t)){const e=this.re(t,n,r,o,h)
274
318
  if(e.length>0){let s=0
275
319
  for(const n of e){const e=t.substring(s,n)
276
- c.push({type:at.BOX,width:i(e),text:e,ce:d+s}),c.push({type:at.DISCRETIONARY,width:0,me:"-",ve:"",xe:"",Ae:i("-"),ue:a?.Te??ut,Ee:!0,text:"",ce:d+n}),s=n}c.push({type:at.BOX,width:i(t.substring(s)),text:t.substring(s),ce:d+s})}else{const e=i(t)
320
+ c.push({type:lt.BOX,width:i(e),text:e,ce:d+s}),c.push({type:lt.DISCRETIONARY,width:0,me:"-",ve:"",xe:"",Ae:i("-"),ue:a?.Te??ft,Ee:!0,text:"",ce:d+n}),s=n}c.push({type:lt.BOX,width:i(t.substring(s)),text:t.substring(s),ce:d+s})}else{const e=i(t)
277
321
  if(l&&e>l){const e=Array.from(t)
278
- for(let t=0;e.length>t;t++)c.push({type:at.BOX,width:i(e[t]),text:e[t],ce:d+t}),e.length-1>t&&c.push({type:at.PENALTY,width:0,ue:5e3,ce:d+t+1})}else c.push({type:at.BOX,width:e,text:t,ce:d})}}else{const e=i(t)
322
+ for(let t=0;e.length>t;t++)c.push({type:lt.BOX,width:i(e[t]),text:e[t],ce:d+t}),e.length-1>t&&c.push({type:lt.PENALTY,width:0,ue:5e3,ce:d+t+1})}else c.push({type:lt.BOX,width:e,text:t,ce:d})}}else{const e=i(t)
279
323
  if(l&&e>l){const e=Array.from(t)
280
- for(let t=0;e.length>t;t++)c.push({type:at.BOX,width:i(e[t]),text:e[t],ce:d+t}),e.length-1>t&&c.push({type:at.PENALTY,width:0,ue:5e3,ce:d+t+1})}else c.push({type:at.BOX,width:e,text:t,ce:d})}d+=t.length}f+=t.length}}return c}static lineBreak(t,e,i,s,n){const r=new ct
281
- r.vt({position:0,line:0,xt:lt.DECENT,bt:0,_t:null,kt:!1,active:!0,te:0,zt:0,jt:0,qt:0})
324
+ for(let t=0;e.length>t;t++)c.push({type:lt.BOX,width:i(e[t]),text:e[t],ce:d+t}),e.length-1>t&&c.push({type:lt.PENALTY,width:0,ue:5e3,ce:d+t+1})}else c.push({type:lt.BOX,width:e,text:t,ce:d})}d+=t.length}f+=t.length}}return c}static lineBreak(t,e,i,s,n){const r=new ut
325
+ r.vt({position:0,line:0,xt:ct.DECENT,bt:0,_t:null,kt:!1,active:!0,te:0,zt:0,jt:0,qt:0})
282
326
  let o=0,h=0,a=0
283
327
  for(let l=0;t.length>l;l++){const c=t[l]
284
- if(!(c.type===at.PENALTY&&1e4>c.ue||c.type===at.DISCRETIONARY||c.type===at.GLUE&&l>0&&t[l-1].type===at.BOX)){c.type===at.BOX?o+=c.width:c.type===at.GLUE?(o+=c.width,h+=c.stretch,a+=c.le):c.type===at.DISCRETIONARY&&(o+=c.width)
285
- continue}let u=0,f=!1;(c.type===at.PENALTY||c.type===at.DISCRETIONARY)&&(u=c.ue,f=c.Ee||!1)
328
+ if(!(c.type===lt.PENALTY&&1e4>c.ue||c.type===lt.DISCRETIONARY||c.type===lt.GLUE&&l>0&&t[l-1].type===lt.BOX)){c.type===lt.BOX?o+=c.width:c.type===lt.GLUE?(o+=c.width,h+=c.stretch,a+=c.le):c.type===lt.DISCRETIONARY&&(o+=c.width)
329
+ continue}let u=0,f=!1;(c.type===lt.PENALTY||c.type===lt.DISCRETIONARY)&&(u=c.ue,f=c.Ee||!1)
286
330
  let d=0
287
- c.type===at.DISCRETIONARY&&(d=c.Ae)
331
+ c.type===lt.DISCRETIONARY&&(d=c.Ae)
288
332
  const y=[null,null,null,null],p=[1/0,1/0,1/0,1/0],w=[],g=r.ie()
289
333
  for(let t=0;g.length>t;t++){const r=g[t],c=h-r.jt,m=a-r.qt,v=e-(o-r.zt+d)
290
334
  let x
@@ -292,28 +336,28 @@ if(v>0){const t=c+s
292
336
  x=t>0?v/t:1/0}else x=0>v?m>0?v/m:-1/0:0
293
337
  const A=this.se(v,v>0?c+s:m)
294
338
  if(-1>x){w.push(r)
295
- continue}if(u!==vt&&A>i)continue
339
+ continue}if(u!==xt&&A>i)continue
296
340
  let b=n.Ie+A
297
- 1e4>Math.abs(b)?b*=b:b=1e8,u>0?b+=u*u:u>vt&&(b-=u*u),f&&r.kt&&(b+=n.Se)
341
+ 1e4>Math.abs(b)?b*=b:b=1e8,u>0?b+=u*u:u>xt&&(b-=u*u),f&&r.kt&&(b+=n.Se)
298
342
  const E=this.ne(x)
299
343
  Math.abs(E-r.xt)>1&&(b+=n.Fe)
300
344
  const T=r.bt+b
301
345
  p[E]>T&&(p[E]=T,y[E]={position:l,line:r.line+1,xt:E,bt:T,_t:r,kt:f,active:!0,te:-1,zt:o,jt:h,qt:a})}for(const t of w)r.ee(t)
302
346
  for(let t=0;4>t;t++)y[t]&&r.vt(y[t])
303
- if(0===r.size()&&u!==vt)return null
304
- c.type===at.BOX?o+=c.width:c.type===at.GLUE?(o+=c.width,h+=c.stretch,a+=c.le):c.type===at.DISCRETIONARY&&(o+=c.width)}let l=null,c=1/0
347
+ if(0===r.size()&&u!==xt)return null
348
+ c.type===lt.BOX?o+=c.width:c.type===lt.GLUE?(o+=c.width,h+=c.stretch,a+=c.le):c.type===lt.DISCRETIONARY&&(o+=c.width)}let l=null,c=1/0
305
349
  for(const t of r.ie())c>t.bt&&(c=t.bt,l=t)
306
350
  return l}static Me(t){if(!t.text||0===t.text.length)return[]
307
- const{text:e,width:i,align:s="left",direction:n="ltr",_e:r=!1,language:o="en-us",Oe:h=!0,measureText:a,Ce:l,ke:c,Be:u,letterSpacing:f=0,Le:d=nt,De:y=rt,Ne:p=ot,Pe:w,$e:g=gt,Ge:m=mt,ze:v=pt,Re:x=wt,We:A=ut,je:b=ft,Ue:E=dt,Ve:T=yt}=t
351
+ const{text:e,width:i,align:s="left",direction:n="ltr",_e:r=!1,language:o="en-us",Oe:h=!0,measureText:a,Ce:l,ke:c,Le:u,letterSpacing:f=0,Be:d=rt,De:y=ot,Ne:p=ht,Pe:w,$e:g=mt,Ge:m=vt,Re:v=wt,ze:x=gt,We:A=ft,je:b=dt,Ue:E=yt,Ve:T=pt}=t
308
352
  if(h&&e.includes("\n")){const i=e.split("\n"),s=[]
309
353
  let n=0
310
354
  for(const e of i){if(0===e.length)s.push({text:"",He:n,qe:n,Ye:0,Je:!0,naturalWidth:0,Ke:!1})
311
355
  else{const i=this.Me({...t,text:e,Oe:!1})
312
356
  i.forEach(t=>{t.He+=n,t.qe+=n}),s.push(...i)}n+=e.length+1}return s}let I=r
313
- !I||c&&c[o]||(st.warn(`Hyphenation patterns for ${o} not available`),I=!1)
357
+ !I||c&&c[o]||(nt.warn(`Hyphenation patterns for ${o} not available`),I=!1)
314
358
  let S=p
315
359
  void 0!==w&&i&&(S=i*w)
316
- const F={Ie:v,Fe:x,Se:E,Xe:T,Te:A,be:b,Qe:s,Be:u,Ze:u?f*u:0}
360
+ const F={Ie:v,Fe:x,Se:E,Xe:T,Te:A,be:b,Qe:s,Le:u,Ze:u?f*u:0}
317
361
  if(!i||i===1/0){const t=a(e)
318
362
  return[{text:e,He:0,qe:e.length-1,Ye:0,Je:!0,naturalWidth:t,Ke:!1}]}let M=this.he(e,a,l,!1,o,c,g,m,F,i),_=this.lineBreak(M,i,y,0,F)
319
363
  if(!_&&I&&(M=this.he(e,a,l,!0,o,c,g,m,F,i),_=this.lineBreak(M,i,d,0,F)),!_){const t=5
@@ -327,12 +371,12 @@ let a=0
327
371
  for(let t=0;i.length>t;t++){const l=i[t],c=!(e.length-1>i[i.length-1]+1)&&t===i.length-1,u=[]
328
372
  let f=-1,d=-1,y=0,p=0,w=0
329
373
  for(let t=a;l>t;t++){const i=e[t]
330
- if((i.type!==at.PENALTY||i.text)&&(i.type!==at.DISCRETIONARY||i.xe)){if(void 0!==i.ce){(-1===f||f>i.ce)&&(f=i.ce)
374
+ if((i.type!==lt.PENALTY||i.text)&&(i.type!==lt.DISCRETIONARY||i.xe)){if(void 0!==i.ce){(-1===f||f>i.ce)&&(f=i.ce)
331
375
  const t=i.ce+(i.text?i.text.length:0)-1
332
- t>d&&(d=t)}i.text?u.push(i.text):i.type===at.DISCRETIONARY&&i.xe&&u.push(i.xe),y+=i.width,i.type===at.GLUE&&(p+=i.stretch,w+=i.le)}}const g=e[l]
376
+ t>d&&(d=t)}i.text?u.push(i.text):i.type===lt.DISCRETIONARY&&i.xe&&u.push(i.xe),y+=i.width,i.type===lt.GLUE&&(p+=i.stretch,w+=i.le)}}const g=e[l]
333
377
  let m=!1
334
- if(e.length>l)if(g.type===at.PENALTY&&g.Ee)u.push("-"),y+=g.width,m=!0,void 0!==g.ce&&(d=g.ce-1)
335
- else if(g.type===at.DISCRETIONARY){const t=g
378
+ if(e.length>l)if(g.type===lt.PENALTY&&g.Ee)u.push("-"),y+=g.width,m=!0,void 0!==g.ce&&(d=g.ce-1)
379
+ else if(g.type===lt.DISCRETIONARY){const t=g
336
380
  t.me&&(u.push(t.me),y+=t.Ae,m=t.Ee||!1,void 0!==g.ce&&(d=g.ce-1))}const v=u.join("")
337
381
  o?.Ze&&0!==y&&(y-=o.Ze)
338
382
  let x=0,A=0,b=n
@@ -342,11 +386,11 @@ else if("justify"===b&&!c){const t=s-y
342
386
  t>0&&p>0?A=t/p:0>t&&w>0&&(A=t/w)}h.push({text:v,He:f,qe:d,Ye:x,ei:A,Je:!1,naturalWidth:y,Ke:m}),a=l+1}if(e.length-1>a){const t=[]
343
387
  let i=-1,l=-1,c=0
344
388
  for(let s=a;e.length-1>s;s++){const n=e[s]
345
- n.type!==at.PENALTY&&(void 0!==n.ce&&((-1===i||i>n.ce)&&(i=n.ce),n.ce>l&&(l=n.ce)),n.text&&t.push(n.text),c+=n.width)}o?.Ze&&0!==c&&(c-=o.Ze)
389
+ n.type!==lt.PENALTY&&(void 0!==n.ce&&((-1===i||i>n.ce)&&(i=n.ce),n.ce>l&&(l=n.ce)),n.text&&t.push(n.text),c+=n.width)}o?.Ze&&0!==c&&(c-=o.Ze)
346
390
  let u=0,f=n
347
391
  "justify"===n&&(f="rtl"===r?"right":"left"),"center"===f?u=(s-c)/2:"right"===f&&(u=s-c),h.push({text:t.join(""),He:i,qe:l,Ye:u,ei:0,Je:!0,naturalWidth:c,Ke:!1}),h.length>1&&(h[h.length-2].Je=!1),h[h.length-1].Je=!0}else h.length>0&&(h[h.length-1].Je=!0)
348
- return h}}const At=new WeakMap
349
- class bt{static Ce(e,i,s=0){const n=Array.from(i)
392
+ return h}}const bt=new WeakMap
393
+ class Et{static Ce(e,i,s=0){const n=Array.from(i)
350
394
  if(0===n.length)return[]
351
395
  const r=new Map
352
396
  let o=0
@@ -366,9 +410,9 @@ const r=t(e.ni)
366
410
  e.hb.shape(e.font,n,r)
367
411
  const o=n.json(e.font),h=s*e.upem
368
412
  let a=0
369
- return o.forEach(t=>{a+=t.ax,0!==h&&(a+=h)}),n.destroy(),a}}class Et{constructor(t){this.oi=t}hi(t){const{text:e,width:i,align:s,direction:n,_e:r,language:o,Oe:h,Le:a,De:l,Ne:c,Pe:u,ke:f,$e:d,Ge:y,ze:p,Re:w,We:g,je:m,Ue:v,letterSpacing:x}=t
413
+ return o.forEach(t=>{a+=t.ax,0!==h&&(a+=h)}),n.destroy(),a}}class Tt{constructor(t){this.oi=t}hi(t){const{text:e,width:i,align:s,direction:n,_e:r,language:o,Oe:h,Be:a,De:l,Ne:c,Pe:u,ke:f,$e:d,Ge:y,Re:p,ze:w,We:g,je:m,Ue:v,letterSpacing:x}=t
370
414
  let A
371
- if(i)A=xt.Me({text:e,width:i,align:s,direction:n,_e:r,language:o,Oe:h,Le:a,De:l,Ne:c,Pe:u,ke:f,$e:d,Ge:y,ze:p,Re:w,We:g,je:m,Ue:v,Be:this.oi.upem,letterSpacing:x,measureText:t=>bt.measureTextWidth(this.oi,t,x),Ce:t=>bt.Ce(this.oi,t,x)})
415
+ if(i)A=At.Me({text:e,width:i,align:s,direction:n,_e:r,language:o,Oe:h,Be:a,De:l,Ne:c,Pe:u,ke:f,$e:d,Ge:y,Re:p,ze:w,We:g,je:m,Ue:v,Le:this.oi.upem,letterSpacing:x,measureText:t=>Et.measureTextWidth(this.oi,t,x),Ce:t=>Et.Ce(this.oi,t,x)})
372
416
  else{const t=e.split("\n")
373
417
  A=[]
374
418
  let i=0
@@ -377,17 +421,17 @@ if(0!==i)for(let e=0;t.length>e;e+=3)t[e]+=i
377
421
  return{offset:i,li:s}}ci(t){const{width:e,align:i,planeBounds:s}=t
378
422
  let n=0
379
423
  const r={min:{...s.min},max:{...s.max}}
380
- return!e||"center"!==i&&"right"!==i||(n="center"===i?(e-(s.max.x-s.min.x))/2-s.min.x:e-s.max.x),0!==n&&(r.min.x+=n,r.max.x+=n),{offset:n,li:r}}}const Tt=65536,It=1330926671,St=2001684038,Ft=2001684018,Mt=1751474532,_t=1751672161,Ot=1330851634,Ct=1719034226,kt=1398030676,Bt=1851878757,Lt=1128678944,Dt=1128678962,Nt=1196643650,Pt=1196445523,$t=new TextDecoder("utf-16be")
381
- class Gt{static ui(t){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
424
+ return!e||"center"!==i&&"right"!==i||(n="center"===i?(e-(s.max.x-s.min.x))/2-s.min.x:e-s.max.x),0!==n&&(r.min.x+=n,r.max.x+=n),{offset:n,li:r}}}const It=65536,St=1330926671,Ft=2001684038,Mt=2001684018,_t=1751474532,Ot=1751672161,Ct=1330851634,kt=1719034226,Lt=1398030676,Bt=1851878757,Dt=1128678944,Nt=1128678962,Pt=1196643650,$t=1196445523,Gt=new TextDecoder("utf-16be")
425
+ class Rt{static ui(t){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
382
426
  const i=new DataView(t),s=i.getUint32(0)
383
- if(![Tt,It].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
384
- const n=e(i),r=n.has(Lt)||n.has(Dt),o=n.get(Mt)?.offset??0,h=n.get(_t)?.offset??0,a=n.get(Ot)?.offset??0,l=n.get(Ct)?.offset??0,c=n.get(kt)?.offset??0,u=n.get(Bt)?.offset??0,f=o?i.getUint16(o+18):1e3
427
+ if(![It,St].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
428
+ const n=e(i),r=n.has(Dt)||n.has(Nt),o=n.get(_t)?.offset??0,h=n.get(Ot)?.offset??0,a=n.get(Ct)?.offset??0,l=n.get(kt)?.offset??0,c=n.get(Lt)?.offset??0,u=n.get(Bt)?.offset??0,f=o?i.getUint16(o+18):1e3
385
429
  let d=null
386
430
  h&&(d={fi:i.getInt16(h+4),di:i.getInt16(h+6),yi:i.getInt16(h+8)})
387
431
  let y=null
388
432
  a&&(y={pi:i.getInt16(a+68),wi:i.getInt16(a+70),gi:i.getInt16(a+72),mi:i.getUint16(a+74),xi:i.getUint16(a+76)})
389
433
  let p=null
390
- return l&&c&&u&&(p=this.Ai(i,c,u)),{bi:r,Be:f,Ei:d?.fi||null,Ti:d?.di||null,Ii:d?.yi||null,pi:y?.pi||null,wi:y?.wi||null,gi:y?.gi||null,mi:y?.mi||null,xi:y?.xi||null,Si:p}}static Fi(t){const i=new DataView(t),s=e(i),n=s.get(Nt)?.offset??0,r=s.get(Pt)?.offset??0,o=s.get(Bt)?.offset??0,h=new Set,a={}
434
+ return l&&c&&u&&(p=this.Ai(i,c,u)),{bi:r,Le:f,Ei:d?.fi||null,Ti:d?.di||null,Ii:d?.yi||null,pi:y?.pi||null,wi:y?.wi||null,gi:y?.gi||null,mi:y?.mi||null,xi:y?.xi||null,Si:p}}static Fi(t){const i=new DataView(t),s=e(i),n=s.get(Pt)?.offset??0,r=s.get($t)?.offset??0,o=s.get(Bt)?.offset??0,h=new Set,a={}
391
435
  try{if(n){const t=this.Mi(i,n,o)
392
436
  t.features.forEach(t=>h.add(t)),Object.assign(a,t.names)}if(r){const t=this.Mi(i,r,o)
393
437
  t.features.forEach(t=>h.add(t)),Object.assign(a,t.names)}}catch(t){return}const l=Array.from(h).sort()
@@ -408,23 +452,23 @@ if(0===o||3===o&&1===h){let t=""
408
452
  for(let e=0;f.length>e;e+=2)t+=String.fromCharCode(f[e]<<8|f[e+1])
409
453
  return t}return new TextDecoder("ascii").decode(f)}return null}catch(t){return null}}static Oi(t){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
410
454
  const i=new DataView(t),s=i.getUint32(0)
411
- if(![Tt,It].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
455
+ if(![It,St].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
412
456
  const n=e(i),r=n.get(Bt)?.offset??0,o=r?this.Ci(i,r):null
413
- return{rt:this.ki(i,n,o),features:this.Bi(i,n,o)}}static Ci(t,e){const i=new Map,s=t.getUint16(e+2),n=t.getUint16(e+4)
414
- for(let r=0;s>r;r++){const s=e+6+12*r,o=t.getUint16(s),h=t.getUint16(s+2),a=t.getUint16(s+4),l=t.getUint16(s+6),c=t.getUint16(s+8),u=t.getUint16(s+10);(0===o||3===o&&1033===a)&&(i.has(l)||i.set(l,{offset:e+n+u,length:c,Li:o,Di:h}))}return i}static Ni(t,e,i){if(!e)return null
457
+ return{rt:this.ki(i,n,o),features:this.Li(i,n,o)}}static Ci(t,e){const i=new Map,s=t.getUint16(e+2),n=t.getUint16(e+4)
458
+ for(let r=0;s>r;r++){const s=e+6+12*r,o=t.getUint16(s),h=t.getUint16(s+2),a=t.getUint16(s+4),l=t.getUint16(s+6),c=t.getUint16(s+8),u=t.getUint16(s+10);(0===o||3===o&&1033===a)&&(i.has(l)||i.set(l,{offset:e+n+u,length:c,Bi:o,Di:h}))}return i}static Ni(t,e,i){if(!e)return null
415
459
  const s=e.get(i)
416
460
  if(!s)return null
417
461
  try{const e=new Uint8Array(t.buffer,s.offset,s.length)
418
- return 0===s.Li||3===s.Li&&1===s.Di?$t.decode(e):new TextDecoder("ascii").decode(e)}catch{return null}}static ki(t,e,i){const s=e.has(Lt)||e.has(Dt),n=e.get(Mt)?.offset??0,r=e.get(_t)?.offset??0,o=e.get(Ot)?.offset??0,h=e.get(Ct)?.offset??0,a=e.get(kt)?.offset??0,l=n?t.getUint16(n+18):1e3
462
+ return 0===s.Bi||3===s.Bi&&1===s.Di?Gt.decode(e):new TextDecoder("ascii").decode(e)}catch{return null}}static ki(t,e,i){const s=e.has(Dt)||e.has(Nt),n=e.get(_t)?.offset??0,r=e.get(Ot)?.offset??0,o=e.get(Ct)?.offset??0,h=e.get(kt)?.offset??0,a=e.get(Lt)?.offset??0,l=n?t.getUint16(n+18):1e3
419
463
  let c=null
420
464
  r&&(c={fi:t.getInt16(r+4),di:t.getInt16(r+6),yi:t.getInt16(r+8)})
421
465
  let u=null
422
466
  o&&(u={pi:t.getInt16(o+68),wi:t.getInt16(o+70),gi:t.getInt16(o+72),mi:t.getUint16(o+74),xi:t.getUint16(o+76)})
423
467
  let f=null
424
- return h&&a&&i&&(f=this.Pi(t,a,i)),{bi:s,Be:l,Ei:c?.fi||null,Ti:c?.di||null,Ii:c?.yi||null,pi:u?.pi||null,wi:u?.wi||null,gi:u?.gi||null,mi:u?.mi||null,xi:u?.xi||null,Si:f}}static Pi(t,e,i){try{if(1>t.getUint16(e))return null
468
+ return h&&a&&i&&(f=this.Pi(t,a,i)),{bi:s,Le:l,Ei:c?.fi||null,Ti:c?.di||null,Ii:c?.yi||null,pi:u?.pi||null,wi:u?.wi||null,gi:u?.gi||null,mi:u?.mi||null,xi:u?.xi||null,Si:f}}static Pi(t,e,i){try{if(1>t.getUint16(e))return null
425
469
  const s=t.getUint16(e+4),n=t.getUint16(e+6),r=t.getUint32(e+8),o={}
426
470
  for(let h=0;n>h;h++){const n=e+r+h*s,a=String.fromCharCode(t.getUint8(n),t.getUint8(n+1),t.getUint8(n+2),t.getUint8(n+3)),l=t.getUint16(n+4),c=this.Ni(t,i,l)
427
- c&&(o[a]=c)}return Object.keys(o).length>0?o:null}catch{return null}}static Bi(t,e,i){const s=e.get(Nt)?.offset??0,n=e.get(Pt)?.offset??0,r=new Set,o={}
471
+ c&&(o[a]=c)}return Object.keys(o).length>0?o:null}catch{return null}}static Li(t,e,i){const s=e.get(Pt)?.offset??0,n=e.get($t)?.offset??0,r=new Set,o={}
428
472
  try{s&&this.$i(t,s,i,r,o),n&&this.$i(t,n,i,r,o)}catch{return}if(0===r.size)return
429
473
  const h=Array.from(r).sort((t,e)=>t-e)
430
474
  return{tags:h.map(this.Gi),names:Object.keys(o).length>0?o:{}}}static $i(t,e,i,s,n){const r=e+t.getUint16(e+6),o=t.getUint16(r)
@@ -440,12 +484,12 @@ if(0===f)continue
440
484
  const d=u+f
441
485
  if(0!==t.getUint16(d))continue
442
486
  const y=t.getUint16(d+2),p=this.Ni(t,i,y)
443
- p&&(n[String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,255&h)]=p)}}static Gi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}static zi(t){return null!==t.pi&&null!==t.wi?{fi:t.pi,di:t.wi,yi:0}:null!==t.Ei&&null!==t.Ti?{fi:t.Ei,di:t.Ti,yi:0}:null!==t.mi&&null!==t.xi?{fi:t.mi,di:-t.xi,yi:0}:{fi:Math.round(.8*t.Be),di:-Math.round(.2*t.Be),yi:0}}static Ri(t){const e=Gt.zi(t)
444
- return{fi:e.fi,di:e.di,yi:e.yi,Be:t.Be,Wi:e.fi-e.di}}}let zt=null
445
- class Rt{static ji(t){if(4>t.byteLength)return"ttf/otf"
487
+ p&&(n[String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,255&h)]=p)}}static Gi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}static Ri(t){return null!==t.pi&&null!==t.wi?{fi:t.pi,di:t.wi,yi:0}:null!==t.Ei&&null!==t.Ti?{fi:t.Ei,di:t.Ti,yi:0}:null!==t.mi&&null!==t.xi?{fi:t.mi,di:-t.xi,yi:0}:{fi:Math.round(.8*t.Le),di:-Math.round(.2*t.Le),yi:0}}static zi(t){const e=Rt.Ri(t)
488
+ return{fi:e.fi,di:e.di,yi:e.yi,Le:t.Le,Wi:e.fi-e.di}}}let zt=null
489
+ class Wt{static ji(t){if(4>t.byteLength)return"ttf/otf"
446
490
  const e=new DataView(t).getUint32(0)
447
- return e===St?"woff":e===Ft?"woff2":"ttf/otf"}static async Ui(t){const e=new DataView(t),i=new Uint8Array(t)
448
- if(e.getUint32(0)!==St)throw Error("Not a valid WOFF font")
491
+ return e===Ft?"woff":e===Mt?"woff2":"ttf/otf"}static async Ui(t){const e=new DataView(t),i=new Uint8Array(t)
492
+ if(e.getUint32(0)!==Ft)throw Error("Not a valid WOFF font")
449
493
  const s=e.getUint32(4),n=e.getUint16(12),r=e.getUint32(16)
450
494
  if("undefined"==typeof DecompressionStream)throw Error("WOFF fonts require DecompressionStream API (Chrome 80+, Firefox 113+, Safari 16.4+). Please use TTF/OTF fonts or upgrade your browser.")
451
495
  const o=new Uint8Array(r),h=new DataView(o.buffer)
@@ -457,144 +501,312 @@ const c=[]
457
501
  for(let t=0;n>t;t++){const i=44+20*t
458
502
  c.push({tag:e.getUint32(i),offset:e.getUint32(i+4),length:e.getUint32(i+8),Vi:e.getUint32(i+12),t:e.getUint32(i+16)})}c.sort((t,e)=>t.tag-e.tag)
459
503
  const u=await Promise.all(c.map(async t=>{if(t.length===t.Vi)return i.subarray(t.offset,t.offset+t.length)
460
- const e=i.subarray(t.offset,t.offset+t.length),s=await Rt.Hi(e)
504
+ const e=i.subarray(t.offset,t.offset+t.length),s=await Wt.Hi(e)
461
505
  if(s.byteLength!==t.Vi)throw Error(`Decompression failed: expected ${t.Vi} bytes, got ${s.byteLength}`)
462
506
  return new Uint8Array(s)}))
463
507
  for(let t=0;n>t;t++){const e=c[t],i=12+16*t
464
- h.setUint32(i,e.tag),h.setUint32(i+4,e.t),h.setUint32(i+8,l),h.setUint32(i+12,e.Vi),o.set(u[t],l),l+=e.Vi,l+=(4-e.Vi%4)%4}return o.buffer.slice(0,l)}static async qi(t){if(new DataView(t).getUint32(0)!==Ft)throw Error("Not a valid WOFF2 font")
508
+ h.setUint32(i,e.tag),h.setUint32(i+4,e.t),h.setUint32(i+8,l),h.setUint32(i+12,e.Vi),o.set(u[t],l),l+=e.Vi,l+=(4-e.Vi%4)%4}return o.buffer.slice(0,l)}static async qi(t){if(new DataView(t).getUint32(0)!==Mt)throw Error("Not a valid WOFF2 font")
465
509
  if(!zt)throw Error("WOFF2 fonts require enabling the decoder. Add to your code:\n import { woff2Decode } from 'woff-lib/woff2/decode';\n Text.enableWoff2(woff2Decode);")
466
510
  return(await zt(t)).buffer}static async Hi(t){const e=new ReadableStream({start(e){e.enqueue(t),e.close()}}).pipeThrough(new DecompressionStream("deflate"))
467
- return new Response(e).arrayBuffer()}}class Wt{constructor(t){this.Yi=t}async Ji(t,e){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
468
- const i=Rt.ji(t)
469
- "woff"===i?t=await Rt.Ui(t):"woff2"===i&&(t=await Rt.qi(t))
511
+ return new Response(e).arrayBuffer()}}class jt{constructor(t){this.Yi=t}async Ji(t,e){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
512
+ const i=Wt.ji(t)
513
+ "woff"===i?t=await Wt.Ui(t):"woff2"===i&&(t=await Wt.qi(t))
470
514
  const s=new DataView(t).getUint32(0)
471
- if(![Tt,It].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
515
+ if(![It,St].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
472
516
  const{hb:n,module:r}=await this.Yi()
473
517
  try{const i=n.Ki(new Uint8Array(t)),s=n.Xi(i,0),o=n.Qi(s)
474
518
  e&&o.Zi(e)
475
- const h=s.ts(),a=Object.keys(h).length>0,{rt:l,features:c}=Gt.Oi(t)
519
+ const h=s.ts(),a=Object.keys(h).length>0,{rt:l,features:c}=Rt.Oi(t)
476
520
  let u
477
521
  if(a&&h){u={}
478
- for(const[t,e]of Object.entries(h))u[t]={...e,name:l.Si?.[t]||null}}return{hb:n,fontBlob:i,face:s,font:o,module:r,upem:l.Be,rt:l,es:e,ss:a,ns:u,rs:c?.tags,hs:c?.names,ls:t}}catch(t){throw st.error("Failed to load font:",t),t}}static cs(t){try{t.font&&"function"==typeof t.font.destroy&&t.font.destroy(),t.face&&"function"==typeof t.face.destroy&&t.face.destroy(),t.fontBlob&&"function"==typeof t.fontBlob.destroy&&t.fontBlob.destroy()}catch(t){st.error("Error destroying font resources:",t)}}}const jt=/^[a-z]{2,3}(?:-[a-z0-9]{2,16})*$/i,Ut=new Set(["af","as","be","bg","bn","ca","cs","cy","da","de-1996","el-monoton","el-polyton","en-gb","en-us","eo","es","et","eu","fi","fr","fur","ga","gl","gu","hi","hr","hsb","hu","hy","ia","id","is","it","ka","kmr","kn","la","lt","lv","mk","ml","mn-cyrl","mr","mul-ethi","nb","nl","nn","oc","or","pa","pl","pms","pt","rm","ro","ru","sa","sh-cyrl","sh-latn","sk","sl","sq","sr-cyrl","sv","ta","te","th","tk","tr","uk","zh-latn-pinyin"])
479
- class Vt{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}clone(){return new Vt(this.x,this.y)}us(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t,this.y*=t,this}fs(t){return this.x/=t,this.y/=t,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}ds(){return this.x*this.x+this.y*this.y}normalize(){const t=this.length()
522
+ for(const[t,e]of Object.entries(h))u[t]={...e,name:l.Si?.[t]||null}}return{hb:n,fontBlob:i,face:s,font:o,module:r,upem:l.Le,rt:l,es:e,ss:a,ns:u,rs:c?.tags,hs:c?.names,ls:t}}catch(t){throw nt.error("Failed to load font:",t),t}}static cs(t){try{t.font&&"function"==typeof t.font.destroy&&t.font.destroy(),t.face&&"function"==typeof t.face.destroy&&t.face.destroy(),t.fontBlob&&"function"==typeof t.fontBlob.destroy&&t.fontBlob.destroy()}catch(t){nt.error("Error destroying font resources:",t)}}}const Ut=/^[a-z]{2,3}(?:-[a-z0-9]{2,16})*$/i,Vt=new Set(["af","as","be","bg","bn","ca","cy","da","de-1996","el-monoton","el-polyton","en-gb","en-us","eo","es","et","eu","fi","fr","fur","ga","gl","gu","hi","hr","hsb","hu","hy","ia","is","it","ka","kmr","kn","la","lt","lv","ml","mn-cyrl","mr","mul-ethi","nb","nl","nn","oc","or","pa","pl","pms","pt","rm","ro","ru","sa","sh-cyrl","sh-latn","sk","sl","sq","sv","ta","te","th","tk","tr","uk","zh-latn-pinyin"])
523
+ class Ht{constructor(t=0,e=0){this.x=t,this.y=e}set(t,e){return this.x=t,this.y=e,this}clone(){return new Ht(this.x,this.y)}us(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}sub(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t,this.y*=t,this}fs(t){return this.x/=t,this.y/=t,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}ds(){return this.x*this.x+this.y*this.y}normalize(){const t=this.length()
480
524
  return t>0&&this.fs(t),this}ys(t){return this.x*t.x+this.y*t.y}ps(t){const e=this.x-t.x,i=this.y-t.y
481
525
  return Math.sqrt(e*e+i*i)}ws(t){const e=this.x-t.x,i=this.y-t.y
482
- return e*e+i*i}equals(t){return this.x===t.x&&this.y===t.y}angle(){return Math.atan2(this.y,this.x)}}class Ht{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}clone(){return new Ht(this.x,this.y,this.z)}us(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}multiply(t){return this.x*=t,this.y*=t,this.z*=t,this}fs(t){return this.x/=t,this.y/=t,this.z/=t,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}ds(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){const t=this.length()
526
+ return e*e+i*i}equals(t){return this.x===t.x&&this.y===t.y}angle(){return Math.atan2(this.y,this.x)}}class qt{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return this.x=t,this.y=e,this.z=i,this}clone(){return new qt(this.x,this.y,this.z)}us(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}multiply(t){return this.x*=t,this.y*=t,this.z*=t,this}fs(t){return this.x/=t,this.y/=t,this.z/=t,this}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}ds(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){const t=this.length()
483
527
  return t>0&&this.fs(t),this}ys(t){return this.x*t.x+this.y*t.y+this.z*t.z}gs(t){const e=this.z*t.x-this.x*t.z,i=this.x*t.y-this.y*t.x
484
528
  return this.x=this.y*t.z-this.z*t.y,this.y=e,this.z=i,this}ps(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z
485
529
  return Math.sqrt(e*e+i*i+s*s)}ws(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z
486
- return e*e+i*i+s*s}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}}class qt{constructor(){this.cache=new Map}get(t){return this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){this.cache.set(t,e)}delete(t){return this.cache.delete(t)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return Array.from(this.cache.keys())}getStats(){return{size:this.cache.size}}}const Yt=new qt,Jt=new qt,Kt=new qt,Xt=new qt
487
- var Qt,Zt,te,ee;(t=>{t[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Qt||(Qt={})),(t=>{t[t.X=0]="POLYGONS",t[t.J=1]="CONNECTED_POLYGONS",t[t.$=2]="BOUNDARY_CONTOURS"})(Zt||(Zt={})),(t=>{t[t.BEGIN=100100]="BEGIN",t[t.EDGE_FLAG=100104]="EDGE_FLAG",t[t.VERTEX=100101]="VERTEX",t[t.END=100102]="END",t[t.ERROR=100103]="ERROR",t[t.COMBINE=100105]="COMBINE",t[t.BEGIN_DATA=100106]="BEGIN_DATA",t[t.EDGE_FLAG_DATA=100110]="EDGE_FLAG_DATA",t[t.VERTEX_DATA=100107]="VERTEX_DATA",t[t.END_DATA=100108]="END_DATA",t[t.ERROR_DATA=100109]="ERROR_DATA",t[t.COMBINE_DATA=100111]="COMBINE_DATA",t[t.WINDING_RULE=100140]="WINDING_RULE",t[t.BOUNDARY_ONLY=100141]="BOUNDARY_ONLY",t[t.TOLERANCE=100142]="TOLERANCE"})(te||(te={})),(t=>{t[t.vs=100151]="MISSING_BEGIN_POLYGON",t[t.xs=100152]="MISSING_BEGIN_CONTOUR",t[t.As=100153]="MISSING_END_POLYGON",t[t.bs=100154]="MISSING_END_CONTOUR",t[t.Es=100155]="COORD_TOO_LARGE",t[t.Ts=100156]="NEED_COMBINE_CALLBACK"})(ee||(ee={}))
488
- class ie{next
489
- u
490
- l=null
530
+ return e*e+i*i+s*s}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}}class Yt{constructor(t){this.vs=new Map,this.oi=t}xs(t,e,i,s,n,r,o){try{const r=[]
531
+ return t.forEach((t,o)=>{const h=this.As(t,o,e,i,s,n)
532
+ r.push(h)}),r}finally{}}As(e,i,s,n,r,o){const h=this.oi.hb.createBuffer()
533
+ "rtl"===o&&h.bs("rtl"),h.ii(e.text),h.si()
534
+ const a=t(this.oi.ni)
535
+ this.oi.hb.shape(this.oi.font,h,a)
536
+ const l=h.json(this.oi.font)
537
+ h.destroy()
538
+ const c=[]
539
+ let u=[],f=[],d=0,y=0,p=e.Ye,w=-i*s
540
+ const g=n*this.oi.upem,m=this.Es(e,r,n),v=this.Ts(e,r),x=e.text,A=x.length,b=l.length
541
+ let E
542
+ for(let t=0;b>t;t++){const s=l[t],n=s.ri,r=x[n],o=r.charCodeAt(0),h=32===o||9===o||10===o||13===o
543
+ s.Is=e.Ke&&n===A-1&&"-"===r?e.qe:e.He+n,s.Ss=i,h&&u.length>0&&(c.push({text:f.join(""),glyphs:u,position:new qt(d,y,0)}),u=[],f=[])
544
+ const a=p+s.dx,T=w+s.dy
545
+ if(h||(0===u.length&&(d=a,y=T),s.x=a-d,s.y=T-y,u.push(s),f.push(r)),p+=s.ax,w+=s.ay,0!==g&&b-1>t&&(p+=g),h&&(p+=m),0!==v&&b-1>t&&!h){const e=x[l[t+1].ri],i=void 0!==E?E:At.fe(r)
546
+ if(E=!!e&&At.fe(e),i&&E){let t=!0
547
+ At.de(e)&&(t=!1),At.ye(r)&&(t=!1),At.pe(r)&&At.pe(e)&&(t=!1),t&&(p+=v)}}else E=void 0}return u.length>0&&c.push({text:f.join(""),glyphs:u,position:new qt(d,y,0)}),c}Es(t,e,i){let s=0
548
+ if(void 0!==t.ei&&"justify"===e&&!t.Je){let e=this.vs.get(i)
549
+ void 0===e&&(e=Et.measureTextWidth(this.oi," ",i),this.vs.set(i,e)),t.ei>0?s=t.ei*e*.5:0>t.ei&&(s=t.ei*e*at)}return s}Ts(t,e){if(void 0===t.ei||"justify"!==e||t.Je)return 0
550
+ return t.ei>0||0>t.ei?.04*t.ei*this.oi.upem:0}}var Jt={exports:{}},Kt=r(Object.freeze({__proto__:null,default:{},o(...t){const e="undefined"!=typeof globalThis?globalThis.require:void 0
551
+ if("function"==typeof e)return e("fs").o(...t)
552
+ throw Error("fs not available in this environment")}}))
553
+ !(function(t){var e,i=(e="undefined"!=typeof document?document.currentScript?.src:void 0,async function(t={}){function i(){var t=g.buffer
554
+ n.HEAP8=new Int8Array(t),n.HEAPU8=m=new Uint8Array(t),n.HEAP32=new Int32Array(t),n.HEAPU32=new Uint32Array(t),n.HEAPF32=new Float32Array(t),new BigInt64Array(t),new BigUint64Array(t)}function s(t){n.Fs?.(t),x(t="Aborted("+t+")"),A=!0,t+=". Build with -sASSERTIONS for more info."
555
+ var e=new WebAssembly.RuntimeError(t)
556
+ throw w?.(e),e}var n=t,r="object"==typeof window,o="undefined"!=typeof WorkerGlobalScope,h="object"==typeof process&&process.versions?.node&&"renderer"!=process.type,a=(t,e)=>{throw e}
557
+ "undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href)
558
+ var l,c,u=""
559
+ if(h){var f=Kt
560
+ u="undefined"!=typeof __dirname?__dirname+"/":"",c=t=>(t=b(t)?new URL(t):t,f.o(t)),l=async(t,e=!0)=>(t=b(t)?new URL(t):t,f.o(t,e?void 0:"utf8")),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),a=(t,e)=>{throw process.exitCode=t,e}}else if(r||o){try{u=new URL(".",e).href}catch{}o&&(c=t=>{var e=new XMLHttpRequest
561
+ return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=async t=>{if(b(t))return new Promise((e,i)=>{var s=new XMLHttpRequest
562
+ s.open("GET",t,!0),s.responseType="arraybuffer",s.onload=()=>{200==s.status||0==s.status&&s.response?e(s.response):i(s.status)},s.onerror=i,s.send(null)})
563
+ var e=await fetch(t,{credentials:"same-origin"})
564
+ if(e.ok)return e.arrayBuffer()
565
+ throw Error(e.status+" : "+e.url)}}console.log.bind(console)
566
+ var d,y,p,w,g,m,v,x=console.error.bind(console),A=!1,b=t=>t.startsWith("file://"),E=!1,T=0,I=null
567
+ class S{name="ExitStatus"
568
+ constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var F,M,_,O=t=>{for(;t.length>0;)t.shift()(n)},C=[],k=t=>C.push(t),L=[],B=t=>L.push(t),D=!0,N=0,P={},$=t=>{if(t instanceof S||"unwind"==t)return y
569
+ a(1,t)},G=()=>D||N>0,R=t=>{y=t,G()||(n.Ms?.(t),A=!0),a(t,new S(t))},z=(t,e)=>Math.ceil(t/e)*e,W=t=>{var e=(t-g.buffer.byteLength+65535)/65536|0
570
+ try{return g.grow(e),i(),1}catch(t){}},j=t=>{const e=t.length
571
+ return[e%128|128,e>>7,...t]},U={u:127,q:127,it:126,f:125,d:124,e:111},V=t=>j(Array.from(t,t=>U[t])),H=t=>F.get(t),q=[],Y=(t,e)=>F.set(t,e)
572
+ n._s&&(D=n._s),n.Os&&(x=n.Os),n.Cs&&(d=n.Cs),n.ks=g,n.Ls=K,n.Bs=(t,e)=>{var i=(t=>(M||(M=new WeakMap,((t,e)=>{if(M)for(var i=0;0+e>i;i++){var s=H(i)
573
+ s&&M.set(s,i)}})(0,F.length)),M.get(t)||0))(t)
574
+ if(i)return i
575
+ var s=q.length?q.pop():F.grow(1)
576
+ try{Y(s,t)}catch(i){if(!(i instanceof TypeError))throw i
577
+ var n=((t,e)=>{var i=Uint8Array.of(0,97,115,109,1,0,0,0,1,...j([1,96,...V(e.slice(1)),...V("v"===e[0]?"":e[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),s=new WebAssembly.Module(i)
578
+ return new WebAssembly.Instance(s,{e:{f:t}}).exports.f})(t,e)
579
+ Y(s,n)}return M.set(t,s),s},n.Ds=t=>{M.delete(H(t)),Y(t,null),q.push(t)}
580
+ var J={Ns:()=>s(""),Ps(){D=!1,N=0},$s(t,e){if(P[t]&&(clearTimeout(P[t].id),delete P[t]),!e)return 0
581
+ var i=setTimeout(()=>{delete P[t],(t=>{if(!A)try{t(),(()=>{if(!G())try{y=t=y,R(t)}catch(t){$(t)}var t})()}catch(t){$(t)}})(()=>_(t,performance.now()))},e)
582
+ return P[t]={id:i,Gs:e},0},Rs(t){var e=m.length,i=2147483648
583
+ if((t>>>=0)>i)return!1
584
+ for(var s=1;4>=s;s*=2){var n=e*(1+.2/s),r=Math.min(i,z(Math.max(t,n=Math.min(n,t+100663296)),65536))
585
+ if(W(r))return!0}return!1},zs:R},K=await(async()=>{function t(t){return n.Ls=K=t.exports,n.ks=g=K.memory,i(),F=K.Ws,(t=>{n.js=t.Us,n.Vs=t.Hs,n.qs=t.Ys,n.Js=t.Ks,n.Xs=t.Qs,n.Zs=t.tn,n.en=t.sn,n.nn=t.rn,n.hn=t.an,n.ln=t.cn,n.un=t.fn,n.dn=t.yn,n.pn=t.wn,n.gn=t.mn,n.vn=t.xn,n.An=t.bn,n.En=t.Tn,n.In=t.Sn,n.Fn=t.Mn,n._n=t.On,n.Cn=t.kn,n.Ln=t.Bn,n.Dn=t.Nn,n.Pn=t.$n,n.Gn=t.Rn,n.zn=t.Wn,n.jn=t.Un,n.Vn=t.Hn,n.qn=t.Yn,n.Jn=t.Kn,n.Xn=t.Qn,n.Zn=t.tr,n.er=t.ir,n.sr=t.nr,n.rr=t.hr,n.ar=t.lr,n.cr=t.ur,n.dr=t.yr,n.pr=t.wr,n.gr=t.mr,n.vr=t.Ar,n.br=t.Er,n.Tr=t.Ir,n.Sr=t.Fr,n.Mr=t._r,n.Or=t.Cr,n.kr=t.Lr,n.Br=t.Dr,n.Nr=t.Pr,n.$r=t.Gr,n.Rr=t.zr,n.Wr=t.jr,_=t.Ur})(K),(()=>{if(T--,n.Vr?.(T),0==T&&I){var t=I
586
+ I=null,t()}})(),K}T++,n.Vr?.(T)
587
+ var e,r={nt:J,Hr:J}
588
+ return n.qr?new Promise(e=>{n.qr(r,i=>{e(t(i))})}):(v??=(e="hb.wasm",n.Yr?n.Yr(e,u):u+e),t((await(async function(t,e,i){if(!t&&!b(e)&&!h)try{var n=fetch(e,{credentials:"same-origin"})
589
+ return await WebAssembly.instantiateStreaming(n,i)}catch(t){x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation")}return(async(t,e)=>{try{var i=await(async t=>{if(!d)try{var e=await l(t)
590
+ return new Uint8Array(e)}catch{}return(t=>{if(t==v&&d)return new Uint8Array(d)
591
+ if(c)return c(t)
592
+ throw"both async and sync fetching of the wasm failed"})(t)})(t)
593
+ return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,v,r)).Jr))})()
594
+ return(()=>{if(n.Kr)for("function"==typeof n.Kr&&(n.Kr=[n.Kr]);n.Kr.length>0;)n.Kr.shift()()})(),(function t(){function e(){n.Xr=!0,A||(E=!0,K.Qr(),p?.(n),n.Zr?.(),(()=>{if(n.eo)for("function"==typeof n.eo&&(n.eo=[n.eo]);n.eo.length;)k(n.eo.shift())
595
+ O(C)})())}T>0?I=t:((()=>{if(n.io)for("function"==typeof n.io&&(n.io=[n.io]);n.io.length;)B(n.io.shift())
596
+ O(L)})(),T>0?I=t:n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e())})(),E?n:new Promise((t,e)=>{p=t,w=e})})
597
+ t.exports=i,t.exports.default=i})(Jt)
598
+ var Xt=n(Jt.exports),Qt={exports:{}}
599
+ try{Qt.exports=t=>{function e(t){return(255&t.charCodeAt(0))<<24|(255&t.charCodeAt(1))<<16|(255&t.charCodeAt(2))<<8|255&t.charCodeAt(3)}function i(e){var i=n.Un(e.length+1)
600
+ for(let s=0;e.length>s;++s){const n=e.charCodeAt(s)
601
+ if(n>127)throw Error("Expected ASCII text")
602
+ t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{so:i,length:e.length,Hn(){n.Hn(i)}}}function s(t,e,s){var r=0,o=0
603
+ s&&(s=s.split(","),r=n.Un(16*s.length),s.forEach(t=>{var e=i(t)
604
+ n.Wn(e.so,-1,r+16*o)&&o++,e.Hn()})),n.jr(t.so,e.so,r,o),r&&n.Hn(r)}var n=t.Ls,r=new TextDecoder("utf8")
605
+ let o=t.Bs,h=t.Ds
606
+ var a=o(t=>{n.Hn(t)},"vi"),l=e("JSON"),c="",u=n.Un(256)
607
+ return{Ki(e){var i=n.Un(e.byteLength)
608
+ t.HEAPU8.set(new Uint8Array(e),i)
609
+ var s=n.Us(i,e.byteLength,2,i,a)
610
+ return{so:s,destroy(){n.Hs(s)}}},Xi(i,s){var r=n.lr(i.so,s)
611
+ const o=n.wr(r)
612
+ return{so:r,upem:o,no(i){var s=n.yr(r,e(i)),o=n.Ys(s)
613
+ if(o){var h=n.Ks(s,null)
614
+ return t.HEAPU8.subarray(h,h+o)}},ts(){var e=n.Un(2048),i=n.Un(4)
615
+ t.HEAPU32[i/4]=64,n.Pr(r,0,i,e)
616
+ var s={}
617
+ return Array.from({length:t.HEAPU32[i/4]}).forEach((i,n)=>{var r
618
+ s[(r=t.HEAPU32[e/4+8*n+1],""+String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(255&r))]={min:t.HEAPF32[e/4+8*n+4],default:t.HEAPF32[e/4+8*n+5],max:t.HEAPF32[e/4+8*n+6]}}),n.Hn(i),n.Hn(e),s},ro(){var e=n.Lr()
619
+ n.mr(r,e)
620
+ var i=(e=>{const i=n.Gr(e),s=n.Un(i<<2),r=s>>2,o=t.HEAPU32.subarray(r,r+i)
621
+ return t.HEAPU32.set(o,r),n.zr(e,-1,s,i),o})(e)
622
+ return n.Dr(e),i},destroy(){n.ur(r)}}},Qi(i){function s(t){return l||(f=o((t,e,i,s,n)=>{c+=`M${s},${n}`},"viiiffi"),d=o((t,e,i,s,n)=>{c+=`L${s},${n}`},"viiiffi"),y=o((t,e,i,s,n,r,o,h,a)=>{c+=`C${s},${n} ${r},${o} ${h},${a}`},"viiiffffffi"),p=o((t,e,i,s,n,r,o)=>{c+=`Q${s},${n} ${r},${o}`},"viiiffffi"),w=o(()=>{c+="Z"},"viiii"),l=n.nr(),n.Yn(l,f,0,0),n.Kn(l,d,0,0),n.tr(l,y,0,0),n.Qn(l,p,0,0),n.ir(l,w,0,0)),c="",n.Ar(a,t,l,0),c}var a=n.Ir(i.so),l=null,f=null,d=null,y=null,p=null,w=null
623
+ return{so:a,oo(e){n.Er(a,e,u,256)
624
+ var i=t.HEAPU8.subarray(u,u+256)
625
+ return r.decode(i.slice(0,i.indexOf(0)))},ho:s,ao:t=>s(t).replace(/([MLQCZ])/g,"|$1 ").split("|").filter(t=>t.length).map(t=>{var e=t.split(/[ ,]/g)
626
+ return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){n.Cr(a,t,e)},Zi(i){var s=Object.entries(i),r=n.Un(8*s.length)
627
+ s.forEach((i,s)=>{t.HEAPU32[r/4+2*s+0]=e(i[0]),t.HEAPF32[r/4+2*s+1]=i[1]}),n.Fr(a,r,s.length),n.Hn(r)},destroy(){n._r(a),l&&(n.hr(l),l=null,h(f),h(d),h(y),h(p),h(w))}}},createBuffer(){var e=n.tn()
628
+ return{so:e,ii(i){const s=(e=>{const i=n.Un(2*e.length),s=new Uint16Array(t.ks.buffer,i,e.length)
629
+ for(let t=0;s.length>t;++t)s[t]=e.charCodeAt(t)
630
+ return{so:i,length:s.length,Hn(){n.Hn(i)}}})(i)
631
+ n.On(e,s.so,s.length,0,s.length),s.Hn()},si:()=>n.Sn(e),bs(t){n.an(e,{lo:4,co:5,uo:6,fo:7}[t]||0)},do(t){var i=0
632
+ t.forEach(t=>{i|=(t=>"BOT"==t?1:"EOT"==t?2:"PRESERVE_DEFAULT_IGNORABLES"==t?4:"REMOVE_DEFAULT_IGNORABLES"==t?8:"DO_NOT_INSERT_DOTTED_CIRCLE"==t?16:"PRODUCE_UNSAFE_TO_CONCAT"==t?64:0)(t)}),n.yn(e,i)},yo(t){var s=i(t)
633
+ n.fn(e,n.Bn(s.so,-1)),s.Hn()},po(t){var s=i(t)
634
+ n.cn(e,n.Nn(s.so,-1)),s.Hn()},wo(t){n.wn(e,t)},json(){for(var i=n.mn(e),s=[],r=n.xn(e,0),o=r/4,h=n.bn(e,0)/4,a=t.HEAPU32.subarray(o,o+5*i),l=t.HEAP32.subarray(h,h+5*i),c=0;i>c;++c)s.push({g:a[5*c+0],ri:a[5*c+2],ax:l[5*c+0],ay:l[5*c+1],dx:l[5*c+2],dy:l[5*c+3],flags:n.Tn(r+20*c)})
635
+ return s},destroy(){n.sn(e)}}},shape:s,mo(e,i,a,c,u){var f=[],d=0,y=!1,p=1048576,w=n.Un(p),g=o((e,i,s)=>{var o=r.decode(t.HEAPU8.subarray(s,t.HEAPU8.indexOf(0,s)))
636
+ return o.startsWith("start table GSUB")?d=1:o.startsWith("start table GPOS")&&(d=2),d!=u&&(y=!1),0!=u&&d==u&&o.startsWith("end lookup "+c)&&(y=!0),y?0:(n.Qs(e,0,n.mn(e),w,p,0,i,l,4),f.push({tt:o,l:JSON.parse(r.decode(t.HEAPU8.subarray(w,t.HEAPU8.indexOf(0,w)))),glyphs:2==n.rn(e)}),1)},"iiiii")
637
+ return n.kn(i.so,g,0,0),s(e,i,a),n.Hn(w),h(g),f},version(){var e=n.Un(12)
638
+ n.$n(e,e+4,e+8)
639
+ var i={vo:t.HEAPU32[e/4],xo:t.HEAPU32[(e+4)/4],Ao:t.HEAPU32[(e+8)/4]}
640
+ return n.Hn(e),i},bo(){var e=n.Rn()
641
+ return r.decode(t.HEAPU8.subarray(e,t.HEAPU8.indexOf(0,e)))}}}}catch(c){}var Zt=n(Qt.exports)
642
+ let te=null,ee=null,ie=null
643
+ const se={Eo(t){ee=t,ie=null,te=null},To(t){ie=t,ee=null,te=null},Io:async()=>te||(te=new Promise(async(t,e)=>{try{const e={}
644
+ if(ie)e.Cs=ie
645
+ else{if(!ee)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
646
+ e.Cs=await s(ee)}const i=await Xt(e)
647
+ t({hb:Zt(i),module:{Bs:i.Bs,exports:i.Ls,Ds:i.Ds}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),te)},ne=72
648
+ class re{static{this.So=new Map}static{this.Fo=null}static{this.Mo=new Map}static{this._o=0}static{this.Oo=1/0}static{this.Co=0}static ko(t){(t=>{zt=t})(t)}static Lo(t){const e=Object.keys(t).sort()
649
+ let i=""
650
+ for(let s=0;e.length>s;s++)s>0&&(i+=","),i+=e[s]+":"+t[e[s]]
651
+ return i}constructor(){this.Bo="",re.Fo||(re.Fo=se.Io()),this.Do=new jt(()=>re.Fo)}static No(t){se.Eo(t),re.Fo=null}static Po(t){se.To(t),re.Fo=null}static init(){return re.Fo||(re.Fo=se.Io()),re.Fo}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
652
+ re.Fo||(re.Fo=se.Io())
653
+ const e=await re.$o(t),i=new re
654
+ i.Go(e)
655
+ const s=await i.Ro(t),n=async e=>{const s={...t}
656
+ for(const t in e){const i=e[t]
657
+ void 0!==i&&(s[t]=i)}if(void 0!==e.font||void 0!==e.es||void 0!==e.ni){const t=await re.$o(s)
658
+ i.Go(t),i.zo()}return t=s,{...await i.Ro(t),getLoadedFont(){return i.getLoadedFont()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n,dispose(){return i.destroy()}}}
659
+ return{...s,getLoadedFont(){return i.getLoadedFont()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n,dispose(){return i.destroy()}}}static async $o(t){let e="string"==typeof t.font?t.font:"buffer-"+re.Wo(t.font)
660
+ t.es&&(e+="_var_"+re.Lo(t.es)),t.ni&&(e+="_feat_"+re.Lo(t.ni))
661
+ let i=re.Mo.get(e)
662
+ return i||(i=await re.jo(e,t.font,t.es,t.ni)),i}static async jo(t,e,i,s){const n=new re
663
+ await n.Ji(e,i,s)
664
+ const r=n.getLoadedFont()
665
+ return re.Mo.set(t,r),re.Uo(r),re.Vo(),r}static Uo(t){re._o+=t.ls?.byteLength??0}static Ho(t){const e=re.Mo.get(t)
666
+ e&&(re._o-=e.ls?.byteLength??0,0>re._o&&(re._o=0))}static Vo(){if(re.Oo!==1/0)for(;re._o>re.Oo&&re.Mo.size>0;){const t=re.Mo.keys().next().value
667
+ if(void 0===t)break
668
+ re.Ho(t),re.Mo.delete(t)}}static Wo(t){if(t){const e=new Uint8Array(t)
669
+ let i=2166136261
670
+ const s=Math.min(32,e.length),n=Math.floor(e.length/s)
671
+ for(let t=0;s>t;t++)i^=e[t*n],i=Math.imul(i,16777619)
672
+ return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++re.Co}Go(t){this.oi=t
673
+ const e=re.Wo(t.ls)
674
+ this.Bo="font_"+e,t.es&&(this.Bo+="_var_"+re.Lo(t.es)),t.ni&&(this.Bo+="_feat_"+re.Lo(t.ni))}async Ji(t,e,i){re.Fo||(re.Fo=se.Io()),await re.Fo
675
+ const n="string"==typeof t?await s(t):t
676
+ try{this.oi&&this.destroy(),this.oi=await this.Do.Ji(n,e),i&&(this.oi.ni=i)
677
+ const t=re.Wo(n)
678
+ this.Bo="font_"+t,e&&(this.Bo+="_var_"+re.Lo(e)),i&&(this.Bo+="_feat_"+re.Lo(i))}catch(t){throw nt.error("Failed to load font:",t),t}}async Ro(t){try{if(!this.oi)throw Error("Font not loaded. Use Text.create() with a font option.")
679
+ const e=await this.qo(t)
680
+ this.Yo(e),this.Jo(t=e),this.oi.font.setScale(this.oi.upem,this.oi.upem),this.Ko||(this.Ko=new Yt(this.oi))
681
+ const i=this.Xo(t)
682
+ return{Qo:this.Ko.xs(i.lines,i.Zo,i.letterSpacing,i.align,i.direction,t.color,t.text),th:i,options:t,oi:this.oi,eh:this.Bo}}finally{}}async qo(t){if(!1!==t.layout?._e&&t.layout?.width){const e=t.layout?.language||"en-us"
683
+ if(!t.layout?.ke?.[e])try{if(!re.So.has(e)){const s=await i(e,t.layout?.ih)
684
+ re.So.set(e,s)}return{...t,layout:{...t.layout,ke:{...t.layout?.ke,[e]:re.So.get(e)}}}}catch(i){return nt.warn(`Failed to load patterns for ${e}: ${i}`),{...t,layout:{...t.layout,_e:!1}}}}return t}Yo(t){if(!t.text)throw Error("Text content is required")
685
+ const e=t.sh??1e5
686
+ if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}Jo(t){t.es&&this.oi&&re.Lo(t.es)!==re.Lo(this.oi.es||{})&&(this.oi.font.Zi(t.es),this.oi.es=t.es)}Xo(t){if(!this.oi)throw Error("Font not loaded. Use Text.create() with a font option")
687
+ const{text:e,size:i=ne,depth:s=0,lineHeight:n=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:l=("rtl"===a?"right":"left"),Oe:c=!0,_e:u=!0,language:f="en-us",Be:d=rt,De:y=ot,Ne:p=ht,Pe:w,ke:g,$e:m,Ge:v,Re:x,ze:A,We:b,je:E,Ue:T}=o,I=this.oi.upem/i
688
+ let S
689
+ void 0!==h&&(S=h*I)
690
+ const F=s*I,M=F>0?Math.max(F,25e-6*this.oi.upem):0
691
+ this.nh||(this.nh=new Tt(this.oi))
692
+ const _=this.nh.hi({text:e,width:S,align:l,direction:a,_e:u,language:f,Oe:c,Be:d,De:y,Ne:p,Pe:w,ke:g,$e:m,Ge:v,Re:x,ze:A,We:b,je:E,Ue:T,letterSpacing:r}),O=Rt.Ri(this.oi.rt)
693
+ return{lines:_.lines,Zo:(O.fi-O.di)*n,letterSpacing:r,align:l,direction:a,depth:M,size:i,rh:1/I}}zi(){if(!this.oi)throw Error("Font not loaded. Call loadFont() first")
694
+ return Rt.zi(this.oi.rt)}static async oh(t,e){await Promise.all(t.map(async t=>{if(!re.So.has(t))try{const s=await i(t,e)
695
+ re.So.set(t,s)}catch(e){nt.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static hh(t,e){re.So.set(t,e)}static ah(t){re.Oo=t===1/0?1/0:1048576*Math.max(1,Math.floor(t)),re.Vo()}getLoadedFont(){return this.oi}measureTextWidth(t,e=0){if(!this.oi)throw Error("Font not loaded. Call loadFont() first")
696
+ return Et.measureTextWidth(this.oi,t,e)}zo(){this.Ko=void 0,this.nh=void 0}destroy(){if(!this.oi)return
697
+ const t=this.oi
698
+ try{jt.cs(t)}catch(t){nt.warn("Error destroying HarfBuzz objects:",t)}finally{this.oi=void 0,this.nh=void 0,this.Ko=void 0}}}class oe{constructor(){this.cache=new Map}get(t){return this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){this.cache.set(t,e)}delete(t){return this.cache.delete(t)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return Array.from(this.cache.keys())}getStats(){return{size:this.cache.size}}}const he=new oe,ae=new oe,le=new oe,ce=new oe,ue=new oe
699
+ var fe,de,ye,pe;(t=>{t[t.ODD=0]="ODD",t[t.NONZERO=1]="NONZERO",t[t.POSITIVE=2]="POSITIVE",t[t.NEGATIVE=3]="NEGATIVE",t[t.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(fe||(fe={})),(t=>{t[t.X=0]="POLYGONS",t[t.J=1]="CONNECTED_POLYGONS",t[t.$=2]="BOUNDARY_CONTOURS"})(de||(de={})),(t=>{t[t.BEGIN=100100]="BEGIN",t[t.EDGE_FLAG=100104]="EDGE_FLAG",t[t.VERTEX=100101]="VERTEX",t[t.END=100102]="END",t[t.ERROR=100103]="ERROR",t[t.COMBINE=100105]="COMBINE",t[t.BEGIN_DATA=100106]="BEGIN_DATA",t[t.EDGE_FLAG_DATA=100110]="EDGE_FLAG_DATA",t[t.VERTEX_DATA=100107]="VERTEX_DATA",t[t.END_DATA=100108]="END_DATA",t[t.ERROR_DATA=100109]="ERROR_DATA",t[t.COMBINE_DATA=100111]="COMBINE_DATA",t[t.WINDING_RULE=100140]="WINDING_RULE",t[t.BOUNDARY_ONLY=100141]="BOUNDARY_ONLY",t[t.TOLERANCE=100142]="TOLERANCE"})(ye||(ye={})),(t=>{t[t.uh=100151]="MISSING_BEGIN_POLYGON",t[t.fh=100152]="MISSING_BEGIN_CONTOUR",t[t.dh=100153]="MISSING_END_POLYGON",t[t.yh=100154]="MISSING_END_CONTOUR",t[t.ph=100155]="COORD_TOO_LARGE",t[t.wh=100156]="NEED_COMBINE_CALLBACK"})(pe||(pe={}))
700
+ class we{next
701
+ v
702
+ m=null
491
703
  G=0
492
- _=0
493
- v=0
704
+ q=0
705
+ j=0
494
706
  T=0
495
- I=0}class se{next
496
- o
497
- h
707
+ I=0}class ge{next
708
+ u
709
+ p
498
710
  C
499
711
  O
500
712
  D
501
713
  N=null
502
- p=0}class ne{next
503
- u
714
+ _=0}class me{next
715
+ v
504
716
  L
505
717
  coords=[0,0,0]
506
718
  s=0
507
- i=0
719
+ l=0
508
720
  B=0
509
- data=null}class re{next
510
- u
721
+ data=null}class ve{next
722
+ v
511
723
  L
512
- _=0}class oe{Y
513
- q
724
+ q=0}class xe{Y
725
+ it
514
726
  Z
515
- Is
516
- Ss=0
517
- constructor(){const t=new ne,e=new re,i=new se,s=new se
518
- t.next=t.u=t,e.next=e.u=e,i.next=i,i.h=s,s.next=s,s.h=i,this.Y=t,this.q=e,this.Z=i,this.Is=s}Fs(t){const e=new se,i=new se,s=t.h.next
519
- return i.next=s,s.h.next=e,e.next=t,t.h.next=i,e.h=i,e.C=e,e.O=i,e.p=0,e.N=null,i.h=e,i.C=i,i.O=e,i.p=0,i.N=null,e}Ms(t,e){const i=t.C,s=e.C
520
- i.h.O=e,s.h.O=t,t.C=s,e.C=i}_s(t,e,i){const s=t,n=i.u
521
- s.u=n,n.next=s,s.next=i,i.u=s,s.L=e,++this.Ss
727
+ gh
728
+ mh=0
729
+ constructor(){const t=new me,e=new ve,i=new ge,s=new ge
730
+ t.next=t.v=t,e.next=e.v=e,i.next=i,i.p=s,s.next=s,s.p=i,this.Y=t,this.it=e,this.Z=i,this.gh=s}xh(t){const e=new ge,i=new ge,s=t.p.next
731
+ return i.next=s,s.p.next=e,e.next=t,t.p.next=i,e.p=i,e.C=e,e.O=i,e._=0,e.N=null,i.p=e,i.C=i,i.O=e,i._=0,i.N=null,e}Ah(t,e){const i=t.C,s=e.C
732
+ i.p.O=e,s.p.O=t,t.C=s,e.C=i}bh(t,e,i){const s=t,n=i.v
733
+ s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,++this.mh
522
734
  let r=e
523
- do{r.o=s,r=r.C}while(r!==e)}Os(t,e,i){const s=t,n=i.u
524
- s.u=n,n.next=s,s.next=i,i.u=s,s.L=e,s._=i._
735
+ do{r.u=s,r=r.C}while(r!==e)}Eh(t,e,i){const s=t,n=i.v
736
+ s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,s.q=i.q
525
737
  let r=e
526
- do{r.D=s,r=r.O}while(r!==e)}Cs(t){const e=t.next,i=t.h.next
527
- e.h.next=i,i.h.next=e}ks(t,e){const i=t.L
738
+ do{r.D=s,r=r.O}while(r!==e)}Th(t){const e=t.next,i=t.p.next
739
+ e.p.next=i,i.p.next=e}Ih(t,e){const i=t.L
528
740
  let s=i
529
- do{s.o=e,s=s.C}while(s!==i)
530
- const n=t.u,r=t.next
531
- r.u=n,n.next=r,--this.Ss}Bs(t,e){const i=t.L
741
+ do{s.u=e,s=s.C}while(s!==i)
742
+ const n=t.v,r=t.next
743
+ r.v=n,n.next=r,--this.mh}Sh(t,e){const i=t.L
532
744
  let s=i
533
745
  do{s.D=e,s=s.O}while(s!==i)
534
- const n=t.u,r=t.next
535
- r.u=n,n.next=r}F(){const t=new ne,e=new ne,i=new re,s=this.Fs(this.Z)
536
- return this._s(t,s,this.Y),this._s(e,s.h,this.Y),this.Os(i,s,this.q),s}splice(t,e){let i=0,s=0
537
- if(t!==e){if(e.o!==t.o&&(s=1,this.ks(e.o,t.o)),e.D!==t.D&&(i=1,this.Bs(e.D,t.D)),this.Ms(e,t),!s){const i=new ne
538
- this._s(i,e,t.o),t.o.L=t}if(!i){const i=new re
539
- this.Os(i,e,t.D),t.D.L=t}}}delete(t){const e=t.h
746
+ const n=t.v,r=t.next
747
+ r.v=n,n.next=r}F(){const t=new me,e=new me,i=new ve,s=this.xh(this.Z)
748
+ return this.bh(t,s,this.Y),this.bh(e,s.p,this.Y),this.Eh(i,s,this.it),s}splice(t,e){let i=0,s=0
749
+ if(t!==e){if(e.u!==t.u&&(s=1,this.Ih(e.u,t.u)),e.D!==t.D&&(i=1,this.Sh(e.D,t.D)),this.Ah(e,t),!s){const i=new me
750
+ this.bh(i,e,t.u),t.u.L=t}if(!i){const i=new ve
751
+ this.Eh(i,e,t.D),t.D.L=t}}}delete(t){const e=t.p
540
752
  let i=0
541
- if(t.D!==t.h.D&&(i=1,this.Bs(t.D,t.h.D)),t.C===t)this.ks(t.o,null)
542
- else if(t.h.D.L=t.h.O,t.o.L=t.C,this.Ms(t,t.h.O),!i){const e=new re
543
- this.Os(e,t,t.D)}e.C===e?(this.ks(e.o,null),this.Bs(e.D,null)):(t.D.L=e.h.O,e.o.L=e.C,this.Ms(e,e.h.O)),this.Cs(t)}Et(t){const e=this.Fs(t),i=e.h
544
- this.Ms(e,t.O),e.o=t.h.o
545
- const s=new ne
546
- return this._s(s,i,e.o),e.D=i.D=t.D,e}V(t){const e=this.Et(t).h
547
- return this.Ms(t.h,t.h.h.O),this.Ms(t.h,e),t.h.o=e.o,e.h.o.L=e.h,e.h.D=t.h.D,e.p=t.p,e.h.p=t.h.p,e}connect(t,e){let i=0
548
- const s=this.Fs(t),n=s.h
549
- if(e.D!==t.D&&(i=1,this.Bs(e.D,t.D)),this.Ms(s,t.O),this.Ms(n,e),s.o=t.h.o,n.o=e.o,s.D=n.D=t.D,t.D.L=n,!i){const e=new re
550
- this.Os(e,s,t.D)}return s}Nt(t){const e=t.L
753
+ if(t.D!==t.p.D&&(i=1,this.Sh(t.D,t.p.D)),t.C===t)this.Ih(t.u,null)
754
+ else if(t.p.D.L=t.p.O,t.u.L=t.C,this.Ah(t,t.p.O),!i){const e=new ve
755
+ this.Eh(e,t,t.D)}e.C===e?(this.Ih(e.u,null),this.Sh(e.D,null)):(t.D.L=e.p.O,e.u.L=e.C,this.Ah(e,e.p.O)),this.Th(t)}Et(t){const e=this.xh(t),i=e.p
756
+ this.Ah(e,t.O),e.u=t.p.u
757
+ const s=new me
758
+ return this.bh(s,i,e.u),e.D=i.D=t.D,e}V(t){const e=this.Et(t).p
759
+ return this.Ah(t.p,t.p.p.O),this.Ah(t.p,e),t.p.u=e.u,e.p.u.L=e.p,e.p.D=t.p.D,e._=t._,e.p._=t.p._,e}connect(t,e){let i=0
760
+ const s=this.xh(t),n=s.p
761
+ if(e.D!==t.D&&(i=1,this.Sh(e.D,t.D)),this.Ah(s,t.O),this.Ah(n,e),s.u=t.p.u,n.u=e.u,s.D=n.D=t.D,t.D.L=n,!i){const e=new ve
762
+ this.Eh(e,s,t.D)}return s}Nt(t){const e=t.L
551
763
  let i,s,n,r,o
552
764
  s=e.O
553
- do{i=s,s=i.O,i.D=null,i.h.D||(i.C===i?this.ks(i.o,null):(i.o.L=i.C,this.Ms(i,i.h.O)),n=i.h,n.C===n?this.ks(n.o,null):(n.o.L=n.C,this.Ms(n,n.h.O)),this.Cs(i))}while(i!=e)
554
- r=t.u,o=t.next,o.u=r,r.next=o}Ls(t){let e=t.L,i=0
765
+ do{i=s,s=i.O,i.D=null,i.p.D||(i.C===i?this.Ih(i.u,null):(i.u.L=i.C,this.Ah(i,i.p.O)),n=i.p,n.C===n?this.Ih(n.u,null):(n.u.L=n.C,this.Ah(n,n.p.O)),this.Th(i))}while(i!=e)
766
+ r=t.v,o=t.next,o.v=r,r.next=o}Fh(t){let e=t.L,i=0
555
767
  do{i++,e=e.O}while(e!==t.L)
556
- return i}check(){}}class he{max=0
768
+ return i}check(){}}class Ae{max=0
557
769
  At
558
770
  It
559
- Ds
771
+ Mh
560
772
  Ot=0
561
- Ns=0
773
+ _h=0
562
774
  size=0
563
- constructor(t){this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.Ds=new Int32Array(t+1),this.Ot=0,this.At[1]=1,this.It[1]=null}reset(t){if(t+1>this.max)this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.Ds=new Int32Array(t+1)
775
+ constructor(t){this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.Mh=new Int32Array(t+1),this.Ot=0,this.At[1]=1,this.It[1]=null}reset(t){if(t+1>this.max)this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.Mh=new Int32Array(t+1)
564
776
  else{const t=this.It
565
- for(let e=1;this.size>=e;e++)t[e]=null}this.size=0,this.Ns=0,this.Ot=0,this.At[1]=1,this.It[1]=null}Ps(t){const e=this.At,i=this.It,s=this.Ds
777
+ for(let e=1;this.size>=e;e++)t[e]=null}this.size=0,this._h=0,this.Ot=0,this.At[1]=1,this.It[1]=null}Oh(t){const e=this.At,i=this.It,s=this.Mh
566
778
  let n=e[t]
567
779
  for(;;){let r=t<<1
568
780
  if(r>this.size)break
569
781
  let o=r,h=e[r]
570
- if(this.size>=r+1){const t=e[r+1],s=i[t],n=i[h];(n.s>s.s||s.s===n.s&&n.i>=s.i)&&(o=r+1,h=t)}const a=i[n],l=i[h]
571
- if(l.s>a.s||a.s===l.s&&l.i>=a.i)break
572
- e[t]=h,s[h]=t,t=o}e[t]=n,s[n]=t}Tt(t){const e=this.At,i=this.It,s=this.Ds
782
+ if(this.size>=r+1){const t=e[r+1],s=i[t],n=i[h];(n.s>s.s||s.s===n.s&&n.l>=s.l)&&(o=r+1,h=t)}const a=i[n],l=i[h]
783
+ if(l.s>a.s||a.s===l.s&&l.l>=a.l)break
784
+ e[t]=h,s[h]=t,t=o}e[t]=n,s[n]=t}Tt(t){const e=this.At,i=this.It,s=this.Mh
573
785
  let n=e[t]
574
786
  for(;;){const r=t>>1
575
787
  if(0===r)break
576
788
  const o=e[r],h=i[o],a=i[n]
577
- if(a.s>h.s||h.s===a.s&&a.i>=h.i)break
578
- e[t]=o,s[o]=t,t=r}e[t]=n,s[n]=t}init(){for(let t=this.size>>1;t>=1;--t)this.Ps(t)
579
- this.Ot=1}$s(){return 0===this.size}min(){return 0===this.size?null:this.It[this.At[1]]}P(t){let e,i
789
+ if(a.s>h.s||h.s===a.s&&a.l>=h.l)break
790
+ e[t]=o,s[o]=t,t=r}e[t]=n,s[n]=t}init(){for(let t=this.size>>1;t>=1;--t)this.Oh(t)
791
+ this.Ot=1}Ch(){return 0===this.size}min(){return 0===this.size?null:this.It[this.At[1]]}P(t){let e,i
580
792
  if(e=++this.size,2*e>this.max){this.max*=2
581
793
  const t=new Int32Array(this.max+1),e=new Int32Array(this.max+1),i=Array(this.max+1).fill(null)
582
- t.set(this.At),e.set(this.Ds)
794
+ t.set(this.At),e.set(this.Mh)
583
795
  for(let t=0;this.It.length>t;t++)i[t]=this.It[t]
584
- this.At=t,this.Ds=e,this.It=i}return 0===this.Ns?i=e:(i=this.Ns,this.Ns=this.Ds[i]),this.At[e]=i,this.Ds[i]=e,this.It[i]=t,this.Ot&&this.Tt(e),i}Mt(){const t=this.At,e=this.It,i=this.Ds
796
+ this.At=t,this.Mh=e,this.It=i}return 0===this._h?i=e:(i=this._h,this._h=this.Mh[i]),this.At[e]=i,this.Mh[i]=e,this.It[i]=t,this.Ot&&this.Tt(e),i}Mt(){const t=this.At,e=this.It,i=this.Mh
585
797
  let s=t[1],n=e[s]
586
- return this.size>0&&(t[1]=t[this.size],i[t[1]]=1,e[s]=null,i[s]=this.Ns,this.Ns=s,--this.size,this.size>0&&this.Ps(1)),n}delete(t){const e=this.At,i=this.It,s=this.Ds
798
+ return this.size>0&&(t[1]=t[this.size],i[t[1]]=1,e[s]=null,i[s]=this._h,this._h=s,--this.size,this.size>0&&this.Oh(1)),n}delete(t){const e=this.At,i=this.It,s=this.Mh
587
799
  let n
588
800
  if(n=s[t],e[n]=e[this.size],s[e[n]]=n,--this.size,this.size>=n)if(n>1){const t=i[e[n>>1]],s=i[e[n]]
589
- s.s>t.s||t.s===s.s&&s.i>=t.i?this.Ps(n):this.Tt(n)}else this.Ps(n)
590
- i[t]=null,s[t]=this.Ns,this.Ns=t}}class ae{Dt
801
+ s.s>t.s||t.s===s.s&&s.l>=t.l?this.Oh(n):this.Tt(n)}else this.Oh(n)
802
+ i[t]=null,s[t]=this._h,this._h=t}}class be{Dt
591
803
  keys
592
804
  order=null
593
805
  size=0
594
806
  max=0
595
807
  Ot=0
596
808
  Lt
597
- constructor(t){this.max=t,this.size=0,this.Ot=0,this.Lt=128>=t,this.Dt=new he(t),this.Lt||(this.keys=Array(t).fill(null))}reset(t){this.Dt.reset(t),this.Lt=128>=t,this.Lt||this.keys&&this.max>=t||(this.keys=Array(t).fill(null)),t>this.max&&(this.max=t),this.size=0,this.Ot=0,this.order=null}P(t){if(this.Lt||this.Ot)return this.Dt.P(t)
809
+ constructor(t){this.max=t,this.size=0,this.Ot=0,this.Lt=128>=t,this.Dt=new Ae(t),this.Lt||(this.keys=Array(t).fill(null))}reset(t){this.Dt.reset(t),this.Lt=128>=t,this.Lt||this.keys&&this.max>=t||(this.keys=Array(t).fill(null)),t>this.max&&(this.max=t),this.size=0,this.Ot=0,this.order=null}P(t){if(this.Lt||this.Ot)return this.Dt.P(t)
598
810
  const e=this.size
599
811
  if(++this.size>=this.max){const t=this.max
600
812
  this.max*=2
@@ -605,31 +817,31 @@ this.order=Array(this.size)
605
817
  for(let t=0;this.size>t;t++)this.order[t]=t
606
818
  const t=this.keys
607
819
  return this.order.sort((e,i)=>{const s=t[e],n=t[i]
608
- return n.s>s.s?1:s.s>n.s||s.i>n.i?-1:1}),this.max=this.size,this.Ot=1,this.Dt.init(),1}Mt(){if(this.Lt||0===this.size)return this.Dt.Mt()
820
+ return n.s>s.s?1:s.s>n.s||s.l>n.l?-1:1}),this.max=this.size,this.Ot=1,this.Dt.init(),1}Mt(){if(this.Lt||0===this.size)return this.Dt.Mt()
609
821
  const t=this.keys[this.order[this.size-1]]
610
- if(!this.Dt.$s()){const e=this.Dt.min()
611
- if(e&&r(e,t))return this.Dt.Mt()}do{--this.size}while(this.size>0&&null===this.keys[this.order[this.size-1]])
822
+ if(!this.Dt.Ch()){const e=this.Dt.min()
823
+ if(e&&a(e,t))return this.Dt.Mt()}do{--this.size}while(this.size>0&&null===this.keys[this.order[this.size-1]])
612
824
  return t}min(){if(this.Lt||0===this.size)return this.Dt.min()
613
825
  const t=this.keys[this.order[this.size-1]]
614
- if(!this.Dt.$s()){const e=this.Dt.min()
615
- if(e&&r(e,t))return e}return t}delete(t){0>t?this.keys[-(t+1)]=null:this.Dt.delete(t)}$s(){return(this.Lt||0===this.size)&&this.Dt.$s()}}class le{head=new ie
826
+ if(!this.Dt.Ch()){const e=this.Dt.min()
827
+ if(e&&a(e,t))return e}return t}delete(t){0>t?this.keys[-(t+1)]=null:this.Dt.delete(t)}Ch(){return(this.Lt||0===this.size)&&this.Dt.Ch()}}class Ee{head=new we
616
828
  frame
617
- constructor(t){this.frame=t,this.head.next=this.head,this.head.u=this.head}min(){return this.head.next}max(){return this.head.u}P(t){return this.insertBefore(this.head,t)}search(t){let e=this.head
618
- do{e=e.next}while(null!==e.l&&!p(this.frame,t,e))
619
- return e}insertBefore(t,e){do{t=t.u}while(null!==t.l&&!p(this.frame,t,e))
620
- return e.next=t.next,t.next.u=e,e.u=t,t.next=e,e}delete(t){t.next.u=t.u,t.u.next=t.next}}let ce=null,ue=null
621
- const fe=[0,0,0,0],de=[null,null,null,null],ye=[0,0,0]
622
- class pe{static Ct(t,e){t.p+=e.p,t.h.p+=e.h.p}static Gt(t,e){let i,s,n
829
+ constructor(t){this.frame=t,this.head.next=this.head,this.head.v=this.head}min(){return this.head.next}max(){return this.head.v}P(t){return this.insertBefore(this.head,t)}search(t){let e=this.head
830
+ do{e=e.next}while(null!==e.m&&!m(this.frame,t,e))
831
+ return e}insertBefore(t,e){do{t=t.v}while(null!==t.m&&!m(this.frame,t,e))
832
+ return e.next=t.next,t.next.v=e,e.v=t,t.next=e,e}delete(t){t.next.v=t.v,t.v.next=t.next}}let Te=null,Ie=null
833
+ const Se=[0,0,0,0],Fe=[null,null,null,null],Me=[0,0,0]
834
+ class _e{static Ct(t,e){t._+=e._,t.p._+=e.p._}static Gt(t,e){let i,s,n
623
835
  if(i=e.L,i.O===i||i.O.O===i)throw Error("Monotone region has degenerate topology")
624
- for(;r(i.h.o,i.o);i=i.C.h);for(;r(i.o,i.h.o);i=i.O);for(s=i.C.h;i.O!==s;)if(r(i.h.o,s.o)){for(;s.O!==i&&(h(s.O)||0>=u(s.o,s.h.o,s.O.h.o));)n=t.connect(s.O,s),s=n.h
625
- s=s.C.h}else{for(;s.O!==i&&(a(i.C.h)||u(i.h.o,i.o,i.C.h.o)>=0);)n=t.connect(i,i.C.h),i=n.h
836
+ for(;a(i.p.u,i.u);i=i.C.p);for(;a(i.u,i.p.u);i=i.O);for(s=i.C.p;i.O!==s;)if(a(i.p.u,s.u)){for(;s.O!==i&&(c(s.O)||0>=y(s.u,s.p.u,s.O.p.u));)n=t.connect(s.O,s),s=n.p
837
+ s=s.C.p}else{for(;s.O!==i&&(u(i.C.p)||y(i.p.u,i.u,i.C.p.u)>=0);)n=t.connect(i,i.C.p),i=n.p
626
838
  i=i.O}if(s.O===i)throw Error("Monotone region has insufficient vertices")
627
- for(;s.O.O!==i;)n=t.connect(s.O,s),s=n.h
628
- return 1}static Gs(t){let e
629
- for(let i=t.q.next;i!==t.q;i=e)e=i.next,i._&&pe.Gt(t,i)
630
- return 1}}let we=[],ge=new Int8Array(64),me=new Int32Array(64),ve=new Int32Array(64)
631
- var xe;(t=>{t[t.Rt=0]="T_DORMANT",t[t.zs=1]="T_IN_POLYGON",t[t.Rs=2]="T_IN_CONTOUR"})(xe||(xe={}))
632
- class Ae{state=xe.Rt
839
+ for(;s.O.O!==i;)n=t.connect(s.O,s),s=n.p
840
+ return 1}static kh(t){let e
841
+ for(let i=t.it.next;i!==t.it;i=e)e=i.next,i.q&&_e.Gt(t,i)
842
+ return 1}}let Oe=[],Ce=new Int8Array(64),ke=new Int32Array(64),Le=new Int32Array(64)
843
+ var Be;(t=>{t[t.Rt=0]="T_DORMANT",t[t.Lh=1]="T_IN_POLYGON",t[t.Bh=2]="T_IN_CONTOUR"})(Be||(Be={}))
844
+ class De{state=Be.Rt
633
845
  Ut=null
634
846
  St=0
635
847
  Bt=0
@@ -637,151 +849,151 @@ Vt=1
637
849
  Pt=0
638
850
  Ft=0
639
851
  Yt=0
640
- Ws=0
852
+ Dh=0
641
853
  A
642
854
  Ht=[0,0,0]
643
- js
644
- Us
855
+ Nh
856
+ Ph
645
857
  Wt
646
858
  Zt
647
- M=Qt.ODD
648
- Kt=Qt.ODD
649
- m
859
+ M=fe.ODD
860
+ Kt=fe.ODD
861
+ k
650
862
  S
651
863
  event
652
864
  Xt
653
865
  Qt
654
866
  Jt
655
867
  $t
656
- Vs
657
- Hs
868
+ $h
869
+ Gh
658
870
  R
659
- qs
660
- k=null
871
+ Rh
872
+ tt=null
661
873
  U=0
662
- Ys(t,e){const i=e||null
874
+ zh(t,e){const i=e||null
663
875
  switch(t){case 100100:case 100106:this.Xt=i
664
876
  break
665
- case 100104:case 100110:this.$t=i,this.Js=1
877
+ case 100104:case 100110:this.$t=i,this.Wh=1
666
878
  break
667
879
  case 100101:case 100107:this.Qt=i
668
880
  break
669
881
  case 100102:case 100108:this.Jt=i
670
882
  break
671
- case 100103:this.Vs=i
883
+ case 100103:this.$h=i
672
884
  break
673
- case 100109:this.Hs=i
885
+ case 100109:this.Gh=i
674
886
  break
675
887
  case 100105:case 100111:this.R=i
676
888
  break
677
- case 100112:this.qs=i
889
+ case 100112:this.Rh=i
678
890
  break
679
- default:throw Error("GLU_INVALID_ENUM")}}Ks(t,e){switch(t){case 100140:{const t=e,i=100130>t?t:t-100130
891
+ default:throw Error("GLU_INVALID_ENUM")}}jh(t,e){switch(t){case 100140:{const t=e,i=100130>t?t:t-100130
680
892
  if(0>i||i>4)throw Error("GLU_INVALID_VALUE")
681
893
  this.Kt=t,this.M=i
682
- break}case 100141:this.Xs=!!e
894
+ break}case 100141:this.Uh=!!e
683
895
  break
684
896
  case 100142:break
685
- default:throw Error("GLU_INVALID_ENUM")}}Qs(t){switch(t){case 100140:return this.Kt
686
- case 100141:return this.Xs
897
+ default:throw Error("GLU_INVALID_ENUM")}}Vh(t){switch(t){case 100140:return this.Kt
898
+ case 100141:return this.Uh
687
899
  case 100142:return 0
688
- default:throw Error("GLU_INVALID_ENUM")}}Zs(t,e,i){this.Ht[0]=t,this.Ht[1]=e,this.Ht[2]=i,0===i||t||e||(this.Vt=i>0?1:-1)}H(t){this.Xt&&this.Xt(t,this.k)}W(t){this.Qt&&this.Qt(t,this.k)}tt(){this.Jt&&this.Jt(this.k)}K(t){this.$t&&this.$t(t,this.k)}j(t){this.Hs?this.Hs(t,this.k):this.Vs&&this.Vs(t)}tn(t){if(this.state!==t)for(;this.state!==t;)t>this.state?this.state===xe.Rt?(this.j(100151),this.en()):this.state===xe.zs&&(this.j(100152),this.sn()):this.state===xe.Rs?(this.j(100154),this.nn()):this.state===xe.zs&&(this.j(100153),this.rn())}Xs=0
689
- Js=0
690
- hn(){const t=this.A,e=t.Y,i=this.Ht[0],s=this.Ht[1],n=this.Ht[2]
900
+ default:throw Error("GLU_INVALID_ENUM")}}Hh(t,e,i){this.Ht[0]=t,this.Ht[1]=e,this.Ht[2]=i,0===i||t||e||(this.Vt=i>0?1:-1)}H(t){this.Xt&&this.Xt(t,this.tt)}W(t){this.Qt&&this.Qt(t,this.tt)}st(){this.Jt&&this.Jt(this.tt)}K(t){this.$t&&this.$t(t,this.tt)}et(t){this.Gh?this.Gh(t,this.tt):this.$h&&this.$h(t)}qh(t){if(this.state!==t)for(;this.state!==t;)t>this.state?this.state===Be.Rt?(this.et(100151),this.Yh()):this.state===Be.Lh&&(this.et(100152),this.Jh()):this.state===Be.Bh?(this.et(100154),this.Kh()):this.state===Be.Lh&&(this.et(100153),this.Xh())}Uh=0
901
+ Wh=0
902
+ Qh(){const t=this.A,e=t.Y,i=this.Ht[0],s=this.Ht[1],n=this.Ht[2]
691
903
  let r,o
692
- if(this.js||(this.js=[0,0,0]),this.Us||(this.Us=[0,0,0]),this.Wt||(this.Wt=[0,0]),this.Zt||(this.Zt=[0,0]),r=this.js,o=this.Us,this.Bt){r[0]=1,r[1]=0,r[2]=0
904
+ if(this.Nh||(this.Nh=[0,0,0]),this.Ph||(this.Ph=[0,0,0]),this.Wt||(this.Wt=[0,0]),this.Zt||(this.Zt=[0,0]),r=this.Nh,o=this.Ph,this.Bt){r[0]=1,r[1]=0,r[2]=0
693
905
  const t=n>0?1:-1
694
- return o[0]=0,o[1]=t,o[2]=0,this.Wt[0]=this.Pt,this.Wt[1]=this.Yt,this.Zt[0]=this.Ft,void(this.Zt[1]=this.Ws)}if(!this.St&&!i&&!s){let i
906
+ return o[0]=0,o[1]=t,o[2]=0,this.Wt[0]=this.Pt,this.Wt[1]=this.Yt,this.Zt[0]=this.Ft,void(this.Zt[1]=this.Dh)}if(!this.St&&!i&&!s){let i
695
907
  r[0]=1,r[1]=0,r[2]=0
696
908
  let s=0
697
909
  if(n)i=n>0?1:-1
698
910
  else{const e=[0,0,0]
699
- $(t,e),i=e[2]>0?1:-1,s=1}o[0]=0,o[1]=i,o[2]=0
911
+ z(t,e),i=e[2]>0?1:-1,s=1}o[0]=0,o[1]=i,o[2]=0
700
912
  let h=e.next,a=h.coords[0],l=h.coords[1]*i
701
- h.s=a,h.i=l
913
+ h.s=a,h.l=l
702
914
  let c=a,u=a,f=l,d=l
703
- for(h=h.next;h!==e;h=h.next)a=h.coords[0],l=h.coords[1]*i,h.s=a,h.i=l,c>a?c=a:a>u&&(u=a),f>l?f=l:l>d&&(d=l)
704
- return this.Wt[0]=c,this.Zt[0]=u,void(s?(G(t,this.Us),o[1]!==i?(this.Wt[1]=-d,this.Zt[1]=-f):(this.Wt[1]=f,this.Zt[1]=d)):(this.Wt[1]=f,this.Zt[1]=d))}let h=0
915
+ for(h=h.next;h!==e;h=h.next)a=h.coords[0],l=h.coords[1]*i,h.s=a,h.l=l,c>a?c=a:a>u&&(u=a),f>l?f=l:l>d&&(d=l)
916
+ return this.Wt[0]=c,this.Zt[0]=u,void(s?(W(t,this.Ph),o[1]!==i?(this.Wt[1]=-d,this.Zt[1]=-f):(this.Wt[1]=f,this.Zt[1]=d)):(this.Wt[1]=f,this.Zt[1]=d))}let h=0
705
917
  const a=[i,s,n]
706
- i||s||n||($(t,a),h=1)
918
+ i||s||n||(z(t,a),h=1)
707
919
  const l=(t=>{let e=0
708
920
  return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e})(a)
709
921
  r[l]=0,r[(l+1)%3]=1,r[(l+2)%3]=0,o[l]=0,o[(l+1)%3]=0,o[(l+2)%3]=a[l]>0?1:-1
710
922
  let c=e.next
711
- c.s=c.coords[0]*r[0]+c.coords[1]*r[1]+c.coords[2]*r[2],c.i=c.coords[0]*o[0]+c.coords[1]*o[1]+c.coords[2]*o[2]
712
- let u=c.s,f=c.s,d=c.i,y=c.i
923
+ c.s=c.coords[0]*r[0]+c.coords[1]*r[1]+c.coords[2]*r[2],c.l=c.coords[0]*o[0]+c.coords[1]*o[1]+c.coords[2]*o[2]
924
+ let u=c.s,f=c.s,d=c.l,y=c.l
713
925
  for(c=c.next;c!==e;c=c.next){const t=c.coords[0]*r[0]+c.coords[1]*r[1]+c.coords[2]*r[2],e=c.coords[0]*o[0]+c.coords[1]*o[1]+c.coords[2]*o[2]
714
- c.s=t,c.i=e,u>t?u=t:t>f&&(f=t),d>e?d=e:e>y&&(y=e)}h&&G(t,this.Us),h&&o[(l+2)%3]!==(a[l]>0?1:-1)?(this.Wt[0]=u,this.Zt[0]=f,this.Wt[1]=-y,this.Zt[1]=-d):(this.Wt[0]=u,this.Zt[0]=f,this.Wt[1]=d,this.Zt[1]=y)}en(t){this.tn(xe.Rt),this.state=xe.zs,this.U=0,this.A=new oe,this.St=0,this.Bt=0!==this.Ht[2]&&!this.Ht[0]&&!this.Ht[1],this.Pt=1/0,this.Ft=-1/0,this.Yt=1/0,this.Ws=-1/0,this.k=t}sn(){this.tn(xe.zs),this.state=xe.Rs,this.Ut=null}an(t,e){this.tn(xe.Rs)
715
- let i=t[0],s=t[1],n=t.length>2?t[2]:0,r=0;-1e150>i?(i=-1e150,r=1):i>1e150&&(i=1e150,r=1),-1e150>s?(s=-1e150,r=1):s>1e150&&(s=1e150,r=1),-1e150>n?(n=-1e150,r=1):n>1e150&&(n=1e150,r=1),r&&this.j(100155)
926
+ c.s=t,c.l=e,u>t?u=t:t>f&&(f=t),d>e?d=e:e>y&&(y=e)}h&&W(t,this.Ph),h&&o[(l+2)%3]!==(a[l]>0?1:-1)?(this.Wt[0]=u,this.Zt[0]=f,this.Wt[1]=-y,this.Zt[1]=-d):(this.Wt[0]=u,this.Zt[0]=f,this.Wt[1]=d,this.Zt[1]=y)}Yh(t){this.qh(Be.Rt),this.state=Be.Lh,this.U=0,this.A=new xe,this.St=0,this.Bt=0!==this.Ht[2]&&!this.Ht[0]&&!this.Ht[1],this.Pt=1/0,this.Ft=-1/0,this.Yt=1/0,this.Dh=-1/0,this.tt=t}Jh(){this.qh(Be.Lh),this.state=Be.Bh,this.Ut=null}Zh(t,e){this.qh(Be.Bh)
927
+ let i=t[0],s=t[1],n=t.length>2?t[2]:0,r=0;-1e150>i?(i=-1e150,r=1):i>1e150&&(i=1e150,r=1),-1e150>s?(s=-1e150,r=1):s>1e150&&(s=1e150,r=1),-1e150>n?(n=-1e150,r=1):n>1e150&&(n=1e150,r=1),r&&this.et(100155)
716
928
  let o=this.Ut
717
- if(null===o?(o=this.A.F(),this.A.splice(o,o.h)):(this.A.V(o),o=o.O),o.o.data=e||null,o.o.coords[0]=i,o.o.coords[1]=s,0!==n?(o.o.coords[2]=n,this.St=1,this.Bt=0):o.o.coords[2]=0,this.Bt){o.o.s=i
929
+ if(null===o?(o=this.A.F(),this.A.splice(o,o.p)):(this.A.V(o),o=o.O),o.u.data=e||null,o.u.coords[0]=i,o.u.coords[1]=s,0!==n?(o.u.coords[2]=n,this.St=1,this.Bt=0):o.u.coords[2]=0,this.Bt){o.u.s=i
718
930
  const t=s*this.Vt
719
- o.o.i=t,this.Pt>i&&(this.Pt=i),i>this.Ft&&(this.Ft=i),this.Yt>t&&(this.Yt=t),t>this.Ws&&(this.Ws=t)}o.p=1,o.h.p=-1,this.Ut=o}nn(){this.tn(xe.Rs),this.state=xe.zs}rn(){this.tn(xe.zs),this.state=xe.Rt,this.compute(this.M,void 0,0)
931
+ o.u.l=t,this.Pt>i&&(this.Pt=i),i>this.Ft&&(this.Ft=i),this.Yt>t&&(this.Yt=t),t>this.Dh&&(this.Dh=t)}o._=1,o.p._=-1,this.Ut=o}Kh(){this.qh(Be.Bh),this.state=Be.Lh}Xh(){this.qh(Be.Lh),this.state=Be.Rt,this.compute(this.M,void 0,0)
720
932
  const t=this.A
721
- this.U||(this.Xs?(j(t,1),V(this,t)):this.Js?(pe.Gs(t),U(this,t)):z(this,t)),this.qs&&this.qs(t),this.A=null,this.Ut=null,this.event=null,this.k=null,this.m=null}ln(){this.tn(xe.Rt)}compute(t=Qt.ODD,e,i=0){this.state!==xe.Rt&&this.state===xe.zs&&(this.state=xe.Rt),this.A||(this.A=new oe),e&&(this.Ht[0]=e[0],this.Ht[1]=e[1],this.Ht[2]=e[2]),this.M=t,this.hn(),((t,e=1)=>{let i,s
722
- if((t=>{let e,i,s,r=t.A.Z
723
- for(e=r.next;e!==r;e=i)i=e.next,s=e.O,n(e.o,e.h.o)&&e.O.O!==e&&(_(t,s,e),t.A.delete(e),e=s,s=e.O),s.O===e&&(s!==e&&(s!==i&&s!==i.h||(i=i.next),t.A.delete(s)),e!==i&&e!==i.h||(i=i.next),t.A.delete(e))})(t),!(t=>{let e,i,s,n=t.A.Ss+8
724
- for(t.S?(t.S.reset(n),e=t.S):e=t.S=new ae(n),s=t.A.Y,i=s.next;i!==s;i=i.next)i.B=e.P(i)
933
+ this.U||(this.Uh?(H(t,1),Y(this,t)):this.Wh?(_e.kh(t),q(this,t)):j(this,t)),this.Rh&&this.Rh(t),this.A=null,this.Ut=null,this.event=null,this.tt=null,this.k=null}ta(){this.qh(Be.Rt)}compute(t=fe.ODD,e,i=0){this.state!==Be.Rt&&this.state===Be.Lh&&(this.state=Be.Rt),this.A||(this.A=new xe),e&&(this.Ht[0]=e[0],this.Ht[1]=e[1],this.Ht[2]=e[2]),this.M=t,this.Qh(),((t,e=1)=>{let i,s
934
+ if((t=>{let e,i,s,n=t.A.Z
935
+ for(e=n.next;e!==n;e=i)i=e.next,s=e.O,h(e.u,e.p.u)&&e.O.O!==e&&(k(t,s,e),t.A.delete(e),e=s,s=e.O),s.O===e&&(s!==e&&(s!==i&&s!==i.p||(i=i.next),t.A.delete(s)),e!==i&&e!==i.p||(i=i.next),t.A.delete(e))})(t),!(t=>{let e,i,s,n=t.A.mh+8
936
+ for(t.S?(t.S.reset(n),e=t.S):e=t.S=new be(n),s=t.A.Y,i=s.next;i!==s;i=i.next)i.B=e.P(i)
725
937
  return i!==s?0:(e.init(),1)})(t))return 0
726
- for((t=>{t.m=new le(t)
938
+ for((t=>{t.k=new Ee(t)
727
939
  let e=t.Zt[0]-t.Wt[0],i=t.Zt[1]-t.Wt[1],s=t.Wt[0]-e,n=t.Zt[0]+e,r=t.Zt[1]+i
728
- P(t,s,n,t.Wt[1]-i),P(t,s,n,r)})(t);null!==(i=t.S.Mt());){for(;s=t.S.min(),null!==s&&n(s,i);)s=t.S.Mt(),_(t,i.L,s.L)
729
- N(t,i)}t.event=t.m.min().l.o,(t=>{let e
730
- for(;null!==(e=t.m.min()).l;)v(t,e)})(t),((t,e)=>{let i,s,n
731
- for(i=e.q.next;i!==e.q;i=s)s=i.next,n=i.L,n.O.O===n&&(m(n.C,n),t.A.delete(n))})(t,t.A),e&&t.A.check()})(this,i)}cn(){this.A&&(j(this.A,1),V(this,this.A))}un(t=0){this.A&&(t?(pe.Gs(this.A),U(this,this.A)):z(this,this.A))}}class be{process(t,e=!0,i=!1,s=!0){if(0===t.length)return{fn:{vertices:[],indices:[]},dn:[]}
940
+ R(t,s,n,t.Wt[1]-i),R(t,s,n,r)})(t);null!==(i=t.S.Mt());){for(;s=t.S.min(),null!==s&&h(s,i);)s=t.S.Mt(),k(t,i.L,s.L)
941
+ G(t,i)}t.event=t.k.min().m.u,(t=>{let e
942
+ for(;null!==(e=t.k.min()).m;)b(t,e)})(t),((t,e)=>{let i,s,n
943
+ for(i=e.it.next;i!==e.it;i=s)s=i.next,n=i.L,n.O.O===n&&(A(n.C,n),t.A.delete(n))})(t,t.A),e&&t.A.check()})(this,i)}ea(){this.A&&(H(this.A,1),Y(this,this.A))}ia(t=0){this.A&&(t?(_e.kh(this.A),q(this,this.A)):j(this,this.A))}}class Ne{process(t,e=!0,i=!1,s=!0){if(0===t.length)return{sa:{vertices:[],indices:[]},na:[]}
732
944
  const n=t.filter(t=>t.points.length>=3)
733
- return 0===n.length?{fn:{vertices:[],indices:[]},dn:[]}:this.yn(n,e,i,s)}pn(t,e=!0,i=!1,s=!0){return 0===t.length?{fn:{vertices:[],indices:[]},dn:[]}:this.wn(t,e,i,s)}yn(t,e,i,s){const n=!i&&!e
945
+ return 0===n.length?{sa:{vertices:[],indices:[]},na:[]}:this.ra(n,e,i,s)}oa(t,e=!0,i=!1,s=!0){return 0===t.length?{sa:{vertices:[],indices:[]},na:[]}:this.ha(t,e,i,s)}ra(t,e,i,s){const n=!i&&!e
734
946
  let r,o
735
- n?(o=this.gn(t,!0),(e||s)&&(r=this.gn(t))):(r=this.gn(t),o=r)
736
- let h=s?n?o:r??this.gn(t):[]
737
- if(e){const t=this.mn(r,"boundary")
738
- if(!t)return st.warn("libtess returned empty result from boundary pass"),{fn:{vertices:[],indices:[]},dn:[]}
739
- o=this.vn(t),s&&(h=o)}const a=this.mn(o,"triangles")
740
- return a?{fn:{vertices:a.vertices,indices:a.indices||[]},dn:h,xn:e}:(st.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{fn:{vertices:[],indices:[]},dn:h})}wn(t,e,i,s){const n=!i&&!e
947
+ n?(o=this.aa(t,!0),(e||s)&&(r=this.aa(t))):(r=this.aa(t),o=r)
948
+ let h=s?n?o:r??this.aa(t):[]
949
+ if(e){const t=this.la(r,"boundary")
950
+ if(!t)return nt.warn("libtess returned empty result from boundary pass"),{sa:{vertices:[],indices:[]},na:[]}
951
+ o=this.ca(t),s&&(h=o)}const a=this.la(o,"triangles")
952
+ return a?{sa:{vertices:a.vertices,indices:a.indices||[]},na:h,ua:e}:(nt.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{sa:{vertices:[],indices:[]},na:h})}ha(t,e,i,s){const n=!i&&!e
741
953
  let r,o
742
- n?(o=this.An(t),(e||s)&&(r=t)):(r=t,o=t)
954
+ n?(o=this.fa(t),(e||s)&&(r=t)):(r=t,o=t)
743
955
  let h=s?n?o:r??t:[]
744
- if(e){const t=this.mn(r,"boundary")
745
- if(!t)return st.warn("libtess returned empty result from boundary pass"),{fn:{vertices:[],indices:[]},dn:[]}
746
- o=this.vn(t),s&&(h=o)}const a=this.mn(o,"triangles")
747
- return a?{fn:{vertices:a.vertices,indices:a.indices||[]},dn:h,xn:e}:(st.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{fn:{vertices:[],indices:[]},dn:h})}gn(t,e=!1){const i=Array(t.length)
956
+ if(e){const t=this.la(r,"boundary")
957
+ if(!t)return nt.warn("libtess returned empty result from boundary pass"),{sa:{vertices:[],indices:[]},na:[]}
958
+ o=this.ca(t),s&&(h=o)}const a=this.la(o,"triangles")
959
+ return a?{sa:{vertices:a.vertices,indices:a.indices||[]},na:h,ua:e}:(nt.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{sa:{vertices:[],indices:[]},na:h})}aa(t,e=!1){const i=Array(t.length)
748
960
  for(let s=0;t.length>s;s++){const n=t[s].points,r=n.length,o=r>1&&n[0].x===n[r-1].x&&n[0].y===n[r-1].y?r-1:r,h=Array(2*(o+1))
749
961
  let a=0
750
962
  if(e)for(let t=o-1;t>=0;t--){const e=n[t]
751
963
  h[a++]=e.x,h[a++]=e.y}else for(let t=0;o>t;t++){const e=n[t]
752
- h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[s]=h}return i}An(t){const e=Array(t.length)
753
- for(let i=0;t.length>i;i++)e[i]=this.bn(t[i])
754
- return e}bn(t){const e=t.length
964
+ h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[s]=h}return i}fa(t){const e=Array(t.length)
965
+ for(let i=0;t.length>i;i++)e[i]=this.da(t[i])
966
+ return e}da(t){const e=t.length
755
967
  if(0===e)return[]
756
968
  const i=4>e||t[0]!==t[e-2]||t[1]!==t[e-1]?e:e-2
757
969
  if(0===i)return[]
758
970
  const s=Array(i+2)
759
971
  let n=0
760
972
  for(let e=i-2;e>=0;e-=2)s[n++]=t[e],s[n++]=t[e+1]
761
- return 2>n||(s[n++]=s[0],s[n++]=s[1]),s}mn(t,e){const i=new Ae
762
- i.Ks(te.WINDING_RULE,Qt.NONZERO)
973
+ return 2>n||(s[n++]=s[0],s[n++]=s[1]),s}la(t,e){const i=new De
974
+ i.jh(ye.WINDING_RULE,fe.NONZERO)
763
975
  const s=[],n=[],r=[]
764
976
  let o=[]
765
- "boundary"===e&&i.Ks(te.BOUNDARY_ONLY,1),"triangles"===e?i.Ys(te.VERTEX_DATA,t=>{n.push(t)}):(i.Ys(te.BEGIN,()=>{o=[]}),i.Ys(te.VERTEX_DATA,t=>{o.push(t)}),i.Ys(te.END,()=>{o.length>0&&r.push(o)})),i.Ys(te.COMBINE,t=>{const e=s.length/2
766
- return s.push(t[0],t[1]),e}),i.Ys(te.ERROR,t=>{st.warn("libtess error: "+t)}),i.Zs(0,0,1),i.en()
767
- for(const e of t){i.sn()
977
+ "boundary"===e&&i.jh(ye.BOUNDARY_ONLY,1),"triangles"===e?i.zh(ye.VERTEX_DATA,t=>{n.push(t)}):(i.zh(ye.BEGIN,()=>{o=[]}),i.zh(ye.VERTEX_DATA,t=>{o.push(t)}),i.zh(ye.END,()=>{o.length>0&&r.push(o)})),i.zh(ye.COMBINE,t=>{const e=s.length/2
978
+ return s.push(t[0],t[1]),e}),i.zh(ye.ERROR,t=>{nt.warn("libtess error: "+t)}),i.Hh(0,0,1),i.Yh()
979
+ for(const e of t){i.Jh()
768
980
  for(let t=0;e.length>t;t+=2){const n=s.length/2
769
- s.push(e[t],e[t+1]),i.an([e[t],e[t+1]],n)}i.nn()}return i.rn(),0===s.length?null:"triangles"===e?{vertices:s,indices:n}:{vertices:s,En:r}}vn(t){if(!t.En)return[]
981
+ s.push(e[t],e[t+1]),i.Zh([e[t],e[t+1]],n)}i.Kh()}return i.Xh(),0===s.length?null:"triangles"===e?{vertices:s,indices:n}:{vertices:s,ya:r}}ca(t){if(!t.ya)return[]
770
982
  const e=[]
771
- for(const i of t.En){const s=[]
983
+ for(const i of t.ya){const s=[]
772
984
  for(const e of i){const i=2*e
773
- s.push(t.vertices[i],t.vertices[i+1])}s.length>2&&(s[0]===s[s.length-2]&&s[1]===s[s.length-1]||s.push(s[0],s[1])),e.push(s)}return e}Tn(t){if(0===t.length)return!1
985
+ s.push(t.vertices[i],t.vertices[i+1])}s.length>2&&(s[0]===s[s.length-2]&&s[1]===s[s.length-1]||s.push(s[0],s[1])),e.push(s)}return e}pa(t){if(0===t.length)return!1
774
986
  if(1===t.length)return!1
775
987
  let e=null
776
- for(const i of t){const t=0>this.In(i)?-1:1
988
+ for(const i of t){const t=0>this.wa(i)?-1:1
777
989
  if(null===e)e=t
778
- else if(t!==e)return!0}return!1}In(t){let e=0
990
+ else if(t!==e)return!0}return!1}wa(t){let e=0
779
991
  const i=t.length
780
992
  if(6>i)return 0
781
993
  for(let s=0;i>s;s+=2)e+=t[s]*t[(s+3)%i]-t[(s+2)%i]*t[s+1]
782
- return e/2}}class Ee{constructor(){}Sn(t,e=0,i){const s=t.fn.vertices,n=t.fn.indices,r=t.dn,o=s.length,h=o/2
994
+ return e/2}}class Pe{constructor(){}ga(t,e=0,i){const s=t.sa.vertices,n=t.sa.indices,r=t.na,o=s.length,h=o/2
783
995
  let a=[],l=0,c=!1
784
- if(0!==e)if(!0===t.xn&&r.length>0){c=!0
996
+ if(0!==e)if(!0===t.ua&&r.length>0){c=!0
785
997
  for(const t of r){const e=t.length>>1
786
998
  2>e||(l+=e-1)}}else{const t=new Map,e=n.length
787
999
  for(let i=0;e>i;i+=3){const e=n[i],s=n[i+1],r=n[i+2]
@@ -813,399 +1025,229 @@ if(p>1e-10){const t=1/Math.sqrt(p)
813
1025
  g=u*t,m=-c*t}const A=3*v
814
1026
  f[A]=r,f[A+1]=o,f[A+2]=0,f[A+3]=h,f[A+4]=l,f[A+5]=0,f[A+6]=r,f[A+7]=o,f[A+8]=w,f[A+9]=h,f[A+10]=l,f[A+11]=w,d[A]=g,d[A+1]=m,d[A+2]=0,d[A+3]=g,d[A+4]=m,d[A+5]=0,d[A+6]=g,d[A+7]=m,d[A+8]=0,d[A+9]=g,d[A+10]=m,d[A+11]=0
815
1027
  const b=v
816
- y[x]=b,y[x+1]=b+1,y[x+2]=b+2,y[x+3]=b+1,y[x+4]=b+3,y[x+5]=b+2,x+=6,v+=4}return{vertices:f,normals:d,indices:y}}}class Te{constructor(){}Fn(t,e){const i=t.length
817
- return 0===i?[]:1===i?[[0]]:this.Mn(t,e)}Mn(t,e){function i(t){return a[t]===t?t:a[t]=i(a[t])}function s(t,e){const s=i(t),n=i(e)
1028
+ y[x]=b,y[x+1]=b+1,y[x+2]=b+2,y[x+3]=b+1,y[x+4]=b+3,y[x+5]=b+2,x+=6,v+=4}return{vertices:f,normals:d,indices:y}}}class $e{constructor(){}ma(t,e){const i=t.length
1029
+ return 0===i?[]:1===i?[[0]]:this.va(t,e)}va(t,e){function i(t){return a[t]===t?t:a[t]=i(a[t])}function s(t,e){const s=i(t),n=i(e)
818
1030
  s!==n&&(l[n]>l[s]?a[s]=n:l[s]>l[n]?a[n]=s:(a[n]=s,l[s]++))}const n=t.length,r=Array(n),o=Array(2*n)
819
1031
  let h=0
820
- for(let i=0;n>i;i++)r[i]=this._n(t[i],e[i]),o[h++]=[r[i].On,0,i],o[h++]=[r[i].Cn,1,i]
1032
+ for(let i=0;n>i;i++)r[i]=this.xa(t[i],e[i]),o[h++]=[r[i].Aa,0,i],o[h++]=[r[i].ba,1,i]
821
1033
  o.sort((t,e)=>t[0]-e[0]||t[1]-e[1])
822
1034
  const a=Array.from({length:n},(t,e)=>e),l=Array(n).fill(0),c=new Set
823
1035
  for(const[,t,e]of o)if(0===t){const t=r[e]
824
1036
  for(const i of c){const n=r[i]
825
- n.kn+.001>t.Bn&&t.kn>n.Bn-.001&&s(e,i)}c.add(e)}else c.delete(e)
1037
+ n.Ea+.001>t.Ta&&t.Ea>n.Ta-.001&&s(e,i)}c.add(e)}else c.delete(e)
826
1038
  const u=new Map
827
1039
  for(let t=0;n>t;t++){const e=i(t)
828
1040
  let s=u.get(e)
829
- s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}_n(t,e){return{On:t.bounds.min.x+e.x,Bn:t.bounds.min.y+e.y,Cn:t.bounds.max.x+e.x,kn:t.bounds.max.y+e.y}}}const Ie={enabled:!0,areaThreshold:1}
830
- let Se=1024,Fe=new Float64Array(Se),Me=new Float64Array(Se),_e=new Float64Array(Se),Oe=new Int32Array(Se),Ce=new Int32Array(Se),ke=new Int32Array(Se),Be=new Int32Array(Se)
831
- class Le{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}Ln(t){this.config=t}Dn(t){const e=t.points,i=e.length
1041
+ s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}xa(t,e){return{Aa:t.bounds.min.x+e.x,Ta:t.bounds.min.y+e.y,ba:t.bounds.max.x+e.x,Ea:t.bounds.max.y+e.y}}}const Ge={enabled:!0,areaThreshold:1}
1042
+ let Re=1024,ze=new Float64Array(Re),We=new Float64Array(Re),je=new Float64Array(Re),Ue=new Int32Array(Re),Ve=new Int32Array(Re),He=new Int32Array(Re),qe=new Int32Array(Re)
1043
+ class Ye{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}Ia(t){this.config=t}Sa(t){const e=t.points,i=e.length
832
1044
  if(5>i||!this.config.enabled)return this.config.enabled&&(this.stats.originalPointCount+=i),t
833
1045
  this.stats.originalPointCount+=i
834
- const s=((t,e,i)=>{if(3>=e)return 0;(t=>{if(t>Se){for(Se=1;t>Se;)Se<<=1
835
- Fe=new Float64Array(Se),Me=new Float64Array(Se),_e=new Float64Array(Se),Oe=new Int32Array(Se),Ce=new Int32Array(Se),ke=new Int32Array(Se),Be=new Int32Array(Se)}})(e)
836
- const s=Fe,n=Me,r=_e,o=Oe,h=Ce,a=ke,l=Be
1046
+ const s=((t,e,i)=>{if(3>=e)return 0;(t=>{if(t>Re){for(Re=1;t>Re;)Re<<=1
1047
+ ze=new Float64Array(Re),We=new Float64Array(Re),je=new Float64Array(Re),Ue=new Int32Array(Re),Ve=new Int32Array(Re),He=new Int32Array(Re),qe=new Int32Array(Re)}})(e)
1048
+ const s=ze,n=We,r=je,o=Ue,h=Ve,a=He,l=qe
837
1049
  for(let i=0;e>i;i++){const e=t[i]
838
1050
  s[i]=e.x,n[i]=e.y,o[i]=i-1,h[i]=i+1}h[e-1]=-1
839
1051
  const c=e-2
840
1052
  r[0]=1/0,r[e-1]=1/0
841
- for(let t=1;e-1>t;t++)r[t]=Y(s,n,t-1,t,t+1),a[t-1]=t,l[t]=t-1
1053
+ for(let t=1;e-1>t;t++)r[t]=X(s,n,t-1,t,t+1),a[t-1]=t,l[t]=t-1
842
1054
  l[0]=-1,l[e-1]=-1
843
1055
  let u=c
844
- for(let t=(u>>1)-1;t>=0;t--)q(a,l,r,t,u)
1056
+ for(let t=(u>>1)-1;t>=0;t--)K(a,l,r,t,u)
845
1057
  const f=2*i,d=e-3
846
1058
  let y=0
847
1059
  for(;u>0&&d>y;){const t=a[0]
848
1060
  if(r[t]>f)break
849
1061
  if(u--,u>0){const t=a[u]
850
- a[0]=t,l[t]=0,q(a,l,r,0,u)}l[t]=-1
1062
+ a[0]=t,l[t]=0,K(a,l,r,0,u)}l[t]=-1
851
1063
  const e=o[t],i=h[t]
852
- if(0>e||(h[e]=i),0>i||(o[i]=e),y++,e>=0&&o[e]>=0){const t=r[e],h=Y(s,n,o[e],e,i)
1064
+ if(0>e||(h[e]=i),0>i||(o[i]=e),y++,e>=0&&o[e]>=0){const t=r[e],h=X(s,n,o[e],e,i)
853
1065
  r[e]=h
854
1066
  const c=l[e]
855
- 0>c||(t>h?H(a,l,r,c):h>t&&q(a,l,r,c,u))}if(i>=0&&h[i]>=0){const t=r[i],o=Y(s,n,e,i,h[i])
1067
+ 0>c||(t>h?J(a,l,r,c):h>t&&K(a,l,r,c,u))}if(i>=0&&h[i]>=0){const t=r[i],o=X(s,n,e,i,h[i])
856
1068
  r[i]=o
857
1069
  const c=l[i]
858
- 0>c||(t>o?H(a,l,r,c):o>t&&q(a,l,r,c,u))}}return y})(e,i,this.config.areaThreshold)
1070
+ 0>c||(t>o?J(a,l,r,c):o>t&&K(a,l,r,c,u))}}return y})(e,i,this.config.areaThreshold)
859
1071
  if(0===s)return t
860
1072
  this.stats.pointsRemovedByVisvalingam+=s
861
1073
  const n=Array(i-s)
862
1074
  let r=0,o=0
863
- for(;r>=0;)n[o++]=e[r],r=Ce[r]
864
- return{...t,points:n}}getStats(){return{...this.stats}}Nn(){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0}}}const De={distanceTolerance:.5,angleTolerance:.2,Pn:0,$n:1e-6,Gn:16},Ne=De.$n
865
- let Pe,$e=0,Ge=0,ze=0,Re=0,We=0,je=0,Ue=0
866
- class Ve{constructor(t){this.curveSteps=null,this.zn=0,this.Rn=0,this.Wn=0,this.jn=0,this.Un=0,this.Vn=0,this.Hn=0,this.qn={...De,...t},this.Yn()}Jn(t){this.qn={...De,...t},this.Yn()}Yn(){const t=this.qn,e=t.distanceTolerance??De.distanceTolerance
867
- this.zn=e*e,this.Rn=t.angleTolerance??De.angleTolerance,this.Wn=this.Rn>0?Math.tan(this.Rn)**2:0,this.jn=t.Pn??0,this.Un=this.jn>0?Math.tan(this.jn)**2:0,this.Vn=t.$n??De.$n,this.Hn=t.Gn??De.Gn}Kn(){$e=this.zn,Re=this.Rn,We=this.Wn,je=this.jn,Ue=this.Un,Ge=this.Vn,ze=this.Hn,Pe=[]}Xn(t){if(null==t)return void(this.curveSteps=null)
1075
+ for(;r>=0;)n[o++]=e[r],r=Ve[r]
1076
+ return{...t,points:n}}getStats(){return{...this.stats}}Fa(){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0}}}const Je={distanceTolerance:.5,angleTolerance:.2,Ma:0,_a:1e-6,Oa:16},Ke=Je._a
1077
+ let Xe,Qe=0,Ze=0,ti=0,ei=0,ii=0,si=0,ni=0
1078
+ class ri{constructor(t){this.curveSteps=null,this.Ca=0,this.ka=0,this.La=0,this.Ba=0,this.Da=0,this.Na=0,this.Pa=0,this.$a={...Je,...t},this.Ga()}Ra(t){this.$a={...Je,...t},this.Ga()}Ga(){const t=this.$a,e=t.distanceTolerance??Je.distanceTolerance
1079
+ this.Ca=e*e,this.ka=t.angleTolerance??Je.angleTolerance,this.La=this.ka>0?Math.tan(this.ka)**2:0,this.Ba=t.Ma??0,this.Da=this.Ba>0?Math.tan(this.Ba)**2:0,this.Na=t._a??Je._a,this.Pa=t.Oa??Je.Oa}za(){Qe=this.Ca,ei=this.ka,ii=this.La,si=this.Ba,ni=this.Da,Ze=this.Na,ti=this.Pa,Xe=[]}Wa(t){if(null==t)return void(this.curveSteps=null)
868
1080
  if(!Number.isFinite(t))return void(this.curveSteps=null)
869
1081
  const e=Math.round(t)
870
- this.curveSteps=1>e?null:e}Qn(t,e,i){return null!==this.curveSteps?this.Zn(t,e,i,this.curveSteps):(this.Kn(),K(t.x,t.y,e.x,e.y,i.x,i.y,0),J(i.x,i.y),Pe)}tr(t,e,i,s){return null!==this.curveSteps?this.er(t,e,i,s,this.curveSteps):(this.Kn(),((t,e,i,s,n,r,o,h)=>{const a=.5*(t+i),l=.5*(e+s),c=.5*(i+n),u=.5*(s+r),f=.5*(n+o),d=.5*(r+h),y=.5*(a+c),p=.5*(l+u),w=.5*(c+f),g=.5*(u+d),m=.5*(y+w),v=.5*(p+g)
871
- X(t,e,a,l,y,p,m,v,1),X(m,v,w,g,f,d,o,h,1)})(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y),J(s.x,s.y),Pe)}Zn(t,e,i,s){this.Kn()
1082
+ this.curveSteps=1>e?null:e}ja(t,e,i){return null!==this.curveSteps?this.Ua(t,e,i,this.curveSteps):(this.za(),Z(t.x,t.y,e.x,e.y,i.x,i.y,0),Q(i.x,i.y),Xe)}Va(t,e,i,s){return null!==this.curveSteps?this.Ha(t,e,i,s,this.curveSteps):(this.za(),((t,e,i,s,n,r,o,h)=>{const a=.5*(t+i),l=.5*(e+s),c=.5*(i+n),u=.5*(s+r),f=.5*(n+o),d=.5*(r+h),y=.5*(a+c),p=.5*(l+u),w=.5*(c+f),g=.5*(u+d),m=.5*(y+w),v=.5*(p+g)
1083
+ tt(t,e,a,l,y,p,m,v,1),tt(m,v,w,g,f,d,o,h,1)})(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y),Q(s.x,s.y),Xe)}Ua(t,e,i,s){this.za()
872
1084
  for(let n=1;s>=n;n++){const r=n/s,o=t.x+(e.x-t.x)*r,h=t.y+(e.y-t.y)*r
873
- J(o+(e.x+(i.x-e.x)*r-o)*r,h+(e.y+(i.y-e.y)*r-h)*r)}return Pe}er(t,e,i,s,n){this.Kn()
1085
+ Q(o+(e.x+(i.x-e.x)*r-o)*r,h+(e.y+(i.y-e.y)*r-h)*r)}return Xe}Ha(t,e,i,s,n){this.za()
874
1086
  for(let r=1;n>=r;r++){const o=r/n,h=t.x+(e.x-t.x)*o,a=t.y+(e.y-t.y)*o,l=e.x+(i.x-e.x)*o,c=e.y+(i.y-e.y)*o,u=h+(l-h)*o,f=a+(c-a)*o
875
- J(u+(l+(i.x+(s.x-i.x)*o-l)*o-u)*o,f+(c+(i.y+(s.y-i.y)*o-c)*o-f)*o)}return Pe}}class He{constructor(t,e){this.ir=0,this.sr=0,this.nr=[],this.rr=null,this.hr=null,this.ar={min:new Vt(1/0,1/0),max:new Vt(-1/0,-1/0)},this.lr=[],this.cr=[],this.ur=[],this.dr=new Vt(0,0),this.yr=new Ve(t),this.pr=new Le({...Ie,...e})}setPosition(t,e){this.dr.set(t,e)}wr(t,e){this.dr.x+=t,this.dr.y+=e}gr(t,e){this.nr.length>0&&this.mr(),this.ir=t,this.sr=e,this.nr=[],this.ar.min.set(1/0,1/0),this.ar.max.set(-1/0,-1/0),this.cr.push(this.dr.clone())}mr(){this.rr&&this.vr(),this.nr.length>0&&(this.lr.push({Ar:this.ir,br:this.nr,bounds:{min:{x:this.ar.min.x,y:this.ar.min.y},max:{x:this.ar.max.x,y:this.ar.max.y}}}),this.ur.push(this.sr)),this.nr=[]}Er(t,e){this.rr&&this.vr(),this.hr=new Vt(t,e),this.Tr(this.hr),this.rr={points:[this.hr],glyphIndex:this.ir}}Ir(t,e){if(!this.rr||!this.hr)return
876
- const i=new Vt(t,e)
877
- this.Tr(i),this.rr.points.push(i),this.hr=i}Sr(t,e,i,s){if(!this.rr||!this.hr)return
878
- const n=this.hr,r=new Vt(t,e),o=new Vt(i,s)
879
- if(Ne>Math.abs((r.x-o.x)*(o.y-n.y)-(r.y-o.y)*(o.x-n.x)))return void this.Ir(i,s)
880
- const h=this.yr.Qn(n,r,o)
1087
+ Q(u+(l+(i.x+(s.x-i.x)*o-l)*o-u)*o,f+(c+(i.y+(s.y-i.y)*o-c)*o-f)*o)}return Xe}}class oi{constructor(t,e){this.qa=0,this.Ya=0,this.Ja=[],this.Ka=null,this.Xa=null,this.Qa={min:new Ht(1/0,1/0),max:new Ht(-1/0,-1/0)},this.Za=[],this.tl=[],this.el=[],this.il=new Ht(0,0),this.sl=new ri(t),this.nl=new Ye({...Ge,...e})}setPosition(t,e){this.il.set(t,e)}rl(t,e){this.il.x+=t,this.il.y+=e}ol(t,e){this.Ja.length>0&&this.hl(),this.qa=t,this.Ya=e,this.Ja=[],this.Qa.min.set(1/0,1/0),this.Qa.max.set(-1/0,-1/0),this.tl.push(this.il.clone())}hl(){this.Ka&&this.al(),this.Ja.length>0&&(this.Za.push({ll:this.qa,cl:this.Ja,bounds:{min:{x:this.Qa.min.x,y:this.Qa.min.y},max:{x:this.Qa.max.x,y:this.Qa.max.y}}}),this.el.push(this.Ya)),this.Ja=[]}ul(t,e){this.Ka&&this.al(),this.Xa=new Ht(t,e),this.fl(this.Xa),this.Ka={points:[this.Xa],glyphIndex:this.qa}}dl(t,e){if(!this.Ka||!this.Xa)return
1088
+ const i=new Ht(t,e)
1089
+ this.fl(i),this.Ka.points.push(i),this.Xa=i}yl(t,e,i,s){if(!this.Ka||!this.Xa)return
1090
+ const n=this.Xa,r=new Ht(t,e),o=new Ht(i,s)
1091
+ if(Ke>Math.abs((r.x-o.x)*(o.y-n.y)-(r.y-o.y)*(o.x-n.x)))return void this.dl(i,s)
1092
+ const h=this.sl.ja(n,r,o)
881
1093
  for(let t=0;h.length>t;t++){const e=h[t]
882
- this.Tr(e),this.rr.points.push(e)}this.hr=o}Fr(t,e,i,s,n,r){if(!this.rr||!this.hr)return
883
- const o=this.hr,h=new Vt(t,e),a=new Vt(i,s),l=new Vt(n,r),c=l.x-o.x,u=l.y-o.y
884
- if(Ne>Math.abs((h.x-l.x)*u-(h.y-l.y)*c)&&Ne>Math.abs((a.x-l.x)*u-(a.y-l.y)*c))return void this.Ir(n,r)
885
- const f=this.yr.tr(o,h,a,l)
1094
+ this.fl(e),this.Ka.points.push(e)}this.Xa=o}pl(t,e,i,s,n,r){if(!this.Ka||!this.Xa)return
1095
+ const o=this.Xa,h=new Ht(t,e),a=new Ht(i,s),l=new Ht(n,r),c=l.x-o.x,u=l.y-o.y
1096
+ if(Ke>Math.abs((h.x-l.x)*u-(h.y-l.y)*c)&&Ke>Math.abs((a.x-l.x)*u-(a.y-l.y)*c))return void this.dl(n,r)
1097
+ const f=this.sl.Va(o,h,a,l)
886
1098
  for(let t=0;f.length>t;t++){const e=f[t]
887
- this.Tr(e),this.rr.points.push(e)}this.hr=l}Mr(){if(!this.rr||!this.hr)return
888
- const t=this.rr.points[0]
889
- this.hr.equals(t)||this.rr.points.push(t),this.vr()}vr(){if(this.rr){const t=this.pr.Dn(this.rr)
890
- this.nr.push(t),this.rr=null,this.hr=null}}Tr(t){this.ar.min.x=Math.min(this.ar.min.x,t.x),this.ar.min.y=Math.min(this.ar.min.y,t.y),this.ar.max.x=Math.max(this.ar.max.x,t.x),this.ar.max.y=Math.max(this.ar.max.y,t.y)}_r(){return this.nr.length>0&&this.mr(),this.lr}Or(){return this.cr}Cr(){return this.ur}reset(){this.lr=[],this.cr=[],this.ur=[],this.nr=[],this.rr=null,this.hr=null,this.ir=0,this.sr=0,this.dr.set(0,0),this.ar={min:new Vt(1/0,1/0),max:new Vt(-1/0,-1/0)}}Jn(t){this.yr.Jn(t)}Xn(t){this.yr.Xn(t)}kr(t){this.pr.Ln({...Ie,...t})}Br(){return this.pr.getStats()}}class qe{constructor(){this.Lr=null,this.Dr=null,this.Nr=null,this.Pr=null,this.$r=null,this.Gr=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.zr&&this.zr.setPosition(t,e)}wr(t,e){this.position.x+=t,this.position.y+=e,this.zr&&this.zr.wr(t,e)}Rr(t){this.zr=t}Wr(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
891
- if(this.zr=e,this.Gr)return
1099
+ this.fl(e),this.Ka.points.push(e)}this.Xa=l}wl(){if(!this.Ka||!this.Xa)return
1100
+ const t=this.Ka.points[0]
1101
+ this.Xa.equals(t)||this.Ka.points.push(t),this.al()}al(){if(this.Ka){const t=this.nl.Sa(this.Ka)
1102
+ this.Ja.push(t),this.Ka=null,this.Xa=null}}fl(t){this.Qa.min.x=Math.min(this.Qa.min.x,t.x),this.Qa.min.y=Math.min(this.Qa.min.y,t.y),this.Qa.max.x=Math.max(this.Qa.max.x,t.x),this.Qa.max.y=Math.max(this.Qa.max.y,t.y)}gl(){return this.Ja.length>0&&this.hl(),this.Za}ml(){return this.tl}vl(){return this.el}reset(){this.Za=[],this.tl=[],this.el=[],this.Ja=[],this.Ka=null,this.Xa=null,this.qa=0,this.Ya=0,this.il.set(0,0),this.Qa={min:new Ht(1/0,1/0),max:new Ht(-1/0,-1/0)}}Ra(t){this.sl.Ra(t)}Wa(t){this.sl.Wa(t)}xl(t){this.nl.Ia({...Ge,...t})}Al(){return this.nl.getStats()}}class hi{constructor(){this.bl=null,this.El=null,this.Tl=null,this.Il=null,this.Sl=null,this.Fl=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.Ml&&this.Ml.setPosition(t,e)}rl(t,e){this.position.x+=t,this.position.y+=e,this.Ml&&this.Ml.rl(t,e)}_l(t){this.Ml=t}Ol(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
1103
+ if(this.Ml=e,this.Fl)return
892
1104
  const i=t.module
893
- this.Lr=i.jr((t,e,i,s,n)=>{this.zr?.Er(s,n)},"viiiffi"),this.Dr=i.jr((t,e,i,s,n)=>{this.zr?.Ir(s,n)},"viiiffi"),this.Nr=i.jr((t,e,i,s,n,r,o)=>{this.zr?.Sr(s,n,r,o)},"viiiffffi"),this.Pr=i.jr((t,e,i,s,n,r,o,h,a)=>{this.zr?.Fr(s,n,r,o,h,a)},"viiiffffffi"),this.$r=i.jr(()=>{this.zr?.Mr()},"viiii"),this.Gr=i.exports.Ur(),i.exports.Vr(this.Gr,this.Lr,0,0),i.exports.Hr(this.Gr,this.Dr,0,0),i.exports.qr(this.Gr,this.Nr,0,0),i.exports.Yr(this.Gr,this.Pr,0,0),i.exports.Jr(this.Gr,this.$r,0,0)}Kr(){if(!this.Gr)throw Error("Draw functions not initialized")
894
- return this.Gr}destroy(t){if(!t||!t.module||!t.hb)return
1105
+ this.bl=i.Bs((t,e,i,s,n)=>{this.Ml?.ul(s,n)},"viiiffi"),this.El=i.Bs((t,e,i,s,n)=>{this.Ml?.dl(s,n)},"viiiffi"),this.Tl=i.Bs((t,e,i,s,n,r,o)=>{this.Ml?.yl(s,n,r,o)},"viiiffffi"),this.Il=i.Bs((t,e,i,s,n,r,o,h,a)=>{this.Ml?.pl(s,n,r,o,h,a)},"viiiffffffi"),this.Sl=i.Bs(()=>{this.Ml?.wl()},"viiii"),this.Fl=i.exports.nr(),i.exports.Yn(this.Fl,this.bl,0,0),i.exports.Kn(this.Fl,this.El,0,0),i.exports.Qn(this.Fl,this.Tl,0,0),i.exports.tr(this.Fl,this.Il,0,0),i.exports.ir(this.Fl,this.Sl,0,0)}Cl(){if(!this.Fl)throw Error("Draw functions not initialized")
1106
+ return this.Fl}destroy(t){if(!t||!t.module||!t.hb)return
895
1107
  const e=t.module
896
- try{this.Gr&&(e.exports.Xr(this.Gr),this.Gr=0),null!==this.Lr&&(e.Qr(this.Lr),this.Lr=null),null!==this.Dr&&(e.Qr(this.Dr),this.Dr=null),null!==this.Nr&&(e.Qr(this.Nr),this.Nr=null),null!==this.Pr&&(e.Qr(this.Pr),this.Pr=null),null!==this.$r&&(e.Qr(this.$r),this.$r=null)}catch(t){st.warn("Error destroying draw callbacks:",t)}this.zr=void 0}}const Ye=new WeakMap
897
- class Je{constructor(t,e){this.Zr="default",this.eo="default",this.io=new Set,this.so=[],this.no=[],this.ro=[],this.cache=t,this.oi=e,this.tessellator=new be,this.oo=new Ee,this.ho=new Te,this.zr=new He,this.ao=(()=>{const t=this.oi.module,e=Ye.get(t)
898
- if(e)return e
899
- const i=new qe
900
- return Ye.set(t,i),i})(),this.ao.Wr(this.oi,this.zr),this.lo=Jt,this.co=Kt,this.uo=Xt}Br(){return this.zr.Br()}Jn(t){this.qn=t,this.zr.Jn(t),this.fo()}Xn(t){if(null==t)this.curveSteps=void 0
1108
+ try{this.Fl&&(e.exports.hr(this.Fl),this.Fl=0),null!==this.bl&&(e.Ds(this.bl),this.bl=null),null!==this.El&&(e.Ds(this.El),this.El=null),null!==this.Tl&&(e.Ds(this.Tl),this.Tl=null),null!==this.Il&&(e.Ds(this.Il),this.Il=null),null!==this.Sl&&(e.Ds(this.Sl),this.Sl=null)}catch(t){nt.warn("Error destroying draw callbacks:",t)}this.Ml=void 0}}const ai=new WeakMap
1109
+ class li{constructor(t,e){this.eh="default",this.kl="default",this.Ll=new Set,this.Bl=[],this.Dl=[],this.Nl=[],this.cache=t,this.oi=e,this.tessellator=new Ne,this.Pl=new Pe,this.$l=new $e,this.Ml=new oi,this.Gl=et(this.oi),this.Gl.Ol(this.oi,this.Ml),this.Rl=ae,this.zl=le,this.Wl=ce}Al(){return this.Ml.Al()}Ra(t){this.$a=t,this.Ml.Ra(t),this.jl()}Wa(t){if(null==t)this.curveSteps=void 0
901
1110
  else if(Number.isFinite(t)){const e=Math.round(t)
902
1111
  this.curveSteps=1>e?void 0:e}else this.curveSteps=void 0
903
- this.zr.Xn(this.curveSteps),this.fo()}kr(t){this.do=t,this.zr.kr(t),this.fo()}yo(t){this.Zr=t,this.fo()}fo(){this.eo=`${this.Zr}__${this.po()}`}po(){return[(()=>{if(void 0!==this.curveSteps)return"cf:steps:"+this.curveSteps
904
- const t=this.qn?.distanceTolerance??De.distanceTolerance,e=this.qn?.angleTolerance??De.angleTolerance
905
- return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.do?.enabled??1?1:0},${(this.do?.areaThreshold??1).toFixed(4)}`].join("|")}wo(t,e,i,n,r,o=!1,h){if(it){let e=0
906
- for(let i=0;t.length>i;i++)e+=t[i].length}const a=this.ro
1112
+ this.Ml.Wa(this.curveSteps),this.jl()}xl(t){this.Ul=t,this.Ml.xl(t),this.jl()}Vl(t){this.eh=t,this.jl()}jl(){this.kl=`${this.eh}__${this.Hl()}`}Hl(){return[(()=>{if(void 0!==this.curveSteps)return"cf:steps:"+this.curveSteps
1113
+ const t=this.$a?.distanceTolerance??Je.distanceTolerance,e=this.$a?.angleTolerance??Je.angleTolerance
1114
+ return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.Ul?.enabled??1?1:0},${(this.Ul?.areaThreshold??1).toFixed(4)}`].join("|")}ql(t,e,i,s,n,r=!1,h){if(st){let e=0
1115
+ for(let i=0;t.length>i;i++)e+=t[i].length}const a=this.Nl
907
1116
  a.length=0
908
1117
  let l=0,c=0,u=0,f=0,d=0
909
1118
  const y=(t,e,i,s)=>{const n=d
910
1119
  let r=a[l]
911
- return r?(r.data=t,r.px=e,r.mo=i,r.vo=s,r.xo=n):(r={data:t,px:e,mo:i,vo:s,xo:n},a[l]=r),l++,c+=t.vertices.length,u+=t.normals.length,f+=t.indices.length,d+=t.vertices.length/3,n},p=[],w={min:{x:1/0,y:1/0,z:0},max:{x:-1/0,y:-1/0,z:e}}
912
- for(let r=0;t.length>r;r++){const a=t[r]
913
- for(const t of a){const r=t.position.x,a=t.position.y,l=t.position.z,c=[]
914
- for(const e of t.glyphs)c.push(this.Ao(e.g))
1120
+ return r?(r.data=t,r.px=e,r.Yl=i,r.Jl=s,r.Kl=n):(r={data:t,px:e,Yl:i,Jl:s,Kl:n},a[l]=r),l++,c+=t.vertices.length,u+=t.normals.length,f+=t.indices.length,d+=t.vertices.length/3,n},p=[],w={min:{x:1/0,y:1/0,z:0},max:{x:-1/0,y:-1/0,z:e}}
1121
+ for(let n=0;t.length>n;n++){const a=t[n]
1122
+ for(const t of a){const n=t.position.x,a=t.position.y,l=t.position.z,c=[]
1123
+ for(const e of t.glyphs)c.push(this.Xl(e.g))
915
1124
  let u
916
- if(t.glyphs.length>1){const e=`${this.eo}_${t.text}`,i=this.uo.get(e)
1125
+ if(t.glyphs.length>1){const e=`${this.kl}_${t.text}`,i=this.Wl.get(e)
917
1126
  let s=!1
918
- if(i&&i.bo.length===t.glyphs.length){s=!0
919
- for(let e=0;t.glyphs.length>e;e++){const n=t.glyphs[e],r=i.Eo[e]
920
- if(i.bo[e]!==n.g||r.x!==(n.x??0)||r.y!==(n.y??0)){s=!1
1127
+ if(i&&i.Ql.length===t.glyphs.length){s=!0
1128
+ for(let e=0;t.glyphs.length>e;e++){const n=t.glyphs[e],r=i.Zl[e]
1129
+ if(i.Ql[e]!==n.g||r.x!==(n.x??0)||r.y!==(n.y??0)){s=!1
921
1130
  break}}}if(s&&i)u=i.groups
922
1131
  else{const i=t.glyphs.length
923
- if(i>this.so.length)for(let t=this.so.length;i>t;t++)this.so.push(new Ht(0,0,0))
924
- this.so.length=i
925
- for(let e=0;i>e;e++){const i=t.glyphs[e],s=this.so[e]
926
- s.x=i.x??0,s.y=i.y??0,s.z=0}u=this.ho.Fn(c,this.so),this.uo.set(e,{bo:t.glyphs.map(t=>t.g),Eo:t.glyphs.map(t=>({x:t.x??0,y:t.y??0})),groups:u})}}else u=[[0]]
927
- const f=o
1132
+ if(i>this.Bl.length)for(let t=this.Bl.length;i>t;t++)this.Bl.push(new qt(0,0,0))
1133
+ this.Bl.length=i
1134
+ for(let e=0;i>e;e++){const i=t.glyphs[e],s=this.Bl[e]
1135
+ s.x=i.x??0,s.y=i.y??0,s.z=0}u=this.$l.ma(c,this.Bl),this.Wl.set(e,{Ql:t.glyphs.map(t=>t.g),Zl:t.glyphs.map(t=>({x:t.x??0,y:t.y??0})),groups:u})}}else u=[[0]]
1136
+ const f=r
928
1137
  let d=u
929
1138
  if(h&&h.size>0){d=[]
930
1139
  for(const e of u)if(e.length>1){const i=[],s=[]
931
- for(const n of e)h.has(t.glyphs[n].To)?i.push(n):s.push(n)
932
- i.length>0&&d.push(i),s.length>0&&d.push(s)}else d.push(e)}for(const o of d)if(o.length>1&&!f){const s=o.map(e=>t.glyphs[e]),h=this.Io(s,e,i)
933
- let u=this.co.get(h)
934
- if(!u){const i=this.no
935
- let r=0
936
- const a=s[0].x??0,l=s[0].y??0
937
- for(let e=0;o.length>e;e++){const s=o[e],n=c[s],h=t.glyphs[s],u=(h.x??0)-a,f=(h.y??0)-l
938
- for(const t of n.br){const e=t.points,s=e.length
1140
+ for(const n of e)h.has(t.glyphs[n].Is)?i.push(n):s.push(n)
1141
+ i.length>0&&d.push(i),s.length>0&&d.push(s)}else d.push(e)}for(const r of d)if(r.length>1&&!f){const o=r.map(e=>t.glyphs[e]),h=this.tc(o,e,i)
1142
+ let u=this.zl.get(h)
1143
+ if(!u){const i=this.Dl
1144
+ let n=0
1145
+ const a=o[0].x??0,l=o[0].y??0
1146
+ for(let e=0;r.length>e;e++){const s=r[e],o=c[s],h=t.glyphs[s],u=(h.x??0)-a,f=(h.y??0)-l
1147
+ for(const t of o.cl){const e=t.points,s=e.length
939
1148
  if(3>s)continue
940
- const n=s>1&&e[0].x===e[s-1].x&&e[0].y===e[s-1].y?s-1:s,o=2*(n+1)
941
- let h=i[r]
942
- !h||o>h.length?(h=Array(o),i[r]=h):h.length=o
1149
+ const r=s>1&&e[0].x===e[s-1].x&&e[0].y===e[s-1].y?s-1:s,o=2*(r+1)
1150
+ let h=i[n]
1151
+ !h||o>h.length?(h=Array(o),i[n]=h):h.length=o
943
1152
  let a=0
944
- for(let t=0;n>t;t++){const i=e[t]
945
- h[a++]=i.x+u,h[a++]=i.y+f}2>a||(h[a++]=h[0],h[a++]=h[1]),r++}}i.length=r,u=this.So(i,e,n),this.co.set(h,u)}const f=s[0],d=y(u,r+(f.x??0),a+(f.y??0),l),g=u.vertices.length/3
946
- for(let i=0;o.length>i;i++){const s=o[i],n=t.glyphs[s],h=this.Fo(n,d,g,r+(n.x??0),a+(n.y??0),l,c[s],e)
947
- p.push(h),this.Mo(h.bounds,w)}}else for(const h of o){const o=t.glyphs[h],u=c[h],f=r+(o.x??0),d=a+(o.y??0),g=l
948
- if(0===u.br.length){const t=this.Fo(o,0,0,f,d,g,u,e)
1153
+ for(let t=0;r>t;t++){const i=e[t]
1154
+ h[a++]=i.x+u,h[a++]=i.y+f}2>a||(h[a++]=h[0],h[a++]=h[1]),n++}}i.length=n,u=this.ec(i,e,s),this.zl.set(h,u)}const f=o[0],d=y(u,n+(f.x??0),a+(f.y??0),l),g=u.vertices.length/3
1155
+ for(let i=0;r.length>i;i++){const s=r[i],o=t.glyphs[s],h=this.sc(o,d,g,n+(o.x??0),a+(o.y??0),l,c[s],e)
1156
+ p.push(h),this.nc(h.bounds,w)}}else for(const h of r){const r=t.glyphs[h],u=c[h],f=n+(r.x??0),d=a+(r.y??0),g=l
1157
+ if(0===u.cl.length){const t=this.sc(r,0,0,f,d,g,u,e)
949
1158
  p.push(t)
950
- continue}const m=s(this.eo,o.g,e,i)
1159
+ continue}const m=o(this.kl,r.g,e,i)
951
1160
  let v=this.cache.get(m)
952
- v?v._o++:(v=this.Oo(u,e,i,n),this.cache.set(m,v))
953
- const x=y(v,f,d,g),A=this.Fo(o,x,v.vertices.length/3,f,d,g,u,e)
954
- p.push(A),this.Mo(A.bounds,w)}}}a.length=l
1161
+ v?v.rc++:(v=this.oc(u,e,i,s),this.cache.set(m,v))
1162
+ const x=y(v,f,d,g),A=this.sc(r,x,v.vertices.length/3,f,d,g,u,e)
1163
+ p.push(A),this.nc(A.bounds,w)}}}a.length=l
955
1164
  const g=new Float32Array(c),m=new Float32Array(u),v=new Uint32Array(f)
956
1165
  let x=0,A=0,b=0
957
- for(let t=0;a.length>t;t++){const e=a[t],i=e.data.vertices,s=e.data.normals,n=e.data.indices,o=e.px*r,h=e.mo*r,l=e.vo*r,c=i.length
1166
+ for(let t=0;a.length>t;t++){const e=a[t],i=e.data.vertices,s=e.data.normals,r=e.data.indices,o=e.px*n,h=e.Yl*n,l=e.Jl*n,c=i.length
958
1167
  let u=x
959
- for(let t=0;c>t;t+=3)g[u]=i[t]*r+o,g[u+1]=i[t+1]*r+h,g[u+2]=i[t+2]*r+l,u+=3
1168
+ for(let t=0;c>t;t+=3)g[u]=i[t]*n+o,g[u+1]=i[t+1]*n+h,g[u+2]=i[t+2]*n+l,u+=3
960
1169
  x=u,m.set(s,A),A+=s.length
961
- const f=e.xo,d=n.length
1170
+ const f=e.Kl,d=r.length
962
1171
  let y=b
963
- for(let t=0;d>t;t++)v[y++]=n[t]+f
964
- b=y}w.min.x*=r,w.min.y*=r,w.min.z*=r,w.max.x*=r,w.max.y*=r,w.max.z*=r
965
- for(let t=0;p.length>t;t++)p[t].bounds.min.x*=r,p[t].bounds.min.y*=r,p[t].bounds.min.z*=r,p[t].bounds.max.x*=r,p[t].bounds.max.y*=r,p[t].bounds.max.z*=r
966
- return{vertices:g,normals:m,indices:v,Co:p,planeBounds:w}}Io(t,e,i){if(0===t.length)return""
1172
+ for(let t=0;d>t;t++)v[y++]=r[t]+f
1173
+ b=y}w.min.x*=n,w.min.y*=n,w.min.z*=n,w.max.x*=n,w.max.y*=n,w.max.z*=n
1174
+ for(let t=0;p.length>t;t++)p[t].bounds.min.x*=n,p[t].bounds.min.y*=n,p[t].bounds.min.z*=n,p[t].bounds.max.x*=n,p[t].bounds.max.y*=n,p[t].bounds.max.z*=n
1175
+ return{vertices:g,normals:m,indices:v,hc:p,planeBounds:w}}tc(t,e,i){if(0===t.length)return""
967
1176
  const s=t[0].x??0,n=t[0].y??0,r=t.map(t=>`${t.g}:${(t.x??0)-s},${(t.y??0)-n}`),o=r.join("|")
968
- return`${this.eo}_${o}_${Math.round(1e3*e)/1e3}_${i}`}Fo(t,e,i,s,n,r,o,h){return{ko:t.To,Bo:t.Bo,xo:e,Ss:i,bounds:{min:{x:o.bounds.min.x+s,y:o.bounds.min.y+n,z:r},max:{x:o.bounds.max.x+s,y:o.bounds.max.y+n,z:r+h}}}}Ao(t){if(this.io.has(t))return{Ar:t,br:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
969
- const e=`${this.eo}_${t}`,i=this.lo.get(e)
1177
+ return`${this.kl}_${o}_${Math.round(1e3*e)/1e3}_${i}`}sc(t,e,i,s,n,r,o,h){return{ac:t.Is,Ss:t.Ss,Kl:e,mh:i,bounds:{min:{x:o.bounds.min.x+s,y:o.bounds.min.y+n,z:r},max:{x:o.bounds.max.x+s,y:o.bounds.max.y+n,z:r+h}}}}Xl(t){if(this.Ll.has(t))return{ll:t,cl:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
1178
+ const e=`${this.kl}_${t}`,i=this.Rl.get(e)
970
1179
  if(i)return i
971
- this.ao.Rr(this.zr),this.zr.reset(),this.zr.gr(t,0),this.oi.module.exports.Lo(this.oi.font.Do,t,this.ao.Kr(),0),this.zr.mr()
972
- const s=this.zr._r()[0]||{Ar:t,br:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
973
- return 0===s.br.length&&this.io.add(t),this.lo.set(e,s),s}So(t,e,i){const s=this.tessellator.pn(t,!0,i,0!==e)
974
- return this.No(s,e)}No(t,e){const i=this.oo.Sn(t,e,this.oi.upem),s=i.vertices
1180
+ this.Gl._l(this.Ml),this.Ml.reset(),this.Ml.ol(t,0),this.oi.module.exports.Ar(this.oi.font.so,t,this.Gl.Cl(),0),this.Ml.hl()
1181
+ const s=this.Ml.gl()[0]||{ll:t,cl:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
1182
+ return 0===s.cl.length&&this.Ll.add(t),this.Rl.set(e,s),s}ec(t,e,i){const s=this.tessellator.oa(t,!0,i,0!==e)
1183
+ return this.lc(s,e)}lc(t,e){const i=this.Pl.ga(t,e,this.oi.upem),s=i.vertices
975
1184
  let n=1/0,r=1/0,o=1/0,h=-1/0,a=-1/0,l=-1/0
976
1185
  for(let t=0;s.length>t;t+=3){const e=s[t],i=s[t+1],c=s[t+2]
977
- n>e&&(n=e),e>h&&(h=e),r>i&&(r=i),i>a&&(a=i),o>c&&(o=c),c>l&&(l=c)}const c=new Ht(n,r,o),u=new Ht(h,a,l)
978
- return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},_o:1}}Oo(t,e,i,s){const n=this.tessellator.process(t.br,i,s,0!==e)
979
- return this.No(n,e)}Mo(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
980
- i.x>n.x&&(i.x=n.x),i.y>n.y&&(i.y=n.y),i.z>n.z&&(i.z=n.z),r.x>s.x&&(s.x=r.x),r.y>s.y&&(s.y=r.y),r.z>s.z&&(s.z=r.z)}Po(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.co.clear(),this.uo.clear(),this.lo.clear()}}class Ke{constructor(t,e){this.$o=new Map,this.oi=t,this.Go=e}zo(t,e,i,s,n,r,o){try{const r=[]
981
- return t.forEach((t,o)=>{const h=this.Ro(t,o,e,i,s,n)
982
- r.push(h)}),r}finally{}}Ro(e,i,s,n,r,o){const h=this.oi.hb.createBuffer()
983
- "rtl"===o&&h.Wo("rtl"),h.ii(e.text),h.si()
984
- const a=t(this.oi.ni)
985
- this.oi.hb.shape(this.oi.font,h,a)
986
- const l=h.json(this.oi.font)
987
- h.destroy()
988
- const c=[]
989
- let u=[],f=[],d=0,y=0,p=e.Ye,w=-i*s
990
- const g=n*this.oi.upem,m=this.jo(e,r,n),v=this.Uo(e,r),x=e.text,A=x.length,b=l.length
991
- let E
992
- for(let t=0;b>t;t++){const s=l[t],n=s.ri,r=x[n],o=r.charCodeAt(0),h=32===o||9===o||10===o||13===o
993
- s.To=e.Ke&&n===A-1&&"-"===r?e.qe:e.He+n,s.Bo=i,h&&u.length>0&&(c.push({text:f.join(""),glyphs:u,position:new Ht(d,y,0)}),u=[],f=[])
994
- const a=p+s.dx,T=w+s.dy
995
- if(h||(0===u.length&&(d=a,y=T),s.x=a-d,s.y=T-y,u.push(s),f.push(r)),p+=s.ax,w+=s.ay,0!==g&&b-1>t&&(p+=g),h&&(p+=m),0!==v&&b-1>t&&!h){const e=x[l[t+1].ri],i=void 0!==E?E:xt.fe(r)
996
- if(E=!!e&&xt.fe(e),i&&E){let t=!0
997
- xt.de(e)&&(t=!1),xt.ye(r)&&(t=!1),xt.pe(r)&&xt.pe(e)&&(t=!1),t&&(p+=v)}}else E=void 0}return u.length>0&&c.push({text:f.join(""),glyphs:u,position:new Ht(d,y,0)}),c}jo(t,e,i){let s=0
998
- if(void 0!==t.ei&&"justify"===e&&!t.Je){let e=this.$o.get(i)
999
- void 0===e&&(e=bt.measureTextWidth(this.oi," ",i),this.$o.set(i,e)),t.ei>0?s=t.ei*e*.5:0>t.ei&&(s=t.ei*e*ht)}return s}Uo(t,e){if(void 0===t.ei||"justify"!==e||t.Je)return 0
1000
- return t.ei>0||0>t.ei?.04*t.ei*this.oi.upem:0}clearCache(){this.Go.clearCache()}Po(){return this.Go.Po()}}var Xe={exports:{}},Qe=tt(Object.freeze({__proto__:null,default:{},it(...t){const e="undefined"!=typeof globalThis?globalThis.require:void 0
1001
- if("function"==typeof e)return e("fs").it(...t)
1002
- throw Error("fs not available in this environment")}}))
1003
- !(function(t){var e,i=(e="undefined"!=typeof document?document.currentScript?.src:void 0,async function(t={}){function i(){var t=g.buffer
1004
- n.HEAP8=new Int8Array(t),n.HEAPU8=m=new Uint8Array(t),n.HEAP32=new Int32Array(t),n.HEAPU32=new Uint32Array(t),n.HEAPF32=new Float32Array(t),new BigInt64Array(t),new BigUint64Array(t)}function s(t){n.Vo?.(t),x(t="Aborted("+t+")"),A=!0,t+=". Build with -sASSERTIONS for more info."
1005
- var e=new WebAssembly.RuntimeError(t)
1006
- throw w?.(e),e}var n=t,r="object"==typeof window,o="undefined"!=typeof WorkerGlobalScope,h="object"==typeof process&&process.versions?.node&&"renderer"!=process.type,a=(t,e)=>{throw e}
1007
- "undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href)
1008
- var l,c,u=""
1009
- if(h){var f=Qe
1010
- u="undefined"!=typeof __dirname?__dirname+"/":"",c=t=>(t=b(t)?new URL(t):t,f.it(t)),l=async(t,e=!0)=>(t=b(t)?new URL(t):t,f.it(t,e?void 0:"utf8")),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),a=(t,e)=>{throw process.exitCode=t,e}}else if(r||o){try{u=new URL(".",e).href}catch{}o&&(c=t=>{var e=new XMLHttpRequest
1011
- return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=async t=>{if(b(t))return new Promise((e,i)=>{var s=new XMLHttpRequest
1012
- s.open("GET",t,!0),s.responseType="arraybuffer",s.onload=()=>{200==s.status||0==s.status&&s.response?e(s.response):i(s.status)},s.onerror=i,s.send(null)})
1013
- var e=await fetch(t,{credentials:"same-origin"})
1014
- if(e.ok)return e.arrayBuffer()
1015
- throw Error(e.status+" : "+e.url)}}console.log.bind(console)
1016
- var d,y,p,w,g,m,v,x=console.error.bind(console),A=!1,b=t=>t.startsWith("file://"),E=!1,T=0,I=null
1017
- class S{name="ExitStatus"
1018
- constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var F,M,_,O=t=>{for(;t.length>0;)t.shift()(n)},C=[],k=t=>C.push(t),B=[],L=t=>B.push(t),D=!0,N=0,P={},$=t=>{if(t instanceof S||"unwind"==t)return y
1019
- a(1,t)},G=()=>D||N>0,z=t=>{y=t,G()||(n.Ho?.(t),A=!0),a(t,new S(t))},R=(t,e)=>Math.ceil(t/e)*e,W=t=>{var e=(t-g.buffer.byteLength+65535)/65536|0
1020
- try{return g.grow(e),i(),1}catch(t){}},j=t=>{const e=t.length
1021
- return[e%128|128,e>>7,...t]},U={o:127,_:127,q:126,f:125,d:124,e:111},V=t=>j(Array.from(t,t=>U[t])),H=t=>F.get(t),q=[],Y=(t,e)=>F.set(t,e)
1022
- n.qo&&(D=n.qo),n.Yo&&(x=n.Yo),n.Jo&&(d=n.Jo),n.Ko=g,n.Xo=K,n.jr=(t,e)=>{var i=(t=>(M||(M=new WeakMap,((t,e)=>{if(M)for(var i=0;0+e>i;i++){var s=H(i)
1023
- s&&M.set(s,i)}})(0,F.length)),M.get(t)||0))(t)
1024
- if(i)return i
1025
- var s=q.length?q.pop():F.grow(1)
1026
- try{Y(s,t)}catch(i){if(!(i instanceof TypeError))throw i
1027
- var n=((t,e)=>{var i=Uint8Array.of(0,97,115,109,1,0,0,0,1,...j([1,96,...V(e.slice(1)),...V("v"===e[0]?"":e[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),s=new WebAssembly.Module(i)
1028
- return new WebAssembly.Instance(s,{e:{f:t}}).exports.f})(t,e)
1029
- Y(s,n)}return M.set(t,s),s},n.Qr=t=>{M.delete(H(t)),Y(t,null),q.push(t)}
1030
- var J={Qo:()=>s(""),Zo(){D=!1,N=0},th(t,e){if(P[t]&&(clearTimeout(P[t].id),delete P[t]),!e)return 0
1031
- var i=setTimeout(()=>{delete P[t],(t=>{if(!A)try{t(),(()=>{if(!G())try{y=t=y,z(t)}catch(t){$(t)}var t})()}catch(t){$(t)}})(()=>_(t,performance.now()))},e)
1032
- return P[t]={id:i,eh:e},0},ih(t){var e=m.length,i=2147483648
1033
- if((t>>>=0)>i)return!1
1034
- for(var s=1;4>=s;s*=2){var n=e*(1+.2/s),r=Math.min(i,R(Math.max(t,n=Math.min(n,t+100663296)),65536))
1035
- if(W(r))return!0}return!1},sh:z},K=await(async()=>{function t(t){return n.Xo=K=t.exports,n.Ko=g=K.memory,i(),F=K.nh,(t=>{n.rh=t.oh,n.hh=t.ah,n.uh=t.fh,n.dh=t.yh,n.ph=t.wh,n.gh=t.mh,n.xh=t.Ah,n.bh=t.Eh,n.Th=t.Ih,n.Sh=t.Fh,n.Mh=t._h,n.Oh=t.Ch,n.kh=t.Bh,n.Lh=t.Dh,n.Nh=t.Ph,n.$h=t.Gh,n.zh=t.Rh,n.Wh=t.jh,n.Uh=t.Vh,n.Hh=t.qh,n.Yh=t.Jh,n.Kh=t.Xh,n.Qh=t.Zh,n.ta=t.ea,n.ia=t.sa,n.na=t.ra,n.oa=t.ha,n.aa=t.la,n.ca=t.Vr,n.ua=t.Hr,n.fa=t.qr,n.da=t.Yr,n.ya=t.Jr,n.pa=t.Ur,n.wa=t.Xr,n.ga=t.ma,n.va=t.xa,n.Aa=t.ba,n.Ea=t.Ta,n.Ia=t.Sa,n.Fa=t.Lo,n.Ma=t._a,n.Oa=t.Ca,n.ka=t.Ba,n.La=t.Da,n.Na=t.Pa,n.$a=t.Ga,n.za=t.Ra,n.Wa=t.ja,n.Ua=t.Va,n.Ha=t.qa,n.Ya=t.Ja,_=t.Ka})(K),(()=>{if(T--,n.Xa?.(T),0==T&&I){var t=I
1036
- I=null,t()}})(),K}T++,n.Xa?.(T)
1037
- var e,r={nt:J,Qa:J}
1038
- return n.Za?new Promise(e=>{n.Za(r,i=>{e(t(i))})}):(v??=(e="hb.wasm",n.tl?n.tl(e,u):u+e),t((await(async function(t,e,i){if(!t&&!b(e)&&!h)try{var n=fetch(e,{credentials:"same-origin"})
1039
- return await WebAssembly.instantiateStreaming(n,i)}catch(t){x("wasm streaming compile failed: "+t),x("falling back to ArrayBuffer instantiation")}return(async(t,e)=>{try{var i=await(async t=>{if(!d)try{var e=await l(t)
1040
- return new Uint8Array(e)}catch{}return(t=>{if(t==v&&d)return new Uint8Array(d)
1041
- if(c)return c(t)
1042
- throw"both async and sync fetching of the wasm failed"})(t)})(t)
1043
- return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,v,r)).el))})()
1044
- return(()=>{if(n.il)for("function"==typeof n.il&&(n.il=[n.il]);n.il.length>0;)n.il.shift()()})(),(function t(){function e(){n.sl=!0,A||(E=!0,K.nl(),p?.(n),n.rl?.(),(()=>{if(n.ol)for("function"==typeof n.ol&&(n.ol=[n.ol]);n.ol.length;)k(n.ol.shift())
1045
- O(C)})())}T>0?I=t:((()=>{if(n.hl)for("function"==typeof n.hl&&(n.hl=[n.hl]);n.hl.length;)L(n.hl.shift())
1046
- O(B)})(),T>0?I=t:n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e())})(),E?n:new Promise((t,e)=>{p=t,w=e})})
1047
- t.exports=i,t.exports.default=i})(Xe)
1048
- var Ze=Z(Xe.exports),ti={exports:{}}
1049
- try{ti.exports=t=>{function e(t){return(255&t.charCodeAt(0))<<24|(255&t.charCodeAt(1))<<16|(255&t.charCodeAt(2))<<8|255&t.charCodeAt(3)}function i(e){var i=n.ha(e.length+1)
1050
- for(let s=0;e.length>s;++s){const n=e.charCodeAt(s)
1051
- if(n>127)throw Error("Expected ASCII text")
1052
- t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{Do:i,length:e.length,la(){n.la(i)}}}function s(t,e,s){var r=0,o=0
1053
- s&&(s=s.split(","),r=n.ha(16*s.length),s.forEach(t=>{var e=i(t)
1054
- n.ra(e.Do,-1,r+16*o)&&o++,e.la()})),n.Ja(t.Do,e.Do,r,o),r&&n.la(r)}var n=t.Xo,r=new TextDecoder("utf8")
1055
- let o=t.jr,h=t.Qr
1056
- var a=o(t=>{n.la(t)},"vi"),l=e("JSON"),c="",u=n.ha(256)
1057
- return{Ki(e){var i=n.ha(e.byteLength)
1058
- t.HEAPU8.set(new Uint8Array(e),i)
1059
- var s=n.oh(i,e.byteLength,2,i,a)
1060
- return{Do:s,destroy(){n.ah(s)}}},Xi(i,s){var r=n.ma(i.Do,s)
1061
- const o=n.Ta(r)
1062
- return{Do:r,upem:o,al(i){var s=n.ba(r,e(i)),o=n.fh(s)
1063
- if(o){var h=n.yh(s,null)
1064
- return t.HEAPU8.subarray(h,h+o)}},ts(){var e=n.ha(2048),i=n.ha(4)
1065
- t.HEAPU32[i/4]=64,n.ja(r,0,i,e)
1066
- var s={}
1067
- return Array.from({length:t.HEAPU32[i/4]}).forEach((i,n)=>{var r
1068
- s[(r=t.HEAPU32[e/4+8*n+1],""+String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(255&r))]={min:t.HEAPF32[e/4+8*n+4],default:t.HEAPF32[e/4+8*n+5],max:t.HEAPF32[e/4+8*n+6]}}),n.la(i),n.la(e),s},ll(){var e=n.Ga()
1069
- n.Sa(r,e)
1070
- var i=(e=>{const i=n.Va(e),s=n.ha(i<<2),r=s>>2,o=t.HEAPU32.subarray(r,r+i)
1071
- return t.HEAPU32.set(o,r),n.qa(e,-1,s,i),o})(e)
1072
- return n.Ra(e),i},destroy(){n.xa(r)}}},Qi(i){function s(t){return l||(f=o((t,e,i,s,n)=>{c+=`M${s},${n}`},"viiiffi"),d=o((t,e,i,s,n)=>{c+=`L${s},${n}`},"viiiffi"),y=o((t,e,i,s,n,r,o,h,a)=>{c+=`C${s},${n} ${r},${o} ${h},${a}`},"viiiffffffi"),p=o((t,e,i,s,n,r,o)=>{c+=`Q${s},${n} ${r},${o}`},"viiiffffi"),w=o(()=>{c+="Z"},"viiii"),l=n.Ur(),n.Vr(l,f,0,0),n.Hr(l,d,0,0),n.Yr(l,y,0,0),n.qr(l,p,0,0),n.Jr(l,w,0,0)),c="",n.Lo(a,t,l,0),c}var a=n.Ca(i.Do),l=null,f=null,d=null,y=null,p=null,w=null
1073
- return{Do:a,cl(e){n._a(a,e,u,256)
1074
- var i=t.HEAPU8.subarray(u,u+256)
1075
- return r.decode(i.slice(0,i.indexOf(0)))},ul:s,fl:t=>s(t).replace(/([MLQCZ])/g,"|$1 ").split("|").filter(t=>t.length).map(t=>{var e=t.split(/[ ,]/g)
1076
- return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){n.Pa(a,t,e)},Zi(i){var s=Object.entries(i),r=n.ha(8*s.length)
1077
- s.forEach((i,s)=>{t.HEAPU32[r/4+2*s+0]=e(i[0]),t.HEAPF32[r/4+2*s+1]=i[1]}),n.Ba(a,r,s.length),n.la(r)},destroy(){n.Da(a),l&&(n.Xr(l),l=null,h(f),h(d),h(y),h(p),h(w))}}},createBuffer(){var e=n.mh()
1078
- return{Do:e,ii(i){const s=(e=>{const i=n.ha(2*e.length),s=new Uint16Array(t.Ko.buffer,i,e.length)
1079
- for(let t=0;s.length>t;++t)s[t]=e.charCodeAt(t)
1080
- return{Do:i,length:s.length,la(){n.la(i)}}})(i)
1081
- n.qh(e,s.Do,s.length,0,s.length),s.la()},si:()=>n.jh(e),Wo(t){n.Ih(e,{dl:4,yl:5,pl:6,wl:7}[t]||0)},gl(t){var i=0
1082
- t.forEach(t=>{i|=(t=>"BOT"==t?1:"EOT"==t?2:"PRESERVE_DEFAULT_IGNORABLES"==t?4:"REMOVE_DEFAULT_IGNORABLES"==t?8:"DO_NOT_INSERT_DOTTED_CIRCLE"==t?16:"PRODUCE_UNSAFE_TO_CONCAT"==t?64:0)(t)}),n.Ch(e,i)},ml(t){var s=i(t)
1083
- n._h(e,n.Xh(s.Do,-1)),s.la()},vl(t){var s=i(t)
1084
- n.Fh(e,n.Zh(s.Do,-1)),s.la()},xl(t){n.Bh(e,t)},json(){for(var i=n.Dh(e),s=[],r=n.Ph(e,0),o=r/4,h=n.Gh(e,0)/4,a=t.HEAPU32.subarray(o,o+5*i),l=t.HEAP32.subarray(h,h+5*i),c=0;i>c;++c)s.push({g:a[5*c+0],ri:a[5*c+2],ax:l[5*c+0],ay:l[5*c+1],dx:l[5*c+2],dy:l[5*c+3],flags:n.Rh(r+20*c)})
1085
- return s},destroy(){n.Ah(e)}}},shape:s,Al(e,i,a,c,u){var f=[],d=0,y=!1,p=1048576,w=n.ha(p),g=o((e,i,s)=>{var o=r.decode(t.HEAPU8.subarray(s,t.HEAPU8.indexOf(0,s)))
1086
- return o.startsWith("start table GSUB")?d=1:o.startsWith("start table GPOS")&&(d=2),d!=u&&(y=!1),0!=u&&d==u&&o.startsWith("end lookup "+c)&&(y=!0),y?0:(n.wh(e,0,n.Dh(e),w,p,0,i,l,4),f.push({k:o,i:JSON.parse(r.decode(t.HEAPU8.subarray(w,t.HEAPU8.indexOf(0,w)))),glyphs:2==n.Eh(e)}),1)},"iiiii")
1087
- return n.Jh(i.Do,g,0,0),s(e,i,a),n.la(w),h(g),f},version(){var e=n.ha(12)
1088
- n.ea(e,e+4,e+8)
1089
- var i={bl:t.HEAPU32[e/4],El:t.HEAPU32[(e+4)/4],Tl:t.HEAPU32[(e+8)/4]}
1090
- return n.la(e),i},Il(){var e=n.sa()
1091
- return r.decode(t.HEAPU8.subarray(e,t.HEAPU8.indexOf(0,e)))}}}}catch(h){}var ei=Z(ti.exports)
1092
- let ii=null,si=null,ni=null
1093
- const ri={Sl(t){si=t,ni=null,ii=null},Fl(t){ni=t,si=null,ii=null},Ml:async()=>ii||(ii=new Promise(async(t,e)=>{try{const e={}
1094
- if(ni)e.Jo=ni
1095
- else{if(!si)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
1096
- e.Jo=await Q(si)}const i=await Ze(e)
1097
- t({hb:ei(i),module:{jr:i.jr,exports:i.Xo,Qr:i.Qr}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),ii)}
1098
- class oi{constructor(t,e){this.text=t,this._l=new Map,e.forEach(t=>{const e=this._l.get(t.ko)||[]
1099
- e.push(t),this._l.set(t.ko,e)})}Ol(t){const e=[]
1100
- return t.Cl&&e.push(...this.kl(t.Cl)),t.Bl&&e.push(...this.Ll(t.Bl)),e}kl(t){const e=[]
1186
+ n>e&&(n=e),e>h&&(h=e),r>i&&(r=i),i>a&&(a=i),o>c&&(o=c),c>l&&(l=c)}const c=new qt(n,r,o),u=new qt(h,a,l)
1187
+ return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},rc:1}}oc(t,e,i,s){const n=this.tessellator.process(t.cl,i,s,0!==e)
1188
+ return this.lc(n,e)}nc(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
1189
+ i.x>n.x&&(i.x=n.x),i.y>n.y&&(i.y=n.y),i.z>n.z&&(i.z=n.z),r.x>s.x&&(s.x=r.x),r.y>s.y&&(s.y=r.y),r.z>s.z&&(s.z=r.z)}cc(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.zl.clear(),this.Wl.clear(),this.Rl.clear()}}class ci{constructor(t,e){this.text=t,this.uc=new Map,e.forEach(t=>{const e=this.uc.get(t.ac)||[]
1190
+ e.push(t),this.uc.set(t.ac,e)})}fc(t){const e=[]
1191
+ return t.dc&&e.push(...this.yc(t.dc)),t.wc&&e.push(...this.gc(t.wc)),e}yc(t){const e=[]
1101
1192
  for(const i of t){let t=0
1102
- for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}Ll(t){return t.map(t=>{const e=this.text.slice(t.start,t.end)
1193
+ for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}gc(t){return t.map(t=>{const e=this.text.slice(t.start,t.end)
1103
1194
  return this.createTextRange(t.start,t.end,e)})}createTextRange(t,e,i){const s=[],n=new Map
1104
- for(let i=t;e>i;i++){const t=this._l.get(i)
1195
+ for(let i=t;e>i;i++){const t=this.uc.get(i)
1105
1196
  if(t)for(const e of t){s.push(e)
1106
- const t=n.get(e.Bo)||[]
1107
- t.push(e),n.set(e.Bo,t)}}return{start:t,end:e,Dl:i,bounds:Array.from(n.values()).map(t=>this.Nl(t)),glyphs:s,Pl:Array.from(n.keys()).sort((t,e)=>t-e)}}Nl(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
1197
+ const t=n.get(e.Ss)||[]
1198
+ t.push(e),n.set(e.Ss,t)}}return{start:t,end:e,mc:i,bounds:Array.from(n.values()).map(t=>this.vc(t)),glyphs:s,xc:Array.from(n.keys()).sort((t,e)=>t-e)}}vc(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
1108
1199
  let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
1109
1200
  for(const h of t)e>h.bounds.min.x&&(e=h.bounds.min.x),i>h.bounds.min.y&&(i=h.bounds.min.y),s>h.bounds.min.z&&(s=h.bounds.min.z),h.bounds.max.x>n&&(n=h.bounds.max.x),h.bounds.max.y>r&&(r=h.bounds.max.y),h.bounds.max.z>o&&(o=h.bounds.max.z)
1110
- return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}const hi=72
1111
- class ai{static{this.$l=new Map}static{this.Gl=null}static{this.zl=new Map}static{this.Rl=0}static{this.Wl=1/0}static{this.jl=0}static Ul(t){(t=>{zt=t})(t)}static Vl(t){const e=Object.keys(t).sort()
1112
- let i=""
1113
- for(let s=0;e.length>s;s++)s>0&&(i+=","),i+=e[s]+":"+t[e[s]]
1114
- return i}constructor(){this.Hl="",ai.Gl||(ai.Gl=ri.Ml()),this.ql=new Wt(()=>ai.Gl)}static Yl(t){ri.Sl(t),ai.Gl=null}static Jl(t){ri.Fl(t),ai.Gl=null}static init(){return ai.Gl||(ai.Gl=ri.Ml()),ai.Gl}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
1115
- ai.Gl||(ai.Gl=ri.Ml())
1116
- const e=await ai.Kl(t),i=new ai
1117
- i.Xl(e)
1118
- const s=await i.Ql(t),n=async e=>{const s={...t}
1119
- for(const t in e){const i=e[t]
1120
- void 0!==i&&(s[t]=i)}if(void 0!==e.font||void 0!==e.es||void 0!==e.ni){const t=await ai.Kl(s)
1121
- i.Xl(t),i.Zl()}return t=s,{...await i.Ql(t),getLoadedFont(){return i.getLoadedFont()},getCacheSize(){return i.getCacheSize()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n}}
1122
- return{...s,getLoadedFont(){return i.getLoadedFont()},getCacheSize(){return i.getCacheSize()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n}}static async Kl(t){let e="string"==typeof t.font?t.font:"buffer-"+ai.tc(t.font)
1123
- t.es&&(e+="_var_"+ai.Vl(t.es)),t.ni&&(e+="_feat_"+ai.Vl(t.ni))
1124
- let i=ai.zl.get(e)
1125
- return i||(i=await ai.ec(e,t.font,t.es,t.ni)),i}static async ec(t,e,i,s){const n=new ai
1126
- await n.Ji(e,i,s)
1127
- const r=n.getLoadedFont()
1128
- return ai.zl.set(t,r),ai.sc(r),ai.nc(),r}static sc(t){ai.Rl+=t.ls?.byteLength??0}static rc(t){const e=ai.zl.get(t)
1129
- e&&(ai.Rl-=e.ls?.byteLength??0,0>ai.Rl&&(ai.Rl=0))}static nc(){if(ai.Wl!==1/0)for(;ai.Rl>ai.Wl&&ai.zl.size>0;){const t=ai.zl.keys().next().value
1130
- if(void 0===t)break
1131
- ai.rc(t),ai.zl.delete(t)}}static tc(t){if(t){const e=new Uint8Array(t)
1132
- let i=2166136261
1133
- const s=Math.min(32,e.length),n=Math.floor(e.length/s)
1134
- for(let t=0;s>t;t++)i^=e[t*n],i=Math.imul(i,16777619)
1135
- return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++ai.jl}Xl(t){this.oi=t
1136
- const e=ai.tc(t.ls)
1137
- this.Hl="font_"+e,t.es&&(this.Hl+="_var_"+ai.Vl(t.es)),t.ni&&(this.Hl+="_feat_"+ai.Vl(t.ni))}async Ji(t,e,i){ai.Gl||(ai.Gl=ri.Ml()),await ai.Gl
1138
- const s="string"==typeof t?await Q(t):t
1139
- try{this.oi&&this.destroy(),this.oi=await this.ql.Ji(s,e),i&&(this.oi.ni=i)
1140
- const t=ai.tc(s)
1141
- this.Hl="font_"+t,e&&(this.Hl+="_var_"+ai.Vl(e)),i&&(this.Hl+="_feat_"+ai.Vl(i))}catch(t){throw st.error("Failed to load font:",t),t}}async Ql(t){try{if(!this.oi)throw Error("Font not loaded. Use Text.create() with a font option.")
1142
- const e=await this.oc(t)
1143
- this.hc(e),this.ac(t=e),this.Go||(this.Go=new Je(Yt,this.oi),this.Go.yo(this.Hl))
1144
- const i=null!=t.curveSteps&&t.curveSteps>0
1145
- this.Go.Xn(t.curveSteps),this.Go.Jn(i?void 0:t.curveFidelity),this.Go.kr(t.geometryOptimization),this.oi.font.setScale(this.oi.upem,this.oi.upem),this.lc||(this.lc=new Ke(this.oi,this.Go))
1146
- const s=this.cc(t),n=t.uc??this.oi.ss??!1,r=this.lc.zo(s.lines,s.fc,s.letterSpacing,s.align,s.direction,t.color,t.text)
1147
- let o,h
1148
- if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.Cl||t.color.Bl)){if(o=new Set,t.color.Cl){h=[]
1149
- for(const e of Object.keys(t.color.Cl)){let i=0
1150
- for(;-1!==(i=t.text.indexOf(e,i));){h.push({pattern:e,start:i,end:i+e.length})
1151
- for(let t=i;i+e.length>t;t++)o.add(t)
1152
- i+=e.length}}}if(t.color.Bl)for(const e of t.color.Bl)for(let t=e.start;e.end>t;t++)o.add(t)}const a=this.Go.wo(r,s.depth,n,this.oi.rt.bi,s.dc,t.perGlyphAttributes??!1,o),l=this.yc(a.vertices,a.normals,a.indices,a.Co,a.planeBounds,t,t.text,h)
1153
- if(t.perGlyphAttributes){const t=this.wc(l.vertices.length/3,l.glyphs)
1154
- l.glyphAttributes=t}return l}finally{}}async oc(t){if(!1!==t.layout?._e&&t.layout?.width){const e=t.layout?.language||"en-us"
1155
- if(!t.layout?.ke?.[e])try{if(!ai.$l.has(e)){const s=await i(e,t.layout?.gc)
1156
- ai.$l.set(e,s)}return{...t,layout:{...t.layout,ke:{...t.layout?.ke,[e]:ai.$l.get(e)}}}}catch(i){return st.warn(`Failed to load patterns for ${e}: ${i}`),{...t,layout:{...t.layout,_e:!1}}}}return t}hc(t){if(!t.text)throw Error("Text content is required")
1157
- const e=t.mc??1e5
1158
- if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}ac(t){t.es&&this.oi&&ai.Vl(t.es)!==ai.Vl(this.oi.es||{})&&(this.oi.font.Zi(t.es),this.oi.es=t.es)}cc(t){if(!this.oi)throw Error("Font not loaded. Use Text.create() with a font option")
1159
- const{text:e,size:i=hi,depth:s=0,lineHeight:n=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:l=("rtl"===a?"right":"left"),Oe:c=!0,_e:u=!0,language:f="en-us",Le:d=nt,De:y=rt,Ne:p=ot,Pe:w,ke:g,$e:m,Ge:v,ze:x,Re:A,We:b,je:E,Ue:T}=o,I=this.oi.upem/i
1160
- let S
1161
- void 0!==h&&(S=h*I)
1162
- const F=s*I,M=F>0?Math.max(F,25e-6*this.oi.upem):0
1163
- this.vc||(this.vc=new Et(this.oi))
1164
- const _=this.vc.hi({text:e,width:S,align:l,direction:a,_e:u,language:f,Oe:c,Le:d,De:y,Ne:p,Pe:w,ke:g,$e:m,Ge:v,ze:x,Re:A,We:b,je:E,Ue:T,letterSpacing:r}),O=Gt.zi(this.oi.rt)
1165
- return{lines:_.lines,fc:(O.fi-O.di)*n,letterSpacing:r,align:l,direction:a,depth:M,size:i,dc:1/I}}xc(t,e,i,s,n){const r=t.length/3,o=new Float32Array(3*r),h=[]
1201
+ return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}exports.DEFAULT_CURVE_FIDELITY=Je,exports.DrawCallbackHandler=hi,exports.FontMetadataExtractor=Rt,exports.MeshGeometryBuilder=class{constructor(t,e){this.oi=t,this.eh=e}Ac(t,e){this.oi=t,this.eh=e,this.bc=void 0}Ec(t,e){try{this.bc||(this.bc=new li(he,this.oi),this.bc.Vl(this.eh))
1202
+ const i=null!=e.curveSteps&&e.curveSteps>0
1203
+ this.bc.Wa(e.curveSteps),this.bc.Ra(i?void 0:e.curveFidelity),this.bc.xl(e.geometryOptimization)
1204
+ const s=e.Tc??this.oi.ss??!1
1205
+ let n,r
1206
+ if(e.color&&"object"==typeof e.color&&!Array.isArray(e.color)&&(e.color.dc||e.color.wc)){if(n=new Set,e.color.dc){r=[]
1207
+ for(const t of Object.keys(e.color.dc)){let i=0
1208
+ for(;-1!==(i=e.text.indexOf(t,i));){r.push({pattern:t,start:i,end:i+t.length})
1209
+ for(let e=i;i+t.length>e;e++)n.add(e)
1210
+ i+=t.length}}}if(e.color.wc)for(const t of e.color.wc)for(let e=t.start;t.end>e;e++)n.add(e)}const o=this.bc.ql(t.Qo,t.th.depth,s,this.oi.rt.bi,t.th.rh,e.perGlyphAttributes??!1,n),h=this.Ic(o.vertices,o.normals,o.indices,o.hc,o.planeBounds,e,e.text,r)
1211
+ if(e.perGlyphAttributes){const t=this.Sc(h.vertices.length/3,h.glyphs)
1212
+ h.glyphAttributes=t}return h}finally{}}getCacheSize(){return this.bc?.cc().size??0}clearCache(){this.bc?.clearCache()}reset(){this.bc=void 0,this.nh=void 0}Ic(t,e,i,s,n,r,o,h){const{layout:a={}}=r,{width:l,align:c=("rtl"===a.direction?"right":"left")}=a
1213
+ this.nh||(this.nh=new Tt(this.oi))
1214
+ const u=this.nh.ci({width:l,align:c,planeBounds:n}),f=u.offset
1215
+ if(n.min.x=u.li.min.x,n.max.x=u.li.max.x,0!==f){for(let e=0;t.length>e;e+=3)t[e]+=f
1216
+ for(let t=0;s.length>t;t++)s[t].bounds.min.x+=f,s[t].bounds.max.x+=f}let d,y
1217
+ if(r.color){const e=this.Fc(t,s,r.color,r.text,h)
1218
+ d=e.colors,y=e.Mc}const p=this.bc.Al()
1219
+ return{vertices:t,normals:e,indices:i,colors:d,glyphs:s,planeBounds:n,stats:{trianglesGenerated:i.length/3,verticesGenerated:t.length/3,pointsRemovedByVisvalingam:p.pointsRemovedByVisvalingam,originalPointCount:p.originalPointCount},query:(()=>{let t=null
1220
+ return e=>{if(!o)throw Error("Original text not available for querying")
1221
+ return t||(t=new ci(o,s)),t.fc(e)}})(),Mc:y,glyphAttributes:void 0}}Fc(t,e,i,s,n){const r=t.length/3,o=new Float32Array(3*r),h=[]
1166
1222
  if(Array.isArray(i)){for(let t=0;r>t;t++){const e=3*t
1167
- o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:s.length,Dl:s,color:i,bounds:[],glyphs:e,Pl:[...new Set(e.map(t=>t.Bo))]})}else{const t=i.default||[1,1,1]
1223
+ o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:s.length,mc:s,color:i,bounds:[],glyphs:e,xc:[...new Set(e.map(t=>t.Ss))]})}else{const t=i.default||[1,1,1]
1168
1224
  for(let e=0;o.length>e;e+=3)o[e]=t[0],o[e+1]=t[1],o[e+2]=t[2]
1169
1225
  let r
1170
- if(i.Cl&&n||i.Bl){r=new Map
1171
- for(const t of e){const e=r.get(t.ko)
1172
- e?e.push(t):r.set(t.ko,[t])}}if(i.Cl&&n&&r)for(const t of n){const e=i.Cl[t.pattern]
1226
+ if(i.dc&&n||i.wc){r=new Map
1227
+ for(const t of e){const e=r.get(t.ac)
1228
+ e?e.push(t):r.set(t.ac,[t])}}if(i.dc&&n&&r)for(const t of n){const e=i.dc[t.pattern]
1173
1229
  if(!e)continue
1174
1230
  const s=[],n=new Map
1175
1231
  for(let i=t.start;t.end>i;i++){const t=r.get(i)
1176
1232
  if(t)for(const i of t){s.push(i)
1177
- const t=n.get(i.Bo)
1178
- t?t.push(i):n.set(i.Bo,[i])
1179
- for(let t=0;i.Ss>t;t++){const s=3*(i.xo+t)
1180
- s>=0&&o.length>s&&(o[s]=e[0],o[s+1]=e[1],o[s+2]=e[2])}}}const a=Array.from(n.values()).map(t=>this.Ac(t))
1181
- h.push({start:t.start,end:t.end,Dl:t.pattern,color:e,bounds:a,glyphs:s,Pl:Array.from(n.keys()).sort((t,e)=>t-e)})}if(i.Bl&&r)for(const t of i.Bl){const e=[],i=new Map
1233
+ const t=n.get(i.Ss)
1234
+ t?t.push(i):n.set(i.Ss,[i])
1235
+ for(let t=0;i.mh>t;t++){const s=3*(i.Kl+t)
1236
+ s>=0&&o.length>s&&(o[s]=e[0],o[s+1]=e[1],o[s+2]=e[2])}}}const a=Array.from(n.values()).map(t=>this._c(t))
1237
+ h.push({start:t.start,end:t.end,mc:t.pattern,color:e,bounds:a,glyphs:s,xc:Array.from(n.keys()).sort((t,e)=>t-e)})}if(i.wc&&r)for(const t of i.wc){const e=[],i=new Map
1182
1238
  for(let s=t.start;t.end>s;s++){const n=r.get(s)
1183
1239
  if(n)for(const s of n){e.push(s)
1184
- const n=i.get(s.Bo)
1185
- n?n.push(s):i.set(s.Bo,[s])
1186
- for(let e=0;s.Ss>e;e++){const i=3*(s.xo+e)
1187
- i>=0&&o.length>i&&(o[i]=t.color[0],o[i+1]=t.color[1],o[i+2]=t.color[2])}}}const n=Array.from(i.values()).map(t=>this.Ac(t))
1188
- h.push({start:t.start,end:t.end,Dl:s.slice(t.start,t.end),color:t.color,bounds:n,glyphs:e,Pl:Array.from(i.keys()).sort((t,e)=>t-e)})}}return{colors:o,bc:h}}Ac(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
1240
+ const n=i.get(s.Ss)
1241
+ n?n.push(s):i.set(s.Ss,[s])
1242
+ for(let e=0;s.mh>e;e++){const i=3*(s.Kl+e)
1243
+ i>=0&&o.length>i&&(o[i]=t.color[0],o[i+1]=t.color[1],o[i+2]=t.color[2])}}}const n=Array.from(i.values()).map(t=>this._c(t))
1244
+ h.push({start:t.start,end:t.end,mc:s.slice(t.start,t.end),color:t.color,bounds:n,glyphs:e,xc:Array.from(i.keys()).sort((t,e)=>t-e)})}}return{colors:o,Mc:h}}_c(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
1189
1245
  let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
1190
1246
  for(const h of t)e>h.bounds.min.x&&(e=h.bounds.min.x),i>h.bounds.min.y&&(i=h.bounds.min.y),s>h.bounds.min.z&&(s=h.bounds.min.z),h.bounds.max.x>n&&(n=h.bounds.max.x),h.bounds.max.y>r&&(r=h.bounds.max.y),h.bounds.max.z>o&&(o=h.bounds.max.z)
1191
- return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}yc(t,e,i,s,n,r,o,h){const{layout:a={}}=r,{width:l,align:c=("rtl"===a.direction?"right":"left")}=a
1192
- this.vc||(this.vc=new Et(this.oi))
1193
- const u=this.vc.ci({width:l,align:c,planeBounds:n}),f=u.offset
1194
- if(n.min.x=u.li.min.x,n.max.x=u.li.max.x,0!==f){for(let e=0;t.length>e;e+=3)t[e]+=f
1195
- for(let t=0;s.length>t;t++)s[t].bounds.min.x+=f,s[t].bounds.max.x+=f}let d,y
1196
- if(r.color){const e=this.xc(t,s,r.color,r.text,h)
1197
- d=e.colors,y=e.bc}const p=this.Go.Br()
1198
- return{vertices:t,normals:e,indices:i,colors:d,glyphs:s,planeBounds:n,stats:{trianglesGenerated:i.length/3,verticesGenerated:t.length/3,pointsRemovedByVisvalingam:p.pointsRemovedByVisvalingam,originalPointCount:p.originalPointCount},query:(()=>{let t=null
1199
- return e=>{if(!o)throw Error("Original text not available for querying")
1200
- return t||(t=new oi(o,s)),t.Ol(e)}})(),bc:y,glyphAttributes:void 0}}Ri(){if(!this.oi)throw Error("Font not loaded. Call loadFont() first")
1201
- return Gt.Ri(this.oi.rt)}static async Ec(t,e){await Promise.all(t.map(async t=>{if(!ai.$l.has(t))try{const s=await i(t,e)
1202
- ai.$l.set(t,s)}catch(e){st.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static Tc(t,e){ai.$l.set(t,e)}static Ic(t){ai.Wl=t===1/0?1/0:1048576*Math.max(1,Math.floor(t)),ai.nc()}getLoadedFont(){return this.oi}measureTextWidth(t,e=0){if(!this.oi)throw Error("Font not loaded. Call loadFont() first")
1203
- return bt.measureTextWidth(this.oi,t,e)}getCacheSize(){return this.Go?this.Go.Po().size:0}clearCache(){this.Go&&this.Go.clearCache()}wc(t,e){const i=new Float32Array(3*t),s=new Float32Array(t),n=new Float32Array(t),r=new Float32Array(t),o=new Float32Array(t)
1247
+ return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}Sc(t,e){const i=new Float32Array(3*t),s=new Float32Array(t),n=new Float32Array(t),r=new Float32Array(t),o=new Float32Array(t)
1204
1248
  let h=1/0,a=-1/0
1205
1249
  for(let t=0;e.length>t;t++){const i=(e[t].bounds.min.x+e[t].bounds.max.x)/2
1206
1250
  h>i&&(h=i),i>a&&(a=i)}const l=a-h
1207
- for(let a=0;e.length>a;a++){const c=e[a],u=(c.bounds.min.x+c.bounds.max.x)/2,f=(c.bounds.min.y+c.bounds.max.y)/2,d=(c.bounds.min.z+c.bounds.max.z)/2,y=c.bounds.min.y,p=l>0?(u-h)/l:0,w=c.xo,g=Math.min(w+c.Ss,t)
1208
- if(g>w){s.fill(a,w,g),n.fill(c.Bo,w,g),r.fill(p,w,g),o.fill(y,w,g)
1209
- for(let t=3*w;3*g>t;t+=3)i[t]=u,i[t+1]=f,i[t+2]=d}}return{glyphCenter:i,glyphIndex:s,glyphLineIndex:n,glyphProgress:r,glyphBaselineY:o}}Zl(){this.Go=void 0,this.lc=void 0,this.vc=void 0}destroy(){if(!this.oi)return
1210
- const t=this.oi
1211
- try{Wt.cs(t)}catch(t){st.warn("Error destroying HarfBuzz objects:",t)}finally{this.oi=void 0,this.vc=void 0,this.lc=void 0}}}exports.DEFAULT_CURVE_FIDELITY=De,exports.FontMetadataExtractor=Gt,exports.Text=ai,exports.createGlyphCache=()=>new qt,exports.globalGlyphCache=Yt
1251
+ for(let a=0;e.length>a;a++){const c=e[a],u=(c.bounds.min.x+c.bounds.max.x)/2,f=(c.bounds.min.y+c.bounds.max.y)/2,d=(c.bounds.min.z+c.bounds.max.z)/2,y=c.bounds.min.y,p=l>0?(u-h)/l:0,w=c.Kl,g=Math.min(w+c.mh,t)
1252
+ if(g>w){s.fill(a,w,g),n.fill(c.Ss,w,g),r.fill(p,w,g),o.fill(y,w,g)
1253
+ for(let t=3*w;3*g>t;t+=3)i[t]=u,i[t+1]=f,i[t+2]=d}}return{glyphCenter:i,glyphIndex:s,glyphLineIndex:n,glyphProgress:r,glyphBaselineY:o}}},exports.Text=re,exports.TextRangeQuery=ci,exports.createGlyphCache=()=>new oe,exports.getSharedDrawCallbackHandler=et,exports.globalGlyphCache=he,exports.globalOutlineCache=ue