@classcad/mcp 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +128 -87
  2. package/dist/app/SOURCE.txt +4 -0
  3. package/dist/app/assets/index-54a14bc0.css +8 -0
  4. package/dist/app/assets/index-c650c783.js +11257 -0
  5. package/dist/app/assets/troika-three-text.esm-188d86b5.js +220 -0
  6. package/dist/app/favicon.svg +98 -0
  7. package/dist/app/index.html +19 -0
  8. package/dist/app/manifest.json +14 -0
  9. package/dist/auth.d.ts +8 -0
  10. package/dist/auth.js +49 -10
  11. package/dist/auth.js.map +1 -1
  12. package/dist/backend.d.ts +8 -0
  13. package/dist/backend.js +39 -0
  14. package/dist/backend.js.map +1 -0
  15. package/dist/client.d.ts +48 -11
  16. package/dist/client.js +152 -167
  17. package/dist/client.js.map +1 -1
  18. package/dist/daemon.d.ts +0 -2
  19. package/dist/daemon.js +77 -62
  20. package/dist/daemon.js.map +1 -1
  21. package/dist/engine/key.d.ts +29 -0
  22. package/dist/engine/key.js +145 -0
  23. package/dist/engine/key.js.map +1 -0
  24. package/dist/engine/wasm-worker.js +7 -7
  25. package/dist/engine/wasm-worker.js.map +1 -1
  26. package/dist/engine/wasm.d.ts +16 -14
  27. package/dist/engine/wasm.js +22 -30
  28. package/dist/engine/wasm.js.map +1 -1
  29. package/dist/mcp-server.d.ts +4 -4
  30. package/dist/mcp-server.js +72 -28
  31. package/dist/mcp-server.js.map +1 -1
  32. package/dist/queue.js +1 -1
  33. package/dist/queue.js.map +1 -1
  34. package/dist/server.js +69 -36
  35. package/dist/server.js.map +1 -1
  36. package/dist/share/hub.d.ts +70 -0
  37. package/dist/share/hub.js +494 -0
  38. package/dist/share/hub.js.map +1 -0
  39. package/dist/share/protocol.d.ts +87 -0
  40. package/dist/share/protocol.js +54 -0
  41. package/dist/share/protocol.js.map +1 -0
  42. package/dist/share/relay.d.ts +45 -0
  43. package/dist/share/relay.js +230 -0
  44. package/dist/share/relay.js.map +1 -0
  45. package/dist/share/server.d.ts +27 -0
  46. package/dist/share/server.js +399 -0
  47. package/dist/share/server.js.map +1 -0
  48. package/dist/share/session.d.ts +120 -0
  49. package/dist/share/session.js +336 -0
  50. package/dist/share/session.js.map +1 -0
  51. package/dist/tools/auth.js +1 -1
  52. package/dist/tools/auth.js.map +1 -1
  53. package/dist/tools/docs.js +3 -2
  54. package/dist/tools/docs.js.map +1 -1
  55. package/dist/tools/lifecycle.js +36 -9
  56. package/dist/tools/lifecycle.js.map +1 -1
  57. package/dist/tools/share.d.ts +18 -0
  58. package/dist/tools/share.js +277 -0
  59. package/dist/tools/share.js.map +1 -0
  60. package/dist/tools/viewer.d.ts +1 -1
  61. package/dist/tools/viewer.js +11 -6
  62. package/dist/tools/viewer.js.map +1 -1
  63. package/package.json +4 -3
  64. package/dist/bridge/protocol.d.ts +0 -87
  65. package/dist/bridge/protocol.js +0 -14
  66. package/dist/bridge/protocol.js.map +0 -1
  67. package/dist/bridge/server.d.ts +0 -35
  68. package/dist/bridge/server.js +0 -236
  69. package/dist/bridge/server.js.map +0 -1
  70. package/dist/tools/bridge.d.ts +0 -4
  71. package/dist/tools/bridge.js +0 -115
  72. package/dist/tools/bridge.js.map +0 -1
@@ -0,0 +1,220 @@
1
+ import{U as xn,M as kn,R as Fn,a as Cn,S as Dn,I as An,b as En,B as Mn,c as Pn,D as on,d as Gn,V as Vt,e as zr,C as yr,f as On,g as br,F as Bn,T as Ln,L as Vr,P as Ur,h as Rn,i as In,j as Wn,k as Nn,l as _r}from"./index-c650c783.js";function zn(){var c=Object.create(null);function r(t,e){var o=t.id,a=t.name,n=t.dependencies;n===void 0&&(n=[]);var i=t.init;i===void 0&&(i=function(){});var s=t.getTransferables;if(s===void 0&&(s=null),!c[o])try{n=n.map(function(l){return l&&l.isWorkerModule&&(r(l,function(h){if(h instanceof Error)throw h}),l=c[l.id].value),l}),i=u("<"+a+">.init",i),s&&(s=u("<"+a+">.getTransferables",s));var f=null;typeof i=="function"?f=i.apply(void 0,n):console.error("worker module init function failed to rehydrate"),c[o]={id:o,value:f,getTransferables:s},e(f)}catch(l){l&&l.noLog||console.error(l),e(l)}}function d(t,e){var o,a=t.id,n=t.args;(!c[a]||typeof c[a].value!="function")&&e(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var i=(o=c[a]).value.apply(o,n);i&&typeof i.then=="function"?i.then(s,function(f){return e(f instanceof Error?f:new Error(""+f))}):s(i)}catch(f){e(f)}function s(f){try{var l=c[a].getTransferables&&c[a].getTransferables(f);(!l||!Array.isArray(l)||!l.length)&&(l=void 0),e(f,l)}catch(h){console.error(h),e(h)}}}function u(t,e){var o=void 0;self.troikaDefine=function(n){return o=n};var a=URL.createObjectURL(new Blob(["/** "+t.replace(/\*/g,"")+` **/
2
+
3
+ troikaDefine(
4
+ `+e+`
5
+ )`],{type:"application/javascript"}));try{importScripts(a)}catch(n){console.error(n)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(t){var e=t.data,o=e.messageId,a=e.action,n=e.data;try{a==="registerModule"&&r(n,function(i){i instanceof Error?postMessage({messageId:o,success:!1,error:i.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof i=="function"}})}),a==="callModule"&&d(n,function(i,s){i instanceof Error?postMessage({messageId:o,success:!1,error:i.message}):postMessage({messageId:o,success:!0,result:i},s||void 0)})}catch(i){postMessage({messageId:o,success:!1,error:i.stack})}})}function Vn(c){var r=function(){for(var d=[],u=arguments.length;u--;)d[u]=arguments[u];return r._getInitResult().then(function(t){if(typeof t=="function")return t.apply(void 0,d);throw new Error("Worker module function was called but `init` did not return a callable function")})};return r._getInitResult=function(){var d=c.dependencies,u=c.init;d=Array.isArray(d)?d.map(function(e){return e&&e._getInitResult?e._getInitResult():e}):[];var t=Promise.all(d).then(function(e){return u.apply(null,e)});return r._getInitResult=function(){return t},t},r}var sn=function(){var c=!1;if(typeof window<"u"&&typeof window.document<"u")try{var r=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));r.terminate(),c=!0}catch(d){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+d.message+"]")}return sn=function(){return c},c},jn=0,Xn=0,ur=!1,Ut=Object.create(null),_t=Object.create(null),vr=Object.create(null);function St(c){if((!c||typeof c.init!="function")&&!ur)throw new Error("requires `options.init` function");var r=c.dependencies,d=c.init,u=c.getTransferables,t=c.workerId;if(!sn())return Vn(c);t==null&&(t="#default");var e="workerModule"+ ++jn,o=c.name||e,a=null;r=r&&r.map(function(i){return typeof i=="function"&&!i.workerModuleData&&(ur=!0,i=St({workerId:t,name:"<"+o+"> function dependency: "+i.name,init:`function(){return (
6
+ `+Nt(i)+`
7
+ )}`}),ur=!1),i&&i.workerModuleData&&(i=i.workerModuleData),i});function n(){for(var i=[],s=arguments.length;s--;)i[s]=arguments[s];if(!a){a=jr(t,"registerModule",n.workerModuleData);var f=function(){a=null,_t[t].delete(f)};(_t[t]||(_t[t]=new Set)).add(f)}return a.then(function(l){var h=l.isCallable;if(h)return jr(t,"callModule",{id:e,args:i});throw new Error("Worker module function was called but `init` did not return a callable function")})}return n.workerModuleData={isWorkerModule:!0,id:e,name:o,dependencies:r,init:Nt(d),getTransferables:u&&Nt(u)},n}function Yn(c){_t[c]&&_t[c].forEach(function(r){r()}),Ut[c]&&(Ut[c].terminate(),delete Ut[c])}function Nt(c){var r=c.toString();return!/^function/.test(r)&&/^\w+\s*\(/.test(r)&&(r="function "+r),r}function Hn(c){var r=Ut[c];if(!r){var d=Nt(zn);r=Ut[c]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+c.replace(/\*/g,"")+` **/
8
+
9
+ ;(`+d+")()"],{type:"application/javascript"}))),r.onmessage=function(u){var t=u.data,e=t.messageId,o=vr[e];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete vr[e],o(t)}}return r}function jr(c,r,d){return new Promise(function(u,t){var e=++Xn;vr[e]=function(o){o.success?u(o.result):t(new Error("Error in worker "+r+" call: "+o.error))},Hn(c).postMessage({messageId:e,action:r,data:d})})}function fn(){var c=function(r){function d(P,W,p,w,B,O,D,I){var F=1-D;I.x=F*F*P+2*F*D*p+D*D*B,I.y=F*F*W+2*F*D*w+D*D*O}function u(P,W,p,w,B,O,D,I,F,M){var z=1-F;M.x=z*z*z*P+3*z*z*F*p+3*z*F*F*B+F*F*F*D,M.y=z*z*z*W+3*z*z*F*w+3*z*F*F*O+F*F*F*I}function t(P,W){for(var p=/([MLQCZ])([^MLQCZ]*)/g,w,B,O,D,I;w=p.exec(P);){var F=w[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(M){return parseFloat(M)});switch(w[1]){case"M":D=B=F[0],I=O=F[1];break;case"L":(F[0]!==D||F[1]!==I)&&W("L",D,I,D=F[0],I=F[1]);break;case"Q":{W("Q",D,I,D=F[2],I=F[3],F[0],F[1]);break}case"C":{W("C",D,I,D=F[4],I=F[5],F[0],F[1],F[2],F[3]);break}case"Z":(D!==B||I!==O)&&W("L",D,I,B,O);break}}}function e(P,W,p){p===void 0&&(p=16);var w={x:0,y:0};t(P,function(B,O,D,I,F,M,z,q,V){switch(B){case"L":W(O,D,I,F);break;case"Q":{for(var E=O,de=D,ce=1;ce<p;ce++)d(O,D,M,z,I,F,ce/(p-1),w),W(E,de,w.x,w.y),E=w.x,de=w.y;break}case"C":{for(var X=O,$=D,fe=1;fe<p;fe++)u(O,D,M,z,q,V,I,F,fe/(p-1),w),W(X,$,w.x,w.y),X=w.x,$=w.y;break}}})}var o="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",a="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",n=new WeakMap,i={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function s(P,W){var p=P.getContext?P.getContext("webgl",i):P,w=n.get(p);if(!w){let z=function(X){var $=O[X];if(!$&&($=O[X]=p.getExtension(X),!$))throw new Error(X+" not supported");return $},q=function(X,$){var fe=p.createShader($);return p.shaderSource(fe,X),p.compileShader(fe),fe},V=function(X,$,fe,L){if(!D[X]){var te={},H={},G=p.createProgram();p.attachShader(G,q($,p.VERTEX_SHADER)),p.attachShader(G,q(fe,p.FRAGMENT_SHADER)),p.linkProgram(G),D[X]={program:G,transaction:function(Q){p.useProgram(G),Q({setUniform:function(J,me){for(var pe=[],ee=arguments.length-2;ee-- >0;)pe[ee]=arguments[ee+2];var ue=H[me]||(H[me]=p.getUniformLocation(G,me));p["uniform"+J].apply(p,[ue].concat(pe))},setAttribute:function(J,me,pe,ee,ue){var ge=te[J];ge||(ge=te[J]={buf:p.createBuffer(),loc:p.getAttribLocation(G,J),data:null}),p.bindBuffer(p.ARRAY_BUFFER,ge.buf),p.vertexAttribPointer(ge.loc,me,p.FLOAT,!1,0,0),p.enableVertexAttribArray(ge.loc),B?p.vertexAttribDivisor(ge.loc,ee):z("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(ge.loc,ee),ue!==ge.data&&(p.bufferData(p.ARRAY_BUFFER,ue,pe),ge.data=ue)}})}}}D[X].transaction(L)},E=function(X,$){F++;try{p.activeTexture(p.TEXTURE0+F);var fe=I[X];fe||(fe=I[X]=p.createTexture(),p.bindTexture(p.TEXTURE_2D,fe),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST)),p.bindTexture(p.TEXTURE_2D,fe),$(fe,F)}finally{F--}},de=function(X,$,fe){var L=p.createFramebuffer();M.push(L),p.bindFramebuffer(p.FRAMEBUFFER,L),p.activeTexture(p.TEXTURE0+$),p.bindTexture(p.TEXTURE_2D,X),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,X,0);try{fe(L)}finally{p.deleteFramebuffer(L),p.bindFramebuffer(p.FRAMEBUFFER,M[--M.length-1]||null)}},ce=function(){O={},D={},I={},F=-1,M.length=0};var B=typeof WebGL2RenderingContext<"u"&&p instanceof WebGL2RenderingContext,O={},D={},I={},F=-1,M=[];p.canvas.addEventListener("webglcontextlost",function(X){ce(),X.preventDefault()},!1),n.set(p,w={gl:p,isWebGL2:B,getExtension:z,withProgram:V,withTexture:E,withTextureFramebuffer:de,handleContextLoss:ce})}W(w)}function f(P,W,p,w,B,O,D,I){D===void 0&&(D=15),I===void 0&&(I=null),s(P,function(F){var M=F.gl,z=F.withProgram,q=F.withTexture;q("copy",function(V,E){M.texImage2D(M.TEXTURE_2D,0,M.RGBA,B,O,0,M.RGBA,M.UNSIGNED_BYTE,W),z("copy",o,a,function(de){var ce=de.setUniform,X=de.setAttribute;X("aUV",2,M.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ce("1i","image",E),M.bindFramebuffer(M.FRAMEBUFFER,I||null),M.disable(M.BLEND),M.colorMask(D&8,D&4,D&2,D&1),M.viewport(p,w,B,O),M.scissor(p,w,B,O),M.drawArrays(M.TRIANGLES,0,3)})})})}function l(P,W,p){var w=P.width,B=P.height;s(P,function(O){var D=O.gl,I=new Uint8Array(w*B*4);D.readPixels(0,0,w,B,D.RGBA,D.UNSIGNED_BYTE,I),P.width=W,P.height=p,f(D,I,0,0,w,B)})}var h=Object.freeze({__proto__:null,withWebGLContext:s,renderImageData:f,resizeWebGLCanvasWithoutClearing:l});function y(P,W,p,w,B,O){O===void 0&&(O=1);var D=new Uint8Array(P*W),I=w[2]-w[0],F=w[3]-w[1],M=[];e(p,function(X,$,fe,L){M.push({x1:X,y1:$,x2:fe,y2:L,minX:Math.min(X,fe),minY:Math.min($,L),maxX:Math.max(X,fe),maxY:Math.max($,L)})}),M.sort(function(X,$){return X.maxX-$.maxX});for(var z=0;z<P;z++)for(var q=0;q<W;q++){var V=de(w[0]+I*(z+.5)/P,w[1]+F*(q+.5)/W),E=Math.pow(1-Math.abs(V)/B,O)/2;V<0&&(E=1-E),E=Math.max(0,Math.min(255,Math.round(E*255))),D[q*P+z]=E}return D;function de(X,$){for(var fe=1/0,L=1/0,te=M.length;te--;){var H=M[te];if(H.maxX+L<=X)break;if(X+L>H.minX&&$-L<H.maxY&&$+L>H.minY){var G=C(X,$,H.x1,H.y1,H.x2,H.y2);G<fe&&(fe=G,L=Math.sqrt(fe))}}return ce(X,$)&&(L=-L),L}function ce(X,$){for(var fe=0,L=M.length;L--;){var te=M[L];if(te.maxX<=X)break;var H=te.y1>$!=te.y2>$&&X<(te.x2-te.x1)*($-te.y1)/(te.y2-te.y1)+te.x1;H&&(fe+=te.y1<te.y2?1:-1)}return fe!==0}}function m(P,W,p,w,B,O,D,I,F,M){O===void 0&&(O=1),I===void 0&&(I=0),F===void 0&&(F=0),M===void 0&&(M=0),g(P,W,p,w,B,O,D,null,I,F,M)}function g(P,W,p,w,B,O,D,I,F,M,z){O===void 0&&(O=1),F===void 0&&(F=0),M===void 0&&(M=0),z===void 0&&(z=0);for(var q=y(P,W,p,w,B,O),V=new Uint8Array(q.length*4),E=0;E<q.length;E++)V[E*4+z]=q[E];f(D,V,F,M,P,W,1<<3-z,I)}function C(P,W,p,w,B,O){var D=B-p,I=O-w,F=D*D+I*I,M=F?Math.max(0,Math.min(1,((P-p)*D+(W-w)*I)/F)):0,z=P-(p+M*D),q=W-(w+M*I);return z*z+q*q}var v=Object.freeze({__proto__:null,generate:y,generateIntoCanvas:m,generateIntoFramebuffer:g}),_="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",k="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",U="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",T=new Float32Array([0,0,2,0,0,2]),x=null,S=!1,Y={},K=new WeakMap;function ne(P){if(!S&&!j(P))throw new Error("WebGL generation not supported")}function b(P,W,p,w,B,O,D){if(O===void 0&&(O=1),D===void 0&&(D=null),!D&&(D=x,!D)){var I=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!I)throw new Error("OffscreenCanvas or DOM canvas not supported");D=x=I.getContext("webgl",{depth:!1})}ne(D);var F=new Uint8Array(P*W*4);s(D,function(V){var E=V.gl,de=V.withTexture,ce=V.withTextureFramebuffer;de("readable",function(X,$){E.texImage2D(E.TEXTURE_2D,0,E.RGBA,P,W,0,E.RGBA,E.UNSIGNED_BYTE,null),ce(X,$,function(fe){A(P,W,p,w,B,O,E,fe,0,0,0),E.readPixels(0,0,P,W,E.RGBA,E.UNSIGNED_BYTE,F)})})});for(var M=new Uint8Array(P*W),z=0,q=0;z<F.length;z+=4)M[q++]=F[z];return M}function R(P,W,p,w,B,O,D,I,F,M){O===void 0&&(O=1),I===void 0&&(I=0),F===void 0&&(F=0),M===void 0&&(M=0),A(P,W,p,w,B,O,D,null,I,F,M)}function A(P,W,p,w,B,O,D,I,F,M,z){O===void 0&&(O=1),F===void 0&&(F=0),M===void 0&&(M=0),z===void 0&&(z=0),ne(D);var q=[];e(p,function(V,E,de,ce){q.push(V,E,de,ce)}),q=new Float32Array(q),s(D,function(V){var E=V.gl,de=V.isWebGL2,ce=V.getExtension,X=V.withProgram,$=V.withTexture,fe=V.withTextureFramebuffer,L=V.handleContextLoss;if($("rawDistances",function(te,H){(P!==te._lastWidth||W!==te._lastHeight)&&E.texImage2D(E.TEXTURE_2D,0,E.RGBA,te._lastWidth=P,te._lastHeight=W,0,E.RGBA,E.UNSIGNED_BYTE,null),X("main",_,k,function(G){var ae=G.setAttribute,Q=G.setUniform,re=!de&&ce("ANGLE_instanced_arrays"),J=!de&&ce("EXT_blend_minmax");ae("aUV",2,E.STATIC_DRAW,0,T),ae("aLineSegment",4,E.DYNAMIC_DRAW,1,q),Q.apply(void 0,["4f","uGlyphBounds"].concat(w)),Q("1f","uMaxDistance",B),Q("1f","uExponent",O),fe(te,H,function(me){E.enable(E.BLEND),E.colorMask(!0,!0,!0,!0),E.viewport(0,0,P,W),E.scissor(0,0,P,W),E.blendFunc(E.ONE,E.ONE),E.blendEquationSeparate(E.FUNC_ADD,de?E.MAX:J.MAX_EXT),E.clear(E.COLOR_BUFFER_BIT),de?E.drawArraysInstanced(E.TRIANGLES,0,3,q.length/4):re.drawArraysInstancedANGLE(E.TRIANGLES,0,3,q.length/4)})}),X("post",o,U,function(G){G.setAttribute("aUV",2,E.STATIC_DRAW,0,T),G.setUniform("1i","tex",H),E.bindFramebuffer(E.FRAMEBUFFER,I),E.disable(E.BLEND),E.colorMask(z===0,z===1,z===2,z===3),E.viewport(F,M,P,W),E.scissor(F,M,P,W),E.drawArrays(E.TRIANGLES,0,3)})}),E.isContextLost())throw L(),new Error("webgl context lost")})}function j(P){var W=!P||P===x?Y:P.canvas||P,p=K.get(W);if(p===void 0){S=!0;var w=null;try{var B=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],O=b(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,P);p=O&&B.length===O.length&&O.every(function(D,I){return D===B[I]}),p||(w="bad trial run results",console.info(B,O))}catch(D){p=!1,w=D.message}w&&console.warn("WebGL SDF generation not supported:",w),S=!1,K.set(W,p)}return p}var N=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:R,generateIntoFramebuffer:A,isSupported:j});function se(P,W,p,w,B,O){B===void 0&&(B=Math.max(w[2]-w[0],w[3]-w[1])/2),O===void 0&&(O=1);try{return b.apply(N,arguments)}catch(D){return console.info("WebGL SDF generation failed, falling back to JS",D),y.apply(v,arguments)}}function ie(P,W,p,w,B,O,D,I,F,M){B===void 0&&(B=Math.max(w[2]-w[0],w[3]-w[1])/2),O===void 0&&(O=1),I===void 0&&(I=0),F===void 0&&(F=0),M===void 0&&(M=0);try{return R.apply(N,arguments)}catch(z){return console.info("WebGL SDF generation failed, falling back to JS",z),m.apply(v,arguments)}}return r.forEachPathCommand=t,r.generate=se,r.generateIntoCanvas=ie,r.javascript=v,r.pathToLineSegments=e,r.webgl=N,r.webglUtils=h,Object.defineProperty(r,"__esModule",{value:!0}),r}({});return c}function Jn(){var c=function(r){var d={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},u={},t={};u.L=1,t[1]="L",Object.keys(d).forEach(function(L,te){u[L]=1<<te+1,t[u[L]]=L}),Object.freeze(u);var e=u.LRI|u.RLI|u.FSI,o=u.L|u.R|u.AL,a=u.B|u.S|u.WS|u.ON|u.FSI|u.LRI|u.RLI|u.PDI,n=u.BN|u.RLE|u.LRE|u.RLO|u.LRO|u.PDF,i=u.S|u.WS|u.B|e|u.PDI|n,s=null;function f(){if(!s){s=new Map;var L=function(H){if(d.hasOwnProperty(H)){var G=0;d[H].split(",").forEach(function(ae){var Q=ae.split("+"),re=Q[0],J=Q[1];re=parseInt(re,36),J=J?parseInt(J,36):0,s.set(G+=re,u[H]);for(var me=0;me<J;me++)s.set(++G,u[H])})}};for(var te in d)L(te)}}function l(L){return f(),s.get(L.codePointAt(0))||u.L}function h(L){return t[l(L)]}var y={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function m(L,te){var H=36,G=0,ae=new Map,Q=te&&new Map,re;return L.split(",").forEach(function J(me){if(me.indexOf("+")!==-1)for(var pe=+me;pe--;)J(re);else{re=me;var ee=me.split(">"),ue=ee[0],ge=ee[1];ue=String.fromCodePoint(G+=parseInt(ue,H)),ge=String.fromCodePoint(G+=parseInt(ge,H)),ae.set(ue,ge),te&&Q.set(ge,ue)}}),{map:ae,reverseMap:Q}}var g,C,v;function _(){if(!g){var L=m(y.pairs,!0),te=L.map,H=L.reverseMap;g=te,C=H,v=m(y.canonical,!1).map}}function k(L){return _(),g.get(L)||null}function U(L){return _(),C.get(L)||null}function T(L){return _(),v.get(L)||null}var x=u.L,S=u.R,Y=u.EN,K=u.ES,ne=u.ET,b=u.AN,R=u.CS,A=u.B,j=u.S,N=u.ON,se=u.BN,ie=u.NSM,P=u.AL,W=u.LRO,p=u.RLO,w=u.LRE,B=u.RLE,O=u.PDF,D=u.LRI,I=u.RLI,F=u.FSI,M=u.PDI;function z(L,te){for(var H=125,G=new Uint32Array(L.length),ae=0;ae<L.length;ae++)G[ae]=l(L[ae]);var Q=new Map;function re(Me,je){var Oe=G[Me];G[Me]=je,Q.set(Oe,Q.get(Oe)-1),Oe&a&&Q.set(a,Q.get(a)-1),Q.set(je,(Q.get(je)||0)+1),je&a&&Q.set(a,(Q.get(a)||0)+1)}for(var J=new Uint8Array(L.length),me=new Map,pe=[],ee=null,ue=0;ue<L.length;ue++)ee||pe.push(ee={start:ue,end:L.length-1,level:te==="rtl"?1:te==="ltr"?0:Wr(ue,!1)}),G[ue]&A&&(ee.end=ue,ee=null);for(var ge=B|w|p|W|e|M|O|A,ke=function(Me){return Me+(Me&1?1:2)},le=function(Me){return Me+(Me&1?2:1)},_e=0;_e<pe.length;_e++){ee=pe[_e];var ve=[{_level:ee.level,_override:0,_isolate:0}],oe=void 0,ye=0,Ue=0,Fe=0;Q.clear();for(var he=ee.start;he<=ee.end;he++){var Se=G[he];if(oe=ve[ve.length-1],Q.set(Se,(Q.get(Se)||0)+1),Se&a&&Q.set(a,(Q.get(a)||0)+1),Se&ge)if(Se&(B|w)){J[he]=oe._level;var Pe=(Se===B?le:ke)(oe._level);Pe<=H&&!ye&&!Ue?ve.push({_level:Pe,_override:0,_isolate:0}):ye||Ue++}else if(Se&(p|W)){J[he]=oe._level;var Xe=(Se===p?le:ke)(oe._level);Xe<=H&&!ye&&!Ue?ve.push({_level:Xe,_override:Se&p?S:x,_isolate:0}):ye||Ue++}else if(Se&e){Se&F&&(Se=Wr(he+1,!0)===1?I:D),J[he]=oe._level,oe._override&&re(he,oe._override);var Qe=(Se===I?le:ke)(oe._level);Qe<=H&&ye===0&&Ue===0?(Fe++,ve.push({_level:Qe,_override:0,_isolate:1,_isolInitIndex:he})):ye++}else if(Se&M){if(ye>0)ye--;else if(Fe>0){for(Ue=0;!ve[ve.length-1]._isolate;)ve.pop();var Ye=ve[ve.length-1]._isolInitIndex;Ye!=null&&(me.set(Ye,he),me.set(he,Ye)),ve.pop(),Fe--}oe=ve[ve.length-1],J[he]=oe._level,oe._override&&re(he,oe._override)}else Se&O?(ye===0&&(Ue>0?Ue--:!oe._isolate&&ve.length>1&&(ve.pop(),oe=ve[ve.length-1])),J[he]=oe._level):Se&A&&(J[he]=ee.level);else J[he]=oe._level,oe._override&&Se!==se&&re(he,oe._override)}for(var Ie=[],Be=null,Te=ee.start;Te<=ee.end;Te++){var it=G[Te];if(!(it&n)){var xe=J[Te],we=it&e,Ne=it===M;Be&&xe===Be._level?(Be._end=Te,Be._endsWithIsolInit=we):Ie.push(Be={_start:Te,_end:Te,_level:xe,_startsWithPDI:Ne,_endsWithIsolInit:we})}}for(var Le=[],be=0;be<Ie.length;be++){var De=Ie[be];if(!De._startsWithPDI||De._startsWithPDI&&!me.has(De._start)){for(var We=[Be=De],Ee=void 0;Be&&Be._endsWithIsolInit&&(Ee=me.get(Be._end))!=null;)for(var Ce=be+1;Ce<Ie.length;Ce++)if(Ie[Ce]._start===Ee){We.push(Be=Ie[Ce]);break}for(var Ge=[],He=0;He<We.length;He++)for(var ze=We[He],Ze=ze._start;Ze<=ze._end;Ze++)Ge.push(Ze);for(var bn=J[Ge[0]],Tr=ee.level,Tt=Ge[0]-1;Tt>=0;Tt--)if(!(G[Tt]&n)){Tr=J[Tt];break}var Yt=Ge[Ge.length-1],Un=J[Yt],wr=ee.level;if(!(G[Yt]&e)){for(var wt=Yt+1;wt<=ee.end;wt++)if(!(G[wt]&n)){wr=J[wt];break}}Le.push({_seqIndices:Ge,_sosType:Math.max(Tr,bn)%2?S:x,_eosType:Math.max(wr,Un)%2?S:x})}}for(var Ht=0;Ht<Le.length;Ht++){var Jt=Le[Ht],Z=Jt._seqIndices,st=Jt._sosType,_n=Jt._eosType;if(Q.get(ie))for(var xt=0;xt<Z.length;xt++){var xr=Z[xt];if(G[xr]&ie){for(var Kt=st,kt=xt-1;kt>=0;kt--)if(!(G[Z[kt]]&n)){Kt=G[Z[kt]];break}re(xr,Kt&(e|M)?N:Kt)}}if(Q.get(Y))for(var Ft=0;Ft<Z.length;Ft++){var kr=Z[Ft];if(G[kr]&Y)for(var Ct=Ft-1;Ct>=-1;Ct--){var Fr=Ct===-1?st:G[Z[Ct]];if(Fr&o){Fr===P&&re(kr,b);break}}}if(Q.get(P))for(var Qt=0;Qt<Z.length;Qt++){var Cr=Z[Qt];G[Cr]&P&&re(Cr,S)}if(Q.get(K)||Q.get(R))for(var ft=1;ft<Z.length-1;ft++){var Zt=Z[ft];if(G[Zt]&(K|R)){for(var tt=0,qt=0,$t=ft-1;$t>=0&&(tt=G[Z[$t]],!!(tt&n));$t--);for(var er=ft+1;er<Z.length&&(qt=G[Z[er]],!!(qt&n));er++);tt===qt&&(G[Zt]===K?tt===Y:tt&(Y|b))&&re(Zt,tt)}}if(Q.get(Y))for(var lt=0;lt<Z.length;lt++){var Sn=Z[lt];if(G[Sn]&Y){for(var Dt=lt-1;Dt>=0&&G[Z[Dt]]&(ne|n);Dt--)re(Z[Dt],Y);for(var At=lt+1;At<Z.length&&G[Z[At]]&(ne|n);At++)re(Z[At],Y)}}if(Q.get(ne)||Q.get(K)||Q.get(R))for(var ut=0;ut<Z.length;ut++){var Dr=Z[ut];if(G[Dr]&(ne|K|R)){re(Dr,N);for(var Et=ut-1;Et>=0&&G[Z[Et]]&n;Et--)re(Z[Et],N);for(var Mt=ut+1;Mt<Z.length&&G[Z[Mt]]&n;Mt++)re(Z[Mt],N)}}if(Q.get(Y))for(var tr=0,Ar=st;tr<Z.length;tr++){var Er=Z[tr],rr=G[Er];rr&Y?Ar===x&&re(Er,x):rr&o&&(Ar=rr)}if(Q.get(a)){var ct=S|Y|b,Mr=ct|x,Pt=[];{for(var rt=[],nt=0;nt<Z.length;nt++)if(G[Z[nt]]&a){var ht=L[Z[nt]],Pr=void 0;if(k(ht)!==null)if(rt.length<63)rt.push({char:ht,seqIndex:nt});else break;else if((Pr=U(ht))!==null)for(var dt=rt.length-1;dt>=0;dt--){var nr=rt[dt].char;if(nr===Pr||nr===U(T(ht))||k(T(nr))===ht){Pt.push([rt[dt].seqIndex,nt]),rt.length=dt;break}}}Pt.sort(function(Me,je){return Me[0]-je[0]})}for(var ar=0;ar<Pt.length;ar++){for(var Gr=Pt[ar],vt=Gr[0],Gt=Gr[1],Or=!1,Ve=0,or=vt+1;or<Gt;or++){var ir=Z[or];if(G[ir]&Mr){Or=!0;var Br=G[ir]&ct?S:x;if(Br===at(ir)){Ve=Br;break}}}if(Or&&!Ve){Ve=st;for(var sr=vt-1;sr>=0;sr--){var Ot=Z[sr];if(G[Ot]&Mr){var Lr=G[Ot]&ct?S:x;Lr!==at(Ot)?Ve=Lr:Ve=at(Ot);break}}}if(Ve){if(G[Z[vt]]=G[Z[Gt]]=Ve,Ve!==at(Z[vt])){for(var pt=vt+1;pt<Z.length;pt++)if(!(G[Z[pt]]&n)){l(L[Z[pt]])&ie&&(G[Z[pt]]=Ve);break}}if(Ve!==at(Z[Gt])){for(var gt=Gt+1;gt<Z.length;gt++)if(!(G[Z[gt]]&n)){l(L[Z[gt]])&ie&&(G[Z[gt]]=Ve);break}}}}for(var Je=0;Je<Z.length;Je++)if(G[Z[Je]]&a){for(var Rr=Je,fr=Je,lr=st,mt=Je-1;mt>=0;mt--)if(G[Z[mt]]&n)Rr=mt;else{lr=G[Z[mt]]&ct?S:x;break}for(var Ir=_n,yt=Je+1;yt<Z.length;yt++)if(G[Z[yt]]&(a|n))fr=yt;else{Ir=G[Z[yt]]&ct?S:x;break}for(var Bt=Rr;Bt<=fr;Bt++)G[Z[Bt]]=lr===Ir?lr:at(Z[Bt]);Je=fr}}}for(var Re=ee.start;Re<=ee.end;Re++){var Tn=J[Re],Lt=G[Re];if(Tn&1?Lt&(x|Y|b)&&J[Re]++:Lt&S?J[Re]++:Lt&(b|Y)&&(J[Re]+=2),Lt&n&&(J[Re]=Re===0?ee.level:J[Re-1]),Re===ee.end||l(L[Re])&(j|A))for(var Rt=Re;Rt>=0&&l(L[Rt])&i;Rt--)J[Rt]=ee.level}}return{levels:J,paragraphs:pe};function Wr(Me,je){for(var Oe=Me;Oe<L.length;Oe++){var Ke=G[Oe];if(Ke&(S|P))return 1;if(Ke&(A|x)||je&&Ke===M)return 0;if(Ke&e){var Nr=wn(Oe);Oe=Nr===-1?L.length:Nr}}return 0}function wn(Me){for(var je=1,Oe=Me+1;Oe<L.length;Oe++){var Ke=G[Oe];if(Ke&A)break;if(Ke&M){if(--je===0)return Oe}else Ke&e&&je++}return-1}function at(Me){return J[Me]&1?S:x}}var q="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",V;function E(){if(!V){var L=m(q,!0),te=L.map,H=L.reverseMap;H.forEach(function(G,ae){te.set(ae,G)}),V=te}}function de(L){return E(),V.get(L)||null}function ce(L,te,H,G){var ae=L.length;H=Math.max(0,H==null?0:+H),G=Math.min(ae-1,G==null?ae-1:+G);for(var Q=new Map,re=H;re<=G;re++)if(te[re]&1){var J=de(L[re]);J!==null&&Q.set(re,J)}return Q}function X(L,te,H,G){var ae=L.length;H=Math.max(0,H==null?0:+H),G=Math.min(ae-1,G==null?ae-1:+G);var Q=[];return te.paragraphs.forEach(function(re){var J=Math.max(H,re.start),me=Math.min(G,re.end);if(J<me){for(var pe=te.levels.slice(J,me+1),ee=me;ee>=J&&l(L[ee])&i;ee--)pe[ee]=re.level;for(var ue=re.level,ge=1/0,ke=0;ke<pe.length;ke++){var le=pe[ke];le>ue&&(ue=le),le<ge&&(ge=le|1)}for(var _e=ue;_e>=ge;_e--)for(var ve=0;ve<pe.length;ve++)if(pe[ve]>=_e){for(var oe=ve;ve+1<pe.length&&pe[ve+1]>=_e;)ve++;ve>oe&&Q.push([oe+H,ve+H])}}}),Q}function $(L,te,H,G){var ae=fe(L,te,H,G),Q=[].concat(L);return ae.forEach(function(re,J){Q[J]=(te.levels[re]&1?de(L[re]):null)||L[re]}),Q.join("")}function fe(L,te,H,G){for(var ae=X(L,te,H,G),Q=[],re=0;re<L.length;re++)Q[re]=re;return ae.forEach(function(J){for(var me=J[0],pe=J[1],ee=Q.slice(me,pe+1),ue=ee.length;ue--;)Q[pe-ue]=ee[ue]}),Q}return r.closingToOpeningBracket=U,r.getBidiCharType=l,r.getBidiCharTypeName=h,r.getCanonicalBracket=T,r.getEmbeddingLevels=z,r.getMirroredCharacter=de,r.getMirroredCharactersMap=ce,r.getReorderSegments=X,r.getReorderedIndices=fe,r.getReorderedString=$,r.openingToClosingBracket=k,Object.defineProperty(r,"__esModule",{value:!0}),r}({});return c}const ln=/\bvoid\s+main\s*\(\s*\)\s*{/g;function pr(c){const r=/^[ \t]*#include +<([\w\d./]+)>/gm;function d(u,t){let e=Dn[t];return e?pr(e):u}return c.replace(r,d)}const Ae=[];for(let c=0;c<256;c++)Ae[c]=(c<16?"0":"")+c.toString(16);function Kn(){const c=Math.random()*4294967295|0,r=Math.random()*4294967295|0,d=Math.random()*4294967295|0,u=Math.random()*4294967295|0;return(Ae[c&255]+Ae[c>>8&255]+Ae[c>>16&255]+Ae[c>>24&255]+"-"+Ae[r&255]+Ae[r>>8&255]+"-"+Ae[r>>16&15|64]+Ae[r>>24&255]+"-"+Ae[d&63|128]+Ae[d>>8&255]+"-"+Ae[d>>16&255]+Ae[d>>24&255]+Ae[u&255]+Ae[u>>8&255]+Ae[u>>16&255]+Ae[u>>24&255]).toUpperCase()}const qe=Object.assign||function(){let c=arguments[0];for(let r=1,d=arguments.length;r<d;r++){let u=arguments[r];if(u)for(let t in u)Object.prototype.hasOwnProperty.call(u,t)&&(c[t]=u[t])}return c},Qn=Date.now(),Xr=new WeakMap,Yr=new Map;let Zn=1e10;function gr(c,r){const d=ta(r);let u=Xr.get(c);if(u||Xr.set(c,u=Object.create(null)),u[d])return new u[d];const t=`_onBeforeCompile${d}`,e=function(i,s){c.onBeforeCompile.call(this,i,s);const f=this.customProgramCacheKey()+"|"+i.vertexShader+"|"+i.fragmentShader;let l=Yr[f];if(!l){const h=qn(this,i,r,d);l=Yr[f]=h}i.vertexShader=l.vertexShader,i.fragmentShader=l.fragmentShader,qe(i.uniforms,this.uniforms),r.timeUniform&&(i.uniforms[r.timeUniform]={get value(){return Date.now()-Qn}}),this[t]&&this[t](i)},o=function(){return a(r.chained?c:c.clone())},a=function(i){const s=Object.create(i,n);return Object.defineProperty(s,"baseMaterial",{value:c}),Object.defineProperty(s,"id",{value:Zn++}),s.uuid=Kn(),s.uniforms=qe({},i.uniforms,r.uniforms),s.defines=qe({},i.defines,r.defines),s.defines[`TROIKA_DERIVED_MATERIAL_${d}`]="",s.extensions=qe({},i.extensions,r.extensions),s._listeners=void 0,s},n={constructor:{value:o},isDerivedMaterial:{value:!0},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return c.customProgramCacheKey()+"|"+d}},onBeforeCompile:{get(){return e},set(i){this[t]=i}},copy:{writable:!0,configurable:!0,value:function(i){return c.copy.call(this,i),!c.isShaderMaterial&&!c.isDerivedMaterial&&(qe(this.extensions,i.extensions),qe(this.defines,i.defines),qe(this.uniforms,xn.clone(i.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const i=new c.constructor;return a(i).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let i=this._depthMaterial;return i||(i=this._depthMaterial=gr(c.isDerivedMaterial?c.getDepthMaterial():new kn({depthPacking:Fn}),r),i.defines.IS_DEPTH_MATERIAL="",i.uniforms=this.uniforms),i}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let i=this._distanceMaterial;return i||(i=this._distanceMaterial=gr(c.isDerivedMaterial?c.getDistanceMaterial():new Cn,r),i.defines.IS_DISTANCE_MATERIAL="",i.uniforms=this.uniforms),i}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:i,_distanceMaterial:s}=this;i&&i.dispose(),s&&s.dispose(),c.dispose.call(this)}}};return u[d]=o,new o}function qn(c,{vertexShader:r,fragmentShader:d},u,t){let{vertexDefs:e,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:n,fragmentDefs:i,fragmentMainIntro:s,fragmentMainOutro:f,fragmentColorTransform:l,customRewriter:h,timeUniform:y}=u;if(e=e||"",o=o||"",a=a||"",i=i||"",s=s||"",f=f||"",(n||h)&&(r=pr(r)),(l||h)&&(d=d.replace(/^[ \t]*#include <((?:tonemapping|encodings|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
10
+ //!BEGIN_POST_CHUNK $1
11
+ $&
12
+ //!END_POST_CHUNK
13
+ `),d=pr(d)),h){let m=h({vertexShader:r,fragmentShader:d});r=m.vertexShader,d=m.fragmentShader}if(l){let m=[];d=d.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,g=>(m.push(g),"")),f=`${l}
14
+ ${m.join(`
15
+ `)}
16
+ ${f}`}if(y){const m=`
17
+ uniform float ${y};
18
+ `;e=m+e,i=m+i}return n&&(r=`vec3 troika_position_${t};
19
+ vec3 troika_normal_${t};
20
+ vec2 troika_uv_${t};
21
+ ${r}
22
+ `,e=`${e}
23
+ void troikaVertexTransform${t}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
24
+ ${n}
25
+ }
26
+ `,o=`
27
+ troika_position_${t} = vec3(position);
28
+ troika_normal_${t} = vec3(normal);
29
+ troika_uv_${t} = vec2(uv);
30
+ troikaVertexTransform${t}(troika_position_${t}, troika_normal_${t}, troika_uv_${t});
31
+ ${o}
32
+ `,r=r.replace(/\b(position|normal|uv)\b/g,(m,g,C,v)=>/\battribute\s+vec[23]\s+$/.test(v.substr(0,C))?g:`troika_${g}_${t}`),c.map&&c.map.channel>0||(r=r.replace(/\bMAP_UV\b/g,`troika_uv_${t}`))),r=Hr(r,t,e,o,a),d=Hr(d,t,i,s,f),{vertexShader:r,fragmentShader:d}}function Hr(c,r,d,u,t){return(u||t||d)&&(c=c.replace(ln,`
33
+ ${d}
34
+ void troikaOrigMain${r}() {`),c+=`
35
+ void main() {
36
+ ${u}
37
+ troikaOrigMain${r}();
38
+ ${t}
39
+ }`),c}function $n(c,r){return c==="uniforms"?void 0:typeof r=="function"?r.toString():r}let ea=0;const Jr=new Map;function ta(c){const r=JSON.stringify(c,$n);let d=Jr.get(r);return d==null&&Jr.set(r,d=++ea),d}function ra(c,r,d){const{defaultFontURL:u}=d,t=Object.create(null),e=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",n=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function i(v,_){function k(){const U=T=>{console.error(`Failure loading font ${v}${v===u?"":"; trying fallback"}`,T),v!==u&&(v=u,k())};try{const T=new XMLHttpRequest;T.open("get",v,!0),T.responseType="arraybuffer",T.onload=function(){if(T.status>=400)U(new Error(T.statusText));else if(T.status>0)try{const x=c(T.response);_(x)}catch(x){U(x)}},T.onerror=U,T.send()}catch(T){U(T)}}k()}function s(v,_){v||(v=u);let k=t[v];k?k.pending?k.pending.push(_):_(k):(t[v]={pending:[_]},i(v,U=>{let T=t[v].pending;t[v]=U,T.forEach(x=>x(U))}))}function f({text:v="",font:_=u,sdfGlyphSize:k=64,fontSize:U=1,letterSpacing:T=0,lineHeight:x="normal",maxWidth:S=e,direction:Y,textAlign:K="left",textIndent:ne=0,whiteSpace:b="normal",overflowWrap:R="normal",anchorX:A=0,anchorY:j=0,includeCaretPositions:N=!1,chunkedBoundsSize:se=8192,colorRanges:ie=null},P,W=!1){const p=m(),w={fontLoad:0,typesetting:0};v.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),v=v.replace(/\r\n/g,`
40
+ `).replace(/\r/g,`
41
+ `)),U=+U,T=+T,S=+S,x=x||"normal",ne=+ne,s(_,B=>{const O=isFinite(S);let D=null,I=null,F=null,M=null,z=null,q=null,V=null,E=0,de=0,ce=b!=="nowrap";const{ascender:X,descender:$,unitsPerEm:fe,lineGap:L,capHeight:te,xHeight:H}=B;w.fontLoad=m()-p;const G=m(),ae=U/fe;x==="normal"&&(x=(X-$+L)/fe),x=x*U;const Q=(x-(X-$)*ae)/2,re=-(X*ae+Q),J=Math.min(x,(X-$)*ae),me=(X+$)/2*ae-J/2;let pe=ne,ee=new g;const ue=[ee];B.forEachGlyph(v,U,T,(le,_e,ve)=>{const oe=v.charAt(ve),ye=le.advanceWidth*ae,Ue=ee.count;let Fe;if("isEmpty"in le||(le.isWhitespace=!!oe&&new RegExp(a).test(oe),le.canBreakAfter=!!oe&&n.test(oe),le.isEmpty=le.xMin===le.xMax||le.yMin===le.yMax||o.test(oe)),!le.isWhitespace&&!le.isEmpty&&de++,ce&&O&&!le.isWhitespace&&_e+ye+pe>S&&Ue){if(ee.glyphAt(Ue-1).glyphObj.canBreakAfter)Fe=new g,pe=-_e;else for(let Se=Ue;Se--;)if(Se===0&&R==="break-word"){Fe=new g,pe=-_e;break}else if(ee.glyphAt(Se).glyphObj.canBreakAfter){Fe=ee.splitAt(Se+1);const Pe=Fe.glyphAt(0).x;pe-=Pe;for(let Xe=Fe.count;Xe--;)Fe.glyphAt(Xe).x-=Pe;break}Fe&&(ee.isSoftWrapped=!0,ee=Fe,ue.push(ee),E=S)}let he=ee.glyphAt(ee.count);he.glyphObj=le,he.x=_e+pe,he.width=ye,he.charIndex=ve,oe===`
42
+ `&&(ee=new g,ue.push(ee),pe=-(_e+ye+T*U)+ne)}),ue.forEach(le=>{for(let _e=le.count;_e--;){let{glyphObj:ve,x:oe,width:ye}=le.glyphAt(_e);if(!ve.isWhitespace){le.width=oe+ye,le.width>E&&(E=le.width);return}}});let ge=0,ke=0;if(A&&(typeof A=="number"?ge=-A:typeof A=="string"&&(ge=-E*(A==="left"?0:A==="center"?.5:A==="right"?1:h(A)))),j){if(typeof j=="number")ke=-j;else if(typeof j=="string"){let le=ue.length*x;ke=j==="top"?0:j==="top-baseline"?-re:j==="top-cap"?-re-te*ae:j==="top-ex"?-re-H*ae:j==="middle"?le/2:j==="bottom"?le:j==="bottom-baseline"?le-Q+$*ae:h(j)*le}}if(!W){const le=r.getEmbeddingLevels(v,Y);D=new Uint16Array(de),I=new Float32Array(de*2),F={},q=[e,e,-e,-e],V=[];let _e=re;N&&(z=new Float32Array(v.length*3)),ie&&(M=new Uint8Array(de*3));let ve=0,oe=-1,ye=-1,Ue,Fe;if(ue.forEach((he,Se)=>{let{count:Pe,width:Xe}=he;if(Pe>0){let Qe=0;for(let xe=Pe;xe--&&he.glyphAt(xe).glyphObj.isWhitespace;)Qe++;let Ye=0,Ie=0;if(K==="center")Ye=(E-Xe)/2;else if(K==="right")Ye=E-Xe;else if(K==="justify"&&he.isSoftWrapped){let xe=0;for(let we=Pe-Qe;we--;)he.glyphAt(we).glyphObj.isWhitespace&&xe++;Ie=(E-Xe)/xe}if(Ie||Ye){let xe=0;for(let we=0;we<Pe;we++){let Ne=he.glyphAt(we);const Le=Ne.glyphObj;Ne.x+=Ye+xe,Ie!==0&&Le.isWhitespace&&we<Pe-Qe&&(xe+=Ie,Ne.width+=Ie)}}const Be=r.getReorderSegments(v,le,he.glyphAt(0).charIndex,he.glyphAt(he.count-1).charIndex);for(let xe=0;xe<Be.length;xe++){const[we,Ne]=Be[xe];let Le=1/0,be=-1/0;for(let De=0;De<Pe;De++)if(he.glyphAt(De).charIndex>=we){let We=De,Ee=De;for(;Ee<Pe;Ee++){let Ce=he.glyphAt(Ee);if(Ce.charIndex>Ne)break;Ee<Pe-Qe&&(Le=Math.min(Le,Ce.x),be=Math.max(be,Ce.x+Ce.width))}for(let Ce=We;Ce<Ee;Ce++){const Ge=he.glyphAt(Ce);Ge.x=be-(Ge.x+Ge.width-Le)}break}}let Te;const it=xe=>Te=xe;for(let xe=0;xe<Pe;xe++){let we=he.glyphAt(xe);Te=we.glyphObj;const Ne=Te.index,Le=le.levels[we.charIndex]&1;if(Le){const be=r.getMirroredCharacter(v[we.charIndex]);be&&B.forEachGlyph(be,0,0,it)}if(N){const{charIndex:be}=we,De=we.x+ge,We=we.x+we.width+ge;z[be*3]=Le?We:De,z[be*3+1]=Le?De:We,z[be*3+2]=_e+me+ke;const Ee=be-oe;Ee>1&&y(z,oe,Ee),oe=be}if(ie){const{charIndex:be}=we;for(;be>ye;)ye++,ie.hasOwnProperty(ye)&&(Fe=ie[ye])}if(!Te.isWhitespace&&!Te.isEmpty){const be=ve++;F[Ne]||(F[Ne]={path:Te.path,pathBounds:[Te.xMin,Te.yMin,Te.xMax,Te.yMax]});const De=we.x+ge,We=_e+ke;I[be*2]=De,I[be*2+1]=We;const Ee=De+Te.xMin*ae,Ce=We+Te.yMin*ae,Ge=De+Te.xMax*ae,He=We+Te.yMax*ae;Ee<q[0]&&(q[0]=Ee),Ce<q[1]&&(q[1]=Ce),Ge>q[2]&&(q[2]=Ge),He>q[3]&&(q[3]=He),be%se===0&&(Ue={start:be,end:be,rect:[e,e,-e,-e]},V.push(Ue)),Ue.end++;const ze=Ue.rect;if(Ee<ze[0]&&(ze[0]=Ee),Ce<ze[1]&&(ze[1]=Ce),Ge>ze[2]&&(ze[2]=Ge),He>ze[3]&&(ze[3]=He),D[be]=Ne,ie){const Ze=be*3;M[Ze]=Fe>>16&255,M[Ze+1]=Fe>>8&255,M[Ze+2]=Fe&255}}}}_e-=x}),z){const he=v.length-oe;he>1&&y(z,oe,he)}}w.typesetting=m()-G,P({glyphIds:D,glyphPositions:I,glyphData:F,caretPositions:z,caretHeight:J,glyphColors:M,chunkedBounds:V,fontSize:U,unitsPerEm:fe,ascender:X*ae,descender:$*ae,capHeight:te*ae,xHeight:H*ae,lineHeight:x,topBaseline:re,blockBounds:[ge,ke-ue.length*x,ge+E,ke],visibleBounds:q,timings:w})})}function l(v,_){f(v,k=>{const[U,T,x,S]=k.blockBounds;_({width:x-U,height:S-T})},{metricsOnly:!0})}function h(v){let _=v.match(/^([\d.]+)%$/),k=_?parseFloat(_[1]):NaN;return isNaN(k)?0:k/100}function y(v,_,k){const U=v[_*3],T=v[_*3+1],x=v[_*3+2],S=(T-U)/k;for(let Y=0;Y<k;Y++){const K=(_+Y)*3;v[K]=U+S*Y,v[K+1]=U+S*(Y+1),v[K+2]=x}}function m(){return(self.performance||Date).now()}function g(){this.data=[]}const C=["glyphObj","x","width","charIndex"];return g.prototype={width:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/C.length)},glyphAt(v){let _=g.flyweight;return _.data=this.data,_.index=v,_},splitAt(v){let _=new g;return _.data=this.data.splice(v*C.length),_}},g.flyweight=C.reduce((v,_,k,U)=>(Object.defineProperty(v,_,{get(){return this.data[this.index*C.length+k]},set(T){this.data[this.index*C.length+k]=T}}),v),{data:null,index:0}),{typeset:f,measure:l,loadFont:s}}const et=()=>(self.performance||Date).now(),Xt=fn();let Kr;function na(c,r,d,u,t,e,o,a,n,i,s=!0){return s?oa(c,r,d,u,t,e,o,a,n,i).then(null,f=>(Kr||(console.warn("WebGL SDF generation failed, falling back to JS",f),Kr=!0),Zr(c,r,d,u,t,e,o,a,n,i))):Zr(c,r,d,u,t,e,o,a,n,i)}const zt=[],aa=5;let mr=0;function un(){const c=et();for(;zt.length&&et()-c<aa;)zt.shift()();mr=zt.length?setTimeout(un,0):0}const oa=(...c)=>new Promise((r,d)=>{zt.push(()=>{const u=et();try{Xt.webgl.generateIntoCanvas(...c),r({timing:et()-u})}catch(t){d(t)}}),mr||(mr=setTimeout(un,0))}),ia=4,sa=2e3,Qr={};let fa=0;function Zr(c,r,d,u,t,e,o,a,n,i){const s="TroikaTextSDFGenerator_JS_"+fa++%ia;let f=Qr[s];return f||(f=Qr[s]={workerModule:St({name:s,workerId:s,dependencies:[fn,et],init(l,h){const y=l().javascript.generate;return function(...m){const g=h();return{textureData:y(...m),timing:h()-g}}},getTransferables(l){return[l.textureData.buffer]}}),requests:0,idleTimer:null}),f.requests++,clearTimeout(f.idleTimer),f.workerModule(c,r,d,u,t,e).then(({textureData:l,timing:h})=>{const y=et(),m=new Uint8Array(l.length*4);for(let g=0;g<l.length;g++)m[g*4+i]=l[g];return Xt.webglUtils.renderImageData(o,m,a,n,c,r,1<<3-i),h+=et()-y,--f.requests===0&&(f.idleTimer=setTimeout(()=>{Yn(s)},sa)),{timing:h}})}function la(c){c._warm||(Xt.webgl.isSupported(c),c._warm=!0)}const ua=Xt.webglUtils.resizeWebGLCanvasWithoutClearing;/*!
43
+ Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
44
+ Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
45
+ */function ca(){return typeof window>"u"&&(self.window=self),function(c){var r={parse:function(t){var e=r._bin,o=new Uint8Array(t);if(e.readASCII(o,0,4)=="ttcf"){var a=4;e.readUshort(o,a),a+=2,e.readUshort(o,a),a+=2;var n=e.readUint(o,a);a+=4;for(var i=[],s=0;s<n;s++){var f=e.readUint(o,a);a+=4,i.push(r._readFont(o,f))}return i}return[r._readFont(o,0)]},_readFont:function(t,e){var o=r._bin,a=e;o.readFixed(t,e),e+=4;var n=o.readUshort(t,e);e+=2,o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2;for(var i=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GPOS","GSUB","SVG "],s={_data:t,_offset:a},f={},l=0;l<n;l++){var h=o.readASCII(t,e,4);e+=4,o.readUint(t,e),e+=4;var y=o.readUint(t,e);e+=4;var m=o.readUint(t,e);e+=4,f[h]={offset:y,length:m}}for(l=0;l<i.length;l++){var g=i[l];f[g]&&(s[g.trim()]=r[g.trim()].parse(t,f[g].offset,f[g].length,s))}return s},_tabOffset:function(t,e,o){for(var a=r._bin,n=a.readUshort(t,o+4),i=o+12,s=0;s<n;s++){var f=a.readASCII(t,i,4);i+=4,a.readUint(t,i),i+=4;var l=a.readUint(t,i);if(i+=4,a.readUint(t,i),i+=4,f==e)return l}return 0}};r._bin={readFixed:function(t,e){return(t[e]<<8|t[e+1])+(t[e+2]<<8|t[e+3])/65540},readF2dot14:function(t,e){return r._bin.readShort(t,e)/16384},readInt:function(t,e){return r._bin._view(t).getInt32(e)},readInt8:function(t,e){return r._bin._view(t).getInt8(e)},readShort:function(t,e){return r._bin._view(t).getInt16(e)},readUshort:function(t,e){return r._bin._view(t).getUint16(e)},readUshorts:function(t,e,o){for(var a=[],n=0;n<o;n++)a.push(r._bin.readUshort(t,e+2*n));return a},readUint:function(t,e){return r._bin._view(t).getUint32(e)},readUint64:function(t,e){return 4294967296*r._bin.readUint(t,e)+r._bin.readUint(t,e+4)},readASCII:function(t,e,o){for(var a="",n=0;n<o;n++)a+=String.fromCharCode(t[e+n]);return a},readUnicode:function(t,e,o){for(var a="",n=0;n<o;n++){var i=t[e++]<<8|t[e++];a+=String.fromCharCode(i)}return a},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(t,e,o){var a=r._bin._tdec;return a&&e==0&&o==t.length?a.decode(t):r._bin.readASCII(t,e,o)},readBytes:function(t,e,o){for(var a=[],n=0;n<o;n++)a.push(t[e+n]);return a},readASCIIArray:function(t,e,o){for(var a=[],n=0;n<o;n++)a.push(String.fromCharCode(t[e+n]));return a},_view:function(t){return t._dataView||(t._dataView=t.buffer?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(new Uint8Array(t).buffer))}},r._lctf={},r._lctf.parse=function(t,e,o,a,n){var i=r._bin,s={},f=e;i.readFixed(t,e),e+=4;var l=i.readUshort(t,e);e+=2;var h=i.readUshort(t,e);e+=2;var y=i.readUshort(t,e);return e+=2,s.scriptList=r._lctf.readScriptList(t,f+l),s.featureList=r._lctf.readFeatureList(t,f+h),s.lookupList=r._lctf.readLookupList(t,f+y,n),s},r._lctf.readLookupList=function(t,e,o){var a=r._bin,n=e,i=[],s=a.readUshort(t,e);e+=2;for(var f=0;f<s;f++){var l=a.readUshort(t,e);e+=2;var h=r._lctf.readLookupTable(t,n+l,o);i.push(h)}return i},r._lctf.readLookupTable=function(t,e,o){var a=r._bin,n=e,i={tabs:[]};i.ltype=a.readUshort(t,e),e+=2,i.flag=a.readUshort(t,e),e+=2;var s=a.readUshort(t,e);e+=2;for(var f=i.ltype,l=0;l<s;l++){var h=a.readUshort(t,e);e+=2;var y=o(t,f,n+h,i);i.tabs.push(y)}return i},r._lctf.numOfOnes=function(t){for(var e=0,o=0;o<32;o++)t>>>o&1&&e++;return e},r._lctf.readClassDef=function(t,e){var o=r._bin,a=[],n=o.readUshort(t,e);if(e+=2,n==1){var i=o.readUshort(t,e);e+=2;var s=o.readUshort(t,e);e+=2;for(var f=0;f<s;f++)a.push(i+f),a.push(i+f),a.push(o.readUshort(t,e)),e+=2}if(n==2){var l=o.readUshort(t,e);for(e+=2,f=0;f<l;f++)a.push(o.readUshort(t,e)),e+=2,a.push(o.readUshort(t,e)),e+=2,a.push(o.readUshort(t,e)),e+=2}return a},r._lctf.getInterval=function(t,e){for(var o=0;o<t.length;o+=3){var a=t[o],n=t[o+1];if(t[o+2],a<=e&&e<=n)return o}return-1},r._lctf.readCoverage=function(t,e){var o=r._bin,a={};a.fmt=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);return e+=2,a.fmt==1&&(a.tab=o.readUshorts(t,e,n)),a.fmt==2&&(a.tab=o.readUshorts(t,e,3*n)),a},r._lctf.coverageIndex=function(t,e){var o=t.tab;if(t.fmt==1)return o.indexOf(e);if(t.fmt==2){var a=r._lctf.getInterval(o,e);if(a!=-1)return o[a+2]+(e-o[a])}return-1},r._lctf.readFeatureList=function(t,e){var o=r._bin,a=e,n=[],i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var f=o.readASCII(t,e,4);e+=4;var l=o.readUshort(t,e);e+=2;var h=r._lctf.readFeatureTable(t,a+l);h.tag=f.trim(),n.push(h)}return n},r._lctf.readFeatureTable=function(t,e){var o=r._bin,a=e,n={},i=o.readUshort(t,e);e+=2,i>0&&(n.featureParams=a+i);var s=o.readUshort(t,e);e+=2,n.tab=[];for(var f=0;f<s;f++)n.tab.push(o.readUshort(t,e+2*f));return n},r._lctf.readScriptList=function(t,e){var o=r._bin,a=e,n={},i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var f=o.readASCII(t,e,4);e+=4;var l=o.readUshort(t,e);e+=2,n[f.trim()]=r._lctf.readScriptTable(t,a+l)}return n},r._lctf.readScriptTable=function(t,e){var o=r._bin,a=e,n={},i=o.readUshort(t,e);e+=2,n.default=r._lctf.readLangSysTable(t,a+i);var s=o.readUshort(t,e);e+=2;for(var f=0;f<s;f++){var l=o.readASCII(t,e,4);e+=4;var h=o.readUshort(t,e);e+=2,n[l.trim()]=r._lctf.readLangSysTable(t,a+h)}return n},r._lctf.readLangSysTable=function(t,e){var o=r._bin,a={};o.readUshort(t,e),e+=2,a.reqFeature=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);return e+=2,a.features=o.readUshorts(t,e,n),a},r.CFF={},r.CFF.parse=function(t,e,o){var a=r._bin;(t=new Uint8Array(t.buffer,e,o))[e=0],t[++e],t[++e],t[++e],e++;var n=[];e=r.CFF.readIndex(t,e,n);for(var i=[],s=0;s<n.length-1;s++)i.push(a.readASCII(t,e+n[s],n[s+1]-n[s]));e+=n[n.length-1];var f=[];e=r.CFF.readIndex(t,e,f);var l=[];for(s=0;s<f.length-1;s++)l.push(r.CFF.readDict(t,e+f[s],e+f[s+1]));e+=f[f.length-1];var h=l[0],y=[];e=r.CFF.readIndex(t,e,y);var m=[];for(s=0;s<y.length-1;s++)m.push(a.readASCII(t,e+y[s],y[s+1]-y[s]));if(e+=y[y.length-1],r.CFF.readSubrs(t,e,h),h.CharStrings){e=h.CharStrings,y=[],e=r.CFF.readIndex(t,e,y);var g=[];for(s=0;s<y.length-1;s++)g.push(a.readBytes(t,e+y[s],y[s+1]-y[s]));h.CharStrings=g}if(h.ROS){e=h.FDArray;var C=[];for(e=r.CFF.readIndex(t,e,C),h.FDArray=[],s=0;s<C.length-1;s++){var v=r.CFF.readDict(t,e+C[s],e+C[s+1]);r.CFF._readFDict(t,v,m),h.FDArray.push(v)}e+=C[C.length-1],e=h.FDSelect,h.FDSelect=[];var _=t[e];if(e++,_!=3)throw _;var k=a.readUshort(t,e);for(e+=2,s=0;s<k+1;s++)h.FDSelect.push(a.readUshort(t,e),t[e+2]),e+=3}return h.Encoding&&(h.Encoding=r.CFF.readEncoding(t,h.Encoding,h.CharStrings.length)),h.charset&&(h.charset=r.CFF.readCharset(t,h.charset,h.CharStrings.length)),r.CFF._readFDict(t,h,m),h},r.CFF._readFDict=function(t,e,o){var a;for(var n in e.Private&&(a=e.Private[1],e.Private=r.CFF.readDict(t,a,a+e.Private[0]),e.Private.Subrs&&r.CFF.readSubrs(t,a+e.Private.Subrs,e.Private)),e)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(n)!=-1&&(e[n]=o[e[n]-426+35])},r.CFF.readSubrs=function(t,e,o){var a=r._bin,n=[];e=r.CFF.readIndex(t,e,n);var i,s=n.length;i=s<1240?107:s<33900?1131:32768,o.Bias=i,o.Subrs=[];for(var f=0;f<n.length-1;f++)o.Subrs.push(a.readBytes(t,e+n[f],n[f+1]-n[f]))},r.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],r.CFF.glyphByUnicode=function(t,e){for(var o=0;o<t.charset.length;o++)if(t.charset[o]==e)return o;return-1},r.CFF.glyphBySE=function(t,e){return e<0||e>255?-1:r.CFF.glyphByUnicode(t,r.CFF.tableSE[e])},r.CFF.readEncoding=function(t,e,o){r._bin;var a=[".notdef"],n=t[e];if(e++,n!=0)throw"error: unknown encoding format: "+n;var i=t[e];e++;for(var s=0;s<i;s++)a.push(t[e+s]);return a},r.CFF.readCharset=function(t,e,o){var a=r._bin,n=[".notdef"],i=t[e];if(e++,i==0)for(var s=0;s<o;s++){var f=a.readUshort(t,e);e+=2,n.push(f)}else{if(i!=1&&i!=2)throw"error: format: "+i;for(;n.length<o;){f=a.readUshort(t,e),e+=2;var l=0;for(i==1?(l=t[e],e++):(l=a.readUshort(t,e),e+=2),s=0;s<=l;s++)n.push(f),f++}}return n},r.CFF.readIndex=function(t,e,o){var a=r._bin,n=a.readUshort(t,e)+1,i=t[e+=2];if(e++,i==1)for(var s=0;s<n;s++)o.push(t[e+s]);else if(i==2)for(s=0;s<n;s++)o.push(a.readUshort(t,e+2*s));else if(i==3)for(s=0;s<n;s++)o.push(16777215&a.readUint(t,e+3*s-1));else if(n!=1)throw"unsupported offset size: "+i+", count: "+n;return(e+=n*i)-1},r.CFF.getCharString=function(t,e,o){var a=r._bin,n=t[e],i=t[e+1];t[e+2],t[e+3],t[e+4];var s=1,f=null,l=null;n<=20&&(f=n,s=1),n==12&&(f=100*n+i,s=2),21<=n&&n<=27&&(f=n,s=1),n==28&&(l=a.readShort(t,e+1),s=3),29<=n&&n<=31&&(f=n,s=1),32<=n&&n<=246&&(l=n-139,s=1),247<=n&&n<=250&&(l=256*(n-247)+i+108,s=2),251<=n&&n<=254&&(l=256*-(n-251)-i-108,s=2),n==255&&(l=a.readInt(t,e+1)/65535,s=5),o.val=l??"o"+f,o.size=s},r.CFF.readCharString=function(t,e,o){for(var a=e+o,n=r._bin,i=[];e<a;){var s=t[e],f=t[e+1];t[e+2],t[e+3],t[e+4];var l=1,h=null,y=null;s<=20&&(h=s,l=1),s==12&&(h=100*s+f,l=2),s!=19&&s!=20||(h=s,l=2),21<=s&&s<=27&&(h=s,l=1),s==28&&(y=n.readShort(t,e+1),l=3),29<=s&&s<=31&&(h=s,l=1),32<=s&&s<=246&&(y=s-139,l=1),247<=s&&s<=250&&(y=256*(s-247)+f+108,l=2),251<=s&&s<=254&&(y=256*-(s-251)-f-108,l=2),s==255&&(y=n.readInt(t,e+1)/65535,l=5),i.push(y??"o"+h),e+=l}return i},r.CFF.readDict=function(t,e,o){for(var a=r._bin,n={},i=[];e<o;){var s=t[e],f=t[e+1];t[e+2],t[e+3],t[e+4];var l=1,h=null,y=null;if(s==28&&(y=a.readShort(t,e+1),l=3),s==29&&(y=a.readInt(t,e+1),l=5),32<=s&&s<=246&&(y=s-139,l=1),247<=s&&s<=250&&(y=256*(s-247)+f+108,l=2),251<=s&&s<=254&&(y=256*-(s-251)-f-108,l=2),s==255)throw y=a.readInt(t,e+1)/65535,l=5,"unknown number";if(s==30){var m=[];for(l=1;;){var g=t[e+l];l++;var C=g>>4,v=15&g;if(C!=15&&m.push(C),v!=15&&m.push(v),v==15)break}for(var _="",k=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],U=0;U<m.length;U++)_+=k[m[U]];y=parseFloat(_)}s<=21&&(h=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][s],l=1,s==12&&(h=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][f],l=2)),h!=null?(n[h]=i.length==1?i[0]:i,i=[]):i.push(y),e+=l}return n},r.cmap={},r.cmap.parse=function(t,e,o){t=new Uint8Array(t.buffer,e,o),e=0;var a=r._bin,n={};a.readUshort(t,e),e+=2;var i=a.readUshort(t,e);e+=2;var s=[];n.tables=[];for(var f=0;f<i;f++){var l=a.readUshort(t,e);e+=2;var h=a.readUshort(t,e);e+=2;var y=a.readUint(t,e);e+=4;var m="p"+l+"e"+h,g=s.indexOf(y);if(g==-1){var C;g=n.tables.length,s.push(y);var v=a.readUshort(t,y);v==0?C=r.cmap.parse0(t,y):v==4?C=r.cmap.parse4(t,y):v==6?C=r.cmap.parse6(t,y):v==12?C=r.cmap.parse12(t,y):console.debug("unknown format: "+v,l,h,y),n.tables.push(C)}if(n[m]!=null)throw"multiple tables for one platform+encoding";n[m]=g}return n},r.cmap.parse0=function(t,e){var o=r._bin,a={};a.format=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);e+=2,o.readUshort(t,e),e+=2,a.map=[];for(var i=0;i<n-6;i++)a.map.push(t[e+i]);return a},r.cmap.parse4=function(t,e){var o=r._bin,a=e,n={};n.format=o.readUshort(t,e),e+=2;var i=o.readUshort(t,e);e+=2,o.readUshort(t,e),e+=2;var s=o.readUshort(t,e);e+=2;var f=s/2;n.searchRange=o.readUshort(t,e),e+=2,n.entrySelector=o.readUshort(t,e),e+=2,n.rangeShift=o.readUshort(t,e),e+=2,n.endCount=o.readUshorts(t,e,f),e+=2*f,e+=2,n.startCount=o.readUshorts(t,e,f),e+=2*f,n.idDelta=[];for(var l=0;l<f;l++)n.idDelta.push(o.readShort(t,e)),e+=2;for(n.idRangeOffset=o.readUshorts(t,e,f),e+=2*f,n.glyphIdArray=[];e<a+i;)n.glyphIdArray.push(o.readUshort(t,e)),e+=2;return n},r.cmap.parse6=function(t,e){var o=r._bin,a={};a.format=o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2,o.readUshort(t,e),e+=2,a.firstCode=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);e+=2,a.glyphIdArray=[];for(var i=0;i<n;i++)a.glyphIdArray.push(o.readUshort(t,e)),e+=2;return a},r.cmap.parse12=function(t,e){var o=r._bin,a={};a.format=o.readUshort(t,e),e+=2,e+=2,o.readUint(t,e),e+=4,o.readUint(t,e),e+=4;var n=o.readUint(t,e);e+=4,a.groups=[];for(var i=0;i<n;i++){var s=e+12*i,f=o.readUint(t,s+0),l=o.readUint(t,s+4),h=o.readUint(t,s+8);a.groups.push([f,l,h])}return a},r.glyf={},r.glyf.parse=function(t,e,o,a){for(var n=[],i=0;i<a.maxp.numGlyphs;i++)n.push(null);return n},r.glyf._parseGlyf=function(t,e){var o=r._bin,a=t._data,n=r._tabOffset(a,"glyf",t._offset)+t.loca[e];if(t.loca[e]==t.loca[e+1])return null;var i={};if(i.noc=o.readShort(a,n),n+=2,i.xMin=o.readShort(a,n),n+=2,i.yMin=o.readShort(a,n),n+=2,i.xMax=o.readShort(a,n),n+=2,i.yMax=o.readShort(a,n),n+=2,i.xMin>=i.xMax||i.yMin>=i.yMax)return null;if(i.noc>0){i.endPts=[];for(var s=0;s<i.noc;s++)i.endPts.push(o.readUshort(a,n)),n+=2;var f=o.readUshort(a,n);if(n+=2,a.length-n<f)return null;i.instructions=o.readBytes(a,n,f),n+=f;var l=i.endPts[i.noc-1]+1;for(i.flags=[],s=0;s<l;s++){var h=a[n];if(n++,i.flags.push(h),(8&h)!=0){var y=a[n];n++;for(var m=0;m<y;m++)i.flags.push(h),s++}}for(i.xs=[],s=0;s<l;s++){var g=(2&i.flags[s])!=0,C=(16&i.flags[s])!=0;g?(i.xs.push(C?a[n]:-a[n]),n++):C?i.xs.push(0):(i.xs.push(o.readShort(a,n)),n+=2)}for(i.ys=[],s=0;s<l;s++)g=(4&i.flags[s])!=0,C=(32&i.flags[s])!=0,g?(i.ys.push(C?a[n]:-a[n]),n++):C?i.ys.push(0):(i.ys.push(o.readShort(a,n)),n+=2);var v=0,_=0;for(s=0;s<l;s++)v+=i.xs[s],_+=i.ys[s],i.xs[s]=v,i.ys[s]=_}else{var k;i.parts=[];do{k=o.readUshort(a,n),n+=2;var U={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(i.parts.push(U),U.glyphIndex=o.readUshort(a,n),n+=2,1&k){var T=o.readShort(a,n);n+=2;var x=o.readShort(a,n);n+=2}else T=o.readInt8(a,n),n++,x=o.readInt8(a,n),n++;2&k?(U.m.tx=T,U.m.ty=x):(U.p1=T,U.p2=x),8&k?(U.m.a=U.m.d=o.readF2dot14(a,n),n+=2):64&k?(U.m.a=o.readF2dot14(a,n),n+=2,U.m.d=o.readF2dot14(a,n),n+=2):128&k&&(U.m.a=o.readF2dot14(a,n),n+=2,U.m.b=o.readF2dot14(a,n),n+=2,U.m.c=o.readF2dot14(a,n),n+=2,U.m.d=o.readF2dot14(a,n),n+=2)}while(32&k);if(256&k){var S=o.readUshort(a,n);for(n+=2,i.instr=[],s=0;s<S;s++)i.instr.push(a[n]),n++}}return i},r.GPOS={},r.GPOS.parse=function(t,e,o,a){return r._lctf.parse(t,e,o,a,r.GPOS.subt)},r.GPOS.subt=function(t,e,o,a){var n=r._bin,i=o,s={};if(s.fmt=n.readUshort(t,o),o+=2,e==1||e==2||e==3||e==7||e==8&&s.fmt<=2){var f=n.readUshort(t,o);o+=2,s.coverage=r._lctf.readCoverage(t,f+i)}if(e==1&&s.fmt==1){var l=n.readUshort(t,o);o+=2;var h=r._lctf.numOfOnes(l);l!=0&&(s.pos=r.GPOS.readValueRecord(t,o,l))}else if(e==2&&s.fmt>=1&&s.fmt<=2){l=n.readUshort(t,o),o+=2;var y=n.readUshort(t,o);o+=2,h=r._lctf.numOfOnes(l);var m=r._lctf.numOfOnes(y);if(s.fmt==1){s.pairsets=[];var g=n.readUshort(t,o);o+=2;for(var C=0;C<g;C++){var v=i+n.readUshort(t,o);o+=2;var _=n.readUshort(t,v);v+=2;for(var k=[],U=0;U<_;U++){var T=n.readUshort(t,v);v+=2,l!=0&&(b=r.GPOS.readValueRecord(t,v,l),v+=2*h),y!=0&&(R=r.GPOS.readValueRecord(t,v,y),v+=2*m),k.push({gid2:T,val1:b,val2:R})}s.pairsets.push(k)}}if(s.fmt==2){var x=n.readUshort(t,o);o+=2;var S=n.readUshort(t,o);o+=2;var Y=n.readUshort(t,o);o+=2;var K=n.readUshort(t,o);for(o+=2,s.classDef1=r._lctf.readClassDef(t,i+x),s.classDef2=r._lctf.readClassDef(t,i+S),s.matrix=[],C=0;C<Y;C++){var ne=[];for(U=0;U<K;U++){var b=null,R=null;l!=0&&(b=r.GPOS.readValueRecord(t,o,l),o+=2*h),y!=0&&(R=r.GPOS.readValueRecord(t,o,y),o+=2*m),ne.push({val1:b,val2:R})}s.matrix.push(ne)}}}else{if(e==9&&s.fmt==1){var A=n.readUshort(t,o);o+=2;var j=n.readUint(t,o);if(o+=4,a.ltype==9)a.ltype=A;else if(a.ltype!=A)throw"invalid extension substitution";return r.GPOS.subt(t,a.ltype,i+j)}console.debug("unsupported GPOS table LookupType",e,"format",s.fmt)}return s},r.GPOS.readValueRecord=function(t,e,o){var a=r._bin,n=[];return n.push(1&o?a.readShort(t,e):0),e+=1&o?2:0,n.push(2&o?a.readShort(t,e):0),e+=2&o?2:0,n.push(4&o?a.readShort(t,e):0),e+=4&o?2:0,n.push(8&o?a.readShort(t,e):0),e+=8&o?2:0,n},r.GSUB={},r.GSUB.parse=function(t,e,o,a){return r._lctf.parse(t,e,o,a,r.GSUB.subt)},r.GSUB.subt=function(t,e,o,a){var n=r._bin,i=o,s={};if(s.fmt=n.readUshort(t,o),o+=2,e!=1&&e!=4&&e!=5&&e!=6)return null;if(e==1||e==4||e==5&&s.fmt<=2||e==6&&s.fmt<=2){var f=n.readUshort(t,o);o+=2,s.coverage=r._lctf.readCoverage(t,i+f)}if(e==1&&s.fmt>=1&&s.fmt<=2){if(s.fmt==1)s.delta=n.readShort(t,o),o+=2;else if(s.fmt==2){var l=n.readUshort(t,o);o+=2,s.newg=n.readUshorts(t,o,l),o+=2*s.newg.length}}else if(e==4){s.vals=[],l=n.readUshort(t,o),o+=2;for(var h=0;h<l;h++){var y=n.readUshort(t,o);o+=2,s.vals.push(r.GSUB.readLigatureSet(t,i+y))}}else if(e==5&&s.fmt==2){if(s.fmt==2){var m=n.readUshort(t,o);o+=2,s.cDef=r._lctf.readClassDef(t,i+m),s.scset=[];var g=n.readUshort(t,o);for(o+=2,h=0;h<g;h++){var C=n.readUshort(t,o);o+=2,s.scset.push(C==0?null:r.GSUB.readSubClassSet(t,i+C))}}}else if(e==6&&s.fmt==3){if(s.fmt==3){for(h=0;h<3;h++){l=n.readUshort(t,o),o+=2;for(var v=[],_=0;_<l;_++)v.push(r._lctf.readCoverage(t,i+n.readUshort(t,o+2*_)));o+=2*l,h==0&&(s.backCvg=v),h==1&&(s.inptCvg=v),h==2&&(s.ahedCvg=v)}l=n.readUshort(t,o),o+=2,s.lookupRec=r.GSUB.readSubstLookupRecords(t,o,l)}}else{if(e==7&&s.fmt==1){var k=n.readUshort(t,o);o+=2;var U=n.readUint(t,o);if(o+=4,a.ltype==9)a.ltype=k;else if(a.ltype!=k)throw"invalid extension substitution";return r.GSUB.subt(t,a.ltype,i+U)}console.debug("unsupported GSUB table LookupType",e,"format",s.fmt)}return s},r.GSUB.readSubClassSet=function(t,e){var o=r._bin.readUshort,a=e,n=[],i=o(t,e);e+=2;for(var s=0;s<i;s++){var f=o(t,e);e+=2,n.push(r.GSUB.readSubClassRule(t,a+f))}return n},r.GSUB.readSubClassRule=function(t,e){var o=r._bin.readUshort,a={},n=o(t,e),i=o(t,e+=2);e+=2,a.input=[];for(var s=0;s<n-1;s++)a.input.push(o(t,e)),e+=2;return a.substLookupRecords=r.GSUB.readSubstLookupRecords(t,e,i),a},r.GSUB.readSubstLookupRecords=function(t,e,o){for(var a=r._bin.readUshort,n=[],i=0;i<o;i++)n.push(a(t,e),a(t,e+2)),e+=4;return n},r.GSUB.readChainSubClassSet=function(t,e){var o=r._bin,a=e,n=[],i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var f=o.readUshort(t,e);e+=2,n.push(r.GSUB.readChainSubClassRule(t,a+f))}return n},r.GSUB.readChainSubClassRule=function(t,e){for(var o=r._bin,a={},n=["backtrack","input","lookahead"],i=0;i<n.length;i++){var s=o.readUshort(t,e);e+=2,i==1&&s--,a[n[i]]=o.readUshorts(t,e,s),e+=2*a[n[i]].length}return s=o.readUshort(t,e),e+=2,a.subst=o.readUshorts(t,e,2*s),e+=2*a.subst.length,a},r.GSUB.readLigatureSet=function(t,e){var o=r._bin,a=e,n=[],i=o.readUshort(t,e);e+=2;for(var s=0;s<i;s++){var f=o.readUshort(t,e);e+=2,n.push(r.GSUB.readLigature(t,a+f))}return n},r.GSUB.readLigature=function(t,e){var o=r._bin,a={chain:[]};a.nglyph=o.readUshort(t,e),e+=2;var n=o.readUshort(t,e);e+=2;for(var i=0;i<n-1;i++)a.chain.push(o.readUshort(t,e)),e+=2;return a},r.head={},r.head.parse=function(t,e,o){var a=r._bin,n={};return a.readFixed(t,e),e+=4,n.fontRevision=a.readFixed(t,e),e+=4,a.readUint(t,e),e+=4,a.readUint(t,e),e+=4,n.flags=a.readUshort(t,e),e+=2,n.unitsPerEm=a.readUshort(t,e),e+=2,n.created=a.readUint64(t,e),e+=8,n.modified=a.readUint64(t,e),e+=8,n.xMin=a.readShort(t,e),e+=2,n.yMin=a.readShort(t,e),e+=2,n.xMax=a.readShort(t,e),e+=2,n.yMax=a.readShort(t,e),e+=2,n.macStyle=a.readUshort(t,e),e+=2,n.lowestRecPPEM=a.readUshort(t,e),e+=2,n.fontDirectionHint=a.readShort(t,e),e+=2,n.indexToLocFormat=a.readShort(t,e),e+=2,n.glyphDataFormat=a.readShort(t,e),e+=2,n},r.hhea={},r.hhea.parse=function(t,e,o){var a=r._bin,n={};return a.readFixed(t,e),e+=4,n.ascender=a.readShort(t,e),e+=2,n.descender=a.readShort(t,e),e+=2,n.lineGap=a.readShort(t,e),e+=2,n.advanceWidthMax=a.readUshort(t,e),e+=2,n.minLeftSideBearing=a.readShort(t,e),e+=2,n.minRightSideBearing=a.readShort(t,e),e+=2,n.xMaxExtent=a.readShort(t,e),e+=2,n.caretSlopeRise=a.readShort(t,e),e+=2,n.caretSlopeRun=a.readShort(t,e),e+=2,n.caretOffset=a.readShort(t,e),e+=2,e+=8,n.metricDataFormat=a.readShort(t,e),e+=2,n.numberOfHMetrics=a.readUshort(t,e),e+=2,n},r.hmtx={},r.hmtx.parse=function(t,e,o,a){for(var n=r._bin,i={aWidth:[],lsBearing:[]},s=0,f=0,l=0;l<a.maxp.numGlyphs;l++)l<a.hhea.numberOfHMetrics&&(s=n.readUshort(t,e),e+=2,f=n.readShort(t,e),e+=2),i.aWidth.push(s),i.lsBearing.push(f);return i},r.kern={},r.kern.parse=function(t,e,o,a){var n=r._bin,i=n.readUshort(t,e);if(e+=2,i==1)return r.kern.parseV1(t,e-2,o,a);var s=n.readUshort(t,e);e+=2;for(var f={glyph1:[],rval:[]},l=0;l<s;l++){e+=2,o=n.readUshort(t,e),e+=2;var h=n.readUshort(t,e);e+=2;var y=h>>>8;if((y&=15)!=0)throw"unknown kern table format: "+y;e=r.kern.readFormat0(t,e,f)}return f},r.kern.parseV1=function(t,e,o,a){var n=r._bin;n.readFixed(t,e),e+=4;var i=n.readUint(t,e);e+=4;for(var s={glyph1:[],rval:[]},f=0;f<i;f++){n.readUint(t,e),e+=4;var l=n.readUshort(t,e);e+=2,n.readUshort(t,e),e+=2;var h=l>>>8;if((h&=15)!=0)throw"unknown kern table format: "+h;e=r.kern.readFormat0(t,e,s)}return s},r.kern.readFormat0=function(t,e,o){var a=r._bin,n=-1,i=a.readUshort(t,e);e+=2,a.readUshort(t,e),e+=2,a.readUshort(t,e),e+=2,a.readUshort(t,e),e+=2;for(var s=0;s<i;s++){var f=a.readUshort(t,e);e+=2;var l=a.readUshort(t,e);e+=2;var h=a.readShort(t,e);e+=2,f!=n&&(o.glyph1.push(f),o.rval.push({glyph2:[],vals:[]}));var y=o.rval[o.rval.length-1];y.glyph2.push(l),y.vals.push(h),n=f}return e},r.loca={},r.loca.parse=function(t,e,o,a){var n=r._bin,i=[],s=a.head.indexToLocFormat,f=a.maxp.numGlyphs+1;if(s==0)for(var l=0;l<f;l++)i.push(n.readUshort(t,e+(l<<1))<<1);if(s==1)for(l=0;l<f;l++)i.push(n.readUint(t,e+(l<<2)));return i},r.maxp={},r.maxp.parse=function(t,e,o){var a=r._bin,n={},i=a.readUint(t,e);return e+=4,n.numGlyphs=a.readUshort(t,e),e+=2,i==65536&&(n.maxPoints=a.readUshort(t,e),e+=2,n.maxContours=a.readUshort(t,e),e+=2,n.maxCompositePoints=a.readUshort(t,e),e+=2,n.maxCompositeContours=a.readUshort(t,e),e+=2,n.maxZones=a.readUshort(t,e),e+=2,n.maxTwilightPoints=a.readUshort(t,e),e+=2,n.maxStorage=a.readUshort(t,e),e+=2,n.maxFunctionDefs=a.readUshort(t,e),e+=2,n.maxInstructionDefs=a.readUshort(t,e),e+=2,n.maxStackElements=a.readUshort(t,e),e+=2,n.maxSizeOfInstructions=a.readUshort(t,e),e+=2,n.maxComponentElements=a.readUshort(t,e),e+=2,n.maxComponentDepth=a.readUshort(t,e),e+=2),n},r.name={},r.name.parse=function(t,e,o){var a=r._bin,n={};a.readUshort(t,e),e+=2;var i=a.readUshort(t,e);e+=2,a.readUshort(t,e);for(var s,f=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],l=e+=2,h=0;h<i;h++){var y=a.readUshort(t,e);e+=2;var m=a.readUshort(t,e);e+=2;var g=a.readUshort(t,e);e+=2;var C=a.readUshort(t,e);e+=2;var v=a.readUshort(t,e);e+=2;var _=a.readUshort(t,e);e+=2;var k,U=f[C],T=l+12*i+_;if(y==0)k=a.readUnicode(t,T,v/2);else if(y==3&&m==0)k=a.readUnicode(t,T,v/2);else if(m==0)k=a.readASCII(t,T,v);else if(m==1)k=a.readUnicode(t,T,v/2);else if(m==3)k=a.readUnicode(t,T,v/2);else{if(y!=1)throw"unknown encoding "+m+", platformID: "+y;k=a.readASCII(t,T,v),console.debug("reading unknown MAC encoding "+m+" as ASCII")}var x="p"+y+","+g.toString(16);n[x]==null&&(n[x]={}),n[x][U!==void 0?U:C]=k,n[x]._lang=g}for(var S in n)if(n[S].postScriptName!=null&&n[S]._lang==1033)return n[S];for(var S in n)if(n[S].postScriptName!=null&&n[S]._lang==0)return n[S];for(var S in n)if(n[S].postScriptName!=null&&n[S]._lang==3084)return n[S];for(var S in n)if(n[S].postScriptName!=null)return n[S];for(var S in n){s=S;break}return console.debug("returning name table with languageID "+n[s]._lang),n[s]},r["OS/2"]={},r["OS/2"].parse=function(t,e,o){var a=r._bin.readUshort(t,e);e+=2;var n={};if(a==0)r["OS/2"].version0(t,e,n);else if(a==1)r["OS/2"].version1(t,e,n);else if(a==2||a==3||a==4)r["OS/2"].version2(t,e,n);else{if(a!=5)throw"unknown OS/2 table version: "+a;r["OS/2"].version5(t,e,n)}return n},r["OS/2"].version0=function(t,e,o){var a=r._bin;return o.xAvgCharWidth=a.readShort(t,e),e+=2,o.usWeightClass=a.readUshort(t,e),e+=2,o.usWidthClass=a.readUshort(t,e),e+=2,o.fsType=a.readUshort(t,e),e+=2,o.ySubscriptXSize=a.readShort(t,e),e+=2,o.ySubscriptYSize=a.readShort(t,e),e+=2,o.ySubscriptXOffset=a.readShort(t,e),e+=2,o.ySubscriptYOffset=a.readShort(t,e),e+=2,o.ySuperscriptXSize=a.readShort(t,e),e+=2,o.ySuperscriptYSize=a.readShort(t,e),e+=2,o.ySuperscriptXOffset=a.readShort(t,e),e+=2,o.ySuperscriptYOffset=a.readShort(t,e),e+=2,o.yStrikeoutSize=a.readShort(t,e),e+=2,o.yStrikeoutPosition=a.readShort(t,e),e+=2,o.sFamilyClass=a.readShort(t,e),e+=2,o.panose=a.readBytes(t,e,10),e+=10,o.ulUnicodeRange1=a.readUint(t,e),e+=4,o.ulUnicodeRange2=a.readUint(t,e),e+=4,o.ulUnicodeRange3=a.readUint(t,e),e+=4,o.ulUnicodeRange4=a.readUint(t,e),e+=4,o.achVendID=[a.readInt8(t,e),a.readInt8(t,e+1),a.readInt8(t,e+2),a.readInt8(t,e+3)],e+=4,o.fsSelection=a.readUshort(t,e),e+=2,o.usFirstCharIndex=a.readUshort(t,e),e+=2,o.usLastCharIndex=a.readUshort(t,e),e+=2,o.sTypoAscender=a.readShort(t,e),e+=2,o.sTypoDescender=a.readShort(t,e),e+=2,o.sTypoLineGap=a.readShort(t,e),e+=2,o.usWinAscent=a.readUshort(t,e),e+=2,o.usWinDescent=a.readUshort(t,e),e+=2},r["OS/2"].version1=function(t,e,o){var a=r._bin;return e=r["OS/2"].version0(t,e,o),o.ulCodePageRange1=a.readUint(t,e),e+=4,o.ulCodePageRange2=a.readUint(t,e),e+=4},r["OS/2"].version2=function(t,e,o){var a=r._bin;return e=r["OS/2"].version1(t,e,o),o.sxHeight=a.readShort(t,e),e+=2,o.sCapHeight=a.readShort(t,e),e+=2,o.usDefault=a.readUshort(t,e),e+=2,o.usBreak=a.readUshort(t,e),e+=2,o.usMaxContext=a.readUshort(t,e),e+=2},r["OS/2"].version5=function(t,e,o){var a=r._bin;return e=r["OS/2"].version2(t,e,o),o.usLowerOpticalPointSize=a.readUshort(t,e),e+=2,o.usUpperOpticalPointSize=a.readUshort(t,e),e+=2},r.post={},r.post.parse=function(t,e,o){var a=r._bin,n={};return n.version=a.readFixed(t,e),e+=4,n.italicAngle=a.readFixed(t,e),e+=4,n.underlinePosition=a.readShort(t,e),e+=2,n.underlineThickness=a.readShort(t,e),e+=2,n},r==null&&(r={}),r.U==null&&(r.U={}),r.U.codeToGlyph=function(t,e){var o=t.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw"no familiar platform and encoding!";var n=o.tables[a];if(n.format==0)return e>=n.map.length?0:n.map[e];if(n.format==4){for(var i=-1,s=0;s<n.endCount.length;s++)if(e<=n.endCount[s]){i=s;break}return i==-1||n.startCount[i]>e?0:65535&(n.idRangeOffset[i]!=0?n.glyphIdArray[e-n.startCount[i]+(n.idRangeOffset[i]>>1)-(n.idRangeOffset.length-i)]:e+n.idDelta[i])}if(n.format==12){if(e>n.groups[n.groups.length-1][1])return 0;for(s=0;s<n.groups.length;s++){var f=n.groups[s];if(f[0]<=e&&e<=f[1])return f[2]+(e-f[0])}return 0}throw"unknown cmap table format "+n.format},r.U.glyphToPath=function(t,e){var o={cmds:[],crds:[]};if(t.SVG&&t.SVG.entries[e]){var a=t.SVG.entries[e];return a==null?o:(typeof a=="string"&&(a=r.SVG.toPath(a),t.SVG.entries[e]=a),a)}if(t.CFF){var n={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:t.CFF.Private?t.CFF.Private.defaultWidthX:0,open:!1},i=t.CFF,s=t.CFF.Private;if(i.ROS){for(var f=0;i.FDSelect[f+2]<=e;)f+=2;s=i.FDArray[i.FDSelect[f+1]].Private}r.U._drawCFF(t.CFF.CharStrings[e],n,i,s,o)}else t.glyf&&r.U._drawGlyf(e,t,o);return o},r.U._drawGlyf=function(t,e,o){var a=e.glyf[t];a==null&&(a=e.glyf[t]=r.glyf._parseGlyf(e,t)),a!=null&&(a.noc>-1?r.U._simpleGlyph(a,o):r.U._compoGlyph(a,e,o))},r.U._simpleGlyph=function(t,e){for(var o=0;o<t.noc;o++){for(var a=o==0?0:t.endPts[o-1]+1,n=t.endPts[o],i=a;i<=n;i++){var s=i==a?n:i-1,f=i==n?a:i+1,l=1&t.flags[i],h=1&t.flags[s],y=1&t.flags[f],m=t.xs[i],g=t.ys[i];if(i==a)if(l){if(!h){r.U.P.moveTo(e,m,g);continue}r.U.P.moveTo(e,t.xs[s],t.ys[s])}else h?r.U.P.moveTo(e,t.xs[s],t.ys[s]):r.U.P.moveTo(e,(t.xs[s]+m)/2,(t.ys[s]+g)/2);l?h&&r.U.P.lineTo(e,m,g):y?r.U.P.qcurveTo(e,m,g,t.xs[f],t.ys[f]):r.U.P.qcurveTo(e,m,g,(m+t.xs[f])/2,(g+t.ys[f])/2)}r.U.P.closePath(e)}},r.U._compoGlyph=function(t,e,o){for(var a=0;a<t.parts.length;a++){var n={cmds:[],crds:[]},i=t.parts[a];r.U._drawGlyf(i.glyphIndex,e,n);for(var s=i.m,f=0;f<n.crds.length;f+=2){var l=n.crds[f],h=n.crds[f+1];o.crds.push(l*s.a+h*s.b+s.tx),o.crds.push(l*s.c+h*s.d+s.ty)}for(f=0;f<n.cmds.length;f++)o.cmds.push(n.cmds[f])}},r.U._getGlyphClass=function(t,e){var o=r._lctf.getInterval(e,t);return o==-1?0:e[o+2]},r.U.getPairAdjustment=function(t,e,o){var a=!1;if(t.GPOS)for(var n=t.GPOS,i=n.lookupList,s=n.featureList,f=[],l=0;l<s.length;l++){var h=s[l];if(h.tag=="kern"){a=!0;for(var y=0;y<h.tab.length;y++)if(!f[h.tab[y]]){f[h.tab[y]]=!0;for(var m=i[h.tab[y]],g=0;g<m.tabs.length;g++)if(m.tabs[g]!=null){var C,v=m.tabs[g];if((!v.coverage||(C=r._lctf.coverageIndex(v.coverage,e))!=-1)&&m.ltype!=1){if(m.ltype==2){var _=null;if(v.fmt==1){var k=v.pairsets[C];for(l=0;l<k.length;l++)k[l].gid2==o&&(_=k[l])}else if(v.fmt==2){var U=r.U._getGlyphClass(e,v.classDef1),T=r.U._getGlyphClass(o,v.classDef2);_=v.matrix[U][T]}if(_){var x=0;return _.val1&&_.val1[2]&&(x+=_.val1[2]),_.val2&&_.val2[0]&&(x+=_.val2[0]),x}}}}}}}if(t.kern&&!a){var S=t.kern.glyph1.indexOf(e);if(S!=-1){var Y=t.kern.rval[S].glyph2.indexOf(o);if(Y!=-1)return t.kern.rval[S].vals[Y]}}return 0},r.U._applySubs=function(t,e,o,a){for(var n=t.length-e-1,i=0;i<o.tabs.length;i++)if(o.tabs[i]!=null){var s,f=o.tabs[i];if(!f.coverage||(s=r._lctf.coverageIndex(f.coverage,t[e]))!=-1){if(o.ltype==1)t[e],f.fmt==1?t[e]=t[e]+f.delta:t[e]=f.newg[s];else if(o.ltype==4)for(var l=f.vals[s],h=0;h<l.length;h++){var y=l[h],m=y.chain.length;if(!(m>n)){for(var g=!0,C=0,v=0;v<m;v++){for(;t[e+C+(1+v)]==-1;)C++;y.chain[v]!=t[e+C+(1+v)]&&(g=!1)}if(g){for(t[e]=y.nglyph,v=0;v<m+C;v++)t[e+v+1]=-1;break}}}else if(o.ltype==5&&f.fmt==2)for(var _=r._lctf.getInterval(f.cDef,t[e]),k=f.cDef[_+2],U=f.scset[k],T=0;T<U.length;T++){var x=U[T],S=x.input;if(!(S.length>n)){for(g=!0,v=0;v<S.length;v++){var Y=r._lctf.getInterval(f.cDef,t[e+1+v]);if(_==-1&&f.cDef[Y+2]!=S[v]){g=!1;break}}if(g){var K=x.substLookupRecords;for(h=0;h<K.length;h+=2)K[h],K[h+1]}}}else if(o.ltype==6&&f.fmt==3){if(!r.U._glsCovered(t,f.backCvg,e-f.backCvg.length)||!r.U._glsCovered(t,f.inptCvg,e)||!r.U._glsCovered(t,f.ahedCvg,e+f.inptCvg.length))continue;var ne=f.lookupRec;for(T=0;T<ne.length;T+=2){_=ne[T];var b=a[ne[T+1]];r.U._applySubs(t,e+_,b,a)}}}}},r.U._glsCovered=function(t,e,o){for(var a=0;a<e.length;a++)if(r._lctf.coverageIndex(e[a],t[o+a])==-1)return!1;return!0},r.U.glyphsToPath=function(t,e,o){for(var a={cmds:[],crds:[]},n=0,i=0;i<e.length;i++){var s=e[i];if(s!=-1){for(var f=i<e.length-1&&e[i+1]!=-1?e[i+1]:0,l=r.U.glyphToPath(t,s),h=0;h<l.crds.length;h+=2)a.crds.push(l.crds[h]+n),a.crds.push(l.crds[h+1]);for(o&&a.cmds.push(o),h=0;h<l.cmds.length;h++)a.cmds.push(l.cmds[h]);o&&a.cmds.push("X"),n+=t.hmtx.aWidth[s],i<e.length-1&&(n+=r.U.getPairAdjustment(t,s,f))}}return a},r.U.P={},r.U.P.moveTo=function(t,e,o){t.cmds.push("M"),t.crds.push(e,o)},r.U.P.lineTo=function(t,e,o){t.cmds.push("L"),t.crds.push(e,o)},r.U.P.curveTo=function(t,e,o,a,n,i,s){t.cmds.push("C"),t.crds.push(e,o,a,n,i,s)},r.U.P.qcurveTo=function(t,e,o,a,n){t.cmds.push("Q"),t.crds.push(e,o,a,n)},r.U.P.closePath=function(t){t.cmds.push("Z")},r.U._drawCFF=function(t,e,o,a,n){for(var i=e.stack,s=e.nStems,f=e.haveWidth,l=e.width,h=e.open,y=0,m=e.x,g=e.y,C=0,v=0,_=0,k=0,U=0,T=0,x=0,S=0,Y=0,K=0,ne={val:0,size:0};y<t.length;){r.CFF.getCharString(t,y,ne);var b=ne.val;if(y+=ne.size,b=="o1"||b=="o18")i.length%2!=0&&!f&&(l=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,f=!0;else if(b=="o3"||b=="o23")i.length%2!=0&&!f&&(l=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,f=!0;else if(b=="o4")i.length>1&&!f&&(l=i.shift()+a.nominalWidthX,f=!0),h&&r.U.P.closePath(n),g+=i.pop(),r.U.P.moveTo(n,m,g),h=!0;else if(b=="o5")for(;i.length>0;)m+=i.shift(),g+=i.shift(),r.U.P.lineTo(n,m,g);else if(b=="o6"||b=="o7")for(var R=i.length,A=b=="o6",j=0;j<R;j++){var N=i.shift();A?m+=N:g+=N,A=!A,r.U.P.lineTo(n,m,g)}else if(b=="o8"||b=="o24"){R=i.length;for(var se=0;se+6<=R;)C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),k=v+i.shift(),m=_+i.shift(),g=k+i.shift(),r.U.P.curveTo(n,C,v,_,k,m,g),se+=6;b=="o24"&&(m+=i.shift(),g+=i.shift(),r.U.P.lineTo(n,m,g))}else{if(b=="o11")break;if(b=="o1234"||b=="o1235"||b=="o1236"||b=="o1237")b=="o1234"&&(v=g,_=(C=m+i.shift())+i.shift(),K=k=v+i.shift(),T=k,S=g,m=(x=(U=(Y=_+i.shift())+i.shift())+i.shift())+i.shift(),r.U.P.curveTo(n,C,v,_,k,Y,K),r.U.P.curveTo(n,U,T,x,S,m,g)),b=="o1235"&&(C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),k=v+i.shift(),Y=_+i.shift(),K=k+i.shift(),U=Y+i.shift(),T=K+i.shift(),x=U+i.shift(),S=T+i.shift(),m=x+i.shift(),g=S+i.shift(),i.shift(),r.U.P.curveTo(n,C,v,_,k,Y,K),r.U.P.curveTo(n,U,T,x,S,m,g)),b=="o1236"&&(C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),K=k=v+i.shift(),T=k,x=(U=(Y=_+i.shift())+i.shift())+i.shift(),S=T+i.shift(),m=x+i.shift(),r.U.P.curveTo(n,C,v,_,k,Y,K),r.U.P.curveTo(n,U,T,x,S,m,g)),b=="o1237"&&(C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),k=v+i.shift(),Y=_+i.shift(),K=k+i.shift(),U=Y+i.shift(),T=K+i.shift(),x=U+i.shift(),S=T+i.shift(),Math.abs(x-m)>Math.abs(S-g)?m=x+i.shift():g=S+i.shift(),r.U.P.curveTo(n,C,v,_,k,Y,K),r.U.P.curveTo(n,U,T,x,S,m,g));else if(b=="o14"){if(i.length>0&&!f&&(l=i.shift()+o.nominalWidthX,f=!0),i.length==4){var ie=i.shift(),P=i.shift(),W=i.shift(),p=i.shift(),w=r.CFF.glyphBySE(o,W),B=r.CFF.glyphBySE(o,p);r.U._drawCFF(o.CharStrings[w],e,o,a,n),e.x=ie,e.y=P,r.U._drawCFF(o.CharStrings[B],e,o,a,n)}h&&(r.U.P.closePath(n),h=!1)}else if(b=="o19"||b=="o20")i.length%2!=0&&!f&&(l=i.shift()+a.nominalWidthX),s+=i.length>>1,i.length=0,f=!0,y+=s+7>>3;else if(b=="o21")i.length>2&&!f&&(l=i.shift()+a.nominalWidthX,f=!0),g+=i.pop(),m+=i.pop(),h&&r.U.P.closePath(n),r.U.P.moveTo(n,m,g),h=!0;else if(b=="o22")i.length>1&&!f&&(l=i.shift()+a.nominalWidthX,f=!0),m+=i.pop(),h&&r.U.P.closePath(n),r.U.P.moveTo(n,m,g),h=!0;else if(b=="o25"){for(;i.length>6;)m+=i.shift(),g+=i.shift(),r.U.P.lineTo(n,m,g);C=m+i.shift(),v=g+i.shift(),_=C+i.shift(),k=v+i.shift(),m=_+i.shift(),g=k+i.shift(),r.U.P.curveTo(n,C,v,_,k,m,g)}else if(b=="o26")for(i.length%2&&(m+=i.shift());i.length>0;)C=m,v=g+i.shift(),m=_=C+i.shift(),g=(k=v+i.shift())+i.shift(),r.U.P.curveTo(n,C,v,_,k,m,g);else if(b=="o27")for(i.length%2&&(g+=i.shift());i.length>0;)v=g,_=(C=m+i.shift())+i.shift(),k=v+i.shift(),m=_+i.shift(),g=k,r.U.P.curveTo(n,C,v,_,k,m,g);else if(b=="o10"||b=="o29"){var O=b=="o10"?a:o;if(i.length==0)console.debug("error: empty stack");else{var D=i.pop(),I=O.Subrs[D+O.Bias];e.x=m,e.y=g,e.nStems=s,e.haveWidth=f,e.width=l,e.open=h,r.U._drawCFF(I,e,o,a,n),m=e.x,g=e.y,s=e.nStems,f=e.haveWidth,l=e.width,h=e.open}}else if(b=="o30"||b=="o31"){var F=i.length,M=(se=0,b=="o31");for(se+=F-(R=-3&F);se<R;)M?(v=g,_=(C=m+i.shift())+i.shift(),g=(k=v+i.shift())+i.shift(),R-se==5?(m=_+i.shift(),se++):m=_,M=!1):(C=m,v=g+i.shift(),_=C+i.shift(),k=v+i.shift(),m=_+i.shift(),R-se==5?(g=k+i.shift(),se++):g=k,M=!0),r.U.P.curveTo(n,C,v,_,k,m,g),se+=4}else{if((b+"").charAt(0)=="o")throw console.debug("Unknown operation: "+b,t),b;i.push(b)}}}e.x=m,e.y=g,e.nStems=s,e.haveWidth=f,e.width=l,e.open=h};var d=r,u={Typr:d};return c.Typr=d,c.default=u,Object.defineProperty(c,"__esModule",{value:!0}),c}({}).Typr}/*!
46
+ Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
47
+ (https://github.com/101arrowz/fflate) for use in Troika text rendering.
48
+ Original licenses apply:
49
+ - fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
50
+ - woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
51
+ */function ha(){return function(c){var r=Uint8Array,d=Uint16Array,u=Uint32Array,t=new r([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),e=new r([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),o=new r([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(b,R){for(var A=new d(31),j=0;j<31;++j)A[j]=R+=1<<b[j-1];var N=new u(A[30]);for(j=1;j<30;++j)for(var se=A[j];se<A[j+1];++se)N[se]=se-A[j]<<5|j;return[A,N]},n=a(t,2),i=n[0],s=n[1];i[28]=258,s[258]=28;for(var f=a(e,0)[0],l=new d(32768),h=0;h<32768;++h){var y=(43690&h)>>>1|(21845&h)<<1;y=(61680&(y=(52428&y)>>>2|(13107&y)<<2))>>>4|(3855&y)<<4,l[h]=((65280&y)>>>8|(255&y)<<8)>>>1}var m=function(b,R,A){for(var j=b.length,N=0,se=new d(R);N<j;++N)++se[b[N]-1];var ie,P=new d(R);for(N=0;N<R;++N)P[N]=P[N-1]+se[N-1]<<1;if(A){ie=new d(1<<R);var W=15-R;for(N=0;N<j;++N)if(b[N])for(var p=N<<4|b[N],w=R-b[N],B=P[b[N]-1]++<<w,O=B|(1<<w)-1;B<=O;++B)ie[l[B]>>>W]=p}else for(ie=new d(j),N=0;N<j;++N)b[N]&&(ie[N]=l[P[b[N]-1]++]>>>15-b[N]);return ie},g=new r(288);for(h=0;h<144;++h)g[h]=8;for(h=144;h<256;++h)g[h]=9;for(h=256;h<280;++h)g[h]=7;for(h=280;h<288;++h)g[h]=8;var C=new r(32);for(h=0;h<32;++h)C[h]=5;var v=m(g,9,1),_=m(C,5,1),k=function(b){for(var R=b[0],A=1;A<b.length;++A)b[A]>R&&(R=b[A]);return R},U=function(b,R,A){var j=R/8|0;return(b[j]|b[j+1]<<8)>>(7&R)&A},T=function(b,R){var A=R/8|0;return(b[A]|b[A+1]<<8|b[A+2]<<16)>>(7&R)},x=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],S=function(b,R,A){var j=new Error(R||x[b]);if(j.code=b,Error.captureStackTrace&&Error.captureStackTrace(j,S),!A)throw j;return j},Y=function(b,R,A){var j=b.length;if(!j||A&&!A.l&&j<5)return R||new r(0);var N=!R||A,se=!A||A.i;A||(A={}),R||(R=new r(3*j));var ie,P=function(oe){var ye=R.length;if(oe>ye){var Ue=new r(Math.max(2*ye,oe));Ue.set(R),R=Ue}},W=A.f||0,p=A.p||0,w=A.b||0,B=A.l,O=A.d,D=A.m,I=A.n,F=8*j;do{if(!B){A.f=W=U(b,p,1);var M=U(b,p+1,3);if(p+=3,!M){var z=b[(H=((ie=p)/8|0)+(7&ie&&1)+4)-4]|b[H-3]<<8,q=H+z;if(q>j){se&&S(0);break}N&&P(w+z),R.set(b.subarray(H,q),w),A.b=w+=z,A.p=p=8*q;continue}if(M==1)B=v,O=_,D=9,I=5;else if(M==2){var V=U(b,p,31)+257,E=U(b,p+10,15)+4,de=V+U(b,p+5,31)+1;p+=14;for(var ce=new r(de),X=new r(19),$=0;$<E;++$)X[o[$]]=U(b,p+3*$,7);p+=3*E;var fe=k(X),L=(1<<fe)-1,te=m(X,fe,1);for($=0;$<de;){var H,G=te[U(b,p,L)];if(p+=15&G,(H=G>>>4)<16)ce[$++]=H;else{var ae=0,Q=0;for(H==16?(Q=3+U(b,p,3),p+=2,ae=ce[$-1]):H==17?(Q=3+U(b,p,7),p+=3):H==18&&(Q=11+U(b,p,127),p+=7);Q--;)ce[$++]=ae}}var re=ce.subarray(0,V),J=ce.subarray(V);D=k(re),I=k(J),B=m(re,D,1),O=m(J,I,1)}else S(1);if(p>F){se&&S(0);break}}N&&P(w+131072);for(var me=(1<<D)-1,pe=(1<<I)-1,ee=p;;ee=p){var ue=(ae=B[T(b,p)&me])>>>4;if((p+=15&ae)>F){se&&S(0);break}if(ae||S(2),ue<256)R[w++]=ue;else{if(ue==256){ee=p,B=null;break}var ge=ue-254;if(ue>264){var ke=t[$=ue-257];ge=U(b,p,(1<<ke)-1)+i[$],p+=ke}var le=O[T(b,p)&pe],_e=le>>>4;if(le||S(3),p+=15&le,J=f[_e],_e>3&&(ke=e[_e],J+=T(b,p)&(1<<ke)-1,p+=ke),p>F){se&&S(0);break}N&&P(w+131072);for(var ve=w+ge;w<ve;w+=4)R[w]=R[w-J],R[w+1]=R[w+1-J],R[w+2]=R[w+2-J],R[w+3]=R[w+3-J];w=ve}}A.l=B,A.p=ee,A.b=w,B&&(W=1,A.m=D,A.d=O,A.n=I)}while(!W);return w==R.length?R:function(oe,ye,Ue){(ye==null||ye<0)&&(ye=0),(Ue==null||Ue>oe.length)&&(Ue=oe.length);var Fe=new(oe instanceof d?d:oe instanceof u?u:r)(Ue-ye);return Fe.set(oe.subarray(ye,Ue)),Fe}(R,0,w)},K=new r(0),ne=typeof TextDecoder<"u"&&new TextDecoder;try{ne.decode(K,{stream:!0})}catch{}return c.convert_streams=function(b){var R=new DataView(b),A=0;function j(){var V=R.getUint16(A);return A+=2,V}function N(){var V=R.getUint32(A);return A+=4,V}function se(V){z.setUint16(q,V),q+=2}function ie(V){z.setUint32(q,V),q+=4}for(var P={signature:N(),flavor:N(),length:N(),numTables:j(),reserved:j(),totalSfntSize:N(),majorVersion:j(),minorVersion:j(),metaOffset:N(),metaLength:N(),metaOrigLength:N(),privOffset:N(),privLength:N()},W=0;Math.pow(2,W)<=P.numTables;)W++;W--;for(var p=16*Math.pow(2,W),w=16*P.numTables-p,B=12,O=[],D=0;D<P.numTables;D++)O.push({tag:N(),offset:N(),compLength:N(),origLength:N(),origChecksum:N()}),B+=16;var I,F=new Uint8Array(12+16*O.length+O.reduce(function(V,E){return V+E.origLength+4},0)),M=F.buffer,z=new DataView(M),q=0;return ie(P.flavor),se(P.numTables),se(p),se(W),se(w),O.forEach(function(V){ie(V.tag),ie(V.origChecksum),ie(B),ie(V.origLength),V.outOffset=B,(B+=V.origLength)%4!=0&&(B+=4-B%4)}),O.forEach(function(V){var E,de=b.slice(V.offset,V.offset+V.compLength);if(V.compLength!=V.origLength){var ce=new Uint8Array(V.origLength);E=new Uint8Array(de,2),Y(E,ce)}else ce=new Uint8Array(de);F.set(ce,V.outOffset);var X=0;(B=V.outOffset+V.origLength)%4!=0&&(X=4-B%4),F.set(new Uint8Array(X).buffer,V.outOffset+V.origLength),I=B+X}),M.slice(0,I)},Object.defineProperty(c,"__esModule",{value:!0}),c}({}).convert_streams}function da(c,r){const d={M:2,L:2,Q:4,C:6,Z:0},u={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},t=1,e=2,o=4,a=8,n=16,i=32;let s;function f(U){if(!s){const T={R:e,L:t,D:o,C:n,U:i,T:a};s=new Map;for(let x in u){let S=0;u[x].split(",").forEach(Y=>{let[K,ne]=Y.split("+");K=parseInt(K,36),ne=ne?parseInt(ne,36):0,s.set(S+=K,T[x]);for(let b=ne;b--;)s.set(++S,T[x])})}}return s.get(U)||i}const l=1,h=2,y=3,m=4,g=[null,"isol","init","fina","medi"];function C(U){const T=new Uint8Array(U.length);let x=i,S=l,Y=-1;for(let K=0;K<U.length;K++){const ne=U.codePointAt(K);let b=f(ne)|0,R=l;b&a||(x&(t|o|n)?b&(e|o|n)?(R=y,(S===l||S===y)&&T[Y]++):b&(t|i)&&(S===h||S===m)&&T[Y]--:x&(e|i)&&(S===h||S===m)&&T[Y]--,S=T[K]=R,x=b,Y=K,ne>65535&&K++)}return T}function v(U,T){const x=[];for(let Y=0;Y<T.length;Y++){const K=T.codePointAt(Y);K>65535&&Y++,x.push(c.U.codeToGlyph(U,K))}const S=U.GSUB;if(S){const{lookupList:Y,featureList:K}=S;let ne;const b=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,R=[];K.forEach(A=>{if(b.test(A.tag))for(let j=0;j<A.tab.length;j++){if(R[A.tab[j]])continue;R[A.tab[j]]=!0;const N=Y[A.tab[j]],se=/^(isol|init|fina|medi)$/.test(A.tag);se&&!ne&&(ne=C(T));for(let ie=0;ie<x.length;ie++)(!ne||!se||g[ne[ie]]===A.tag)&&c.U._applySubs(x,ie,N,Y)}})}return x}function _(...U){for(let T=0;T<U.length;T++)if(typeof U[T]=="number")return U[T]}function k(U){const T=Object.create(null),x=U["OS/2"],S=U.hhea,Y=U.head.unitsPerEm,K=_(x&&x.sTypoAscender,S&&S.ascender,Y),ne={unitsPerEm:Y,ascender:K,descender:_(x&&x.sTypoDescender,S&&S.descender,0),capHeight:_(x&&x.sCapHeight,K),xHeight:_(x&&x.sxHeight,K),lineGap:_(x&&x.sTypoLineGap,S&&S.lineGap),forEachGlyph(b,R,A,j){let N=0;const se=1/ne.unitsPerEm*R,ie=v(U,b);let P=0,W=-1;return ie.forEach((p,w)=>{if(p!==-1){let B=T[p];if(!B){const{cmds:O,crds:D}=c.U.glyphToPath(U,p);let I="",F=0;for(let E=0,de=O.length;E<de;E++){const ce=d[O[E]];I+=O[E];for(let X=1;X<=ce;X++)I+=(X>1?",":"")+D[F++]}let M,z,q,V;if(D.length){M=z=1/0,q=V=-1/0;for(let E=0,de=D.length;E<de;E+=2){let ce=D[E],X=D[E+1];ce<M&&(M=ce),X<z&&(z=X),ce>q&&(q=ce),X>V&&(V=X)}}else M=q=z=V=0;B=T[p]={index:p,advanceWidth:U.hmtx.aWidth[p],xMin:M,yMin:z,xMax:q,yMax:V,path:I,pathCommandCount:O.length}}W!==-1&&(N+=c.U.getPairAdjustment(U,W,p)*se),j.call(null,B,N,P),B.advanceWidth&&(N+=B.advanceWidth*se),A&&(N+=A*R),W=p}P+=b.codePointAt(P)>65535?2:1}),N}};return ne}return function(T){const x=new Uint8Array(T,0,4),S=c._bin.readASCII(x,0,4);if(S==="wOFF")T=r(T);else if(S==="wOF2")throw new Error("woff2 fonts not supported");return k(c.parse(T)[0])}}const va=St({name:"Typr Font Parser",dependencies:[ca,ha,da],init(c,r,d){const u=c(),t=r();return d(u,t)}}),$e={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},pa=new yr;let cn=!1;function ot(){return(self.performance||Date).now()}function Ba(c){cn?console.warn("configureTextBuilder called after first font request; will be ignored."):vn($e,c)}const jt=Object.create(null);function hn(c,r){cn=!0,c=vn({},c);const d=ot();if(c.font=ma(c.font||$e.defaultFontURL),c.text=""+c.text,c.sdfGlyphSize=c.sdfGlyphSize||$e.sdfGlyphSize,c.colorRanges!=null){let f={};for(let l in c.colorRanges)if(c.colorRanges.hasOwnProperty(l)){let h=c.colorRanges[l];typeof h!="number"&&(h=pa.set(h).getHex()),f[l]=h}c.colorRanges=f}Object.freeze(c);const{textureWidth:u,sdfExponent:t}=$e,{sdfGlyphSize:e}=c,o=u/e*4;let a=jt[e];if(!a){const f=document.createElement("canvas");f.width=u,f.height=e*256/o,a=jt[e]={glyphCount:0,sdfGlyphSize:e,sdfCanvas:f,sdfTexture:new Ln(f,void 0,void 0,void 0,Vr,Vr),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,ga(a)}const{sdfTexture:n,sdfCanvas:i}=a;let s=a.glyphsByFont.get(c.font);s||a.glyphsByFont.set(c.font,s=new Map),ba(c).then(f=>{const{glyphIds:l,glyphPositions:h,fontSize:y,unitsPerEm:m,timings:g}=f,C=[],v=new Float32Array(l.length*4),_=y/m;let k=0,U=0;const T=ot();l.forEach((ne,b)=>{let R=s.get(ne);if(!R){const{path:se,pathBounds:ie}=f.glyphData[ne],P=Math.max(ie[2]-ie[0],ie[3]-ie[1])/e*($e.sdfMargin*e+.5),W=a.glyphCount++,p=[ie[0]-P,ie[1]-P,ie[2]+P,ie[3]+P];s.set(ne,R={path:se,atlasIndex:W,sdfViewBox:p}),C.push(R)}const{sdfViewBox:A}=R,j=h[U++],N=h[U++];v[k++]=j+A[0]*_,v[k++]=N+A[1]*_,v[k++]=j+A[2]*_,v[k++]=N+A[3]*_,l[b]=R.atlasIndex}),g.quads=(g.quads||0)+(ot()-T);const x=ot();g.sdf={};const S=i.height,Y=Math.ceil(a.glyphCount/o),K=Math.pow(2,Math.ceil(Math.log2(Y*e)));K>S&&(console.info(`Increasing SDF texture size ${S}->${K}`),ua(i,u,K),n.dispose()),Promise.all(C.map(ne=>dn(ne,a,c.gpuAccelerateSDF).then(({timing:b})=>{g.sdf[ne.atlasIndex]=b}))).then(()=>{C.length&&!a.contextLost&&(pn(a),n.needsUpdate=!0),g.sdfTotal=ot()-x,g.total=ot()-d,r(Object.freeze({parameters:c,sdfTexture:n,sdfGlyphSize:e,sdfExponent:t,glyphBounds:v,glyphAtlasIndices:l,glyphColors:f.glyphColors,caretPositions:f.caretPositions,caretHeight:f.caretHeight,chunkedBounds:f.chunkedBounds,ascender:f.ascender,descender:f.descender,lineHeight:f.lineHeight,capHeight:f.capHeight,xHeight:f.xHeight,topBaseline:f.topBaseline,blockBounds:f.blockBounds,visibleBounds:f.visibleBounds,timings:f.timings}))})}),Promise.resolve().then(()=>{a.contextLost||la(i)})}function dn({path:c,atlasIndex:r,sdfViewBox:d},{sdfGlyphSize:u,sdfCanvas:t,contextLost:e},o){if(e)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:n}=$e,i=Math.max(d[2]-d[0],d[3]-d[1]),s=Math.floor(r/4),f=s%(a/u)*u,l=Math.floor(s/(a/u))*u,h=r%4;return na(u,u,c,d,i,n,t,f,l,h,o)}function ga(c){const r=c.sdfCanvas;r.addEventListener("webglcontextlost",d=>{console.log("Context Lost",d),d.preventDefault(),c.contextLost=!0}),r.addEventListener("webglcontextrestored",d=>{console.log("Context Restored",d),c.contextLost=!1;const u=[];c.glyphsByFont.forEach(t=>{t.forEach(e=>{u.push(dn(e,c,!0))})}),Promise.all(u).then(()=>{pn(c),c.sdfTexture.needsUpdate=!0})})}function La({font:c,characters:r,sdfGlyphSize:d},u){let t=Array.isArray(r)?r.join(`
52
+ `):""+r;hn({font:c,sdfGlyphSize:d,text:t},u)}function vn(c,r){for(let d in r)r.hasOwnProperty(d)&&(c[d]=r[d]);return c}let It;function ma(c){return It||(It=typeof document>"u"?{}:document.createElement("a")),It.href=c,It.href}function pn(c){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:r,sdfTexture:d}=c,{width:u,height:t}=r,e=c.sdfCanvas.getContext("webgl");let o=d.image.data;(!o||o.length!==u*t*4)&&(o=new Uint8Array(u*t*4),d.image={width:u,height:t,data:o},d.flipY=!1,d.isDataTexture=!0),e.readPixels(0,0,u,t,e.RGBA,e.UNSIGNED_BYTE,o)}}const ya=St({name:"Typesetter",dependencies:[$e,va,ra,Jn],init(c,r,d,u){const{defaultFontURL:t}=c;return d(r,u(),{defaultFontURL:t})}}),ba=St({name:"Typesetter",dependencies:[ya],init(c){return function(r){return new Promise(d=>{c.typeset(r,d)})}},getTransferables(c){const r=[c.glyphPositions.buffer,c.glyphIds.buffer];return c.caretPositions&&r.push(c.caretPositions.buffer),c.glyphColors&&r.push(c.glyphColors.buffer),r}});function Ra(){Object.keys(jt).forEach(c=>{const r=jt[c].sdfCanvas,{width:d,height:u}=r;console.log("%c.",`
53
+ background: url(${r.toDataURL()});
54
+ background-size: ${d}px ${u}px;
55
+ color: transparent;
56
+ font-size: 0;
57
+ line-height: ${u}px;
58
+ padding-left: ${d}px;
59
+ `)})}const qr={};function Ua(c){let r=qr[c];if(!r){const d=new Ur(1,1,c,c),u=d.clone(),t=d.attributes,e=u.attributes,o=new Rn,a=t.uv.count;for(let n=0;n<a;n++)e.position.array[n*3]*=-1,e.normal.array[n*3+2]*=-1;["position","normal","uv"].forEach(n=>{o.setAttribute(n,new In([...t[n].array,...e[n].array],t[n].itemSize))}),o.setIndex([...d.index.array,...u.index.array.map(n=>n+a)]),o.translate(.5,.5,0),r=qr[c]=o}return r}const _a="aTroikaGlyphBounds",$r="aTroikaGlyphIndex",Sa="aTroikaGlyphColor";class Ta extends An{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new En,this.boundingBox=new Mn}computeBoundingSphere(){}computeBoundingBox(){}setSide(r){const d=this.getIndex().count;this.setDrawRange(r===Pn?d/2:0,r===on?d:d/2)}set detail(r){if(r!==this._detail){this._detail=r,(typeof r!="number"||r<1)&&(r=1);let d=Ua(r);["position","normal","uv"].forEach(u=>{this.attributes[u]=d.attributes[u].clone()}),this.setIndex(d.getIndex().clone())}}get detail(){return this._detail}set curveRadius(r){r!==this._curveRadius&&(this._curveRadius=r,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(r,d,u,t,e){cr(this,_a,r,4),cr(this,$r,d,1),cr(this,Sa,e,3),this._blockBounds=u,this._chunkedBounds=t,this.instanceCount=d.length,this._updateBounds()}_updateBounds(){const r=this._blockBounds;if(r){const{curveRadius:d,boundingBox:u}=this;if(d){const{PI:t,floor:e,min:o,max:a,sin:n,cos:i}=Math,s=t/2,f=t*2,l=Math.abs(d),h=r[0]/l,y=r[2]/l,m=e((h+s)/f)!==e((y+s)/f)?-l:o(n(h)*l,n(y)*l),g=e((h-s)/f)!==e((y-s)/f)?l:a(n(h)*l,n(y)*l),C=e((h+t)/f)!==e((y+t)/f)?l*2:a(l-i(h)*l,l-i(y)*l);u.min.set(m,r[1],d<0?-C:0),u.max.set(g,r[3],d<0?0:C)}else u.min.set(r[0],r[1],0),u.max.set(r[2],r[3],0);u.getBoundingSphere(this.boundingSphere)}}applyClipRect(r){let d=this.getAttribute($r).count,u=this._chunkedBounds;if(u)for(let t=u.length;t--;){d=u[t].end;let e=u[t].rect;if(e[1]<r.w&&e[3]>r.y&&e[0]<r.z&&e[2]>r.x)break}this.instanceCount=d}}function cr(c,r,d,u){const t=c.getAttribute(r);d?t&&t.array.length===d.length?(t.array.set(d),t.needsUpdate=!0):(c.setAttribute(r,new Gn(d,u)),delete c._maxInstanceCount,c.dispose()):t&&c.deleteAttribute(r)}const wa=`
60
+ uniform vec2 uTroikaSDFTextureSize;
61
+ uniform float uTroikaSDFGlyphSize;
62
+ uniform vec4 uTroikaTotalBounds;
63
+ uniform vec4 uTroikaClipRect;
64
+ uniform mat3 uTroikaOrient;
65
+ uniform bool uTroikaUseGlyphColors;
66
+ uniform float uTroikaDistanceOffset;
67
+ uniform float uTroikaBlurRadius;
68
+ uniform vec2 uTroikaPositionOffset;
69
+ uniform float uTroikaCurveRadius;
70
+ attribute vec4 aTroikaGlyphBounds;
71
+ attribute float aTroikaGlyphIndex;
72
+ attribute vec3 aTroikaGlyphColor;
73
+ varying vec2 vTroikaGlyphUV;
74
+ varying vec4 vTroikaTextureUVBounds;
75
+ varying float vTroikaTextureChannel;
76
+ varying vec3 vTroikaGlyphColor;
77
+ varying vec2 vTroikaGlyphDimensions;
78
+ `,xa=`
79
+ vec4 bounds = aTroikaGlyphBounds;
80
+ bounds.xz += uTroikaPositionOffset.x;
81
+ bounds.yw -= uTroikaPositionOffset.y;
82
+
83
+ vec4 outlineBounds = vec4(
84
+ bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius,
85
+ bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius
86
+ );
87
+ vec4 clippedBounds = vec4(
88
+ clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
89
+ clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
90
+ );
91
+
92
+ vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);
93
+
94
+ position.xy = mix(bounds.xy, bounds.zw, clippedXY);
95
+
96
+ uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);
97
+
98
+ float rad = uTroikaCurveRadius;
99
+ if (rad != 0.0) {
100
+ float angle = position.x / rad;
101
+ position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
102
+ normal.xz = vec2(sin(angle), cos(angle));
103
+ }
104
+
105
+ position = uTroikaOrient * position;
106
+ normal = uTroikaOrient * normal;
107
+
108
+ vTroikaGlyphUV = clippedXY.xy;
109
+ vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);
110
+
111
+
112
+ float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
113
+ vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
114
+ vec2 txStartUV = txUvPerSquare * vec2(
115
+ mod(floor(aTroikaGlyphIndex / 4.0), txCols),
116
+ floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
117
+ );
118
+ vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
119
+ vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
120
+ `,ka=`
121
+ uniform sampler2D uTroikaSDFTexture;
122
+ uniform vec2 uTroikaSDFTextureSize;
123
+ uniform float uTroikaSDFGlyphSize;
124
+ uniform float uTroikaSDFExponent;
125
+ uniform float uTroikaDistanceOffset;
126
+ uniform float uTroikaFillOpacity;
127
+ uniform float uTroikaOutlineOpacity;
128
+ uniform float uTroikaBlurRadius;
129
+ uniform vec3 uTroikaStrokeColor;
130
+ uniform float uTroikaStrokeWidth;
131
+ uniform float uTroikaStrokeOpacity;
132
+ uniform bool uTroikaSDFDebug;
133
+ varying vec2 vTroikaGlyphUV;
134
+ varying vec4 vTroikaTextureUVBounds;
135
+ varying float vTroikaTextureChannel;
136
+ varying vec2 vTroikaGlyphDimensions;
137
+
138
+ float troikaSdfValueToSignedDistance(float alpha) {
139
+ // Inverse of exponential encoding in webgl-sdf-generator
140
+
141
+ float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
142
+ float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
143
+ float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
144
+ return signedDist;
145
+ }
146
+
147
+ float troikaGlyphUvToSdfValue(vec2 glyphUV) {
148
+ vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
149
+ vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
150
+ float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
151
+ return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
152
+ }
153
+
154
+ float troikaGlyphUvToDistance(vec2 uv) {
155
+ return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
156
+ }
157
+
158
+ float troikaGetAADist() {
159
+
160
+ #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
161
+ return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
162
+ #else
163
+ return vTroikaGlyphDimensions.x / 64.0;
164
+ #endif
165
+ }
166
+
167
+ float troikaGetFragDistValue() {
168
+ vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
169
+ float distance = troikaGlyphUvToDistance(clampedGlyphUV);
170
+
171
+ // Extrapolate distance when outside bounds:
172
+ distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 :
173
+ length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);
174
+
175
+
176
+
177
+ return distance;
178
+ }
179
+
180
+ float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
181
+ #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
182
+ float alpha = step(-distanceOffset, -distance);
183
+ #else
184
+
185
+ float alpha = smoothstep(
186
+ distanceOffset + aaDist,
187
+ distanceOffset - aaDist,
188
+ distance
189
+ );
190
+ #endif
191
+
192
+ return alpha;
193
+ }
194
+ `,Fa=`
195
+ float aaDist = troikaGetAADist();
196
+ float fragDistance = troikaGetFragDistValue();
197
+ float edgeAlpha = uTroikaSDFDebug ?
198
+ troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
199
+ troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius));
200
+
201
+ #if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
202
+ vec4 fillRGBA = gl_FragColor;
203
+ fillRGBA.a *= uTroikaFillOpacity;
204
+ vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
205
+ if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
206
+ gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
207
+ -uTroikaStrokeWidth - aaDist,
208
+ -uTroikaStrokeWidth + aaDist,
209
+ fragDistance
210
+ ));
211
+ gl_FragColor.a *= edgeAlpha;
212
+ #endif
213
+
214
+ if (edgeAlpha == 0.0) {
215
+ discard;
216
+ }
217
+ `;function Ca(c){const r=gr(c,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new Vt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new zr(0,0,0,0)},uTroikaClipRect:{value:new zr(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new Vt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new yr},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new On},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:wa,vertexTransform:xa,fragmentDefs:ka,fragmentColorTransform:Fa,customRewriter({vertexShader:d,fragmentShader:u}){let t=/\buniform\s+vec3\s+diffuse\b/;return t.test(u)&&(u=u.replace(t,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),t.test(d)||(d=d.replace(ln,`uniform vec3 diffuse;
218
+ $&
219
+ vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
220
+ `))),{vertexShader:d,fragmentShader:u}}});return r.transparent=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}const Sr=new Wn({color:16777215,side:on,transparent:!0}),en=8421504,tn=new Nn,Wt=new _r,hr=new _r,bt=[],Da=new _r,dr="+x+y";function rn(c){return Array.isArray(c)?c[0]:c}let gn=()=>{const c=new br(new Ur(1,1),Sr);return gn=()=>c,c},mn=()=>{const c=new br(new Ur(1,1,32,1),Sr);return mn=()=>c,c};const Aa={type:"syncstart"},Ea={type:"synccomplete"},yn=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Ma=yn.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class Pa extends br{constructor(){const r=new Ta;super(r,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=en,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=dr,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(r){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(r):(this._isSyncing=!0,this.dispatchEvent(Aa),hn({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},d=>{this._isSyncing=!1,this._textRenderInfo=d,this.geometry.updateGlyphs(d.glyphBounds,d.glyphAtlasIndices,d.blockBounds,d.chunkedBounds,d.glyphColors);const u=this._queuedSyncs;u&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{u.forEach(t=>t&&t())})),this.dispatchEvent(Ea),r&&r()})))}onBeforeRender(r,d,u,t,e,o){this.sync(),e.isTroikaTextMaterial&&this._prepareForRender(e),e._hadOwnSide=e.hasOwnProperty("side"),this.geometry.setSide(e._actualSide=e.side),e.side=Bn}onAfterRender(r,d,u,t,e,o){e._hadOwnSide?e.side=e._actualSide:delete e.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let r=this._derivedMaterial;const d=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=Sr.clone());if((!r||r.baseMaterial!==d)&&(r=this._derivedMaterial=Ca(d),d.addEventListener("dispose",function u(){d.removeEventListener("dispose",u),r.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let u=r._outlineMtl;return u||(u=r._outlineMtl=Object.create(r,{id:{value:r.id+.1}}),u.isTextOutlineMaterial=!0,u.depthWrite=!1,u.map=null,r.addEventListener("dispose",function t(){r.removeEventListener("dispose",t),u.dispose()})),[u,r]}else return r}set material(r){r&&r.isTroikaTextMaterial?(this._derivedMaterial=r,this._baseMaterial=r.baseMaterial):this._baseMaterial=r}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(r){this.geometry.detail=r}get curveRadius(){return this.geometry.curveRadius}set curveRadius(r){this.geometry.curveRadius=r}get customDepthMaterial(){return rn(this.material).getDepthMaterial()}get customDistanceMaterial(){return rn(this.material).getDistanceMaterial()}_prepareForRender(r){const d=r.isTextOutlineMaterial,u=r.uniforms,t=this.textRenderInfo;if(t){const{sdfTexture:a,blockBounds:n}=t;u.uTroikaSDFTexture.value=a,u.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),u.uTroikaSDFGlyphSize.value=t.sdfGlyphSize,u.uTroikaSDFExponent.value=t.sdfExponent,u.uTroikaTotalBounds.value.fromArray(n),u.uTroikaUseGlyphColors.value=!d&&!!t.glyphColors;let i=0,s=0,f=0,l,h,y,m=0,g=0;if(d){let{outlineWidth:v,outlineOffsetX:_,outlineOffsetY:k,outlineBlur:U,outlineOpacity:T}=this;i=this._parsePercent(v)||0,s=Math.max(0,this._parsePercent(U)||0),l=T,m=this._parsePercent(_)||0,g=this._parsePercent(k)||0}else f=Math.max(0,this._parsePercent(this.strokeWidth)||0),f&&(y=this.strokeColor,u.uTroikaStrokeColor.value.set(y??en),h=this.strokeOpacity,h==null&&(h=1)),l=this.fillOpacity;u.uTroikaDistanceOffset.value=i,u.uTroikaPositionOffset.value.set(m,g),u.uTroikaBlurRadius.value=s,u.uTroikaStrokeWidth.value=f,u.uTroikaStrokeOpacity.value=h,u.uTroikaFillOpacity.value=l??1,u.uTroikaCurveRadius.value=this.curveRadius||0;let C=this.clipRect;if(C&&Array.isArray(C)&&C.length===4)u.uTroikaClipRect.value.fromArray(C);else{const v=(this.fontSize||.1)*100;u.uTroikaClipRect.value.set(n[0]-v,n[1]-v,n[2]+v,n[3]+v)}this.geometry.applyClipRect(u.uTroikaClipRect.value)}u.uTroikaSDFDebug.value=!!this.debugSDF,r.polygonOffset=!!this.depthOffset,r.polygonOffsetFactor=r.polygonOffsetUnits=this.depthOffset||0;const e=d?this.outlineColor||0:this.color;if(e==null)delete r.color;else{const a=r.hasOwnProperty("color")?r.color:r.color=new yr;(e!==a._input||typeof e=="object")&&a.set(a._input=e)}let o=this.orientation||dr;if(o!==r._orientation){let a=u.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let n=o!==dr&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(n){let[,i,s,f,l]=n;Wt.set(0,0,0)[s]=i==="-"?1:-1,hr.set(0,0,0)[l]=f==="-"?-1:1,tn.lookAt(Da,Wt.cross(hr),hr),a.setFromMatrix4(tn)}else a.identity();r._orientation=o}}_parsePercent(r){if(typeof r=="string"){let d=r.match(/^(-?[\d.]+)%$/),u=d?parseFloat(d[1]):NaN;r=(isNaN(u)?0:u/100)*this.fontSize}return r}localPositionToTextCoords(r,d=new Vt){d.copy(r);const u=this.curveRadius;return u&&(d.x=Math.atan2(r.x,Math.abs(u)-Math.abs(r.z))*Math.abs(u)),d}worldPositionToTextCoords(r,d=new Vt){return Wt.copy(r),this.localPositionToTextCoords(this.worldToLocal(Wt),d)}raycast(r,d){const{textRenderInfo:u,curveRadius:t}=this;if(u){const e=u.blockBounds,o=t?mn():gn(),a=o.geometry,{position:n,uv:i}=a.attributes;for(let s=0;s<i.count;s++){let f=e[0]+i.getX(s)*(e[2]-e[0]);const l=e[1]+i.getY(s)*(e[3]-e[1]);let h=0;t&&(h=t-Math.cos(f/t)*t,f=Math.sin(f/t)*t),n.setXYZ(s,f,l,h)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,bt.length=0,o.raycast(r,bt);for(let s=0;s<bt.length;s++)bt[s].object=this,d.push(bt[s])}}copy(r){const d=this.geometry;return super.copy(r),this.geometry=d,Ma.forEach(u=>{this[u]=r[u]}),this}clone(){return new this.constructor().copy(this)}}yn.forEach(c=>{const r="_private_"+c;Object.defineProperty(Pa.prototype,c,{get(){return this[r]},set(d){d!==this[r]&&(this[r]=d,this._needsSync=!0)}})});function Ia(c,r,d){let u=null;const{caretHeight:t}=c,e=Ga(c);let o=1/0;return e.forEach((a,n)=>{Math.abs(d-(n+t/2))<Math.abs(d-(o+t/2))&&(o=n)}),e.get(o).forEach(a=>{(!u||Math.abs(r-a.x)<Math.abs(r-u.x))&&(u=a)}),u}const nn=new WeakMap;function Wa(c,r,d){let u;if(c){let t=nn.get(c);if(t&&t.start===r&&t.end===d)return t.rects;const{caretPositions:e,caretHeight:o}=c;if(d<r){const n=r;r=d,d=n}r=Math.max(r,0),d=Math.min(d,e.length+1),u=[];let a=null;for(let n=r;n<d;n++){const i=e[n*3],s=e[n*3+1],f=Math.min(i,s),l=Math.max(i,s),h=e[n*3+2];(!a||h!==a.bottom||f>a.right||l<a.left)&&(a={left:1/0,right:-1/0,bottom:h,top:h+o},u.push(a)),a.left=Math.min(f,a.left),a.right=Math.max(l,a.right)}u.sort((n,i)=>i.bottom-n.bottom||n.left-i.left);for(let n=u.length-1;n-- >0;){const i=u[n],s=u[n+1];i.bottom===s.bottom&&i.left<=s.right&&i.right>=s.left&&(s.left=Math.min(s.left,i.left),s.right=Math.max(s.right,i.right),u.splice(n,1))}nn.set(c,{start:r,end:d,rects:u})}return u}const an=new WeakMap;function Ga(c){let r=an.get(c);if(!r){const{caretPositions:d,caretHeight:u}=c;r=new Map;for(let t=0;t<d.length;t+=3){const e=d[t+2];let o=r.get(e);o||r.set(e,o=[]),o.push({x:d[t],y:e,height:u,charIndex:t/3}),t+3>=d.length&&o.push({x:d[t+1],y:e,height:u,charIndex:t/3+1})}}return an.set(c,r),r}export{Ta as GlyphsGeometry,Pa as Text,Ba as configureTextBuilder,Ca as createTextDerivedMaterial,Ra as dumpSDFTextures,Ia as getCaretAtPoint,Wa as getSelectionRects,La as preloadFont,ya as typesetterWorkerModule};
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
+ width="82.988152mm"
13
+ height="85.920082mm"
14
+ viewBox="0 0 82.988152 85.920084"
15
+ version="1.1"
16
+ id="svg4552"
17
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
18
+ sodipodi:docname="AwvLogo-Cube.svg">
19
+ <defs
20
+ id="defs4546" />
21
+ <sodipodi:namedview
22
+ id="base"
23
+ pagecolor="#ffffff"
24
+ bordercolor="#666666"
25
+ borderopacity="1.0"
26
+ inkscape:pageopacity="0.0"
27
+ inkscape:pageshadow="2"
28
+ inkscape:zoom="1.979899"
29
+ inkscape:cx="169.75576"
30
+ inkscape:cy="96.060927"
31
+ inkscape:document-units="mm"
32
+ inkscape:current-layer="g5105"
33
+ showgrid="false"
34
+ inkscape:window-width="3000"
35
+ inkscape:window-height="1875"
36
+ inkscape:window-x="-13"
37
+ inkscape:window-y="-13"
38
+ inkscape:window-maximized="1" />
39
+ <metadata
40
+ id="metadata4549">
41
+ <rdf:RDF>
42
+ <cc:Work
43
+ rdf:about="">
44
+ <dc:format>image/svg+xml</dc:format>
45
+ <dc:type
46
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
47
+ <dc:title></dc:title>
48
+ </cc:Work>
49
+ </rdf:RDF>
50
+ </metadata>
51
+ <g
52
+ inkscape:label="Ebene 1"
53
+ inkscape:groupmode="layer"
54
+ id="layer1"
55
+ transform="translate(223.21658,-92.831494)">
56
+ <g
57
+ transform="matrix(0,0.35277777,0.35277777,0,-335.93014,54.09332)"
58
+ inkscape:label="AwvLogo"
59
+ id="g5105">
60
+ <g
61
+ transform="translate(245.566,444.631)"
62
+ id="g5115">
63
+ <path
64
+ inkscape:connector-curvature="0"
65
+ id="path5117"
66
+ style="fill:#8b0204;fill-opacity:1;fill-rule:nonzero;stroke:none"
67
+ d="M 0,0 H 107.795 L 44.22,110.114 H -63.581" />
68
+ </g>
69
+ <g
70
+ transform="translate(289.788,319.503)"
71
+ id="g5119">
72
+ <path
73
+ inkscape:connector-curvature="0"
74
+ id="path5121"
75
+ style="fill:#ed1c24;fill-opacity:1;fill-rule:nonzero;stroke:none"
76
+ d="M 0,0 63.574,110.121 H -44.221 L -107.803,0" />
77
+ </g>
78
+ <g
79
+ transform="translate(169.029,327.057)"
80
+ id="g5123">
81
+ <path
82
+ inkscape:connector-curvature="0"
83
+ id="path5125"
84
+ style="fill:#8b0204;fill-opacity:1;fill-rule:nonzero;stroke:none"
85
+ d="m 0,0 53.897,93.353 -5.319,9.214 H -59.219" />
86
+ </g>
87
+ <g
88
+ transform="translate(109.809,444.631)"
89
+ id="g5127">
90
+ <path
91
+ inkscape:connector-curvature="0"
92
+ id="path5129"
93
+ style="fill:#ed1c24;fill-opacity:1;fill-rule:nonzero;stroke:none"
94
+ d="m 0,0 h 107.798 l 5.32,9.212 -53.902,93.354" />
95
+ </g>
96
+ </g>
97
+ </g>
98
+ </svg>
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <link rel="apple-touch-icon" href="/favicon.svg" />
9
+ <link rel="manifest" href="/manifest.json" />
10
+ <title>buerligons</title>
11
+
12
+ <script type="module" crossorigin src="/assets/index-c650c783.js"></script>
13
+ <link rel="stylesheet" href="/assets/index-54a14bc0.css">
14
+ </head>
15
+ <body>
16
+ <noscript>You need to enable JavaScript to run this app.</noscript>
17
+ <div id="root"></div>
18
+ </body>
19
+ </html>
@@ -0,0 +1,14 @@
1
+ {
2
+ "short_name": "buerligons",
3
+ "name": "buerligons",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.svg",
7
+ "type": "image/svg"
8
+ }
9
+ ],
10
+ "start_url": ".",
11
+ "display": "standalone",
12
+ "theme_color": "#000000",
13
+ "background_color": "#ffffff"
14
+ }
package/dist/auth.d.ts CHANGED
@@ -13,6 +13,14 @@ export type AuthStatus = {
13
13
  };
14
14
  /** The current sign-in, checked against Firebase at most once per token lifetime. */
15
15
  export declare function authStatus(): Promise<AuthStatus>;
16
+ /**
17
+ * This machine's sign-in, as a service outside can check it: a Firebase ID
18
+ * token (a JWT signed by Google, good for an hour). The share relay takes a
19
+ * session only from a machine that shows one (share/relay.ts). Null when the
20
+ * machine is not signed in, or Firebase cannot be reached for a new token.
21
+ */
22
+ /** `fresh`: not the one kept for the hour, for claims that changed since (a confirmed address, a new plan). */
23
+ export declare function idToken(fresh?: boolean): Promise<string | null>;
16
24
  /** Forgets the sign-in on this machine. */
17
25
  export declare function logout(): boolean;
18
26
  /**