UNPKG

ocearo-ui

Version:

Ocean Robot UI: 3D visualization dashboard for signalk

86 lines (81 loc) 122 kB
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,32189,(e,t,r)=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},65156,(e,t,r)=>{"use strict";var a=e.r(32189);function n(){}function i(){}i.resetWarningCache=n,t.exports=function(){function e(e,t,r,n,i,o){if(o!==a){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return r.PropTypes=r,r}},57384,(e,t,r)=>{t.exports=e.r(65156)()},84226,16196,e=>{"use strict";let t,r;var a=e.i(43476),n=e.i(71645),i=e.i(57384),o=e.i(67561),s=e.i(46991),l=e.i(85709),u=e.i(83402),f=e.i(90072),h=e.i(31067),d=f;function c(){var e=Object.create(null);function t(e,t){var r=void 0;self.troikaDefine=function(e){return r=e};var a=URL.createObjectURL(new Blob(["/** "+e.replace(/\*/g,"")+" **/\n\ntroikaDefine(\n"+t+"\n)"],{type:"application/javascript"}));try{importScripts(a)}catch(e){console.error(e)}return URL.revokeObjectURL(a),delete self.troikaDefine,r}self.addEventListener("message",function(r){var a=r.data,n=a.messageId,i=a.action,o=a.data;try{"registerModule"===i&&function r(a,n){var i=a.id,o=a.name,s=a.dependencies;void 0===s&&(s=[]);var l=a.init;void 0===l&&(l=function(){});var u=a.getTransferables;if(void 0===u&&(u=null),!e[i])try{s=s.map(function(t){return t&&t.isWorkerModule&&(r(t,function(e){if(e instanceof Error)throw e}),t=e[t.id].value),t}),l=t("<"+o+">.init",l),u&&(u=t("<"+o+">.getTransferables",u));var f=null;"function"==typeof l?f=l.apply(void 0,s):console.error("worker module init function failed to rehydrate"),e[i]={id:i,value:f,getTransferables:u},n(f)}catch(e){e&&e.noLog||console.error(e),n(e)}}(o,function(e){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:{isCallable:"function"==typeof e}})}),"callModule"===i&&function(t,r){var a,n=t.id,i=t.args;e[n]&&"function"==typeof e[n].value||r(Error("Worker module "+n+": not found or its 'init' did not return a function"));try{var o=(a=e[n]).value.apply(a,i);o&&"function"==typeof o.then?o.then(s,function(e){return r(e instanceof Error?e:Error(""+e))}):s(o)}catch(e){r(e)}function s(t){try{var a=e[n].getTransferables&&e[n].getTransferables(t);a&&Array.isArray(a)&&a.length||(a=void 0),r(t,a)}catch(e){console.error(e),r(e)}}}(o,function(e,t){e instanceof Error?postMessage({messageId:n,success:!1,error:e.message}):postMessage({messageId:n,success:!0,result:e},t||void 0)})}catch(e){postMessage({messageId:n,success:!1,error:e.stack})}})}e.i(47167);var v=function(){var e=!1;if("u">typeof window&&void 0!==window.document)try{new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"}))).terminate(),e=!0}catch(e){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+e.message+"]")}return v=function(){return e},e},p=0,g=0,m=!1,y=Object.create(null),b=Object.create(null),x=Object.create(null);function S(e){if((!e||"function"!=typeof e.init)&&!m)throw Error("requires `options.init` function");var t,r=e.dependencies,a=e.init,n=e.getTransferables,i=e.workerId,o=((t=function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return t._getInitResult().then(function(t){if("function"==typeof t)return t.apply(void 0,e);throw Error("Worker module function was called but `init` did not return a callable function")})})._getInitResult=function(){var r=e.dependencies,a=e.init,n=Promise.all(r=Array.isArray(r)?r.map(function(e){return e&&(e=e.onMainThread||e)._getInitResult&&(e=e._getInitResult()),e}):[]).then(function(e){return a.apply(null,e)});return t._getInitResult=function(){return n},n},t);null==i&&(i="#default");var s="workerModule"+ ++p,l=e.name||s,u=null;function f(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(!v())return o.apply(void 0,e);if(!u){u=T(i,"registerModule",f.workerModuleData);var r=function(){u=null,b[i].delete(r)};(b[i]||(b[i]=new Set)).add(r)}return u.then(function(t){if(t.isCallable)return T(i,"callModule",{id:s,args:e});throw Error("Worker module function was called but `init` did not return a callable function")})}return r=r&&r.map(function(e){return"function"!=typeof e||e.workerModuleData||(m=!0,e=S({workerId:i,name:"<"+l+"> function dependency: "+e.name,init:"function(){return (\n"+U(e)+"\n)}"}),m=!1),e&&e.workerModuleData&&(e=e.workerModuleData),e}),f.workerModuleData={isWorkerModule:!0,id:s,name:l,dependencies:r,init:U(a),getTransferables:n&&U(n)},f.onMainThread=o,f}function U(e){var t=e.toString();return!/^function/.test(t)&&/^\w+\s*\(/.test(t)&&(t="function "+t),t}function T(e,t,r){return new Promise(function(a,n){var i=++g;x[i]=function(e){e.success?a(e.result):n(Error("Error in worker "+t+" call: "+e.error))},(function(e){var t=y[e];if(!t){var r=U(c);(t=y[e]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+e.replace(/\*/g,"")+" **/\n\n;("+r+")()"],{type:"application/javascript"})))).onmessage=function(e){var t=e.data,r=t.messageId,a=x[r];if(!a)throw Error("WorkerModule response with empty or unknown messageId");delete x[r],a(t)}}return t})(e).postMessage({messageId:i,action:t,data:r})})}function k(){return function(e){function t(e,t){for(var r,a,n,i,o,s=/([MLQCZ])([^MLQCZ]*)/g;r=s.exec(e);){var l=r[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(e){return parseFloat(e)});switch(r[1]){case"M":i=a=l[0],o=n=l[1];break;case"L":(l[0]!==i||l[1]!==o)&&t("L",i,o,i=l[0],o=l[1]);break;case"Q":t("Q",i,o,i=l[2],o=l[3],l[0],l[1]);break;case"C":t("C",i,o,i=l[4],o=l[5],l[0],l[1],l[2],l[3]);break;case"Z":(i!==a||o!==n)&&t("L",i,o,a,n)}}}function r(e,r,a){void 0===a&&(a=16);var n={x:0,y:0};t(e,function(e,t,i,o,s,l,u,f,h){switch(e){case"L":r(t,i,o,s);break;case"Q":for(var d=t,c=i,v=1;v<a;v++)!function(e,t,r,a,n,i,o,s){var l=1-o;s.x=l*l*e+2*l*o*r+o*o*n,s.y=l*l*t+2*l*o*a+o*o*i}(t,i,l,u,o,s,v/(a-1),n),r(d,c,n.x,n.y),d=n.x,c=n.y;break;case"C":for(var p=t,g=i,m=1;m<a;m++)!function(e,t,r,a,n,i,o,s,l,u){var f=1-l;u.x=f*f*f*e+3*f*f*l*r+3*f*l*l*n+l*l*l*o,u.y=f*f*f*t+3*f*f*l*a+3*f*l*l*i+l*l*l*s}(t,i,l,u,f,h,o,s,m/(a-1),n),r(p,g,n.x,n.y),p=n.x,g=n.y}})}var a="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);}",n=new WeakMap,i={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function o(e,t){var r=e.getContext?e.getContext("webgl",i):e,a=n.get(r);if(!a){var o="u">typeof WebGL2RenderingContext&&r instanceof WebGL2RenderingContext,s={},l={},u={},f=-1,h=[];function d(e){var t=s[e];if(!t&&!(t=s[e]=r.getExtension(e)))throw Error(e+" not supported");return t}function c(e,t){var a=r.createShader(t);return r.shaderSource(a,e),r.compileShader(a),a}function v(){s={},l={},u={},f=-1,h.length=0}r.canvas.addEventListener("webglcontextlost",function(e){v(),e.preventDefault()},!1),n.set(r,a={gl:r,isWebGL2:o,getExtension:d,withProgram:function(e,t,a,n){if(!l[e]){var i={},s={},u=r.createProgram();r.attachShader(u,c(t,r.VERTEX_SHADER)),r.attachShader(u,c(a,r.FRAGMENT_SHADER)),r.linkProgram(u),l[e]={program:u,transaction:function(e){r.useProgram(u),e({setUniform:function(e,t){for(var a=[],n=arguments.length-2;n-- >0;)a[n]=arguments[n+2];var i=s[t]||(s[t]=r.getUniformLocation(u,t));r["uniform"+e].apply(r,[i].concat(a))},setAttribute:function(e,t,a,n,s){var l=i[e];l||(l=i[e]={buf:r.createBuffer(),loc:r.getAttribLocation(u,e),data:null}),r.bindBuffer(r.ARRAY_BUFFER,l.buf),r.vertexAttribPointer(l.loc,t,r.FLOAT,!1,0,0),r.enableVertexAttribArray(l.loc),o?r.vertexAttribDivisor(l.loc,n):d("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(l.loc,n),s!==l.data&&(r.bufferData(r.ARRAY_BUFFER,s,a),l.data=s)}})}}}l[e].transaction(n)},withTexture:function(e,t){f++;try{r.activeTexture(r.TEXTURE0+f);var a=u[e];a||(a=u[e]=r.createTexture(),r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)),r.bindTexture(r.TEXTURE_2D,a),t(a,f)}finally{f--}},withTextureFramebuffer:function(e,t,a){var n=r.createFramebuffer();h.push(n),r.bindFramebuffer(r.FRAMEBUFFER,n),r.activeTexture(r.TEXTURE0+t),r.bindTexture(r.TEXTURE_2D,e),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0);try{a(n)}finally{r.deleteFramebuffer(n),r.bindFramebuffer(r.FRAMEBUFFER,h[--h.length-1]||null)}},handleContextLoss:v})}t(a)}function s(e,t,r,n,i,s,l,u){void 0===l&&(l=15),void 0===u&&(u=null),o(e,function(e){var o=e.gl,f=e.withProgram;(0,e.withTexture)("copy",function(e,h){o.texImage2D(o.TEXTURE_2D,0,o.RGBA,i,s,0,o.RGBA,o.UNSIGNED_BYTE,t),f("copy",a,"precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",function(e){var t=e.setUniform;(0,e.setAttribute)("aUV",2,o.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),t("1i","image",h),o.bindFramebuffer(o.FRAMEBUFFER,u||null),o.disable(o.BLEND),o.colorMask(8&l,4&l,2&l,1&l),o.viewport(r,n,i,s),o.scissor(r,n,i,s),o.drawArrays(o.TRIANGLES,0,3)})})})}var l=Object.freeze({__proto__:null,withWebGLContext:o,renderImageData:s,resizeWebGLCanvasWithoutClearing:function(e,t,r){var a=e.width,n=e.height;o(e,function(i){var o=i.gl,l=new Uint8Array(a*n*4);o.readPixels(0,0,a,n,o.RGBA,o.UNSIGNED_BYTE,l),e.width=t,e.height=r,s(o,l,0,0,a,n)})}});function u(e,t,a,n,i,o){void 0===o&&(o=1);var s=new Uint8Array(e*t),l=n[2]-n[0],u=n[3]-n[1],f=[];r(a,function(e,t,r,a){f.push({x1:e,y1:t,x2:r,y2:a,minX:Math.min(e,r),minY:Math.min(t,a),maxX:Math.max(e,r),maxY:Math.max(t,a)})}),f.sort(function(e,t){return e.maxX-t.maxX});for(var h=0;h<e;h++)for(var d=0;d<t;d++){var c=function(e,t){for(var r=1/0,a=1/0,n=f.length;n--;){var i=f[n];if(i.maxX+a<=e)break;if(e+a>i.minX&&t-a<i.maxY&&t+a>i.minY){var o=function(e,t,r,a,n,i){var o=n-r,s=i-a,l=o*o+s*s,u=l?Math.max(0,Math.min(1,((e-r)*o+(t-a)*s)/l)):0,f=e-(r+u*o),h=t-(a+u*s);return f*f+h*h}(e,t,i.x1,i.y1,i.x2,i.y2);o<r&&(a=Math.sqrt(r=o))}}return function(e,t){for(var r=0,a=f.length;a--;){var n=f[a];if(n.maxX<=e)break;n.y1>t!=n.y2>t&&e<(n.x2-n.x1)*(t-n.y1)/(n.y2-n.y1)+n.x1&&(r+=n.y1<n.y2?1:-1)}return 0!==r}(e,t)&&(a=-a),a}(n[0]+l*(h+.5)/e,n[1]+u*(d+.5)/t),v=Math.pow(1-Math.abs(c)/i,o)/2;c<0&&(v=1-v),v=Math.max(0,Math.min(255,Math.round(255*v))),s[d*e+h]=v}return s}function f(e,t,r,a,n,i,o,s,l,u){void 0===i&&(i=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0),h(e,t,r,a,n,i,o,null,s,l,u)}function h(e,t,r,a,n,i,o,l,f,h,d){void 0===i&&(i=1),void 0===f&&(f=0),void 0===h&&(h=0),void 0===d&&(d=0);for(var c=u(e,t,r,a,n,i),v=new Uint8Array(4*c.length),p=0;p<c.length;p++)v[4*p+d]=c[p];s(o,v,f,h,e,t,1<<3-d,l)}var d=Object.freeze({__proto__:null,generate:u,generateIntoCanvas:f,generateIntoFramebuffer:h}),c=new Float32Array([0,0,2,0,0,2]),v=null,p=!1,g={},m=new WeakMap;function y(e){if(!p&&!U(e))throw Error("WebGL generation not supported")}function b(e,t,r,a,n,i,s){if(void 0===i&&(i=1),void 0===s&&(s=null),!s&&!(s=v)){var l="function"==typeof OffscreenCanvas?new OffscreenCanvas(1,1):"u">typeof document?document.createElement("canvas"):null;if(!l)throw Error("OffscreenCanvas or DOM canvas not supported");s=v=l.getContext("webgl",{depth:!1})}y(s);var u=new Uint8Array(e*t*4);o(s,function(o){var s=o.gl,l=o.withTexture,f=o.withTextureFramebuffer;l("readable",function(o,l){s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e,t,0,s.RGBA,s.UNSIGNED_BYTE,null),f(o,l,function(o){S(e,t,r,a,n,i,s,o,0,0,0),s.readPixels(0,0,e,t,s.RGBA,s.UNSIGNED_BYTE,u)})})});for(var f=new Uint8Array(e*t),h=0,d=0;h<u.length;h+=4)f[d++]=u[h];return f}function x(e,t,r,a,n,i,o,s,l,u){void 0===i&&(i=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0),S(e,t,r,a,n,i,o,null,s,l,u)}function S(e,t,n,i,s,l,u,f,h,d,v){void 0===l&&(l=1),void 0===h&&(h=0),void 0===d&&(d=0),void 0===v&&(v=0),y(u);var p=[];r(n,function(e,t,r,a){p.push(e,t,r,a)}),p=new Float32Array(p),o(u,function(r){var n=r.gl,o=r.isWebGL2,u=r.getExtension,g=r.withProgram,m=r.withTexture,y=r.withTextureFramebuffer,b=r.handleContextLoss;if(m("rawDistances",function(r,m){(e!==r._lastWidth||t!==r._lastHeight)&&n.texImage2D(n.TEXTURE_2D,0,n.RGBA,r._lastWidth=e,r._lastHeight=t,0,n.RGBA,n.UNSIGNED_BYTE,null),g("main","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);}","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);}",function(a){var f=a.setAttribute,h=a.setUniform,d=!o&&u("ANGLE_instanced_arrays"),v=!o&&u("EXT_blend_minmax");f("aUV",2,n.STATIC_DRAW,0,c),f("aLineSegment",4,n.DYNAMIC_DRAW,1,p),h.apply(void 0,["4f","uGlyphBounds"].concat(i)),h("1f","uMaxDistance",s),h("1f","uExponent",l),y(r,m,function(r){n.enable(n.BLEND),n.colorMask(!0,!0,!0,!0),n.viewport(0,0,e,t),n.scissor(0,0,e,t),n.blendFunc(n.ONE,n.ONE),n.blendEquationSeparate(n.FUNC_ADD,o?n.MAX:v.MAX_EXT),n.clear(n.COLOR_BUFFER_BIT),o?n.drawArraysInstanced(n.TRIANGLES,0,3,p.length/4):d.drawArraysInstancedANGLE(n.TRIANGLES,0,3,p.length/4)})}),g("post",a,"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);}",function(r){r.setAttribute("aUV",2,n.STATIC_DRAW,0,c),r.setUniform("1i","tex",m),n.bindFramebuffer(n.FRAMEBUFFER,f),n.disable(n.BLEND),n.colorMask(0===v,1===v,2===v,3===v),n.viewport(h,d,e,t),n.scissor(h,d,e,t),n.drawArrays(n.TRIANGLES,0,3)})}),n.isContextLost())throw b(),Error("webgl context lost")})}function U(e){var t=e&&e!==v?e.canvas||e:g,r=m.get(t);if(void 0===r){p=!0;var a=null;try{var n=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],i=b(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,e);(r=i&&n.length===i.length&&i.every(function(e,t){return e===n[t]}))||(a="bad trial run results",console.info(n,i))}catch(e){r=!1,a=e.message}a&&console.warn("WebGL SDF generation not supported:",a),p=!1,m.set(t,r)}return r}var T=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:x,generateIntoFramebuffer:S,isSupported:U});return e.forEachPathCommand=t,e.generate=function(e,t,r,a,n,i){void 0===n&&(n=Math.max(a[2]-a[0],a[3]-a[1])/2),void 0===i&&(i=1);try{return b.apply(T,arguments)}catch(e){return console.info("WebGL SDF generation failed, falling back to JS",e),u.apply(d,arguments)}},e.generateIntoCanvas=function(e,t,r,a,n,i,o,s,l,u){void 0===n&&(n=Math.max(a[2]-a[0],a[3]-a[1])/2),void 0===i&&(i=1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0);try{return x.apply(T,arguments)}catch(e){return console.info("WebGL SDF generation failed, falling back to JS",e),f.apply(d,arguments)}},e.javascript=d,e.pathToLineSegments=r,e.webgl=T,e.webglUtils=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}var w=e.i(8560),_=f;let C=/\bvoid\s+main\s*\(\s*\)\s*{/g;function F(e){return e.replace(/^[ \t]*#include +<([\w\d./]+)>/gm,function(e,t){let r=w.ShaderChunk[t];return r?F(r):e})}let D=[];for(let e=0;e<256;e++)D[e]=(e<16?"0":"")+e.toString(16);let M=Object.assign||function(){let e=arguments[0];for(let t=1,r=arguments.length;t<r;t++){let r=arguments[t];if(r)for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},A=Date.now(),E=new WeakMap,I=new Map,R=1e10;function P(e,t){let r,a,n=(r=JSON.stringify(t,G),null==(a=L.get(r))&&L.set(r,a=++B),a),i=E.get(e);if(i||E.set(e,i=Object.create(null)),i[n])return new i[n];let o=`_onBeforeCompile${n}`,s=function(r,a){e.onBeforeCompile.call(this,r,a);let i=this.customProgramCacheKey()+"|"+r.vertexShader+"|"+r.fragmentShader,s=I[i];if(!s){let e=function(e,{vertexShader:t,fragmentShader:r},a,n){let{vertexDefs:i,vertexMainIntro:o,vertexMainOutro:s,vertexTransform:l,fragmentDefs:u,fragmentMainIntro:f,fragmentMainOutro:h,fragmentColorTransform:d,customRewriter:c,timeUniform:v}=a;if(i=i||"",o=o||"",s=s||"",u=u||"",f=f||"",h=h||"",(l||c)&&(t=F(t)),(d||c)&&(r=F(r=r.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,"\n//!BEGIN_POST_CHUNK $1\n$&\n//!END_POST_CHUNK\n"))),c){let e=c({vertexShader:t,fragmentShader:r});t=e.vertexShader,r=e.fragmentShader}if(d){let e=[];r=r.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,t=>(e.push(t),"")),h=`${d} ${e.join("\n")} ${h}`}if(v){let e=` uniform float ${v}; `;i=e+i,u=e+u}return l&&(t=`vec3 troika_position_${n}; vec3 troika_normal_${n}; vec2 troika_uv_${n}; ${t} `,i=`${i} void troikaVertexTransform${n}(inout vec3 position, inout vec3 normal, inout vec2 uv) { ${l} } `,o=` troika_position_${n} = vec3(position); troika_normal_${n} = vec3(normal); troika_uv_${n} = vec2(uv); troikaVertexTransform${n}(troika_position_${n}, troika_normal_${n}, troika_uv_${n}); ${o} `,t=t.replace(/\b(position|normal|uv)\b/g,(e,t,r,a)=>/\battribute\s+vec[23]\s+$/.test(a.substr(0,r))?t:`troika_${t}_${n}`),e.map&&e.map.channel>0||(t=t.replace(/\bMAP_UV\b/g,`troika_uv_${n}`))),{vertexShader:t=O(t,n,i,o,s),fragmentShader:r=O(r,n,u,f,h)}}(this,r,t,n);s=I[i]=e}r.vertexShader=s.vertexShader,r.fragmentShader=s.fragmentShader,M(r.uniforms,this.uniforms),t.timeUniform&&(r.uniforms[t.timeUniform]={get value(){return Date.now()-A}}),this[o]&&this[o](r)},l=function(){return u(t.chained?e:e.clone())},u=function(r){let a,i,o,s,l=Object.create(r,f);return Object.defineProperty(l,"baseMaterial",{value:e}),Object.defineProperty(l,"id",{value:R++}),a=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,o=0xffffffff*Math.random()|0,s=0xffffffff*Math.random()|0,l.uuid=(D[255&a]+D[a>>8&255]+D[a>>16&255]+D[a>>24&255]+"-"+D[255&i]+D[i>>8&255]+"-"+D[i>>16&15|64]+D[i>>24&255]+"-"+D[63&o|128]+D[o>>8&255]+"-"+D[o>>16&255]+D[o>>24&255]+D[255&s]+D[s>>8&255]+D[s>>16&255]+D[s>>24&255]).toUpperCase(),l.uniforms=M({},r.uniforms,t.uniforms),l.defines=M({},r.defines,t.defines),l.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",l.extensions=M({},r.extensions,t.extensions),l._listeners=void 0,l},f={constructor:{value:l},isDerivedMaterial:{value:!0},type:{get:()=>e.type,set:t=>{e.type=t}},isDerivedFrom:{writable:!0,configurable:!0,value:function(e){let t=this.baseMaterial;return e===t||t.isDerivedMaterial&&t.isDerivedFrom(e)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return e.customProgramCacheKey()+"|"+n}},onBeforeCompile:{get:()=>s,set(e){this[o]=e}},copy:{writable:!0,configurable:!0,value:function(t){return e.copy.call(this,t),e.isShaderMaterial||e.isDerivedMaterial||(M(this.extensions,t.extensions),M(this.defines,t.defines),M(this.uniforms,_.UniformsUtils.clone(t.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){return u(new e.constructor).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let r=this._depthMaterial;return r||((r=this._depthMaterial=P(e.isDerivedMaterial?e.getDepthMaterial():new _.MeshDepthMaterial({depthPacking:_.RGBADepthPacking}),t)).defines.IS_DEPTH_MATERIAL="",r.uniforms=this.uniforms),r}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let r=this._distanceMaterial;return r||((r=this._distanceMaterial=P(e.isDerivedMaterial?e.getDistanceMaterial():new _.MeshDistanceMaterial,t)).defines.IS_DISTANCE_MATERIAL="",r.uniforms=this.uniforms),r}},dispose:{writable:!0,configurable:!0,value(){let{_depthMaterial:t,_distanceMaterial:r}=this;t&&t.dispose(),r&&r.dispose(),e.dispose.call(this)}}};return i[n]=l,new l}function O(e,t,r,a,n){return(a||n||r)&&(e=e.replace(C,` ${r} void troikaOrigMain${t}() {`)+` void main() { ${a} troikaOrigMain${t}(); ${n} }`),e}function G(e,t){return"uniforms"===e?void 0:"function"==typeof t?t.toString():t}let B=0,L=new Map,z=` uniform vec3 pointA; uniform vec3 controlA; uniform vec3 controlB; uniform vec3 pointB; uniform float radius; varying float bezierT; vec3 cubicBezier(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) { float t2 = 1.0 - t; float b0 = t2 * t2 * t2; float b1 = 3.0 * t * t2 * t2; float b2 = 3.0 * t * t * t2; float b3 = t * t * t; return b0 * p1 + b1 * c1 + b2 * c2 + b3 * p2; } vec3 cubicBezierDerivative(vec3 p1, vec3 c1, vec3 c2, vec3 p2, float t) { float t2 = 1.0 - t; return -3.0 * p1 * t2 * t2 + c1 * (3.0 * t2 * t2 - 6.0 * t2 * t) + c2 * (6.0 * t2 * t - 3.0 * t * t) + 3.0 * p2 * t * t; } `,W=` float t = position.y; bezierT = t; vec3 bezierCenterPos = cubicBezier(pointA, controlA, controlB, pointB, t); vec3 bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t)); // Make "sideways" always perpendicular to the camera ray; this ensures that any twists // in the cylinder occur where you won't see them: vec3 viewDirection = normalMatrix * vec3(0.0, 0.0, 1.0); if (bezierDir == viewDirection) { bezierDir = normalize(cubicBezierDerivative(pointA, controlA, controlB, pointB, t == 1.0 ? t - 0.0001 : t + 0.0001)); } vec3 sideways = normalize(cross(bezierDir, viewDirection)); vec3 upish = normalize(cross(sideways, bezierDir)); // Build a matrix for transforming this disc in the cylinder: mat4 discTx; discTx[0].xyz = sideways * radius; discTx[1].xyz = bezierDir * radius; discTx[2].xyz = upish * radius; discTx[3].xyz = bezierCenterPos; discTx[3][3] = 1.0; // Apply transform, ignoring original y position = (discTx * vec4(position.x, 0.0, position.z, 1.0)).xyz; normal = normalize(mat3(discTx) * normal); `,j=` uniform vec3 dashing; varying float bezierT; `,V=` if (dashing.x + dashing.y > 0.0) { float dashFrac = mod(bezierT - dashing.z, dashing.x + dashing.y); if (dashFrac > dashing.x) { discard; } } `,N=null,q=new _.MeshStandardMaterial({color:0xffffff,side:_.DoubleSide});class X extends _.Mesh{static getGeometry(){return N||(N=new _.CylinderGeometry(1,1,1,6,64).translate(0,.5,0))}constructor(){super(X.getGeometry(),q),this.pointA=new _.Vector3,this.controlA=new _.Vector3,this.controlB=new _.Vector3,this.pointB=new _.Vector3,this.radius=.01,this.dashArray=new _.Vector2,this.dashOffset=0,this.frustumCulled=!1}get material(){let e=this._derivedMaterial,t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=q.clone());return e&&e.baseMaterial===t||(e=this._derivedMaterial=P(t,{chained:!0,uniforms:{pointA:{value:new _.Vector3},controlA:{value:new _.Vector3},controlB:{value:new _.Vector3},pointB:{value:new _.Vector3},radius:{value:.01},dashing:{value:new _.Vector3}},vertexDefs:z,vertexTransform:W,fragmentDefs:j,fragmentMainIntro:V}),t.addEventListener("dispose",function r(){t.removeEventListener("dispose",r),e.dispose()})),e}set material(e){this._baseMaterial=e}get customDepthMaterial(){return this.material.getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return this.material.getDistanceMaterial()}set customDistanceMaterial(e){}onBeforeRender(){let{uniforms:e}=this.material,{pointA:t,controlA:r,controlB:a,pointB:n,radius:i,dashArray:o,dashOffset:s}=this;e.pointA.value.copy(t),e.controlA.value.copy(r),e.controlB.value.copy(a),e.pointB.value.copy(n),e.radius.value=i,e.dashing.value.set(o.x,o.y,s||0)}raycast(){}}let $=S({name:"Typr Font Parser",dependencies:[function(){var e,t,r;return"u"<typeof window&&(self.window=self),(e={},(t={parse:function(e){var r=t._bin,a=new Uint8Array(e);if("ttcf"==r.readASCII(a,0,4)){var n=4;r.readUshort(a,n),n+=2,r.readUshort(a,n),n+=2;var i=r.readUint(a,n);n+=4;for(var o=[],s=0;s<i;s++){var l=r.readUint(a,n);n+=4,o.push(t._readFont(a,l))}return o}return[t._readFont(a,0)]},_readFont:function(e,r){var a=t._bin,n=r;a.readFixed(e,r),r+=4;var i=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2;for(var o=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],s={_data:e,_offset:n},l={},u=0;u<i;u++){var f=a.readASCII(e,r,4);r+=4,a.readUint(e,r),r+=4;var h=a.readUint(e,r);r+=4;var d=a.readUint(e,r);r+=4,l[f]={offset:h,length:d}}for(u=0;u<o.length;u++){var c=o[u];l[c]&&(s[c.trim()]=t[c.trim()].parse(e,l[c].offset,l[c].length,s))}return s},_tabOffset:function(e,r,a){for(var n=t._bin,i=n.readUshort(e,a+4),o=a+12,s=0;s<i;s++){var l=n.readASCII(e,o,4);o+=4,n.readUint(e,o),o+=4;var u=n.readUint(e,o);if(o+=4,n.readUint(e,o),o+=4,l==r)return u}return 0}})._bin={readFixed:function(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<8|e[t+3])/65540},readF2dot14:function(e,r){return t._bin.readShort(e,r)/16384},readInt:function(e,r){return t._bin._view(e).getInt32(r)},readInt8:function(e,r){return t._bin._view(e).getInt8(r)},readShort:function(e,r){return t._bin._view(e).getInt16(r)},readUshort:function(e,r){return t._bin._view(e).getUint16(r)},readUshorts:function(e,r,a){for(var n=[],i=0;i<a;i++)n.push(t._bin.readUshort(e,r+2*i));return n},readUint:function(e,r){return t._bin._view(e).getUint32(r)},readUint64:function(e,r){return 0x100000000*t._bin.readUint(e,r)+t._bin.readUint(e,r+4)},readASCII:function(e,t,r){for(var a="",n=0;n<r;n++)a+=String.fromCharCode(e[t+n]);return a},readUnicode:function(e,t,r){for(var a="",n=0;n<r;n++)a+=String.fromCharCode(e[t++]<<8|e[t++]);return a},_tdec:"u">typeof window&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(e,r,a){var n=t._bin._tdec;return n&&0==r&&a==e.length?n.decode(e):t._bin.readASCII(e,r,a)},readBytes:function(e,t,r){for(var a=[],n=0;n<r;n++)a.push(e[t+n]);return a},readASCIIArray:function(e,t,r){for(var a=[],n=0;n<r;n++)a.push(String.fromCharCode(e[t+n]));return a},_view:function(e){return e._dataView||(e._dataView=e.buffer?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(new Uint8Array(e).buffer))}},t._lctf={},t._lctf.parse=function(e,r,a,n,i){var o=t._bin,s={},l=r;o.readFixed(e,r),r+=4;var u=o.readUshort(e,r);r+=2;var f=o.readUshort(e,r);r+=2;var h=o.readUshort(e,r);return r+=2,s.scriptList=t._lctf.readScriptList(e,l+u),s.featureList=t._lctf.readFeatureList(e,l+f),s.lookupList=t._lctf.readLookupList(e,l+h,i),s},t._lctf.readLookupList=function(e,r,a){var n=t._bin,i=r,o=[],s=n.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var u=n.readUshort(e,r);r+=2;var f=t._lctf.readLookupTable(e,i+u,a);o.push(f)}return o},t._lctf.readLookupTable=function(e,r,a){var n=t._bin,i=r,o={tabs:[]};o.ltype=n.readUshort(e,r),r+=2,o.flag=n.readUshort(e,r),r+=2;var s=n.readUshort(e,r);r+=2;for(var l=o.ltype,u=0;u<s;u++){var f=n.readUshort(e,r);r+=2;var h=a(e,l,i+f,o);o.tabs.push(h)}return o},t._lctf.numOfOnes=function(e){for(var t=0,r=0;r<32;r++)0!=(e>>>r&1)&&t++;return t},t._lctf.readClassDef=function(e,r){var a=t._bin,n=[],i=a.readUshort(e,r);if(r+=2,1==i){var o=a.readUshort(e,r);r+=2;var s=a.readUshort(e,r);r+=2;for(var l=0;l<s;l++)n.push(o+l),n.push(o+l),n.push(a.readUshort(e,r)),r+=2}if(2==i){var u=a.readUshort(e,r);for(r+=2,l=0;l<u;l++)n.push(a.readUshort(e,r)),r+=2,n.push(a.readUshort(e,r)),r+=2,n.push(a.readUshort(e,r)),r+=2}return n},t._lctf.getInterval=function(e,t){for(var r=0;r<e.length;r+=3){var a=e[r],n=e[r+1];if(e[r+2],a<=t&&t<=n)return r}return -1},t._lctf.readCoverage=function(e,r){var a=t._bin,n={};n.fmt=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);return r+=2,1==n.fmt&&(n.tab=a.readUshorts(e,r,i)),2==n.fmt&&(n.tab=a.readUshorts(e,r,3*i)),n},t._lctf.coverageIndex=function(e,r){var a=e.tab;if(1==e.fmt)return a.indexOf(r);if(2==e.fmt){var n=t._lctf.getInterval(a,r);if(-1!=n)return a[n+2]+(r-a[n])}return -1},t._lctf.readFeatureList=function(e,r){var a=t._bin,n=r,i=[],o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readASCII(e,r,4);r+=4;var u=a.readUshort(e,r);r+=2;var f=t._lctf.readFeatureTable(e,n+u);f.tag=l.trim(),i.push(f)}return i},t._lctf.readFeatureTable=function(e,r){var a=t._bin,n=r,i={},o=a.readUshort(e,r);r+=2,o>0&&(i.featureParams=n+o);var s=a.readUshort(e,r);r+=2,i.tab=[];for(var l=0;l<s;l++)i.tab.push(a.readUshort(e,r+2*l));return i},t._lctf.readScriptList=function(e,r){var a=t._bin,n=r,i={},o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readASCII(e,r,4);r+=4;var u=a.readUshort(e,r);r+=2,i[l.trim()]=t._lctf.readScriptTable(e,n+u)}return i},t._lctf.readScriptTable=function(e,r){var a=t._bin,n=r,i={},o=a.readUshort(e,r);r+=2,o>0&&(i.default=t._lctf.readLangSysTable(e,n+o));var s=a.readUshort(e,r);r+=2;for(var l=0;l<s;l++){var u=a.readASCII(e,r,4);r+=4;var f=a.readUshort(e,r);r+=2,i[u.trim()]=t._lctf.readLangSysTable(e,n+f)}return i},t._lctf.readLangSysTable=function(e,r){var a=t._bin,n={};a.readUshort(e,r),r+=2,n.reqFeature=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);return r+=2,n.features=a.readUshorts(e,r,i),n},t.CFF={},t.CFF.parse=function(e,r,a){var n=t._bin;(e=new Uint8Array(e.buffer,r,a))[r=0],e[++r],e[++r],e[++r],r++;var i=[];r=t.CFF.readIndex(e,r,i);for(var o=[],s=0;s<i.length-1;s++)o.push(n.readASCII(e,r+i[s],i[s+1]-i[s]));r+=i[i.length-1];var l=[];r=t.CFF.readIndex(e,r,l);var u=[];for(s=0;s<l.length-1;s++)u.push(t.CFF.readDict(e,r+l[s],r+l[s+1]));r+=l[l.length-1];var f=u[0],h=[];r=t.CFF.readIndex(e,r,h);var d=[];for(s=0;s<h.length-1;s++)d.push(n.readASCII(e,r+h[s],h[s+1]-h[s]));if(r+=h[h.length-1],t.CFF.readSubrs(e,r,f),f.CharStrings){r=f.CharStrings,h=[],r=t.CFF.readIndex(e,r,h);var c=[];for(s=0;s<h.length-1;s++)c.push(n.readBytes(e,r+h[s],h[s+1]-h[s]));f.CharStrings=c}if(f.ROS){r=f.FDArray;var v=[];for(r=t.CFF.readIndex(e,r,v),f.FDArray=[],s=0;s<v.length-1;s++){var p=t.CFF.readDict(e,r+v[s],r+v[s+1]);t.CFF._readFDict(e,p,d),f.FDArray.push(p)}r+=v[v.length-1],r=f.FDSelect,f.FDSelect=[];var g=e[r];if(r++,3!=g)throw g;var m=n.readUshort(e,r);for(r+=2,s=0;s<m+1;s++)f.FDSelect.push(n.readUshort(e,r),e[r+2]),r+=3}return f.Encoding&&(f.Encoding=t.CFF.readEncoding(e,f.Encoding,f.CharStrings.length)),f.charset&&(f.charset=t.CFF.readCharset(e,f.charset,f.CharStrings.length)),t.CFF._readFDict(e,f,d),f},t.CFF._readFDict=function(e,r,a){var n;for(var i in r.Private&&(n=r.Private[1],r.Private=t.CFF.readDict(e,n,n+r.Private[0]),r.Private.Subrs&&t.CFF.readSubrs(e,n+r.Private.Subrs,r.Private)),r)-1!=["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(i)&&(r[i]=a[r[i]-426+35])},t.CFF.readSubrs=function(e,r,a){var n=t._bin,i=[];r=t.CFF.readIndex(e,r,i);var o=i.length;a.Bias=o<1240?107:o<33900?1131:32768,a.Subrs=[];for(var s=0;s<i.length-1;s++)a.Subrs.push(n.readBytes(e,r+i[s],i[s+1]-i[s]))},t.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],t.CFF.glyphByUnicode=function(e,t){for(var r=0;r<e.charset.length;r++)if(e.charset[r]==t)return r;return -1},t.CFF.glyphBySE=function(e,r){return r<0||r>255?-1:t.CFF.glyphByUnicode(e,t.CFF.tableSE[r])},t.CFF.readEncoding=function(e,r,a){t._bin;var n=[".notdef"],i=e[r];if(r++,0!=i)throw"error: unknown encoding format: "+i;var o=e[r];r++;for(var s=0;s<o;s++)n.push(e[r+s]);return n},t.CFF.readCharset=function(e,r,a){var n=t._bin,i=[".notdef"],o=e[r];if(r++,0==o)for(var s=0;s<a;s++){var l=n.readUshort(e,r);r+=2,i.push(l)}else{if(1!=o&&2!=o)throw"error: format: "+o;for(;i.length<a;){l=n.readUshort(e,r),r+=2;var u=0;for(1==o?(u=e[r],r++):(u=n.readUshort(e,r),r+=2),s=0;s<=u;s++)i.push(l),l++}}return i},t.CFF.readIndex=function(e,r,a){var n=t._bin,i=n.readUshort(e,r)+1,o=e[r+=2];if(r++,1==o)for(var s=0;s<i;s++)a.push(e[r+s]);else if(2==o)for(s=0;s<i;s++)a.push(n.readUshort(e,r+2*s));else if(3==o)for(s=0;s<i;s++)a.push(0xffffff&n.readUint(e,r+3*s-1));else if(1!=i)throw"unsupported offset size: "+o+", count: "+i;return(r+=i*o)-1},t.CFF.getCharString=function(e,r,a){var n=t._bin,i=e[r],o=e[r+1];e[r+2],e[r+3],e[r+4];var s=1,l=null,u=null;i<=20&&(l=i,s=1),12==i&&(l=100*i+o,s=2),21<=i&&i<=27&&(l=i,s=1),28==i&&(u=n.readShort(e,r+1),s=3),29<=i&&i<=31&&(l=i,s=1),32<=i&&i<=246&&(u=i-139,s=1),247<=i&&i<=250&&(u=256*(i-247)+o+108,s=2),251<=i&&i<=254&&(u=-(256*(i-251))-o-108,s=2),255==i&&(u=n.readInt(e,r+1)/65535,s=5),a.val=null!=u?u:"o"+l,a.size=s},t.CFF.readCharString=function(e,r,a){for(var n=r+a,i=t._bin,o=[];r<n;){var s=e[r],l=e[r+1];e[r+2],e[r+3],e[r+4];var u=1,f=null,h=null;s<=20&&(f=s,u=1),12==s&&(f=100*s+l,u=2),19!=s&&20!=s||(f=s,u=2),21<=s&&s<=27&&(f=s,u=1),28==s&&(h=i.readShort(e,r+1),u=3),29<=s&&s<=31&&(f=s,u=1),32<=s&&s<=246&&(h=s-139,u=1),247<=s&&s<=250&&(h=256*(s-247)+l+108,u=2),251<=s&&s<=254&&(h=-(256*(s-251))-l-108,u=2),255==s&&(h=i.readInt(e,r+1)/65535,u=5),o.push(null!=h?h:"o"+f),r+=u}return o},t.CFF.readDict=function(e,r,a){for(var n=t._bin,i={},o=[];r<a;){var s=e[r],l=e[r+1];e[r+2],e[r+3],e[r+4];var u=1,f=null,h=null;if(28==s&&(h=n.readShort(e,r+1),u=3),29==s&&(h=n.readInt(e,r+1),u=5),32<=s&&s<=246&&(h=s-139,u=1),247<=s&&s<=250&&(h=256*(s-247)+l+108,u=2),251<=s&&s<=254&&(h=-(256*(s-251))-l-108,u=2),255==s)throw h=n.readInt(e,r+1)/65535,u=5,"unknown number";if(30==s){var d=[];for(u=1;;){var c=e[r+u];u++;var v=c>>4,p=15&c;if(15!=v&&d.push(v),15!=p&&d.push(p),15==p)break}for(var g="",m=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],y=0;y<d.length;y++)g+=m[d[y]];h=parseFloat(g)}s<=21&&(f=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][s],u=1,12==s)&&(f=["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"][l],u=2),null!=f?(i[f]=1==o.length?o[0]:o,o=[]):o.push(h),r+=u}return i},t.cmap={},t.cmap.parse=function(e,r,a){e=new Uint8Array(e.buffer,r,a),r=0;var n=t._bin,i={};n.readUshort(e,r),r+=2;var o=n.readUshort(e,r);r+=2;var s=[];i.tables=[];for(var l=0;l<o;l++){var u=n.readUshort(e,r);r+=2;var f=n.readUshort(e,r);r+=2;var h=n.readUint(e,r);r+=4;var d="p"+u+"e"+f,c=s.indexOf(h);if(-1==c){c=i.tables.length,s.push(h);var v,p=n.readUshort(e,h);0==p?v=t.cmap.parse0(e,h):4==p?v=t.cmap.parse4(e,h):6==p?v=t.cmap.parse6(e,h):12==p?v=t.cmap.parse12(e,h):console.debug("unknown format: "+p,u,f,h),i.tables.push(v)}if(null!=i[d])throw"multiple tables for one platform+encoding";i[d]=c}return i},t.cmap.parse0=function(e,r){var a=t._bin,n={};n.format=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2,n.map=[];for(var o=0;o<i-6;o++)n.map.push(e[r+o]);return n},t.cmap.parse4=function(e,r){var a=t._bin,n=r,i={};i.format=a.readUshort(e,r),r+=2;var o=a.readUshort(e,r);r+=2,a.readUshort(e,r),r+=2;var s=a.readUshort(e,r);r+=2;var l=s/2;i.searchRange=a.readUshort(e,r),r+=2,i.entrySelector=a.readUshort(e,r),r+=2,i.rangeShift=a.readUshort(e,r),r+=2,i.endCount=a.readUshorts(e,r,l),r+=2*l,r+=2,i.startCount=a.readUshorts(e,r,l),r+=2*l,i.idDelta=[];for(var u=0;u<l;u++)i.idDelta.push(a.readShort(e,r)),r+=2;for(i.idRangeOffset=a.readUshorts(e,r,l),r+=2*l,i.glyphIdArray=[];r<n+o;)i.glyphIdArray.push(a.readUshort(e,r)),r+=2;return i},t.cmap.parse6=function(e,r){var a=t._bin,n={};n.format=a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,a.readUshort(e,r),r+=2,n.firstCode=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);r+=2,n.glyphIdArray=[];for(var o=0;o<i;o++)n.glyphIdArray.push(a.readUshort(e,r)),r+=2;return n},t.cmap.parse12=function(e,r){var a=t._bin,n={};n.format=a.readUshort(e,r),r+=2,r+=2,a.readUint(e,r),r+=4,a.readUint(e,r),r+=4;var i=a.readUint(e,r);r+=4,n.groups=[];for(var o=0;o<i;o++){var s=r+12*o,l=a.readUint(e,s+0),u=a.readUint(e,s+4),f=a.readUint(e,s+8);n.groups.push([l,u,f])}return n},t.glyf={},t.glyf.parse=function(e,t,r,a){for(var n=[],i=0;i<a.maxp.numGlyphs;i++)n.push(null);return n},t.glyf._parseGlyf=function(e,r){var a,n=t._bin,i=e._data,o=t._tabOffset(i,"glyf",e._offset)+e.loca[r];if(e.loca[r]==e.loca[r+1])return null;var s={};if(s.noc=n.readShort(i,o),o+=2,s.xMin=n.readShort(i,o),o+=2,s.yMin=n.readShort(i,o),o+=2,s.xMax=n.readShort(i,o),o+=2,s.yMax=n.readShort(i,o),o+=2,s.xMin>=s.xMax||s.yMin>=s.yMax)return null;if(s.noc>0){s.endPts=[];for(var l=0;l<s.noc;l++)s.endPts.push(n.readUshort(i,o)),o+=2;var u=n.readUshort(i,o);if(o+=2,i.length-o<u)return null;s.instructions=n.readBytes(i,o,u),o+=u;var f=s.endPts[s.noc-1]+1;for(l=0,s.flags=[];l<f;l++){var h=i[o];if(o++,s.flags.push(h),0!=(8&h)){var d=i[o];o++;for(var c=0;c<d;c++)s.flags.push(h),l++}}for(l=0,s.xs=[];l<f;l++){var v=0!=(2&s.flags[l]),p=0!=(16&s.flags[l]);v?(s.xs.push(p?i[o]:-i[o]),o++):p?s.xs.push(0):(s.xs.push(n.readShort(i,o)),o+=2)}for(l=0,s.ys=[];l<f;l++)v=0!=(4&s.flags[l]),p=0!=(32&s.flags[l]),v?(s.ys.push(p?i[o]:-i[o]),o++):p?s.ys.push(0):(s.ys.push(n.readShort(i,o)),o+=2);var g=0,m=0;for(l=0;l<f;l++)g+=s.xs[l],m+=s.ys[l],s.xs[l]=g,s.ys[l]=m}else{s.parts=[];do{a=n.readUshort(i,o),o+=2;var y={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(s.parts.push(y),y.glyphIndex=n.readUshort(i,o),o+=2,1&a){var b=n.readShort(i,o);o+=2;var x=n.readShort(i,o);o+=2}else b=n.readInt8(i,o),o++,x=n.readInt8(i,o),o++;2&a?(y.m.tx=b,y.m.ty=x):(y.p1=b,y.p2=x),8&a?(y.m.a=y.m.d=n.readF2dot14(i,o),o+=2):64&a?(y.m.a=n.readF2dot14(i,o),o+=2,y.m.d=n.readF2dot14(i,o),o+=2):128&a&&(y.m.a=n.readF2dot14(i,o),o+=2,y.m.b=n.readF2dot14(i,o),o+=2,y.m.c=n.readF2dot14(i,o),o+=2,y.m.d=n.readF2dot14(i,o),o+=2)}while(32&a)if(256&a){var S=n.readUshort(i,o);for(o+=2,s.instr=[],l=0;l<S;l++)s.instr.push(i[o]),o++}}return s},t.GDEF={},t.GDEF.parse=function(e,r,a,n){var i=r;r+=4;var o=t._bin.readUshort(e,r);return{glyphClassDef:0===o?null:t._lctf.readClassDef(e,i+o)}},t.GPOS={},t.GPOS.parse=function(e,r,a,n){return t._lctf.parse(e,r,a,n,t.GPOS.subt)},t.GPOS.subt=function(e,r,a,n){var i=t._bin,o=a,s={};if(s.fmt=i.readUshort(e,a),a+=2,1==r||2==r||3==r||7==r||8==r&&s.fmt<=2){var l=i.readUshort(e,a);a+=2,s.coverage=t._lctf.readCoverage(e,l+o)}if(1==r&&1==s.fmt){var u=i.readUshort(e,a);a+=2,0!=u&&(s.pos=t.GPOS.readValueRecord(e,a,u))}else if(2==r&&s.fmt>=1&&s.fmt<=2){u=i.readUshort(e,a),a+=2;var f=i.readUshort(e,a);a+=2;var h=t._lctf.numOfOnes(u),d=t._lctf.numOfOnes(f);if(1==s.fmt){s.pairsets=[];var c=i.readUshort(e,a);a+=2;for(var v=0;v<c;v++){var p=o+i.readUshort(e,a);a+=2;var g=i.readUshort(e,p);p+=2;for(var m=[],y=0;y<g;y++){var b=i.readUshort(e,p);p+=2,0!=u&&(w=t.GPOS.readValueRecord(e,p,u),p+=2*h),0!=f&&(_=t.GPOS.readValueRecord(e,p,f),p+=2*d),m.push({gid2:b,val1:w,val2:_})}s.pairsets.push(m)}}if(2==s.fmt){var x=i.readUshort(e,a);a+=2;var S=i.readUshort(e,a);a+=2;var U=i.readUshort(e,a);a+=2;var T=i.readUshort(e,a);for(a+=2,s.classDef1=t._lctf.readClassDef(e,o+x),s.classDef2=t._lctf.readClassDef(e,o+S),s.matrix=[],v=0;v<U;v++){var k=[];for(y=0;y<T;y++){var w=null,_=null;0!=u&&(w=t.GPOS.readValueRecord(e,a,u),a+=2*h),0!=f&&(_=t.GPOS.readValueRecord(e,a,f),a+=2*d),k.push({val1:w,val2:_})}s.matrix.push(k)}}}else if(4==r&&1==s.fmt)s.markCoverage=t._lctf.readCoverage(e,i.readUshort(e,a)+o),s.baseCoverage=t._lctf.readCoverage(e,i.readUshort(e,a+2)+o),s.markClassCount=i.readUshort(e,a+4),s.markArray=t.GPOS.readMarkArray(e,i.readUshort(e,a+6)+o),s.baseArray=t.GPOS.readBaseArray(e,i.readUshort(e,a+8)+o,s.markClassCount);else if(6==r&&1==s.fmt)s.mark1Coverage=t._lctf.readCoverage(e,i.readUshort(e,a)+o),s.mark2Coverage=t._lctf.readCoverage(e,i.readUshort(e,a+2)+o),s.markClassCount=i.readUshort(e,a+4),s.mark1Array=t.GPOS.readMarkArray(e,i.readUshort(e,a+6)+o),s.mark2Array=t.GPOS.readBaseArray(e,i.readUshort(e,a+8)+o,s.markClassCount);else{if(9==r&&1==s.fmt){var C=i.readUshort(e,a);a+=2;var F=i.readUint(e,a);if(a+=4,9==n.ltype)n.ltype=C;else if(n.ltype!=C)throw"invalid extension substitution";return t.GPOS.subt(e,n.ltype,o+F)}console.debug("unsupported GPOS table LookupType",r,"format",s.fmt)}return s},t.GPOS.readValueRecord=function(e,r,a){var n=t._bin,i=[];return i.push(1&a?n.readShort(e,r):0),r+=1&a?2:0,i.push(2&a?n.readShort(e,r):0),r+=2&a?2:0,i.push(4&a?n.readShort(e,r):0),r+=4&a?2:0,i.push(8&a?n.readShort(e,r):0),r+=8&a?2:0,i},t.GPOS.readBaseArray=function(e,r,a){var n=t._bin,i=[],o=r,s=n.readUshort(e,r);r+=2;for(var l=0;l<s;l++){for(var u=[],f=0;f<a;f++)u.push(t.GPOS.readAnchorRecord(e,o+n.readUshort(e,r))),r+=2;i.push(u)}return i},t.GPOS.readMarkArray=function(e,r){var a=t._bin,n=[],i=r,o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=t.GPOS.readAnchorRecord(e,a.readUshort(e,r+2)+i);l.markClass=a.readUshort(e,r),n.push(l),r+=4}return n},t.GPOS.readAnchorRecord=function(e,r){var a=t._bin,n={};return n.fmt=a.readUshort(e,r),n.x=a.readShort(e,r+2),n.y=a.readShort(e,r+4),n},t.GSUB={},t.GSUB.parse=function(e,r,a,n){return t._lctf.parse(e,r,a,n,t.GSUB.subt)},t.GSUB.subt=function(e,r,a,n){var i=t._bin,o=a,s={};if(s.fmt=i.readUshort(e,a),a+=2,1!=r&&2!=r&&4!=r&&5!=r&&6!=r)return null;if(1==r||2==r||4==r||5==r&&s.fmt<=2||6==r&&s.fmt<=2){var l=i.readUshort(e,a);a+=2,s.coverage=t._lctf.readCoverage(e,o+l)}if(1==r&&s.fmt>=1&&s.fmt<=2){if(1==s.fmt)s.delta=i.readShort(e,a),a+=2;else if(2==s.fmt){var u=i.readUshort(e,a);a+=2,s.newg=i.readUshorts(e,a,u),a+=2*s.newg.length}}else if(2==r&&1==s.fmt){u=i.readUshort(e,a),a+=2,s.seqs=[];for(var f=0;f<u;f++){var h=i.readUshort(e,a)+o;a+=2;var d=i.readUshort(e,h);s.seqs.push(i.readUshorts(e,h+2,d))}}else if(4==r)for(s.vals=[],u=i.readUshort(e,a),a+=2,f=0;f<u;f++){var c=i.readUshort(e,a);a+=2,s.vals.push(t.GSUB.readLigatureSet(e,o+c))}else if(5==r&&2==s.fmt){if(2==s.fmt){var v=i.readUshort(e,a);a+=2,s.cDef=t._lctf.readClassDef(e,o+v),s.scset=[];var p=i.readUshort(e,a);for(a+=2,f=0;f<p;f++){var g=i.readUshort(e,a);a+=2,s.scset.push(0==g?null:t.GSUB.readSubClassSet(e,o+g))}}}else if(6==r&&3==s.fmt){if(3==s.fmt){for(f=0;f<3;f++){u=i.readUshort(e,a),a+=2;for(var m=[],y=0;y<u;y++)m.push(t._lctf.readCoverage(e,o+i.readUshort(e,a+2*y)));a+=2*u,0==f&&(s.backCvg=m),1==f&&(s.inptCvg=m),2==f&&(s.ahedCvg=m)}u=i.readUshort(e,a),a+=2,s.lookupRec=t.GSUB.readSubstLookupRecords(e,a,u)}}else{if(7==r&&1==s.fmt){var b=i.readUshort(e,a);a+=2;var x=i.readUint(e,a);if(a+=4,9==n.ltype)n.ltype=b;else if(n.ltype!=b)throw"invalid extension substitution";return t.GSUB.subt(e,n.ltype,o+x)}console.debug("unsupported GSUB table LookupType",r,"format",s.fmt)}return s},t.GSUB.readSubClassSet=function(e,r){var a=t._bin.readUshort,n=r,i=[],o=a(e,r);r+=2;for(var s=0;s<o;s++){var l=a(e,r);r+=2,i.push(t.GSUB.readSubClassRule(e,n+l))}return i},t.GSUB.readSubClassRule=function(e,r){var a=t._bin.readUshort,n={},i=a(e,r),o=a(e,r+=2);r+=2,n.input=[];for(var s=0;s<i-1;s++)n.input.push(a(e,r)),r+=2;return n.substLookupRecords=t.GSUB.readSubstLookupRecords(e,r,o),n},t.GSUB.readSubstLookupRecords=function(e,r,a){for(var n=t._bin.readUshort,i=[],o=0;o<a;o++)i.push(n(e,r),n(e,r+2)),r+=4;return i},t.GSUB.readChainSubClassSet=function(e,r){var a=t._bin,n=r,i=[],o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readUshort(e,r);r+=2,i.push(t.GSUB.readChainSubClassRule(e,n+l))}return i},t.GSUB.readChainSubClassRule=function(e,r){for(var a=t._bin,n={},i=["backtrack","input","lookahead"],o=0;o<i.length;o++){var s=a.readUshort(e,r);r+=2,1==o&&s--,n[i[o]]=a.readUshorts(e,r,s),r+=2*n[i[o]].length}return s=a.readUshort(e,r),r+=2,n.subst=a.readUshorts(e,r,2*s),r+=2*n.subst.length,n},t.GSUB.readLigatureSet=function(e,r){var a=t._bin,n=r,i=[],o=a.readUshort(e,r);r+=2;for(var s=0;s<o;s++){var l=a.readUshort(e,r);r+=2,i.push(t.GSUB.readLigature(e,n+l))}return i},t.GSUB.readLigature=function(e,r){var a=t._bin,n={chain:[]};n.nglyph=a.readUshort(e,r),r+=2;var i=a.readUshort(e,r);r+=2;for(var o=0;o<i-1;o++)n.chain.push(a.readUshort(e,r)),r+=2;return n},t.head={},t.head.parse=function(e,r,a){var n=t._bin,i={};return n.readFixed(e,r),r+=4,i.fontRevision=n.readFixed(e,r),r+=4,n.readUint(e,r),r+=4,n.readUint(e,r),r+=4,i.flags=n.readUshort(e,r),r+=2,i.unitsPerEm=n.readUshort(e,r),r+=2,i.created=n.readUint64(e,r),r+=8,i.modified=n.readUint64(e,r),r+=8,i.xMin=n.readShort(e,r),r+=2,i.yMin=n.readShort(e,r),r+=2,i.xMax=n.readShort(e,r),r+=2,i.yMax=n.readShort(e,r),r+=2,i.macStyle=n.readUshort(e,r),r+=2,i.lowestRecPPEM=n.readUshort(e,r),r+=2,i.fontDirectionHint=n.readShort(e,r),r+=2,i.indexToLocFormat=n.readShort(e,r),r+=2,i.glyphDataFormat=n.readShort(e,r),r+=2,i},t.hhea={},t.hhea.parse=function(e,r,a){var n=t._bin,i={};return n.readFixed(e,r),r+=4,i.ascender=n.readShort(e,r),r+=2,i.descender=n.readShort(e,r),r+=2,i.lineGap=n.readShort(e,r),r+=2,i.advanceWidthMax=n.readUshort(e,r),r+=2,i.minLeftSideBearing=n.readShort(e,r),r+=2,i.minRightSideBearing=n.readShort(e,r),r+=2,i.xMaxExtent=n.readShort(e,r),r+=2,i.caretSlopeRise=n.readShort(e,r),r+=2,i.caretSlopeRun=n.readShort(e,r),r+=2,i.caretOffset=n.readShort(e,r),r+=2,r+=8,i.metricDataFormat=n.readShort(e,r),r+=2,i.numberOfHMetrics=n.readUshort(e,r),r+=2,i},t.hmtx={},t.hmtx.parse=function(e,r,a,n){for(var i=t._bin,o={aWidth:[],lsBearing:[]},s=0,l=0,u=0;u<n.maxp.numGlyphs;u++)u<n.hhea.numberOfHMetrics&&(s=i.readUshort(e,r),r+=2,l=i.readShort(e,r),r+=2),o.aWidth.push(s),o.lsBearing.push(l);return o},t.kern={},t.kern.parse=function(e,r,a,n){var i=t._bin,o=i.readUshort(e,r);if(r+=2,1==o)return t.kern.parseV1(e,r-2,a,n);var s=i.readUshort(e,r);r+=2;for(var l={glyph1:[],rval:[]},u=0;u<s;u++){r+=2,a=i.readUshort(e,r),r+=2;var f=i.readUshort(e,r);r+=2;var h=f>>>8;if(0!=(h&=15))throw"unknown kern table format: "+h;r=t.kern.readFormat0(e,r,l)}return l},t.kern.parseV1=function(e,r,a,n){var i=t._bin;i.readFixed(e,r),r+=4;var o=i.readUint(e,r);r+=4;for(var s={glyph1:[],rval:[]},l=0;l<o;l++){i.readUint(e,r),r+=4;var u=i.readUshort(e,r);r+=2,i.readUshort(e,r),r+=2;var f=u>>>8;if(0!=(f&=15))throw"unknown kern table format: "+f;r=t.kern.readFormat0(e,r,s)}return s},t.kern.readFormat0=function(e,r,a){var n=t._bin,i=-1,o=n.readUshort(e,r);r+=2,n.readUshort(e,r),r+=2,n.readUshort(e,r),r+=2,n.readUshort(e,r),r+=2;for(var s=0;s<o;s++){var l=n.readUshort(e,r);r+=2;var u=n.readUshort(e,r);r+=2;var f=n.readShort(e,r);r+=2,l!=i&&(a.glyph1.push(l),a.rval.push({glyph2:[],vals:[]}));var h=a.rval[a.rval.length-1];h.glyph2.push(u),h.vals.push(f),i=l}return r},t.loca={},t.loca.parse=function(e,r,a,n){var i=t._bin,o=[],s=n.head.indexToLocFormat,l=n.maxp.numGlyphs+1;if(0==s)for(var u=0;u<l;u++)o.push(i.readUshort(e,r+(u<<1))<<1);if(1==s)for(u=0;u<l;u++)o.push(i.readUint(e,r+(u<<2)));return o},t.maxp={},t.maxp.parse=function(e,r,a){var n=t._bin,i={},o=n.readUint(e,r);return r+=4,i.numGlyphs=n.readUshort(e,r),r+=2,65536==o&&(i.maxPoints=n.readUshort(e,r),r+=2,i.maxContours=n.readUshort(e,r),r+=2,i.maxCompositePoints=n.readUshort(e,r),r+=2,i.maxCompositeContours=n.readUshort(e,r),r+=2,i.maxZones=n.readUshort(e,r),r+=2,i.maxTwilightPoints=n.readUshort(e,r),r+=2,i.maxStorage=n.readUshort(e,r),r+=2,i.maxFunctionDefs=n.readUshort(e,r),r+=2,i.maxInstructionDefs=n.readUshort(e,r),r+=2,i.maxStackElements=n.readUshort(e,r),r+=2,i.maxSizeOfInstructions=n.readUshort(e,r),r+=2,i.maxComponentElements=n.readUshort(e,r),r+=2,i.maxComponentDepth=n.readUshort(e,r),r+=2),i},t.name={},t.name.parse=function(e,r,a){var n=t._bin,i={};n.readUshort(e,r),r+=2;var o=n.readUshort(e,r);r+=2,n.readUshort(e,r);for(var s,l=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],u=r+=2,f=0;f<o;f++){var h=n.readUshort(e,r);r+=2;var d=n.readUshort(e,r);r+=2;var c=n.readUshort(e,r);r+=2;var v=n.readUshort(e,r);r+=2;var p=n.readUshort(e,r);r+=2;var g=n.readUshort(e,r);r+=2;var m,y=l[v],b=u+12*o+g;if(0==h)m=n.readUnicode(e,b,p/2);else if(3==h&&0==d)m=n.readUnicode(e,b,p/2);else if(0==d)m=n.readASCII(e,b,p);else if(1==d)m=n.readUnicode(e,b,p/2);else if(3==d)m=n.readUnicode(e,b,p/2);else{if(1!=h)throw"unknown encoding "+d+", platformID: "+h;m=n.readASCII(e,b,p),console.debug("reading unknown MAC encoding "+d+" as ASCII")}var x="p"+h+","+c.toString(16);null==i[x]&&(i[x]={}),i[x][void 0!==y?y:v]=m,i[x]._lang=c}for(var S in i)if(null!=i[S].postScriptName&&1033==i[S]._lang)return i[S];for(var S in i)if(null!=i[S].postScriptName&&0==i[S]._lang)return i[S];for(var S in i)if(null!=i[S].postScriptName&&3084==i[S]._lang)return i[S];for(var S in i)if(null!=i[S].postScriptName)return i[S];for(var S in