three-text 0.2.17 → 0.2.19

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