three-text 0.2.17 → 0.2.18

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.18
3
3
  * Copyright (C) 2025 Countertype LLC
4
4
  *
5
5
  * This program is free software: you can redistribute it and/or modify
@@ -469,14 +469,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
469
469
  var Y=J.exports
470
470
  class K{process(t,e=!0,i=!1,s=!0){if(0===t.length)return{Yi:{vertices:[],indices:[]},Ki:[]}
471
471
  const n=t.filter(t=>t.points.length>=3)
472
- return 0===n.length?{Yi:{vertices:[],indices:[]},Ki:[]}:this.Xi(n,e,i,s)}Xi(t,e,i,s){let n,r
473
- i||e?(n=this.Qi(t),r=n):(r=this.Qi(t,!0),(e||s)&&(n=this.Qi(t)))
474
- let o=s?n??this.Qi(t):[]
475
- if(e){const t=this.Zi(n,"boundary")
472
+ return 0===n.length?{Yi:{vertices:[],indices:[]},Ki:[]}:this.Xi(n,e,i,s)}Xi(t,e,i,s){const n=!i&&!e
473
+ let r,o
474
+ n?(o=this.Qi(t,!0),(e||s)&&(r=this.Qi(t))):(r=this.Qi(t),o=r)
475
+ let h=s?n?o:r??this.Qi(t):[]
476
+ if(e){const t=this.Zi(r,"boundary")
476
477
  if(!t)return l.warn("libtess returned empty result from boundary pass"),{Yi:{vertices:[],indices:[]},Ki:[]}
477
- r=this.ts(t),s&&(o=r)}else if(s&&!i&&this.es(o)){const t=this.Zi(o,"boundary")
478
- t&&(o=this.ts(t))}const h=this.Zi(r,"triangles")
479
- 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)
478
+ o=this.ts(t),s&&(h=o)}const a=this.Zi(o,"triangles")
479
+ 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)
480
480
  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))
481
481
  let a=0
482
482
  if(e)for(let t=o-1;t>=0;t--){const e=n[t]
@@ -489,11 +489,11 @@ let o=[]
489
489
  return s.push(t[0],t[1]),e}),i.zi(Y.Ni.GLU_TESS_ERROR,t=>{l.warn("libtess error: "+t)}),i.ji(0,0,1),i.Hi(null)
490
490
  for(const e of t){i.Vi()
491
491
  for(let t=0;e.length>t;t+=2){const n=s.length/2
492
- s.push(e[t],e[t+1]),i.Wi([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[]
492
+ s.push(e[t],e[t+1]),i.Wi([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[]
493
493
  const e=[]
494
- for(const i of t.ss){const s=[]
494
+ for(const i of t.es){const s=[]
495
495
  for(const e of i){const i=2*e
496
- 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
496
+ 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
497
497
  if(1===t.length)return!1
498
498
  let e=null
499
499
  for(const i of t){const t=0>this.ns(i)?-1:1
@@ -502,210 +502,218 @@ else if(t!==e)return!0}return!1}ns(t){let e=0
502
502
  const i=t.length
503
503
  if(6>i)return 0
504
504
  for(let s=0;i>s;s+=2)e+=t[s]*t[(s+3)%i]-t[(s+2)%i]*t[s+1]
505
- return e/2}}class X{constructor(){}rs(t,e=0,i){const s=t.Yi.vertices,n=t.Yi.indices,r=s.length/2
506
- let o=0
507
- if(0!==e)for(const e of t.Ki){const t=e.length/2
508
- 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)
505
+ 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
506
+ let o=[]
507
+ if(0!==e){const t=new Map,e=new Map
508
+ 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
509
+ t.set(h,a),1===a&&e.set(h,[s,r])
510
+ const c=this.rs(r,o),l=(t.get(c)??0)+1
511
+ t.set(c,l),1===l&&e.set(c,[r,o])
512
+ const u=this.rs(o,s),f=(t.get(u)??0)+1
513
+ t.set(u,f),1===f&&e.set(u,[o,s])}o=[]
514
+ for(const[i,s]of t){if(1!==s)continue
515
+ const t=e.get(i)
516
+ 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)
509
517
  if(0===e){let t=0
510
- 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
511
- for(let t=0;n.length>t;t++)l[t]=n[t]
512
- return{vertices:a,normals:c,indices:l}}const u=25e-6*i,f=e>u?e:u
518
+ 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
519
+ for(let t=0;n.length>t;t++)u[t]=n[t]
520
+ return{vertices:c,normals:l,indices:u}}const f=25e-6*i,d=e>f?e:f
513
521
  for(let t=0,e=0;s.length>t;t+=2,e++){const i=s[t],n=s[t+1],o=3*e
514
- a[o]=i,a[o+1]=n,a[o+2]=0,c[o]=0,c[o+1]=0,c[o+2]=-1
522
+ c[o]=i,c[o+1]=n,c[o+2]=0,l[o]=0,l[o+1]=0,l[o+2]=-1
515
523
  const h=3*(r+e)
516
- 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]
517
- for(let t=0;n.length>t;t++)l[n.length+t]=n[t]+r
518
- let d=2*r,y=2*n.length
519
- 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
520
- let p=0,w=0
521
- if(u>0){const t=1/Math.sqrt(u)
522
- p=h*t,w=-o*t}const m=d,v=3*m
523
- a[v]=i,a[v+1]=s,a[v+2]=0,a[v+3]=n,a[v+4]=r,a[v+5]=0,a[v+6]=i,a[v+7]=s,a[v+8]=f,a[v+9]=n,a[v+10]=r,a[v+11]=f,c[v]=p,c[v+1]=w,c[v+2]=0,c[v+3]=p,c[v+4]=w,c[v+5]=0,c[v+6]=p,c[v+7]=w,c[v+8]=0,c[v+9]=p,c[v+10]=w,c[v+11]=0,l[y++]=m,l[y++]=m+1,l[y++]=m+2,l[y++]=m+1,l[y++]=m+3,l[y++]=m+2,d+=4}return{vertices:a,normals:c,indices:l}}}class Q{constructor(){}hs(t,e){const i=t.length
524
- 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)
524
+ 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]
525
+ for(let t=0;n.length>t;t++)u[n.length+t]=n[t]+r
526
+ let y=2*r,p=2*n.length
527
+ 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],m=f-h,v=w-a,g=m*m+v*v
528
+ let x=0,S=0
529
+ if(g>0){const t=1/Math.sqrt(g)
530
+ x=v*t,S=-m*t}const b=y,_=3*b
531
+ 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]=S,l[_+2]=0,l[_+3]=x,l[_+4]=S,l[_+5]=0,l[_+6]=x,l[_+7]=S,l[_+8]=0,l[_+9]=x,l[_+10]=S,l[_+11]=0,u[p++]=b,u[p++]=b+1,u[p++]=b+2,u[p++]=b+1,u[p++]=b+3,u[p++]=b+2,y+=4}return{vertices:c,normals:l,indices:u}}}class Q{constructor(){}cs(t,e){const i=t.length
532
+ 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)
525
533
  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)
526
534
  let h=0
527
- 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]
535
+ 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]
528
536
  o.sort((t,e)=>t[0]-e[0]||t[1]-e[1])
529
537
  const a=Array.from({length:n},(t,e)=>e),c=Array(n).fill(0),l=new Set
530
538
  for(const[,t,e]of o)if(0===t){const t=r[e]
531
539
  for(const i of l){const n=r[i]
532
- n.ds+.001>t.ys&&t.ds>n.ys-.001&&s(e,i)}l.add(e)}else l.delete(e)
540
+ n.ys+.001>t.ps&&t.ys>n.ps-.001&&s(e,i)}l.add(e)}else l.delete(e)
533
541
  const u=new Map
534
542
  for(let t=0;n>t;t++){const e=i(t)
535
543
  let s=u.get(e)
536
- 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)
537
- if(void 0!==e)return this.vs(e),void this.gs(e)
538
- const i=this.ps.length
539
- this.ps.push(t),this.ws.set(t,i),this.vs(i)}xs(){const t=this.ps.length
544
+ 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)
545
+ if(void 0!==e)return this.gs(e),void this.xs(e)
546
+ const i=this.ws.length
547
+ this.ws.push(t),this.vs.set(t,i),this.gs(i)}Ss(){const t=this.ws.length
540
548
  if(!t)return
541
- if(1===t){const t=this.ps.pop()
542
- return this.ws.clear(),t}const e=this.ps[0],i=this.ps.pop()
543
- 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)
544
- void 0!==e?(this.vs(e),this.gs(e)):this.k(t)}Ss(){return!this.ps.length}bs(t,e){const i=this.ps[t],s=this.ps[e]
545
- 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]
546
- for(;t>0;){const i=t-1>>1,s=this.ps[i]
549
+ if(1===t){const t=this.ws.pop()
550
+ return this.vs.clear(),t}const e=this.ws[0],i=this.ws.pop()
551
+ 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)
552
+ void 0!==e?(this.gs(e),this.xs(e)):this.k(t)}bs(){return!this.ws.length}_s(t,e){const i=this.ws[t],s=this.ws[e]
553
+ 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]
554
+ for(;t>0;){const i=t-1>>1,s=this.ws[i]
547
555
  if(this.compare(e,s)>=0)break
548
- 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
556
+ 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
549
557
  for(;s>t;){const s=1+(t<<1),n=s+1
550
558
  let r=t,o=e
551
- const h=this.ps[s]
552
- if(0>this.compare(h,o)&&(r=s,o=h),i>n){const t=this.ps[n]
559
+ const h=this.ws[s]
560
+ if(0>this.compare(h,o)&&(r=s,o=h),i>n){const t=this.ws[n]
553
561
  0>this.compare(t,o)&&(r=n,o=t)}if(r===t)break
554
- 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}
555
- 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
556
- this.stats.Ms+=t.points.length
562
+ 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}
563
+ class et{constructor(t){this.stats={Ls:0,Ms:0,Is:0},this.config=t}Gs(t){this.config=t}Os(t){if(!this.config.enabled||2>=t.points.length)return t
564
+ this.stats.Is+=t.points.length
557
565
  const e=t.points
558
566
  if(5>e.length)return t
559
- let i=this.Os(e,this.config._s)
560
- 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
561
- const i=t.length,s=t.map((t,e)=>({index:e,ks:1/0,pi:null,next:null}))
567
+ let i=this.Fs(e,this.config.Es)
568
+ 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
569
+ const i=t.length,s=t.map((t,e)=>({index:e,Cs:1/0,pi:null,next:null}))
562
570
  for(let t=0;s.length>t;t++)s[t].pi=s[t-1]||null,s[t].next=s[t+1]||null
563
- const n=new Z((t,e)=>t.ks-e.ks)
571
+ const n=new Z((t,e)=>t.Cs-e.Cs)
564
572
  for(let e=1;s.length-1>e;e++){const i=s[e]
565
- i.ks=this.Cs(t[i.pi.index],t[i.index],t[i.next.index]),n.k(i)}let r=i
566
- for(;!n.Ss()&&r>3;){const i=n.xs()
567
- if(!i||i.ks>e)break
568
- 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)
569
- 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=[]
573
+ i.Cs=this.Bs(t[i.pi.index],t[i.index],t[i.next.index]),n.k(i)}let r=i
574
+ for(;!n.bs()&&r>3;){const i=n.Ss()
575
+ if(!i||i.Cs>e)break
576
+ 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)
577
+ 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=[]
570
578
  let h=s[0]
571
579
  for(;h;)o.push(t[h.index]),h=h.next
572
- return this.stats.As+=i-o.length,o}Fs(t,e){if(2>=t.length)return t
580
+ return this.stats.Ls+=i-o.length,o}ks(t,e){if(2>=t.length)return t
573
581
  const i=[t[0]]
574
- 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
575
- 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
576
- class nt{constructor(t){this.Ns={...it,...t}}Ds(t){this.Ns={...it,...t}}Ps(t,e,i){const s=[]
577
- return this.Rs(t.x,t.y,e.x,e.y,i.x,i.y,s),this.js(i.x,i.y,s),s}zs(t,e,i,s){const n=[]
578
- return this.Ws(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y,n),this.js(s.x,s.y,n),n}Rs(t,e,i,s,n,r,o,h=0){if(h>16)return
579
- 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),m=this.Ns.Us??it.Us,v=m*m
580
- if(w>st){if(v*(y*y+p*p)>=w*w){const h=this.Ns.$s??it.$s
581
- if(0>=h)return void this.js(i,s,o)
582
+ 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
583
+ Math.abs(Math.atan2(h*l-a*c,h*c+a*l))>e||u>h*h+a*a||u>c*c+l*l?i.push(r):this.stats.Ms++}return i.push(t[t.length-1]),i}Bs(t,e,i){return Math.abs((t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y))/2)}getStats(){return{...this.stats}}Us(){this.stats={Ls:0,Ms:0,Is:0}}}const it={$s:.5,Ns:.2},st=1e-6
584
+ class nt{constructor(t){this.Ds={...it,...t}}Ps(t){this.Ds={...it,...t}}Rs(t,e,i){const s=[]
585
+ return this.js(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=[]
586
+ return this.Hs(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}js(t,e,i,s,n,r,o,h=0){if(h>16)return
587
+ 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),m=this.Ds.$s??it.$s,v=m*m
588
+ if(w>st){if(v*(y*y+p*p)>=w*w){const h=this.Ds.Ns??it.Ns
589
+ if(0>=h)return void this.zs(i,s,o)
582
590
  {const a=i-t,c=s-e,l=n-i,u=r-s
583
- if(h>Math.abs(Math.atan2(a*u-c*l,a*l+c*u)))return void this.js(i,s,o)}}}else{const n=y*y+p*p
584
- if(0===n){if(v>=(i-t)*(i-t)+(s-e)*(s-e))return void this.js(i,s,o)}else{const r=((i-t)*y+(s-e)*p)/n
585
- if(r>0&&1>r&&v*n>=w*w)return void this.js(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)}Ws(t,e,i,s,n,r,o,h,a,c=0){if(c>16)return
586
- 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,m=(u+d)/2,v=(f+y)/2,g=(d+p)/2,x=(w+v)/2,S=(m+g)/2,b=o-t,_=h-e,E=Math.abs((i-o)*_-(s-h)*b),T=Math.abs((n-o)*_-(r-h)*b),A=this.Ns.Us??it.Us,L=A*A
591
+ 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
592
+ if(0===n){if(v>=(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
593
+ if(r>0&&1>r&&v*n>=w*w)return void this.zs(i,s,o)}}this.js(t,e,a,c,f,d,o,h+1),this.js(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
594
+ 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,m=(u+d)/2,v=(f+y)/2,g=(d+p)/2,x=(w+v)/2,S=(m+g)/2,b=o-t,_=h-e,E=Math.abs((i-o)*_-(s-h)*b),T=Math.abs((n-o)*_-(r-h)*b),A=this.Ds.$s??it.$s,L=A*A
587
595
  let M=0
588
596
  switch(E>st&&(M|=1),T>st&&(M|=2),M){case 0:const c=b*b+_*_
589
- if(0===c){if(L>=(i-t)*(i-t)+(s-e)*(s-e)&&L>=(n-t)*(n-t)+(r-e)*(r-e))return this.js(i,s,a),void this.js(n,r,a)}else{const o=((i-t)*b+(s-e)*_)/c,h=((n-t)*b+(r-e)*_)/c
590
- if(o>0&&1>o&&h>0&&1>h&&L*c>=(E+T)*(E+T))return this.js(i,s,a),void this.js(n,r,a)}break
591
- case 1:if(L*(b*b+_*_)>=T*T){const t=this.Ns.$s??it.$s
592
- if(0>=t)return this.js(i,s,a),void this.js(n,r,a)
597
+ 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)*b+(s-e)*_)/c,h=((n-t)*b+(r-e)*_)/c
598
+ 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
599
+ case 1:if(L*(b*b+_*_)>=T*T){const t=this.Ds.Ns??it.Ns
600
+ if(0>=t)return this.zs(i,s,a),void this.zs(n,r,a)
593
601
  {const e=n-i,c=r-s,l=o-n,u=h-r
594
- if(t>Math.abs(Math.atan2(e*u-c*l,e*l+c*u)))return this.js(i,s,a),void this.js(n,r,a)}}break
595
- case 2:if(L*(b*b+_*_)>=E*E){const o=this.Ns.$s??it.$s
596
- if(0>=o)return this.js(i,s,a),void this.js(n,r,a)
602
+ 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
603
+ case 2:if(L*(b*b+_*_)>=E*E){const o=this.Ds.Ns??it.Ns
604
+ if(0>=o)return this.zs(i,s,a),void this.zs(n,r,a)
597
605
  {const h=i-t,c=s-e,l=n-i,u=r-s
598
- if(o>Math.abs(Math.atan2(h*u-c*l,h*l+c*u)))return this.js(i,s,a),void this.js(n,r,a)}}break
599
- case 3:if(L*(b*b+_*_)>=(E+T)*(E+T)){const c=this.Ns.$s??it.$s
600
- if(0>=c)return this.js(i,s,a),void this.js(n,r,a)
606
+ 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
607
+ case 3:if(L*(b*b+_*_)>=(E+T)*(E+T)){const c=this.Ds.Ns??it.Ns
608
+ if(0>=c)return this.zs(i,s,a),void this.zs(n,r,a)
601
609
  {const l=i-t,u=s-e,f=n-i,d=r-s,y=o-n,p=h-r
602
- 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.js(i,s,a),void this.js(n,r,a)}}}this.Ws(t,e,l,u,w,m,x,S,a,c+1),this.Ws(x,S,v,g,y,p,o,h,a,c+1)}js(t,e,i){const s=new P(t,e)
610
+ 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.Hs(t,e,l,u,w,m,x,S,a,c+1),this.Hs(x,S,v,g,y,p,o,h,a,c+1)}zs(t,e,i){const s=new P(t,e)
603
611
  if(0===i.length)return void i.push(s)
604
612
  const n=i[i.length-1],r=s.x-n.x,o=s.y-n.y
605
- 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,bi: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
613
+ 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,bi:this.Js,bounds:{min:{x:this.Xs.min.x,y:this.Xs.min.y},max:{x:this.Xs.max.x,y:this.Xs.max.y}}}),this.tn.push(this.qs)),this.Js=[]}un(t,e){this.Ys&&this.cn(),this.Ks=new P(t,e),this.fn(this.Ks),this.Ys={points:[this.Ks],dn:this.Vs}}yn(t,e){if(!this.Ys||!this.Ks)return
606
614
  const i=new P(t,e)
607
- this.un(i),this.Js.points.push(i),this.Ys=i}yn(t,e,i,s){if(!this.Js||!this.Ys)return
608
- const n=this.Ys,r=new P(t,e),o=new P(i,s)
609
- 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)
610
- const h=this.en.Ps(n,r,o)
615
+ this.fn(i),this.Ys.points.push(i),this.Ks=i}pn(t,e,i,s){if(!this.Ys||!this.Ks)return
616
+ const n=this.Ks,r=new P(t,e),o=new P(i,s)
617
+ 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)
618
+ const h=this.sn.Rs(n,r,o)
611
619
  for(let t=0;h.length>t;t++){const e=h[t]
612
- this.un(e),this.Js.points.push(e)}this.Ys=o}pn(t,e,i,s,n,r){if(!this.Js||!this.Ys)return
613
- 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
614
- 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)
615
- const f=this.en.zs(o,h,a,c)
620
+ this.fn(e),this.Ys.points.push(e)}this.Ks=o}wn(t,e,i,s,n,r){if(!this.Ys||!this.Ks)return
621
+ 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
622
+ 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)
623
+ const f=this.sn.Ws(o,h,a,c)
616
624
  for(let t=0;f.length>t;t++){const e=f[t]
617
- this.un(e),this.Js.points.push(e)}this.Ys=c}wn(){if(!this.Js||!this.Ys)return
618
- const t=this.Js.points[0]
619
- this.Ys.equals(t)||this.Js.points.push(t),this.an()}an(){if(this.Js){const t=this.sn.Gs(this.Js)
620
- 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)}mn(){return this.qs.length>0&&this.hn(),this.Xs}vn(){return this.Qs}gn(){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})}Sn(){return this.sn.getStats()}}class ot{constructor(){this.bn=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")
621
- if(this.Mn=e,this.Ln)return
625
+ this.fn(e),this.Ys.points.push(e)}this.Ks=c}mn(){if(!this.Ys||!this.Ks)return
626
+ const t=this.Ys.points[0]
627
+ this.Ks.equals(t)||this.Ys.points.push(t),this.cn()}cn(){if(this.Ys){const t=this.nn.Os(this.Ys)
628
+ 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)}vn(){return this.Js.length>0&&this.an(),this.Qs}gn(){return this.Zs}xn(){return this.tn}reset(){this.Qs=[],this.Zs=[],this.tn=[],this.Js=[],this.Ys=null,this.Ks=null,this.Vs=0,this.qs=0,this.en.set(0,0),this.Xs={min:new P(1/0,1/0),max:new P(-1/0,-1/0)}}Ps(t){this.sn.Ps(t)}Sn(t){this.nn.Gs({...tt,...t})}bn(){return this.nn.getStats()}}class ot{constructor(){this._n=null,this.En=null,this.Tn=null,this.An=null,this.Ln=null,this.Mn=0,this.position={x:0,y:0}}setPosition(t,e){this.position.x=t,this.position.y=e,this.In&&this.In.setPosition(t,e)}rn(t,e){this.position.x+=t,this.position.y+=e,this.In&&this.In.rn(t,e)}Gn(t){this.In=t}On(t,e){if(!t||!t.module||!t.hb)throw Error("Invalid font object")
629
+ if(this.In=e,this.Mn)return
622
630
  const i=t.module
623
- this.bn=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.bn,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")
624
- return this.Ln}destroy(t){if(!t||!t.module||!t.hb)return
631
+ 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.Ln=i.Fn(()=>{this.In?.mn()},"viiii"),this.Mn=i.exports.kn(),i.exports.Cn(this.Mn,this._n,0,0),i.exports.Bn(this.Mn,this.En,0,0),i.exports.Un(this.Mn,this.Tn,0,0),i.exports.$n(this.Mn,this.An,0,0),i.exports.Nn(this.Mn,this.Ln,0,0)}Dn(){if(!this.Mn)throw Error("Draw functions not initialized")
632
+ return this.Mn}destroy(t){if(!t||!t.module||!t.hb)return
625
633
  const e=t.module
626
- try{this.Ln&&(e.exports.Dn(this.Ln),this.Ln=0),null!==this.bn&&(e.Pn(this.bn),this.bn=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
627
- class at{constructor(t,e){this.Rn="default",this.jn="default",this.zn=new Set,this.cache=t,this.le=e,this.tessellator=new K,this.Wn=new X,this.Hn=new Q,this.Mn=new rt,this.Vn=(()=>{const t=this.le.module,e=ht.get(t)
634
+ try{this.Mn&&(e.exports.Pn(this.Mn),this.Mn=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.Ln&&(e.Rn(this.Ln),this.Ln=null)}catch(t){l.warn("Error destroying draw callbacks:",t)}this.In=void 0}}const ht=new WeakMap
635
+ class at{constructor(t,e){this.jn="default",this.zn="default",this.Wn=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)
628
636
  if(e)return e
629
637
  const i=new ot
630
- return ht.set(t,i),i})(),this.Vn.Gn(this.le,this.Mn),this.qn=W,this.Jn=H,this.Yn=V}Sn(){return this.Mn.Sn()}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.jn=`${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
631
- 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,n,r=!1,o){if(c){let e=0
638
+ return ht.set(t,i),i})(),this.qn.On(this.le,this.In),this.Jn=W,this.Yn=H,this.Kn=V}bn(){return this.In.bn()}Ps(t){this.Ds=t,this.In.Ps(t),this.Xn()}Sn(t){this.Qn=t,this.In.Sn(t),this.Xn()}Zn(t){this.jn=t,this.Xn()}Xn(){this.zn=`${this.jn}__${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
639
+ return[`cf:${t.toFixed(4)},${e.toFixed(4)}`,`opt:${i?1:0},${s.toFixed(4)},${n.toFixed(6)},${r.toFixed(4)}`].join("|")}er(t,e,i,n,r=!1,o){if(c){let e=0
632
640
  for(let i=0;t.length>i;i++)e+=t[i].length}const h=[]
633
641
  let a=0,l=0,u=0,f=0
634
642
  const d=(t,e,i,s)=>{const n=f
635
- 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}}
643
+ 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}}
636
644
  for(let h=0;t.length>h;h++){const a=t[h]
637
645
  for(const t of a){const h=t.position.x,a=t.position.y,c=t.position.z,l=[]
638
- for(const e of t.glyphs)l.push(this.nr(e.g))
646
+ for(const e of t.glyphs)l.push(this.rr(e.g))
639
647
  let u
640
- if(t.glyphs.length>1){const e=`${this.jn}_${t.text}`,i=this.Yn.get(e)
648
+ if(t.glyphs.length>1){const e=`${this.zn}_${t.text}`,i=this.Kn.get(e)
641
649
  let s=!1
642
- if(i&&i.rr.length===t.glyphs.length){s=!0
643
- for(let e=0;t.glyphs.length>e;e++)if(i.rr[e]!==t.glyphs[e].g){s=!1
650
+ if(i&&i.hr.length===t.glyphs.length){s=!0
651
+ for(let e=0;t.glyphs.length>e;e++)if(i.hr[e]!==t.glyphs[e].g){s=!1
644
652
  break}}if(s&&i)u=i.groups
645
653
  else{const i=t.glyphs.map(t=>new R(t.x??0,t.y??0,0))
646
- u=this.Hn.hs(l,i),this.Yn.set(e,{rr:t.glyphs.map(t=>t.g),groups:u})}}else u=[[0]]
647
- const f=o&&t.glyphs.some(t=>o.has(t.hr)),w=r||f
648
- for(const r of u)if(r.length>1&&!w){const s=r.map(e=>t.glyphs[e]),o=this.ar(s,e,i)
649
- let u=this.Jn.get(o)
654
+ u=this.Vn.cs(l,i),this.Kn.set(e,{hr:t.glyphs.map(t=>t.g),groups:u})}}else u=[[0]]
655
+ const f=o&&t.glyphs.some(t=>o.has(t.ar)),w=r||f
656
+ for(const r of u)if(r.length>1&&!w){const s=r.map(e=>t.glyphs[e]),o=this.cr(s,e,i)
657
+ let u=this.Yn.get(o)
650
658
  if(!u){const i=[],h=s[0].x??0,a=s[0].y??0
651
659
  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
652
- for(const t of n.bi)i.push({...t,points:t.points.map(t=>new P(t.x+c,t.y+u))})}u=this.cr(i,e,n),this.Jn.set(o,u)}const f=s[0],w=d(u,h+(f.x??0),a+(f.y??0),c),m=u.vertices.length/3
653
- for(let i=0;r.length>i;i++){const s=r[i],n=t.glyphs[s],o=this.lr(n,w,m,h+(n.x??0),a+(n.y??0),c,l[s],e)
654
- 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),m=c
655
- if(0===u.bi.length){const t=this.lr(r,0,0,f,w,m,u,e)
660
+ for(const t of n.bi)i.push({...t,points:t.points.map(t=>new P(t.x+c,t.y+u))})}u=this.lr(i,e,n),this.Yn.set(o,u)}const f=s[0],w=d(u,h+(f.x??0),a+(f.y??0),c),m=u.vertices.length/3
661
+ for(let i=0;r.length>i;i++){const s=r[i],n=t.glyphs[s],o=this.ur(n,w,m,h+(n.x??0),a+(n.y??0),c,l[s],e)
662
+ 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),m=c
663
+ if(0===u.bi.length){const t=this.ur(r,0,0,f,w,m,u,e)
656
664
  y.push(t)
657
- continue}const v=s(this.jn,r.g,e,i)
665
+ continue}const v=s(this.zn,r.g,e,i)
658
666
  let g=this.cache.get(v)
659
- g?g.dr++:(g=this.yr(u,e,i,n),this.cache.set(v,g))
660
- const x=d(g,f,w,m),S=this.lr(r,x,g.vertices.length/3,f,w,m,u,e)
661
- y.push(S),this.ur(S.bounds,p)}}}const w=new Float32Array(a),m=new Float32Array(l),v=new Uint32Array(u)
667
+ g?g.yr++:(g=this.pr(u,e,i,n),this.cache.set(v,g))
668
+ const x=d(g,f,w,m),S=this.ur(r,x,g.vertices.length/3,f,w,m,u,e)
669
+ y.push(S),this.dr(S.bounds,p)}}}const w=new Float32Array(a),m=new Float32Array(l),v=new Uint32Array(u)
662
670
  let g=0,x=0,S=0
663
- 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
671
+ 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
664
672
  for(let t=0;i.length>t;t+=3)w[g++]=i[t]+r,w[g++]=i[t+1]+o,w[g++]=i[t+2]+a
665
673
  m.set(s,x),x+=s.length
666
- const c=e.sr
667
- for(let t=0;n.length>t;t++)v[S++]=n[t]+c}return{vertices:w,normals:m,indices:v,pr:y,planeBounds:p}}ar(t,e,i){if(0===t.length)return""
674
+ const c=e.nr
675
+ for(let t=0;n.length>t;t++)v[S++]=n[t]+c}return{vertices:w,normals:m,indices:v,wr:y,planeBounds:p}}cr(t,e,i){if(0===t.length)return""
668
676
  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("|")
669
- return`${this.jn}_${r}_${Math.round(1e3*e)/1e3}_${i}`}lr(t,e,i,s,n,r,o,h){return{wr:t.hr,mr:t.mr,sr:e,vr: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.zn.has(t))return{cn:t,bi:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
670
- const e=`${this.jn}_${t}`,i=this.qn.get(e)
677
+ return`${this.zn}_${r}_${Math.round(1e3*e)/1e3}_${i}`}ur(t,e,i,s,n,r,o,h){return{mr:t.ar,vr:t.vr,nr:e,gr:i,bounds:{min:{x:o.bounds.min.x+s,y:o.bounds.min.y+n,z:r},max:{x:o.bounds.max.x+s,y:o.bounds.max.y+n,z:r+h}}}}rr(t){if(this.Wn.has(t))return{ln:t,bi:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
678
+ const e=`${this.zn}_${t}`,i=this.Jn.get(e)
671
679
  if(i)return i
672
- this.Vn.In(this.Mn),this.Mn.reset(),this.Mn.rn(t,0),this.le.module.exports.gr(this.le.font.Sr,t,this.Vn.Nn(),0),this.Mn.hn()
673
- const s=this.Mn.mn()[0]||{cn:t,bi:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
674
- return 0===s.bi.length&&this.zn.add(t),this.qn.set(e,s),s}cr(t,e,i){const s=this.tessellator.process(t,!0,i,0!==e)
675
- return this.br(s,e)}br(t,e){const i=this.Wn.rs(t,e,this.le.upem),s=i.vertices
680
+ this.qn.Gn(this.In),this.In.reset(),this.In.hn(t,0),this.le.module.exports.Sr(this.le.font.br,t,this.qn.Dn(),0),this.In.an()
681
+ const s=this.In.vn()[0]||{ln:t,bi:[],bounds:{min:{x:0,y:0},max:{x:0,y:0}}}
682
+ return 0===s.bi.length&&this.Wn.add(t),this.Jn.set(e,s),s}lr(t,e,i){const s=this.tessellator.process(t,!0,i,0!==e)
683
+ return this._r(s,e)}_r(t,e){const i=this.Hn.hs(t,e,this.le.upem),s=i.vertices
676
684
  let n=1/0,r=1/0,o=1/0,h=-1/0,a=-1/0,c=-1/0
677
685
  for(let t=0;s.length>t;t+=3){const e=s[t],i=s[t+1],l=s[t+2]
678
686
  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)
679
- 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.bi,i,s,0!==e)
680
- return this.br(n,e)}ur(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
681
- 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=[]
682
- return t.forEach((t,o)=>{const h=this.Lr(t,o,e,i,s,n)
683
- r.push(h)}),r}finally{}}Lr(e,i,s,n,r,o){const h=this.le.hb.createBuffer()
684
- "rtl"===o&&h.Mr("rtl"),h.oe(e.text),h.he()
687
+ return{geometry:t,vertices:i.vertices,normals:i.normals,indices:i.indices,bounds:{min:l,max:u},yr:1}}pr(t,e,i,s){const n=this.tessellator.process(t.bi,i,s,0!==e)
688
+ return this._r(n,e)}dr(t,e){const i=e.min,s=e.max,n=t.min,r=t.max
689
+ 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}Lr(t,e,i,s,n,r,o){try{const r=[]
690
+ return t.forEach((t,o)=>{const h=this.Mr(t,o,e,i,s,n)
691
+ r.push(h)}),r}finally{}}Mr(e,i,s,n,r,o){const h=this.le.hb.createBuffer()
692
+ "rtl"===o&&h.Ir("rtl"),h.oe(e.text),h.he()
685
693
  const a=t(this.le.ae)
686
694
  this.le.hb.shape(this.le.font,h,a)
687
695
  const c=h.json(this.le.font)
688
696
  h.destroy()
689
697
  const l=[]
690
698
  let u=[],f="",d=0,y=0,p=e.Dt,w=-i*s
691
- const m=n*this.le.upem,v=this.Ir(e,r,n),g=this.Gr(e,r)
699
+ const m=n*this.le.upem,v=this.Gr(e,r,n),g=this.Or(e,r)
692
700
  for(let t=0;c.length>t;t++){const s=c[t],n=/\s/.test(e.text[s.ce])
693
- s.hr=e.Rt&&s.ce===e.text.length-1&&"-"===e.text[s.ce]?e.Nt:e.$t+s.ce,s.mr=i,n&&u.length>0&&(l.push({text:f,glyphs:u,position:new R(d,y,0)}),u=[],f="")
701
+ s.ar=e.Rt&&s.ce===e.text.length-1&&"-"===e.text[s.ce]?e.Nt:e.$t+s.ce,s.vr=i,n&&u.length>0&&(l.push({text:f,glyphs:u,position:new R(d,y,0)}),u=[],f="")
694
702
  const r=p+s.dx,o=w+s.dy
695
703
  if(n||(0===u.length&&(d=r,y=o),s.x=r-d,s.y=o-y,u.push(s),f+=e.text[s.ce]),p+=s.ax,w+=s.ay,0!==m&&c.length-1>t&&(p+=m),n&&(p+=v),0!==g&&c.length-1>t&&!n){const i=e.text[s.ce],n=e.text[c[t+1].ce],r=M.tt(i),o=n&&M.tt(n)
696
704
  if(r&&o){let t=!0
697
- M.et(n)&&(t=!1),M.it(i)&&(t=!1),M.st(i)&&M.st(n)&&(t=!1),t&&(p+=g)}}}return u.length>0&&l.push({text:f,glyphs:u,position:new R(d,y,0)}),l}Ir(t,e,i){let s=0
698
- if(void 0!==t.Kt&&"justify"===e&&!t.Pt){let e=this.Er.get(i)
699
- 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
700
- 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=h(Object.freeze({__proto__:null,default:{},Or(){throw Error("fs not available in browser")}}))
705
+ M.et(n)&&(t=!1),M.it(i)&&(t=!1),M.st(i)&&M.st(n)&&(t=!1),t&&(p+=g)}}}return u.length>0&&l.push({text:f,glyphs:u,position:new R(d,y,0)}),l}Gr(t,e,i){let s=0
706
+ if(void 0!==t.Kt&&"justify"===e&&!t.Pt){let e=this.Tr.get(i)
707
+ 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
708
+ 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=h(Object.freeze({__proto__:null,default:{},Fr(){throw Error("fs not available in browser")}}))
701
709
  !(function(t){var e,i=(e="undefined"!=typeof document?document.currentScript?.src:void 0,async function(t={}){function i(){var t=m.buffer
702
- n.HEAP8=new Int8Array(t),n.HEAPU8=v=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+")"),S=!0,t+=". Build with -sASSERTIONS for more info."
710
+ n.HEAP8=new Int8Array(t),n.HEAPU8=v=new Uint8Array(t),n.HEAP32=new Int32Array(t),n.HEAPU32=new Uint32Array(t),n.HEAPF32=new Float32Array(t),new BigInt64Array(t),new BigUint64Array(t)}function s(t){n.kr?.(t),x(t="Aborted("+t+")"),S=!0,t+=". Build with -sASSERTIONS for more info."
703
711
  var e=new WebAssembly.RuntimeError(t)
704
712
  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}
705
713
  "undefined"!=typeof __filename?e=__filename:o&&(e=self.location.href)
706
714
  var c,l,u=""
707
715
  if(h){var f=ut
708
- u=__dirname+"/",l=t=>(t=b(t)?new URL(t):t,f.Or(t)),c=async(t,e=!0)=>(t=b(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
716
+ u=__dirname+"/",l=t=>(t=b(t)?new URL(t):t,f.Fr(t)),c=async(t,e=!0)=>(t=b(t)?new URL(t):t,f.Fr(t,e?void 0:"utf8")),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),a=(t,e)=>{throw process.exitCode=t,e}}else if(r||o){try{u=new URL(".",e).href}catch{}o&&(l=t=>{var e=new XMLHttpRequest
709
717
  return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),c=async t=>{if(b(t))return new Promise((e,i)=>{var s=new XMLHttpRequest
710
718
  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)})
711
719
  var e=await fetch(t,{credentials:"same-origin"})
@@ -714,158 +722,158 @@ throw Error(e.status+" : "+e.url)}}console.log.bind(console)
714
722
  var d,y,p,w,m,v,g,x=console.error.bind(console),S=!1,b=t=>t.startsWith("file://"),_=!1,E=0,T=null
715
723
  class A{name="ExitStatus"
716
724
  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
717
- a(1,t)},D=()=>B||U>0,P=t=>{y=t,D()||(n.kr?.(t),S=!0),a(t,new A(t))},R=(t,e)=>Math.ceil(t/e)*e,j=t=>{var e=(t-m.buffer.byteLength+65535)/65536|0
725
+ a(1,t)},D=()=>B||U>0,P=t=>{y=t,D()||(n.Cr?.(t),S=!0),a(t,new A(t))},R=(t,e)=>Math.ceil(t/e)*e,j=t=>{var e=(t-m.buffer.byteLength+65535)/65536|0
718
726
  try{return m.grow(e),i(),1}catch(t){}},z=t=>{const e=t.length
719
727
  return[e%128|128,e>>7,...t]},W={Ei:127,Ai:127,Mi:126,f:125,d:124,e:111},H=t=>z(Array.from(t,t=>W[t])),V=t=>L.get(t),q=[],J=(t,e)=>L.set(t,e)
720
- n.Cr&&(B=n.Cr),n.Br&&(x=n.Br),n.Ur&&(d=n.Ur),n.$r=m,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)
728
+ n.Br&&(B=n.Br),n.Ur&&(x=n.Ur),n.$r&&(d=n.$r),n.Nr=m,n.Dr=K,n.Fn=(t,e)=>{var i=(t=>(M||(M=new WeakMap,((t,e)=>{if(M)for(var i=0;0+e>i;i++){var s=V(i)
721
729
  s&&M.set(s,i)}})(0,L.length)),M.get(t)||0))(t)
722
730
  if(i)return i
723
731
  var s=q.length?q.pop():L.grow(1)
724
732
  try{J(s,t)}catch(i){if(!(i instanceof TypeError))throw i
725
733
  var n=((t,e)=>{var i=Uint8Array.of(0,97,115,109,1,0,0,0,1,...z([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)
726
734
  return new WebAssembly.Instance(s,{e:{f:t}}).exports.f})(t,e)
727
- J(s,n)}return M.set(t,s),s},n.Pn=t=>{M.delete(V(t)),J(t,null),q.push(t)}
728
- var Y={Dr:()=>s(""),Pr(){B=!1,U=0},Rr(t,e){if($[t]&&(clearTimeout($[t].id),delete $[t]),!e)return 0
735
+ J(s,n)}return M.set(t,s),s},n.Rn=t=>{M.delete(V(t)),J(t,null),q.push(t)}
736
+ var Y={Pr:()=>s(""),Rr(){B=!1,U=0},jr(t,e){if($[t]&&(clearTimeout($[t].id),delete $[t]),!e)return 0
729
737
  var i=setTimeout(()=>{delete $[t],(t=>{if(!S)try{t(),(()=>{if(!D())try{y=t=y,P(t)}catch(t){N(t)}var t})()}catch(t){N(t)}})(()=>I(t,performance.now()))},e)
730
- return $[t]={id:i,jr:e},0},zr(t){var e=v.length,i=2147483648
738
+ return $[t]={id:i,zr:e},0},Wr(t){var e=v.length,i=2147483648
731
739
  if((t>>>=0)>i)return!1
732
740
  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))
733
- if(j(r))return!0}return!1},Wr:P},K=await(async()=>{function t(t){return n.Nr=K=t.exports,n.$r=m=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.mo=t.vo,n.xo=t.So,n.bo=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.jo=t.zo,n.Wo=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.gr,n.wh=t.mh,n.gh=t.xh,n.Sh=t.bh,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
734
- T=null,t()}})(),K}E++,n.Ph?.(E)
735
- var e,r={u:Y,Rh:Y}
736
- return n.jh?new Promise(e=>{n.jh(r,i=>{e(t(i))})}):(g??=(e="hb.wasm",n.zh?n.zh(e,u):u+e),t((await(async function(t,e,i){if(!t&&!b(e)&&!h)try{var n=fetch(e,{credentials:"same-origin"})
741
+ if(j(r))return!0}return!1},Hr:P},K=await(async()=>{function t(t){return n.Dr=K=t.exports,n.Nr=m=K.memory,i(),L=K.Vr,(t=>{n.qr=t.Jr,n.Yr=t.Kr,n.Xr=t.Qr,n.Zr=t.eo,n.io=t.so,n.no=t.ro,n.oo=t.ho,n.ao=t.co,n.lo=t.uo,n.fo=t.do,n.yo=t.po,n.wo=t.mo,n.vo=t.xo,n.So=t.bo,n._o=t.Eo,n.To=t.Ao,n.Lo=t.Mo,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.jo,n.zo=t.Wo,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.Sr,n.mh=t.gh,n.xh=t.Sh,n.bh=t._h,n.Eh=t.Th,n.Ah=t.Lh,n.Mh=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
742
+ T=null,t()}})(),K}E++,n.Rh?.(E)
743
+ var e,r={u:Y,jh:Y}
744
+ return n.zh?new Promise(e=>{n.zh(r,i=>{e(t(i))})}):(g??=(e="hb.wasm",n.Wh?n.Wh(e,u):u+e),t((await(async function(t,e,i){if(!t&&!b(e)&&!h)try{var n=fetch(e,{credentials:"same-origin"})
737
745
  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)
738
746
  return new Uint8Array(e)}catch{}return(t=>{if(t==g&&d)return new Uint8Array(d)
739
747
  if(l)return l(t)
740
748
  throw"both async and sync fetching of the wasm failed"})(t)})(t)
741
- return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,g,r)).Wh))})()
742
- 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,S||(_=!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())
743
- 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())
749
+ return await WebAssembly.instantiate(i,e)}catch(t){x("failed to asynchronously prepare wasm: "+t),s(t)}})(e,i)})(d,g,r)).Hh))})()
750
+ return(()=>{if(n.Vh)for("function"==typeof n.Vh&&(n.Vh=[n.Vh]);n.Vh.length>0;)n.Vh.shift()()})(),(function t(){function e(){n.qh=!0,S||(_=!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())
751
+ 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())
744
752
  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})})
745
753
  t.exports=i,t.exports.default=i})(lt)
746
754
  var ft=o(lt.exports),dt={exports:{}}
747
- 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)
755
+ 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)
748
756
  for(let s=0;e.length>s;++s){const n=e.charCodeAt(s)
749
757
  if(n>127)throw Error("Expected ASCII text")
750
- t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{Sr:i,length:e.length,Yo(){n.Yo(i)}}}function s(t,e,s){var r=0,o=0
751
- s&&(s=s.split(","),r=n.qo(16*s.length),s.forEach(t=>{var e=i(t)
752
- n.Ho(e.Sr,-1,r+16*o)&&o++,e.Yo()})),n.Nh(t.Sr,e.Sr,r,o),r&&n.Yo(r)}var n=t.Nr,r=new TextDecoder("utf8")
753
- let o=t.On,h=t.Pn
754
- var a=o(t=>{n.Yo(t)},"vi"),c=e("JSON"),l="",u=n.qo(256)
755
- return{je(e){var i=n.qo(e.byteLength)
758
+ t.HEAPU8[i+s]=n}return t.HEAPU8[i+e.length]=0,{br:i,length:e.length,Ko(){n.Ko(i)}}}function s(t,e,s){var r=0,o=0
759
+ s&&(s=s.split(","),r=n.Jo(16*s.length),s.forEach(t=>{var e=i(t)
760
+ n.Vo(e.br,-1,r+16*o)&&o++,e.Ko()})),n.Dh(t.br,e.br,r,o),r&&n.Ko(r)}var n=t.Dr,r=new TextDecoder("utf8")
761
+ let o=t.Fn,h=t.Rn
762
+ var a=o(t=>{n.Ko(t)},"vi"),c=e("JSON"),l="",u=n.Jo(256)
763
+ return{je(e){var i=n.Jo(e.byteLength)
756
764
  t.HEAPU8.set(new Uint8Array(e),i)
757
- var s=n.qr(i,e.byteLength,2,i,a)
758
- return{Sr:s,destroy(){n.Yr(s)}}},ze(i,s){var r=n.nh(i.Sr,s)
759
- const o=n.fh(r)
760
- return{Sr:r,upem:o,Xh(i){var s=n.ah(r,e(i)),o=n.Xr(s)
761
- if(o){var h=n.Zr(s,null)
762
- return t.HEAPU8.subarray(h,h+o)}},Ve(){var e=n.qo(2048),i=n.qo(4)
763
- t.HEAPU32[i/4]=64,n.Fh(r,0,i,e)
765
+ var s=n.Jr(i,e.byteLength,2,i,a)
766
+ return{br:s,destroy(){n.Kr(s)}}},ze(i,s){var r=n.rh(i.br,s)
767
+ const o=n.dh(r)
768
+ return{br:r,upem:o,Qh(i){var s=n.uh(r,e(i)),o=n.Qr(s)
769
+ if(o){var h=n.eo(s,null)
770
+ return t.HEAPU8.subarray(h,h+o)}},Ve(){var e=n.Jo(2048),i=n.Jo(4)
771
+ t.HEAPU32[i/4]=64,n.kh(r,0,i,e)
764
772
  var s={}
765
773
  return Array.from({length:t.HEAPU32[i/4]}).forEach((i,n)=>{var r
766
- 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()
767
- n.yh(r,e)
768
- var i=(e=>{const i=n.Ch(e),s=n.qo(i<<2),r=s>>2,o=t.HEAPU32.subarray(r,r+i)
769
- return t.HEAPU32.set(o,r),n.Uh(e,-1,s,i),o})(e)
770
- return n.Gh(e),i},destroy(){n.oh(r)}}},We(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.gr(a,t,c,0),l}var a=n.xh(i.Sr),c=null,f=null,d=null,y=null,p=null,w=null
771
- return{Sr:a,Zh(e){n.mh(a,e,u,256)
774
+ 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()
775
+ n.ph(r,e)
776
+ var i=(e=>{const i=n.Bh(e),s=n.Jo(i<<2),r=s>>2,o=t.HEAPU32.subarray(r,r+i)
777
+ return t.HEAPU32.set(o,r),n.$h(e,-1,s,i),o})(e)
778
+ return n.Oh(e),i},destroy(){n.hh(r)}}},We(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.Sr(a,t,c,0),l}var a=n.Sh(i.br),c=null,f=null,d=null,y=null,p=null,w=null
779
+ return{br:a,ta(e){n.gh(a,e,u,256)
772
780
  var i=t.HEAPU8.subarray(u,u+256)
773
- 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)
774
- 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)
775
- s.forEach((i,s)=>{t.HEAPU32[r/4+2*s+0]=e(i[0]),t.HEAPF32[r/4+2*s+1]=i[1]}),n.bh(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()
776
- return{Sr:e,oe(i){const s=(e=>{const i=n.qo(2*e.length),s=new Uint16Array(t.$r.buffer,i,e.length)
781
+ 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)
782
+ return{type:e[0],values:e.slice(1).filter(t=>t.length).map(t=>+t)}}),setScale(t,e){n.Lh(a,t,e)},He(i){var s=Object.entries(i),r=n.Jo(8*s.length)
783
+ 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()
784
+ return{br:e,oe(i){const s=(e=>{const i=n.Jo(2*e.length),s=new Uint16Array(t.Nr.buffer,i,e.length)
777
785
  for(let t=0;s.length>t;++t)s[t]=e.charCodeAt(t)
778
- return{Sr:i,length:s.length,Yo(){n.Yo(i)}}})(i)
779
- n.ko(e,s.Sr,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
780
- 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)
781
- n.yo(e,n.$o(s.Sr,-1)),s.Yo()},aa(t){var s=i(t)
782
- n.fo(e,n.Do(s.Sr,-1)),s.Yo()},ca(t){n.vo(e,t)},json(){for(var i=n.So(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)})
783
- 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),m=o((e,i,s)=>{var o=r.decode(t.HEAPU8.subarray(s,t.HEAPU8.indexOf(0,s)))
784
- 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.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.ao(e)}),1)},"iiiii")
785
- return n.Bo(i.Sr,m,0,0),s(e,i,a),n.Yo(w),h(m),f},version(){var e=n.qo(12)
786
- n.Ro(e,e+4,e+8)
787
- var i={ua:t.HEAPU32[e/4],fa:t.HEAPU32[(e+4)/4],da:t.HEAPU32[(e+8)/4]}
788
- return n.Yo(e),i},ya(){var e=n.zo()
786
+ return{br:i,length:s.length,Ko(){n.Ko(i)}}})(i)
787
+ n.Co(e,s.br,s.length,0,s.length),s.Ko()},he:()=>n.Go(e),Ir(t){n.uo(e,{sa:4,na:5,ra:6,oa:7}[t]||0)},ha(t){var i=0
788
+ 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.mo(e,i)},aa(t){var s=i(t)
789
+ n.po(e,n.No(s.br,-1)),s.Ko()},ca(t){var s=i(t)
790
+ n.do(e,n.Po(s.br,-1)),s.Ko()},la(t){n.xo(e,t)},json(){for(var i=n.bo(e),s=[],r=n.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.Mo(r+20*l)})
791
+ 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),m=o((e,i,s)=>{var o=r.decode(t.HEAPU8.subarray(s,t.HEAPU8.indexOf(0,s)))
792
+ return o.startsWith("start table GSUB")?d=1:o.startsWith("start table GPOS")&&(d=2),d!=u&&(y=!1),0!=u&&d==u&&o.startsWith("end lookup "+l)&&(y=!0),y?0:(n.so(e,0,n.bo(e),w,p,0,i,c,4),f.push({Ii:o,ki:JSON.parse(r.decode(t.HEAPU8.subarray(w,t.HEAPU8.indexOf(0,w)))),glyphs:2==n.co(e)}),1)},"iiiii")
793
+ return n.Uo(i.br,m,0,0),s(e,i,a),n.Ko(w),h(m),f},version(){var e=n.Jo(12)
794
+ n.jo(e,e+4,e+8)
795
+ var i={fa:t.HEAPU32[e/4],da:t.HEAPU32[(e+4)/4],ya:t.HEAPU32[(e+8)/4]}
796
+ return n.Ko(e),i},pa(){var e=n.Wo()
789
797
  return r.decode(t.HEAPU8.subarray(e,t.HEAPU8.indexOf(0,e)))}}}}catch(t){}var yt=o(dt.exports)
790
798
  let pt=null,wt=null,mt=null
791
- const vt={pa(t){wt=t,mt=null,pt=null},wa(t){mt=t,wt=null,pt=null},ma:async()=>pt||(pt=new Promise(async(t,e)=>{try{const e={}
792
- if(mt)e.Ur=mt
799
+ const vt={wa(t){wt=t,mt=null,pt=null},ma(t){mt=t,wt=null,pt=null},va:async()=>pt||(pt=new Promise(async(t,e)=>{try{const e={}
800
+ if(mt)e.$r=mt
793
801
  else{if(!wt)throw Error("HarfBuzz WASM path or buffer must be set before initialization.")
794
- e.zh=(t,e)=>t.endsWith(".wasm")?wt:e+t}const i=await ft(e)
795
- t({hb:yt(i),module:{On:i.On,exports:i.Nr,Pn:i.Pn}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),pt)}
796
- class gt{constructor(t,e){this.text=t,this.va=new Map,e.forEach(t=>{const e=this.va.get(t.wr)||[]
797
- e.push(t),this.va.set(t.wr,e)})}ga(t){const e=[]
798
- return t.xa&&e.push(...this.Sa(t.xa)),t.ba&&e.push(...this._a(t.ba)),e}Sa(t){const e=[]
802
+ e.Wh=(t,e)=>t.endsWith(".wasm")?wt:e+t}const i=await ft(e)
803
+ t({hb:yt(i),module:{Fn:i.Fn,exports:i.Dr,Rn:i.Rn}})}catch(t){e(Error("Failed to initialize HarfBuzz: "+t))}}),pt)}
804
+ class gt{constructor(t,e){this.text=t,this.ga=new Map,e.forEach(t=>{const e=this.ga.get(t.mr)||[]
805
+ e.push(t),this.ga.set(t.mr,e)})}xa(t){const e=[]
806
+ return t.Sa&&e.push(...this.ba(t.Sa)),t._a&&e.push(...this.Ea(t._a)),e}ba(t){const e=[]
799
807
  for(const i of t){let t=0
800
- 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)
808
+ 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)
801
809
  return this.createTextRange(t.start,t.end,e)})}createTextRange(t,e,i){const s=[],n=new Map
802
- for(let i=t;e>i;i++){const t=this.va.get(i)
810
+ for(let i=t;e>i;i++){const t=this.ga.get(i)
803
811
  if(t)for(const e of t){s.push(e)
804
- const t=n.get(e.mr)||[]
805
- t.push(e),n.set(e.mr,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}}
812
+ const t=n.get(e.vr)||[]
813
+ t.push(e),n.set(e.vr,t)}}return{start:t,end:e,Ta:i,bounds:Array.from(n.values()).map(t=>this.Aa(t)),glyphs:s,La:Array.from(n.keys()).sort((t,e)=>t-e)}}Aa(t){if(0===t.length)return{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}}
806
814
  let e=1/0,i=1/0,s=1/0,n=-1/0,r=-1/0,o=-1/0
807
815
  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)
808
- 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=vt.ma()),this.Ba=new $(()=>xt.Ma)}static Ua(t){vt.pa(t),xt.Ma=null}static $a(t){vt.wa(t),xt.Ma=null}static init(){return xt.Ma||(xt.Ma=vt.ma()),xt.Ma}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
809
- xt.Ma||(xt.Ma=vt.ma())
810
- const e=await xt.Na(t),i=new xt
811
- i.Da(e)
812
- const s=await i.Pa(t),n=async e=>{const s={...t}
816
+ return{min:{x:e,y:i,z:s},max:{x:n,y:r,z:o}}}}class xt{static{this.Ma=new Map}static{this.Ia=null}static{this.Ga=new Map}static{this.Oa=0}static{this.Fa=1/0}static{this.ka=0}static Ca(t){return Object.keys(t).sort().map(e=>`${e}:${t[e]}`).join(",")}constructor(){this.Ba="",xt.Ia||(xt.Ia=vt.va()),this.Ua=new $(()=>xt.Ia)}static $a(t){vt.wa(t),xt.Ia=null}static Na(t){vt.ma(t),xt.Ia=null}static init(){return xt.Ia||(xt.Ia=vt.va()),xt.Ia}static async create(t){if(!t.font)throw Error("Font is required. Specify options.font as a URL string or ArrayBuffer.")
817
+ xt.Ia||(xt.Ia=vt.va())
818
+ const e=await xt.Da(t),i=new xt
819
+ i.Pa(e)
820
+ const s=await i.Ra(t),n=async e=>{const s={...t}
813
821
  for(const t in e){const i=e[t]
814
- 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)
815
- 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}}
816
- 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.ja(t.font)
817
- t.qe&&(e+="_var_"+xt.ka(t.qe)),t.ae&&(e+="_feat_"+xt.ka(t.ae))
818
- let i=xt.Ia.get(e)
819
- return i||(i=await xt.za(e,t.font,t.qe,t.ae)),i}static async za(t,e,i,s){const n=new xt
822
+ 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)
823
+ i.Pa(t),i.ja()}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}}
824
+ 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.za(t.font)
825
+ t.qe&&(e+="_var_"+xt.Ca(t.qe)),t.ae&&(e+="_feat_"+xt.Ca(t.ae))
826
+ let i=xt.Ga.get(e)
827
+ 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
820
828
  await n.Re(e,i,s)
821
829
  const r=n.getLoadedFont()
822
- return xt.Ia.set(t,r),xt.Wa(r),xt.Ha(),r}static Wa(t){xt.Ga+=t.Qe?.byteLength??0}static Va(t){const e=xt.Ia.get(t)
823
- 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
830
+ 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)
831
+ 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
824
832
  if(void 0===t)break
825
- xt.Va(t),xt.Ia.delete(t)}}static ja(t){if(t){const e=new Uint8Array(t)
833
+ xt.qa(t),xt.Ga.delete(t)}}static za(t){if(t){const e=new Uint8Array(t)
826
834
  let i=2166136261
827
835
  const s=Math.min(32,e.length),n=Math.floor(e.length/s)
828
836
  for(let t=0;s>t;t++)i^=e[t*n],i=Math.imul(i,16777619)
829
- return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++xt.Fa}Da(t){this.le=t
830
- const e=xt.ja(t.Qe)
831
- 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=vt.ma()),await xt.Ma
837
+ return i^=e.length,i=Math.imul(i,16777619),(i>>>0).toString(36)}return"c"+ ++xt.ka}Pa(t){this.le=t
838
+ const e=xt.za(t.Qe)
839
+ 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=vt.va()),await xt.Ia
832
840
  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}`)
833
841
  return e.arrayBuffer()}):t
834
- try{this.le&&this.destroy(),this.le=await this.Ba.Re(s,e),i&&(this.le.ae=i)
835
- const t=xt.ja(s)
836
- 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.")
837
- const e=await this.qa(t)
838
- if(this.Ja(e),this.Ya(t=e),!this.Tr){const e=t.Ka?r(t.Ka):z
839
- 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))
840
- 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)
842
+ try{this.le&&this.destroy(),this.le=await this.Ua.Re(s,e),i&&(this.le.ae=i)
843
+ const t=xt.za(s)
844
+ 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.")
845
+ const e=await this.Ja(t)
846
+ if(this.Ya(e),this.Ka(t=e),!this.Ar){const e=t.Xa?r(t.Xa):z
847
+ this.Ar=new at(e,this.le),this.Ar.Zn(this.Ba)}this.Ar.Ps(t.Qa),this.Ar.Sn(t.Za),this.le.font.setScale(this.le.upem,this.le.upem),this.tc||(this.tc=new ct(this.le,this.Ar))
848
+ const i=this.ec(t),s=t.sc??this.le.Je??!1,n=this.tc.Lr(i.lines,i.nc,i.letterSpacing,i.align,i.direction,t.color,t.text)
841
849
  let o
842
- if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.xa||t.color.ba)){if(o=new Set,t.color.xa)for(const e of Object.keys(t.color.xa)){let i=0
850
+ if(t.color&&"object"==typeof t.color&&!Array.isArray(t.color)&&(t.color.Sa||t.color._a)){if(o=new Set,t.color.Sa)for(const e of Object.keys(t.color.Sa)){let i=0
843
851
  for(;-1!==(i=t.text.indexOf(e,i));){for(let t=i;i+e.length>t;t++)o.add(t)
844
- i+=e.length}}if(t.color.ba)for(const e of t.color.ba)for(let t=e.start;e.end>t;t++)o.add(t)}const h=this.Tr.tr(n,i.depth,s,this.le.p.Te,t.nc||!1,o),a=this.Tr._r(),c=this.rc(h.vertices,h.normals,h.indices,h.pr,h.planeBounds,t,a,t.text)
845
- if(t.nc){const t=this.oc(c.vertices.length/3,c.glyphs)
846
- c.glyphAttributes=t}return c}finally{}}async qa(t){if(!1!==t.layout?.vt&&t.layout?.width){const e=t.layout?.language||"en-us"
847
- if(!t.layout?.St?.[e])try{if(!xt.La.has(e)){const s=await i(e,t.layout?.hc)
848
- xt.La.set(e,s)}return{...t,layout:{...t.layout,St:{...t.layout?.St,[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")
849
- const e=t.ac??1e5
850
- 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
+ i+=e.length}}if(t.color._a)for(const e of t.color._a)for(let t=e.start;e.end>t;t++)o.add(t)}const h=this.Ar.er(n,i.depth,s,this.le.p.Te,t.rc||!1,o),a=this.Ar.Er(),c=this.oc(h.vertices,h.normals,h.indices,h.wr,h.planeBounds,t,a,t.text)
853
+ if(t.rc){const t=this.hc(c.vertices.length/3,c.glyphs)
854
+ c.glyphAttributes=t}return c}finally{}}async Ja(t){if(!1!==t.layout?.vt&&t.layout?.width){const e=t.layout?.language||"en-us"
855
+ if(!t.layout?.St?.[e])try{if(!xt.Ma.has(e)){const s=await i(e,t.layout?.ac)
856
+ xt.Ma.set(e,s)}return{...t,layout:{...t.layout,St:{...t.layout?.St,[e]:xt.Ma.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")
857
+ const e=t.cc??1e5
858
+ 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")
851
859
  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:m=f,Tt:v=d,At:g,St:x,Lt:S,Mt:b,It:_,Gt:E,Ot:T,Ft:A,kt:L,Ct:M,Bt:I,Ut:G}=o
852
860
  let F
853
861
  void 0!==h&&(F=h*(this.le.upem/i))
854
862
  const k=s*(this.le.upem/i),C=k>0?Math.max(k,25e-6*this.le.upem):0
855
- this.cc||(this.cc=new O(this.le))
856
- const U=this.cc.ue({text:e,width:F,align:c,direction:a,vt:y,language:p,gt:l,_t:w,Et:m,Tt:v,At:g,St:x,Lt:S,Mt:b,It:_,Gt:E,Ot:T,Ft:A,kt:L,Ct:M,Bt:I,Ut:G,letterSpacing:r}),$=B.ke(this.le.p)
857
- return{lines:U.lines,sc:($.we-$.me)*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=[]
863
+ this.lc||(this.lc=new O(this.le))
864
+ const U=this.lc.ue({text:e,width:F,align:c,direction:a,vt:y,language:p,gt:l,_t:w,Et:m,Tt:v,At:g,St:x,Lt:S,Mt:b,It:_,Gt:E,Ot:T,Ft:A,kt:L,Ct:M,Bt:I,Ut:G,letterSpacing:r}),$=B.ke(this.le.p)
865
+ return{lines:U.lines,nc:($.we-$.me)*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=[]
858
866
  if(Array.isArray(i)){for(let t=0;n>t;t++){const e=3*t
859
- 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.mr))]})}else{const t=i.default||[1,1,1]
867
+ r[e]=i[0],r[e+1]=i[1],r[e+2]=i[2]}o.push({start:0,end:s.length,Ta:s,color:i,bounds:[],glyphs:e,La:[...new Set(e.map(t=>t.vr))]})}else{const t=i.default||[1,1,1]
860
868
  for(let e=0;r.length>e;e+=3)r[e]=t[0],r[e+1]=t[1],r[e+2]=t[2]
861
- i.xa&&new gt(s,e).ga({xa:Object.keys(i.xa)}).forEach(t=>{const e=i.xa[t.Ea]
862
- e&&(t.glyphs.forEach(t=>{for(let i=0;t.vr>i;i++){const s=3*(t.sr+i)
863
- 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.ba&&i.ba.forEach(t=>{const i=[]
864
- for(const s of e)if(s.wr>=t.start&&t.end>s.wr){i.push(s)
865
- for(let e=0;s.vr>e;e++){const i=3*(s.sr+e)
866
- 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.mr))]})})}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
867
- this.cc||(this.cc=new O(this.le))
868
- const f=this.cc.ye({width:l,align:u,planeBounds:n}),d=f.offset
869
+ i.Sa&&new gt(s,e).xa({Sa:Object.keys(i.Sa)}).forEach(t=>{const e=i.Sa[t.Ta]
870
+ e&&(t.glyphs.forEach(t=>{for(let i=0;t.gr>i;i++){const s=3*(t.nr+i)
871
+ s>=0&&r.length>s&&(r[s]=e[0],r[s+1]=e[1],r[s+2]=e[2])}}),o.push({start:t.start,end:t.end,Ta:t.Ta,color:e,bounds:t.bounds,glyphs:t.glyphs,La:t.La}))}),i._a&&i._a.forEach(t=>{const i=[]
872
+ for(const s of e)if(s.mr>=t.start&&t.end>s.mr){i.push(s)
873
+ for(let e=0;s.gr>e;e++){const i=3*(s.nr+e)
874
+ i>=0&&r.length>i&&(r[i]=t.color[0],r[i+1]=t.color[1],r[i+2]=t.color[2])}}o.push({start:t.start,end:t.end,Ta:s.slice(t.start,t.end),color:t.color,bounds:[],glyphs:i,La:[...new Set(i.map(t=>t.vr))]})})}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
875
+ this.lc||(this.lc=new O(this.le))
876
+ const f=this.lc.ye({width:l,align:u,planeBounds:n}),d=f.offset
869
877
  n.min.x=f.de.min.x,n.max.x=f.de.max.x
870
878
  const y=c/this.le.upem,p=d*y
871
879
  if(0===p)for(let e=0;t.length>e;e++)t[e]*=y
@@ -873,15 +881,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
873
881
  n.min.x*=y,n.min.y*=y,n.min.z*=y,n.max.x*=y,n.max.y*=y,n.max.z*=y
874
882
  for(let t=0;s.length>t;t++){const e=s[t]
875
883
  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,m
876
- if(r.color){const e=this.lc(t,s,r.color,r.text)
877
- w=e.colors,m=e.uc}const v=this.Tr.Sn()
878
- return{vertices:t,normals:e,indices:i,colors:w,glyphs:s,planeBounds:n,stats:{fc:i.length/3,dc:t.length/3,As:v.As,Ls:v.Ls,Ms:v.Ms,...o||{}},query(t){if(!h)throw Error("Original text not available for querying")
879
- return new gt(h,s).ga(t)},uc:m,glyphAttributes:void 0}}Ce(){if(!this.le)throw Error("Font not loaded. Call loadFont() first")
880
- 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 s=await i(t,e)
881
- xt.La.set(t,s)}catch(e){l.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static wc(t,e){xt.La.set(t,e)}static mc(){xt.Ia.clear(),xt.Ga=0}static vc(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")
882
- 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)
884
+ if(r.color){const e=this.uc(t,s,r.color,r.text)
885
+ w=e.colors,m=e.fc}const v=this.Ar.bn()
886
+ return{vertices:t,normals:e,indices:i,colors:w,glyphs:s,planeBounds:n,stats:{dc:i.length/3,yc:t.length/3,Ls:v.Ls,Ms:v.Ms,Is:v.Is,...o||{}},query(t){if(!h)throw Error("Original text not available for querying")
887
+ return new gt(h,s).xa(t)},fc:m,glyphAttributes:void 0}}Ce(){if(!this.le)throw Error("Font not loaded. Call loadFont() first")
888
+ return B.Ce(this.le.p)}static async wc(t,e){await Promise.all(t.map(async t=>{if(!xt.Ma.has(t))try{const s=await i(t,e)
889
+ xt.Ma.set(t,s)}catch(e){l.warn(`Failed to pre-load patterns for ${t}: ${e}`)}}))}static mc(t,e){xt.Ma.set(t,e)}static vc(){xt.Ga.clear(),xt.Oa=0}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")
890
+ 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)
883
891
  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
884
- for(let c=0;e.vr>c;c++){const l=e.sr+c
885
- t>l&&(i[3*l]=o,i[3*l+1]=h,i[3*l+2]=a,s[l]=r,n[l]=e.mr)}}),{gc:i,fn:s,xc:n}}Ra(){this.Tr=void 0,this.Za=void 0,this.cc=void 0}destroy(){if(!this.le)return
892
+ for(let c=0;e.gr>c;c++){const l=e.nr+c
893
+ t>l&&(i[3*l]=o,i[3*l+1]=h,i[3*l+2]=a,s[l]=r,n[l]=e.vr)}}),{xc:i,dn:s,Sc:n}}ja(){this.Ar=void 0,this.tc=void 0,this.lc=void 0}destroy(){if(!this.le)return
886
894
  const t=this.le
887
- 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}}}exports.DEFAULT_CURVE_FIDELITY=it,exports.FontMetadataExtractor=B,exports.Text=xt,exports.createGlyphCache=r,exports.globalGlyphCache=z
895
+ 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}}}exports.DEFAULT_CURVE_FIDELITY=it,exports.FontMetadataExtractor=B,exports.Text=xt,exports.createGlyphCache=r,exports.globalGlyphCache=z