three-text 0.5.0 → 0.5.2
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 +15 -16
- package/dist/index.cjs +66 -20
- package/dist/index.d.ts +6 -0
- package/dist/index.js +66 -20
- package/dist/index.min.cjs +310 -307
- package/dist/index.min.js +265 -262
- package/dist/index.umd.js +68 -21
- package/dist/index.umd.min.js +268 -265
- package/dist/three/index.cjs +2 -1
- package/dist/three/index.d.ts +1 -0
- package/dist/three/index.js +2 -1
- package/dist/three/react.cjs +35 -17
- package/dist/three/react.d.ts +6 -0
- package/dist/three/react.js +35 -17
- package/dist/types/core/Text.d.ts +6 -0
- package/dist/types/three/index.d.ts +1 -0
- package/dist/types/vector/core.d.ts +27 -0
- package/dist/types/vector/index.d.ts +30 -24
- package/dist/types/vector/loopBlinnTSL.d.ts +14 -3
- package/dist/types/vector/react.d.ts +4 -6
- package/dist/vector/all.cjs +21 -0
- package/dist/vector/all.d.ts +134 -0
- package/dist/vector/all.js +2 -0
- package/dist/vector/core.cjs +1310 -0
- package/dist/vector/core.d.ts +112 -0
- package/dist/vector/core.js +1306 -0
- package/dist/vector/index.cjs +41 -1265
- package/dist/vector/index.d.ts +335 -20
- package/dist/vector/index.js +28 -1239
- package/dist/vector/loopBlinnTSL.cjs +229 -0
- package/dist/vector/loopBlinnTSL.d.ts +69 -0
- package/dist/vector/loopBlinnTSL.js +207 -0
- package/dist/vector/react.cjs +45 -60
- package/dist/vector/react.d.ts +9 -3
- package/dist/vector/react.js +46 -42
- package/dist/vector/webgl/index.cjs +3 -1
- package/dist/vector/webgl/index.js +3 -1
- package/package.json +1 -1
package/dist/index.min.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @license
|
|
3
|
-
* three-text v0.5.
|
|
3
|
+
* three-text v0.5.2
|
|
4
4
|
* Copyright © 2025-2026 Jeremy Tribby, Countertype LLC
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
@@ -51,8 +51,8 @@ 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>
|
|
|
51
51
|
do{e=x(e)}while(e.m.u===s)
|
|
52
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
53
|
do{t=x(t)}while(t.m.p.u===e)
|
|
54
|
-
return t}function
|
|
55
|
-
return s.m=i,t.k.insertBefore(e,s),s.I=0,s.j=0,s.T=0,i.N=s,s}function
|
|
54
|
+
return t}function F(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 S(t,e){switch(t.M){case fe.ODD:return!!(1&e)
|
|
56
56
|
case fe.NONZERO:return 0!==e
|
|
57
57
|
case fe.POSITIVE:return e>0
|
|
58
58
|
case fe.NEGATIVE:return 0>e
|
|
@@ -61,9 +61,9 @@ s.q=e.q,s.L=i,b(t,e)}function _(t,e,i){let s,n=null,r=e,o=e.m
|
|
|
61
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
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
|
|
63
63
|
a=i
|
|
64
|
-
do{
|
|
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=
|
|
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&&(
|
|
64
|
+
do{F(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=S(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&&(Se[0]=e.u.data,Se[1]=i.u.data,Se[2]=null,Se[3]=null,Fe[0]=.5,Fe[1]=.5,Fe[2]=0,Fe[3]=0,C(t,e.u,Se,Fe,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
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
68
|
const s=e.m,n=i.m
|
|
69
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
|
|
@@ -82,14 +82,14 @@ if(r===o)return 0
|
|
|
82
82
|
if(c=Math.min(r.l,f.l),u=Math.max(o.l,m.l),c>u)return 0
|
|
83
83
|
if(a(r,o)){if(y(m,r,o)>0)return 0}else if(0>y(f,o,r))return 0
|
|
84
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)=>{
|
|
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)=>{Fe[0]=0,Fe[1]=0,Fe[2]=0,Fe[3]=0,Se[0]=i.data,Se[1]=s.data,Se[2]=n.data,Se[3]=r.data,e.coords[0]=e.coords[1]=e.coords[2]=0,L(e,i,s,Fe,0),L(e,n,r,Fe,2),C(t,e,Se,Fe,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
86
|
for(;;){for(;n.T;)e=n,n=v(n)
|
|
87
87
|
if(!e.T&&(n=e,null===(e=x(e))||!e.T))return
|
|
88
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
89
|
else if(N(t,e))return
|
|
90
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
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=
|
|
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=S(t,e.G)})(t,F(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
93
|
if(s=e.m,h(s.u,i))k(t,s,i.L)
|
|
94
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
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
|
|
@@ -148,10 +148,10 @@ 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,
|
|
|
148
148
|
t.H(2)
|
|
149
149
|
let e=i.L
|
|
150
150
|
do{t.W(e.u.data),e=e.O}while(e!==i.L)
|
|
151
|
-
t.st()}}function
|
|
151
|
+
t.st()}}function K(t,e,i,s){const n=t[s],r=i[n]
|
|
152
152
|
for(;s>0;){const n=s-1>>1,o=t[n]
|
|
153
153
|
if(r>=i[o])break
|
|
154
|
-
t[s]=o,e[o]=s,s=n}t[s]=n,e[n]=s}function
|
|
154
|
+
t[s]=o,e[o]=s,s=n}t[s]=n,e[n]=s}function J(t,e,i,s,n){const r=t[s],o=i[r],h=n>>1
|
|
155
155
|
for(;h>s;){let r=1+(s<<1),h=t[r],a=i[h]
|
|
156
156
|
const l=r+1
|
|
157
157
|
if(n>l){const e=t[l],s=i[e]
|
|
@@ -338,9 +338,9 @@ const A=this.se(v,v>0?c+s:m)
|
|
|
338
338
|
if(-1>x){w.push(r)
|
|
339
339
|
continue}if(u!==xt&&A>i)continue
|
|
340
340
|
let b=n.Ie+A
|
|
341
|
-
1e4>Math.abs(b)?b*=b:b=1e8,u>0?b+=u*u:u>xt&&(b-=u*u),f&&r.kt&&(b+=n.
|
|
341
|
+
1e4>Math.abs(b)?b*=b:b=1e8,u>0?b+=u*u:u>xt&&(b-=u*u),f&&r.kt&&(b+=n.Fe)
|
|
342
342
|
const E=this.ne(x)
|
|
343
|
-
Math.abs(E-r.xt)>1&&(b+=n.
|
|
343
|
+
Math.abs(E-r.xt)>1&&(b+=n.Se)
|
|
344
344
|
const T=r.bt+b
|
|
345
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)
|
|
346
346
|
for(let t=0;4>t;t++)y[t]&&r.vt(y[t])
|
|
@@ -351,21 +351,21 @@ return l}static Me(t){if(!t.text||0===t.text.length)return[]
|
|
|
351
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
|
|
352
352
|
if(h&&e.includes("\n")){const i=e.split("\n"),s=[]
|
|
353
353
|
let n=0
|
|
354
|
-
for(const e of i){if(0===e.length)s.push({text:"",He:n,qe:n,Ye:0,
|
|
354
|
+
for(const e of i){if(0===e.length)s.push({text:"",He:n,qe:n,Ye:0,Ke:!0,naturalWidth:0,Je:!1})
|
|
355
355
|
else{const i=this.Me({...t,text:e,Oe:!1})
|
|
356
356
|
i.forEach(t=>{t.He+=n,t.qe+=n}),s.push(...i)}n+=e.length+1}return s}let I=r
|
|
357
357
|
!I||c&&c[o]||(nt.warn(`Hyphenation patterns for ${o} not available`),I=!1)
|
|
358
|
-
let
|
|
359
|
-
void 0!==w&&i&&(
|
|
360
|
-
const
|
|
358
|
+
let F=p
|
|
359
|
+
void 0!==w&&i&&(F=i*w)
|
|
360
|
+
const S={Ie:v,Se:x,Fe:E,Xe:T,Te:A,be:b,Qe:s,Le:u,Ze:u?f*u:0}
|
|
361
361
|
if(!i||i===1/0){const t=a(e)
|
|
362
|
-
return[{text:e,He:0,qe:e.length-1,Ye:0,
|
|
363
|
-
if(!_&&I&&(M=this.he(e,a,l,!0,o,c,g,m,
|
|
364
|
-
for(let e=0;t>e&&!_;e++){const t=
|
|
365
|
-
_=this.lineBreak(M,i,d,t,
|
|
362
|
+
return[{text:e,He:0,qe:e.length-1,Ye:0,Ke:!0,naturalWidth:t,Je:!1}]}let M=this.he(e,a,l,!1,o,c,g,m,S,i),_=this.lineBreak(M,i,y,0,S)
|
|
363
|
+
if(!_&&I&&(M=this.he(e,a,l,!0,o,c,g,m,S,i),_=this.lineBreak(M,i,d,0,S)),!_){const t=5
|
|
364
|
+
for(let e=0;t>e&&!_;e++){const t=F+e*i*.1
|
|
365
|
+
_=this.lineBreak(M,i,d,t,S),_||(_=this.lineBreak(M,i,1e4,t,S))}}if(_){const t=[]
|
|
366
366
|
let r=_
|
|
367
367
|
for(;r&&r.position>0;)t.unshift(r.position),r=r._t
|
|
368
|
-
return this.ti(e,M,t,i,s,n,
|
|
368
|
+
return this.ti(e,M,t,i,s,n,S)}return[{text:e,He:0,qe:e.length-1,Ye:0,ei:0,Ke:!0,naturalWidth:a(e),Je:!1}]}static ti(t,e,i,s,n,r,o){if(0===i.length)return[{text:t,He:0,qe:t.length-1,Ye:0}]
|
|
369
369
|
const h=[]
|
|
370
370
|
let a=0
|
|
371
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=[]
|
|
@@ -383,12 +383,12 @@ let x=0,A=0,b=n
|
|
|
383
383
|
if("justify"===n&&c&&(b="rtl"===r?"right":"left"),"center"===b)x=(s-y)/2
|
|
384
384
|
else if("right"===b)x=s-y
|
|
385
385
|
else if("justify"===b&&!c){const t=s-y
|
|
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,
|
|
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,Ke:!1,naturalWidth:y,Je:m}),a=l+1}if(e.length-1>a){const t=[]
|
|
387
387
|
let i=-1,l=-1,c=0
|
|
388
388
|
for(let s=a;e.length-1>s;s++){const n=e[s]
|
|
389
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)
|
|
390
390
|
let u=0,f=n
|
|
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,
|
|
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,Ke:!0,naturalWidth:c,Je:!1}),h.length>1&&(h[h.length-2].Ke=!1),h[h.length-1].Ke=!0}else h.length>0&&(h[h.length-1].Ke=!0)
|
|
392
392
|
return h}}const bt=new WeakMap
|
|
393
393
|
class Et{static Ce(e,i,s=0){const n=Array.from(i)
|
|
394
394
|
if(0===n.length)return[]
|
|
@@ -421,17 +421,17 @@ if(0!==i)for(let e=0;t.length>e;e+=3)t[e]+=i
|
|
|
421
421
|
return{offset:i,li:s}}ci(t){const{width:e,align:i,planeBounds:s}=t
|
|
422
422
|
let n=0
|
|
423
423
|
const r={min:{...s.min},max:{...s.max}}
|
|
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,
|
|
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,Ft=1330926671,St=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
425
|
class Rt{static ui(t){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
|
|
426
426
|
const i=new DataView(t),s=i.getUint32(0)
|
|
427
|
-
if(![It,
|
|
427
|
+
if(![It,Ft].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
|
|
428
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
|
|
429
429
|
let d=null
|
|
430
430
|
h&&(d={fi:i.getInt16(h+4),di:i.getInt16(h+6),yi:i.getInt16(h+8)})
|
|
431
431
|
let y=null
|
|
432
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)})
|
|
433
433
|
let p=null
|
|
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,
|
|
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,Fi:p}}static Si(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={}
|
|
435
435
|
try{if(n){const t=this.Mi(i,n,o)
|
|
436
436
|
t.features.forEach(t=>h.add(t)),Object.assign(a,t.names)}if(r){const t=this.Mi(i,r,o)
|
|
437
437
|
t.features.forEach(t=>h.add(t)),Object.assign(a,t.names)}}catch(t){return}const l=Array.from(h).sort()
|
|
@@ -452,7 +452,7 @@ if(0===o||3===o&&1===h){let t=""
|
|
|
452
452
|
for(let e=0;f.length>e;e+=2)t+=String.fromCharCode(f[e]<<8|f[e+1])
|
|
453
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")
|
|
454
454
|
const i=new DataView(t),s=i.getUint32(0)
|
|
455
|
-
if(![It,
|
|
455
|
+
if(![It,Ft].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
|
|
456
456
|
const n=e(i),r=n.get(Bt)?.offset??0,o=r?this.Ci(i,r):null
|
|
457
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
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
|
|
@@ -465,7 +465,7 @@ r&&(c={fi:t.getInt16(r+4),di:t.getInt16(r+6),yi:t.getInt16(r+8)})
|
|
|
465
465
|
let u=null
|
|
466
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)})
|
|
467
467
|
let f=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,
|
|
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,Fi:f}}static Pi(t,e,i){try{if(1>t.getUint16(e))return null
|
|
469
469
|
const s=t.getUint16(e+4),n=t.getUint16(e+6),r=t.getUint32(e+8),o={}
|
|
470
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)
|
|
471
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={}
|
|
@@ -488,8 +488,8 @@ p&&(n[String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,255&h)]=p)}}static Gi(t){
|
|
|
488
488
|
return{fi:e.fi,di:e.di,yi:e.yi,Le:t.Le,Wi:e.fi-e.di}}}let zt=null
|
|
489
489
|
class Wt{static ji(t){if(4>t.byteLength)return"ttf/otf"
|
|
490
490
|
const e=new DataView(t).getUint32(0)
|
|
491
|
-
return e===
|
|
492
|
-
if(e.getUint32(0)!==
|
|
491
|
+
return e===St?"woff":e===Mt?"woff2":"ttf/otf"}static async Ui(t){const e=new DataView(t),i=new Uint8Array(t)
|
|
492
|
+
if(e.getUint32(0)!==St)throw Error("Not a valid WOFF font")
|
|
493
493
|
const s=e.getUint32(4),n=e.getUint16(12),r=e.getUint32(16)
|
|
494
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.")
|
|
495
495
|
const o=new Uint8Array(r),h=new DataView(o.buffer)
|
|
@@ -508,18 +508,18 @@ for(let t=0;n>t;t++){const e=c[t],i=12+16*t
|
|
|
508
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")
|
|
509
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);")
|
|
510
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"))
|
|
511
|
-
return new Response(e).arrayBuffer()}}class jt{constructor(t){this.Yi=t}async
|
|
511
|
+
return new Response(e).arrayBuffer()}}class jt{constructor(t){this.Yi=t}async Ki(t,e){if(!t||12>t.byteLength)throw Error("Invalid font buffer: too small to be a valid font file")
|
|
512
512
|
const i=Wt.ji(t)
|
|
513
513
|
"woff"===i?t=await Wt.Ui(t):"woff2"===i&&(t=await Wt.qi(t))
|
|
514
514
|
const s=new DataView(t).getUint32(0)
|
|
515
|
-
if(![It,
|
|
515
|
+
if(![It,Ft].includes(s))throw Error("Invalid font format. Expected TTF/OTF/WOFF/WOFF2, got signature: 0x"+s.toString(16))
|
|
516
516
|
const{hb:n,module:r}=await this.Yi()
|
|
517
|
-
try{const i=n.
|
|
517
|
+
try{const i=n.Ji(new Uint8Array(t)),s=n.Xi(i,0),o=n.Qi(s)
|
|
518
518
|
e&&o.Zi(e)
|
|
519
519
|
const h=s.ts(),a=Object.keys(h).length>0,{rt:l,features:c}=Rt.Oi(t)
|
|
520
520
|
let u
|
|
521
521
|
if(a&&h){u={}
|
|
522
|
-
for(const[t,e]of Object.entries(h))u[t]={...e,name:l.
|
|
522
|
+
for(const[t,e]of Object.entries(h))u[t]={...e,name:l.Fi?.[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
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()
|
|
524
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
|
|
525
525
|
return Math.sqrt(e*e+i*i)}ws(t){const e=this.x-t.x,i=this.y-t.y
|
|
@@ -540,23 +540,23 @@ let u=[],f=[],d=0,y=0,p=e.Ye,w=-i*s
|
|
|
540
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
541
|
let E
|
|
542
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.
|
|
543
|
+
s.Is=e.Je&&n===A-1&&"-"===r?e.qe:e.He+n,s.Fs=i,h&&u.length>0&&(c.push({text:f.join(""),glyphs:u,position:new qt(d,y,0)}),u=[],f=[])
|
|
544
544
|
const a=p+s.dx,T=w+s.dy
|
|
545
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
546
|
if(E=!!e&&At.fe(e),i&&E){let t=!0
|
|
547
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.
|
|
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.
|
|
550
|
-
return t.ei>0||0>t.ei?.04*t.ei*this.oi.upem:0}}var
|
|
548
|
+
if(void 0!==t.ei&&"justify"===e&&!t.Ke){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.Ke)return 0
|
|
550
|
+
return t.ei>0||0>t.ei?.04*t.ei*this.oi.upem:0}}var Kt={exports:{}},Jt=r(Object.freeze({__proto__:null,default:{},o(...t){const e="undefined"!=typeof globalThis?globalThis.require:void 0
|
|
551
551
|
if("function"==typeof e)return e("fs").o(...t)
|
|
552
552
|
throw Error("fs not available in this environment")}}))
|
|
553
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.
|
|
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.Ss?.(t),x(t="Aborted("+t+")"),A=!0,t+=". Build with -sASSERTIONS for more info."
|
|
555
555
|
var e=new WebAssembly.RuntimeError(t)
|
|
556
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
557
|
"undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href)
|
|
558
558
|
var l,c,u=""
|
|
559
|
-
if(h){var f=
|
|
559
|
+
if(h){var f=Jt
|
|
560
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
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
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)})
|
|
@@ -564,38 +564,38 @@ var e=await fetch(t,{credentials:"same-origin"})
|
|
|
564
564
|
if(e.ok)return e.arrayBuffer()
|
|
565
565
|
throw Error(e.status+" : "+e.url)}}console.log.bind(console)
|
|
566
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
|
|
568
|
-
constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var
|
|
569
|
-
a(1,t)},G=()=>D||N>0,R=t=>{y=t,G()||(n.Ms?.(t),A=!0),a(t,new
|
|
567
|
+
class F{name="ExitStatus"
|
|
568
|
+
constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var S,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 F||"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 F(t))},z=(t,e)=>Math.ceil(t/e)*e,W=t=>{var e=(t-g.buffer.byteLength+65535)/65536|0
|
|
570
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=>
|
|
572
|
-
n._s&&(D=n._s),n.Os&&(x=n.Os),n.Cs&&(d=n.Cs),n.ks=g,n.Ls=
|
|
573
|
-
s&&M.set(s,i)}})(0,
|
|
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=>S.get(t),q=[],Y=(t,e)=>S.set(t,e)
|
|
572
|
+
n._s&&(D=n._s),n.Os&&(x=n.Os),n.Cs&&(d=n.Cs),n.ks=g,n.Ls=J,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,S.length)),M.get(t)||0))(t)
|
|
574
574
|
if(i)return i
|
|
575
|
-
var s=q.length?q.pop():
|
|
575
|
+
var s=q.length?q.pop():S.grow(1)
|
|
576
576
|
try{Y(s,t)}catch(i){if(!(i instanceof TypeError))throw i
|
|
577
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
578
|
return new WebAssembly.Instance(s,{e:{f:t}}).exports.f})(t,e)
|
|
579
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
|
|
580
|
+
var K={Ns:()=>s(""),Ps(){D=!1,N=0},$s(t,e){if(P[t]&&(clearTimeout(P[t].id),delete P[t]),!e)return 0
|
|
581
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
582
|
return P[t]={id:i,Gs:e},0},Rs(t){var e=m.length,i=2147483648
|
|
583
583
|
if((t>>>=0)>i)return!1
|
|
584
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},
|
|
586
|
-
I=null,t()}})(),
|
|
587
|
-
var e,r={nt:
|
|
585
|
+
if(W(r))return!0}return!1},zs:R},J=await(async()=>{function t(t){return n.Ls=J=t.exports,n.ks=g=J.memory,i(),S=J.Ws,(t=>{n.js=t.Us,n.Vs=t.Hs,n.qs=t.Ys,n.Ks=t.Js,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.Fn,n.Sn=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.Kn=t.Jn,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.Fr=t.Sr,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})(J),(()=>{if(T--,n.Vr?.(T),0==T&&I){var t=I
|
|
586
|
+
I=null,t()}})(),J}T++,n.Vr?.(T)
|
|
587
|
+
var e,r={nt:K,Hr:K}
|
|
588
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
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
590
|
return new Uint8Array(e)}catch{}return(t=>{if(t==v&&d)return new Uint8Array(d)
|
|
591
591
|
if(c)return c(t)
|
|
592
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)).
|
|
594
|
-
return(()=>{if(n.
|
|
593
|
+
return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,v,r)).Kr))})()
|
|
594
|
+
return(()=>{if(n.Jr)for("function"==typeof n.Jr&&(n.Jr=[n.Jr]);n.Jr.length>0;)n.Jr.shift()()})(),(function t(){function e(){n.Xr=!0,A||(E=!0,J.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
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
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})(
|
|
598
|
-
var Xt=n(
|
|
597
|
+
t.exports=i,t.exports.default=i})(Kt)
|
|
598
|
+
var Xt=n(Kt.exports),Qt={exports:{}}
|
|
599
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
600
|
for(let s=0;e.length>s;++s){const n=e.charCodeAt(s)
|
|
601
601
|
if(n>127)throw Error("Expected ASCII text")
|
|
@@ -604,13 +604,13 @@ s&&(s=s.split(","),r=n.Un(16*s.length),s.forEach(t=>{var e=i(t)
|
|
|
604
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
605
|
let o=t.Bs,h=t.Ds
|
|
606
606
|
var a=o(t=>{n.Hn(t)},"vi"),l=e("JSON"),c="",u=n.Un(256)
|
|
607
|
-
return{
|
|
607
|
+
return{Ji(e){var i=n.Un(e.byteLength)
|
|
608
608
|
t.HEAPU8.set(new Uint8Array(e),i)
|
|
609
609
|
var s=n.Us(i,e.byteLength,2,i,a)
|
|
610
610
|
return{so:s,destroy(){n.Hs(s)}}},Xi(i,s){var r=n.lr(i.so,s)
|
|
611
611
|
const o=n.wr(r)
|
|
612
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.
|
|
613
|
+
if(o){var h=n.Js(s,null)
|
|
614
614
|
return t.HEAPU8.subarray(h,h+o)}},ts(){var e=n.Un(2048),i=n.Un(4)
|
|
615
615
|
t.HEAPU32[i/4]=64,n.Pr(r,0,i,e)
|
|
616
616
|
var s={}
|
|
@@ -619,16 +619,16 @@ s[(r=t.HEAPU32[e/4+8*n+1],""+String.fromCharCode(r>>24&255)+String.fromCharCode(
|
|
|
619
619
|
n.mr(r,e)
|
|
620
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
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.
|
|
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.Jn(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
623
|
return{so:a,oo(e){n.Er(a,e,u,256)
|
|
624
624
|
var i=t.HEAPU8.subarray(u,u+256)
|
|
625
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
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.
|
|
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.Sr(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
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
629
|
for(let t=0;s.length>t;++t)s[t]=e.charCodeAt(t)
|
|
630
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.
|
|
631
|
+
n.On(e,s.so,s.length,0,s.length),s.Hn()},si:()=>n.Fn(e),bs(t){n.an(e,{lo:4,co:5,uo:6,fo:7}[t]||0)},do(t){var i=0
|
|
632
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
633
|
n.fn(e,n.Bn(s.so,-1)),s.Hn()},po(t){var s=i(t)
|
|
634
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)})
|
|
@@ -645,58 +645,61 @@ if(ie)e.Cs=ie
|
|
|
645
645
|
else{if(!ee)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
|
|
646
646
|
e.Cs=await s(ee)}const i=await Xt(e)
|
|
647
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.
|
|
648
|
+
class re{static{this.Fo=new Map}static{this.So=null}static{this.Mo=new Map}static{this._o=new Map}static{this.Oo=new Map}static{this.Co=0}static{this.ko=1/0}static{this.Lo=0}static Bo(t){(t=>{zt=t})(t)}static Do(t){const e=Object.keys(t).sort()
|
|
649
649
|
let i=""
|
|
650
650
|
for(let s=0;e.length>s;s++)s>0&&(i+=","),i+=e[s]+":"+t[e[s]]
|
|
651
|
-
return i}constructor(){this.
|
|
652
|
-
re.
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
for(const t in e){const
|
|
657
|
-
void 0!==
|
|
658
|
-
|
|
659
|
-
return{...
|
|
660
|
-
|
|
651
|
+
return i}constructor(){this.No="",re.So||(re.So=se.Io()),this.Po=new jt(()=>re.So)}static $o(t){se.Eo(t),re.So=null}static Go(t){se.To(t),re.So=null}static init(){return re.So||(re.So=se.Io()),re.So}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
|
|
652
|
+
re.So||(re.So=se.Io())
|
|
653
|
+
const{oi:e,Ro:i}=await re.zo(t),s=new re
|
|
654
|
+
s.Wo(e,i)
|
|
655
|
+
const n=await s.jo(t),r=async e=>{const i={...t}
|
|
656
|
+
for(const t in e){const s=e[t]
|
|
657
|
+
void 0!==s&&(i[t]=s)}if(void 0!==e.font||void 0!==e.es||void 0!==e.ni){const{oi:t,Ro:e}=await re.zo(i)
|
|
658
|
+
s.Wo(t,e),s.Uo()}return t=i,{...await s.jo(t),getLoadedFont(){return s.getLoadedFont()},measureTextWidth(t,e){return s.measureTextWidth(t,e)},update:r,dispose(){return s.destroy()}}}
|
|
659
|
+
return{...n,getLoadedFont(){return s.getLoadedFont()},measureTextWidth(t,e){return s.measureTextWidth(t,e)},update:r,dispose(){return s.destroy()}}}static Vo(t){re.Oo.set(t,(re.Oo.get(t)??0)+1)}static Ho(t,e){const i=(re.Oo.get(t)??0)-1
|
|
660
|
+
i>0?re.Oo.set(t,i):(re.Oo.delete(t),re.Mo.has(t)||jt.cs(e))}static async zo(t){let e="string"==typeof t.font?t.font:"buffer-"+re.qo(t.font)
|
|
661
|
+
t.es&&(e+="_var_"+re.Do(t.es)),t.ni&&(e+="_feat_"+re.Do(t.ni))
|
|
661
662
|
let i=re.Mo.get(e)
|
|
662
|
-
|
|
663
|
-
await
|
|
663
|
+
if(!i){let s=re._o.get(e)
|
|
664
|
+
s||(s=re.Yo(e,t.font,t.es,t.ni).finally(()=>{re._o.delete(e)}),re._o.set(e,s)),i=await s}return re.Vo(e),{oi:i,Ro:e}}static async Yo(t,e,i,s){const n=new re
|
|
665
|
+
await n.Ki(e,i,s)
|
|
664
666
|
const r=n.getLoadedFont()
|
|
665
|
-
return re.Mo.set(t,r),re.
|
|
666
|
-
e&&(re.
|
|
667
|
+
return re.Mo.set(t,r),re.Ko(r),re.Jo(),r}static Ko(t){re.Co+=t.ls?.byteLength??0}static Xo(t){const e=re.Mo.get(t)
|
|
668
|
+
e&&(re.Co-=e.ls?.byteLength??0,0>re.Co&&(re.Co=0))}static Jo(){if(re.ko!==1/0)for(;re.Co>re.ko&&re.Mo.size>0;){const t=re.Mo.keys().next().value
|
|
667
669
|
if(void 0===t)break
|
|
668
|
-
re.
|
|
670
|
+
const e=re.Mo.get(t)
|
|
671
|
+
re.Xo(t),re.Mo.delete(t),0>=(re.Oo.get(t)??0)&&e&&jt.cs(e)}}static qo(t){if(t){const e=new Uint8Array(t)
|
|
669
672
|
let i=2166136261
|
|
670
673
|
const s=Math.min(32,e.length),n=Math.floor(e.length/s)
|
|
671
674
|
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.
|
|
673
|
-
const
|
|
674
|
-
this.
|
|
675
|
+
return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++re.Lo}Wo(t,e){this.oi&&this.oi!==t&&this.Qo(),this.oi=t,this.Zo=e
|
|
676
|
+
const i=re.qo(t.ls)
|
|
677
|
+
this.No="font_"+i,t.es&&(this.No+="_var_"+re.Do(t.es)),t.ni&&(this.No+="_feat_"+re.Do(t.ni))}Qo(){if(!this.oi)return
|
|
678
|
+
const t=this.oi,e=this.Zo
|
|
679
|
+
try{e?re.Ho(e,t):jt.cs(t)}catch(t){nt.warn("Error destroying HarfBuzz objects:",t)}finally{this.oi=void 0,this.Zo=void 0,this.th=void 0,this.eh=void 0}}async Ki(t,e,i){re.So||(re.So=se.Io()),await re.So
|
|
675
680
|
const n="string"==typeof t?await s(t):t
|
|
676
|
-
try{this.oi&&this.destroy(),this.oi=await this.
|
|
677
|
-
const t=re.
|
|
678
|
-
this.
|
|
679
|
-
const e=await this.
|
|
680
|
-
this.
|
|
681
|
-
const i=this.
|
|
682
|
-
return{
|
|
683
|
-
if(!t.layout?.ke?.[e])try{if(!re.
|
|
684
|
-
re.
|
|
685
|
-
const e=t.
|
|
686
|
-
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}
|
|
681
|
+
try{this.oi&&this.destroy(),this.oi=await this.Po.Ki(n,e),i&&(this.oi.ni=i)
|
|
682
|
+
const t=re.qo(n)
|
|
683
|
+
this.No="font_"+t,e&&(this.No+="_var_"+re.Do(e)),i&&(this.No+="_feat_"+re.Do(i))}catch(t){throw nt.error("Failed to load font:",t),t}}async jo(t){try{if(!this.oi)throw Error("Font not loaded. Use Text.create() with a font option.")
|
|
684
|
+
const e=await this.ih(t)
|
|
685
|
+
this.sh(e),this.nh(t=e),this.oi.font.setScale(this.oi.upem,this.oi.upem),this.eh||(this.eh=new Yt(this.oi))
|
|
686
|
+
const i=this.rh(t)
|
|
687
|
+
return{oh:this.eh.xs(i.lines,i.hh,i.letterSpacing,i.align,i.direction,t.color,t.text),ah:i,options:t,oi:this.oi,uh:this.No}}finally{}}async ih(t){if(!1!==t.layout?._e&&t.layout?.width){const e=t.layout?.language||"en-us"
|
|
688
|
+
if(!t.layout?.ke?.[e])try{if(!re.Fo.has(e)){const s=await i(e,t.layout?.fh)
|
|
689
|
+
re.Fo.set(e,s)}return{...t,layout:{...t.layout,ke:{...t.layout?.ke,[e]:re.Fo.get(e)}}}}catch(i){return nt.warn(`Failed to load patterns for ${e}: ${i}`),{...t,layout:{...t.layout,_e:!1}}}}return t}sh(t){if(!t.text)throw Error("Text content is required")
|
|
690
|
+
const e=t.dh??1e5
|
|
691
|
+
if(t.text.length>e)throw Error(`Text exceeds ${e} character limit`)}nh(t){t.es&&this.oi&&re.Do(t.es)!==re.Do(this.oi.es||{})&&(this.oi.font.Zi(t.es),this.oi.es=t.es)}rh(t){if(!this.oi)throw Error("Font not loaded. Use Text.create() with a font option")
|
|
687
692
|
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
|
|
689
|
-
void 0!==h&&(
|
|
690
|
-
const
|
|
691
|
-
this.
|
|
692
|
-
const _=this.
|
|
693
|
-
return{lines:_.lines,
|
|
694
|
-
return Rt.zi(this.oi.rt)}static async
|
|
695
|
-
re.
|
|
696
|
-
return Et.measureTextWidth(this.oi,t,e)}
|
|
697
|
-
|
|
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={}))
|
|
693
|
+
let F
|
|
694
|
+
void 0!==h&&(F=h*I)
|
|
695
|
+
const S=s*I,M=S>0?Math.max(S,25e-6*this.oi.upem):0
|
|
696
|
+
this.th||(this.th=new Tt(this.oi))
|
|
697
|
+
const _=this.th.hi({text:e,width:F,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)
|
|
698
|
+
return{lines:_.lines,hh:(O.fi-O.di)*n,letterSpacing:r,align:l,direction:a,depth:M,size:i,yh:1/I}}zi(){if(!this.oi)throw Error("Font not loaded. Call loadFont() first")
|
|
699
|
+
return Rt.zi(this.oi.rt)}static async ph(t,e){await Promise.all(t.map(async t=>{if(!re.Fo.has(t))try{const s=await i(t,e)
|
|
700
|
+
re.Fo.set(t,s)}catch(e){nt.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static wh(t,e){re.Fo.set(t,e)}static gh(t){re.ko=t===1/0?1/0:1048576*Math.max(1,Math.floor(t)),re.Jo()}getLoadedFont(){return this.oi}measureTextWidth(t,e=0){if(!this.oi)throw Error("Font not loaded. Call loadFont() first")
|
|
701
|
+
return Et.measureTextWidth(this.oi,t,e)}Uo(){this.eh=void 0,this.th=void 0}destroy(){this.oi&&this.Qo()}}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
|
|
702
|
+
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.mh=100151]="MISSING_BEGIN_POLYGON",t[t.xh=100152]="MISSING_BEGIN_CONTOUR",t[t.Ah=100153]="MISSING_END_POLYGON",t[t.bh=100154]="MISSING_END_CONTOUR",t[t.Eh=100155]="COORD_TOO_LARGE",t[t.Th=100156]="NEED_COMBINE_CALLBACK"})(pe||(pe={}))
|
|
700
703
|
class we{next
|
|
701
704
|
v
|
|
702
705
|
m=null
|
|
@@ -724,82 +727,82 @@ L
|
|
|
724
727
|
q=0}class xe{Y
|
|
725
728
|
it
|
|
726
729
|
Z
|
|
727
|
-
|
|
728
|
-
|
|
730
|
+
Ih
|
|
731
|
+
Fh=0
|
|
729
732
|
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.
|
|
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}
|
|
732
|
-
i.p.O=e,s.p.O=t,t.C=s,e.C=i}
|
|
733
|
-
s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,++this.
|
|
733
|
+
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.Ih=s}Sh(t){const e=new ge,i=new ge,s=t.p.next
|
|
734
|
+
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}Mh(t,e){const i=t.C,s=e.C
|
|
735
|
+
i.p.O=e,s.p.O=t,t.C=s,e.C=i}_h(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,++this.Fh
|
|
734
737
|
let r=e
|
|
735
|
-
do{r.u=s,r=r.C}while(r!==e)}
|
|
738
|
+
do{r.u=s,r=r.C}while(r!==e)}Oh(t,e,i){const s=t,n=i.v
|
|
736
739
|
s.v=n,n.next=s,s.next=i,i.v=s,s.L=e,s.q=i.q
|
|
737
740
|
let r=e
|
|
738
|
-
do{r.D=s,r=r.O}while(r!==e)}
|
|
739
|
-
e.p.next=i,i.p.next=e}
|
|
741
|
+
do{r.D=s,r=r.O}while(r!==e)}Ch(t){const e=t.next,i=t.p.next
|
|
742
|
+
e.p.next=i,i.p.next=e}kh(t,e){const i=t.L
|
|
740
743
|
let s=i
|
|
741
744
|
do{s.u=e,s=s.C}while(s!==i)
|
|
742
745
|
const n=t.v,r=t.next
|
|
743
|
-
r.v=n,n.next=r,--this.
|
|
746
|
+
r.v=n,n.next=r,--this.Fh}Lh(t,e){const i=t.L
|
|
744
747
|
let s=i
|
|
745
748
|
do{s.D=e,s=s.O}while(s!==i)
|
|
746
749
|
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.
|
|
748
|
-
return this.
|
|
749
|
-
if(t!==e){if(e.u!==t.u&&(s=1,this.
|
|
750
|
-
this.
|
|
751
|
-
this.
|
|
750
|
+
r.v=n,n.next=r}F(){const t=new me,e=new me,i=new ve,s=this.Sh(this.Z)
|
|
751
|
+
return this._h(t,s,this.Y),this._h(e,s.p,this.Y),this.Oh(i,s,this.it),s}splice(t,e){let i=0,s=0
|
|
752
|
+
if(t!==e){if(e.u!==t.u&&(s=1,this.kh(e.u,t.u)),e.D!==t.D&&(i=1,this.Lh(e.D,t.D)),this.Mh(e,t),!s){const i=new me
|
|
753
|
+
this._h(i,e,t.u),t.u.L=t}if(!i){const i=new ve
|
|
754
|
+
this.Oh(i,e,t.D),t.D.L=t}}}delete(t){const e=t.p
|
|
752
755
|
let i=0
|
|
753
|
-
if(t.D!==t.p.D&&(i=1,this.
|
|
754
|
-
else if(t.p.D.L=t.p.O,t.u.L=t.C,this.
|
|
755
|
-
this.
|
|
756
|
-
this.
|
|
756
|
+
if(t.D!==t.p.D&&(i=1,this.Lh(t.D,t.p.D)),t.C===t)this.kh(t.u,null)
|
|
757
|
+
else if(t.p.D.L=t.p.O,t.u.L=t.C,this.Mh(t,t.p.O),!i){const e=new ve
|
|
758
|
+
this.Oh(e,t,t.D)}e.C===e?(this.kh(e.u,null),this.Lh(e.D,null)):(t.D.L=e.p.O,e.u.L=e.C,this.Mh(e,e.p.O)),this.Ch(t)}Et(t){const e=this.Sh(t),i=e.p
|
|
759
|
+
this.Mh(e,t.O),e.u=t.p.u
|
|
757
760
|
const s=new me
|
|
758
|
-
return this.
|
|
759
|
-
return this.
|
|
760
|
-
const s=this.
|
|
761
|
-
if(e.D!==t.D&&(i=1,this.
|
|
762
|
-
this.
|
|
761
|
+
return this._h(s,i,e.u),e.D=i.D=t.D,e}V(t){const e=this.Et(t).p
|
|
762
|
+
return this.Mh(t.p,t.p.p.O),this.Mh(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
|
|
763
|
+
const s=this.Sh(t),n=s.p
|
|
764
|
+
if(e.D!==t.D&&(i=1,this.Lh(e.D,t.D)),this.Mh(s,t.O),this.Mh(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
|
|
765
|
+
this.Oh(e,s,t.D)}return s}Nt(t){const e=t.L
|
|
763
766
|
let i,s,n,r,o
|
|
764
767
|
s=e.O
|
|
765
|
-
do{i=s,s=i.O,i.D=null,i.p.D||(i.C===i?this.
|
|
766
|
-
r=t.v,o=t.next,o.v=r,r.next=o}
|
|
768
|
+
do{i=s,s=i.O,i.D=null,i.p.D||(i.C===i?this.kh(i.u,null):(i.u.L=i.C,this.Mh(i,i.p.O)),n=i.p,n.C===n?this.kh(n.u,null):(n.u.L=n.C,this.Mh(n,n.p.O)),this.Ch(i))}while(i!=e)
|
|
769
|
+
r=t.v,o=t.next,o.v=r,r.next=o}Bh(t){let e=t.L,i=0
|
|
767
770
|
do{i++,e=e.O}while(e!==t.L)
|
|
768
771
|
return i}check(){}}class Ae{max=0
|
|
769
772
|
At
|
|
770
773
|
It
|
|
771
|
-
|
|
774
|
+
Dh
|
|
772
775
|
Ot=0
|
|
773
|
-
|
|
776
|
+
Nh=0
|
|
774
777
|
size=0
|
|
775
|
-
constructor(t){this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.
|
|
778
|
+
constructor(t){this.max=t,this.At=new Int32Array(t+1),this.It=Array(t+1).fill(null),this.Dh=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.Dh=new Int32Array(t+1)
|
|
776
779
|
else{const t=this.It
|
|
777
|
-
for(let e=1;this.size>=e;e++)t[e]=null}this.size=0,this.
|
|
780
|
+
for(let e=1;this.size>=e;e++)t[e]=null}this.size=0,this.Nh=0,this.Ot=0,this.At[1]=1,this.It[1]=null}Ph(t){const e=this.At,i=this.It,s=this.Dh
|
|
778
781
|
let n=e[t]
|
|
779
782
|
for(;;){let r=t<<1
|
|
780
783
|
if(r>this.size)break
|
|
781
784
|
let o=r,h=e[r]
|
|
782
785
|
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
786
|
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.
|
|
787
|
+
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.Dh
|
|
785
788
|
let n=e[t]
|
|
786
789
|
for(;;){const r=t>>1
|
|
787
790
|
if(0===r)break
|
|
788
791
|
const o=e[r],h=i[o],a=i[n]
|
|
789
792
|
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.
|
|
791
|
-
this.Ot=1}
|
|
793
|
+
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.Ph(t)
|
|
794
|
+
this.Ot=1}$h(){return 0===this.size}min(){return 0===this.size?null:this.It[this.At[1]]}P(t){let e,i
|
|
792
795
|
if(e=++this.size,2*e>this.max){this.max*=2
|
|
793
796
|
const t=new Int32Array(this.max+1),e=new Int32Array(this.max+1),i=Array(this.max+1).fill(null)
|
|
794
|
-
t.set(this.At),e.set(this.
|
|
797
|
+
t.set(this.At),e.set(this.Dh)
|
|
795
798
|
for(let t=0;this.It.length>t;t++)i[t]=this.It[t]
|
|
796
|
-
this.At=t,this.
|
|
799
|
+
this.At=t,this.Dh=e,this.It=i}return 0===this.Nh?i=e:(i=this.Nh,this.Nh=this.Dh[i]),this.At[e]=i,this.Dh[i]=e,this.It[i]=t,this.Ot&&this.Tt(e),i}Mt(){const t=this.At,e=this.It,i=this.Dh
|
|
797
800
|
let s=t[1],n=e[s]
|
|
798
|
-
return this.size>0&&(t[1]=t[this.size],i[t[1]]=1,e[s]=null,i[s]=this.
|
|
801
|
+
return this.size>0&&(t[1]=t[this.size],i[t[1]]=1,e[s]=null,i[s]=this.Nh,this.Nh=s,--this.size,this.size>0&&this.Ph(1)),n}delete(t){const e=this.At,i=this.It,s=this.Dh
|
|
799
802
|
let n
|
|
800
803
|
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]]
|
|
801
|
-
s.s>t.s||t.s===s.s&&s.l>=t.l?this.
|
|
802
|
-
i[t]=null,s[t]=this.
|
|
804
|
+
s.s>t.s||t.s===s.s&&s.l>=t.l?this.Ph(n):this.Tt(n)}else this.Ph(n)
|
|
805
|
+
i[t]=null,s[t]=this.Nh,this.Nh=t}}class be{Dt
|
|
803
806
|
keys
|
|
804
807
|
order=null
|
|
805
808
|
size=0
|
|
@@ -819,28 +822,28 @@ const t=this.keys
|
|
|
819
822
|
return this.order.sort((e,i)=>{const s=t[e],n=t[i]
|
|
820
823
|
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()
|
|
821
824
|
const t=this.keys[this.order[this.size-1]]
|
|
822
|
-
if(!this.Dt
|
|
825
|
+
if(!this.Dt.$h()){const e=this.Dt.min()
|
|
823
826
|
if(e&&a(e,t))return this.Dt.Mt()}do{--this.size}while(this.size>0&&null===this.keys[this.order[this.size-1]])
|
|
824
827
|
return t}min(){if(this.Lt||0===this.size)return this.Dt.min()
|
|
825
828
|
const t=this.keys[this.order[this.size-1]]
|
|
826
|
-
if(!this.Dt
|
|
827
|
-
if(e&&a(e,t))return e}return t}delete(t){0>t?this.keys[-(t+1)]=null:this.Dt.delete(t)}
|
|
829
|
+
if(!this.Dt.$h()){const e=this.Dt.min()
|
|
830
|
+
if(e&&a(e,t))return e}return t}delete(t){0>t?this.keys[-(t+1)]=null:this.Dt.delete(t)}$h(){return(this.Lt||0===this.size)&&this.Dt.$h()}}class Ee{head=new we
|
|
828
831
|
frame
|
|
829
832
|
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
833
|
do{e=e.next}while(null!==e.m&&!m(this.frame,t,e))
|
|
831
834
|
return e}insertBefore(t,e){do{t=t.v}while(null!==t.m&&!m(this.frame,t,e))
|
|
832
835
|
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
|
|
836
|
+
const Fe=[0,0,0,0],Se=[null,null,null,null],Me=[0,0,0]
|
|
834
837
|
class _e{static Ct(t,e){t._+=e._,t.p._+=e.p._}static Gt(t,e){let i,s,n
|
|
835
838
|
if(i=e.L,i.O===i||i.O.O===i)throw Error("Monotone region has degenerate topology")
|
|
836
839
|
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
840
|
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
|
|
838
841
|
i=i.O}if(s.O===i)throw Error("Monotone region has insufficient vertices")
|
|
839
842
|
for(;s.O.O!==i;)n=t.connect(s.O,s),s=n.p
|
|
840
|
-
return 1}static
|
|
843
|
+
return 1}static Gh(t){let e
|
|
841
844
|
for(let i=t.it.next;i!==t.it;i=e)e=i.next,i.q&&_e.Gt(t,i)
|
|
842
845
|
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.
|
|
846
|
+
var Be;(t=>{t[t.Rt=0]="T_DORMANT",t[t.Rh=1]="T_IN_POLYGON",t[t.zh=2]="T_IN_CONTOUR"})(Be||(Be={}))
|
|
844
847
|
class De{state=Be.Rt
|
|
845
848
|
Ut=null
|
|
846
849
|
St=0
|
|
@@ -849,11 +852,11 @@ Vt=1
|
|
|
849
852
|
Pt=0
|
|
850
853
|
Ft=0
|
|
851
854
|
Yt=0
|
|
852
|
-
|
|
855
|
+
Wh=0
|
|
853
856
|
A
|
|
854
857
|
Ht=[0,0,0]
|
|
855
|
-
|
|
856
|
-
|
|
858
|
+
jh
|
|
859
|
+
Uh
|
|
857
860
|
Wt
|
|
858
861
|
Zt
|
|
859
862
|
M=fe.ODD
|
|
@@ -865,45 +868,45 @@ Xt
|
|
|
865
868
|
Qt
|
|
866
869
|
Jt
|
|
867
870
|
$t
|
|
868
|
-
|
|
869
|
-
|
|
871
|
+
Vh
|
|
872
|
+
Hh
|
|
870
873
|
R
|
|
871
|
-
|
|
874
|
+
qh
|
|
872
875
|
tt=null
|
|
873
876
|
U=0
|
|
874
|
-
|
|
877
|
+
Yh(t,e){const i=e||null
|
|
875
878
|
switch(t){case 100100:case 100106:this.Xt=i
|
|
876
879
|
break
|
|
877
|
-
case 100104:case 100110:this.$t=i,this.
|
|
880
|
+
case 100104:case 100110:this.$t=i,this.Kh=1
|
|
878
881
|
break
|
|
879
882
|
case 100101:case 100107:this.Qt=i
|
|
880
883
|
break
|
|
881
884
|
case 100102:case 100108:this.Jt=i
|
|
882
885
|
break
|
|
883
|
-
case 100103:this
|
|
886
|
+
case 100103:this.Vh=i
|
|
884
887
|
break
|
|
885
|
-
case 100109:this.
|
|
888
|
+
case 100109:this.Hh=i
|
|
886
889
|
break
|
|
887
890
|
case 100105:case 100111:this.R=i
|
|
888
891
|
break
|
|
889
|
-
case 100112:this.
|
|
892
|
+
case 100112:this.qh=i
|
|
890
893
|
break
|
|
891
|
-
default:throw Error("GLU_INVALID_ENUM")}}
|
|
894
|
+
default:throw Error("GLU_INVALID_ENUM")}}Jh(t,e){switch(t){case 100140:{const t=e,i=100130>t?t:t-100130
|
|
892
895
|
if(0>i||i>4)throw Error("GLU_INVALID_VALUE")
|
|
893
896
|
this.Kt=t,this.M=i
|
|
894
|
-
break}case 100141:this.
|
|
897
|
+
break}case 100141:this.Xh=!!e
|
|
895
898
|
break
|
|
896
899
|
case 100142:break
|
|
897
|
-
default:throw Error("GLU_INVALID_ENUM")}}
|
|
898
|
-
case 100141:return this.
|
|
900
|
+
default:throw Error("GLU_INVALID_ENUM")}}Qh(t){switch(t){case 100140:return this.Kt
|
|
901
|
+
case 100141:return this.Xh
|
|
899
902
|
case 100142:return 0
|
|
900
|
-
default:throw Error("GLU_INVALID_ENUM")}}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
+
default:throw Error("GLU_INVALID_ENUM")}}Zh(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.Hh?this.Hh(t,this.tt):this.Vh&&this.Vh(t)}ta(t){if(this.state!==t)for(;this.state!==t;)t>this.state?this.state===Be.Rt?(this.et(100151),this.ea()):this.state===Be.Rh&&(this.et(100152),this.ia()):this.state===Be.zh?(this.et(100154),this.sa()):this.state===Be.Rh&&(this.et(100153),this.na())}Xh=0
|
|
904
|
+
Kh=0
|
|
905
|
+
ra(){const t=this.A,e=t.Y,i=this.Ht[0],s=this.Ht[1],n=this.Ht[2]
|
|
903
906
|
let r,o
|
|
904
|
-
if(this.
|
|
907
|
+
if(this.jh||(this.jh=[0,0,0]),this.Uh||(this.Uh=[0,0,0]),this.Wt||(this.Wt=[0,0]),this.Zt||(this.Zt=[0,0]),r=this.jh,o=this.Uh,this.Bt){r[0]=1,r[1]=0,r[2]=0
|
|
905
908
|
const t=n>0?1:-1
|
|
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.
|
|
909
|
+
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.Wh)}if(!this.St&&!i&&!s){let i
|
|
907
910
|
r[0]=1,r[1]=0,r[2]=0
|
|
908
911
|
let s=0
|
|
909
912
|
if(n)i=n>0?1:-1
|
|
@@ -913,7 +916,7 @@ let h=e.next,a=h.coords[0],l=h.coords[1]*i
|
|
|
913
916
|
h.s=a,h.l=l
|
|
914
917
|
let c=a,u=a,f=l,d=l
|
|
915
918
|
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.
|
|
919
|
+
return this.Wt[0]=c,this.Zt[0]=u,void(s?(W(t,this.Uh),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
|
|
917
920
|
const a=[i,s,n]
|
|
918
921
|
i||s||n||(z(t,a),h=1)
|
|
919
922
|
const l=(t=>{let e=0
|
|
@@ -923,16 +926,16 @@ let c=e.next
|
|
|
923
926
|
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
927
|
let u=c.s,f=c.s,d=c.l,y=c.l
|
|
925
928
|
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]
|
|
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.
|
|
929
|
+
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.Uh),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)}ea(t){this.ta(Be.Rt),this.state=Be.Rh,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.Wh=-1/0,this.tt=t}ia(){this.ta(Be.Rh),this.state=Be.zh,this.Ut=null}oa(t,e){this.ta(Be.zh)
|
|
927
930
|
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)
|
|
928
931
|
let o=this.Ut
|
|
929
932
|
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
|
|
930
933
|
const t=s*this.Vt
|
|
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.
|
|
934
|
+
o.u.l=t,this.Pt>i&&(this.Pt=i),i>this.Ft&&(this.Ft=i),this.Yt>t&&(this.Yt=t),t>this.Wh&&(this.Wh=t)}o._=1,o.p._=-1,this.Ut=o}sa(){this.ta(Be.zh),this.state=Be.Rh}na(){this.ta(Be.Rh),this.state=Be.Rt,this.compute(this.M,void 0,0)
|
|
932
935
|
const t=this.A
|
|
933
|
-
this.U||(this.
|
|
936
|
+
this.U||(this.Xh?(H(t,1),Y(this,t)):this.Kh?(_e.Gh(t),q(this,t)):j(this,t)),this.qh&&this.qh(t),this.A=null,this.Ut=null,this.event=null,this.tt=null,this.k=null}ha(){this.ta(Be.Rt)}compute(t=fe.ODD,e,i=0){this.state!==Be.Rt&&this.state===Be.Rh&&(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.ra(),((t,e=1)=>{let i,s
|
|
934
937
|
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.
|
|
938
|
+
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.Fh+8
|
|
936
939
|
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)
|
|
937
940
|
return i!==s?0:(e.init(),1)})(t))return 0
|
|
938
941
|
for((t=>{t.k=new Ee(t)
|
|
@@ -940,60 +943,60 @@ 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
|
|
|
940
943
|
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
944
|
G(t,i)}t.event=t.k.min().m.u,(t=>{let e
|
|
942
945
|
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)}
|
|
946
|
+
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)}aa(){this.A&&(H(this.A,1),Y(this,this.A))}la(t=0){this.A&&(t?(_e.Gh(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{ca:{vertices:[],indices:[]},ua:[]}
|
|
944
947
|
const n=t.filter(t=>t.points.length>=3)
|
|
945
|
-
return 0===n.length?{
|
|
948
|
+
return 0===n.length?{ca:{vertices:[],indices:[]},ua:[]}:this.fa(n,e,i,s)}da(t,e=!0,i=!1,s=!0){return 0===t.length?{ca:{vertices:[],indices:[]},ua:[]}:this.ya(t,e,i,s)}fa(t,e,i,s){const n=!i&&!e
|
|
946
949
|
let r,o
|
|
947
|
-
n?(o=this.
|
|
948
|
-
let h=s?n?o:r??this.
|
|
949
|
-
if(e){const t=this.
|
|
950
|
-
if(!t)return nt.warn("libtess returned empty result from boundary pass"),{
|
|
951
|
-
o=this.
|
|
952
|
-
return a?{
|
|
950
|
+
n?(o=this.pa(t,!0),(e||s)&&(r=this.pa(t))):(r=this.pa(t),o=r)
|
|
951
|
+
let h=s?n?o:r??this.pa(t):[]
|
|
952
|
+
if(e){const t=this.wa(r,"boundary")
|
|
953
|
+
if(!t)return nt.warn("libtess returned empty result from boundary pass"),{ca:{vertices:[],indices:[]},ua:[]}
|
|
954
|
+
o=this.ga(t),s&&(h=o)}const a=this.wa(o,"triangles")
|
|
955
|
+
return a?{ca:{vertices:a.vertices,indices:a.indices||[]},ua:h,ma:e}:(nt.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{ca:{vertices:[],indices:[]},ua:h})}ya(t,e,i,s){const n=!i&&!e
|
|
953
956
|
let r,o
|
|
954
|
-
n?(o=this.
|
|
957
|
+
n?(o=this.va(t),(e||s)&&(r=t)):(r=t,o=t)
|
|
955
958
|
let h=s?n?o:r??t:[]
|
|
956
|
-
if(e){const t=this.
|
|
957
|
-
if(!t)return nt.warn("libtess returned empty result from boundary pass"),{
|
|
958
|
-
o=this.
|
|
959
|
-
return a?{
|
|
959
|
+
if(e){const t=this.wa(r,"boundary")
|
|
960
|
+
if(!t)return nt.warn("libtess returned empty result from boundary pass"),{ca:{vertices:[],indices:[]},ua:[]}
|
|
961
|
+
o=this.ga(t),s&&(h=o)}const a=this.wa(o,"triangles")
|
|
962
|
+
return a?{ca:{vertices:a.vertices,indices:a.indices||[]},ua:h,ma:e}:(nt.warn(e?"libtess returned empty result from triangulation pass":"libtess returned empty result from single-pass triangulation"),{ca:{vertices:[],indices:[]},ua:h})}pa(t,e=!1){const i=Array(t.length)
|
|
960
963
|
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))
|
|
961
964
|
let a=0
|
|
962
965
|
if(e)for(let t=o-1;t>=0;t--){const e=n[t]
|
|
963
966
|
h[a++]=e.x,h[a++]=e.y}else for(let t=0;o>t;t++){const e=n[t]
|
|
964
|
-
h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[s]=h}return i}
|
|
965
|
-
for(let i=0;t.length>i;i++)e[i]=this.
|
|
966
|
-
return e}
|
|
967
|
+
h[a++]=e.x,h[a++]=e.y}2>a||(h[a++]=h[0],h[a++]=h[1]),i[s]=h}return i}va(t){const e=Array(t.length)
|
|
968
|
+
for(let i=0;t.length>i;i++)e[i]=this.xa(t[i])
|
|
969
|
+
return e}xa(t){const e=t.length
|
|
967
970
|
if(0===e)return[]
|
|
968
971
|
const i=4>e||t[0]!==t[e-2]||t[1]!==t[e-1]?e:e-2
|
|
969
972
|
if(0===i)return[]
|
|
970
973
|
const s=Array(i+2)
|
|
971
974
|
let n=0
|
|
972
975
|
for(let e=i-2;e>=0;e-=2)s[n++]=t[e],s[n++]=t[e+1]
|
|
973
|
-
return 2>n||(s[n++]=s[0],s[n++]=s[1]),s}
|
|
974
|
-
i.
|
|
976
|
+
return 2>n||(s[n++]=s[0],s[n++]=s[1]),s}wa(t,e){const i=new De
|
|
977
|
+
i.Jh(ye.WINDING_RULE,fe.NONZERO)
|
|
975
978
|
const s=[],n=[],r=[]
|
|
976
979
|
let o=[]
|
|
977
|
-
"boundary"===e&&i.
|
|
978
|
-
return s.push(t[0],t[1]),e}),i.
|
|
979
|
-
for(const e of t){i.
|
|
980
|
+
"boundary"===e&&i.Jh(ye.BOUNDARY_ONLY,1),"triangles"===e?i.Yh(ye.VERTEX_DATA,t=>{n.push(t)}):(i.Yh(ye.BEGIN,()=>{o=[]}),i.Yh(ye.VERTEX_DATA,t=>{o.push(t)}),i.Yh(ye.END,()=>{o.length>0&&r.push(o)})),i.Yh(ye.COMBINE,t=>{const e=s.length/2
|
|
981
|
+
return s.push(t[0],t[1]),e}),i.Yh(ye.ERROR,t=>{nt.warn("libtess error: "+t)}),i.Zh(0,0,1),i.ea()
|
|
982
|
+
for(const e of t){i.ia()
|
|
980
983
|
for(let t=0;e.length>t;t+=2){const n=s.length/2
|
|
981
|
-
s.push(e[t],e[t+1]),i.
|
|
984
|
+
s.push(e[t],e[t+1]),i.oa([e[t],e[t+1]],n)}i.sa()}return i.na(),0===s.length?null:"triangles"===e?{vertices:s,indices:n}:{vertices:s,Aa:r}}ga(t){if(!t.Aa)return[]
|
|
982
985
|
const e=[]
|
|
983
|
-
for(const i of t.
|
|
986
|
+
for(const i of t.Aa){const s=[]
|
|
984
987
|
for(const e of i){const i=2*e
|
|
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}
|
|
988
|
+
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}ba(t){if(0===t.length)return!1
|
|
986
989
|
if(1===t.length)return!1
|
|
987
990
|
let e=null
|
|
988
|
-
for(const i of t){const t=0>this.
|
|
991
|
+
for(const i of t){const t=0>this.Ea(i)?-1:1
|
|
989
992
|
if(null===e)e=t
|
|
990
|
-
else if(t!==e)return!0}return!1}
|
|
993
|
+
else if(t!==e)return!0}return!1}Ea(t){let e=0
|
|
991
994
|
const i=t.length
|
|
992
995
|
if(6>i)return 0
|
|
993
996
|
for(let s=0;i>s;s+=2)e+=t[s]*t[(s+3)%i]-t[(s+2)%i]*t[s+1]
|
|
994
|
-
return e/2}}class Pe{constructor(){}
|
|
997
|
+
return e/2}}class Pe{constructor(){}Ta(t,e=0,i){const s=t.ca.vertices,n=t.ca.indices,r=t.ua,o=s.length,h=o/2
|
|
995
998
|
let a=[],l=0,c=!1
|
|
996
|
-
if(0!==e)if(!0===t.
|
|
999
|
+
if(0!==e)if(!0===t.ma&&r.length>0){c=!0
|
|
997
1000
|
for(const t of r){const e=t.length>>1
|
|
998
1001
|
2>e||(l+=e-1)}}else{const t=new Map,e=n.length
|
|
999
1002
|
for(let i=0;e>i;i+=3){const e=n[i],s=n[i+1],r=n[i+2]
|
|
@@ -1025,22 +1028,22 @@ if(p>1e-10){const t=1/Math.sqrt(p)
|
|
|
1025
1028
|
g=u*t,m=-c*t}const A=3*v
|
|
1026
1029
|
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
|
|
1027
1030
|
const b=v
|
|
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(){}
|
|
1029
|
-
return 0===i?[]:1===i?[[0]]:this.
|
|
1031
|
+
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(){}Ia(t,e){const i=t.length
|
|
1032
|
+
return 0===i?[]:1===i?[[0]]:this.Fa(t,e)}Fa(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)
|
|
1030
1033
|
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)
|
|
1031
1034
|
let h=0
|
|
1032
|
-
for(let i=0;n>i;i++)r[i]=this.
|
|
1035
|
+
for(let i=0;n>i;i++)r[i]=this.Sa(t[i],e[i]),o[h++]=[r[i].Ma,0,i],o[h++]=[r[i]._a,1,i]
|
|
1033
1036
|
o.sort((t,e)=>t[0]-e[0]||t[1]-e[1])
|
|
1034
1037
|
const a=Array.from({length:n},(t,e)=>e),l=Array(n).fill(0),c=new Set
|
|
1035
1038
|
for(const[,t,e]of o)if(0===t){const t=r[e]
|
|
1036
1039
|
for(const i of c){const n=r[i]
|
|
1037
|
-
n.
|
|
1040
|
+
n.Oa+.001>t.Ca&&t.Oa>n.Ca-.001&&s(e,i)}c.add(e)}else c.delete(e)
|
|
1038
1041
|
const u=new Map
|
|
1039
1042
|
for(let t=0;n>t;t++){const e=i(t)
|
|
1040
1043
|
let s=u.get(e)
|
|
1041
|
-
s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}
|
|
1044
|
+
s||(s=[],u.set(e,s)),s.push(t)}return Array.from(u.values())}Sa(t,e){return{Ma:t.bounds.min.x+e.x,Ca:t.bounds.min.y+e.y,_a:t.bounds.max.x+e.x,Oa:t.bounds.max.y+e.y}}}const Ge={enabled:!0,areaThreshold:1}
|
|
1042
1045
|
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}
|
|
1046
|
+
class Ye{constructor(t){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0},this.config=t}ka(t){this.config=t}La(t){const e=t.points,i=e.length
|
|
1044
1047
|
if(5>i||!this.config.enabled)return this.config.enabled&&(this.stats.originalPointCount+=i),t
|
|
1045
1048
|
this.stats.originalPointCount+=i
|
|
1046
1049
|
const s=((t,e,i)=>{if(3>=e)return 0;(t=>{if(t>Re){for(Re=1;t>Re;)Re<<=1
|
|
@@ -1053,201 +1056,201 @@ r[0]=1/0,r[e-1]=1/0
|
|
|
1053
1056
|
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
|
|
1054
1057
|
l[0]=-1,l[e-1]=-1
|
|
1055
1058
|
let u=c
|
|
1056
|
-
for(let t=(u>>1)-1;t>=0;t--)
|
|
1059
|
+
for(let t=(u>>1)-1;t>=0;t--)J(a,l,r,t,u)
|
|
1057
1060
|
const f=2*i,d=e-3
|
|
1058
1061
|
let y=0
|
|
1059
1062
|
for(;u>0&&d>y;){const t=a[0]
|
|
1060
1063
|
if(r[t]>f)break
|
|
1061
1064
|
if(u--,u>0){const t=a[u]
|
|
1062
|
-
a[0]=t,l[t]=0,
|
|
1065
|
+
a[0]=t,l[t]=0,J(a,l,r,0,u)}l[t]=-1
|
|
1063
1066
|
const e=o[t],i=h[t]
|
|
1064
1067
|
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)
|
|
1065
1068
|
r[e]=h
|
|
1066
1069
|
const c=l[e]
|
|
1067
|
-
0>c||(t>h?
|
|
1070
|
+
0>c||(t>h?K(a,l,r,c):h>t&&J(a,l,r,c,u))}if(i>=0&&h[i]>=0){const t=r[i],o=X(s,n,e,i,h[i])
|
|
1068
1071
|
r[i]=o
|
|
1069
1072
|
const c=l[i]
|
|
1070
|
-
0>c||(t>o?
|
|
1073
|
+
0>c||(t>o?K(a,l,r,c):o>t&&J(a,l,r,c,u))}}return y})(e,i,this.config.areaThreshold)
|
|
1071
1074
|
if(0===s)return t
|
|
1072
1075
|
this.stats.pointsRemovedByVisvalingam+=s
|
|
1073
1076
|
const n=Array(i-s)
|
|
1074
1077
|
let r=0,o=0
|
|
1075
1078
|
for(;r>=0;)n[o++]=e[r],r=Ve[r]
|
|
1076
|
-
return{...t,points:n}}getStats(){return{...this.stats}}
|
|
1079
|
+
return{...t,points:n}}getStats(){return{...this.stats}}Ba(){this.stats={pointsRemovedByVisvalingam:0,originalPointCount:0}}}const Ke={distanceTolerance:.5,angleTolerance:.2,Da:0,Na:1e-6,Pa:16},Je=Ke.Na
|
|
1077
1080
|
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
|
|
1079
|
-
this
|
|
1081
|
+
class ri{constructor(t){this.curveSteps=null,this.$a=0,this.Ga=0,this.Ra=0,this.za=0,this.Wa=0,this.ja=0,this.Ua=0,this.Va={...Ke,...t},this.Ha()}qa(t){this.Va={...Ke,...t},this.Ha()}Ha(){const t=this.Va,e=t.distanceTolerance??Ke.distanceTolerance
|
|
1082
|
+
this.$a=e*e,this.Ga=t.angleTolerance??Ke.angleTolerance,this.Ra=this.Ga>0?Math.tan(this.Ga)**2:0,this.za=t.Da??0,this.Wa=this.za>0?Math.tan(this.za)**2:0,this.ja=t.Na??Ke.Na,this.Ua=t.Pa??Ke.Pa}Ya(){Qe=this.$a,ei=this.Ga,ii=this.Ra,si=this.za,ni=this.Wa,Ze=this.ja,ti=this.Ua,Xe=[]}Ka(t){if(null==t)return void(this.curveSteps=null)
|
|
1080
1083
|
if(!Number.isFinite(t))return void(this.curveSteps=null)
|
|
1081
1084
|
const e=Math.round(t)
|
|
1082
|
-
this.curveSteps=1>e?null:e}
|
|
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)}
|
|
1085
|
+
this.curveSteps=1>e?null:e}Ja(t,e,i){return null!==this.curveSteps?this.Xa(t,e,i,this.curveSteps):(this.Ya(),Z(t.x,t.y,e.x,e.y,i.x,i.y,0),Q(i.x,i.y),Xe)}Qa(t,e,i,s){return null!==this.curveSteps?this.Za(t,e,i,s,this.curveSteps):(this.Ya(),((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)
|
|
1086
|
+
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)}Xa(t,e,i,s){this.Ya()
|
|
1084
1087
|
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
|
|
1085
|
-
Q(o+(e.x+(i.x-e.x)*r-o)*r,h+(e.y+(i.y-e.y)*r-h)*r)}return Xe}
|
|
1088
|
+
Q(o+(e.x+(i.x-e.x)*r-o)*r,h+(e.y+(i.y-e.y)*r-h)*r)}return Xe}Za(t,e,i,s,n){this.Ya()
|
|
1086
1089
|
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
|
|
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.
|
|
1090
|
+
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.tl=0,this.el=0,this.il=[],this.sl=null,this.nl=null,this.rl={min:new Ht(1/0,1/0),max:new Ht(-1/0,-1/0)},this.ol=[],this.hl=[],this.al=[],this.ll=new Ht(0,0),this.cl=new ri(t),this.ul=new Ye({...Ge,...e})}setPosition(t,e){this.ll.set(t,e)}fl(t,e){this.ll.x+=t,this.ll.y+=e}dl(t,e){this.il.length>0&&this.yl(),this.tl=t,this.el=e,this.il=[],this.rl.min.set(1/0,1/0),this.rl.max.set(-1/0,-1/0),this.hl.push(this.ll.clone())}yl(){this.sl&&this.pl(),this.il.length>0&&(this.ol.push({wl:this.tl,gl:this.il,bounds:{min:{x:this.rl.min.x,y:this.rl.min.y},max:{x:this.rl.max.x,y:this.rl.max.y}}}),this.al.push(this.el)),this.il=[]}ml(t,e){this.sl&&this.pl(),this.nl=new Ht(t,e),this.vl(this.nl),this.sl={points:[this.nl],glyphIndex:this.tl}}xl(t,e){if(!this.sl||!this.nl)return
|
|
1088
1091
|
const i=new Ht(t,e)
|
|
1089
|
-
this.
|
|
1090
|
-
const n=this.
|
|
1091
|
-
if(
|
|
1092
|
-
const h=this.
|
|
1092
|
+
this.vl(i),this.sl.points.push(i),this.nl=i}Al(t,e,i,s){if(!this.sl||!this.nl)return
|
|
1093
|
+
const n=this.nl,r=new Ht(t,e),o=new Ht(i,s)
|
|
1094
|
+
if(Je>Math.abs((r.x-o.x)*(o.y-n.y)-(r.y-o.y)*(o.x-n.x)))return void this.xl(i,s)
|
|
1095
|
+
const h=this.cl.Ja(n,r,o)
|
|
1093
1096
|
for(let t=0;h.length>t;t++){const e=h[t]
|
|
1094
|
-
this.
|
|
1095
|
-
const o=this.
|
|
1096
|
-
if(
|
|
1097
|
-
const f=this.
|
|
1097
|
+
this.vl(e),this.sl.points.push(e)}this.nl=o}bl(t,e,i,s,n,r){if(!this.sl||!this.nl)return
|
|
1098
|
+
const o=this.nl,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
|
|
1099
|
+
if(Je>Math.abs((h.x-l.x)*u-(h.y-l.y)*c)&&Je>Math.abs((a.x-l.x)*u-(a.y-l.y)*c))return void this.xl(n,r)
|
|
1100
|
+
const f=this.cl.Qa(o,h,a,l)
|
|
1098
1101
|
for(let t=0;f.length>t;t++){const e=f[t]
|
|
1099
|
-
this.
|
|
1100
|
-
const t=this.
|
|
1101
|
-
this.
|
|
1102
|
-
this.
|
|
1103
|
-
if(this.
|
|
1102
|
+
this.vl(e),this.sl.points.push(e)}this.nl=l}El(){if(!this.sl||!this.nl)return
|
|
1103
|
+
const t=this.sl.points[0]
|
|
1104
|
+
this.nl.equals(t)||this.sl.points.push(t),this.pl()}pl(){if(this.sl){const t=this.ul.La(this.sl)
|
|
1105
|
+
this.il.push(t),this.sl=null,this.nl=null}}vl(t){this.rl.min.x=Math.min(this.rl.min.x,t.x),this.rl.min.y=Math.min(this.rl.min.y,t.y),this.rl.max.x=Math.max(this.rl.max.x,t.x),this.rl.max.y=Math.max(this.rl.max.y,t.y)}Tl(){return this.il.length>0&&this.yl(),this.ol}Il(){return this.hl}Fl(){return this.al}reset(){this.ol=[],this.hl=[],this.al=[],this.il=[],this.sl=null,this.nl=null,this.tl=0,this.el=0,this.ll.set(0,0),this.rl={min:new Ht(1/0,1/0),max:new Ht(-1/0,-1/0)}}qa(t){this.cl.qa(t)}Ka(t){this.cl.Ka(t)}Sl(t){this.ul.ka({...Ge,...t})}Ml(){return this.ul.getStats()}}class hi{constructor(){this._l=null,this.Ol=null,this.Cl=null,this.kl=null,this.Ll=null,this.Bl=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.Dl&&this.Dl.setPosition(t,e)}fl(t,e){this.position.x+=t,this.position.y+=e,this.Dl&&this.Dl.fl(t,e)}Nl(t){this.Dl=t}Pl(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
|
|
1106
|
+
if(this.Dl=e,this.Bl)return
|
|
1104
1107
|
const i=t.module
|
|
1105
|
-
this.
|
|
1106
|
-
return this.
|
|
1108
|
+
this._l=i.Bs((t,e,i,s,n)=>{this.Dl?.ml(s,n)},"viiiffi"),this.Ol=i.Bs((t,e,i,s,n)=>{this.Dl?.xl(s,n)},"viiiffi"),this.Cl=i.Bs((t,e,i,s,n,r,o)=>{this.Dl?.Al(s,n,r,o)},"viiiffffi"),this.kl=i.Bs((t,e,i,s,n,r,o,h,a)=>{this.Dl?.bl(s,n,r,o,h,a)},"viiiffffffi"),this.Ll=i.Bs(()=>{this.Dl?.El()},"viiii"),this.Bl=i.exports.nr(),i.exports.Yn(this.Bl,this._l,0,0),i.exports.Jn(this.Bl,this.Ol,0,0),i.exports.Qn(this.Bl,this.Cl,0,0),i.exports.tr(this.Bl,this.kl,0,0),i.exports.ir(this.Bl,this.Ll,0,0)}$l(){if(!this.Bl)throw Error("Draw functions not initialized")
|
|
1109
|
+
return this.Bl}destroy(t){if(!t||!t.module||!t.hb)return
|
|
1107
1110
|
const e=t.module
|
|
1108
|
-
try{this.
|
|
1109
|
-
class li{constructor(t,e){this.
|
|
1111
|
+
try{this.Bl&&(e.exports.hr(this.Bl),this.Bl=0),null!==this._l&&(e.Ds(this._l),this._l=null),null!==this.Ol&&(e.Ds(this.Ol),this.Ol=null),null!==this.Cl&&(e.Ds(this.Cl),this.Cl=null),null!==this.kl&&(e.Ds(this.kl),this.kl=null),null!==this.Ll&&(e.Ds(this.Ll),this.Ll=null)}catch(t){nt.warn("Error destroying draw callbacks:",t)}this.Dl=void 0}}const ai=new WeakMap
|
|
1112
|
+
class li{constructor(t,e){this.uh="default",this.Gl="default",this.Rl=new Set,this.zl=[],this.Wl=[],this.jl=[],this.cache=t,this.oi=e,this.tessellator=new Ne,this.Ul=new Pe,this.Vl=new $e,this.Dl=new oi,this.Hl=et(this.oi),this.Hl.Pl(this.oi,this.Dl),this.ql=ae,this.Yl=le,this.Kl=ce}Ml(){return this.Dl.Ml()}qa(t){this.Va=t,this.Dl.qa(t),this.Jl()}Ka(t){if(null==t)this.curveSteps=void 0
|
|
1110
1113
|
else if(Number.isFinite(t)){const e=Math.round(t)
|
|
1111
1114
|
this.curveSteps=1>e?void 0:e}else this.curveSteps=void 0
|
|
1112
|
-
this.
|
|
1113
|
-
const t=this
|
|
1114
|
-
return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.
|
|
1115
|
-
for(let i=0;t.length>i;i++)e+=t[i].length}const a=this.
|
|
1115
|
+
this.Dl.Ka(this.curveSteps),this.Jl()}Sl(t){this.Xl=t,this.Dl.Sl(t),this.Jl()}Ql(t){this.uh=t,this.Jl()}Jl(){this.Gl=`${this.uh}__${this.Zl()}`}Zl(){return[(()=>{if(void 0!==this.curveSteps)return"cf:steps:"+this.curveSteps
|
|
1116
|
+
const t=this.Va?.distanceTolerance??Ke.distanceTolerance,e=this.Va?.angleTolerance??Ke.angleTolerance
|
|
1117
|
+
return`cf:${t.toFixed(4)},${e.toFixed(4)}`})(),`opt:${this.Xl?.enabled??1?1:0},${(this.Xl?.areaThreshold??1).toFixed(4)}`].join("|")}tc(t,e,i,s,n,r=!1,h){if(st){let e=0
|
|
1118
|
+
for(let i=0;t.length>i;i++)e+=t[i].length}const a=this.jl
|
|
1116
1119
|
a.length=0
|
|
1117
1120
|
let l=0,c=0,u=0,f=0,d=0
|
|
1118
1121
|
const y=(t,e,i,s)=>{const n=d
|
|
1119
1122
|
let r=a[l]
|
|
1120
|
-
return r?(r.data=t,r.px=e,r.
|
|
1123
|
+
return r?(r.data=t,r.px=e,r.ec=i,r.sc=s,r.nc=n):(r={data:t,px:e,ec:i,sc:s,nc: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
1124
|
for(let n=0;t.length>n;n++){const a=t[n]
|
|
1122
1125
|
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.
|
|
1126
|
+
for(const e of t.glyphs)c.push(this.rc(e.g))
|
|
1124
1127
|
let u
|
|
1125
|
-
if(t.glyphs.length>1){const e=`${this.
|
|
1128
|
+
if(t.glyphs.length>1){const e=`${this.Gl}_${t.text}`,i=this.Kl.get(e)
|
|
1126
1129
|
let s=!1
|
|
1127
|
-
if(i&&i.
|
|
1128
|
-
for(let e=0;t.glyphs.length>e;e++){const n=t.glyphs[e],r=i.
|
|
1129
|
-
if(i.
|
|
1130
|
+
if(i&&i.oc.length===t.glyphs.length){s=!0
|
|
1131
|
+
for(let e=0;t.glyphs.length>e;e++){const n=t.glyphs[e],r=i.hc[e]
|
|
1132
|
+
if(i.oc[e]!==n.g||r.x!==(n.x??0)||r.y!==(n.y??0)){s=!1
|
|
1130
1133
|
break}}}if(s&&i)u=i.groups
|
|
1131
1134
|
else{const i=t.glyphs.length
|
|
1132
|
-
if(i>this.
|
|
1133
|
-
this.
|
|
1134
|
-
for(let e=0;i>e;e++){const i=t.glyphs[e],s=this.
|
|
1135
|
-
s.x=i.x??0,s.y=i.y??0,s.z=0}u=this
|
|
1135
|
+
if(i>this.zl.length)for(let t=this.zl.length;i>t;t++)this.zl.push(new qt(0,0,0))
|
|
1136
|
+
this.zl.length=i
|
|
1137
|
+
for(let e=0;i>e;e++){const i=t.glyphs[e],s=this.zl[e]
|
|
1138
|
+
s.x=i.x??0,s.y=i.y??0,s.z=0}u=this.Vl.Ia(c,this.zl),this.Kl.set(e,{oc:t.glyphs.map(t=>t.g),hc:t.glyphs.map(t=>({x:t.x??0,y:t.y??0})),groups:u})}}else u=[[0]]
|
|
1136
1139
|
const f=r
|
|
1137
1140
|
let d=u
|
|
1138
1141
|
if(h&&h.size>0){d=[]
|
|
1139
1142
|
for(const e of u)if(e.length>1){const i=[],s=[]
|
|
1140
1143
|
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.
|
|
1142
|
-
let u=this.
|
|
1143
|
-
if(!u){const i=this.
|
|
1144
|
+
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.ac(o,e,i)
|
|
1145
|
+
let u=this.Yl.get(h)
|
|
1146
|
+
if(!u){const i=this.Wl
|
|
1144
1147
|
let n=0
|
|
1145
1148
|
const a=o[0].x??0,l=o[0].y??0
|
|
1146
1149
|
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.
|
|
1150
|
+
for(const t of o.gl){const e=t.points,s=e.length
|
|
1148
1151
|
if(3>s)continue
|
|
1149
1152
|
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
1153
|
let h=i[n]
|
|
1151
1154
|
!h||o>h.length?(h=Array(o),i[n]=h):h.length=o
|
|
1152
1155
|
let a=0
|
|
1153
1156
|
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.
|
|
1155
|
-
for(let i=0;r.length>i;i++){const s=r[i],o=t.glyphs[s],h=this.
|
|
1156
|
-
p.push(h),this.
|
|
1157
|
-
if(0===u.
|
|
1157
|
+
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.lc(i,e,s),this.Yl.set(h,u)}const f=o[0],d=y(u,n+(f.x??0),a+(f.y??0),l),g=u.vertices.length/3
|
|
1158
|
+
for(let i=0;r.length>i;i++){const s=r[i],o=t.glyphs[s],h=this.cc(o,d,g,n+(o.x??0),a+(o.y??0),l,c[s],e)
|
|
1159
|
+
p.push(h),this.uc(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
|
|
1160
|
+
if(0===u.gl.length){const t=this.cc(r,0,0,f,d,g,u,e)
|
|
1158
1161
|
p.push(t)
|
|
1159
|
-
continue}const m=o(this.
|
|
1162
|
+
continue}const m=o(this.Gl,r.g,e,i)
|
|
1160
1163
|
let v=this.cache.get(m)
|
|
1161
|
-
v?v.
|
|
1162
|
-
const x=y(v,f,d,g),A=this.
|
|
1163
|
-
p.push(A),this.
|
|
1164
|
+
v?v.fc++:(v=this.dc(u,e,i,s),this.cache.set(m,v))
|
|
1165
|
+
const x=y(v,f,d,g),A=this.cc(r,x,v.vertices.length/3,f,d,g,u,e)
|
|
1166
|
+
p.push(A),this.uc(A.bounds,w)}}}a.length=l
|
|
1164
1167
|
const g=new Float32Array(c),m=new Float32Array(u),v=new Uint32Array(f)
|
|
1165
1168
|
let x=0,A=0,b=0
|
|
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.
|
|
1169
|
+
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.ec*n,l=e.sc*n,c=i.length
|
|
1167
1170
|
let u=x
|
|
1168
1171
|
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
|
|
1169
1172
|
x=u,m.set(s,A),A+=s.length
|
|
1170
|
-
const f=e.
|
|
1173
|
+
const f=e.nc,d=r.length
|
|
1171
1174
|
let y=b
|
|
1172
1175
|
for(let t=0;d>t;t++)v[y++]=r[t]+f
|
|
1173
1176
|
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
1177
|
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,
|
|
1178
|
+
return{vertices:g,normals:m,indices:v,yc:p,planeBounds:w}}ac(t,e,i){if(0===t.length)return""
|
|
1176
1179
|
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("|")
|
|
1177
|
-
return`${this.
|
|
1178
|
-
const e=`${this.
|
|
1180
|
+
return`${this.Gl}_${o}_${Math.round(1e3*e)/1e3}_${i}`}cc(t,e,i,s,n,r,o,h){return{wc:t.Is,Fs:t.Fs,nc:e,Fh: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}}}}rc(t){if(this.Rl.has(t))return{wl:t,gl:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
1181
|
+
const e=`${this.Gl}_${t}`,i=this.ql.get(e)
|
|
1179
1182
|
if(i)return i
|
|
1180
|
-
this.
|
|
1181
|
-
const s=this.
|
|
1182
|
-
return 0===s.
|
|
1183
|
-
return this.
|
|
1183
|
+
this.Hl.Nl(this.Dl),this.Dl.reset(),this.Dl.dl(t,0),this.oi.module.exports.Ar(this.oi.font.so,t,this.Hl.$l(),0),this.Dl.yl()
|
|
1184
|
+
const s=this.Dl.Tl()[0]||{wl:t,gl:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
|
|
1185
|
+
return 0===s.gl.length&&this.Rl.add(t),this.ql.set(e,s),s}lc(t,e,i){const s=this.tessellator.da(t,!0,i,0!==e)
|
|
1186
|
+
return this.gc(s,e)}gc(t,e){const i=this.Ul.Ta(t,e,this.oi.upem),s=i.vertices
|
|
1184
1187
|
let n=1/0,r=1/0,o=1/0,h=-1/0,a=-1/0,l=-1/0
|
|
1185
1188
|
for(let t=0;s.length>t;t+=3){const e=s[t],i=s[t+1],c=s[t+2]
|
|
1186
1189
|
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},
|
|
1188
|
-
return this.
|
|
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)}
|
|
1190
|
-
e.push(t),this.
|
|
1191
|
-
return t.
|
|
1190
|
+
return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:c,max:u},fc:1}}dc(t,e,i,s){const n=this.tessellator.process(t.gl,i,s,0!==e)
|
|
1191
|
+
return this.gc(n,e)}uc(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
|
|
1192
|
+
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)}mc(){return this.cache.getStats()}clearCache(){this.cache.clear(),this.Yl.clear(),this.Kl.clear(),this.ql.clear()}}class ci{constructor(t,e){this.text=t,this.vc=new Map,e.forEach(t=>{const e=this.vc.get(t.wc)||[]
|
|
1193
|
+
e.push(t),this.vc.set(t.wc,e)})}xc(t){const e=[]
|
|
1194
|
+
return t.Ac&&e.push(...this.bc(t.Ac)),t.Ec&&e.push(...this.Tc(t.Ec)),e}bc(t){const e=[]
|
|
1192
1195
|
for(const i of t){let t=0
|
|
1193
|
-
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}
|
|
1196
|
+
for(;-1!==(t=this.text.indexOf(i,t));)e.push(this.createTextRange(t,t+i.length,i)),t+=i.length}return e}Tc(t){return t.map(t=>{const e=this.text.slice(t.start,t.end)
|
|
1194
1197
|
return this.createTextRange(t.start,t.end,e)})}createTextRange(t,e,i){const s=[],n=new Map
|
|
1195
|
-
for(let i=t;e>i;i++){const t=this.
|
|
1198
|
+
for(let i=t;e>i;i++){const t=this.vc.get(i)
|
|
1196
1199
|
if(t)for(const e of t){s.push(e)
|
|
1197
|
-
const t=n.get(e.
|
|
1198
|
-
t.push(e),n.set(e.
|
|
1200
|
+
const t=n.get(e.Fs)||[]
|
|
1201
|
+
t.push(e),n.set(e.Fs,t)}}return{start:t,end:e,Ic:i,bounds:Array.from(n.values()).map(t=>this.Fc(t)),glyphs:s,Sc:Array.from(n.keys()).sort((t,e)=>t-e)}}Fc(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
1199
1202
|
let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
|
|
1200
1203
|
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)
|
|
1201
|
-
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}exports.DEFAULT_CURVE_FIDELITY=
|
|
1204
|
+
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}exports.DEFAULT_CURVE_FIDELITY=Ke,exports.DrawCallbackHandler=hi,exports.FontMetadataExtractor=Rt,exports.MeshGeometryBuilder=class{constructor(t,e){this.oi=t,this.uh=e}Mc(t,e){this.oi=t,this.uh=e,this._c=void 0}Oc(t,e){try{this._c||(this._c=new li(he,this.oi),this._c.Ql(this.uh))
|
|
1202
1205
|
const i=null!=e.curveSteps&&e.curveSteps>0
|
|
1203
|
-
this.
|
|
1204
|
-
const s=e.
|
|
1206
|
+
this._c.Ka(e.curveSteps),this._c.qa(i?void 0:e.curveFidelity),this._c.Sl(e.geometryOptimization)
|
|
1207
|
+
const s=e.Cc??this.oi.ss??!1
|
|
1205
1208
|
let n,r
|
|
1206
|
-
if(e.color&&"object"==typeof e.color&&!Array.isArray(e.color)&&(e.color.
|
|
1207
|
-
for(const t of Object.keys(e.color.
|
|
1209
|
+
if(e.color&&"object"==typeof e.color&&!Array.isArray(e.color)&&(e.color.Ac||e.color.Ec)){if(n=new Set,e.color.Ac){r=[]
|
|
1210
|
+
for(const t of Object.keys(e.color.Ac)){let i=0
|
|
1208
1211
|
for(;-1!==(i=e.text.indexOf(t,i));){r.push({pattern:t,start:i,end:i+t.length})
|
|
1209
1212
|
for(let e=i;i+t.length>e;e++)n.add(e)
|
|
1210
|
-
i+=t.length}}}if(e.color.
|
|
1211
|
-
if(e.perGlyphAttributes){const t=this.
|
|
1212
|
-
h.glyphAttributes=t}return h}finally{}}getCacheSize(){return this.
|
|
1213
|
-
this.
|
|
1214
|
-
const u=this.
|
|
1213
|
+
i+=t.length}}}if(e.color.Ec)for(const t of e.color.Ec)for(let e=t.start;t.end>e;e++)n.add(e)}const o=this._c.tc(t.oh,t.ah.depth,s,this.oi.rt.bi,t.ah.yh,e.perGlyphAttributes??!1,n),h=this.kc(o.vertices,o.normals,o.indices,o.yc,o.planeBounds,e,e.text,r)
|
|
1214
|
+
if(e.perGlyphAttributes){const t=this.Lc(h.vertices.length/3,h.glyphs)
|
|
1215
|
+
h.glyphAttributes=t}return h}finally{}}getCacheSize(){return this._c?.mc().size??0}clearCache(){this._c?.clearCache()}reset(){this._c=void 0,this.th=void 0}kc(t,e,i,s,n,r,o,h){const{layout:a={}}=r,{width:l,align:c=("rtl"===a.direction?"right":"left")}=a
|
|
1216
|
+
this.th||(this.th=new Tt(this.oi))
|
|
1217
|
+
const u=this.th.ci({width:l,align:c,planeBounds:n}),f=u.offset
|
|
1215
1218
|
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
1219
|
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.
|
|
1218
|
-
d=e.colors,y=e.
|
|
1220
|
+
if(r.color){const e=this.Bc(t,s,r.color,r.text,h)
|
|
1221
|
+
d=e.colors,y=e.Dc}const p=this._c.Ml()
|
|
1219
1222
|
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
1223
|
return e=>{if(!o)throw Error("Original text not available for querying")
|
|
1221
|
-
return t||(t=new ci(o,s)),t.
|
|
1224
|
+
return t||(t=new ci(o,s)),t.xc(e)}})(),Dc:y,glyphAttributes:void 0}}Bc(t,e,i,s,n){const r=t.length/3,o=new Float32Array(3*r),h=[]
|
|
1222
1225
|
if(Array.isArray(i)){for(let t=0;r>t;t++){const e=3*t
|
|
1223
|
-
o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:s.length,
|
|
1226
|
+
o[e]=i[0],o[e+1]=i[1],o[e+2]=i[2]}h.push({start:0,end:s.length,Ic:s,color:i,bounds:[],glyphs:e,Sc:[...new Set(e.map(t=>t.Fs))]})}else{const t=i.default||[1,1,1]
|
|
1224
1227
|
for(let e=0;o.length>e;e+=3)o[e]=t[0],o[e+1]=t[1],o[e+2]=t[2]
|
|
1225
1228
|
let r
|
|
1226
|
-
if(i.
|
|
1227
|
-
for(const t of e){const e=r.get(t.
|
|
1228
|
-
e?e.push(t):r.set(t.
|
|
1229
|
+
if(i.Ac&&n||i.Ec){r=new Map
|
|
1230
|
+
for(const t of e){const e=r.get(t.wc)
|
|
1231
|
+
e?e.push(t):r.set(t.wc,[t])}}if(i.Ac&&n&&r)for(const t of n){const e=i.Ac[t.pattern]
|
|
1229
1232
|
if(!e)continue
|
|
1230
1233
|
const s=[],n=new Map
|
|
1231
1234
|
for(let i=t.start;t.end>i;i++){const t=r.get(i)
|
|
1232
1235
|
if(t)for(const i of t){s.push(i)
|
|
1233
|
-
const t=n.get(i.
|
|
1234
|
-
t?t.push(i):n.set(i.
|
|
1235
|
-
for(let t=0;i.
|
|
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.
|
|
1237
|
-
h.push({start:t.start,end:t.end,
|
|
1236
|
+
const t=n.get(i.Fs)
|
|
1237
|
+
t?t.push(i):n.set(i.Fs,[i])
|
|
1238
|
+
for(let t=0;i.Fh>t;t++){const s=3*(i.nc+t)
|
|
1239
|
+
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.Nc(t))
|
|
1240
|
+
h.push({start:t.start,end:t.end,Ic:t.pattern,color:e,bounds:a,glyphs:s,Sc:Array.from(n.keys()).sort((t,e)=>t-e)})}if(i.Ec&&r)for(const t of i.Ec){const e=[],i=new Map
|
|
1238
1241
|
for(let s=t.start;t.end>s;s++){const n=r.get(s)
|
|
1239
1242
|
if(n)for(const s of n){e.push(s)
|
|
1240
|
-
const n=i.get(s.
|
|
1241
|
-
n?n.push(s):i.set(s.
|
|
1242
|
-
for(let e=0;s.
|
|
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.
|
|
1244
|
-
h.push({start:t.start,end:t.end,
|
|
1243
|
+
const n=i.get(s.Fs)
|
|
1244
|
+
n?n.push(s):i.set(s.Fs,[s])
|
|
1245
|
+
for(let e=0;s.Fh>e;e++){const i=3*(s.nc+e)
|
|
1246
|
+
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.Nc(t))
|
|
1247
|
+
h.push({start:t.start,end:t.end,Ic:s.slice(t.start,t.end),color:t.color,bounds:n,glyphs:e,Sc:Array.from(i.keys()).sort((t,e)=>t-e)})}}return{colors:o,Dc:h}}Nc(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
|
|
1245
1248
|
let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
|
|
1246
1249
|
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)
|
|
1247
|
-
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}
|
|
1250
|
+
return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}Lc(t,e){const i=new Float32Array(3*t),s=new Float32Array(t),n=new Float32Array(t),r=new Float32Array(t),o=new Float32Array(t)
|
|
1248
1251
|
let h=1/0,a=-1/0
|
|
1249
1252
|
for(let t=0;e.length>t;t++){const i=(e[t].bounds.min.x+e[t].bounds.max.x)/2
|
|
1250
1253
|
h>i&&(h=i),i>a&&(a=i)}const l=a-h
|
|
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.
|
|
1252
|
-
if(g>w){s.fill(a,w,g),n.fill(c.
|
|
1254
|
+
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.nc,g=Math.min(w+c.Fh,t)
|
|
1255
|
+
if(g>w){s.fill(a,w,g),n.fill(c.Fs,w,g),r.fill(p,w,g),o.fill(y,w,g)
|
|
1253
1256
|
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
|