three-text 0.2.17 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/index.cjs +133 -105
- package/dist/index.d.ts +48 -43
- package/dist/index.js +133 -105
- package/dist/index.min.cjs +259 -251
- package/dist/index.min.js +319 -311
- package/dist/index.umd.js +133 -105
- package/dist/index.umd.min.js +295 -287
- package/dist/three/index.cjs +1 -0
- package/dist/three/index.d.ts +13 -1
- package/dist/three/index.js +1 -0
- package/dist/three/react.cjs +2 -1
- package/dist/three/react.d.ts +18 -12
- package/dist/three/react.js +2 -1
- package/dist/types/core/Text.d.ts +0 -1
- package/dist/types/core/geometry/Extruder.d.ts +1 -0
- package/dist/types/core/types.d.ts +10 -3
- package/dist/types/three/index.d.ts +6 -1
- package/dist/types/three/react.d.ts +1 -0
- package/package.json +14 -3
package/dist/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* three-text v0.2.
|
|
2
|
+
* three-text v0.2.19
|
|
3
3
|
* Copyright (C) 2025 Countertype LLC
|
|
4
4
|
*
|
|
5
5
|
* This program is free software: you can redistribute it and/or modify
|
|
@@ -62,11 +62,11 @@ class w{constructor(){this.G=new Map,this.O=[],this.F=new Set}getKey(t,e){return
|
|
|
62
62
|
i&&i.U>t.U?(i.U=t.U,i.N=t.N,i.D=t.D):i||(this.G.set(e,t),this.F.add(t),t.P=this.O.length,this.O.push(t))}R(t,e){return this.G.get(this.getKey(t,e))}W(){return this.O}j(t){if(t.active&&void 0!==t.P){t.active=!1
|
|
63
63
|
const e=t.P,i=this.O.length-1
|
|
64
64
|
if(e!==i){const t=this.O[i]
|
|
65
|
-
this.O[e]=t,t.P=e}this.O.pop(),t.P=void 0}}size(){return this.F.size}}const v=50,m=50,g=1e4,x=10,S=1e4,b=-1/0,
|
|
65
|
+
this.O[e]=t,t.P=e}this.O.pop(),t.P=void 0}}size(){return this.F.size}}const v=50,m=50,g=1e4,x=10,S=1e4,b=-1/0,E=2,_=4,T=1e4,A=.7
|
|
66
66
|
class L{static H(t,e){if(0===t)return 0
|
|
67
67
|
if(0>=e)return T
|
|
68
68
|
let i
|
|
69
|
-
return i=t>7230584?1663497>e?t:Math.floor(t/Math.floor(e/297)):Math.floor(297*t/e),i>1290?T:Math.floor((i*i*i+131072)/262144)}static V(t,e="en-us",i,s=
|
|
69
|
+
return i=t>7230584?1663497>e?t:Math.floor(t/Math.floor(e/297)):Math.floor(297*t/e),i>1290?T:Math.floor((i*i*i+131072)/262144)}static V(t,e="en-us",i,s=E,n=_){let r
|
|
70
70
|
if(!i||!i[e])return[]
|
|
71
71
|
if(r=i[e],!r)return[]
|
|
72
72
|
const o=`.${t.toLowerCase()}.`,h=Array(o.length).fill(0)
|
|
@@ -76,7 +76,7 @@ if(!e.children||!e.children[s])break
|
|
|
76
76
|
if(e=e.children[s],e.q)for(let i=0;e.q.length>i;i++){const s=t+i
|
|
77
77
|
h.length>s&&(h[s]=Math.max(h[s],e.q[i]))}}}const a=[]
|
|
78
78
|
for(let t=2;o.length-2>t;t++)h[t]%2==1&&a.push(t-1)
|
|
79
|
-
return a.filter(e=>e>=s&&t.length-e>=n)}static J(t,e,i,s=!1,n="en-us",r,o=
|
|
79
|
+
return a.filter(e=>e>=s&&t.length-e>=n)}static J(t,e,i,s=!1,n="en-us",r,o=E,h=_,a){const c=[]
|
|
80
80
|
return c.push(...this.Y(t,e,i,s,n,r,o,h,a)),c.push({type:y.GLUE,width:0,stretch:1/0,K:0,text:"",X:t.length}),c.push({type:y.PENALTY,width:0,Z:-1/0,text:"",X:t.length}),c}static tt(t){const e=t.codePointAt(0)
|
|
81
81
|
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 et(t){const e=t.charCodeAt(0)
|
|
82
82
|
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 it(t){const e=t.charCodeAt(0)
|
|
@@ -118,7 +118,7 @@ for(let r=0;e.length-1>r;r++){const o=e[r]
|
|
|
118
118
|
let h=0
|
|
119
119
|
for(let e=n;o>e;e++)t[e].type!==y.PENALTY&&(h+=t[e].width)
|
|
120
120
|
if(h>0&&s>h/i)return!0
|
|
121
|
-
n=o+1}return!1}static wt(t){const{text:e,width:i,align:s="left",direction:n="ltr",vt:r=!1,language:o="en-us",gt:h=!0,measureText:a,xt:d,St:y,bt:p,letterSpacing:w=0,
|
|
121
|
+
n=o+1}return!1}static wt(t){const{text:e,width:i,align:s="left",direction:n="ltr",vt:r=!1,language:o="en-us",gt:h=!0,measureText:a,xt:d,St:y,bt:p,letterSpacing:w=0,Et:b=l,_t:M=u,Tt:I=f,At:G,Lt:O=E,Mt:F=_,It:k=x,Gt:C=S,Ot:B=v,Ft:$=m,kt:U=g,Ct:N=0,Bt:D=!1,$t:P=A}=t
|
|
122
122
|
if(h&&e.includes("\n")){const i=e.split("\n"),s=[]
|
|
123
123
|
let n=0
|
|
124
124
|
for(const e of i){if(0===e.length)s.push({text:"",Ut:n,Nt:n,Dt:0,Pt:!0,naturalWidth:0,Rt:!1})
|
|
@@ -160,17 +160,17 @@ const p=L.te(t,d.position,i,d.line,s,o,h),{ratio:w,ee:v,stretch:m,K:g,D:x}=p
|
|
|
160
160
|
let S
|
|
161
161
|
if(v>0){const t=m+r
|
|
162
162
|
S=t>0?L.H(v,t):10001}else S=0>v?g>0?-v>g?10001:L.H(-v,g):10001:0
|
|
163
|
-
const
|
|
164
|
-
if(!l&&!
|
|
165
|
-
const
|
|
166
|
-
if(!l&&!
|
|
163
|
+
const E=a&&l&&c.value===1/0&&1===u.length&&d.active
|
|
164
|
+
if(!l&&!E&&-1>w)continue
|
|
165
|
+
const _=L.ie(S,v>0)
|
|
166
|
+
if(!l&&!E&&S>n)continue
|
|
167
167
|
let T=0,A=0,M=(h?.zt??0)+S,I=1e4>Math.abs(M)?M*M:1e8
|
|
168
|
-
const G=
|
|
169
|
-
0!==O&&(O>0?I+=O*O:O>b&&(I-=O*O)),(t[i].type===y.PENALTY&&t[i].ft||t[i].type===y.DISCRETIONARY&&t[i].ft)&&d.position>0&&(t[d.position].type===y.PENALTY&&t[d.position].ft||t[d.position].type===y.DISCRETIONARY&&t[d.position].ft)&&(T=h?.jt??0,I+=T),Math.abs(
|
|
168
|
+
const G=E,O=t[i].type===y.PENALTY||t[i].type===y.DISCRETIONARY?t[i].Z:0
|
|
169
|
+
0!==O&&(O>0?I+=O*O:O>b&&(I-=O*O)),(t[i].type===y.PENALTY&&t[i].ft||t[i].type===y.DISCRETIONARY&&t[i].ft)&&d.position>0&&(t[d.position].type===y.PENALTY&&t[d.position].ft||t[d.position].type===y.DISCRETIONARY&&t[d.position].ft)&&(T=h?.jt??0,I+=T),Math.abs(_-d.$)>1&&(A=h?.Wt??0,I+=A),(l||G)&&(I=0)
|
|
170
170
|
const F=d.U+I
|
|
171
171
|
c.value>F&&(c.value=F)
|
|
172
|
-
let k=e.R(i,
|
|
173
|
-
k?k.U>F&&(k.U=F,k.N=d,k.D=x):e.k({position:i,line:d.line+1,$:
|
|
172
|
+
let k=e.R(i,_)
|
|
173
|
+
k?k.U>F&&(k.U=F,k.N=d,k.D=x):e.k({position:i,line:d.line+1,$:_,U:F,D:x,N:d,active:!0})}}static te(t,e,i,s,n,r,o){let h=0,a=0,c=0
|
|
174
174
|
if(r){h=r.se[i]-r.se[e],a=r.ne[i]-r.ne[e],c=r.re[i]-r.re[e]
|
|
175
175
|
for(let s=e;i>s;s++){const e=t[s]
|
|
176
176
|
e.type===y.PENALTY&&(h-=e.width)}}else for(let s=e;i>s;s++){const e=t[s]
|
|
@@ -227,13 +227,13 @@ const r=t(e.ae)
|
|
|
227
227
|
e.hb.shape(e.font,n,r)
|
|
228
228
|
const o=n.json(e.font),h=s*e.upem
|
|
229
229
|
let a=0
|
|
230
|
-
return o.forEach(t=>{a+=t.ax,0!==h&&(a+=h)}),n.destroy(),a}}class G{constructor(t){this.le=t}ue(t){const{text:e,width:i,align:s,direction:n,vt:r,language:o,gt:h,
|
|
231
|
-
let
|
|
232
|
-
if(i)
|
|
230
|
+
return o.forEach(t=>{a+=t.ax,0!==h&&(a+=h)}),n.destroy(),a}}class G{constructor(t){this.le=t}ue(t){const{text:e,width:i,align:s,direction:n,vt:r,language:o,gt:h,Et:a,_t:c,Tt:l,At:u,St:f,Lt:d,Mt:y,It:p,Gt:w,Ot:v,Ft:m,kt:g,Ct:x,Bt:S,$t:b,letterSpacing:E}=t
|
|
231
|
+
let _
|
|
232
|
+
if(i)_=L.wt({text:e,width:i,align:s,direction:n,vt:r,language:o,gt:h,Et:a,_t:c,Tt:l,At:u,St:f,Lt:d,Mt:y,It:p,Gt:w,Ot:v,Ft:m,kt:g,Ct:x,Bt:S,$t:b,bt:this.le.upem,letterSpacing:E,measureText:t=>I.measureTextWidth(this.le,t,E),xt:t=>I.xt(this.le,t,E)})
|
|
233
233
|
else{const t=e.split("\n")
|
|
234
|
-
|
|
234
|
+
_=[]
|
|
235
235
|
let i=0
|
|
236
|
-
for(const e of t)
|
|
236
|
+
for(const e of t)_.push({text:e,Ut:i,Nt:0===e.length?i:i+e.length-1,Dt:0}),i+=e.length+1}return{lines:_}}fe(t,e){const{offset:i,de:s}=this.ye(e)
|
|
237
237
|
if(0!==i)for(let e=0;t.length>e;e+=3)t[e]+=i
|
|
238
238
|
return{offset:i,de:s}}ye(t){const{width:e,align:i,planeBounds:s}=t
|
|
239
239
|
let n=0
|
|
@@ -246,9 +246,9 @@ const n=e(i),r=n.has(1128678944)||n.has(1128678962),o=n.get(1751474532)?.offset?
|
|
|
246
246
|
let d=null
|
|
247
247
|
h&&(d={we:i.getInt16(h+4),ve:i.getInt16(h+6),me:i.getInt16(h+8)})
|
|
248
248
|
let y=null
|
|
249
|
-
a&&(y={ge:i.getInt16(a+68),xe:i.getInt16(a+70),Se:i.getInt16(a+72),be:i.getUint16(a+74),
|
|
249
|
+
a&&(y={ge:i.getInt16(a+68),xe:i.getInt16(a+70),Se:i.getInt16(a+72),be:i.getUint16(a+74),Ee:i.getUint16(a+76)})
|
|
250
250
|
let p=null
|
|
251
|
-
return c&&l&&u&&(p=this.
|
|
251
|
+
return c&&l&&u&&(p=this._e(i,l,u)),{Te:r,bt:f,Ae:d?.we||null,Le:d?.ve||null,Me:d?.me||null,ge:y?.ge||null,xe:y?.xe||null,Se:y?.Se||null,be:y?.be||null,Ee:y?.Ee||null,Ie:p}}static Ge(t){const i=new DataView(t),s=e(i),n=s.get(1196643650)?.offset??0,r=s.get(1196445523)?.offset??0,o=s.get(k)?.offset??0,h=new Set,a={}
|
|
252
252
|
try{if(n){const t=this.Oe(i,n,o)
|
|
253
253
|
t.features.forEach(t=>h.add(t)),Object.assign(a,t.names)}if(r){const t=this.Oe(i,r,o)
|
|
254
254
|
t.features.forEach(t=>h.add(t)),Object.assign(a,t.names)}}catch(t){return}const c=Array.from(h).sort()
|
|
@@ -257,7 +257,7 @@ for(let e=0;n>e;e++){const n=s+2+6*e,h=String.fromCharCode(t.getUint8(n),t.getUi
|
|
|
257
257
|
if(r.push(h),/^(ss\d{2}|cv\d{2})$/.test(h)&&i){const e=s+t.getUint16(n+4),r=t.getUint16(e)
|
|
258
258
|
if(0!==r){const s=e+r
|
|
259
259
|
if(0===t.getUint16(s)){const e=t.getUint16(s+2),n=this.Fe(t,i,e)
|
|
260
|
-
n&&(o[h]=n)}}}}return{features:r,names:o}}static
|
|
260
|
+
n&&(o[h]=n)}}}}return{features:r,names:o}}static _e(t,e,i){try{if(1>t.getUint16(e))return null
|
|
261
261
|
const s=t.getUint16(e+4),n=t.getUint16(e+6),r=t.getUint32(e+8),o={}
|
|
262
262
|
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)),c=t.getUint16(n+4),l=this.Fe(t,i,c)
|
|
263
263
|
l&&(o[a]=l)}return Object.keys(o).length>0?o:null}catch(t){return null}}static Fe(t,e,i){try{const s=t.getUint16(e+2),n=t.getUint16(e+4)
|
|
@@ -265,7 +265,7 @@ for(let r=0;s>r;r++){const s=e+6+12*r,o=t.getUint16(s),h=t.getUint16(s+2),a=t.ge
|
|
|
265
265
|
if(c===i&&(0===o||3===o&&1033===a)){const i=new Uint8Array(t.buffer,e+n+u,l)
|
|
266
266
|
if(0===o||3===o&&1===h){let t=""
|
|
267
267
|
for(let e=0;i.length>e;e+=2)t+=String.fromCharCode(i[e]<<8|i[e+1])
|
|
268
|
-
return t}return new TextDecoder("ascii").decode(i)}}return null}catch(t){return null}}static ke(t){return null!==t.ge&&null!==t.xe?{we:t.ge,ve:t.xe,me:0}:null!==t.Ae&&null!==t.Le?{we:t.Ae,ve:t.Le,me:0}:null!==t.be&&null!==t.
|
|
268
|
+
return t}return new TextDecoder("ascii").decode(i)}}return null}catch(t){return null}}static ke(t){return null!==t.ge&&null!==t.xe?{we:t.ge,ve:t.xe,me:0}:null!==t.Ae&&null!==t.Le?{we:t.Ae,ve:t.Le,me:0}:null!==t.be&&null!==t.Ee?{we:t.be,ve:-t.Ee,me:0}:{we:Math.round(.8*t.bt),ve:-Math.round(.2*t.bt),me:0}}static Ce(t){const e=C.ke(t)
|
|
269
269
|
return{we:e.we,ve:e.ve,me:e.me,bt:t.bt,Be:e.we-e.ve}}}class B{static $e(t){if(4>t.byteLength)return"ttf/otf"
|
|
270
270
|
const e=new DataView(t).getUint32(0)
|
|
271
271
|
return e===F?"woff":2001684018===e?"woff2":"ttf/otf"}static async Ue(t){const e=new DataView(t),i=new Uint8Array(t)
|
|
@@ -336,22 +336,22 @@ return m(e,t.c),m(e.b,t.c),g(e,t.a),e}function f(t,e){var i=!1,s=!1
|
|
|
336
336
|
t!==e&&(e.a!==t.a&&(s=!0,S(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),v(e,t),s||(m(e,t.a),t.a.c=t),i||(g(e,t.d),t.d.a=t))}function d(t){var e=t.b,i=!1
|
|
337
337
|
t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?S(t.a,null):(t.b.d.a=X(t),t.a.c=t.c,v(t,X(t)),i||g(t,t.d)),e.c===e?(S(e.a,null),b(e.d,null)):(t.d.a=X(e),e.a.c=e.c,v(e,X(e))),x(t)}function y(t){var e=w(t),i=e.b
|
|
338
338
|
return v(e,t.e),e.a=t.b.a,m(i,e.a),e.d=i.d=t.d,e=e.b,v(t.b,X(t.b)),v(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function p(t,e){var i=!1,s=w(t),n=s.b
|
|
339
|
-
return e.d!==t.d&&(i=!0,b(e.d,t.d)),v(s,t.e),v(n,e),s.a=t.b.a,n.a=e.a,s.d=n.d=t.d,t.d.a=n,i||g(s,t.d),s}function w(t){var e=new K,i=new K,s=t.b.
|
|
340
|
-
return i.
|
|
339
|
+
return e.d!==t.d&&(i=!0,b(e.d,t.d)),v(s,t.e),v(n,e),s.a=t.b.a,n.a=e.a,s.d=n.d=t.d,t.d.a=n,i||g(s,t.d),s}function w(t){var e=new K,i=new K,s=t.b.Ei
|
|
340
|
+
return i.Ei=s,s.b.Ei=e,e.Ei=t,t.b.Ei=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function v(t,e){var i=t.c,s=e.c
|
|
341
341
|
i.b.e=e,s.b.e=t,t.c=s,e.c=i}function m(t,e){var i=e.f,s=new Z(e,i)
|
|
342
342
|
i.e=s,e.f=s,i=s.c=t
|
|
343
343
|
do{i.a=s,i=i.c}while(i!==t)}function g(t,e){var i=e.d,s=new Y(e,i)
|
|
344
344
|
i.b=s,e.d=s,s.a=t,s.c=e.c,i=t
|
|
345
|
-
do{i.d=s,i=i.e}while(i!==t)}function x(t){var e=t.
|
|
346
|
-
e.b.
|
|
345
|
+
do{i.d=s,i=i.e}while(i!==t)}function x(t){var e=t.Ei
|
|
346
|
+
e.b.Ei=t=t.b.Ei,t.b.Ei=e}function S(t,e){var i=t.c,s=i
|
|
347
347
|
do{s.a=e,s=s.c}while(s!==i);(s=t.e).f=i=t.f,i.e=s}function b(t,e){var i=t.a,s=i
|
|
348
|
-
do{s.d=e,s=s.e}while(s!==i);(s=t.b).d=i=t.d,i.b=s}function
|
|
349
|
-
return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}function
|
|
348
|
+
do{s.d=e,s=s.e}while(s!==i);(s=t.b).d=i=t.d,i.b=s}function E(t){var e=0
|
|
349
|
+
return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}function _(t,e){t.f+=e.f,t.b.f+=e.b.f}function T(t,e,r){return r=r.a,(e=e.a).b.a===(t=t.a)?r.b.a===t?i(e.a,r.a)?0>=n(r.b.a,e.a,r.a):n(e.b.a,r.a,e.a)>=0:0>=n(r.b.a,t,r.a):r.b.a===t?n(e.b.a,t,e.a)>=0:(e=s(e.b.a,t,e.a))>=(t=s(r.b.a,t,r.a))}function A(t){t.a._i=null
|
|
350
350
|
var e=t.e
|
|
351
|
-
e.a.c=e.c,e.c.a=e.a,t.e=null}function L(t,e){d(t.a),t.c=!1,t.a=e,e.
|
|
351
|
+
e.a.c=e.c,e.c.a=e.a,t.e=null}function L(t,e){d(t.a),t.c=!1,t.a=e,e._i=t}function M(t){var e=t.a.a
|
|
352
352
|
do{t=ut(t)}while(t.a.a===e)
|
|
353
353
|
return t.c&&(L(t,e=p(lt(t).a.b,t.a.e)),t=ut(t)),t}function I(t,e,i){var s=new ct
|
|
354
|
-
return s.a=i,s.e=W(t.f,e.e,s),i.
|
|
354
|
+
return s.a=i,s.e=W(t.f,e.e,s),i._i=s}function G(t,e){switch(t.s){case 100130:return!!(1&e)
|
|
355
355
|
case 100131:return 0!==e
|
|
356
356
|
case 100132:return e>0
|
|
357
357
|
case 100133:return 0>e
|
|
@@ -361,26 +361,26 @@ var s=lt(t),n=s.a
|
|
|
361
361
|
if(n.a!==e.a){if(!s.c){O(t)
|
|
362
362
|
break}L(s,n=p(e.c.b,n.b))}e.c!==n&&(f(X(n),n),f(e,n)),O(t),e=s.a,t=s}return e}function k(t,e,i,s,n,r){var o=!0
|
|
363
363
|
do{I(t,e,i.b),i=i.c}while(i!==s)
|
|
364
|
-
for(null===n&&(n=lt(e).a.b.c);(i=(s=lt(e)).a.b).a===n.a;)i.c!==n&&(f(X(i),i),f(X(n),i)),s.f=e.f-i.f,s.d=G(t,s.f),e.b=!0,!o&&U(t,e)&&(
|
|
364
|
+
for(null===n&&(n=lt(e).a.b.c);(i=(s=lt(e)).a.b).a===n.a;)i.c!==n&&(f(X(i),i),f(X(n),i)),s.f=e.f-i.f,s.d=G(t,s.f),e.b=!0,!o&&U(t,e)&&(_(i,n),A(e),d(n)),o=!1,e=s,n=i
|
|
365
365
|
e.b=!0,r&&D(t,e)}function C(t,e,i,s,n){var r=[e.g[0],e.g[1],e.g[2]]
|
|
366
366
|
e.d=null,e.d=t.Ti&&t.Ti(r,i,s,t.c)||null,null===e.d&&(n?t.n||(J(t,100156),t.n=!0):e.d=i[0])}function B(t,e,i){var s=[null,null,null,null]
|
|
367
367
|
s[0]=e.a.d,s[1]=i.a.d,C(t,e.a,s,[.5,.5,0,0],!1),f(e,i)}function $(t,e,i,s,n){var r=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),h=n+1
|
|
368
368
|
s[n]=.5*o/(r+o),s[h]=.5*r/(r+o),t.g[0]+=s[n]*e.g[0]+s[h]*i.g[0],t.g[1]+=s[n]*e.g[1]+s[h]*i.g[1],t.g[2]+=s[n]*e.g[2]+s[h]*i.g[2]}function U(t,s){var r=lt(s),o=s.a,h=r.a
|
|
369
369
|
if(i(o.a,h.a)){if(n(h.b.a,o.a,h.a)>0)return!1
|
|
370
370
|
if(e(o.a,h.a)){if(o.a!==h.a){r=t.e
|
|
371
|
-
var a=o.a.
|
|
371
|
+
var a=o.a.Ei
|
|
372
372
|
if(0>a)for(r.c[-(a+1)]=null;r.a>0&&null===r.c[r.d[r.a-1]];)--r.a
|
|
373
373
|
else{var c=(r=r.b).d,l=r.e,u=r.c,d=u[a]
|
|
374
374
|
c[d]=c[r.a],u[c[d]]=d,d<=--r.a&&(d>1?i(l[c[d>>1]],l[c[d]])?ht(r,d):at(r,d):ht(r,d)),l[a]=null,u[a]=r.b,r.b=a}B(t,X(h),o)}}else y(h.b),f(o,X(h)),s.b=r.b=!0}else{if(0>n(o.b.a,h.a,o.a))return!1
|
|
375
375
|
ut(s).b=s.b=!0,y(o.b),f(X(h),o)}return!0}function N(t,a){var c=lt(a),u=a.a,d=c.a,p=u.a,w=d.a,v=u.b.a,m=d.b.a,g=new Z
|
|
376
376
|
if(n(v,t.a,p),n(m,t.a,w),p===w||Math.min(p.a,v.a)>Math.max(w.a,m.a))return!1
|
|
377
377
|
if(i(p,w)){if(n(m,p,w)>0)return!1}else if(0>n(v,w,p))return!1
|
|
378
|
-
var x,S,b=v,
|
|
379
|
-
if(i(b,
|
|
378
|
+
var x,S,b=v,E=p,_=m,T=w
|
|
379
|
+
if(i(b,E)||(x=b,b=E,E=x),i(_,T)||(x=_,_=T,T=x),i(b,_)||(x=b,b=_,_=x,x=E,E=T,T=x),i(_,E)?i(E,T)?(0>(x=s(b,_,E))+(S=s(_,E,T))&&(x=-x,S=-S),g.b=l(x,_.b,S,E.b)):(0>(x=n(b,_,E))+(S=-n(b,T,E))&&(x=-x,S=-S),g.b=l(x,_.b,S,T.b)):g.b=(_.b+E.b)/2,r(b,E)||(x=b,b=E,E=x),r(_,T)||(x=_,_=T,T=x),r(b,_)||(x=b,b=_,_=x,x=E,E=T,T=x),r(_,E)?r(E,T)?(0>(x=o(b,_,E))+(S=o(_,E,T))&&(x=-x,S=-S),g.a=l(x,_.a,S,E.a)):(0>(x=h(b,_,E))+(S=-h(b,T,E))&&(x=-x,S=-S),g.a=l(x,_.a,S,T.a)):g.a=(_.a+E.a)/2,i(g,t.a)&&(g.b=t.a.b,g.a=t.a.a),b=i(p,w)?p:w,i(b,g)&&(g.b=b.b,g.a=b.a),e(g,p)||e(g,w))return U(t,a),!1
|
|
380
380
|
if(!e(v,t.a)&&n(v,t.a,g)>=0||!e(m,t.a)&&0>=n(m,t.a,g)){if(m===t.a)return y(u.b),f(d.b,u),u=lt(a=M(a)).a,F(t,lt(a),c),k(t,a,X(u),u,u,!0),!0
|
|
381
381
|
if(v===t.a){y(d.b),f(u.e,X(d)),w=(p=c=a).a.b.a
|
|
382
382
|
do{p=ut(p)}while(p.a.b.a===w)
|
|
383
|
-
return p=lt(a=p).a.b.c,c.a=X(d),k(t,a,(d=F(t,c,null)).c,u.b.c,p,!0),!0}return n(v,t.a,g)>=0&&(ut(a).b=a.b=!0,y(u.b),u.a.b=t.a.b,u.a.a=t.a.a),0>=n(m,t.a,g)&&(a.b=c.b=!0,y(d.b),d.a.b=t.a.b,d.a.a=t.a.a),!1}return y(u.b),y(d.b),f(X(d),u),u.a.b=g.b,u.a.a=g.a,u.a.
|
|
383
|
+
return p=lt(a=p).a.b.c,c.a=X(d),k(t,a,(d=F(t,c,null)).c,u.b.c,p,!0),!0}return n(v,t.a,g)>=0&&(ut(a).b=a.b=!0,y(u.b),u.a.b=t.a.b,u.a.a=t.a.a),0>=n(m,t.a,g)&&(a.b=c.b=!0,y(d.b),d.a.b=t.a.b,d.a.a=t.a.a),!1}return y(u.b),y(d.b),f(X(d),u),u.a.b=g.b,u.a.a=g.a,u.a.Ei=et(t.e,u.a),d=[0,0,0,0],g=[p.d,v.d,w.d,m.d],(u=u.a).g[0]=u.g[1]=u.g[2]=0,$(u,p,v,d,0),$(u,w,m,d,2),C(t,u,g,d,!0),ut(a).b=a.b=c.b=!0,!1}function D(t,e){for(var s=lt(e);;){for(;s.b;)e=s,s=lt(s)
|
|
384
384
|
if(!e.b&&(s=e,null===(e=ut(e))||!e.b))break
|
|
385
385
|
e.b=!1
|
|
386
386
|
var r,o=e.a,h=s.a
|
|
@@ -389,25 +389,25 @@ if(i(c.b.a,l.b.a)){if(0>n(c.b.a,l.b.a,c.a)){r=!1
|
|
|
389
389
|
break t}ut(r).b=r.b=!0,u=y(c),f(l.b,u),u.d.c=r.d}else{if(n(l.b.a,c.b.a,l.a)>0){r=!1
|
|
390
390
|
break t}r.b=a.b=!0,u=y(l),f(c.e,l.b),u.b.d.c=r.d}r=!0}if(r&&(s.c?(A(s),d(h),h=(s=lt(e)).a):e.c&&(A(e),d(o),o=(e=ut(s)).a)),o.a!==h.a)if(o.b.a===h.b.a||e.c||s.c||o.b.a!==t.a&&h.b.a!==t.a)U(t,e)
|
|
391
391
|
else if(N(t,e))break
|
|
392
|
-
o.a===h.a&&o.b.a===h.b.a&&(
|
|
393
|
-
for(var r=s.c;null===r.
|
|
392
|
+
o.a===h.a&&o.b.a===h.b.a&&(_(h,o),A(e),d(o),e=ut(s))}}function P(t,s){t.a=s
|
|
393
|
+
for(var r=s.c;null===r._i;)if((r=r.c)===s.c){r=t
|
|
394
394
|
var o=s;(u=new ct).a=o.c.b
|
|
395
395
|
var h=(l=r.f).a
|
|
396
396
|
do{h=h.a}while(null!==h.b&&!l.c(l.b,u,h.b))
|
|
397
397
|
if(h=(c=lt(l=h.b)).a,0===n((u=l.a).b.a,o,u.a))e((u=l.a).a,o)||e(u.b.a,o)||(y(u.b),l.c&&(d(u.c),l.c=!1),f(o.c,u),P(r,o))
|
|
398
398
|
else{var a=i(h.b.a,u.b.a)?l:c,c=void 0
|
|
399
|
-
l.d||a.c?(c=a===l?p(o.c.b,u.e):p(h.b.c.b,o.c).b,a.c?L(a,c):(u=r,(l=I(r,l,c)).f=ut(l).f+l.a.f,l.d=G(u,l.f)),P(r,o)):k(r,l,o.c,o.c,null,!0)}return}if(l=(u=lt(r=M(r.
|
|
400
|
-
s.a.b=dt,s.a.a=e,s.b.a.b=-dt,s.b.a.a=e,t.a=s.b.a,i.a=s,i.f=0,i.d=!1,i.c=!1,i.
|
|
401
|
-
return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function H(){this.d=yt,this.Ai=this.b=this.Li=null,this.Mi=[0,0,0],this.s=100130,this.n=!1,this.Ti=this.a=this.e=this.f=null,this.Ii=!1,this.c=this.r=this.
|
|
399
|
+
l.d||a.c?(c=a===l?p(o.c.b,u.e):p(h.b.c.b,o.c).b,a.c?L(a,c):(u=r,(l=I(r,l,c)).f=ut(l).f+l.a.f,l.d=G(u,l.f)),P(r,o)):k(r,l,o.c,o.c,null,!0)}return}if(l=(u=lt(r=M(r._i))).a,(u=F(t,u,null)).c===l){var l,u=(l=u).c,w=(h=lt(r),!1);(c=r.a).b.a!==(a=h.a).b.a&&N(t,r),e(c.a,t.a)&&(f(X(u),c),u=lt(r=M(r)).a,F(t,lt(r),h),w=!0),e(a.a,t.a)&&(f(l,X(a)),l=F(t,h,null),w=!0),w?k(t,r,l.c,u,u,!0):(o=i(a.a,c.a)?X(a):c,k(t,r,o=p(l.c.b,o),o.c,o.c,!1),o.b._i.c=!0,D(t,r))}else k(t,r,u.c,l,l,!0)}function R(t,e){var i=new ct,s=u(t.b)
|
|
400
|
+
s.a.b=dt,s.a.a=e,s.b.a.b=-dt,s.b.a.a=e,t.a=s.b.a,i.a=s,i.f=0,i.d=!1,i.c=!1,i.Ei=!0,i.b=!1,s=W(s=t.f,s.a,i),i.e=s}function z(t){this.a=new j,this.b=t,this.c=T}function W(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i))
|
|
401
|
+
return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function H(){this.d=yt,this.Ai=this.b=this.Li=null,this.Mi=[0,0,0],this.s=100130,this.n=!1,this.Ti=this.a=this.e=this.f=null,this.Ii=!1,this.c=this.r=this._i=this.Gi=this.Oi=this.Ei=null}function q(t,e){if(t.d!==e)for(;t.d!==e;)if(e>t.d)switch(t.d){case yt:J(t,100151),t.Fi(null)
|
|
402
402
|
break
|
|
403
403
|
case 1:J(t,100152),t.ki()}else switch(t.d){case 2:J(t,100154),t.Ci()
|
|
404
404
|
break
|
|
405
|
-
case 1:J(t,100153),t.w()}}function J(t,e){t.Ai&&t.Ai(e,t.c)}function Y(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function K(){this.
|
|
406
|
-
return 2*n>s.f&&(s.f*=2,s.c=nt(s.c,s.f+1)),0===s.b?i=n:(i=s.b,s.b=s.c[s.b]),s.e[i]=e,s.c[i]=n,s.d[n]=i,s.
|
|
405
|
+
case 1:J(t,100153),t.w()}}function J(t,e){t.Ai&&t.Ai(e,t.c)}function Y(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function K(){this.Ei=this,this._i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function X(t){return t.b.e}function Q(){this.c=new Z,this.a=new Y,this.b=new K,this.d=new K,this.b.b=this.d,this.d.b=this.b}function Z(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.Ei=this.a=this.b=0}function tt(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new st}function et(t,e){if(t.e){var i,s=t.b,n=++s.a
|
|
406
|
+
return 2*n>s.f&&(s.f*=2,s.c=nt(s.c,s.f+1)),0===s.b?i=n:(i=s.b,s.b=s.c[s.b]),s.e[i]=e,s.c[i]=n,s.d[n]=i,s.Ei&&at(s,n),i}return s=t.a++,t.c[s]=e,-(s+1)}function it(t){if(0===t.a)return ot(t.b)
|
|
407
407
|
var e=t.c[t.d[t.a-1]]
|
|
408
408
|
if(0!==t.b.a&&i(rt(t.b),e))return ot(t.b)
|
|
409
409
|
do{--t.a}while(t.a>0&&null===t.c[t.d[t.a-1]])
|
|
410
|
-
return e}function st(){this.d=nt([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.
|
|
410
|
+
return e}function st(){this.d=nt([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.Ei=!1,this.d[1]=1}function nt(t,e){for(var i=Array(e),s=0;t.length>s;s++)i[s]=t[s]
|
|
411
411
|
for(;e>s;s++)i[s]=0
|
|
412
412
|
return i}function rt(t){return t.e[t.d[1]]}function ot(t){var e=t.d,i=t.e,s=t.c,n=e[1],r=i[n]
|
|
413
413
|
return t.a>0&&(e[1]=e[t.a],s[e[1]]=1,i[n]=null,s[n]=t.b,t.b=n,--t.a>0&&ht(t,1)),r}function ht(t,e){for(var s=t.d,n=t.e,r=t.c,o=e,h=s[o];;){var a=o<<1
|
|
@@ -416,20 +416,20 @@ var c=s[a]
|
|
|
416
416
|
if(a>t.a||i(n[h],n[c])){s[o]=h,r[h]=o
|
|
417
417
|
break}s[o]=c,r[c]=o,o=a}}function at(t,e){for(var s=t.d,n=t.e,r=t.c,o=e,h=s[o];;){var a=o>>1,c=s[a]
|
|
418
418
|
if(0===a||i(n[c],n[h])){s[o]=h,r[h]=o
|
|
419
|
-
break}s[o]=c,r[c]=o,o=a}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.
|
|
419
|
+
break}s[o]=c,r[c]=o,o=a}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.Ei=this.d=!1}function lt(t){return t.e.c.b}function ut(t){return t.e.a.b}var ft,dt=4e150,yt=0;(ft=H.prototype).x=function(){q(this,yt)},ft.B=function(t,e){switch(t){case 100142:return
|
|
420
420
|
case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break
|
|
421
421
|
case 100141:return void(this.Ii=!!e)
|
|
422
422
|
default:return void J(this,100900)}J(this,100901)},ft.y=function(t){switch(t){case 100142:return 0
|
|
423
423
|
case 100140:return this.s
|
|
424
424
|
case 100141:return this.Ii
|
|
425
425
|
default:J(this,100900)}return!1},ft.A=function(t,e,i){this.Mi[0]=t,this.Mi[1]=e,this.Mi[2]=i},ft.z=function(t,e){var i=e||null
|
|
426
|
-
switch(t){case 100100:case 100106:this.
|
|
426
|
+
switch(t){case 100100:case 100106:this.Ei=i
|
|
427
427
|
break
|
|
428
428
|
case 100104:case 100110:this.Oi=i
|
|
429
429
|
break
|
|
430
430
|
case 100101:case 100107:this.Gi=i
|
|
431
431
|
break
|
|
432
|
-
case 100102:case 100108:this.
|
|
432
|
+
case 100102:case 100108:this._i=i
|
|
433
433
|
break
|
|
434
434
|
case 100103:case 100109:this.Ai=i
|
|
435
435
|
break
|
|
@@ -443,39 +443,39 @@ for(var n=0;3>n;++n){var r=t[n];-1e150>r&&(r=-1e150,i=!0),r>1e150&&(r=1e150,i=!0
|
|
|
443
443
|
var t=!1,s=[u=this.Mi[0],r=this.Mi[1],h=this.Mi[2]]
|
|
444
444
|
if(0===u&&0===r&&0===h){for(var r=[-2e150,-2e150,-2e150],o=[2e150,2e150,2e150],h=[],l=[],u=(t=this.b.c).e;u!==t;u=u.e)for(var f=0;3>f;++f){var y=u.g[f]
|
|
445
445
|
o[f]>y&&(o[f]=y,l[f]=u),y>r[f]&&(r[f]=y,h[f]=u)}if(u=0,r[1]-o[1]>r[0]-o[0]&&(u=1),r[2]-o[2]>r[u]-o[u]&&(u=2),r[u]>o[u]){for(r=0,o=l[u],l=[0,0,0],o=[o.g[0]-(h=h[u]).g[0],o.g[1]-h.g[1],o.g[2]-h.g[2]],f=[0,0,0],u=t.e;u!==t;u=u.e)f[0]=u.g[0]-h.g[0],f[1]=u.g[1]-h.g[1],f[2]=u.g[2]-h.g[2],l[0]=o[1]*f[2]-o[2]*f[1],l[1]=o[2]*f[0]-o[0]*f[2],l[2]=o[0]*f[1]-o[1]*f[0],(y=l[0]*l[0]+l[1]*l[1]+l[2]*l[2])>r&&(r=y,s[0]=l[0],s[1]=l[1],s[2]=l[2])
|
|
446
|
-
0>=r&&(s[0]=s[1]=s[2]=0,s[
|
|
447
|
-
t=!0}for(r=((l=
|
|
446
|
+
0>=r&&(s[0]=s[1]=s[2]=0,s[E(o)]=1)}else s[0]=0,s[1]=0,s[2]=1
|
|
447
|
+
t=!0}for(r=((l=E(s))+1)%3,h=(l+2)%3,l=s[l]>0?1:-1,s=(u=this.b.c).e;s!==u;s=s.e)s.b=s.g[r],s.a=l*s.g[h]
|
|
448
448
|
if(t){for(s=0,u=(t=this.b.a).b;u!==t;u=u.b)if((r=u.a).f>0)do{s+=(r.a.b-r.b.a.b)*(r.a.a+r.b.a.a),r=r.e}while(r!==u.a)
|
|
449
|
-
if(0>s)for(t=(s=this.b.c).e;t!==s;t=t.e)t.a=-t.a}for(this.n=!1,u=(s=this.b.b).
|
|
450
|
-
for(this.e=s=new tt,u=(t=this.b.c).e;u!==t;u=u.e)u.
|
|
449
|
+
if(0>s)for(t=(s=this.b.c).e;t!==s;t=t.e)t.a=-t.a}for(this.n=!1,u=(s=this.b.b).Ei;u!==s;u=t)t=u.Ei,r=u.e,e(u.a,u.b.a)&&u.e.e!==u&&(B(this,r,u),d(u),r=(u=r).e),r.e===u&&(r!==u&&(r!==t&&r!==t.b||(t=t.Ei),d(r)),u!==t&&u!==t.b||(t=t.Ei),d(u))
|
|
450
|
+
for(this.e=s=new tt,u=(t=this.b.c).e;u!==t;u=u.e)u.Ei=et(s,u)
|
|
451
451
|
for((t=>{t.d=[]
|
|
452
452
|
for(var e=0;t.a>e;e++)t.d[e]=e
|
|
453
453
|
t.d.sort((t=>(e,s)=>i(t[e],t[s])?1:-1)(t.c)),t.e=!0,(t=>{for(var e=t.a;e>=1;--e)ht(t,e)
|
|
454
|
-
t.
|
|
454
|
+
t.Ei=!0})(t.b)})(s),this.f=new z(this),R(this,-dt),R(this,dt);null!==(s=it(this.e));){for(;;){t:if(u=this.e,0===u.a)t=rt(u.b)
|
|
455
455
|
else if(t=u.c[u.d[u.a-1]],0!==u.b.a&&(u=rt(u.b),i(u,t))){t=u
|
|
456
456
|
break t}if(null===t||!e(t,s))break
|
|
457
|
-
t=it(this.e),B(this,s.c,t.c)}P(this,s)}for(this.a=this.f.a.a.b.a.a,s=0;null!==(t=this.f.a.a.b);)t.
|
|
458
|
-
for(this.f=null,(s=this.e).b=null,s.d=null,this.e=s.c=null,u=(s=this.b).a.b;u!==s.a;u=t)t=u.b,(u=u.a).e.e===u&&(
|
|
459
|
-
if(!this.n){if(s=this.b,this.Ii)for(u=s.b.
|
|
457
|
+
t=it(this.e),B(this,s.c,t.c)}P(this,s)}for(this.a=this.f.a.a.b.a.a,s=0;null!==(t=this.f.a.a.b);)t.Ei||++s,A(t)
|
|
458
|
+
for(this.f=null,(s=this.e).b=null,s.d=null,this.e=s.c=null,u=(s=this.b).a.b;u!==s.a;u=t)t=u.b,(u=u.a).e.e===u&&(_(u.c,u),d(u))
|
|
459
|
+
if(!this.n){if(s=this.b,this.Ii)for(u=s.b.Ei;u!==s.b;u=t)t=u.Ei,u.b.d.c!==u.d.c?u.f=u.d.c?1:-1:d(u)
|
|
460
460
|
else for(u=s.a.b;u!==s.a;u=t)if(t=u.b,u.c){for(u=u.a;i(u.b.a,u.a);u=u.c.b);for(;i(u.a,u.b.a);u=u.e);for(r=u.c.b,h=void 0;u.e!==r;)if(i(u.b.a,r.a)){for(;r.e!==u&&(a(r.e)||0>=n(r.a,r.b.a,r.e.b.a));)r=(h=p(r.e,r)).b
|
|
461
461
|
r=r.c.b}else{for(;r.e!==u&&(c(u.c.b)||n(u.b.a,u.a,u.c.b.a)>=0);)u=(h=p(u,u.c.b)).b
|
|
462
|
-
u=u.e}for(;r.e.e!==u;)r=(h=p(r.e,r)).b}if(this.
|
|
462
|
+
u=u.e}for(;r.e.e!==u;)r=(h=p(r.e,r)).b}if(this.Ei||this._i||this.Gi||this.Oi)if(this.Ii){for(t=(s=this.b).a.b;t!==s.a;t=t.b)if(t.c){this.Ei&&this.Ei(2,this.c),u=t.a
|
|
463
463
|
do{this.Gi&&this.Gi(u.a.d,this.c),u=u.e}while(u!==t.a)
|
|
464
|
-
this.
|
|
465
|
-
do{t&&r!==(o=l.b.d.c?0:1)&&(r=o,this.Oi&&this.Oi(!!r,this.c)),this.Gi&&this.Gi(l.a.d,this.c),l=l.e}while(l!==h.a)}u&&this.
|
|
464
|
+
this._i&&this._i(this.c)}}else{for(t=!!this.Oi,u=!1,r=-1,h=(s=this.b).a.d;h!==s.a;h=h.d)if(h.c){u||(this.Ei&&this.Ei(4,this.c),u=!0),l=h.a
|
|
465
|
+
do{t&&r!==(o=l.b.d.c?0:1)&&(r=o,this.Oi&&this.Oi(!!r,this.c)),this.Gi&&this.Gi(l.a.d,this.c),l=l.e}while(l!==h.a)}u&&this._i&&this._i(this.c)}if(this.r){for(u=(s=this.b).a.b;u!==s.a;u=t)if(t=u.b,!u.c){h=(r=u.a).e,l=void 0
|
|
466
466
|
do{h=(l=h).e,l.d=null,null===l.b.d&&(l.c===l?S(l.a,null):(l.a.c=l.c,v(l,X(l))),(o=l.b).c===o?S(o.a,null):(o.a.c=o.c,v(o,X(o))),x(l))}while(l!==r)
|
|
467
467
|
r=u.d,(u=u.b).d=r,r.b=u}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},V.Bi={GluTesselator:H,$i:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},Ui:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},Ni:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},H.prototype.Di=H.prototype.x,H.prototype.Pi=H.prototype.B,H.prototype.Ri=H.prototype.y,H.prototype.zi=H.prototype.A,H.prototype.Wi=H.prototype.z,H.prototype.ji=H.prototype.C,H.prototype.Hi=H.prototype.Fi,H.prototype.Vi=H.prototype.ki,H.prototype.qi=H.prototype.Ci,H.prototype.Ji=H.prototype.w,t.exports=V.Bi})(q)
|
|
468
468
|
var J=q.exports
|
|
469
469
|
class Y{process(t,e=!0,i=!1,s=!0){if(0===t.length)return{Yi:{vertices:[],indices:[]},Ki:[]}
|
|
470
470
|
const n=t.filter(t=>t.points.length>=3)
|
|
471
|
-
return 0===n.length?{Yi:{vertices:[],indices:[]},Ki:[]}:this.Xi(n,e,i,s)}Xi(t,e,i,s){
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
471
|
+
return 0===n.length?{Yi:{vertices:[],indices:[]},Ki:[]}:this.Xi(n,e,i,s)}Xi(t,e,i,s){const n=!i&&!e
|
|
472
|
+
let r,o
|
|
473
|
+
n?(o=this.Qi(t,!0),(e||s)&&(r=this.Qi(t))):(r=this.Qi(t),o=r)
|
|
474
|
+
let h=s?n?o:r??this.Qi(t):[]
|
|
475
|
+
if(e){const t=this.Zi(r,"boundary")
|
|
475
476
|
if(!t)return c.warn("libtess returned empty result from boundary pass"),{Yi:{vertices:[],indices:[]},Ki:[]}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
return h?{Yi:{vertices:h.vertices,indices:h.indices||[]},Ki:o}:(c.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{Yi:{vertices:[],indices:[]},Ki:o})}Qi(t,e=!1){const i=Array(t.length)
|
|
477
|
+
o=this.ts(t),s&&(h=o)}const a=this.Zi(o,"triangles")
|
|
478
|
+
return a?{Yi:{vertices:a.vertices,indices:a.indices||[]},Ki:h}:(c.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{Yi:{vertices:[],indices:[]},Ki:h})}Qi(t,e=!1){const i=Array(t.length)
|
|
479
479
|
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))
|
|
480
480
|
let a=0
|
|
481
481
|
if(e)for(let t=o-1;t>=0;t--){const e=n[t]
|
|
@@ -488,11 +488,11 @@ let o=[]
|
|
|
488
488
|
return s.push(t[0],t[1]),e}),i.Wi(J.Ni.GLU_TESS_ERROR,t=>{c.warn("libtess error: "+t)}),i.zi(0,0,1),i.Hi(null)
|
|
489
489
|
for(const e of t){i.Vi()
|
|
490
490
|
for(let t=0;e.length>t;t+=2){const n=s.length/2
|
|
491
|
-
s.push(e[t],e[t+1]),i.ji([e[t],e[t+1],0],n)}i.qi()}return i.Ji(),0===s.length?null:"triangles"===e?{vertices:s,indices:n}:{vertices:s,
|
|
491
|
+
s.push(e[t],e[t+1]),i.ji([e[t],e[t+1],0],n)}i.qi()}return i.Ji(),0===s.length?null:"triangles"===e?{vertices:s,indices:n}:{vertices:s,es:r}}ts(t){if(!t.es)return[]
|
|
492
492
|
const e=[]
|
|
493
|
-
for(const i of t.
|
|
493
|
+
for(const i of t.es){const s=[]
|
|
494
494
|
for(const e of i){const i=2*e
|
|
495
|
-
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}
|
|
495
|
+
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}ss(t){if(0===t.length)return!1
|
|
496
496
|
if(1===t.length)return!1
|
|
497
497
|
let e=null
|
|
498
498
|
for(const i of t){const t=0>this.ns(i)?-1:1
|
|
@@ -501,370 +501,378 @@ else if(t!==e)return!0}return!1}ns(t){let e=0
|
|
|
501
501
|
const i=t.length
|
|
502
502
|
if(6>i)return 0
|
|
503
503
|
for(let s=0;i>s;s+=2)e+=t[s]*t[(s+3)%i]-t[(s+2)%i]*t[s+1]
|
|
504
|
-
return e/2}}class K{constructor(){}rs(t,e=0,i){const s=t.Yi.vertices,n=t.Yi.indices,r=s.length/2
|
|
505
|
-
let o=
|
|
506
|
-
if(0!==e)
|
|
507
|
-
|
|
504
|
+
return e/2}}class K{constructor(){}rs(t,e){return 4294967296*(e>t?t:e)+(e>t?e:t)}hs(t,e=0,i){const s=t.Yi.vertices,n=t.Yi.indices,r=s.length/2
|
|
505
|
+
let o=[]
|
|
506
|
+
if(0!==e){const t=new Map,e=new Map
|
|
507
|
+
for(let i=0;n.length>i;i+=3){const s=n[i],r=n[i+1],o=n[i+2],h=this.rs(s,r),a=(t.get(h)??0)+1
|
|
508
|
+
t.set(h,a),1===a&&e.set(h,[s,r])
|
|
509
|
+
const c=this.rs(r,o),l=(t.get(c)??0)+1
|
|
510
|
+
t.set(c,l),1===l&&e.set(c,[r,o])
|
|
511
|
+
const u=this.rs(o,s),f=(t.get(u)??0)+1
|
|
512
|
+
t.set(u,f),1===f&&e.set(u,[o,s])}o=[]
|
|
513
|
+
for(const[i,s]of t){if(1!==s)continue
|
|
514
|
+
const t=e.get(i)
|
|
515
|
+
t&&o.push(t)}}const h=0===e?0:o.length,a=(0===e?r:2*r)+(0===e?0:4*h),c=new Float32Array(3*a),l=new Float32Array(3*a),u=new Uint32Array(0===e?n.length:2*n.length+6*h)
|
|
508
516
|
if(0===e){let t=0
|
|
509
|
-
for(let e=0;s.length>e;e+=2)
|
|
510
|
-
for(let t=0;n.length>t;t++)
|
|
511
|
-
return{vertices:
|
|
517
|
+
for(let e=0;s.length>e;e+=2)c[t]=s[e],c[t+1]=s[e+1],c[t+2]=0,l[t]=0,l[t+1]=0,l[t+2]=1,t+=3
|
|
518
|
+
for(let t=0;n.length>t;t++)u[t]=n[t]
|
|
519
|
+
return{vertices:c,normals:l,indices:u}}const f=25e-6*i,d=e>f?e:f
|
|
512
520
|
for(let t=0,e=0;s.length>t;t+=2,e++){const i=s[t],n=s[t+1],o=3*e
|
|
513
|
-
|
|
521
|
+
c[o]=i,c[o+1]=n,c[o+2]=0,l[o]=0,l[o+1]=0,l[o+2]=-1
|
|
514
522
|
const h=3*(r+e)
|
|
515
|
-
|
|
516
|
-
for(let t=0;n.length>t;t++)
|
|
517
|
-
let
|
|
518
|
-
for(
|
|
519
|
-
let
|
|
520
|
-
if(
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
return 0===i?[]:1===i?[[0]]:this.
|
|
523
|
+
c[h]=i,c[h+1]=n,c[h+2]=d,l[h]=0,l[h+1]=0,l[h+2]=1}for(let t=0;n.length>t;t++)u[t]=n[n.length-1-t]
|
|
524
|
+
for(let t=0;n.length>t;t++)u[n.length+t]=n[t]+r
|
|
525
|
+
let y=2*r,p=2*n.length
|
|
526
|
+
for(let t=0;o.length>t;t++){const[e,i]=o[t],n=2*e,r=2*i,h=s[n],a=s[n+1],f=s[r],w=s[r+1],v=f-h,m=w-a,g=v*v+m*m
|
|
527
|
+
let x=0,S=0
|
|
528
|
+
if(g>0){const t=1/Math.sqrt(g)
|
|
529
|
+
x=m*t,S=-v*t}const b=y,E=3*b
|
|
530
|
+
c[E]=h,c[E+1]=a,c[E+2]=0,c[E+3]=f,c[E+4]=w,c[E+5]=0,c[E+6]=h,c[E+7]=a,c[E+8]=d,c[E+9]=f,c[E+10]=w,c[E+11]=d,l[E]=x,l[E+1]=S,l[E+2]=0,l[E+3]=x,l[E+4]=S,l[E+5]=0,l[E+6]=x,l[E+7]=S,l[E+8]=0,l[E+9]=x,l[E+10]=S,l[E+11]=0,u[p++]=b,u[p++]=b+1,u[p++]=b+2,u[p++]=b+1,u[p++]=b+3,u[p++]=b+2,y+=4}return{vertices:c,normals:l,indices:u}}}class X{constructor(){}cs(t,e){const i=t.length
|
|
531
|
+
return 0===i?[]:1===i?[[0]]:this.ls(t,e)}ls(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)
|
|
524
532
|
s!==n&&(c[n]>c[s]?a[s]=n:c[s]>c[n]?a[n]=s:(a[n]=s,c[s]++))}const n=t.length,r=Array(n),o=Array(2*n)
|
|
525
533
|
let h=0
|
|
526
|
-
for(let i=0;n>i;i++)r[i]=this.
|
|
534
|
+
for(let i=0;n>i;i++)r[i]=this.us(t[i],e[i]),o[h++]=[r[i].fs,0,i],o[h++]=[r[i].ds,1,i]
|
|
527
535
|
o.sort((t,e)=>t[0]-e[0]||t[1]-e[1])
|
|
528
536
|
const a=Array.from({length:n},(t,e)=>e),c=Array(n).fill(0),l=new Set
|
|
529
537
|
for(const[,t,e]of o)if(0===t){const t=r[e]
|
|
530
538
|
for(const i of l){const n=r[i]
|
|
531
|
-
n.
|
|
539
|
+
n.ys+.001>t.ps&&t.ys>n.ps-.001&&s(e,i)}l.add(e)}else l.delete(e)
|
|
532
540
|
const u=new Map
|
|
533
541
|
for(let t=0;n>t;t++){const e=i(t)
|
|
534
542
|
let s=u.get(e)
|
|
535
|
-
s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}
|
|
536
|
-
if(void 0!==e)return this.
|
|
537
|
-
const i=this.
|
|
538
|
-
this.
|
|
543
|
+
s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}us(t,e){return{fs:t.bounds.min.x+e.x,ps:t.bounds.min.y+e.y,ds:t.bounds.max.x+e.x,ys:t.bounds.max.y+e.y}}}class Q{constructor(t){this.ws=[],this.vs=new Map,this.compare=t}k(t){const e=this.vs.get(t)
|
|
544
|
+
if(void 0!==e)return this.gs(e),void this.xs(e)
|
|
545
|
+
const i=this.ws.length
|
|
546
|
+
this.ws.push(t),this.vs.set(t,i),this.gs(i)}Ss(){const t=this.ws.length
|
|
539
547
|
if(!t)return
|
|
540
|
-
if(1===t){const t=this.
|
|
541
|
-
return this.
|
|
542
|
-
return this.
|
|
543
|
-
void 0!==e?(this.
|
|
544
|
-
this.
|
|
545
|
-
for(;t>0;){const i=t-1>>1,s=this.
|
|
548
|
+
if(1===t){const t=this.ws.pop()
|
|
549
|
+
return this.vs.clear(),t}const e=this.ws[0],i=this.ws.pop()
|
|
550
|
+
return this.ws[0]=i,this.vs.delete(e),this.vs.set(i,0),this.xs(0),e}update(t){const e=this.vs.get(t)
|
|
551
|
+
void 0!==e?(this.gs(e),this.xs(e)):this.k(t)}bs(){return!this.ws.length}Es(t,e){const i=this.ws[t],s=this.ws[e]
|
|
552
|
+
this.ws[t]=s,this.ws[e]=i,this.vs.set(i,e),this.vs.set(s,t)}gs(t){const e=this.ws[t]
|
|
553
|
+
for(;t>0;){const i=t-1>>1,s=this.ws[i]
|
|
546
554
|
if(this.compare(e,s)>=0)break
|
|
547
|
-
this.
|
|
555
|
+
this.ws[t]=s,this.vs.set(s,t),t=i}this.ws[t]=e,this.vs.set(e,t)}xs(t){const e=this.ws[t],i=this.ws.length,s=i>>1
|
|
548
556
|
for(;s>t;){const s=1+(t<<1),n=s+1
|
|
549
557
|
let r=t,o=e
|
|
550
|
-
const h=this.
|
|
551
|
-
if(0>this.compare(h,o)&&(r=s,o=h),i>n){const t=this.
|
|
558
|
+
const h=this.ws[s]
|
|
559
|
+
if(0>this.compare(h,o)&&(r=s,o=h),i>n){const t=this.ws[n]
|
|
552
560
|
0>this.compare(t,o)&&(r=n,o=t)}if(r===t)break
|
|
553
|
-
this.
|
|
554
|
-
class tt{constructor(t){this.stats={
|
|
555
|
-
this.stats.
|
|
561
|
+
this.ws[t]=o,this.vs.set(o,t),t=r}this.ws[t]=e,this.vs.set(e,t)}}const Z={enabled:!0,_s:1,Ts:.0087,As:10}
|
|
562
|
+
class tt{constructor(t){this.stats={Ls:0,Ms:0,Is:0},this.config=t}Gs(t){this.config=t}Os(t){if(!this.config.enabled||2>=t.points.length)return t
|
|
563
|
+
this.stats.Is+=t.points.length
|
|
556
564
|
const e=t.points
|
|
557
565
|
if(5>e.length)return t
|
|
558
|
-
let i=this.
|
|
559
|
-
return 3>i.length?t:(i=this.
|
|
560
|
-
const i=t.length,s=t.map((t,e)=>({index:e,
|
|
566
|
+
let i=this.Fs(e,this.config._s)
|
|
567
|
+
return 3>i.length?t:(i=this.ks(i,this.config.Ts),3>i.length?t:{...t,points:i})}Fs(t,e){if(3>=t.length)return t
|
|
568
|
+
const i=t.length,s=t.map((t,e)=>({index:e,Cs:1/0,pi:null,next:null}))
|
|
561
569
|
for(let t=0;s.length>t;t++)s[t].pi=s[t-1]||null,s[t].next=s[t+1]||null
|
|
562
|
-
const n=new Q((t,e)=>t.
|
|
570
|
+
const n=new Q((t,e)=>t.Cs-e.Cs)
|
|
563
571
|
for(let e=1;s.length-1>e;e++){const i=s[e]
|
|
564
|
-
i.
|
|
565
|
-
for(;!n.
|
|
566
|
-
if(!i||i.
|
|
567
|
-
if(this.config.
|
|
568
|
-
if(this.config.
|
|
572
|
+
i.Cs=this.Bs(t[i.pi.index],t[i.index],t[i.next.index]),n.k(i)}let r=i
|
|
573
|
+
for(;!n.bs()&&r>3;){const i=n.Ss()
|
|
574
|
+
if(!i||i.Cs>e)break
|
|
575
|
+
if(this.config.As>0&&i.pi&&i.next){const e=t[i.index],s=t[i.next.index],n=t[i.pi.index].ni(e),r=e.ni(s)
|
|
576
|
+
if(this.config.As>n||this.config.As>r)continue}i.pi&&(i.pi.next=i.next),i.next&&(i.next.pi=i.pi),r--,i.pi&&i.pi.pi&&(i.pi.Cs=this.Bs(t[i.pi.pi.index],t[i.pi.index],t[i.next.index]),n.update(i.pi)),i.next&&i.next.next&&(i.next.Cs=this.Bs(t[i.pi.index],t[i.next.index],t[i.next.next.index]),n.update(i.next))}const o=[]
|
|
569
577
|
let h=s[0]
|
|
570
578
|
for(;h;)o.push(t[h.index]),h=h.next
|
|
571
|
-
return this.stats.
|
|
579
|
+
return this.stats.Ls+=i-o.length,o}ks(t,e){if(2>=t.length)return t
|
|
572
580
|
const i=[t[0]]
|
|
573
|
-
for(let s=1;t.length-1>s;s++){const n=t[s-1],r=t[s],o=t[s+1],h=r.x-n.x,a=r.y-n.y,c=o.x-r.x,l=o.y-r.y,u=this.config.
|
|
574
|
-
Math.abs(Math.atan2(h*l-a*c,h*c+a*l))>e||u>h*h+a*a||u>c*c+l*l?i.push(r):this.stats.
|
|
575
|
-
class st{constructor(t){this.
|
|
576
|
-
return this.
|
|
577
|
-
return this.
|
|
578
|
-
const a=(t+i)/2,c=(e+s)/2,l=(i+n)/2,u=(s+r)/2,f=(a+l)/2,d=(c+u)/2,y=n-t,p=r-e,w=Math.abs((i-n)*p-(s-r)*y),v=this.
|
|
579
|
-
if(w>it){if(m*(y*y+p*p)>=w*w){const h=this.Ns
|
|
580
|
-
if(0>=h)return void this.
|
|
581
|
+
for(let s=1;t.length-1>s;s++){const n=t[s-1],r=t[s],o=t[s+1],h=r.x-n.x,a=r.y-n.y,c=o.x-r.x,l=o.y-r.y,u=this.config.As*this.config.As
|
|
582
|
+
Math.abs(Math.atan2(h*l-a*c,h*c+a*l))>e||u>h*h+a*a||u>c*c+l*l?i.push(r):this.stats.Ms++}return i.push(t[t.length-1]),i}Bs(t,e,i){return Math.abs((t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y))/2)}getStats(){return{...this.stats}}$s(){this.stats={Ls:0,Ms:0,Is:0}}}const et={Us:.5,Ns:.2},it=1e-6
|
|
583
|
+
class st{constructor(t){this.Ds={...et,...t}}Ps(t){this.Ds={...et,...t}}Rs(t,e,i){const s=[]
|
|
584
|
+
return this.zs(t.x,t.y,e.x,e.y,i.x,i.y,s),this.Ws(i.x,i.y,s),s}js(t,e,i,s){const n=[]
|
|
585
|
+
return this.Hs(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y,n),this.Ws(s.x,s.y,n),n}zs(t,e,i,s,n,r,o,h=0){if(h>16)return
|
|
586
|
+
const a=(t+i)/2,c=(e+s)/2,l=(i+n)/2,u=(s+r)/2,f=(a+l)/2,d=(c+u)/2,y=n-t,p=r-e,w=Math.abs((i-n)*p-(s-r)*y),v=this.Ds.Us??.5,m=v*v
|
|
587
|
+
if(w>it){if(m*(y*y+p*p)>=w*w){const h=this.Ds.Ns??.2
|
|
588
|
+
if(0>=h)return void this.Ws(i,s,o)
|
|
581
589
|
{const a=i-t,c=s-e,l=n-i,u=r-s
|
|
582
|
-
if(h>Math.abs(Math.atan2(a*u-c*l,a*l+c*u)))return void this.
|
|
583
|
-
if(0===n){if(m>=(i-t)*(i-t)+(s-e)*(s-e))return void this.
|
|
584
|
-
if(r>0&&1>r&&m*n>=w*w)return void this.
|
|
585
|
-
const l=(t+i)/2,u=(e+s)/2,f=(i+n)/2,d=(s+r)/2,y=(n+o)/2,p=(r+h)/2,w=(l+f)/2,v=(u+d)/2,m=(f+y)/2,g=(d+p)/2,x=(w+m)/2,S=(v+g)/2,b=o-t,
|
|
590
|
+
if(h>Math.abs(Math.atan2(a*u-c*l,a*l+c*u)))return void this.Ws(i,s,o)}}}else{const n=y*y+p*p
|
|
591
|
+
if(0===n){if(m>=(i-t)*(i-t)+(s-e)*(s-e))return void this.Ws(i,s,o)}else{const r=((i-t)*y+(s-e)*p)/n
|
|
592
|
+
if(r>0&&1>r&&m*n>=w*w)return void this.Ws(i,s,o)}}this.zs(t,e,a,c,f,d,o,h+1),this.zs(f,d,l,u,n,r,o,h+1)}Hs(t,e,i,s,n,r,o,h,a,c=0){if(c>16)return
|
|
593
|
+
const l=(t+i)/2,u=(e+s)/2,f=(i+n)/2,d=(s+r)/2,y=(n+o)/2,p=(r+h)/2,w=(l+f)/2,v=(u+d)/2,m=(f+y)/2,g=(d+p)/2,x=(w+m)/2,S=(v+g)/2,b=o-t,E=h-e,_=Math.abs((i-o)*E-(s-h)*b),T=Math.abs((n-o)*E-(r-h)*b),A=this.Ds.Us??.5,L=A*A
|
|
586
594
|
let M=0
|
|
587
|
-
switch(
|
|
588
|
-
if(0===c){if(L>=(i-t)*(i-t)+(s-e)*(s-e)&&L>=(n-t)*(n-t)+(r-e)*(r-e))return this.
|
|
589
|
-
if(o>0&&1>o&&h>0&&1>h&&L*c>=(
|
|
590
|
-
case 1:if(L*(b*b+
|
|
591
|
-
if(0>=t)return this.
|
|
595
|
+
switch(_>it&&(M|=1),T>it&&(M|=2),M){case 0:const c=b*b+E*E
|
|
596
|
+
if(0===c){if(L>=(i-t)*(i-t)+(s-e)*(s-e)&&L>=(n-t)*(n-t)+(r-e)*(r-e))return this.Ws(i,s,a),void this.Ws(n,r,a)}else{const o=((i-t)*b+(s-e)*E)/c,h=((n-t)*b+(r-e)*E)/c
|
|
597
|
+
if(o>0&&1>o&&h>0&&1>h&&L*c>=(_+T)*(_+T))return this.Ws(i,s,a),void this.Ws(n,r,a)}break
|
|
598
|
+
case 1:if(L*(b*b+E*E)>=T*T){const t=this.Ds.Ns??.2
|
|
599
|
+
if(0>=t)return this.Ws(i,s,a),void this.Ws(n,r,a)
|
|
592
600
|
{const e=n-i,c=r-s,l=o-n,u=h-r
|
|
593
|
-
if(t>Math.abs(Math.atan2(e*u-c*l,e*l+c*u)))return this.
|
|
594
|
-
case 2:if(L*(b*b+
|
|
595
|
-
if(0>=o)return this.
|
|
601
|
+
if(t>Math.abs(Math.atan2(e*u-c*l,e*l+c*u)))return this.Ws(i,s,a),void this.Ws(n,r,a)}}break
|
|
602
|
+
case 2:if(L*(b*b+E*E)>=_*_){const o=this.Ds.Ns??.2
|
|
603
|
+
if(0>=o)return this.Ws(i,s,a),void this.Ws(n,r,a)
|
|
596
604
|
{const h=i-t,c=s-e,l=n-i,u=r-s
|
|
597
|
-
if(o>Math.abs(Math.atan2(h*u-c*l,h*l+c*u)))return this.
|
|
598
|
-
case 3:if(L*(b*b+
|
|
599
|
-
if(0>=c)return this.
|
|
605
|
+
if(o>Math.abs(Math.atan2(h*u-c*l,h*l+c*u)))return this.Ws(i,s,a),void this.Ws(n,r,a)}}break
|
|
606
|
+
case 3:if(L*(b*b+E*E)>=(_+T)*(_+T)){const c=this.Ds.Ns??.2
|
|
607
|
+
if(0>=c)return this.Ws(i,s,a),void this.Ws(n,r,a)
|
|
600
608
|
{const l=i-t,u=s-e,f=n-i,d=r-s,y=o-n,p=h-r
|
|
601
|
-
if(c>Math.abs(Math.atan2(l*d-u*f,l*f+u*d))+Math.abs(Math.atan2(f*p-d*y,f*y+d*p)))return this.
|
|
609
|
+
if(c>Math.abs(Math.atan2(l*d-u*f,l*f+u*d))+Math.abs(Math.atan2(f*p-d*y,f*y+d*p)))return this.Ws(i,s,a),void this.Ws(n,r,a)}}}this.Hs(t,e,l,u,w,v,x,S,a,c+1),this.Hs(x,S,m,g,y,p,o,h,a,c+1)}Ws(t,e,i){const s=new D(t,e)
|
|
602
610
|
if(0===i.length)return void i.push(s)
|
|
603
611
|
const n=i[i.length-1],r=s.x-n.x,o=s.y-n.y
|
|
604
|
-
r*r+o*o>1e-12&&i.push(s)}}class nt{constructor(t,e){this.
|
|
612
|
+
r*r+o*o>1e-12&&i.push(s)}}class nt{constructor(t,e){this.Vs=0,this.qs=0,this.Js=[],this.Ys=null,this.Ks=null,this.Xs={min:new D(1/0,1/0),max:new D(-1/0,-1/0)},this.Qs=[],this.Zs=[],this.tn=[],this.en=new D(0,0),this.sn=new st(t),this.nn=new tt({...Z,...e})}setPosition(t,e){this.en.set(t,e)}rn(t,e){this.en.x+=t,this.en.y+=e}hn(t,e){this.Js.length>0&&this.an(),this.Vs=t,this.qs=e,this.Js=[],this.Xs.min.set(1/0,1/0),this.Xs.max.set(-1/0,-1/0),this.Zs.push(this.en.clone())}an(){this.Ys&&this.cn(),this.Js.length>0&&(this.Qs.push({ln:this.Vs,bi:this.Js,bounds:{min:{x:this.Xs.min.x,y:this.Xs.min.y},max:{x:this.Xs.max.x,y:this.Xs.max.y}}}),this.tn.push(this.qs)),this.Js=[]}un(t,e){this.Ys&&this.cn(),this.Ks=new D(t,e),this.fn(this.Ks),this.Ys={points:[this.Ks],dn:this.Vs}}yn(t,e){if(!this.Ys||!this.Ks)return
|
|
605
613
|
const i=new D(t,e)
|
|
606
|
-
this.
|
|
607
|
-
const n=this.
|
|
608
|
-
if(it>Math.abs((r.x-o.x)*(o.y-n.y)-(r.y-o.y)*(o.x-n.x)))return void this.
|
|
609
|
-
const h=this.
|
|
614
|
+
this.fn(i),this.Ys.points.push(i),this.Ks=i}pn(t,e,i,s){if(!this.Ys||!this.Ks)return
|
|
615
|
+
const n=this.Ks,r=new D(t,e),o=new D(i,s)
|
|
616
|
+
if(it>Math.abs((r.x-o.x)*(o.y-n.y)-(r.y-o.y)*(o.x-n.x)))return void this.yn(i,s)
|
|
617
|
+
const h=this.sn.Rs(n,r,o)
|
|
610
618
|
for(let t=0;h.length>t;t++){const e=h[t]
|
|
611
|
-
this.
|
|
612
|
-
const o=this.
|
|
613
|
-
if(it>Math.abs((h.x-c.x)*u-(h.y-c.y)*l)&&it>Math.abs((a.x-c.x)*u-(a.y-c.y)*l))return void this.
|
|
614
|
-
const f=this.
|
|
619
|
+
this.fn(e),this.Ys.points.push(e)}this.Ks=o}wn(t,e,i,s,n,r){if(!this.Ys||!this.Ks)return
|
|
620
|
+
const o=this.Ks,h=new D(t,e),a=new D(i,s),c=new D(n,r),l=c.x-o.x,u=c.y-o.y
|
|
621
|
+
if(it>Math.abs((h.x-c.x)*u-(h.y-c.y)*l)&&it>Math.abs((a.x-c.x)*u-(a.y-c.y)*l))return void this.yn(n,r)
|
|
622
|
+
const f=this.sn.js(o,h,a,c)
|
|
615
623
|
for(let t=0;f.length>t;t++){const e=f[t]
|
|
616
|
-
this.
|
|
617
|
-
const t=this.
|
|
618
|
-
this.
|
|
619
|
-
this.
|
|
620
|
-
if(this.
|
|
624
|
+
this.fn(e),this.Ys.points.push(e)}this.Ks=c}vn(){if(!this.Ys||!this.Ks)return
|
|
625
|
+
const t=this.Ys.points[0]
|
|
626
|
+
this.Ks.equals(t)||this.Ys.points.push(t),this.cn()}cn(){if(this.Ys){const t=this.nn.Os(this.Ys)
|
|
627
|
+
this.Js.push(t),this.Ys=null,this.Ks=null}}fn(t){this.Xs.min.x=Math.min(this.Xs.min.x,t.x),this.Xs.min.y=Math.min(this.Xs.min.y,t.y),this.Xs.max.x=Math.max(this.Xs.max.x,t.x),this.Xs.max.y=Math.max(this.Xs.max.y,t.y)}mn(){return this.Js.length>0&&this.an(),this.Qs}gn(){return this.Zs}xn(){return this.tn}reset(){this.Qs=[],this.Zs=[],this.tn=[],this.Js=[],this.Ys=null,this.Ks=null,this.Vs=0,this.qs=0,this.en.set(0,0),this.Xs={min:new D(1/0,1/0),max:new D(-1/0,-1/0)}}Ps(t){this.sn.Ps(t)}Sn(t){this.nn.Gs({...Z,...t})}bn(){return this.nn.getStats()}}class rt{constructor(){this.En=null,this._n=null,this.Tn=null,this.An=null,this.Ln=null,this.Mn=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.In&&this.In.setPosition(t,e)}rn(t,e){this.position.x+=t,this.position.y+=e,this.In&&this.In.rn(t,e)}Gn(t){this.In=t}On(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
|
|
628
|
+
if(this.In=e,this.Mn)return
|
|
621
629
|
const i=t.module
|
|
622
|
-
this.
|
|
623
|
-
return this.
|
|
630
|
+
this.En=i.Fn((t,e,i,s,n)=>{this.In?.un(s,n)},"viiiffi"),this._n=i.Fn((t,e,i,s,n)=>{this.In?.yn(s,n)},"viiiffi"),this.Tn=i.Fn((t,e,i,s,n,r,o)=>{this.In?.pn(s,n,r,o)},"viiiffffi"),this.An=i.Fn((t,e,i,s,n,r,o,h,a)=>{this.In?.wn(s,n,r,o,h,a)},"viiiffffffi"),this.Ln=i.Fn(()=>{this.In?.vn()},"viiii"),this.Mn=i.exports.kn(),i.exports.Cn(this.Mn,this.En,0,0),i.exports.Bn(this.Mn,this._n,0,0),i.exports.$n(this.Mn,this.Tn,0,0),i.exports.Un(this.Mn,this.An,0,0),i.exports.Nn(this.Mn,this.Ln,0,0)}Dn(){if(!this.Mn)throw Error("Draw functions not initialized")
|
|
631
|
+
return this.Mn}destroy(t){if(!t||!t.module||!t.hb)return
|
|
624
632
|
const e=t.module
|
|
625
|
-
try{this.
|
|
626
|
-
class ht{constructor(t,e){this.
|
|
633
|
+
try{this.Mn&&(e.exports.Pn(this.Mn),this.Mn=0),null!==this.En&&(e.Rn(this.En),this.En=null),null!==this._n&&(e.Rn(this._n),this._n=null),null!==this.Tn&&(e.Rn(this.Tn),this.Tn=null),null!==this.An&&(e.Rn(this.An),this.An=null),null!==this.Ln&&(e.Rn(this.Ln),this.Ln=null)}catch(t){c.warn("Error destroying draw callbacks:",t)}this.In=void 0}}const ot=new WeakMap
|
|
634
|
+
class ht{constructor(t,e){this.zn="default",this.Wn="default",this.jn=new Set,this.cache=t,this.le=e,this.tessellator=new Y,this.Hn=new K,this.Vn=new X,this.In=new nt,this.qn=(()=>{const t=this.le.module,e=ot.get(t)
|
|
627
635
|
if(e)return e
|
|
628
636
|
const i=new rt
|
|
629
|
-
return ot.set(t,i),i})(),this.
|
|
630
|
-
return[`cf:${t.toFixed(4)},${e.toFixed(4)}`,`opt:${i?1:0},${s.toFixed(4)},${n.toFixed(6)},${r.toFixed(4)}`].join("|")}
|
|
637
|
+
return ot.set(t,i),i})(),this.qn.On(this.le,this.In),this.Jn=W,this.Yn=j,this.Kn=H}bn(){return this.In.bn()}Ps(t){this.Ds=t,this.In.Ps(t),this.Xn()}Sn(t){this.Qn=t,this.In.Sn(t),this.Xn()}Zn(t){this.zn=t,this.Xn()}Xn(){this.Wn=`${this.zn}__${this.tr()}`}tr(){const t=this.Ds?.Us??.5,e=this.Ds?.Ns??.2,i=this.Qn?.enabled??!0,s=this.Qn?._s??1,n=this.Qn?.Ts??.0087,r=this.Qn?.As??10
|
|
638
|
+
return[`cf:${t.toFixed(4)},${e.toFixed(4)}`,`opt:${i?1:0},${s.toFixed(4)},${n.toFixed(6)},${r.toFixed(4)}`].join("|")}er(t,e,i,n,r=!1,o){if(a){let e=0
|
|
631
639
|
for(let i=0;t.length>i;i++)e+=t[i].length}const h=[]
|
|
632
640
|
let c=0,l=0,u=0,f=0
|
|
633
641
|
const d=(t,e,i,s)=>{const n=f
|
|
634
|
-
return h.push({data:t,px:e,
|
|
642
|
+
return h.push({data:t,px:e,ir:i,sr:s,nr:n}),c+=t.vertices.length,l+=t.normals.length,u+=t.indices.length,f+=t.vertices.length/3,n},y=[],p={min:{x:1/0,y:1/0,z:0},max:{x:-1/0,y:-1/0,z:e}}
|
|
635
643
|
for(let h=0;t.length>h;h++){const a=t[h]
|
|
636
644
|
for(const t of a){const h=t.position.x,a=t.position.y,c=t.position.z,l=[]
|
|
637
|
-
for(const e of t.glyphs)l.push(this.
|
|
645
|
+
for(const e of t.glyphs)l.push(this.rr(e.g))
|
|
638
646
|
let u
|
|
639
|
-
if(t.glyphs.length>1){const e=`${this.
|
|
647
|
+
if(t.glyphs.length>1){const e=`${this.Wn}_${t.text}`,i=this.Kn.get(e)
|
|
640
648
|
let s=!1
|
|
641
|
-
if(i&&i.
|
|
642
|
-
for(let e=0;t.glyphs.length>e;e++)if(i.
|
|
649
|
+
if(i&&i.hr.length===t.glyphs.length){s=!0
|
|
650
|
+
for(let e=0;t.glyphs.length>e;e++)if(i.hr[e]!==t.glyphs[e].g){s=!1
|
|
643
651
|
break}}if(s&&i)u=i.groups
|
|
644
652
|
else{const i=t.glyphs.map(t=>new P(t.x??0,t.y??0,0))
|
|
645
|
-
u=this.
|
|
646
|
-
const f=o&&t.glyphs.some(t=>o.has(t.
|
|
647
|
-
for(const r of u)if(r.length>1&&!w){const s=r.map(e=>t.glyphs[e]),o=this.
|
|
648
|
-
let u=this.
|
|
653
|
+
u=this.Vn.cs(l,i),this.Kn.set(e,{hr:t.glyphs.map(t=>t.g),groups:u})}}else u=[[0]]
|
|
654
|
+
const f=o&&t.glyphs.some(t=>o.has(t.ar)),w=r||f
|
|
655
|
+
for(const r of u)if(r.length>1&&!w){const s=r.map(e=>t.glyphs[e]),o=this.cr(s,e,i)
|
|
656
|
+
let u=this.Yn.get(o)
|
|
649
657
|
if(!u){const i=[],h=s[0].x??0,a=s[0].y??0
|
|
650
658
|
for(let e=0;r.length>e;e++){const s=r[e],n=l[s],o=t.glyphs[s],c=(o.x??0)-h,u=(o.y??0)-a
|
|
651
|
-
for(const t of n.bi)i.push({...t,points:t.points.map(t=>new D(t.x+c,t.y+u))})}u=this.
|
|
652
|
-
for(let i=0;r.length>i;i++){const s=r[i],n=t.glyphs[s],o=this.
|
|
653
|
-
y.push(o),this.
|
|
654
|
-
if(0===u.bi.length){const t=this.
|
|
659
|
+
for(const t of n.bi)i.push({...t,points:t.points.map(t=>new D(t.x+c,t.y+u))})}u=this.lr(i,e,n),this.Yn.set(o,u)}const f=s[0],w=d(u,h+(f.x??0),a+(f.y??0),c),v=u.vertices.length/3
|
|
660
|
+
for(let i=0;r.length>i;i++){const s=r[i],n=t.glyphs[s],o=this.ur(n,w,v,h+(n.x??0),a+(n.y??0),c,l[s],e)
|
|
661
|
+
y.push(o),this.dr(o.bounds,p)}}else for(const o of r){const r=t.glyphs[o],u=l[o],f=h+(r.x??0),w=a+(r.y??0),v=c
|
|
662
|
+
if(0===u.bi.length){const t=this.ur(r,0,0,f,w,v,u,e)
|
|
655
663
|
y.push(t)
|
|
656
|
-
continue}const m=s(this.
|
|
664
|
+
continue}const m=s(this.Wn,r.g,e,i)
|
|
657
665
|
let g=this.cache.get(m)
|
|
658
|
-
g?g.
|
|
659
|
-
const x=d(g,f,w,v),S=this.
|
|
660
|
-
y.push(S),this.
|
|
666
|
+
g?g.yr++:(g=this.pr(u,e,i,n),this.cache.set(m,g))
|
|
667
|
+
const x=d(g,f,w,v),S=this.ur(r,x,g.vertices.length/3,f,w,v,u,e)
|
|
668
|
+
y.push(S),this.dr(S.bounds,p)}}}const w=new Float32Array(c),v=new Float32Array(l),m=new Uint32Array(u)
|
|
661
669
|
let g=0,x=0,S=0
|
|
662
|
-
for(let t=0;h.length>t;t++){const e=h[t],i=e.data.vertices,s=e.data.normals,n=e.data.indices,r=e.px,o=e.
|
|
670
|
+
for(let t=0;h.length>t;t++){const e=h[t],i=e.data.vertices,s=e.data.normals,n=e.data.indices,r=e.px,o=e.ir,a=e.sr
|
|
663
671
|
for(let t=0;i.length>t;t+=3)w[g++]=i[t]+r,w[g++]=i[t+1]+o,w[g++]=i[t+2]+a
|
|
664
672
|
v.set(s,x),x+=s.length
|
|
665
|
-
const c=e.
|
|
666
|
-
for(let t=0;n.length>t;t++)m[S++]=n[t]+c}return{vertices:w,normals:v,indices:m,
|
|
673
|
+
const c=e.nr
|
|
674
|
+
for(let t=0;n.length>t;t++)m[S++]=n[t]+c}return{vertices:w,normals:v,indices:m,wr:y,planeBounds:p}}cr(t,e,i){if(0===t.length)return""
|
|
667
675
|
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}`).join("|")
|
|
668
|
-
return`${this.
|
|
669
|
-
const e=`${this.
|
|
676
|
+
return`${this.Wn}_${r}_${Math.round(1e3*e)/1e3}_${i}`}ur(t,e,i,s,n,r,o,h){return{vr:t.ar,mr:t.mr,nr:e,gr: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}}}}rr(t){if(this.jn.has(t))return{ln:t,bi:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
677
|
+
const e=`${this.Wn}_${t}`,i=this.Jn.get(e)
|
|
670
678
|
if(i)return i
|
|
671
|
-
this.
|
|
672
|
-
const s=this.
|
|
673
|
-
return 0===s.bi.length&&this.
|
|
674
|
-
return this.
|
|
679
|
+
this.qn.Gn(this.In),this.In.reset(),this.In.hn(t,0),this.le.module.exports.Sr(this.le.font.br,t,this.qn.Dn(),0),this.In.an()
|
|
680
|
+
const s=this.In.mn()[0]||{ln:t,bi:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
681
|
+
return 0===s.bi.length&&this.jn.add(t),this.Jn.set(e,s),s}lr(t,e,i){const s=this.tessellator.process(t,!0,i,0!==e)
|
|
682
|
+
return this.Er(s,e)}Er(t,e){const i=this.Hn.hs(t,e,this.le.upem),s=i.vertices
|
|
675
683
|
let n=1/0,r=1/0,o=1/0,h=-1/0,a=-1/0,c=-1/0
|
|
676
684
|
for(let t=0;s.length>t;t+=3){const e=s[t],i=s[t+1],l=s[t+2]
|
|
677
685
|
n>e&&(n=e),e>h&&(h=e),r>i&&(r=i),i>a&&(a=i),o>l&&(o=l),l>c&&(c=l)}const l=new P(n,r,o),u=new P(h,a,c)
|
|
678
|
-
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:l,max:u},
|
|
679
|
-
return this.
|
|
680
|
-
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)}_r(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.
|
|
681
|
-
return t.forEach((t,o)=>{const h=this.
|
|
682
|
-
r.push(h)}),r}finally{}}
|
|
683
|
-
"rtl"===o&&h.
|
|
686
|
+
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:l,max:u},yr:1}}pr(t,e,i,s){const n=this.tessellator.process(t.bi,i,s,0!==e)
|
|
687
|
+
return this.Er(n,e)}dr(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
|
|
688
|
+
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)}_r(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.Yn.clear(),this.Kn.clear(),this.Jn.clear()}}class at{constructor(t,e){this.Tr=new Map,this.le=t,this.Ar=e}Lr(t,e,i,s,n,r,o){try{const r=[]
|
|
689
|
+
return t.forEach((t,o)=>{const h=this.Mr(t,o,e,i,s,n)
|
|
690
|
+
r.push(h)}),r}finally{}}Mr(e,i,s,n,r,o){const h=this.le.hb.createBuffer()
|
|
691
|
+
"rtl"===o&&h.Ir("rtl"),h.oe(e.text),h.he()
|
|
684
692
|
const a=t(this.le.ae)
|
|
685
693
|
this.le.hb.shape(this.le.font,h,a)
|
|
686
694
|
const c=h.json(this.le.font)
|
|
687
695
|
h.destroy()
|
|
688
696
|
const l=[]
|
|
689
697
|
let u=[],f="",d=0,y=0,p=e.Dt,w=-i*s
|
|
690
|
-
const v=n*this.le.upem,m=this.
|
|
698
|
+
const v=n*this.le.upem,m=this.Gr(e,r,n),g=this.Or(e,r)
|
|
691
699
|
for(let t=0;c.length>t;t++){const s=c[t],n=/\s/.test(e.text[s.ce])
|
|
692
|
-
s.
|
|
700
|
+
s.ar=e.Rt&&s.ce===e.text.length-1&&"-"===e.text[s.ce]?e.Nt:e.Ut+s.ce,s.mr=i,n&&u.length>0&&(l.push({text:f,glyphs:u,position:new P(d,y,0)}),u=[],f="")
|
|
693
701
|
const r=p+s.dx,o=w+s.dy
|
|
694
702
|
if(n||(0===u.length&&(d=r,y=o),s.x=r-d,s.y=o-y,u.push(s),f+=e.text[s.ce]),p+=s.ax,w+=s.ay,0!==v&&c.length-1>t&&(p+=v),n&&(p+=m),0!==g&&c.length-1>t&&!n){const i=e.text[s.ce],n=e.text[c[t+1].ce],r=L.tt(i),o=n&&L.tt(n)
|
|
695
703
|
if(r&&o){let t=!0
|
|
696
|
-
L.et(n)&&(t=!1),L.it(i)&&(t=!1),L.st(i)&&L.st(n)&&(t=!1),t&&(p+=g)}}}return u.length>0&&l.push({text:f,glyphs:u,position:new P(d,y,0)}),l}
|
|
697
|
-
if(void 0!==t.Kt&&"justify"===e&&!t.Pt){let e=this.
|
|
698
|
-
void 0===e&&(e=I.measureTextWidth(this.le," ",i),this.
|
|
699
|
-
return t.Kt>0||0>t.Kt?.04*t.Kt*this.le.upem:0}clearCache(){this.
|
|
704
|
+
L.et(n)&&(t=!1),L.it(i)&&(t=!1),L.st(i)&&L.st(n)&&(t=!1),t&&(p+=g)}}}return u.length>0&&l.push({text:f,glyphs:u,position:new P(d,y,0)}),l}Gr(t,e,i){let s=0
|
|
705
|
+
if(void 0!==t.Kt&&"justify"===e&&!t.Pt){let e=this.Tr.get(i)
|
|
706
|
+
void 0===e&&(e=I.measureTextWidth(this.le," ",i),this.Tr.set(i,e)),t.Kt>0?s=t.Kt*e*.5:0>t.Kt&&(s=t.Kt*e*d)}return s}Or(t,e){if(void 0===t.Kt||"justify"!==e||t.Pt)return 0
|
|
707
|
+
return t.Kt>0||0>t.Kt?.04*t.Kt*this.le.upem:0}clearCache(){this.Ar.clearCache()}_r(){return this.Ar._r()}}var ct={exports:{}},lt=h(Object.freeze({__proto__:null,default:{},Fr(){throw Error("fs not available in browser")}}))
|
|
700
708
|
!(function(t){var e,i=(e="undefined"!=typeof document?document.currentScript?.src:void 0,async function(t={}){function i(){var t=v.buffer
|
|
701
|
-
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.
|
|
709
|
+
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.kr?.(t),x(t="Aborted("+t+")"),S=!0,t+=". Build with -sASSERTIONS for more info."
|
|
702
710
|
var e=new WebAssembly.RuntimeError(t)
|
|
703
711
|
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}
|
|
704
712
|
"undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href)
|
|
705
713
|
var c,l,u=""
|
|
706
714
|
if(h){var f=lt
|
|
707
|
-
u=__dirname+"/",l=t=>(t=b(t)?new URL(t):t,f.
|
|
715
|
+
u=__dirname+"/",l=t=>(t=b(t)?new URL(t):t,f.Fr(t)),c=async(t,e=!0)=>(t=b(t)?new URL(t):t,f.Fr(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&&(l=t=>{var e=new XMLHttpRequest
|
|
708
716
|
return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),c=async t=>{if(b(t))return new Promise((e,i)=>{var s=new XMLHttpRequest
|
|
709
717
|
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)})
|
|
710
718
|
var e=await fetch(t,{credentials:"same-origin"})
|
|
711
719
|
if(e.ok)return e.arrayBuffer()
|
|
712
720
|
throw Error(e.status+" : "+e.url)}}console.log.bind(console)
|
|
713
|
-
var d,y,p,w,v,m,g,x=console.error.bind(console),S=!1,b=t=>t.startsWith("file://"),
|
|
721
|
+
var d,y,p,w,v,m,g,x=console.error.bind(console),S=!1,b=t=>t.startsWith("file://"),E=!1,_=0,T=null
|
|
714
722
|
class A{name="ExitStatus"
|
|
715
723
|
constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var L,M,I,G=t=>{for(;t.length>0;)t.shift()(n)},O=[],F=t=>O.push(t),k=[],C=t=>k.push(t),B=!0,$=0,U={},N=t=>{if(t instanceof A||"unwind"==t)return y
|
|
716
|
-
a(1,t)},D=()=>B||$>0,P=t=>{y=t,D()||(n.
|
|
724
|
+
a(1,t)},D=()=>B||$>0,P=t=>{y=t,D()||(n.Cr?.(t),S=!0),a(t,new A(t))},R=(t,e)=>Math.ceil(t/e)*e,z=t=>{var e=(t-v.buffer.byteLength+65535)/65536|0
|
|
717
725
|
try{return v.grow(e),i(),1}catch(t){}},W=t=>{const e=t.length
|
|
718
|
-
return[e%128|128,e>>7,...t]},j={
|
|
719
|
-
n.
|
|
726
|
+
return[e%128|128,e>>7,...t]},j={_i:127,Ai:127,Mi:126,f:125,d:124,e:111},H=t=>W(Array.from(t,t=>j[t])),V=t=>L.get(t),q=[],J=(t,e)=>L.set(t,e)
|
|
727
|
+
n.Br&&(B=n.Br),n.$r&&(x=n.$r),n.Ur&&(d=n.Ur),n.Nr=v,n.Dr=K,n.Fn=(t,e)=>{var i=(t=>(M||(M=new WeakMap,((t,e)=>{if(M)for(var i=0;0+e>i;i++){var s=V(i)
|
|
720
728
|
s&&M.set(s,i)}})(0,L.length)),M.get(t)||0))(t)
|
|
721
729
|
if(i)return i
|
|
722
730
|
var s=q.length?q.pop():L.grow(1)
|
|
723
731
|
try{J(s,t)}catch(i){if(!(i instanceof TypeError))throw i
|
|
724
732
|
var n=((t,e)=>{var i=Uint8Array.of(0,97,115,109,1,0,0,0,1,...W([1,96,...H(e.slice(1)),...H("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)
|
|
725
733
|
return new WebAssembly.Instance(s,{e:{f:t}}).exports.f})(t,e)
|
|
726
|
-
J(s,n)}return M.set(t,s),s},n.
|
|
727
|
-
var Y={
|
|
734
|
+
J(s,n)}return M.set(t,s),s},n.Rn=t=>{M.delete(V(t)),J(t,null),q.push(t)}
|
|
735
|
+
var Y={Pr:()=>s(""),Rr(){B=!1,$=0},zr(t,e){if(U[t]&&(clearTimeout(U[t].id),delete U[t]),!e)return 0
|
|
728
736
|
var i=setTimeout(()=>{delete U[t],(t=>{if(!S)try{t(),(()=>{if(!D())try{y=t=y,P(t)}catch(t){N(t)}var t})()}catch(t){N(t)}})(()=>I(t,performance.now()))},e)
|
|
729
|
-
return U[t]={id:i,
|
|
737
|
+
return U[t]={id:i,Wr:e},0},jr(t){var e=m.length,i=2147483648
|
|
730
738
|
if((t>>>=0)>i)return!1
|
|
731
739
|
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))
|
|
732
|
-
if(z(r))return!0}return!1},
|
|
733
|
-
T=null,t()}})(),K}
|
|
734
|
-
var e,r={u:Y,
|
|
735
|
-
return n.
|
|
740
|
+
if(z(r))return!0}return!1},Hr:P},K=await(async()=>{function t(t){return n.Dr=K=t.exports,n.Nr=v=K.memory,i(),L=K.Vr,(t=>{n.qr=t.Jr,n.Yr=t.Kr,n.Xr=t.Qr,n.Zr=t.eo,n.io=t.so,n.no=t.ro,n.oo=t.ho,n.ao=t.co,n.lo=t.uo,n.fo=t.do,n.yo=t.po,n.wo=t.vo,n.mo=t.xo,n.So=t.bo,n.Eo=t._o,n.To=t.Ao,n.Lo=t.Mo,n.Io=t.Go,n.Oo=t.Fo,n.ko=t.Co,n.Bo=t.$o,n.Uo=t.No,n.Do=t.Po,n.Ro=t.zo,n.Wo=t.jo,n.Ho=t.Vo,n.qo=t.Jo,n.Yo=t.Ko,n.Xo=t.Cn,n.Qo=t.Bn,n.Zo=t.$n,n.th=t.Un,n.eh=t.Nn,n.ih=t.kn,n.sh=t.Pn,n.nh=t.rh,n.oh=t.hh,n.ah=t.uh,n.fh=t.dh,n.yh=t.ph,n.wh=t.Sr,n.mh=t.gh,n.xh=t.Sh,n.bh=t.Eh,n._h=t.Th,n.Ah=t.Lh,n.Mh=t.Ih,n.Gh=t.Oh,n.Fh=t.kh,n.Ch=t.Bh,n.$h=t.Uh,n.Nh=t.Dh,I=t.Ph})(K),(()=>{if(_--,n.Rh?.(_),0==_&&T){var t=T
|
|
741
|
+
T=null,t()}})(),K}_++,n.Rh?.(_)
|
|
742
|
+
var e,r={u:Y,zh:Y}
|
|
743
|
+
return n.Wh?new Promise(e=>{n.Wh(r,i=>{e(t(i))})}):(g??=(e="hb.wasm",n.jh?n.jh(e,u):u+e),t((await(async function(t,e,i){if(!t&&!b(e)&&!h)try{var n=fetch(e,{credentials:"same-origin"})
|
|
736
744
|
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 c(t)
|
|
737
745
|
return new Uint8Array(e)}catch{}return(t=>{if(t==g&&d)return new Uint8Array(d)
|
|
738
746
|
if(l)return l(t)
|
|
739
747
|
throw"both async and sync fetching of the wasm failed"})(t)})(t)
|
|
740
|
-
return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,g,r)).
|
|
741
|
-
return(()=>{if(n.
|
|
742
|
-
G(O)})())}
|
|
743
|
-
G(k)})(),
|
|
748
|
+
return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,g,r)).Hh))})()
|
|
749
|
+
return(()=>{if(n.Vh)for("function"==typeof n.Vh&&(n.Vh=[n.Vh]);n.Vh.length>0;)n.Vh.shift()()})(),(function t(){function e(){n.qh=!0,S||(E=!0,K.Jh(),p?.(n),n.Yh?.(),(()=>{if(n.Kh)for("function"==typeof n.Kh&&(n.Kh=[n.Kh]);n.Kh.length;)F(n.Kh.shift())
|
|
750
|
+
G(O)})())}_>0?T=t:((()=>{if(n.Xh)for("function"==typeof n.Xh&&(n.Xh=[n.Xh]);n.Xh.length;)C(n.Xh.shift())
|
|
751
|
+
G(k)})(),_>0?T=t:n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e())})(),E?n:new Promise((t,e)=>{p=t,w=e})})
|
|
744
752
|
t.exports=i,t.exports.default=i})(ct)
|
|
745
753
|
var ut=o(ct.exports),ft={exports:{}}
|
|
746
|
-
try{ft.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.
|
|
754
|
+
try{ft.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.Jo(e.length+1)
|
|
747
755
|
for(let s=0;e.length>s;++s){const n=e.charCodeAt(s)
|
|
748
756
|
if(n>127)throw Error("Expected ASCII text")
|
|
749
|
-
t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{
|
|
750
|
-
s&&(s=s.split(","),r=n.
|
|
751
|
-
n.
|
|
752
|
-
let o=t.
|
|
753
|
-
var a=o(t=>{n.
|
|
754
|
-
return{ze(e){var i=n.
|
|
757
|
+
t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{br:i,length:e.length,Ko(){n.Ko(i)}}}function s(t,e,s){var r=0,o=0
|
|
758
|
+
s&&(s=s.split(","),r=n.Jo(16*s.length),s.forEach(t=>{var e=i(t)
|
|
759
|
+
n.Vo(e.br,-1,r+16*o)&&o++,e.Ko()})),n.Dh(t.br,e.br,r,o),r&&n.Ko(r)}var n=t.Dr,r=new TextDecoder("utf8")
|
|
760
|
+
let o=t.Fn,h=t.Rn
|
|
761
|
+
var a=o(t=>{n.Ko(t)},"vi"),c=e("JSON"),l="",u=n.Jo(256)
|
|
762
|
+
return{ze(e){var i=n.Jo(e.byteLength)
|
|
755
763
|
t.HEAPU8.set(new Uint8Array(e),i)
|
|
756
|
-
var s=n.
|
|
757
|
-
return{
|
|
758
|
-
const o=n.
|
|
759
|
-
return{
|
|
760
|
-
if(o){var h=n.
|
|
761
|
-
return t.HEAPU8.subarray(h,h+o)}},Ve(){var e=n.
|
|
762
|
-
t.HEAPU32[i/4]=64,n.
|
|
764
|
+
var s=n.Jr(i,e.byteLength,2,i,a)
|
|
765
|
+
return{br:s,destroy(){n.Kr(s)}}},We(i,s){var r=n.rh(i.br,s)
|
|
766
|
+
const o=n.dh(r)
|
|
767
|
+
return{br:r,upem:o,Qh(i){var s=n.uh(r,e(i)),o=n.Qr(s)
|
|
768
|
+
if(o){var h=n.eo(s,null)
|
|
769
|
+
return t.HEAPU8.subarray(h,h+o)}},Ve(){var e=n.Jo(2048),i=n.Jo(4)
|
|
770
|
+
t.HEAPU32[i/4]=64,n.kh(r,0,i,e)
|
|
763
771
|
var s={}
|
|
764
772
|
return Array.from({length:t.HEAPU32[i/4]}).forEach((i,n)=>{var r
|
|
765
|
-
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.
|
|
766
|
-
n.
|
|
767
|
-
var i=(e=>{const i=n.
|
|
768
|
-
return t.HEAPU32.set(o,r),n
|
|
769
|
-
return n.
|
|
770
|
-
return{
|
|
773
|
+
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.Ko(i),n.Ko(e),s},Zh(){var e=n.Ih()
|
|
774
|
+
n.ph(r,e)
|
|
775
|
+
var i=(e=>{const i=n.Bh(e),s=n.Jo(i<<2),r=s>>2,o=t.HEAPU32.subarray(r,r+i)
|
|
776
|
+
return t.HEAPU32.set(o,r),n.Uh(e,-1,s,i),o})(e)
|
|
777
|
+
return n.Oh(e),i},destroy(){n.hh(r)}}},je(i){function s(t){return c||(f=o((t,e,i,s,n)=>{l+=`M${s},${n}`},"viiiffi"),d=o((t,e,i,s,n)=>{l+=`L${s},${n}`},"viiiffi"),y=o((t,e,i,s,n,r,o,h,a)=>{l+=`C${s},${n} ${r},${o} ${h},${a}`},"viiiffffffi"),p=o((t,e,i,s,n,r,o)=>{l+=`Q${s},${n} ${r},${o}`},"viiiffffi"),w=o(()=>{l+="Z"},"viiii"),c=n.kn(),n.Cn(c,f,0,0),n.Bn(c,d,0,0),n.Un(c,y,0,0),n.$n(c,p,0,0),n.Nn(c,w,0,0)),l="",n.Sr(a,t,c,0),l}var a=n.Sh(i.br),c=null,f=null,d=null,y=null,p=null,w=null
|
|
778
|
+
return{br:a,ta(e){n.gh(a,e,u,256)
|
|
771
779
|
var i=t.HEAPU8.subarray(u,u+256)
|
|
772
|
-
return r.decode(i.slice(0,i.indexOf(0)))},
|
|
773
|
-
return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){n.
|
|
774
|
-
s.forEach((i,s)=>{t.HEAPU32[r/4+2*s+0]=e(i[0]),t.HEAPF32[r/4+2*s+1]=i[1]}),n.
|
|
775
|
-
return{
|
|
780
|
+
return r.decode(i.slice(0,i.indexOf(0)))},ea:s,ia:t=>s(t).replace(/([MLQCZ])/g,"|$1 ").split("|").filter(t=>t.length).map(t=>{var e=t.split(/[ ,]/g)
|
|
781
|
+
return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){n.Lh(a,t,e)},He(i){var s=Object.entries(i),r=n.Jo(8*s.length)
|
|
782
|
+
s.forEach((i,s)=>{t.HEAPU32[r/4+2*s+0]=e(i[0]),t.HEAPF32[r/4+2*s+1]=i[1]}),n.Eh(a,r,s.length),n.Ko(r)},destroy(){n.Th(a),c&&(n.Pn(c),c=null,h(f),h(d),h(y),h(p),h(w))}}},createBuffer(){var e=n.ro()
|
|
783
|
+
return{br:e,oe(i){const s=(e=>{const i=n.Jo(2*e.length),s=new Uint16Array(t.Nr.buffer,i,e.length)
|
|
776
784
|
for(let t=0;s.length>t;++t)s[t]=e.charCodeAt(t)
|
|
777
|
-
return{
|
|
778
|
-
n.
|
|
779
|
-
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.
|
|
780
|
-
n.
|
|
781
|
-
n.
|
|
782
|
-
return s},destroy(){n.
|
|
783
|
-
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 "+l)&&(y=!0),y?0:(n.
|
|
784
|
-
return n
|
|
785
|
-
n.
|
|
786
|
-
var i={
|
|
787
|
-
return n.
|
|
785
|
+
return{br:i,length:s.length,Ko(){n.Ko(i)}}})(i)
|
|
786
|
+
n.Co(e,s.br,s.length,0,s.length),s.Ko()},he:()=>n.Go(e),Ir(t){n.uo(e,{sa:4,na:5,ra:6,oa:7}[t]||0)},ha(t){var i=0
|
|
787
|
+
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.vo(e,i)},aa(t){var s=i(t)
|
|
788
|
+
n.po(e,n.No(s.br,-1)),s.Ko()},ca(t){var s=i(t)
|
|
789
|
+
n.do(e,n.Po(s.br,-1)),s.Ko()},la(t){n.xo(e,t)},json(){for(var i=n.bo(e),s=[],r=n._o(e,0),o=r/4,h=n.Ao(e,0)/4,a=t.HEAPU32.subarray(o,o+5*i),c=t.HEAP32.subarray(h,h+5*i),l=0;i>l;++l)s.push({g:a[5*l+0],ce:a[5*l+2],ax:c[5*l+0],ay:c[5*l+1],dx:c[5*l+2],dy:c[5*l+3],flags:n.Mo(r+20*l)})
|
|
790
|
+
return s},destroy(){n.ho(e)}}},shape:s,ua(e,i,a,l,u){var f=[],d=0,y=!1,p=1048576,w=n.Jo(p),v=o((e,i,s)=>{var o=r.decode(t.HEAPU8.subarray(s,t.HEAPU8.indexOf(0,s)))
|
|
791
|
+
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 "+l)&&(y=!0),y?0:(n.so(e,0,n.bo(e),w,p,0,i,c,4),f.push({Ii:o,ki:JSON.parse(r.decode(t.HEAPU8.subarray(w,t.HEAPU8.indexOf(0,w)))),glyphs:2==n.co(e)}),1)},"iiiii")
|
|
792
|
+
return n.$o(i.br,v,0,0),s(e,i,a),n.Ko(w),h(v),f},version(){var e=n.Jo(12)
|
|
793
|
+
n.zo(e,e+4,e+8)
|
|
794
|
+
var i={fa:t.HEAPU32[e/4],da:t.HEAPU32[(e+4)/4],ya:t.HEAPU32[(e+8)/4]}
|
|
795
|
+
return n.Ko(e),i},pa(){var e=n.jo()
|
|
788
796
|
return r.decode(t.HEAPU8.subarray(e,t.HEAPU8.indexOf(0,e)))}}}}catch(t){}var dt=o(ft.exports)
|
|
789
797
|
let yt=null,pt=null,wt=null
|
|
790
|
-
const vt={
|
|
791
|
-
if(wt)e
|
|
798
|
+
const vt={wa(t){pt=t,wt=null,yt=null},va(t){wt=t,pt=null,yt=null},ma:async()=>yt||(yt=new Promise(async(t,e)=>{try{const e={}
|
|
799
|
+
if(wt)e.Ur=wt
|
|
792
800
|
else{if(!pt)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
|
|
793
|
-
e.
|
|
794
|
-
t({hb:dt(i),module:{
|
|
795
|
-
class mt{constructor(t,e){this.text=t,this.
|
|
796
|
-
e.push(t),this.
|
|
797
|
-
return t.
|
|
801
|
+
e.jh=(t,e)=>t.endsWith(".wasm")?pt:e+t}const i=await ut(e)
|
|
802
|
+
t({hb:dt(i),module:{Fn:i.Fn,exports:i.Dr,Rn:i.Rn}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),yt)}
|
|
803
|
+
class mt{constructor(t,e){this.text=t,this.ga=new Map,e.forEach(t=>{const e=this.ga.get(t.vr)||[]
|
|
804
|
+
e.push(t),this.ga.set(t.vr,e)})}xa(t){const e=[]
|
|
805
|
+
return t.Sa&&e.push(...this.ba(t.Sa)),t.Ea&&e.push(...this._a(t.Ea)),e}ba(t){const e=[]
|
|
798
806
|
for(const i of t){let t=0
|
|
799
807
|
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}_a(t){return t.map(t=>{const e=this.text.slice(t.start,t.end)
|
|
800
808
|
return this.createTextRange(t.start,t.end,e)})}createTextRange(t,e,i){const s=[],n=new Map
|
|
801
|
-
for(let i=t;e>i;i++){const t=this.
|
|
809
|
+
for(let i=t;e>i;i++){const t=this.ga.get(i)
|
|
802
810
|
if(t)for(const e of t){s.push(e)
|
|
803
|
-
const t=n.get(e.
|
|
804
|
-
t.push(e),n.set(e.
|
|
811
|
+
const t=n.get(e.mr)||[]
|
|
812
|
+
t.push(e),n.set(e.mr,t)}}return{start:t,end:e,Ta:i,bounds:Array.from(n.values()).map(t=>this.Aa(t)),glyphs:s,La:Array.from(n.keys()).sort((t,e)=>t-e)}}Aa(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
805
813
|
let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
|
|
806
814
|
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)
|
|
807
|
-
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}class gt{static{this.
|
|
808
|
-
gt.
|
|
809
|
-
const e=await gt.
|
|
810
|
-
i.
|
|
811
|
-
const s=await i.
|
|
815
|
+
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}class gt{static{this.Ma=new Map}static{this.Ia=null}static{this.Ga=new Map}static{this.Oa=0}static{this.Fa=1/0}static{this.ka=0}static Ca(t){return Object.keys(t).sort().map(e=>`${e}:${t[e]}`).join(",")}constructor(){this.Ba="",gt.Ia||(gt.Ia=vt.ma()),this.$a=new $(()=>gt.Ia)}static Ua(t){vt.wa(t),gt.Ia=null}static Na(t){vt.va(t),gt.Ia=null}static init(){return gt.Ia||(gt.Ia=vt.ma()),gt.Ia}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
|
|
816
|
+
gt.Ia||(gt.Ia=vt.ma())
|
|
817
|
+
const e=await gt.Da(t),i=new gt
|
|
818
|
+
i.Pa(e)
|
|
819
|
+
const s=await i.Ra(t),n=async e=>{const s={...t}
|
|
812
820
|
for(const t in e){const i=e[t]
|
|
813
|
-
void 0!==i&&(s[t]=i)}if(void 0!==e.font||void 0!==e.qe||void 0!==e.ae){const t=await gt.
|
|
814
|
-
i.
|
|
815
|
-
return{...s,getLoadedFont(){return i.getLoadedFont()},getCacheStatistics(){return i.getCacheStatistics()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n}}static async
|
|
816
|
-
t.qe&&(e+="_var_"+gt.
|
|
817
|
-
let i=gt.
|
|
818
|
-
return i||(i=await gt.
|
|
821
|
+
void 0!==i&&(s[t]=i)}if(void 0!==e.font||void 0!==e.qe||void 0!==e.ae){const t=await gt.Da(s)
|
|
822
|
+
i.Pa(t),i.za()}return t=s,{...await i.Ra(t),getLoadedFont(){return i.getLoadedFont()},getCacheStatistics(){return i.getCacheStatistics()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n}}
|
|
823
|
+
return{...s,getLoadedFont(){return i.getLoadedFont()},getCacheStatistics(){return i.getCacheStatistics()},clearCache(){return i.clearCache()},measureTextWidth(t,e){return i.measureTextWidth(t,e)},update:n}}static async Da(t){let e="string"==typeof t.font?t.font:"buffer-"+gt.Wa(t.font)
|
|
824
|
+
t.qe&&(e+="_var_"+gt.Ca(t.qe)),t.ae&&(e+="_feat_"+gt.Ca(t.ae))
|
|
825
|
+
let i=gt.Ga.get(e)
|
|
826
|
+
return i||(i=await gt.ja(e,t.font,t.qe,t.ae)),i}static async ja(t,e,i,s){const n=new gt
|
|
819
827
|
await n.Re(e,i,s)
|
|
820
828
|
const r=n.getLoadedFont()
|
|
821
|
-
return gt.
|
|
822
|
-
e&&(gt.
|
|
829
|
+
return gt.Ga.set(t,r),gt.Ha(r),gt.Va(),r}static Ha(t){gt.Oa+=t.Qe?.byteLength??0}static qa(t){const e=gt.Ga.get(t)
|
|
830
|
+
e&&(gt.Oa-=e.Qe?.byteLength??0,0>gt.Oa&&(gt.Oa=0))}static Va(){if(gt.Fa!==1/0)for(;gt.Oa>gt.Fa&>.Ga.size>0;){const t=gt.Ga.keys().next().value
|
|
823
831
|
if(void 0===t)break
|
|
824
|
-
gt.
|
|
832
|
+
gt.qa(t),gt.Ga.delete(t)}}static Wa(t){if(t){const e=new Uint8Array(t)
|
|
825
833
|
let i=2166136261
|
|
826
834
|
const s=Math.min(32,e.length),n=Math.floor(e.length/s)
|
|
827
835
|
for(let t=0;s>t;t++)i^=e[t*n],i=Math.imul(i,16777619)
|
|
828
|
-
return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++gt.
|
|
829
|
-
const e=gt.
|
|
830
|
-
this.
|
|
836
|
+
return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++gt.ka}Pa(t){this.le=t
|
|
837
|
+
const e=gt.Wa(t.Qe)
|
|
838
|
+
this.Ba="font_"+e,t.qe&&(this.Ba+="_var_"+gt.Ca(t.qe)),t.ae&&(this.Ba+="_feat_"+gt.Ca(t.ae))}async Re(t,e,i){gt.Ia||(gt.Ia=vt.ma()),await gt.Ia
|
|
831
839
|
const s="string"==typeof t?await fetch(t).then(e=>{if(!e.ok)throw Error(`Failed to load font from ${t}: HTTP ${e.status} ${e.statusText}`)
|
|
832
840
|
return e.arrayBuffer()}):t
|
|
833
|
-
try{this.le&&this.destroy(),this.le=await this.
|
|
834
|
-
const t=gt.
|
|
835
|
-
this.
|
|
836
|
-
const e=await this.
|
|
837
|
-
if(this.
|
|
838
|
-
this.
|
|
839
|
-
const i=this.
|
|
841
|
+
try{this.le&&this.destroy(),this.le=await this.$a.Re(s,e),i&&(this.le.ae=i)
|
|
842
|
+
const t=gt.Wa(s)
|
|
843
|
+
this.Ba="font_"+t,e&&(this.Ba+="_var_"+gt.Ca(e)),i&&(this.Ba+="_feat_"+gt.Ca(i))}catch(t){throw c.error("Failed to load font:",t),t}}async Ra(t){try{if(!this.le)throw Error("Font not loaded. Use Text.create() with a font option.")
|
|
844
|
+
const e=await this.Ja(t)
|
|
845
|
+
if(this.Ya(e),this.Ka(t=e),!this.Ar){const e=t.Xa?r(t.Xa):z
|
|
846
|
+
this.Ar=new ht(e,this.le),this.Ar.Zn(this.Ba)}this.Ar.Ps(t.Qa),this.Ar.Sn(t.Za),this.le.font.setScale(this.le.upem,this.le.upem),this.tc||(this.tc=new at(this.le,this.Ar))
|
|
847
|
+
const i=this.ec(t),s=t.sc??this.le.Je??!1,n=this.tc.Lr(i.lines,i.nc,i.letterSpacing,i.align,i.direction,t.color,t.text)
|
|
840
848
|
let o
|
|
841
|
-
if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.
|
|
849
|
+
if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.Sa||t.color.Ea)){if(o=new Set,t.color.Sa)for(const e of Object.keys(t.color.Sa)){let i=0
|
|
842
850
|
for(;-1!==(i=t.text.indexOf(e,i));){for(let t=i;i+e.length>t;t++)o.add(t)
|
|
843
|
-
i+=e.length}}if(t.color.
|
|
844
|
-
if(t.
|
|
845
|
-
c.glyphAttributes=t}return c}finally{}}async
|
|
846
|
-
if(!t.layout?.St?.[e])try{if(!gt.
|
|
847
|
-
gt.
|
|
848
|
-
const e=t.
|
|
849
|
-
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}
|
|
850
|
-
const{text:e,size:i=72,depth:s=0,lineHeight:n=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:c=("rtl"===a?"right":"left"),gt:d=!0,vt:y=!0,language:p="en-us",
|
|
851
|
+
i+=e.length}}if(t.color.Ea)for(const e of t.color.Ea)for(let t=e.start;e.end>t;t++)o.add(t)}const h=this.Ar.er(n,i.depth,s,this.le.p.Te,t.rc||!1,o),a=this.Ar._r(),c=this.oc(h.vertices,h.normals,h.indices,h.wr,h.planeBounds,t,a,t.text)
|
|
852
|
+
if(t.rc){const t=this.hc(c.vertices.length/3,c.glyphs)
|
|
853
|
+
c.glyphAttributes=t}return c}finally{}}async Ja(t){if(!1!==t.layout?.vt&&t.layout?.width){const e=t.layout?.language||"en-us"
|
|
854
|
+
if(!t.layout?.St?.[e])try{if(!gt.Ma.has(e)){const s=await i(e,t.layout?.ac)
|
|
855
|
+
gt.Ma.set(e,s)}return{...t,layout:{...t.layout,St:{...t.layout?.St,[e]:gt.Ma.get(e)}}}}catch(i){return c.warn(`Failed to load patterns for ${e}: ${i}`),{...t,layout:{...t.layout,vt:!1}}}}return t}Ya(t){if(!t.text)throw Error("Text content is required")
|
|
856
|
+
const e=t.cc??1e5
|
|
857
|
+
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}Ka(t){t.qe&&this.le&>.Ca(t.qe)!==gt.Ca(this.le.qe||{})&&(this.le.font.He(t.qe),this.le.qe=t.qe)}ec(t){if(!this.le)throw Error("Font not loaded. Use Text.create() with a font option")
|
|
858
|
+
const{text:e,size:i=72,depth:s=0,lineHeight:n=1,letterSpacing:r=0,layout:o={}}=t,{width:h,direction:a="ltr",align:c=("rtl"===a?"right":"left"),gt:d=!0,vt:y=!0,language:p="en-us",Et:w=l,_t:v=u,Tt:m=f,At:g,St:x,Lt:S,Mt:b,It:E,Gt:_,Ot:T,Ft:A,kt:L,Ct:M,Bt:I,$t:O}=o
|
|
851
859
|
let F
|
|
852
860
|
void 0!==h&&(F=h*(this.le.upem/i))
|
|
853
861
|
const k=s*(this.le.upem/i),B=k>0?Math.max(k,25e-6*this.le.upem):0
|
|
854
|
-
this.
|
|
855
|
-
const $=this.
|
|
856
|
-
return{lines:$.lines,
|
|
862
|
+
this.lc||(this.lc=new G(this.le))
|
|
863
|
+
const $=this.lc.ue({text:e,width:F,align:c,direction:a,vt:y,language:p,gt:d,Et:w,_t:v,Tt:m,At:g,St:x,Lt:S,Mt:b,It:E,Gt:_,Ot:T,Ft:A,kt:L,Ct:M,Bt:I,$t:O,letterSpacing:r}),U=C.ke(this.le.p)
|
|
864
|
+
return{lines:$.lines,nc:(U.we-U.ve)*n,letterSpacing:r,align:c,direction:a,depth:B,size:i}}uc(t,e,i,s){const n=t.length/3,r=new Float32Array(3*n),o=[]
|
|
857
865
|
if(Array.isArray(i)){for(let t=0;n>t;t++){const e=3*t
|
|
858
|
-
r[e]=i[0],r[e+1]=i[1],r[e+2]=i[2]}o.push({start:0,end:s.length,
|
|
866
|
+
r[e]=i[0],r[e+1]=i[1],r[e+2]=i[2]}o.push({start:0,end:s.length,Ta:s,color:i,bounds:[],glyphs:e,La:[...new Set(e.map(t=>t.mr))]})}else{const t=i.default||[1,1,1]
|
|
859
867
|
for(let e=0;r.length>e;e+=3)r[e]=t[0],r[e+1]=t[1],r[e+2]=t[2]
|
|
860
|
-
i.
|
|
861
|
-
e&&(t.glyphs.forEach(t=>{for(let i=0;t.
|
|
862
|
-
s>=0&&r.length>s&&(r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2])}}),o.push({start:t.start,end:t.end,
|
|
863
|
-
for(const s of e)if(s.
|
|
864
|
-
for(let e=0;s.
|
|
865
|
-
i>=0&&r.length>i&&(r[i]=t.color[0],r[i+1]=t.color[1],r[i+2]=t.color[2])}}o.push({start:t.start,end:t.end,
|
|
866
|
-
this.
|
|
867
|
-
const f=this.
|
|
868
|
+
i.Sa&&new mt(s,e).xa({Sa:Object.keys(i.Sa)}).forEach(t=>{const e=i.Sa[t.Ta]
|
|
869
|
+
e&&(t.glyphs.forEach(t=>{for(let i=0;t.gr>i;i++){const s=3*(t.nr+i)
|
|
870
|
+
s>=0&&r.length>s&&(r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2])}}),o.push({start:t.start,end:t.end,Ta:t.Ta,color:e,bounds:t.bounds,glyphs:t.glyphs,La:t.La}))}),i.Ea&&i.Ea.forEach(t=>{const i=[]
|
|
871
|
+
for(const s of e)if(s.vr>=t.start&&t.end>s.vr){i.push(s)
|
|
872
|
+
for(let e=0;s.gr>e;e++){const i=3*(s.nr+e)
|
|
873
|
+
i>=0&&r.length>i&&(r[i]=t.color[0],r[i+1]=t.color[1],r[i+2]=t.color[2])}}o.push({start:t.start,end:t.end,Ta:s.slice(t.start,t.end),color:t.color,bounds:[],glyphs:i,La:[...new Set(i.map(t=>t.mr))]})})}return{colors:r,fc:o}}oc(t,e,i,s,n,r,o,h){const{layout:a={},size:c=72}=r,{width:l,align:u=("rtl"===a.direction?"right":"left")}=a
|
|
874
|
+
this.lc||(this.lc=new G(this.le))
|
|
875
|
+
const f=this.lc.ye({width:l,align:u,planeBounds:n}),d=f.offset
|
|
868
876
|
n.min.x=f.de.min.x,n.max.x=f.de.max.x
|
|
869
877
|
const y=c/this.le.upem,p=d*y
|
|
870
878
|
if(0===p)for(let e=0;t.length>e;e++)t[e]*=y
|
|
@@ -872,15 +880,15 @@ else for(let e=0;t.length>e;e+=3)t[e]=t[e]*y+p,t[e+1]*=y,t[e+2]*=y
|
|
|
872
880
|
n.min.x*=y,n.min.y*=y,n.min.z*=y,n.max.x*=y,n.max.y*=y,n.max.z*=y
|
|
873
881
|
for(let t=0;s.length>t;t++){const e=s[t]
|
|
874
882
|
e.bounds.min.x=e.bounds.min.x*y+p,e.bounds.min.y*=y,e.bounds.min.z*=y,e.bounds.max.x=e.bounds.max.x*y+p,e.bounds.max.y*=y,e.bounds.max.z*=y}let w,v
|
|
875
|
-
if(r.color){const e=this.
|
|
876
|
-
w=e.colors,v=e.
|
|
877
|
-
return{vertices:t,normals:e,indices:i,colors:w,glyphs:s,planeBounds:n,stats:{
|
|
878
|
-
return new mt(h,s).
|
|
879
|
-
return C.Ce(this.le.p)}static async
|
|
880
|
-
gt.
|
|
881
|
-
return I.measureTextWidth(this.le,t,e)}getCacheStatistics(){return this.
|
|
883
|
+
if(r.color){const e=this.uc(t,s,r.color,r.text)
|
|
884
|
+
w=e.colors,v=e.fc}const m=this.Ar.bn()
|
|
885
|
+
return{vertices:t,normals:e,indices:i,colors:w,glyphs:s,planeBounds:n,stats:{dc:i.length/3,yc:t.length/3,Ls:m.Ls,Ms:m.Ms,Is:m.Is,...o||{}},query(t){if(!h)throw Error("Original text not available for querying")
|
|
886
|
+
return new mt(h,s).xa(t)},fc:v,glyphAttributes:void 0}}Ce(){if(!this.le)throw Error("Font not loaded. Call loadFont() first")
|
|
887
|
+
return C.Ce(this.le.p)}static async wc(t,e){await Promise.all(t.map(async t=>{if(!gt.Ma.has(t))try{const s=await i(t,e)
|
|
888
|
+
gt.Ma.set(t,s)}catch(e){c.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static vc(t,e){gt.Ma.set(t,e)}static mc(t){gt.Fa=t===1/0?1/0:1048576*Math.max(1,Math.floor(t)),gt.Va()}getLoadedFont(){return this.le}measureTextWidth(t,e=0){if(!this.le)throw Error("Font not loaded. Call loadFont() first")
|
|
889
|
+
return I.measureTextWidth(this.le,t,e)}getCacheStatistics(){return this.Ar?this.Ar._r():null}clearCache(){this.Ar&&this.Ar.clearCache()}hc(t,e){const i=new Float32Array(3*t),s=new Float32Array(t),n=new Float32Array(t)
|
|
882
890
|
return e.forEach((e,r)=>{const o=(e.bounds.min.x+e.bounds.max.x)/2,h=(e.bounds.min.y+e.bounds.max.y)/2,a=(e.bounds.min.z+e.bounds.max.z)/2
|
|
883
|
-
for(let c=0;e.
|
|
884
|
-
t>l&&(i[3*l]=o,i[3*l+1]=h,i[3*l+2]=a,s[l]=r,n[l]=e.
|
|
891
|
+
for(let c=0;e.gr>c;c++){const l=e.nr+c
|
|
892
|
+
t>l&&(i[3*l]=o,i[3*l+1]=h,i[3*l+2]=a,s[l]=r,n[l]=e.mr)}}),{gc:i,dn:s,xc:n}}za(){this.Ar=void 0,this.tc=void 0,this.lc=void 0}destroy(){if(!this.le)return
|
|
885
893
|
const t=this.le
|
|
886
|
-
try{$.Ze(t)}catch(t){c.warn("Error destroying HarfBuzz objects:",t)}finally{this.le=void 0,this.
|
|
894
|
+
try{$.Ze(t)}catch(t){c.warn("Error destroying HarfBuzz objects:",t)}finally{this.le=void 0,this.lc=void 0,this.tc=void 0}}}export{et as DEFAULT_CURVE_FIDELITY,C as FontMetadataExtractor,gt as Text,r as createGlyphCache,z as globalGlyphCache}
|