modern-text 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernText={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={grad:.9,turn:360,rad:360/(2*Math.PI)},n=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},r=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},a=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},o=function(e){return{r:i(e.r,0,255),g:i(e.g,0,255),b:i(e.b,0,255),a:i(e.a)}},s=function(e){return{r:r(e.r),g:r(e.g),b:r(e.b),a:r(e.a,3)}},c=/^#([0-9a-f]{3,8})$/i,l=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},u=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},d=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},f=function(e){return{h:a(e.h),s:i(e.s,0,100),l:i(e.l,0,100),a:i(e.a)}},p=function(e){return{h:r(e.h),s:r(e.s),l:r(e.l),a:r(e.a,3)}},m=function(e){return d((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},h=function(e){return{h:(t=u(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},g=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,b={string:[[function(e){var t=c.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?r(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?r(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=v.exec(e)||y.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:o({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var n=g.exec(e)||_.exec(e);if(!n)return null;var r,i;return m(f({h:(r=n[1],i=n[2],i===void 0&&(i=`deg`),Number(r)*(t[i]||1)),s:Number(n[3]),l:Number(n[4]),a:n[5]===void 0?1:Number(n[5])/(n[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,r=e.g,i=e.b,a=e.a,s=a===void 0?1:a;return n(t)&&n(r)&&n(i)?o({r:Number(t),g:Number(r),b:Number(i),a:Number(s)}):null},`rgb`],[function(e){var t=e.h,r=e.s,i=e.l,a=e.a,o=a===void 0?1:a;return!n(t)||!n(r)||!n(i)?null:m(f({h:Number(t),s:Number(r),l:Number(i),a:Number(o)}))},`hsl`],[function(e){var t=e.h,r=e.s,o=e.v,s=e.a,c=s===void 0?1:s;return!n(t)||!n(r)||!n(o)?null:d(function(e){return{h:a(e.h),s:i(e.s,0,100),v:i(e.v,0,100),a:i(e.a)}}({h:Number(t),s:Number(r),v:Number(o),a:Number(c)}))},`hsv`]]},x=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},S=function(e){return typeof e==`string`?x(e.trim(),b.string):typeof e==`object`&&e?x(e,b.object):[null,void 0]},C=function(e,t){var n=h(e);return{h:n.h,s:i(n.s+100*t,0,100),l:n.l,a:n.a}},w=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},T=function(e,t){var n=h(e);return{h:n.h,s:n.s,l:i(n.l+100*t,0,100),a:n.a}},E=function(){function e(e){this.parsed=S(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return r(w(this.rgba),2)},e.prototype.isDark=function(){return w(this.rgba)<.5},e.prototype.isLight=function(){return w(this.rgba)>=.5},e.prototype.toHex=function(){return e=s(this.rgba),t=e.r,n=e.g,i=e.b,o=(a=e.a)<1?l(r(255*a)):``,`#`+l(t)+l(n)+l(i)+o;var e,t,n,i,a,o},e.prototype.toRgb=function(){return s(this.rgba)},e.prototype.toRgbString=function(){return e=s(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return p(h(this.rgba))},e.prototype.toHslString=function(){return e=p(h(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=u(this.rgba),{h:r(e.h),s:r(e.s),v:r(e.v),a:r(e.a,3)};var e},e.prototype.invert=function(){return D({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),D(C(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),D(C(this.rgba,-e))},e.prototype.grayscale=function(){return D(C(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),D(T(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),D(T(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?D({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):r(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=h(this.rgba);return typeof e==`number`?D({h:e,s:t.s,l:t.l,a:t.a}):r(t.h)},e.prototype.isEqual=function(e){return this.toHex()===D(e).toHex()},e}(),D=function(e){return e instanceof E?e:new E(e)};function O(e){return e==null||e===``||e===`none`}function k(e,t=0,n=10**t){return Math.round(n*e)/n+0}function A(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>A(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=A(i,t):n[r]=i)}return n}function j(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function M(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Array.from(new Set([...Object.keys(e),...Object.keys(t)]));return!n.length||n.every(n=>e[n]===t[n])}return!1}function N(e,t,n){let r=t.length-1;if(r<0)return e===void 0?n:e;for(let i=0;i<r;i++){if(e==null)return n;e=e[t[i]]}return e==null||e[t[r]]===void 0?n:e[t[r]]}function P(e,t,n){let r=t.length-1;for(let n=0;n<r;n++)typeof e[t[n]]!=`object`&&(e[t[n]]={}),e=e[t[n]];e[t[r]]=n}function F(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),N(e,t.split(`.`),n)):e[t]}function I(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),P(e,t.split(`.`),n)}var L=class{_eventListeners={};on(e,t){let n=this._eventListeners[e];n===void 0&&(n=[],this._eventListeners[e]=n);let r=n.indexOf(t);return r>-1&&n.splice(r,1),n.push(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n),this}off(e,t){let n=this._eventListeners[e];if(n!==void 0){let e=n.indexOf(t);e>-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._eventListeners[e];if(n!==void 0){let e=n.length;if(e>0)for(let r=0;r<e;r++)n[r].apply(this,t)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}},R=Symbol.for(`declarations`),z=Symbol.for(`inited`);function B(e){let t;if(Object.hasOwn(e,R))t=e[R];else{let n=Object.getPrototypeOf(e);t={...n?B(n):{}},e[R]=t}return t}function V(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?I(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??te(e,t,r),o)}function ee(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?F(e,r):e[i],a??=te(e,t,n),a}function te(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[z]?.[t]){e[z]||(e[z]={}),e[z][t]=!0;let n=typeof r==`function`?r():r;n!==void 0&&(e[t]=n,a=n)}return a===void 0&&i!==void 0&&(a=typeof i==`function`?i():i),a}function ne(e,t){function n(){return this.getProperty?this.getProperty(e):ee(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):V(this,e,n,t)}return{get:n,set:r}}function re(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=B(e);i[t]=r;let{get:a,set:o}=ne(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function ie(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);re(t.constructor,n,e)}}var ae=class extends L{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,t){this._properties[e]=t}offsetGetProperties(e){let t=this._properties,n=Object.keys(t),r={};for(let i,a,o=0;o<n.length;o++)i=n[o],a=t[i],a!==void 0&&(!e||e.includes(i))&&(a&&typeof a==`object`?`toJSON`in a?r[i]=a.toJSON():Array.isArray(a)?r[i]=[...a]:r[i]={...a}:r[i]=a);return r}offsetSetProperties(e){if(e&&typeof e==`object`){let t=Object.keys(e);for(let n,r=0;r<t.length;r++)n=t[r],this.offsetSetProperty(n,e[n])}return this}getProperty(e){let t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return ee(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??te(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)V(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??te(this,e,n),r)}}getProperties(e){let t={},n=this.getPropertyDeclarations(),r=Object.keys(n);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=n[a];o.internal||o.alias||(!e||e.includes(a))&&(t[a]=this.getProperty(a))}return t}setProperties(e){if(e&&typeof e==`object`)for(let t in e)this.setProperty(t,e[t]);return this}resetProperties(){let e=this.getPropertyDeclarations(),t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){let r=t[n],i=e[r];this.setProperty(r,typeof i.default==`function`?i.default():i.default)}return this}getPropertyDeclarations(){return B(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){let t=this.getPropertyDeclarations(),n=[];if(e&&e.getProperty&&e.setProperty){let r=Object.keys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=t[a];if(o.internal||o.alias)continue;let s=this.offsetGetProperty(a),c=e.getProperty(a);c!==void 0&&!Object.is(s,c)&&(this.offsetSetProperty(a,c),n.push({key:a,newValue:c,oldValue:s}))}}this._propertyAccessor=e;for(let e=0,t=n.length;e<t;e++){let{key:t,newValue:r,oldValue:i}=n[e];this.requestUpdate(t,r,i)}return this}async _nextTick(){return`requestAnimationFrame`in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&=(this.onUpdate(),!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,t,n){Object.is(t,n)||this.requestUpdate(e,t,n)}requestUpdate(e,t,n){e!==void 0&&(this._updatedProperties[e]=n,this._changedProperties.add(e),this._updateProperty(e,t,n),this.emit(`updateProperty`,e,t,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,n){}toJSON(){return this.offsetGetProperties()}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit(`destroy`),super.destroy()}};function oe(e){let t;return t=typeof e==`number`?{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:(e&255)/255}:e,D(t)}function se(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}}function ce(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var le=`#000000FF`;function ue(e){return oe(e).isValid()}function de(e,t=!1){let n=oe(e);if(!n.isValid()){if(typeof e==`string`)return e;let n=`Failed to normalizeColor ${e}`;if(t)throw Error(n);return console.warn(n),le}let{r,g:i,b:a,a:o}=se(n.rgba);return`#${ce(r)}${ce(i)}${ce(a)}${ce(k(o*255))}`}var fe=fe||{};fe.parse=(function(){let e={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i},t=``;function n(e){let n=Error(`${t}: ${e}`);throw n.source=t,n}function r(){let e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return y(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,d)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,d)}function o(t,r,i){return s(r,r=>{let a=i();return a&&(I(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:y(b)}})}function s(t,r){let i=I(t);if(i){I(e.startCall)||n(`Missing (`);let t=r(i);return I(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=F(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return F(`directional`,e.sideOrCorner,1)}function u(){return F(`angular`,e.angleValue,1)||F(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,I(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=p()||m();if(e)e.at=g();else{let t=h();if(t){e=t;let n=g();n&&(e.at=n)}else{let t=g();if(t)e={type:`default-radial`,at:t};else{let t=_();t&&(e={type:`default-radial`,at:t})}}}return e}function p(){let e=F(`shape`,/^(circle)/i,0);return e&&(e.style=P()||h()),e}function m(){let e=F(`shape`,/^(ellipse)/i,0);return e&&(e.style=_()||j()||h()),e}function h(){return F(`extent-keyword`,e.extentKeywords,1)}function g(){if(F(`position`,/^at/,0)){let e=_();return e||n(`Missing positioning value`),e}}function _(){let e=v();if(e.x||e.y)return{type:`position`,value:e}}function v(){return{x:j(),y:j()}}function y(t){let r=t(),i=[];if(r)for(i.push(r);I(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function b(){let e=x();return e||n(`Expected color definition`),e.length=j(),e}function x(){return C()||O()||D()||T()||w()||E()||S()}function S(){return F(`literal`,e.literalColor,0)}function C(){return F(`hex`,e.hexColor,1)}function w(){return s(e.rgbColor,()=>({type:`rgb`,value:y(A)}))}function T(){return s(e.rgbaColor,()=>({type:`rgba`,value:y(A)}))}function E(){return s(e.varColor,()=>({type:`var`,value:k()}))}function D(){return s(e.hslColor,()=>{I(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=A();I(e.comma);let r=I(e.percentageValue),i=r?r[1]:null;I(e.comma),r=I(e.percentageValue);let a=r?r[1]:null;return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSL`),{type:`hsl`,value:[t,i,a]}})}function O(){return s(e.hslaColor,()=>{let t=A();I(e.comma);let r=I(e.percentageValue),i=r?r[1]:null;I(e.comma),r=I(e.percentageValue);let a=r?r[1]:null;I(e.comma);let o=A();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function k(){return I(e.variableName)[1]}function A(){return I(e.number)[1]}function j(){return F(`%`,e.percentageValue,1)||M()||N()||P()}function M(){return F(`position-keyword`,e.positionKeywords,1)}function N(){return s(e.calcValue,()=>{let e=1,r=0;for(;e>0&&r<t.length;){let n=t.charAt(r);n===`(`?e++:n===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);let i=t.substring(0,r-1);return L(r-1),{type:`calc`,value:i}})}function P(){return F(`px`,e.pixelValue,1)||F(`em`,e.emValue,1)}function F(e,t,n){let r=I(t);if(r)return{type:e,value:r[n]}}function I(e){let n,r;return r=/^\s+/.exec(t),r&&L(r[0].length),n=e.exec(t),n&&L(n[0].length),n}function L(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var pe=fe.parse.bind(fe),me=me||{};me.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.value.y)},"visit_%":function(e){return e.value+`%`},visit_em:function(e){return e.value+`em`},visit_px:function(e){return e.value+`px`},visit_calc:function(e){return`calc(`+e.value+`)`},visit_literal:function(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.visit(n.length);return i&&(r+=` `+i),r},visit_angular:function(e){return e.value+`deg`},visit_directional:function(e){return`to `+e.value},visit_array:function(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})(),me.stringify.bind(me);function he(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=k(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=de({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=de({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=de(e.value);break;case`hex`:a=de(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break}return{offset:i,color:a}})}function ge(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break}return{type:`linear-gradient`,angle:t,stops:he(e.colorStops)}}function _e(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:he(e.colorStops)}}function ve(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function ye(e){return pe(e).map(e=>{switch(e?.type){case`linear-gradient`:return ge(e);case`repeating-linear-gradient`:return{...ge(e),repeat:!0};case`radial-gradient`:return _e(e);case`repeating-radial-gradient`:return{..._e(e),repeat:!0};default:return}}).filter(Boolean)}var be=[`color`];function xe(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=de(t.color),j(t,be)}var Se=[`linearGradient`,`radialGradient`,`rotateWithShape`];function Ce(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=ye(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return j(t,Se)}var we=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Te(e){let t;return t=typeof e==`string`?{image:e}:{...e},j(t,we)}var Ee=[`preset`,`foregroundColor`,`backgroundColor`];function De(e){let t;return t=typeof e==`string`?{preset:e}:{...e},O(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=de(t.foregroundColor),O(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=de(t.backgroundColor),j(t,Ee)}function Oe(e){return!O(e.color)}function ke(e){return typeof e==`string`?ue(e):Oe(e)}function Ae(e){return!O(e.image)&&ve(e.image)||!!e.linearGradient||!!e.radialGradient}function je(e){return typeof e==`string`?ve(e):Ae(e)}function Me(e){return!O(e.image)&&!ve(e.image)}function Ne(e){return typeof e==`string`?!ue(e)&&!ve(e):Me(e)}function Pe(e){return!O(e.preset)}function Fe(e){return typeof e==`string`?!1:Pe(e)}function Ie(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return ke(e)&&Object.assign(t,xe(e)),je(e)&&Object.assign(t,Ce(e)),Ne(e)&&Object.assign(t,Te(e)),Fe(e)&&Object.assign(t,De(e)),j(A(t),Array.from(new Set([`enabled`,...be,...we,...Se,...Ee])))}function Le(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function Re(e){return typeof e==`string`?{...Ie(e)}:{...Ie(e),...j(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function ze(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Be(e){return typeof e==`string`?{enabled:!0,color:de(e)}:{...e,enabled:e.enabled??!0,color:O(e.color)?le:de(e.color)}}function Ve(){return{boxShadow:`none`}}var He=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`];function Ue(e){let t=j(e,He),{rotate:n,scaleX:r,scaleY:i,skewX:a,skewY:o,translateX:s,translateY:c}=e,l=[];return(s||c)&&l.push(`translate(${s||0}, ${c||0})`),n&&l.push(`rotate(${n}deg)`),(r||i)&&l.push(`scale(${r??1}, ${i??1})`),a&&l.push(`skewX(${a}deg)`),o&&l.push(`skewY(${o}deg)`),l.length>0&&(t.transform=l.join(` `)),(e.textStrokeWidth||e.textStrokeColor)&&(t.outline={color:e.textStrokeColor,width:e.textStrokeWidth}),e.color&&(t.fill={color:e.color}),(e.shadowOffsetX||e.shadowOffsetY||e.shadowBlur||e.shadowColor)&&(t.shadow={offsetX:e.shadowOffsetX,offsetY:e.shadowOffsetY,blur:e.shadowBlur,color:e.shadowColor}),t}function We(e){let t=Ue(e);return A({fill:O(t.fill)?void 0:Ie(t.fill),outline:O(t.outline)?void 0:Re(t.outline),shadow:O(t.shadow)?void 0:Be(t.shadow),transform:O(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin})}function Ge(){return{overflow:`visible`,direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function Ke(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function qe(){return{...Ge(),...Ke(),...Ve(),...Le(),...ze(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function Je(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function Ye(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function Xe(){return{...Je(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function Ze(){return{...Ye(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function Qe(){return{...Ze(),...Xe(),textStrokeWidth:0,textStrokeColor:`none`}}function $e(e){return A({...e,color:O(e.color)?void 0:de(e.color),backgroundColor:O(e.backgroundColor)?void 0:de(e.backgroundColor),borderColor:O(e.borderColor)?void 0:de(e.borderColor),outlineColor:O(e.outlineColor)?void 0:de(e.outlineColor),shadowColor:O(e.shadowColor)?void 0:de(e.shadowColor),textStrokeColor:O(e.textStrokeColor)?void 0:de(e.textStrokeColor)})}function et(){return{...qe(),...Qe()}}var tt=/\r\n|\n\r|\n|\r/;RegExp(`${tt.source}|<br\\/>`,`g`);var nt=RegExp(`^(${tt.source})$`),rt=`
2
- `;function it(e){return nt.test(e)}function at(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?$e(e):{},a=n?Ie(n):void 0,o=r?Re(r):void 0,s=A({...i,fill:a,outline:o,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=s:t.push(s),s}function i(e=``,t,i,a){let o=t?$e(t):{},s=i?Ie(i):void 0,c=a?Re(a):void 0;Array.from(e).forEach(e=>{if(it(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(A({...o,fill:s,outline:c,content:rt})),r(a,t,i)}else{let t=n()||r(),i=t.fragments[t.fragments.length-1];if(i){let{content:t,fill:n,outline:r,...a}=i;if(M(s,n)&&M(c,r)&&M(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(A({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(st(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(ot(e)){let{fragments:t,fill:n,outline:a,...o}=e;r(o,n,a),t.forEach(e=>{let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)})}else Array.isArray(e)?(r(),e.forEach(e=>{if(typeof e==`string`)i(e);else if(st(e)){let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)}})):console.warn(`Failed to parse text content`,e)});let a=n();return a&&!a.fragments.length&&a.fragments.push({content:``}),t}function ot(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function st(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function ct(e){return A({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function lt(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:at(e)}:A({enabled:e.enabled??!0,content:at(e.content??``),style:e.style?$e(e.style):void 0,deformation:e.deformation?ct(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...We(e),effects:e.effects?e.effects.map(e=>We(e)):void 0})}function ut(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=dt(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=vt(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return pt(a,o,n,s,c,l,0),o}function dt(e,t,n,r,i){let a;if(i===Vt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Rt(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Rt(i/r|0,e[i],e[i+1],a);return a&&At(a,a.next)&&(zt(a),a=a.next),a}function ft(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(At(n,n.next)||H(n.prev,n,n.next)===0)){if(zt(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function pt(e,t,n,r,i,a,o){if(!e)return;!o&&a&&Ct(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?ht(e,r,i,a):mt(e)){t.push(c.i,e.i,l.i),zt(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=gt(ft(e),t),pt(e,t,n,r,i,a,2)):o===2&&_t(e,t,n,r,i,a):pt(ft(e),t,n,r,i,a,1);break}}}function mt(e){let t=e.prev,n=e,r=e.next;if(H(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&Ot(i,s,a,c,o,l,m.x,m.y)&&H(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ht(e,t,n,r){let i=e.prev,a=e,o=e.next;if(H(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=Tt(p,m,t,n,r),v=Tt(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Ot(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Ot(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Ot(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Ot(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function gt(e,t){let n=e;do{let r=n.prev,i=n.next.next;!At(r,i)&&jt(r,n,n.next,i)&&Ft(r,i)&&Ft(i,r)&&(t.push(r.i,n.i,i.i),zt(n),zt(n.next),n=e=i),n=n.next}while(n!==e);return ft(n)}function _t(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&kt(o,e)){let s=Lt(o,e);o=ft(o,o.next),s=ft(s,s.next),pt(o,t,n,r,i,a,0),pt(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function vt(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=dt(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Et(o))}i.sort(yt);for(let e=0;e<i.length;e++)n=bt(i[e],n);return n}function yt(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function bt(e,t){let n=xt(e,t);if(!n)return t;let r=Lt(n,e);return ft(r,r.next),ft(n,n.next)}function xt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(At(e,n))return n;do{if(At(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&Dt(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Ft(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&St(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function St(e,t){return H(e.prev,e,t.prev)<0&&H(t.next,e,e.next)<0}function Ct(e,t,n,r){let i=e;do i.z===0&&(i.z=Tt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,wt(i)}function wt(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function Tt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Et(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Dt(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Ot(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&Dt(e,t,n,r,i,a,o,s)}function kt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Pt(e,t)&&(Ft(e,t)&&Ft(t,e)&&It(e,t)&&(H(e.prev,e,t.prev)||H(e,t.prev,t))||At(e,t)&&H(e.prev,e,e.next)>0&&H(t.prev,t,t.next)>0)}function H(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function At(e,t){return e.x===t.x&&e.y===t.y}function jt(e,t,n,r){let i=Nt(H(e,t,n)),a=Nt(H(e,t,r)),o=Nt(H(n,r,e)),s=Nt(H(n,r,t));return!!(i!==a&&o!==s||i===0&&Mt(e,n,t)||a===0&&Mt(e,r,t)||o===0&&Mt(n,e,r)||s===0&&Mt(n,t,r))}function Mt(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Nt(e){return e>0?1:e<0?-1:0}function Pt(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&jt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Ft(e,t){return H(e.prev,e,e.next)<0?H(e,t,e.next)>=0&&H(e,e.prev,t)>=0:H(e,t,e.prev)<0||H(e,e.next,t)<0}function It(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Lt(e,t){let n=Bt(e.i,e.x,e.y),r=Bt(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Rt(e,t,n,r){let i=Bt(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zt(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Bt(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Ht(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var Ut={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function Wt(e,t){let{fill:n=`#000`,stroke:r=`none`,strokeWidth:i=r===`none`?0:1,strokeLinecap:a=`round`,strokeLinejoin:o=`miter`,strokeMiterlimit:s=0,strokeDasharray:c=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:d=0,shadowBlur:f=0,shadowColor:p=`rgba(0, 0, 0, 0)`}=t;e.fillStyle=n,e.strokeStyle=r,e.lineWidth=i,e.lineCap=a,e.lineJoin=Ut[o],e.miterLimit=s,e.setLineDash(c),e.lineDashOffset=l,e.shadowOffsetX=u,e.shadowOffsetY=d,e.shadowBlur=f,e.shadowColor=p}var U=class e{constructor(e=0,t=0,n){this._x=e,this._y=t,this._onUpdate=n}static get MAX(){return new e(1/0,1/0)}static get MIN(){return new e(-1/0,-1/0)}static lerp(t,n,r){return new e(n.x,n.y).clone().sub(t).multiply(r).add(t)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._onUpdate?.(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._onUpdate?.(this))}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._onUpdate?.(this)),this}add(e){return this.set(this._x+e.x,this._y+e.y)}sub(e){return this.set(this._x-e.x,this._y-e.y)}subVectors(e,t){return this.set(e.x-t.x,e.y-t.y)}multiply(e=0,t=e){return this.set(this._x*e,this._y*t)}divide(e=0,t=e){return this.set(this._x/e,this._y/t)}cross(e){return this._x*e.y-this._y*e.x}dot(e){return this._x*e.x+this._y*e.y}rotate(e,t={x:0,y:0}){let{x:n,y:r}=this,i=Math.cos(e),a=Math.sin(e);return this.set((n-t.x)*i-(r-t.y)*a+t.x,(n-t.x)*a+(r-t.y)*i+t.y)}getLength(){let{x:e,y:t}=this;return Math.sqrt(e*e+t*t)}getAngle(){return Math.atan2(-this.x,-this.y)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){let e=1/(this.getLength()||1);return this.set(this.x*e,this.y*e),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._onUpdate?.(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return this._x===e.x&&this._y===e.y}get array(){return[this.x,this.y]}finite(){return this.set(Number.isFinite(this._x)?this._x:0,Number.isFinite(this._y)?this._y:0)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){return this.set(n.x+(this._x-n.x)*e,n.y+(this._y-n.y)*t)}skew(e,t=0,n={x:0,y:0}){let r=this._x-n.x,i=this._y-n.y;return this.set(n.x+(r+Math.tan(e)*i),n.y+(i+Math.tan(t)*r))}clampMin(...e){return this.set(Math.min(this._x,...e.map(e=>e.x)),Math.min(this._y,...e.map(e=>e.y)))}clampMax(...e){return this.set(Math.max(this.x,...e.map(e=>e.x)),Math.max(this.y,...e.map(e=>e.y)))}clone(t){return new e(this._x,this._y,t??this._onUpdate)}toJSON(){return{x:this._x,y:this._y}}destroy(){this._onUpdate=void 0}},W=class e{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new U((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new e;if(t.length===1)return t[0].clone();let n=t[0],r=t.slice(1).reduce((e,t)=>(e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.right=Math.max(e.right,t.right),e.bottom=Math.max(e.bottom,t.bottom),e),{left:n?.left??0,top:n?.top??0,right:n?.right??0,bottom:n?.bottom??0});return new e(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new e(this.left,this.top,this.width,this.height)}};function Gt(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}var Kt=Math.PI*2;function qt(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function Jt(e,t,n,r){let i=t.clone().sub(e),a=r.clone().sub(n),o=n.clone().sub(e),s=i.cross(a);if(s===0)return new U((e.x+n.x)/2,(e.y+n.y)/2);let c=o.cross(a)/s;return Math.abs(c)>1?new U((e.x+n.x)/2,(e.y+n.y)/2):new U(e.x+c*i.x,e.y+c*i.y)}var Yt=/([\w-]+)\((.+?)\)/g,Xt=/[^,]+/g,Zt=/([-e.\d]+)(.*)/;function Qt(e,t={}){let n=[],r;for(;(r=Yt.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:$t(e,i,t)})}return n}function $t(e,t,n={}){let r=[],i,a=0;for(;(i=Xt.exec(t))!==null;)r.push(en(e,i[0],{...n,index:a++}));return r}function en(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(Zt),s={unit:o?.[2]??null,value:t,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(e){case`scale`:case`scaleX`:case`scaleY`:case`scale3d`:s.normalizedDefaultIntValue=1;break}switch(s.unit){case`%`:s.normalizedIntValue=s.intValue/100;break;case`rad`:s.normalizedIntValue=s.intValue/Kt;break;case`deg`:s.normalizedIntValue=s.intValue/360;break;case`px`:switch(a){case 0:s.normalizedIntValue=s.intValue/r;break;case 1:s.normalizedIntValue=s.intValue/i;break}break;default:s.normalizedIntValue=s.intValue;break}return s}function tn(e,t){let n=1-e;return n*n*n*t}function nn(e,t){let n=1-e;return 3*n*n*e*t}function rn(e,t){return 3*(1-e)*e*e*t}function an(e,t){return e*e*e*t}function on(e,t,n,r,i){return tn(e,t)+nn(e,n)+rn(e,r)+an(e,i)}function sn(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=ut(e,i,2);if(c.length){for(let e=0;e<c.length;e+=3)r[s++]=c[e]+o,r[s++]=c[e+1]+o,r[s++]=c[e+2]+o;let t=o*a;for(let r=0;r<e.length;r+=2)n[t]=e[r],n[t+1]=e[r+1],t+=a}return{vertices:n,indices:r}}var cn=8,ln=1.1920929e-7,un=1;function dn(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(un-Math.min(.99,Math.max(0,c)))/1;return u*=u,fn(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function fn(e,t,n,r,i,a,o,s,c,l,u){if(u>cn)return;let d=(e+n)/2,f=(t+r)/2,p=(n+i)/2,m=(r+a)/2,h=(i+o)/2,g=(a+s)/2,_=(d+p)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(_+y)/2,S=(v+b)/2;if(u>0){let u=o-e,d=s-t,f=Math.abs((n-o)*d-(r-s)*u),p=Math.abs((i-o)*d-(a-s)*u);if(f>ln&&p>ln){if((f+p)*(f+p)<=l*(u*u+d*d)){c.push(x,S);return}}else if(f>ln){if(f*f<=l*(u*u+d*d)){c.push(x,S);return}}else if(p>ln){if(p*p<=l*(u*u+d*d)){c.push(x,S);return}}else if(u=x-(e+o)/2,d=S-(t+s)/2,u*u+d*d<=l){c.push(x,S);return}}fn(e,t,d,f,_,v,x,S,c,l,u+1),fn(x,S,y,b,h,g,o,s,c,l,u+1)}var pn=8,mn=1.1920929e-7,hn=1;function gn(e,t,n,r,i,a,o=.5,s=[]){let c=(hn-Math.min(.99,Math.max(0,o)))/1;return c*=c,_n(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function _n(e,t,n,r,i,a,o,s,c){if(c>pn)return;let l=(t+r)/2,u=(n+i)/2,d=(r+a)/2,f=(i+o)/2,p=(l+d)/2,m=(u+f)/2,h=a-t,g=o-n,_=Math.abs((r-a)*g-(i-o)*h);if(_>mn){if(_*_<=s*(h*h+g*g)){e.push(p,m);return}}else if(h=p-(t+a)/2,g=m-(n+o)/2,h*h+g*g<=s){e.push(p,m);return}_n(e,t,n,l,u,p,m,s,c+1),_n(e,p,m,d,f,a,o,s,c+1)}function vn(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function yn(e,t,n){let r=n.length,i=0;for(let a=0,o=r-2;a<r;o=a,a+=2){let r=n[a],s=n[a+1],c=n[o],l=n[o+1];s<=t?l>t&&vn(c,l,r,s,e,t)>0&&i++:l<=t&&vn(c,l,r,s,e,t)<0&&i--}return i}function bn(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function xn(e){let t=e.map((e,t)=>({index:t})),n=e.map(e=>{let t=e.length;if(!t)return[];let n=[2**53-1,0],r=[0,2**53-1],i=[-(2**53-1),0],a=[0,-(2**53-1)];for(let o=0;o<t;o+=2){let t=e[o],s=e[o+1];n[0]>t&&(n=[t,s]),r[1]>s&&(r=[t,s]),i[0]<t&&(i=[t,s]),a[1]<s&&(a=[t,s])}let o=[(n[0]+i[0])/2,(r[1]+a[1])/2],s,c,l,u,d,f,p,m;for(let n=0;n<t;n+=2){let t=e[n],r=e[n+1],i=Math.abs(t-o[0]),a=Math.abs(r-o[1]);r<o[1]&&(!s||i<s)&&(s=i,l=[t,r]),r>o[1]&&(!c||i<c)&&(c=i,u=[t,r]),t<o[0]&&(!d||a<d)&&(d=a,p=[t,r]),t>o[0]&&(!f||a<f)&&(f=a,m=[t,r])}return[n,r,i,a,l,u,p,m].filter(Boolean)});for(let r=0,i=e.length;r<i;r++){let a=[],o=n[r];for(let t=0;t<i;t++){if(r===t)continue;let i={},s=[];for(let n=0,r=o.length;n<r;n++){let[r,a]=o[n],c=yn(r,a,e[t]);i[c]=(i[c]??0)+1,s.push(c)}s.filter(e=>e!==0).length>s.filter(e=>e===0).length&&a.push({index:r,parentIndex:t,winding:Number(Array.from(Object.entries(i)).sort((e,t)=>t[1]-e[1])?.[0]?.[0]??0),dist:bn(n[r][0],n[t][0])})}a.reduce((e,t)=>e+t.winding,0)!==0&&(a.sort((e,t)=>e.dist-t.dist),t[r]=a[0])}return t}function Sn(e,t){let n=1-e;return n*n*t}function Cn(e,t){return 2*(1-e)*e*t}function wn(e,t){return e*e*t}function Tn(e,t,n,r){return Sn(e,t)+Cn(e,n)+wn(e,r)}var En=1e-4,Dn=1e-4;function On(e,t={}){let{vertices:n=[],indices:r=[],lineStyle:i={alignment:.5,cap:`butt`,join:`miter`,width:1,miterLimit:10},flipAlignment:a=!1,closed:o=!0}=t,s=En;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=kn(e);a&&(t*=-1),l=(l-.5)*t+.5}let u={x:e[0],y:e[1]},d={x:e[e.length-2],y:e[e.length-1]},f=o,p=Math.abs(u.x-d.x)<s&&Math.abs(u.y-d.y)<s;if(f){e=e.slice(),p&&(e.pop(),e.pop(),d.x=e[e.length-2],d.y=e[e.length-1]);let t=(u.x+d.x)*.5,n=(d.y+u.y)*.5;e.unshift(t,n),e.push(t,n)}let m=n,h=e.length/2,g=e.length,_=m.length/2,v=c.width/2,y=v*v,b=c.miterLimit*c.miterLimit,x=e[0],S=e[1],C=e[2],w=e[3],T=0,E=0,D=-(S-w),O=x-C,k=0,A=0,j=Math.sqrt(D*D+O*O);D/=j,O/=j,D*=v,O*=v;let M=l,N=(1-M)*2,P=M*2;f||(c.cap===`round`?g+=jn(x-D*(N-P)*.5,S-O*(N-P)*.5,x-D*N,S-O*N,x+D*P,S+O*P,m,!0)+2:c.cap===`square`&&(g+=An(x,S,D,O,N,P,!0,m))),m.push(x-D*N,S-O*N),m.push(x+D*P,S+O*P);for(let t=1;t<h-1;++t){x=e[(t-1)*2],S=e[(t-1)*2+1],C=e[t*2],w=e[t*2+1],T=e[(t+1)*2],E=e[(t+1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,k=-(w-E),A=C-T,j=Math.sqrt(k*k+A*A),k/=j,A/=j,k*=v,A*=v;let n=C-x,r=S-w,i=C-T,a=E-w,o=n*i+r*a,s=r*i-a*n,l=s<0;if(Math.abs(s)<.001*Math.abs(o)){m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),o>=0&&(c.join===`round`?g+=jn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4:g+=2,m.push(C-k*P,w-A*P),m.push(C+k*N,w+A*N));continue}let u=(-D+x)*(-O+w)-(-D+C)*(-O+S),d=(-k+T)*(-A+w)-(-k+C)*(-A+E),f=(n*d-i*u)/s,p=(a*u-r*d)/s,h=(f-C)*(f-C)+(p-w)*(p-w),_=C+(f-C)*N,M=w+(p-w)*N,F=C-(f-C)*P,I=w-(p-w)*P,L=Math.min(n*n+r*r,i*i+a*a),R=l?N:P;h<=L+R*R*y?c.join===`bevel`||h/y>b?(l?(m.push(_,M),m.push(C+D*P,w+O*P),m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),m.push(C-k*N,w-A*N),m.push(F,I)),g+=2):c.join===`round`?l?(m.push(_,M),m.push(C+D*P,w+O*P),g+=jn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+4,m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),g+=jn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4,m.push(C-k*N,w-A*N),m.push(F,I)):(m.push(_,M),m.push(F,I)):(m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),c.join===`round`?l?g+=jn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=jn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+2:c.join===`miter`&&h/y<=b&&(l?(m.push(F,I),m.push(F,I)):(m.push(_,M),m.push(_,M)),g+=2),m.push(C-k*N,w-A*N),m.push(C+k*P,w+A*P),g+=2)}x=e[(h-2)*2],S=e[(h-2)*2+1],C=e[(h-1)*2],w=e[(h-1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),f||(c.cap===`round`?g+=jn(C-D*(N-P)*.5,w-O*(N-P)*.5,C-D*N,w-O*N,C+D*P,w+O*P,m,!1)+2:c.cap===`square`&&(g+=An(C,w,D,O,N,P,!1,m)));let F=Dn*Dn;for(let e=_;e<g+_-2;++e)x=m[e*2],S=m[e*2+1],C=m[(e+1)*2],w=m[(e+1)*2+1],T=m[(e+2)*2],E=m[(e+2)*2+1],!(Math.abs(x*(w-E)+C*(E-S)+T*(S-w))<F)&&r.push(e,e+1,e+2);return{vertices:n,indices:r}}function kn(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function An(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function jn(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}var Mn=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}_array;set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}skewX(e){let t=Math.tan(e);return this.a+=t*this.b,this.c+=t*this.d,this.tx+=t*this.ty,this}skewY(e){let t=Math.tan(e);return this.b+=t*this.a,this.d+=t*this.c,this.ty+=t*this.tx,this}skew(e,t){let n=Math.tan(e),r=Math.tan(t),i=this.a,a=this.b,o=this.c,s=this.d,c=this.tx,l=this.ty;return this.a=i+n*a,this.b=r*i+a,this.c=o+n*s,this.d=r*o+s,this.tx=c+n*l,this.ty=r*c+l,this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,n){return this.translate(e,t,n)}translate(e,t,n=0){return this.tx+=e,this.ty+=t,this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,n=1){return this.scale(e,t,n)}scale(e,t,n=1){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}rotate3d(e,t,n,r){let[i,a,o]=this._rotate3d(e,t,n,r);return i&&this.rotateX(i),a&&this.rotateY(a),o&&this.rotateZ(o),this}_rotateToScale(e){let t=e/Kt;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,n,r){if(e===1&&t===0&&n===0)return[r,0,0];if(e===0&&t===1&&n===0)return[0,r,0];if(e===0&&t===0)return[0,0,r];{let i=Math.cos(r),a=Math.sin(r),o=i+e*e*(1-i),s=e*t*(1-i)-n*a,c=e*n*(1-i)+t*a,l=i+t*t*(1-i),u=t*n*(1-i)-e*a,d=i+n*n*(1-i);return[-Math.atan2(-u,l),-Math.atan2(c,Math.sqrt(u*u+d*d)),-Math.atan2(-s,o)]}}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=-Math.atan2(-i,a),l=Math.atan2(r,n),u=Math.abs(c+l);return u<1e-5||Math.abs(Kt-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=l),t.scale.x=Math.sqrt(n*n+r*r),t.scale.y=Math.sqrt(i*i+a*a),t.position.x=o+(e.x*n+e.y*i),t.position.y=s+(e.x*r+e.y*a),t}apply(e,t){t||=new U;let{x:n,y:r}=e;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}affineInvert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t||=new U;let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=1/(n*a+i*-r),l=e.x,u=e.y;return t.x=a*c*l+-i*c*u+(s*i-o*a)*c,t.y=n*c*u+-r*c*l+(-s*n+o*r)*c,t}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}isIdentity(){let{a:e,b:t,c:n,d:r,tx:i,ty:a}=this;return e===1&&t===0&&n===0&&r===1&&i===0&&a===0}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}prependCssTransform(t,n={}){let{width:r=1,height:i=1}=n,a=new e;return Qt(t,{width:r,height:i}).reverse().forEach(({name:e,args:t})=>{let n=t.map(e=>e.normalizedIntValue);switch(e){case`translateX`:a.translateX(n[0]*r);break;case`translateY`:a.translateY(n[0]*i);break;case`translateZ`:a.translateZ(n[0]);break;case`translate`:a.translate(n[0]*r,(n[1]??n[0])*i);break;case`translate3d`:a.translate3d(n[0]*r,(n[1]??n[0])*i,n[2]??n[1]??n[0]);break;case`scaleX`:a.scaleX(n[0]);break;case`scaleY`:a.scaleY(n[0]);break;case`scale`:a.scale(n[0],n[1]??n[0]);break;case`scale3d`:a.scale3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`rotateX`:a.rotateX(n[0]*Kt);break;case`rotateY`:a.rotateY(n[0]*Kt);break;case`rotateZ`:a.rotateZ(n[0]*Kt);break;case`rotate`:a.rotate(n[0]*Kt);break;case`rotate3d`:a.rotate3d(n[0]*Kt,(n[1]??n[0])*Kt,(n[2]??n[1]??n[0])*Kt,(n[3]??n[2]??n[1]??n[0])*Kt);break;case`skewX`:a.skewX(n[0]*Kt);break;case`skewY`:a.skewY(n[0]*Kt);break;case`skew`:a.skew(n[0]*Kt,(n[0]??n[1])*Kt);break;case`matrix`:a.set(n[0],n[1],n[2],n[3],n[4],n[5]);break}}),this.prepend(a),this}clone(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)}toArray(e,t){this._array||=new Float32Array(9);let n=t||this._array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}toString(){return`[Transform2D a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}toJSON(){return{a:this.a,b:this.b,c:this.c,d:this.d,tx:this.tx,ty:this.ty}}destroy(){this._array=void 0}};function Nn(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function Pn(e,t,n,r,i,a,o,s){if(t===0||n===0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,l=(o.y-s.y)/2,u=Math.cos(r)*c+Math.sin(r)*l,d=-Math.sin(r)*c+Math.cos(r)*l,f=t*t,p=n*n,m=u*u,h=d*d,g=m/f+h/p;if(g>1){let e=Math.sqrt(g);t=e*t,n=e*n,f=t*t,p=n*n}let _=f*h+p*m,v=(f*p-_)/_,y=Math.sqrt(Math.max(0,v));i===a&&(y=-y);let b=y*t*d/n,x=-y*n*u/t,S=Math.cos(r)*b-Math.sin(r)*x+(o.x+s.x)/2,C=Math.sin(r)*b+Math.cos(r)*x+(o.y+s.y)/2,w=Nn(1,0,(u-b)/t,(d-x)/n),T=Nn((u-b)/t,(d-x)/n,(-u-b)/t,(-d-x)/n)%(Math.PI*2);e.ellipse(S,C,t,n,r,w,w+T,a===0)}var G={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Fn(e,t,n=0){let r=0,i=!0,a=``,o=``,s=[];function c(e,t,n){let r=SyntaxError(`Unexpected character "${e}" at index ${t}.`);throw r.partial=n,r}function l(){a!==``&&(o===``?s.push(Number(a)):s.push(Number(a)*10**Number(o))),a=``,o=``}let u,d=e.length;for(let f=0;f<d;f++){if(u=e[f],Array.isArray(t)&&t.includes(s.length%n)&&G.FLAGS.test(u)){r=1,a=u,l();continue}if(r===0){if(G.WHITESPACE.test(u))continue;if(G.DIGIT.test(u)||G.SIGN.test(u)){r=1,a=u;continue}if(G.POINT.test(u)){r=2,a=u;continue}G.COMMA.test(u)&&(i&&c(u,f,s),i=!0)}if(r===1){if(G.DIGIT.test(u)){a+=u;continue}if(G.POINT.test(u)){a+=u,r=2;continue}if(G.EXP.test(u)){r=3;continue}G.SIGN.test(u)&&a.length===1&&G.SIGN.test(a[0])&&c(u,f,s)}if(r===2){if(G.DIGIT.test(u)){a+=u;continue}if(G.EXP.test(u)){r=3;continue}G.POINT.test(u)&&a[a.length-1]===`.`&&c(u,f,s)}if(r===3){if(G.DIGIT.test(u)){o+=u;continue}if(G.SIGN.test(u)){if(o===``){o+=u;continue}o.length===1&&G.SIGN.test(o)&&c(u,f,s)}}G.WHITESPACE.test(u)?(l(),r=0,i=!1):G.COMMA.test(u)?(l(),r=0,i=!0):G.SIGN.test(u)?(l(),r=1,a=u):G.POINT.test(u)?(l(),r=2,a=u):c(u,f,s)}return l(),s}function In(e,t){return e-(t-e)}function Ln(e,t){let n=new U,r=new U,i=``;for(let a=0,o=e.length;a<o;a++){let o=e[a];if(((o.type===`s`||o.type===`S`)&&!`CcSs`.includes(i)||(o.type===`t`||o.type===`T`)&&!`QqTt`.includes(i))&&r.copyFrom(n),o.type===`m`||o.type===`M`)o.type===`m`?n.add(o):n.copyFrom(o),t.moveTo(n.x,n.y),r.copyFrom(n);else if(o.type===`h`||o.type===`H`)o.type===`h`?n.x+=o.x:n.x=o.x,t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`v`||o.type===`V`)o.type===`v`?n.y+=o.y:n.y=o.y,t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`l`||o.type===`L`)o.type===`l`?n.add(o):n.copyFrom(o),t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`c`||o.type===`C`)o.type===`c`?(t.bezierCurveTo(n.x+o.x1,n.y+o.y1,n.x+o.x2,n.y+o.y2,n.x+o.x,n.y+o.y),r.x=n.x+o.x2,r.y=n.y+o.y2,n.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,n.copyFrom(o));else if(o.type===`s`||o.type===`S`)o.type===`s`?(t.bezierCurveTo(In(n.x,r.x),In(n.y,r.y),n.x+o.x2,n.y+o.y2,n.x+o.x,n.y+o.y),r.x=n.x+o.x2,r.y=n.y+o.y2,n.add(o)):(t.bezierCurveTo(In(n.x,r.x),In(n.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,n.copyFrom(o));else if(o.type===`q`||o.type===`Q`)o.type===`q`?(t.quadraticCurveTo(n.x+o.x1,n.y+o.y1,n.x+o.x,n.y+o.y),r.x=n.x+o.x1,r.y=n.y+o.y1,n.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,n.copyFrom(o));else if(o.type===`t`||o.type===`T`){let e=In(n.x,r.x),i=In(n.y,r.y);r.x=e,r.y=i,o.type===`t`?(t.quadraticCurveTo(e,i,n.x+o.x,n.y+o.y),n.add(o)):(t.quadraticCurveTo(e,i,o.x,o.y),n.copyFrom(o))}else if(o.type===`a`||o.type===`A`){let e=n.clone();if(o.type===`a`){if(o.x===0&&o.y===0)continue;n.add(o)}else{if(n.equals(o))continue;n.copyFrom(o)}r.copyFrom(n),Pn(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,e,n)}else o.type===`z`||o.type===`Z`?(t.startPoint&&n.copyFrom(t.startPoint),t.closePath()):console.warn(`Unsupported commands`,o);i=o.type}}function Rn(e){let t,n,r=[];for(let i=0,a=e.length;i<a;i++){let a=e[i];switch(a.type){case`m`:case`M`:if(a.x.toFixed(4)===n?.x.toFixed(4)&&a.y.toFixed(4)===n?.y.toFixed(4))continue;r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y},t={x:a.x,y:a.y};break;case`h`:case`H`:r.push(`${a.type} ${a.x}`),n={x:a.x,y:n?.y??0};break;case`v`:case`V`:r.push(`${a.type} ${a.y}`),n={x:n?.x??0,y:a.y};break;case`l`:case`L`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`c`:case`C`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`s`:case`S`:r.push(`${a.type} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`q`:case`Q`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`t`:case`T`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`a`:case`A`:r.push(`${a.type} ${a.rx} ${a.ry} ${a.angle} ${a.largeArcFlag} ${a.sweepFlag} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`z`:case`Z`:r.push(a.type),t&&(n={x:t.x,y:t.y});break}}return r.join(` `)}var zn=/[a-df-z][^a-df-z]*/gi;function Bn(e){let t=[],n=e.match(zn);if(!n)return t;for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.charAt(0),a=r.slice(1).trim(),o;switch(i){case`m`:case`M`:o=Fn(a);for(let e=0,n=o.length;e<n;e+=2)e===0?t.push({type:i,x:o[e],y:o[e+1]}):t.push({type:i===`m`?`l`:`L`,x:o[e],y:o[e+1]});break;case`h`:case`H`:o=Fn(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=Fn(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=Fn(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`c`:case`C`:o=Fn(a);for(let e=0,n=o.length;e<n;e+=6)t.push({type:i,x1:o[e],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]});break;case`s`:case`S`:o=Fn(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x2:o[e],y2:o[e+1],x:o[e+2],y:o[e+3]});break;case`q`:case`Q`:o=Fn(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x1:o[e],y1:o[e+1],x:o[e+2],y:o[e+3]});break;case`t`:case`T`:o=Fn(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`a`:case`A`:o=Fn(a,[3,4],7);for(let e=0,n=o.length;e<n;e+=7)t.push({type:i,rx:o[e],ry:o[e+1],angle:o[e+2],largeArcFlag:o[e+3],sweepFlag:o[e+4],x:o[e+5],y:o[e+6]});break;case`z`:case`Z`:t.push({type:i});break;default:console.warn(r)}}return t}var Vn=`data:image/svg+xml;`,Hn=`${Vn}base64,`,Un=`${Vn}charset=utf8,`;function Wn(e){if(typeof e==`string`){let t;e.startsWith(Hn)?(e=e.substring(Hn.length,e.length),t=atob(e)):e.startsWith(Un)?(e=e.substring(Un.length,e.length),t=decodeURIComponent(e)):t=e;let n=new DOMParser().parseFromString(t,`text/xml`),r=n.querySelector(`parsererror`);if(r)throw Error(`${r.textContent??`parser error`}
3
- ${t}`);return n.documentElement}else return e}var Gn=`px`,Kn=90,qn=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],Jn={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function K(e){let t=`px`;if(typeof e==`string`)for(let n=0,r=qn.length;n<r;n++){let r=qn[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return n=Jn[t][Gn],n<0&&(n=Jn[t].in*Kn),n*Number.parseFloat(e)}function Yn(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=Xn(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function Xn(e){let t=new Mn;return e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))&&t.translate(K(e.getAttribute(`x`)),K(e.getAttribute(`y`))),e.hasAttribute(`transform`)&&t.prependCssTransform(e.getAttribute(`transform`)),t}function Zn(e){return new Mr().arc(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`r`)||0),0,Math.PI*2)}function Qn(e,t){if(!(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length))for(let n=0;n<e.sheet.cssRules.length;n++){let r=e.sheet.cssRules[n];if(r.type!==1)continue;let i=r.selectorText.split(/,/g).filter(Boolean).map(e=>e.trim()),a={};for(let e=r.style.length,t=0;t<e;t++){let e=r.style.item(t);a[e]=r.style.getPropertyValue(e)}for(let e=0;e<i.length;e++)t[i[e]]=Object.assign(t[i[e]]||{},{...a})}}function $n(e){return new Mr().ellipse(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`rx`)||0),K(e.getAttribute(`ry`)||0),0,0,Math.PI*2)}function er(e){return new Mr().moveTo(K(e.getAttribute(`x1`)||0),K(e.getAttribute(`y1`)||0)).lineTo(K(e.getAttribute(`x2`)||0),K(e.getAttribute(`y2`)||0))}function tr(e){let t=new Mr,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var nr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function rr(e){let t=new Mr,n=0;return e.getAttribute(`points`)?.replace(nr,(e,r,i)=>{let a=K(r),o=K(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!0,t}var ir=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ar(e){let t=new Mr,n=0;return e.getAttribute(`points`)?.replace(ir,(e,r,i)=>{let a=K(r),o=K(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!1,t}function or(e){let t=K(e.getAttribute(`x`)||0),n=K(e.getAttribute(`y`)||0),r=e.getAttribute(`rx`),i=e.getAttribute(`ry`),a=K(r??i??0),o=K(i??r??0),s=K(e.getAttribute(`width`)),c=K(e.getAttribute(`height`));a=Math.max(0,Math.min(a,s/2)),o=Math.max(0,Math.min(o,c/2));let l=.448084975506,u=new Mr;return u.moveTo(t+a,n),u.lineTo(t+s-a,n),(a!==0||o!==0)&&u.bezierCurveTo(t+s-a*l,n,t+s,n+o*l,t+s,n+o),u.lineTo(t+s,n+c-o),(a!==0||o!==0)&&u.bezierCurveTo(t+s,n+c-o*l,t+s-a*l,n+c,t+s-a,n+c),u.lineTo(t+a,n+c),(a!==0||o!==0)&&u.bezierCurveTo(t+a*l,n+c,t,n+c-o*l,t,n+c-o),u.lineTo(t,n+o),(a!==0||o!==0)&&u.bezierCurveTo(t,n+o*l,t+a*l,n,t+a,n),u}function sr(e,t,n){t=Object.assign({},t);let r={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,n[`.${t[e]}`])}e.hasAttribute(`id`)&&(r=Object.assign(r,n[`#${e.getAttribute(`id`)}`]));for(let n=e.style.length,i=0;i<n;i++){let n=e.style.item(i),a=e.style.getPropertyValue(n);t[n]=a,r[n]=a}function i(n,i,o=a){e.hasAttribute(n)&&(t[i]=o(e.getAttribute(n))),r[n]&&(t[i]=o(r[n]))}function a(e){return e.startsWith(`url`)&&console.warn(`url access in attributes is not implemented.`),e}function o(e){return Math.max(0,Math.min(1,K(e)))}function s(e){return Math.max(0,K(e))}function c(e){return e.split(` `).filter(e=>e!==``).map(e=>K(e))}return i(`fill`,`fill`),i(`fill-opacity`,`fillOpacity`,o),i(`fill-rule`,`fillRule`),i(`opacity`,`opacity`,o),i(`stroke`,`stroke`),i(`stroke-opacity`,`strokeOpacity`,o),i(`stroke-width`,`strokeWidth`,s),i(`stroke-linecap`,`strokeLinecap`),i(`stroke-linejoin`,`strokeLinejoin`),i(`stroke-miterlimit`,`strokeMiterlimit`,s),i(`stroke-dasharray`,`strokeDasharray`,c),i(`stroke-dashoffset`,`strokeDashoffset`,K),i(`visibility`,`visibility`),t}function cr(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=sr(e,o,r);break;case`style`:Qn(e,r);break;case`g`:o=sr(e,o,r);break;case`path`:o=sr(e,o,r),e.hasAttribute(`d`)&&(a=tr(e));break;case`rect`:o=sr(e,o,r),a=or(e);break;case`polygon`:o=sr(e,o,r),a=rr(e);break;case`polyline`:o=sr(e,o,r),a=ar(e);break;case`circle`:o=sr(e,o,r),a=Zn(e);break;case`ellipse`:o=sr(e,o,r),a=$n(e);break;case`line`:o=sr(e,o,r),a=er(e);break;case`defs`:i=!0;break;case`use`:{o=sr(e,o,r);let t=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),i=e.viewportElement?.getElementById(t);i?cr(i,o,n,r):console.warn(`'use node' references non-existent node id: ${t}`);break}default:console.warn(e);break}if(o.display===`none`)return n;let s=new Mn,c=[],l=Yn(e,s,c);a&&(a.applyTransform(s),n.push(a),a.style={...o});let u=e.childNodes;for(let e=0,t=u.length;e<t;e++){let t=u[e];i&&t.nodeName!==`style`&&t.nodeName!==`defs`||cr(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function lr(e){let t=Wn(e);return new Nr(cr(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var ur=class{arcLengthDivision=200;_lengths=[];getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(e){let t=typeof e==`function`;return this.getControlPointRefs().forEach(n=>{t?e(n):e.apply(n,n)}),this}getUnevenVertices(e=5,t=[]){let n=new U;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){let n=new U;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){let r=e[n],i=e[n+1];t.push(new U(r,i))}return t}getSpacedPoints(e,t=[]){let n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){let n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){let t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return n=e?this.getUnevenVertices(e):this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){let e=this.getLengths();return e[e.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){let e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){let a=this.getPoint(i/e);n+=a.distanceTo(r),t.push(n),r=a}this._lengths=t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let a=0,o=0,s=r-1,c;for(;o<=s;)if(a=Math.floor(o+(s-o)/2),c=n[a]-i,c<0)o=a+1;else if(c>0)s=a-1;else{s=a;break}if(a=Math.max(0,s),n[a]===i)return a/(r-1);let l=n[a],u=n[a+1]-l,d=Math.max(0,(i-l)/u);return(a+d)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;let a=this.getPoint(i);if(a.distanceTo(e)<t)return i;a.x<e.x?n=i:r=i}return i}getMinMax(e=U.MAX,t=U.MIN){let n=this.getPoints();for(let r=0,i=n.length;r<i;r++){let i=n[r];e.clampMin(i),t.clampMax(i)}return{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new W(e.x,e.y,t.x-e.x,t.y-e.y)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return sn(this.getFillVertices(e),e)}strokeTriangulate(e){return On(this.getAdaptiveVertices(),e)}toCommands(){let e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){let r=t[n];n===0?e.push({type:`M`,x:r.x,y:r.y}):e.push({type:`L`,x:r.x,y:r.y})}return e}toData(){return Rn(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case`M`:e.moveTo(t.x,t.y);break;case`L`:e.lineTo(t.x,t.y);break}}),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copyFrom(this)}},dr=new Mn,fr=new Mn,pr=new Mn,mr=new U,hr=class extends ur{constructor(e=new U,t=new U,n=new U,r=0,i=0,a=Math.PI*2,o=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){let e=Math.PI*2,t=this.endAngle-this.startAngle,n=Math.abs(t)<2**-52;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new U){let n=this._getDeltaAngle(),r=this.startAngle+e*n,i=this.cx+this.rx*Math.cos(r),a=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),n=i-this.cx,r=a-this.cy;i=n*e-r*t+this.cx,a=n*t+r*e+this.cy}return t.set(i,a)}toCommands(){let{cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,clockwise:o,rotate:s}=this,c=e+n*Math.cos(i)*Math.cos(s)-r*Math.sin(i)*Math.sin(s),l=t+n*Math.cos(i)*Math.sin(s)+r*Math.sin(i)*Math.cos(s),u=Math.abs(i-a),d=+(u>Math.PI),f=+!!o,p=s*180/Math.PI;if(u>=2*Math.PI){let a=i+Math.PI,o=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),u=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:o,y:u},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:c,y:l}]}else{let i=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),o=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:d,sweepFlag:f,x:i,y:o}]}}drawTo(e){let{cx:t,cy:n,rx:r,ry:i,rotate:a,startAngle:o,endAngle:s,clockwise:c}=this;return e.ellipse(t,n,r,i,a,o,s,!c),this}applyTransform(e){return mr.set(this.cx,this.cy),e.apply(mr,mr),this.cx=mr.x,this.cy=mr.y,yr(e)?gr(this,e):_r(this,e),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,startAngle:s,endAngle:c,clockwise:l,rotate:u}=this,d=!l,f=Math.abs(s-c);(!d&&s>c||d&&c>s)&&(f=2*Math.PI-f);let p=Math.max(12,Math.floor(12*r**(1/3)*(f/Math.PI))),m=f/p,h=s;m*=d?-1:1;let g=Math.cos(d?u:-u),_=Math.sin(d?u:-u);for(let s=0;s<p+1;s++){let s=a+Math.cos(h)*r,c=o+Math.sin(h)*i,l=s*g-c*_,u=s*_+c*g;e.push(t+l,n+u),h+=m}return e}_getAdaptiveVerticesByCircle(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,rotate:s,clockwise:c}=this;if(!(r>=0&&i>=0&&a>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(r+i)),u=l*8+(a?4:0)+(o?4:0),d=[];if(u===0)return e;{let e=d.length;if(l===0)d[e]=d[e+6]=t+a,d[e+1]=d[e+3]=n+o,d[e+2]=d[e+4]=t-a,d[e+5]=d[e+7]=n-o;else{let s=e,c=e+l*4+(a?2:0)+2,f=c,p=u,m=a+r,h=o,g=t+m,_=t-m,v=n+h;if(d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,o){let e=n-h;d[f++]=_,d[f++]=e,d[--p]=e,d[--p]=g}for(let e=1;e<l;e++){let u=Math.PI/2*(e/l),m=a+Math.cos(u)*r,h=o+Math.sin(u)*i,g=t+m,_=t-m,v=n+h,y=n-h;d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,d[f++]=_,d[f++]=y,d[--p]=y,d[--p]=g}m=a,h=o+i,g=t+m,_=t-m,v=n+h;let y=n-h;d[s++]=g,d[s++]=v,d[--p]=y,d[--p]=g,a&&(d[s++]=_,d[s++]=v,d[--p]=y,d[--p]=_)}}let f=Math.cos(c?-s:s),p=Math.sin(c?-s:s);for(let r=0;r<d.length;r+=2){let i=d[r],a=d[r+1],o=i-t,s=a-n,c=o*f-s*p,l=o*p+s*f;e.push(t+c,n+l)}return e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}};function gr(e,t){let n=e.rx,r=e.ry,i=Math.cos(e.rotate),a=Math.sin(e.rotate),o=new U(n*i,n*a),s=new U(-r*a,r*i),c=t.a*o.x+t.c*o.y,l=t.b*o.x+t.d*o.y,u=t.a*s.x+t.c*s.y,d=t.b*s.x+t.d*s.y,f=dr.set(c,l,u,d,0,0),{a:p,b:m,c:h,d:g}=fr.copyFrom(f).affineInvert(),_=br(p*p+m*m,h*p+g*m,h*h+g*g),v=Math.sqrt(_.rt1),y=Math.sqrt(_.rt2);if(e.rx=1/v,e.ry=1/y,e.rotate=Math.atan2(_.sn,_.cs),!((e.endAngle-e.startAngle)%(2*Math.PI)<2**-52)){let n=fr.set(v,0,0,y,0,0),r=pr.set(_.cs,_.sn,-_.sn,_.cs,0,0),i=n.append(r).append(f),a=e=>{let{x:t,y:n}=i.apply({x:Math.cos(e),y:Math.sin(e)});return Math.atan2(n,t)};e.startAngle=a(e.startAngle),e.endAngle=a(e.endAngle),vr(t)&&(e.clockwise=!e.clockwise)}}function _r(e,t){let{scale:n}=t.decompose();e.rx*=n.x,e.ry*=n.y;let r=n.x>2**-52?Math.atan2(t.b,t.a):Math.atan2(-t.c,t.d);e.rotate+=r,vr(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function vr(e){return e.a*e.d-e.c*e.b<0}function yr(e){let t=e.a*e.c+e.b*e.d;if(t===0)return!1;let{scale:n}=e.decompose();return Math.abs(t/(n.x*n.y))>2**-52}function br(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?(i=.5*(c-u),s=1/i,r=e*s*n-t*s*t):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}var xr=class extends hr{constructor(e=0,t=0,n=1,r=0,i=Math.PI*2,a=!1){super(new U(e,t),new U(n,n),new U,0,r,i,a)}drawTo(e){let{cx:t,cy:n,rx:r,startAngle:i,endAngle:a,clockwise:o}=this;return e.arc(t,n,r,i,a,!o),this}},Sr=class e extends ur{constructor(e=new U,t=new U){super(),this.p1=e,this.p2=t}static from(t,n,r,i){return new e(new U(t,n),new U(r,i))}getPoint(e,t=new U){return e===1?t.copyFrom(this.p2):t.copyFrom(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new U){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,p2:t}=this;return[{type:`M`,x:e.x,y:e.y},{type:`L`,x:t.x,y:t.y}]}getFillVertices(e={}){let t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),i=Math.max(this.p1.y,this.p2.y),a=t,o=r,s=n-t||e.style?.strokeWidth||0,c=i-r||e.style?.strokeWidth||0;return[a,o,a+s,o,a+s,o+c,a,o+c]}drawTo(e){let{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.p2.copyFrom(e.p2),this}},Cr=class e extends ur{constructor(e=[]){super(),this.curves=e}getFlatCurves(){return this.curves.flatMap(t=>t instanceof e?t.getFlatCurves():t)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new U){let n=e*this.getLength(),r=this.getLengths(),i=r.length;if(i===0)return t;let a=0,o=i-1;for(;a<o;){let e=a+o>>>1;r[e]<n?a=e+1:o=e}let s=r[a]-n,c=this.curves[a],l=c.getLength();return c.getPointAt(l===0?0:1-s/l,t)}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){let e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)n+=this.curves[t].getLength(),e.push(n);this._lengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){let n=[e[t-1],e[t]],r=[e[t+1],e[t+2]];return n[0]===r[0]&&n[1]===r[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{let t=[],n;return this.curves.forEach(r=>{let i;i=r instanceof Sr?r.getAdaptiveVertices():r.getFillVertices(e),t.push(...i),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this.curves.forEach(t=>t.applyTransform(e)),this}getMinMax(e=U.MAX,t=U.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new W(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this}copyFrom(e){return super.copyFrom(e),this.curves=e.curves.map(e=>e.clone()),this}},wr=class e extends ur{constructor(e=new U,t=new U,n=new U,r=new U){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(t,n,r,i,a,o,s,c){return new e(new U(t,n),new U(r,i),new U(a,o),new U(s,c))}getPoint(e,t=new U){let{p1:n,cp1:r,cp2:i,p2:a}=this;return t.set(on(e,n.x,r.x,i.x,a.x),on(e,n.y,r.y,i.y,a.y))}getAdaptiveVertices(e=[]){return dn(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){if(Math.abs(e)<1e-12){if(Math.abs(t)<1e-12)return[];let e=-n/t;return e>=0&&e<=1?[e]:[]}let r=t*t-4*e*n;if(r<0)return[];let i=Math.sqrt(r);return[(-t+i)/(2*e),(-t-i)/(2*e)].filter(e=>e>=0&&e<=1)}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,cp1:r,cp2:i,p2:a}=this,o=this._solveQuadratic(3*(-n.x+3*r.x-3*i.x+a.x),6*(n.x-2*r.x+i.x),3*(r.x-n.x)),s=this._solveQuadratic(3*(-n.y+3*r.y-3*i.y+a.y),6*(n.y-2*r.y+i.y),3*(r.y-n.y)),c=[0,1,...o,...s];for(let n of c){let r=this.getPoint(n);e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),t.x=Math.max(t.x,r.x),t.y=Math.max(t.y,r.y)}return{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:`M`,x:e.x,y:e.y},{type:`C`,x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){let{p1:t,cp1:n,cp2:r,p2:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,i.x,i.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp1.copyFrom(e.cp1),this.cp2.copyFrom(e.cp2),this.p2.copyFrom(e.p2),this}},Tr=class extends hr{constructor(e=0,t=0,n=1,r=1,i=0,a=0,o=Math.PI*2,s=!1){super(new U(e,t),new U(n,r),new U,i,a,o,s)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}},Er=class extends Cr{},Dr=class e extends ur{constructor(e=new U,t=new U,n=new U){super(),this.p1=e,this.cp=t,this.p2=n}static from(t,n,r,i,a,o){return new e(new U(t,n),new U(r,i),new U(a,o))}getPoint(e,t=new U){let{p1:n,cp:r,p2:i}=this;return t.set(Tn(e,n.x,r.x,i.x),Tn(e,n.y,r.y,i.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return gn(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,cp:r,p2:i}=this,a=(e,t,n)=>{let r=e-2*t+n;if(Math.abs(r)<1e-12)return null;let i=(e-t)/r;return i>0&&i<1?i:null},o=a(n.x,r.x,i.x),s=a(n.y,r.y,i.y),c=[n.x,i.x],l=[n.y,i.y];return o!==null&&c.push(Tn(o,n.x,r.x,i.x)),s!==null&&l.push(Tn(s,n.y,r.y,i.y)),e.x=Math.min(e.x,...c),e.y=Math.min(e.y,...l),t.x=Math.max(t.x,...c),t.y=Math.max(t.y,...l),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp:t,p2:n}=this;return[{type:`M`,x:e.x,y:e.y},{type:`Q`,x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){let{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp.copyFrom(e.cp),this.p2.copyFrom(e.p2),this}},Or=class extends Er{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,i=[new U(e,t),new U(e+n,t),new U(e+n,t+r),new U(e,t+r)];return this.curves=[new Sr(i[0],i[1]),new Sr(i[1],i[2]),new Sr(i[2],i[3]),new Sr(i[3],i[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){let{x:t,y:n,width:r,height:i}=this;return[t,n,t+r,n,t+r,n+i,t,n+i]}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}},kr=class extends hr{constructor(e=0,t=0,n=1,r=1,i=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.update()}update(){let{x:e,y:t,width:n,height:r,radius:i}=this,a=n/2,o=r/2,s=e+a,c=t+o,l=Math.max(0,Math.min(i,Math.min(a,o))),u=l;return this._center=new U(s,c),this._radius=new U(l,u),this._diff=new U(a-l,o-u),this}drawTo(e){let{x:t,y:n,width:r,height:i,radius:a}=this;return e.roundRect(t,n,r,i,a),this}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}},Ar=class extends ur{constructor(e=[]){super(),this.points=e}getPoint(e,t=new U){let{points:n}=this,r=(n.length-1)*e,i=Math.floor(r),a=r-i,o=n[i===0?i:i-1],s=n[i],c=n[i>n.length-2?n.length-1:i+1],l=n[i>n.length-3?n.length-1:i+2];return t.set(Gt(a,o.x,s.x,c.x,l.x),Gt(a,o.y,s.y,c.y,l.y)),t}getControlPointRefs(){return this.points}copyFrom(e){super.copyFrom(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}},jr=class extends Cr{startPoint;currentPoint;autoClose=!1;constructor(e){super(),e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++){let{x:n,y:r}=e[t];this.lineTo(n,r)}return this}addCommands(e){return Ln(e,this),this}addData(e){return this.addCommands(Bn(e)),this}_closeVertices(e){return this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getUnevenVertices(e=40,t=[]){return this._closeVertices(super.getUnevenVertices(e,t))}getSpacedVertices(e=40,t=[]){return this._closeVertices(super.getSpacedVertices(e,t))}getAdaptiveVertices(e=[]){return this._closeVertices(super.getAdaptiveVertices(e))}getFillVertices(e){return this._closeVertices(super.getFillVertices(e))}_setCurrentPoint(e){return this.currentPoint=new U(e.x,e.y),this.startPoint||=this.currentPoint.clone(),this}_connetLineTo(e){if(this.curves.length>0){let t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){let e=this.startPoint;if(e){let t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new Sr(t.clone(),e.clone())),t.copyFrom(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new U(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){let n=this.currentPoint;return n?.equals({x:e,y:t})||this.curves.push(Sr.from(n?.x??0,n?.y??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,n,r,i,a){let o=this.currentPoint;return o?.equals({x:i,y:a})||this.curves.push(wr.from(o?.x??0,o?.y??0,e,t,n,r,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(e,t,n,r){let i=this.currentPoint;return i?.equals({x:n,y:r})||this.curves.push(Dr.from(i?.x??0,i?.y??0,e,t,n,r)),this._setCurrentPoint({x:n,y:r}),this}arc(e,t,n,r,i,a){let o=new xr(e,t,n,r,i,!a);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint(o.getPoint(1)),this}relativeArc(e,t,n,r,i,a){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return console.warn(`Method arcTo not supported yet`),this}ellipse(e,t,n,r,i,a,o,s=!0){let c=new Tr(e,t,n,r,i,a,o,!s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,t,n,r,i,a,o,s){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){let i=new Or(e,t,n,r);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,n,r,i){let a=new kr(e,t,n,r,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){let t=this.currentPoint??new U;return this.curves.push(new Ar([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this.autoClose&&e.closePath(),this}copyFrom(e){return super.copyFrom(e),this.autoClose=e.autoClose,this.currentPoint=e.currentPoint?.clone(),this}},Mr=class e extends Cr{_meta;currentCurve=new jr;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??`none`)===`none`?0:1)}constructor(t,n={}){super(),this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof e?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(e){return this._meta=e,this}addPath(t){let n=t instanceof e?t.curves:[t];if(n.filter(e=>e.curves.length).length===0)return this;if(!this.currentCurve.curves.length){let e=this.curves.findIndex(e=>e===this.currentCurve);e>-1&&this.curves.splice(e,1)}return this.curves.push(...n.map(e=>e.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){let e=this.startPoint;return e&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new jr().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.curves.length&&(this.currentCurve=new jr,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,n,r,i,a){return this.currentCurve.bezierCurveTo(e,t,n,r,i,a),this}quadraticCurveTo(e,t,n,r){return this.currentCurve.quadraticCurveTo(e,t,n,r),this}arc(e,t,n,r,i,a){return this.currentCurve.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return this.currentCurve.arcTo(e,t,n,r,i),this}ellipse(e,t,n,r,i,a,o,s){return this.currentCurve.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){return this.currentCurve.rect(e,t,n,r),this}roundRect(e,t,n,r,i){return this.currentCurve.roundRect(e,t,n,r,i),this}reset(){return this.currentCurve=new jr,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return Ln(e,this),this}addData(e){return this.addCommands(Bn(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(e,t,n)}),this}skew(e,t=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(e,t,n)}),this}rotate(e,t={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(e,t)}),this}bold(e){if(e===0)return this;let t=this.getFlatCurves(),n=[],r=[],i=[];t.forEach((e,t)=>{let a=e.getControlPointRefs(),o=e.isClockwise();i[t]=a,r[t]=o;let s=a[0],c=a[a.length-1]??s;n.push({start:o?c:s,end:o?s:c,index:t})});let a=[];return n.forEach((e,t)=>{a[t]=[],n.forEach((n,r)=>{n.start&&e.end&&r!==t&&n.start?.equals(e.end)&&a[t].push(n.index)})}),t.forEach((t,n)=>{let a=r[n];i[n].forEach(n=>{n.add(t.getNormal(t.getTForPoint(n)).scale(a?e:-e))})}),a.forEach((e,t)=>{let n=i[t];e.forEach(e=>{let t=i[e],r=Jt(n[n.length-1],n[n.length-2]??n[n.length-1],t[0],t[1]??t[0]);r&&(n[n.length-1].copyFrom(r),t[0].copyFrom(r))})}),this}getMinMax(e=U.MAX,t=U.MIN,n=!0){let r=this.strokeWidth;return this.curves.forEach(i=>{if(i.getMinMax(e,t),n&&r>1){let n=r/2,a=i.isClockwise(),o=[];for(let e=0;e<=1;e+=1/i.arcLengthDivision){let t=i.getPoint(e),r=i.getNormal(e),s=r.clone().scale(a?n:-n),c=r.clone().scale(a?-n:n);o.push(t.clone().add(s),t.clone().add(c),t.clone().add({x:n,y:0}),t.clone().add({x:-n,y:0}),t.clone().add({x:0,y:n}),t.clone().add({x:0,y:-n}),t.clone().add({x:n,y:n}),t.clone().add({x:-n,y:-n}))}e.clampMin(...o),t.clampMax(...o)}}),{min:e.finite(),max:t.finite()}}strokeTriangulate(e){let t=e?.indices??[],n=e?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...e,indices:t,vertices:n,style:{...this.style}})}),{indices:t,vertices:n}}fillTriangulate(e){let t={...e,style:{...this.style,...e?.style}},n=t.indices??[],r=t.vertices??[];if((t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=xn(i),o=a.length;for(let t=0;t<o;t++){let s=a[t],c=i[t];if(s.winding||!c.length)continue;let l=c.slice(),u=[];for(let e=0;e<o;e++){let n=a[e];n.parentIndex===t&&(u.push(l.length/2),l.push(...i[n.index]))}sn(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else this.curves.forEach(t=>{t.fillTriangulate({...e,indices:n,vertices:r,style:{...this.style}})});return{indices:n,vertices:r}}getBoundingBox(e=!0){let{min:t,max:n}=this.getMinMax(void 0,void 0,e);return new W(t.x,t.y,n.x-t.x,n.y-t.y)}drawTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:r=`none`}=t;return e.beginPath(),e.save(),Wt(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(),r!==`none`&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:r=`none`}=t;return e.beginPath(),e.save(),Wt(e,t),this.getControlPointRefs().forEach(t=>{Ht(e,t.x,t.y,{radius:4})}),n!==`none`&&e.fill(),r!==`none`&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(` `)}toSvgPathString(){let e={...this.style,fill:this.style.fill??`#000`,stroke:this.style.stroke??`none`},t={};for(let n in e)e[n]!==void 0&&(t[qt(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let n=``;for(let e in t)t[e]!==void 0&&(n+=`${e}:${t[e]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copyFrom(e){return super.copyFrom(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}},Nr=class{constructor(e=[],t){this.paths=e,this.viewBox=t}getBoundingBox(e=!0){if(!this.paths.length)return;let t=U.MAX,n=U.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new W(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSvgString(e=this.paths.map(e=>e.fillTriangulate()),t=0){let n=``,r=``,i={x:-t,y:-t},a={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:e,indices:o,points:s=[]})=>{let c=n=>{let r=e[n*2],o=e[n*2+1];return i.x=Math.min(i.x,r+t),a.x=Math.max(a.x,r+t),i.y=Math.min(i.y,o+t),a.y=Math.max(a.y,o+t),[r,o]};for(let e=0,t=o.length;e<t;e+=3){let t=c(o[e]),r=c(o[e+1]),i=c(o[e+2]);n+=`<polygon
2
+ `;function it(e){return nt.test(e)}function at(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?$e(e):{},a=n?Ie(n):void 0,o=r?Re(r):void 0,s=A({...i,fill:a,outline:o,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=s:t.push(s),s}function i(e=``,t,i,a){let o=t?$e(t):{},s=i?Ie(i):void 0,c=a?Re(a):void 0;Array.from(e).forEach(e=>{if(it(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(A({...o,fill:s,outline:c,content:rt})),r(a,t,i)}else{let t=n()||r(),i=t.fragments[t.fragments.length-1];if(i){let{content:t,fill:n,outline:r,...a}=i;if(M(s,n)&&M(c,r)&&M(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(A({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(st(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(ot(e)){let{fragments:t,fill:n,outline:a,...o}=e;r(o,n,a),t.forEach(e=>{let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)})}else Array.isArray(e)?(r(),e.forEach(e=>{if(typeof e==`string`)i(e);else if(st(e)){let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)}})):console.warn(`Failed to parse text content`,e)});let a=n();return a&&!a.fragments.length&&a.fragments.push({content:``}),t}function ot(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function st(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function ct(e){return A({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function lt(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:at(e)}:A({enabled:e.enabled??!0,content:at(e.content??``),style:e.style?$e(e.style):void 0,deformation:e.deformation?ct(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...We(e),effects:e.effects?e.effects.map(e=>We(e)):void 0})}function ut(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=dt(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=vt(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return pt(a,o,n,s,c,l,0),o}function dt(e,t,n,r,i){let a;if(i===Vt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Rt(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Rt(i/r|0,e[i],e[i+1],a);return a&&At(a,a.next)&&(zt(a),a=a.next),a}function ft(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(At(n,n.next)||H(n.prev,n,n.next)===0)){if(zt(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function pt(e,t,n,r,i,a,o){if(!e)return;!o&&a&&Ct(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?ht(e,r,i,a):mt(e)){t.push(c.i,e.i,l.i),zt(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=gt(ft(e),t),pt(e,t,n,r,i,a,2)):o===2&&_t(e,t,n,r,i,a):pt(ft(e),t,n,r,i,a,1);break}}}function mt(e){let t=e.prev,n=e,r=e.next;if(H(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&Ot(i,s,a,c,o,l,m.x,m.y)&&H(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ht(e,t,n,r){let i=e.prev,a=e,o=e.next;if(H(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=Tt(p,m,t,n,r),v=Tt(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Ot(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Ot(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&Ot(s,u,c,d,l,f,y.x,y.y)&&H(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&Ot(s,u,c,d,l,f,b.x,b.y)&&H(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function gt(e,t){let n=e;do{let r=n.prev,i=n.next.next;!At(r,i)&&jt(r,n,n.next,i)&&Ft(r,i)&&Ft(i,r)&&(t.push(r.i,n.i,i.i),zt(n),zt(n.next),n=e=i),n=n.next}while(n!==e);return ft(n)}function _t(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&kt(o,e)){let s=Lt(o,e);o=ft(o,o.next),s=ft(s,s.next),pt(o,t,n,r,i,a,0),pt(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function vt(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=dt(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(Et(o))}i.sort(yt);for(let e=0;e<i.length;e++)n=bt(i[e],n);return n}function yt(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function bt(e,t){let n=xt(e,t);if(!n)return t;let r=Lt(n,e);return ft(r,r.next),ft(n,n.next)}function xt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(At(e,n))return n;do{if(At(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&Dt(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Ft(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&St(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function St(e,t){return H(e.prev,e,t.prev)<0&&H(t.next,e,e.next)<0}function Ct(e,t,n,r){let i=e;do i.z===0&&(i.z=Tt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,wt(i)}function wt(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function Tt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Et(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Dt(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function Ot(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&Dt(e,t,n,r,i,a,o,s)}function kt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Pt(e,t)&&(Ft(e,t)&&Ft(t,e)&&It(e,t)&&(H(e.prev,e,t.prev)||H(e,t.prev,t))||At(e,t)&&H(e.prev,e,e.next)>0&&H(t.prev,t,t.next)>0)}function H(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function At(e,t){return e.x===t.x&&e.y===t.y}function jt(e,t,n,r){let i=Nt(H(e,t,n)),a=Nt(H(e,t,r)),o=Nt(H(n,r,e)),s=Nt(H(n,r,t));return!!(i!==a&&o!==s||i===0&&Mt(e,n,t)||a===0&&Mt(e,r,t)||o===0&&Mt(n,e,r)||s===0&&Mt(n,t,r))}function Mt(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Nt(e){return e>0?1:e<0?-1:0}function Pt(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&jt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Ft(e,t){return H(e.prev,e,e.next)<0?H(e,t,e.next)>=0&&H(e,e.prev,t)>=0:H(e,t,e.prev)<0||H(e,e.next,t)<0}function It(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Lt(e,t){let n=Bt(e.i,e.x,e.y),r=Bt(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Rt(e,t,n,r){let i=Bt(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function zt(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Bt(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function Ht(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var Ut={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function Wt(e,t){let{fill:n=`#000`,stroke:r=`none`,strokeWidth:i=r===`none`?0:1,strokeLinecap:a=`round`,strokeLinejoin:o=`miter`,strokeMiterlimit:s=0,strokeDasharray:c=[],strokeDashoffset:l=0,shadowOffsetX:u=0,shadowOffsetY:d=0,shadowBlur:f=0,shadowColor:p=`rgba(0, 0, 0, 0)`}=t;e.fillStyle=n,e.strokeStyle=r,e.lineWidth=i,e.lineCap=a,e.lineJoin=Ut[o],e.miterLimit=s,e.setLineDash(c),e.lineDashOffset=l,e.shadowOffsetX=u,e.shadowOffsetY=d,e.shadowBlur=f,e.shadowColor=p}var U=class e{constructor(e=0,t=0,n){this._x=e,this._y=t,this._onUpdate=n}static get MAX(){return new e(1/0,1/0)}static get MIN(){return new e(-1/0,-1/0)}static lerp(t,n,r){return new e(n.x,n.y).clone().sub(t).multiply(r).add(t)}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}get left(){return this.x}set left(e){this.x=e}get top(){return this.y}set top(e){this.y=e}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._onUpdate?.(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._onUpdate?.(this))}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._onUpdate?.(this)),this}add(e){return this.set(this._x+e.x,this._y+e.y)}sub(e){return this.set(this._x-e.x,this._y-e.y)}subVectors(e,t){return this.set(e.x-t.x,e.y-t.y)}multiply(e=0,t=e){return this.set(this._x*e,this._y*t)}divide(e=0,t=e){return this.set(e===0?this._x:this._x/e,t===0?this._y:this._y/t)}cross(e){return this._x*e.y-this._y*e.x}dot(e){return this._x*e.x+this._y*e.y}rotate(e,t={x:0,y:0}){let{x:n,y:r}=this,i=Math.cos(e),a=Math.sin(e);return this.set((n-t.x)*i-(r-t.y)*a+t.x,(n-t.x)*a+(r-t.y)*i+t.y)}getLength(){let{x:e,y:t}=this;return Math.sqrt(e*e+t*t)}getAngle(){return Math.atan2(-this.x,-this.y)+Math.PI}distanceTo(e){return Math.hypot(e.x-this.x,e.y-this.y)}normalize(){let e=1/(this.getLength()||1);return this.set(this.x*e,this.y*e),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._onUpdate?.(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return this._x===e.x&&this._y===e.y}get array(){return[this.x,this.y]}finite(){return this.set(Number.isFinite(this._x)?this._x:0,Number.isFinite(this._y)?this._y:0)}lengthSquared(){return this._x*this._x+this._y*this._y}length(){return Math.sqrt(this.lengthSquared())}scale(e,t=e,n={x:0,y:0}){return this.set(n.x+(this._x-n.x)*e,n.y+(this._y-n.y)*t)}skew(e,t=0,n={x:0,y:0}){let r=this._x-n.x,i=this._y-n.y;return this.set(n.x+(r+Math.tan(e)*i),n.y+(i+Math.tan(t)*r))}clampMin(...e){return this.set(Math.min(this._x,...e.map(e=>e.x)),Math.min(this._y,...e.map(e=>e.y)))}clampMax(...e){return this.set(Math.max(this.x,...e.map(e=>e.x)),Math.max(this.y,...e.map(e=>e.y)))}clone(t){return new e(this._x,this._y,t??this._onUpdate)}toJSON(){return{x:this._x,y:this._y}}destroy(){this._onUpdate=void 0}},W=class e{constructor(e=0,t=0,n=0,r=0){this.left=e,this.top=t,this.width=n,this.height=r}get x(){return this.left}set x(e){this.left=e}get y(){return this.top}set y(e){this.top=e}get right(){return this.left+this.width}get bottom(){return this.top+this.height}get center(){return new U((this.left+this.right)/2,(this.top+this.bottom)/2)}get array(){return[this.left,this.top,this.width,this.height]}static from(...t){if(t.length===0)return new e;if(t.length===1)return t[0].clone();let n=t[0],r=t.slice(1).reduce((e,t)=>(e.left=Math.min(e.left,t.left),e.top=Math.min(e.top,t.top),e.right=Math.max(e.right,t.right),e.bottom=Math.max(e.bottom,t.bottom),e),{left:n?.left??0,top:n?.top??0,right:n?.right??0,bottom:n?.bottom??0});return new e(r.left,r.top,r.right-r.left,r.bottom-r.top)}translate(e,t){return this.left+=e,this.top+=t,this}copy(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this}clone(){return new e(this.left,this.top,this.width,this.height)}};function Gt(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}var Kt=Math.PI*2;function qt(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function Jt(e,t,n,r){let i=t.clone().sub(e),a=r.clone().sub(n),o=n.clone().sub(e),s=i.cross(a);if(s===0)return null;let c=o.cross(a)/s;return Math.abs(c)>1?null:new U(e.x+c*i.x,e.y+c*i.y)}var Yt=/([\w-]+)\((.+?)\)/g,Xt=/[^,]+/g,Zt=/([-e.\d]+)(.*)/;function Qt(e,t={}){let n=[],r;for(;(r=Yt.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:$t(e,i,t)})}return n}function $t(e,t,n={}){let r=[],i,a=0;for(;(i=Xt.exec(t))!==null;)r.push(en(e,i[0],{...n,index:a++}));return r}function en(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(Zt),s={unit:o?.[2]??null,value:t,intValue:Number(o?.[1]),normalizedIntValue:0,normalizedDefaultIntValue:0};switch(e){case`scale`:case`scaleX`:case`scaleY`:case`scale3d`:s.normalizedDefaultIntValue=1;break}switch(s.unit){case`%`:s.normalizedIntValue=s.intValue/100;break;case`rad`:s.normalizedIntValue=s.intValue/Kt;break;case`deg`:s.normalizedIntValue=s.intValue/360;break;case`px`:switch(a){case 0:s.normalizedIntValue=s.intValue/r;break;case 1:s.normalizedIntValue=s.intValue/i;break}break;default:s.normalizedIntValue=s.intValue;break}return s}function tn(e,t){let n=1-e;return n*n*n*t}function nn(e,t){let n=1-e;return 3*n*n*e*t}function rn(e,t){return 3*(1-e)*e*e*t}function an(e,t){return e*e*e*t}function on(e,t,n,r,i){return tn(e,t)+nn(e,n)+rn(e,r)+an(e,i)}function sn(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=ut(e,i,2);if(c.length){for(let e=0;e<c.length;e+=3)r[s++]=c[e]+o,r[s++]=c[e+1]+o,r[s++]=c[e+2]+o;let t=o*a;for(let r=0;r<e.length;r+=2)n[t]=e[r],n[t+1]=e[r+1],t+=a}return{vertices:n,indices:r}}var cn=8,ln=1.1920929e-7,un=1;function dn(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(un-Math.min(.99,Math.max(0,c)))/1;return u*=u,fn(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function fn(e,t,n,r,i,a,o,s,c,l,u){if(u>cn)return;let d=(e+n)/2,f=(t+r)/2,p=(n+i)/2,m=(r+a)/2,h=(i+o)/2,g=(a+s)/2,_=(d+p)/2,v=(f+m)/2,y=(p+h)/2,b=(m+g)/2,x=(_+y)/2,S=(v+b)/2;if(u>0){let u=o-e,d=s-t,f=Math.abs((n-o)*d-(r-s)*u),p=Math.abs((i-o)*d-(a-s)*u);if(f>ln&&p>ln){if((f+p)*(f+p)<=l*(u*u+d*d)){c.push(x,S);return}}else if(f>ln){if(f*f<=l*(u*u+d*d)){c.push(x,S);return}}else if(p>ln){if(p*p<=l*(u*u+d*d)){c.push(x,S);return}}else if(u=x-(e+o)/2,d=S-(t+s)/2,u*u+d*d<=l){c.push(x,S);return}}fn(e,t,d,f,_,v,x,S,c,l,u+1),fn(x,S,y,b,h,g,o,s,c,l,u+1)}var pn=8,mn=1.1920929e-7,hn=1;function gn(e,t,n,r,i,a,o=.5,s=[]){let c=(hn-Math.min(.99,Math.max(0,o)))/1;return c*=c,_n(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function _n(e,t,n,r,i,a,o,s,c){if(c>pn)return;let l=(t+r)/2,u=(n+i)/2,d=(r+a)/2,f=(i+o)/2,p=(l+d)/2,m=(u+f)/2,h=a-t,g=o-n,_=Math.abs((r-a)*g-(i-o)*h);if(_>mn){if(_*_<=s*(h*h+g*g)){e.push(p,m);return}}else if(h=p-(t+a)/2,g=m-(n+o)/2,h*h+g*g<=s){e.push(p,m);return}_n(e,t,n,l,u,p,m,s,c+1),_n(e,p,m,d,f,a,o,s,c+1)}function vn(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function yn(e,t,n){let r=n.length,i=0;for(let a=0,o=r-2;a<r;o=a,a+=2){let r=n[a],s=n[a+1],c=n[o],l=n[o+1];s<=t?l>t&&vn(c,l,r,s,e,t)>0&&i++:l<=t&&vn(c,l,r,s,e,t)<0&&i--}return i}function bn(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function xn(e,t){return e.minX<=t.maxX&&e.maxX>=t.minX&&e.minY<=t.maxY&&e.maxY>=t.minY}function Sn(e){let t=e.map((e,t)=>({index:t})),n=[],r=e.map((e,t)=>{let r=e.length;if(!r)return n[t]=null,[];let i=[2**53-1,0],a=[0,2**53-1],o=[-(2**53-1),0],s=[0,-(2**53-1)];for(let t=0;t<r;t+=2){let n=e[t],r=e[t+1];i[0]>n&&(i=[n,r]),a[1]>r&&(a=[n,r]),o[0]<n&&(o=[n,r]),s[1]<r&&(s=[n,r])}n[t]={minX:i[0],minY:a[1],maxX:o[0],maxY:s[1]};let c=[(i[0]+o[0])/2,(a[1]+s[1])/2],l,u,d,f,p,m,h,g;for(let t=0;t<r;t+=2){let n=e[t],r=e[t+1],i=Math.abs(n-c[0]),a=Math.abs(r-c[1]);r<c[1]&&(!l||i<l)&&(l=i,d=[n,r]),r>c[1]&&(!u||i<u)&&(u=i,f=[n,r]),n<c[0]&&(!p||a<p)&&(p=a,h=[n,r]),n>c[0]&&(!m||a<m)&&(m=a,g=[n,r])}return[i,a,o,s,d,f,h,g].filter(Boolean)});for(let i=0,a=e.length;i<a;i++){let o=[],s=r[i],c=n[i];for(let t=0;t<a;t++){if(i===t)continue;let a=n[t];if(!c||!a||!xn(c,a))continue;let l={},u=[];for(let n=0,r=s.length;n<r;n++){let[r,i]=s[n],a=yn(r,i,e[t]);l[a]=(l[a]??0)+1,u.push(a)}u.filter(e=>e!==0).length>u.filter(e=>e===0).length&&o.push({index:i,parentIndex:t,winding:Number(Array.from(Object.entries(l)).sort((e,t)=>t[1]-e[1])?.[0]?.[0]??0),dist:bn(r[i][0],r[t][0])})}o.reduce((e,t)=>e+t.winding,0)!==0&&(o.sort((e,t)=>e.dist-t.dist),t[i]=o[0])}return t}function Cn(e,t,n,r,i,a){return(n-e)*(a-t)-(i-e)*(r-t)}function wn(e,t,n){let r=n.length,i=0;for(let a=0;a<r;a+=2){let o=n[a],s=n[a+1],c=(a+2)%r,l=n[c],u=n[c+1];s<=t?u>t&&Cn(o,s,l,u,e,t)>0&&i++:u<=t&&Cn(o,s,l,u,e,t)<0&&i--}return i}function Tn(e,t,n){let r=n.length,i=0;for(let a=0;a<r;a+=2){let o=n[a],s=n[a+1],c=(a+2)%r,l=n[c],u=n[c+1];(s<=t&&u>t||s>t&&u<=t)&&e<o+(t-s)/(u-s)*(l-o)&&i++}return i}function En(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s,l=c===0?0:((e-n)*o+(t-r)*s)/c;l<0?l=0:l>1&&(l=1);let u=n+l*o,d=r+l*s;return Math.hypot(e-u,t-d)}function Dn(e,t,n=`nonzero`){return t.length<6?!1:n===`evenodd`?(Tn(e.x,e.y,t)&1)==1:wn(e.x,e.y,t)!==0}function On(e,t,n=`nonzero`){let{x:r,y:i}=e;if(n===`evenodd`){let e=0;for(let n=0,a=t.length;n<a;n++){let a=t[n];a.length>=6&&(e+=Tn(r,i,a))}return(e&1)==1}let a=0;for(let e=0,n=t.length;e<n;e++){let n=t[e];n.length>=6&&(a+=wn(r,i,n))}return a!==0}function kn(e,t,n=!1){let r=t.length;if(r<2)return 1/0;let{x:i,y:a}=e;if(r===2)return Math.hypot(i-t[0],a-t[1]);let o=1/0;for(let e=0;e<r-2;e+=2){let n=En(i,a,t[e],t[e+1],t[e+2],t[e+3]);n<o&&(o=n)}if(n&&r>=6){let e=En(i,a,t[r-2],t[r-1],t[0],t[1]);e<o&&(o=e)}return o}function An(e,t){let n=1-e;return n*n*t}function jn(e,t){return 2*(1-e)*e*t}function Mn(e,t){return e*e*t}function Nn(e,t,n,r){return An(e,t)+jn(e,n)+Mn(e,r)}var Pn=1e-4,Fn=1e-4;function In(e,t={}){let{vertices:n=[],indices:r=[],lineStyle:i={alignment:.5,cap:`butt`,join:`miter`,width:1,miterLimit:10},flipAlignment:a=!1,closed:o=!0}=t,s=Pn;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=Ln(e);a&&(t*=-1),l=(l-.5)*t+.5}let u={x:e[0],y:e[1]},d={x:e[e.length-2],y:e[e.length-1]},f=o,p=Math.abs(u.x-d.x)<s&&Math.abs(u.y-d.y)<s;if(f){e=e.slice(),p&&(e.pop(),e.pop(),d.x=e[e.length-2],d.y=e[e.length-1]);let t=(u.x+d.x)*.5,n=(d.y+u.y)*.5;e.unshift(t,n),e.push(t,n)}let m=n,h=e.length/2,g=e.length,_=m.length/2,v=c.width/2,y=v*v,b=c.miterLimit*c.miterLimit,x=e[0],S=e[1],C=e[2],w=e[3],T=0,E=0,D=-(S-w),O=x-C,k=0,A=0,j=Math.sqrt(D*D+O*O);D/=j,O/=j,D*=v,O*=v;let M=l,N=(1-M)*2,P=M*2;f||(c.cap===`round`?g+=zn(x-D*(N-P)*.5,S-O*(N-P)*.5,x-D*N,S-O*N,x+D*P,S+O*P,m,!0)+2:c.cap===`square`&&(g+=Rn(x,S,D,O,N,P,!0,m))),m.push(x-D*N,S-O*N),m.push(x+D*P,S+O*P);for(let t=1;t<h-1;++t){x=e[(t-1)*2],S=e[(t-1)*2+1],C=e[t*2],w=e[t*2+1],T=e[(t+1)*2],E=e[(t+1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,k=-(w-E),A=C-T,j=Math.sqrt(k*k+A*A),k/=j,A/=j,k*=v,A*=v;let n=C-x,r=S-w,i=C-T,a=E-w,o=n*i+r*a,s=r*i-a*n,l=s<0;if(Math.abs(s)<.001*Math.abs(o)){m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),o>=0&&(c.join===`round`?g+=zn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4:g+=2,m.push(C-k*P,w-A*P),m.push(C+k*N,w+A*N));continue}let u=(-D+x)*(-O+w)-(-D+C)*(-O+S),d=(-k+T)*(-A+w)-(-k+C)*(-A+E),f=(n*d-i*u)/s,p=(a*u-r*d)/s,h=(f-C)*(f-C)+(p-w)*(p-w),_=C+(f-C)*N,M=w+(p-w)*N,F=C-(f-C)*P,I=w-(p-w)*P,L=Math.min(n*n+r*r,i*i+a*a),R=l?N:P;h<=L+R*R*y?c.join===`bevel`||h/y>b?(l?(m.push(_,M),m.push(C+D*P,w+O*P),m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),m.push(C-k*N,w-A*N),m.push(F,I)),g+=2):c.join===`round`?l?(m.push(_,M),m.push(C+D*P,w+O*P),g+=zn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+4,m.push(_,M),m.push(C+k*P,w+A*P)):(m.push(C-D*N,w-O*N),m.push(F,I),g+=zn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+4,m.push(C-k*N,w-A*N),m.push(F,I)):(m.push(_,M),m.push(F,I)):(m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),c.join===`round`?l?g+=zn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=zn(C,w,C-D*N,w-O*N,C-k*N,w-A*N,m,!1)+2:c.join===`miter`&&h/y<=b&&(l?(m.push(F,I),m.push(F,I)):(m.push(_,M),m.push(_,M)),g+=2),m.push(C-k*N,w-A*N),m.push(C+k*P,w+A*P),g+=2)}x=e[(h-2)*2],S=e[(h-2)*2+1],C=e[(h-1)*2],w=e[(h-1)*2+1],D=-(S-w),O=x-C,j=Math.sqrt(D*D+O*O),D/=j,O/=j,D*=v,O*=v,m.push(C-D*N,w-O*N),m.push(C+D*P,w+O*P),f||(c.cap===`round`?g+=zn(C-D*(N-P)*.5,w-O*(N-P)*.5,C-D*N,w-O*N,C+D*P,w+O*P,m,!1)+2:c.cap===`square`&&(g+=Rn(C,w,D,O,N,P,!1,m)));let F=Fn*Fn;for(let e=_;e<g+_-2;++e)x=m[e*2],S=m[e*2+1],C=m[(e+1)*2],w=m[(e+1)*2+1],T=m[(e+2)*2],E=m[(e+2)*2+1],!(Math.abs(x*(w-E)+C*(E-S)+T*(S-w))<F)&&r.push(e,e+1,e+2);return{vertices:n,indices:r}}function Ln(e){let t=e.length;if(t<6)return 1;let n=0;for(let r=0,i=e[t-2],a=e[t-1];r<t;r+=2){let t=e[r],o=e[r+1];n+=(t-i)*(o+a),i=t,a=o}return n<0?-1:1}function Rn(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h),s.push(g,_),2}function zn(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t),o.push(n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t),o.push(e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t),o.push(i,a)}else{o.push(n,r),o.push(e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h),o.push(e,t);o.push(i,a),o.push(e,t)}return g*2}var Bn=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}_array;set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}appendFrom(e,t){let n=e.a,r=e.b,i=e.c,a=e.d,o=e.tx,s=e.ty,c=t.a,l=t.b,u=t.c,d=t.d;return this.a=n*c+r*u,this.b=n*l+r*d,this.c=i*c+a*u,this.d=i*l+a*d,this.tx=o*c+s*u+t.tx,this.ty=o*l+s*d+t.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}skewX(e){let t=Math.tan(e);return this.a+=t*this.b,this.c+=t*this.d,this.tx+=t*this.ty,this}skewY(e){let t=Math.tan(e);return this.b+=t*this.a,this.d+=t*this.c,this.ty+=t*this.tx,this}skew(e,t){let n=Math.tan(e),r=Math.tan(t),i=this.a,a=this.b,o=this.c,s=this.d,c=this.tx,l=this.ty;return this.a=i+n*a,this.b=r*i+a,this.c=o+n*s,this.d=r*o+s,this.tx=c+n*l,this.ty=r*c+l,this}translateX(e){return this.translate(e,0)}translateY(e){return this.translate(0,e)}translateZ(e){return this.translate(0,0,e)}translate3d(e,t,n){return this.translate(e,t,n)}translate(e,t,n=0){return this.tx+=e,this.ty+=t,this}scaleX(e){return this.scale(e,1)}scaleY(e){return this.scale(1,e)}scale3d(e,t,n=1){return this.scale(e,t,n)}scale(e,t,n=1){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotateX(e){return this.scaleY(this._rotateToScale(e))}rotateY(e){return this.scaleX(this._rotateToScale(e))}rotateZ(e){return this.rotate(e)}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}rotate3d(e,t,n,r){let[i,a,o]=this._rotate3d(e,t,n,r);return i&&this.rotateX(i),a&&this.rotateY(a),o&&this.rotateZ(o),this}_rotateToScale(e){let t=e/Kt;return t<=.5?t*-4+1:(t-1)*4+1}_rotate3d(e,t,n,r){if(e===1&&t===0&&n===0)return[r,0,0];if(e===0&&t===1&&n===0)return[0,r,0];if(e===0&&t===0)return[0,0,r];{let i=Math.cos(r),a=Math.sin(r),o=i+e*e*(1-i),s=e*t*(1-i)-n*a,c=e*n*(1-i)+t*a,l=i+t*t*(1-i),u=t*n*(1-i)-e*a,d=i+n*n*(1-i);return[-Math.atan2(-u,l),-Math.atan2(c,Math.sqrt(u*u+d*d)),-Math.atan2(-s,o)]}}decompose(e={x:0,y:0},t={position:{x:0,y:0},scale:{x:0,y:0},skew:{x:0,y:0},rotation:0}){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=-Math.atan2(-i,a),l=Math.atan2(r,n),u=Math.abs(c+l);return u<1e-5||Math.abs(Kt-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=c,t.skew.y=l),t.scale.x=Math.sqrt(n*n+r*r),t.scale.y=Math.sqrt(i*i+a*a),t.position.x=o+(e.x*n+e.y*i),t.position.y=s+(e.x*r+e.y*a),t}apply(e,t){t||=new U;let{x:n,y:r}=e;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}affineInvert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}affineInverse(){return this.clone().affineInvert()}applyAffineInverse(e,t){t||=new U;let{a:n,b:r,c:i,d:a,tx:o,ty:s}=this,c=1/(n*a+i*-r),l=e.x,u=e.y;return t.x=a*c*l+-i*c*u+(s*i-o*a)*c,t.y=n*c*u+-r*c*l+(-s*n+o*r)*c,t}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}isIdentity(){let{a:e,b:t,c:n,d:r,tx:i,ty:a}=this;return e===1&&t===0&&n===0&&r===1&&i===0&&a===0}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}prependCssTransform(t,n={}){let{width:r=1,height:i=1}=n,a=new e;return Qt(t,{width:r,height:i}).reverse().forEach(({name:e,args:t})=>{let n=t.map(e=>e.normalizedIntValue);switch(e){case`translateX`:a.translateX(n[0]*r);break;case`translateY`:a.translateY(n[0]*i);break;case`translateZ`:a.translateZ(n[0]);break;case`translate`:a.translate(n[0]*r,(n[1]??n[0])*i);break;case`translate3d`:a.translate3d(n[0]*r,(n[1]??n[0])*i,n[2]??n[1]??n[0]);break;case`scaleX`:a.scaleX(n[0]);break;case`scaleY`:a.scaleY(n[0]);break;case`scale`:a.scale(n[0],n[1]??n[0]);break;case`scale3d`:a.scale3d(n[0],n[1]??n[0],n[2]??n[1]??n[0]);break;case`rotateX`:a.rotateX(n[0]*Kt);break;case`rotateY`:a.rotateY(n[0]*Kt);break;case`rotateZ`:a.rotateZ(n[0]*Kt);break;case`rotate`:a.rotate(n[0]*Kt);break;case`rotate3d`:a.rotate3d(n[0]*Kt,(n[1]??n[0])*Kt,(n[2]??n[1]??n[0])*Kt,(n[3]??n[2]??n[1]??n[0])*Kt);break;case`skewX`:a.skewX(n[0]*Kt);break;case`skewY`:a.skewY(n[0]*Kt);break;case`skew`:a.skew(n[0]*Kt,(n[0]??n[1])*Kt);break;case`matrix`:a.set(n[0],n[1],n[2],n[3],n[4],n[5]);break}}),this.prepend(a),this}clone(){return new e(this.a,this.b,this.c,this.d,this.tx,this.ty)}toArray(e,t){this._array||=new Float32Array(9);let n=t||this._array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}toString(){return`[Transform2D a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}toJSON(){return{a:this.a,b:this.b,c:this.c,d:this.d,tx:this.tx,ty:this.ty}}destroy(){this._array=void 0}};function Vn(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function Hn(e,t,n,r,i,a,o,s){if(t===0||n===0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,l=(o.y-s.y)/2,u=Math.cos(r)*c+Math.sin(r)*l,d=-Math.sin(r)*c+Math.cos(r)*l,f=t*t,p=n*n,m=u*u,h=d*d,g=m/f+h/p;if(g>1){let e=Math.sqrt(g);t=e*t,n=e*n,f=t*t,p=n*n}let _=f*h+p*m,v=(f*p-_)/_,y=Math.sqrt(Math.max(0,v));i===a&&(y=-y);let b=y*t*d/n,x=-y*n*u/t,S=Math.cos(r)*b-Math.sin(r)*x+(o.x+s.x)/2,C=Math.sin(r)*b+Math.cos(r)*x+(o.y+s.y)/2,w=Vn(1,0,(u-b)/t,(d-x)/n),T=Vn((u-b)/t,(d-x)/n,(-u-b)/t,(-d-x)/n)%(Math.PI*2);e.ellipse(S,C,t,n,r,w,w+T,a===0)}var G={WHITESPACE:/[ \t\r\n]/,DIGIT:/\d/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/};function Un(e,t,n=0){let r=0,i=!0,a=``,o=``,s=[];function c(e,t,n){let r=SyntaxError(`Unexpected character "${e}" at index ${t}.`);throw r.partial=n,r}function l(){a!==``&&(o===``?s.push(Number(a)):s.push(Number(a)*10**Number(o))),a=``,o=``}let u,d=e.length;for(let f=0;f<d;f++){if(u=e[f],Array.isArray(t)&&t.includes(s.length%n)&&G.FLAGS.test(u)){r=1,a=u,l();continue}if(r===0){if(G.WHITESPACE.test(u))continue;if(G.DIGIT.test(u)||G.SIGN.test(u)){r=1,a=u;continue}if(G.POINT.test(u)){r=2,a=u;continue}G.COMMA.test(u)&&(i&&c(u,f,s),i=!0)}if(r===1){if(G.DIGIT.test(u)){a+=u;continue}if(G.POINT.test(u)){a+=u,r=2;continue}if(G.EXP.test(u)){r=3;continue}G.SIGN.test(u)&&a.length===1&&G.SIGN.test(a[0])&&c(u,f,s)}if(r===2){if(G.DIGIT.test(u)){a+=u;continue}if(G.EXP.test(u)){r=3;continue}G.POINT.test(u)&&a[a.length-1]===`.`&&c(u,f,s)}if(r===3){if(G.DIGIT.test(u)){o+=u;continue}if(G.SIGN.test(u)){if(o===``){o+=u;continue}o.length===1&&G.SIGN.test(o)&&c(u,f,s)}}G.WHITESPACE.test(u)?(l(),r=0,i=!1):G.COMMA.test(u)?(l(),r=0,i=!0):G.SIGN.test(u)?(l(),r=1,a=u):G.POINT.test(u)?(l(),r=2,a=u):c(u,f,s)}return l(),s}function Wn(e,t){return e-(t-e)}function Gn(e,t){let n=new U,r=new U,i=``;for(let a=0,o=e.length;a<o;a++){let o=e[a];if(((o.type===`s`||o.type===`S`)&&!`CcSs`.includes(i)||(o.type===`t`||o.type===`T`)&&!`QqTt`.includes(i))&&r.copyFrom(n),o.type===`m`||o.type===`M`)o.type===`m`?n.add(o):n.copyFrom(o),t.moveTo(n.x,n.y),r.copyFrom(n);else if(o.type===`h`||o.type===`H`)o.type===`h`?n.x+=o.x:n.x=o.x,t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`v`||o.type===`V`)o.type===`v`?n.y+=o.y:n.y=o.y,t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`l`||o.type===`L`)o.type===`l`?n.add(o):n.copyFrom(o),t.lineTo(n.x,n.y),r.copyFrom(n);else if(o.type===`c`||o.type===`C`)o.type===`c`?(t.bezierCurveTo(n.x+o.x1,n.y+o.y1,n.x+o.x2,n.y+o.y2,n.x+o.x,n.y+o.y),r.x=n.x+o.x2,r.y=n.y+o.y2,n.add(o)):(t.bezierCurveTo(o.x1,o.y1,o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,n.copyFrom(o));else if(o.type===`s`||o.type===`S`)o.type===`s`?(t.bezierCurveTo(Wn(n.x,r.x),Wn(n.y,r.y),n.x+o.x2,n.y+o.y2,n.x+o.x,n.y+o.y),r.x=n.x+o.x2,r.y=n.y+o.y2,n.add(o)):(t.bezierCurveTo(Wn(n.x,r.x),Wn(n.y,r.y),o.x2,o.y2,o.x,o.y),r.x=o.x2,r.y=o.y2,n.copyFrom(o));else if(o.type===`q`||o.type===`Q`)o.type===`q`?(t.quadraticCurveTo(n.x+o.x1,n.y+o.y1,n.x+o.x,n.y+o.y),r.x=n.x+o.x1,r.y=n.y+o.y1,n.add(o)):(t.quadraticCurveTo(o.x1,o.y1,o.x,o.y),r.x=o.x1,r.y=o.y1,n.copyFrom(o));else if(o.type===`t`||o.type===`T`){let e=Wn(n.x,r.x),i=Wn(n.y,r.y);r.x=e,r.y=i,o.type===`t`?(t.quadraticCurveTo(e,i,n.x+o.x,n.y+o.y),n.add(o)):(t.quadraticCurveTo(e,i,o.x,o.y),n.copyFrom(o))}else if(o.type===`a`||o.type===`A`){let e=n.clone();if(o.type===`a`){if(o.x===0&&o.y===0)continue;n.add(o)}else{if(n.equals(o))continue;n.copyFrom(o)}r.copyFrom(n),Hn(t,o.rx,o.ry,o.angle,o.largeArcFlag,o.sweepFlag,e,n)}else o.type===`z`||o.type===`Z`?(t.startPoint&&n.copyFrom(t.startPoint),t.closePath()):console.warn(`Unsupported commands`,o);i=o.type}}function Kn(e){let t,n,r=[];for(let i=0,a=e.length;i<a;i++){let a=e[i];switch(a.type){case`m`:case`M`:if(a.x.toFixed(4)===n?.x.toFixed(4)&&a.y.toFixed(4)===n?.y.toFixed(4))continue;r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y},t={x:a.x,y:a.y};break;case`h`:case`H`:r.push(`${a.type} ${a.x}`),n={x:a.x,y:n?.y??0};break;case`v`:case`V`:r.push(`${a.type} ${a.y}`),n={x:n?.x??0,y:a.y};break;case`l`:case`L`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`c`:case`C`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`s`:case`S`:r.push(`${a.type} ${a.x2} ${a.y2} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`q`:case`Q`:r.push(`${a.type} ${a.x1} ${a.y1} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`t`:case`T`:r.push(`${a.type} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`a`:case`A`:r.push(`${a.type} ${a.rx} ${a.ry} ${a.angle} ${a.largeArcFlag} ${a.sweepFlag} ${a.x} ${a.y}`),n={x:a.x,y:a.y};break;case`z`:case`Z`:r.push(a.type),t&&(n={x:t.x,y:t.y});break}}return r.join(` `)}var qn=/[a-df-z][^a-df-z]*/gi;function Jn(e){let t=[],n=e.match(qn);if(!n)return t;for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.charAt(0),a=r.slice(1).trim(),o;switch(i){case`m`:case`M`:o=Un(a);for(let e=0,n=o.length;e<n;e+=2)e===0?t.push({type:i,x:o[e],y:o[e+1]}):t.push({type:i===`m`?`l`:`L`,x:o[e],y:o[e+1]});break;case`h`:case`H`:o=Un(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=Un(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=Un(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`c`:case`C`:o=Un(a);for(let e=0,n=o.length;e<n;e+=6)t.push({type:i,x1:o[e],y1:o[e+1],x2:o[e+2],y2:o[e+3],x:o[e+4],y:o[e+5]});break;case`s`:case`S`:o=Un(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x2:o[e],y2:o[e+1],x:o[e+2],y:o[e+3]});break;case`q`:case`Q`:o=Un(a);for(let e=0,n=o.length;e<n;e+=4)t.push({type:i,x1:o[e],y1:o[e+1],x:o[e+2],y:o[e+3]});break;case`t`:case`T`:o=Un(a);for(let e=0,n=o.length;e<n;e+=2)t.push({type:i,x:o[e],y:o[e+1]});break;case`a`:case`A`:o=Un(a,[3,4],7);for(let e=0,n=o.length;e<n;e+=7)t.push({type:i,rx:o[e],ry:o[e+1],angle:o[e+2],largeArcFlag:o[e+3],sweepFlag:o[e+4],x:o[e+5],y:o[e+6]});break;case`z`:case`Z`:t.push({type:i});break;default:console.warn(r)}}return t}var Yn=`data:image/svg+xml;`,Xn=`${Yn}base64,`,Zn=`${Yn}charset=utf8,`;function Qn(e){if(typeof e==`string`){let t;e.startsWith(Xn)?(e=e.substring(Xn.length,e.length),t=atob(e)):e.startsWith(Zn)?(e=e.substring(Zn.length,e.length),t=decodeURIComponent(e)):t=e;let n=new DOMParser().parseFromString(t,`text/xml`),r=n.querySelector(`parsererror`);if(r)throw Error(`${r.textContent??`parser error`}
3
+ ${t}`);return n.documentElement}else return e}var $n=`px`,er=90,tr=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],nr={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function K(e){let t=`px`;if(typeof e==`string`)for(let n=0,r=tr.length;n<r;n++){let r=tr[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return n=nr[t][$n],n<0&&(n=nr[t].in*er),n*Number.parseFloat(e)}function rr(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=ir(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function ir(e){let t=new Bn;return e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))&&t.translate(K(e.getAttribute(`x`)),K(e.getAttribute(`y`))),e.hasAttribute(`transform`)&&t.prependCssTransform(e.getAttribute(`transform`)),t}function ar(e){return new Vr().arc(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`r`)||0),0,Math.PI*2)}function or(e,t){if(!(!e.sheet||!e.sheet.cssRules||!e.sheet.cssRules.length))for(let n=0;n<e.sheet.cssRules.length;n++){let r=e.sheet.cssRules[n];if(r.type!==1)continue;let i=r.selectorText.split(/,/g).filter(Boolean).map(e=>e.trim()),a={};for(let e=r.style.length,t=0;t<e;t++){let e=r.style.item(t);a[e]=r.style.getPropertyValue(e)}for(let e=0;e<i.length;e++)t[i[e]]=Object.assign(t[i[e]]||{},{...a})}}function sr(e){return new Vr().ellipse(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`rx`)||0),K(e.getAttribute(`ry`)||0),0,0,Math.PI*2)}function cr(e){return new Vr().moveTo(K(e.getAttribute(`x1`)||0),K(e.getAttribute(`y1`)||0)).lineTo(K(e.getAttribute(`x2`)||0),K(e.getAttribute(`y2`)||0))}function lr(e){let t=new Vr,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var ur=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function dr(e){let t=new Vr,n=0;return e.getAttribute(`points`)?.replace(ur,(e,r,i)=>{let a=K(r),o=K(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!0,t}var fr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function pr(e){let t=new Vr,n=0;return e.getAttribute(`points`)?.replace(fr,(e,r,i)=>{let a=K(r),o=K(i);return n===0?t.moveTo(a,o):t.lineTo(a,o),n++,e}),t.currentCurve.autoClose=!1,t}function mr(e){let t=K(e.getAttribute(`x`)||0),n=K(e.getAttribute(`y`)||0),r=e.getAttribute(`rx`),i=e.getAttribute(`ry`),a=K(r??i??0),o=K(i??r??0),s=K(e.getAttribute(`width`)),c=K(e.getAttribute(`height`));a=Math.max(0,Math.min(a,s/2)),o=Math.max(0,Math.min(o,c/2));let l=.448084975506,u=new Vr;return u.moveTo(t+a,n),u.lineTo(t+s-a,n),(a!==0||o!==0)&&u.bezierCurveTo(t+s-a*l,n,t+s,n+o*l,t+s,n+o),u.lineTo(t+s,n+c-o),(a!==0||o!==0)&&u.bezierCurveTo(t+s,n+c-o*l,t+s-a*l,n+c,t+s-a,n+c),u.lineTo(t+a,n+c),(a!==0||o!==0)&&u.bezierCurveTo(t+a*l,n+c,t,n+c-o*l,t,n+c-o),u.lineTo(t,n+o),(a!==0||o!==0)&&u.bezierCurveTo(t,n+o*l,t+a*l,n,t+a,n),u}function hr(e,t,n){t=Object.assign({},t);let r={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)r=Object.assign(r,n[`.${t[e]}`])}e.hasAttribute(`id`)&&(r=Object.assign(r,n[`#${e.getAttribute(`id`)}`]));for(let n=e.style.length,i=0;i<n;i++){let n=e.style.item(i),a=e.style.getPropertyValue(n);t[n]=a,r[n]=a}function i(n,i,o=a){e.hasAttribute(n)&&(t[i]=o(e.getAttribute(n))),r[n]&&(t[i]=o(r[n]))}function a(e){return e.startsWith(`url`)&&console.warn(`url access in attributes is not implemented.`),e}function o(e){return Math.max(0,Math.min(1,K(e)))}function s(e){return Math.max(0,K(e))}function c(e){return e.split(` `).filter(e=>e!==``).map(e=>K(e))}return i(`fill`,`fill`),i(`fill-opacity`,`fillOpacity`,o),i(`fill-rule`,`fillRule`),i(`opacity`,`opacity`,o),i(`stroke`,`stroke`),i(`stroke-opacity`,`strokeOpacity`,o),i(`stroke-width`,`strokeWidth`,s),i(`stroke-linecap`,`strokeLinecap`),i(`stroke-linejoin`,`strokeLinejoin`),i(`stroke-miterlimit`,`strokeMiterlimit`,s),i(`stroke-dasharray`,`strokeDasharray`,c),i(`stroke-dashoffset`,`strokeDashoffset`,K),i(`visibility`,`visibility`),t}function gr(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=hr(e,o,r);break;case`style`:or(e,r);break;case`g`:o=hr(e,o,r);break;case`path`:o=hr(e,o,r),e.hasAttribute(`d`)&&(a=lr(e));break;case`rect`:o=hr(e,o,r),a=mr(e);break;case`polygon`:o=hr(e,o,r),a=dr(e);break;case`polyline`:o=hr(e,o,r),a=pr(e);break;case`circle`:o=hr(e,o,r),a=ar(e);break;case`ellipse`:o=hr(e,o,r),a=sr(e);break;case`line`:o=hr(e,o,r),a=cr(e);break;case`defs`:i=!0;break;case`use`:{o=hr(e,o,r);let t=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),i=e.viewportElement?.getElementById(t);i?gr(i,o,n,r):console.warn(`'use node' references non-existent node id: ${t}`);break}default:console.warn(e);break}if(o.display===`none`)return n;let s=new Bn,c=[],l=rr(e,s,c);a&&(a.applyTransform(s),n.push(a),a.style={...o});let u=e.childNodes;for(let e=0,t=u.length;e<t;e++){let t=u[e];i&&t.nodeName!==`style`&&t.nodeName!==`defs`||gr(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function _r(e){let t=Qn(e);return new Hr(gr(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var vr=class{arcLengthDivision=200;_lengths=[];_adaptiveCache;_owner;_invalidating=!1;invalidate(){return this._invalidating?this:(this._invalidating=!0,this._invalidateSelf(),this._owner?.invalidate(),this._invalidating=!1,this)}_invalidateSelf(){this._lengths.length=0,this._adaptiveCache=void 0}_getCachedAdaptiveVertices(){return this._adaptiveCache??=this.getAdaptiveVertices()}getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}isClockwise(){return!1}getControlPointRefs(){return[]}applyTransform(e){let t=typeof e==`function`;return this.getControlPointRefs().forEach(n=>{t?e(n):e.apply(n,n)}),this.invalidate(),this}getUnevenVertices(e=5,t=[]){let n=new U;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPoint(r/i,n),t.push(n.x,n.y);return t}getSpacedVertices(e=5,t=[]){let n=new U;for(let r=0,i=Math.max(1,e)-1;r<=i;r++)this.getPointAt(r/i,n),t.push(n.x,n.y);return t}getAdaptiveVertices(e=[]){return this.getUnevenVertices(5,e)}_verticesToPoints(e,t=[]){for(let n=0,r=e.length;n<r;n+=2){let r=e[n],i=e[n+1];t.push(new U(r,i))}return t}getSpacedPoints(e,t=[]){let n=this.getSpacedVertices(e);return this._verticesToPoints(n,t),t}getUnevenPoints(e,t=[]){let n=this.getUnevenVertices(e);return this._verticesToPoints(n,t),t}getAdaptivePoints(e=[]){let t=this.getAdaptiveVertices();return this._verticesToPoints(t,e),e}getPoints(e,t=[]){let n;return n=e?this.getUnevenVertices(e):this.getAdaptiveVertices(),this._verticesToPoints(n,t),t}getLength(){let e=this.getLengths();return e[e.length-1]??0}getLengths(){return this._lengths.length!==this.arcLengthDivision+1&&this.updateLengths(),this._lengths}updateLengths(){let e=this.arcLengthDivision,t=[0];for(let n=0,r=this.getPoint(0),i=1;i<=e;i++){let a=this.getPoint(i/e);n+=a.distanceTo(r),t.push(n),r=a}this._lengths=t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t??e*n[r-1];if(r<2)return i/n[0];let a=0,o=0,s=r-1,c;for(;o<=s;)if(a=Math.floor(o+(s-o)/2),c=n[a]-i,c<0)o=a+1;else if(c>0)s=a-1;else{s=a;break}if(a=Math.max(0,s),n[a]===i)return a/(r-1);let l=n[a],u=n[a+1]-l,d=Math.max(0,(i-l)/u);return(a+d)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getTangentAt(e,t){return this.getTangent(this.getUToTMapping(e),t)}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}getNormalAt(e,t){return this.getNormal(this.getUToTMapping(e),t)}getTForPoint(e,t=.001){let n=0,r=1,i=(n+r)/2;for(;r-n>t;){i=(n+r)/2;let a=this.getPoint(i);if(a.distanceTo(e)<t)return i;a.x<e.x?n=i:r=i}return i}getMinMax(e=U.MAX,t=U.MIN){let n=this.getAdaptiveVertices(),r=e.x,i=e.y,a=t.x,o=t.y;for(let e=0,t=n.length;e<t;e+=2){let t=n[e],s=n[e+1];t<r&&(r=t),s<i&&(i=s),t>a&&(a=t),s>o&&(o=s)}return e.set(r,i),t.set(a,o),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new W(e.x,e.y,t.x-e.x,t.y-e.y)}isPointInFill(e,t={}){return Dn(e,this._getCachedAdaptiveVertices(),t.fillRule)}isPointInStroke(e,t={}){let{strokeWidth:n=1,tolerance:r=0,closed:i=!1}=t;return kn(e,this._getCachedAdaptiveVertices(),i)<=n/2+r}contains(e,t,n={}){return this.isPointInFill({x:e,y:t},n)}getFillVertices(e){return this.getAdaptiveVertices()}fillTriangulate(e){return sn(this.getFillVertices(e),e)}strokeTriangulate(e){return In(this.getAdaptiveVertices(),e)}toCommands(){let e=[],t=this.getPoints();for(let n=0,r=t.length;n<r;n++){let r=t[n];n===0?e.push({type:`M`,x:r.x,y:r.y}):e.push({type:`L`,x:r.x,y:r.y})}return e}toData(){return Kn(this.toCommands())}drawTo(e){return this.toCommands().forEach(t=>{switch(t.type){case`M`:e.moveTo(t.x,t.y);break;case`L`:e.lineTo(t.x,t.y);break}}),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this}clone(){return new this.constructor().copyFrom(this)}},yr=new Bn,br=new Bn,xr=new Bn,Sr=new U,Cr=class extends vr{constructor(e=new U,t=new U,n=new U,r=0,i=0,a=Math.PI*2,o=!1){super(),this._center=e,this._radius=t,this._diff=n,this.rotate=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}get cx(){return this._center.x}set cx(e){this._center.x=e}get cy(){return this._center.y}set cy(e){this._center.y=e}get rx(){return this._radius.x}set rx(e){this._radius.x=e}get ry(){return this._radius.y}set ry(e){this._radius.y=e}get dx(){return this._diff.x}set dx(e){this._diff.x=e}get dy(){return this._diff.y}set dy(e){this._diff.y=e}isClockwise(){return this.clockwise}_getDeltaAngle(){let e=Math.PI*2,t=this.endAngle-this.startAngle,n=Math.abs(t)<2**-52;return t=(t%e+e)%e,n?t=0:this.clockwise||(t=t===0?-e:t-e),t}getPoint(e,t=new U){let n=this._getDeltaAngle(),r=this.startAngle+e*n,i=this.cx+this.rx*Math.cos(r),a=this.cy+this.ry*Math.sin(r);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),n=i-this.cx,r=a-this.cy;i=n*e-r*t+this.cx,a=n*t+r*e+this.cy}return t.set(i,a)}_pointAtAngle(e,t){let n=this.cx+this.rx*Math.cos(e),r=this.cy+this.ry*Math.sin(e);if(this.rotate!==0){let e=Math.cos(this.rotate),t=Math.sin(this.rotate),i=n-this.cx,a=r-this.cy;n=i*e-a*t+this.cx,r=i*t+a*e+this.cy}return t.set(n,r)}getMinMax(e=U.MAX,t=U.MIN){let{startAngle:n,rotate:r}=this,i=this._getDeltaAngle(),a=Math.cos(r),o=Math.sin(r),s=Sr,c=e.x,l=e.y,u=t.x,d=t.y,f=e=>{this._pointAtAngle(e,s),s.x<c&&(c=s.x),s.y<l&&(l=s.y),s.x>u&&(u=s.x),s.y>d&&(d=s.y)};f(n),f(n+i);let p=Math.atan2(-this.ry*o,this.rx*a),m=Math.atan2(this.ry*a,this.rx*o),h=[p,p+Math.PI,m,m+Math.PI];for(let e=0;e<4;e++)wr(h[e],n,i)&&f(h[e]);return e.set(c,l),t.set(u,d),{min:e.finite(),max:t.finite()}}toCommands(){let{cx:e,cy:t,rx:n,ry:r,startAngle:i,endAngle:a,clockwise:o,rotate:s}=this,c=e+n*Math.cos(i)*Math.cos(s)-r*Math.sin(i)*Math.sin(s),l=t+n*Math.cos(i)*Math.sin(s)+r*Math.sin(i)*Math.cos(s),u=Math.abs(i-a),d=+(u>Math.PI),f=+!!o,p=s*180/Math.PI;if(u>=2*Math.PI){let a=i+Math.PI,o=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),u=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:o,y:u},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:0,sweepFlag:f,x:c,y:l}]}else{let i=e+n*Math.cos(a)*Math.cos(s)-r*Math.sin(a)*Math.sin(s),o=t+n*Math.cos(a)*Math.sin(s)+r*Math.sin(a)*Math.cos(s);return[{type:`M`,x:c,y:l},{type:`A`,rx:n,ry:r,angle:p,largeArcFlag:d,sweepFlag:f,x:i,y:o}]}}drawTo(e){let{cx:t,cy:n,rx:r,ry:i,rotate:a,startAngle:o,endAngle:s,clockwise:c}=this;return e.ellipse(t,n,r,i,a,o,s,!c),this}applyTransform(e){return Sr.set(this.cx,this.cy),e.apply(Sr,Sr),this.cx=Sr.x,this.cy=Sr.y,Or(e)?Tr(this,e):Er(this,e),this.invalidate(),this}getControlPointRefs(){return[this._center]}_getAdaptiveVerticesByArc(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,startAngle:s,endAngle:c,clockwise:l,rotate:u}=this,d=!l,f=Math.abs(s-c);(!d&&s>c||d&&c>s)&&(f=2*Math.PI-f);let p=Math.max(12,Math.floor(12*r**(1/3)*(f/Math.PI))),m=f/p,h=s;m*=d?-1:1;let g=Math.cos(d?u:-u),_=Math.sin(d?u:-u);for(let s=0;s<p+1;s++){let s=a+Math.cos(h)*r,c=o+Math.sin(h)*i,l=s*g-c*_,u=s*_+c*g;e.push(t+l,n+u),h+=m}return e}_getAdaptiveVerticesByCircle(e=[]){let{cx:t,cy:n,rx:r,ry:i,dx:a,dy:o,rotate:s,clockwise:c}=this;if(!(r>=0&&i>=0&&a>=0&&o>=0))return e;let l=Math.ceil(2.3*Math.sqrt(r+i)),u=l*8+(a?4:0)+(o?4:0),d=[];if(u===0)return e;{let e=d.length;if(l===0)d[e]=d[e+6]=t+a,d[e+1]=d[e+3]=n+o,d[e+2]=d[e+4]=t-a,d[e+5]=d[e+7]=n-o;else{let s=e,c=e+l*4+(a?2:0)+2,f=c,p=u,m=a+r,h=o,g=t+m,_=t-m,v=n+h;if(d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,o){let e=n-h;d[f++]=_,d[f++]=e,d[--p]=e,d[--p]=g}for(let e=1;e<l;e++){let u=Math.PI/2*(e/l),m=a+Math.cos(u)*r,h=o+Math.sin(u)*i,g=t+m,_=t-m,v=n+h,y=n-h;d[s++]=g,d[s++]=v,d[--c]=v,d[--c]=_,d[f++]=_,d[f++]=y,d[--p]=y,d[--p]=g}m=a,h=o+i,g=t+m,_=t-m,v=n+h;let y=n-h;d[s++]=g,d[s++]=v,d[--p]=y,d[--p]=g,a&&(d[s++]=_,d[s++]=v,d[--p]=y,d[--p]=_)}}let f=Math.cos(c?-s:s),p=Math.sin(c?-s:s);for(let r=0;r<d.length;r+=2){let i=d[r],a=d[r+1],o=i-t,s=a-n,c=o*f-s*p,l=o*p+s*f;e.push(t+c,n+l)}return e}getAdaptiveVertices(e=[]){return this.startAngle===0&&this.endAngle===Math.PI*2?this._getAdaptiveVerticesByCircle(e):this._getAdaptiveVerticesByArc(e)}copyFrom(e){return super.copyFrom(e),this.cx=e.cx,this.cy=e.cy,this.rx=e.rx,this.ry=e.ry,this.dx=e.dx,this.dy=e.dy,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotate=e.rotate,this}};function wr(e,t,n){let r=Math.PI*2,i=1e-9;if(Math.abs(n)>=r-i)return!0;let a=(e-t)%r;return n>=0?(a<-1e-9&&(a+=r),a>=-1e-9&&a<=n+i):(a>i&&(a-=r),a<=i&&a>=n-i)}function Tr(e,t){let n=e.rx,r=e.ry,i=Math.cos(e.rotate),a=Math.sin(e.rotate),o=new U(n*i,n*a),s=new U(-r*a,r*i),c=t.a*o.x+t.c*o.y,l=t.b*o.x+t.d*o.y,u=t.a*s.x+t.c*s.y,d=t.b*s.x+t.d*s.y,f=yr.set(c,l,u,d,0,0),{a:p,b:m,c:h,d:g}=br.copyFrom(f).affineInvert(),_=kr(p*p+m*m,h*p+g*m,h*h+g*g),v=Math.sqrt(_.rt1),y=Math.sqrt(_.rt2);if(e.rx=1/v,e.ry=1/y,e.rotate=Math.atan2(_.sn,_.cs),!((e.endAngle-e.startAngle)%(2*Math.PI)<2**-52)){let n=br.set(v,0,0,y,0,0),r=xr.set(_.cs,_.sn,-_.sn,_.cs,0,0),i=n.append(r).append(f),a=e=>{let{x:t,y:n}=i.apply({x:Math.cos(e),y:Math.sin(e)});return Math.atan2(n,t)};e.startAngle=a(e.startAngle),e.endAngle=a(e.endAngle),Dr(t)&&(e.clockwise=!e.clockwise)}}function Er(e,t){let{scale:n}=t.decompose();e.rx*=n.x,e.ry*=n.y;let r=n.x>2**-52?Math.atan2(t.b,t.a):Math.atan2(-t.c,t.d);e.rotate+=r,Dr(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function Dr(e){return e.a*e.d-e.c*e.b<0}function Or(e){let t=e.a*e.c+e.b*e.d;if(t===0)return!1;let{scale:n}=e.decompose();return Math.abs(t/(n.x*n.y))>2**-52}function kr(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?(i=.5*(c-u),s=1/i,r=e*s*n-t*s*t):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}var Ar=class extends Cr{constructor(e=0,t=0,n=1,r=0,i=Math.PI*2,a=!1){super(new U(e,t),new U(n,n),new U,0,r,i,a)}drawTo(e){let{cx:t,cy:n,rx:r,startAngle:i,endAngle:a,clockwise:o}=this;return e.arc(t,n,r,i,a,!o),this}},jr=class e extends vr{constructor(e=new U,t=new U){super(),this.p1=e,this.p2=t}static from(t,n,r,i){return new e(new U(t,n),new U(r,i))}getPoint(e,t=new U){return e===1?t.copyFrom(this.p2):t.copyFrom(this.p2).sub(this.p1).scale(e).add(this.p1),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.p2,this.p1).normalize()}getTangentAt(e,t=new U){return this.getTangent(e,t)}getControlPointRefs(){return[this.p1,this.p2]}getAdaptiveVertices(e=[]){return e.push(this.p1.x,this.p1.y,this.p2.x,this.p2.y),e}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,p2:r}=this;return e.x=Math.min(e.x,n.x,r.x),e.y=Math.min(e.y,n.y,r.y),t.x=Math.max(t.x,n.x,r.x),t.y=Math.max(t.y,n.y,r.y),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,p2:t}=this;return[{type:`M`,x:e.x,y:e.y},{type:`L`,x:t.x,y:t.y}]}getFillVertices(e={}){let t=Math.min(this.p1.x,this.p2.x),n=Math.max(this.p1.x,this.p2.x),r=Math.min(this.p1.y,this.p2.y),i=Math.max(this.p1.y,this.p2.y),a=t,o=r,s=n-t||e.style?.strokeWidth||0,c=i-r||e.style?.strokeWidth||0;return[a,o,a+s,o,a+s,o+c,a,o+c]}drawTo(e){let{p1:t,p2:n}=this;return e.lineTo(t.x,t.y),e.lineTo(n.x,n.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.p2.copyFrom(e.p2),this}},Mr=class e extends vr{constructor(e=[]){super(),this.curves=e}_adaptiveCacheLen=-1;_invalidateSelf(){super._invalidateSelf(),this._adaptiveCacheLen=-1,this.curves.forEach(e=>e.invalidate())}_getCachedAdaptiveVertices(){return(!this._adaptiveCache||this._adaptiveCacheLen!==this.curves.length)&&(this.curves.forEach(e=>{e._owner=this}),this._adaptiveCache=this.getAdaptiveVertices(),this._adaptiveCacheLen=this.curves.length),this._adaptiveCache}getFlatCurves(){return this.curves.flatMap(t=>t instanceof e?t.getFlatCurves():t)}addCurve(e){return this.curves.push(e),this}getPoint(e,t=new U){let n=e*this.getLength(),r=this.getLengths(),i=r.length;if(i===0)return t;let a=0,o=i-1;for(;a<o;){let e=a+o>>>1;r[e]<n?a=e+1:o=e}let s=r[a]-n,c=this.curves[a],l=c.getLength();return c.getPointAt(l===0?0:1-s/l,t)}getLengths(){return this._lengths.length!==this.curves.length&&this.updateLengths(),this._lengths}updateLengths(){let e=[];for(let t=0,n=0,r=this.curves.length;t<r;t++)this.curves[t]._owner=this,n+=this.curves[t].getLength(),e.push(n);this._lengths=e}getControlPointRefs(){return this.curves.flatMap(e=>e.getControlPointRefs())}_removeNextPointIfEqualPrevPoint(e,t){let n=[e[t-1],e[t]],r=[e[t+1],e[t+2]];return n[0]===r[0]&&n[1]===r[1]&&e.splice(t+1,2),e}getSpacedVertices(e=5,t=[]){let n;return this.curves.forEach(r=>{r.getSpacedVertices(e,t),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}getAdaptiveVertices(e=[]){let t;return this.curves.forEach(n=>{n.getAdaptiveVertices(e),t&&this._removeNextPointIfEqualPrevPoint(e,t),t=e.length-1}),e}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}getFillVertices(e){if(this.curves.length===1)return this.curves[0].getFillVertices(e);{let t=[],n;return this.curves.forEach(r=>{let i;i=r instanceof jr?r.getAdaptiveVertices():r.getFillVertices(e),t.push(...i),n&&this._removeNextPointIfEqualPrevPoint(t,n),n=t.length-1}),t}}applyTransform(e){return this._invalidating=!0,this.curves.forEach(t=>t.applyTransform(e)),this._invalidating=!1,this.invalidate(),this}getMinMax(e=U.MAX,t=U.MIN){return this.curves.forEach(n=>n.getMinMax(e,t)),{min:e.finite(),max:t.finite()}}getBoundingBox(){let{min:e,max:t}=this.getMinMax();return new W(e.x,e.y,t.x-e.x,t.y-e.y)}toCommands(){return this.curves.flatMap(e=>e.toCommands())}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this}copyFrom(e){return super.copyFrom(e),this.curves=e.curves.map(e=>e.clone()),this}},Nr=class e extends vr{constructor(e=new U,t=new U,n=new U,r=new U){super(),this.p1=e,this.cp1=t,this.cp2=n,this.p2=r}static from(t,n,r,i,a,o,s,c){return new e(new U(t,n),new U(r,i),new U(a,o),new U(s,c))}getPoint(e,t=new U){let{p1:n,cp1:r,cp2:i,p2:a}=this;return t.set(on(e,n.x,r.x,i.x,a.x),on(e,n.y,r.y,i.y,a.y))}getAdaptiveVertices(e=[]){return dn(this.p1.x,this.p1.y,this.cp1.x,this.cp1.y,this.cp2.x,this.cp2.y,this.p2.x,this.p2.y,.5,e)}getControlPointRefs(){return[this.p1,this.cp1,this.cp2,this.p2]}_solveQuadratic(e,t,n){if(Math.abs(e)<1e-12){if(Math.abs(t)<1e-12)return[];let e=-n/t;return e>=0&&e<=1?[e]:[]}let r=t*t-4*e*n;if(r<0)return[];let i=Math.sqrt(r);return[(-t+i)/(2*e),(-t-i)/(2*e)].filter(e=>e>=0&&e<=1)}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,cp1:r,cp2:i,p2:a}=this,o=this._solveQuadratic(3*(-n.x+3*r.x-3*i.x+a.x),6*(n.x-2*r.x+i.x),3*(r.x-n.x)),s=this._solveQuadratic(3*(-n.y+3*r.y-3*i.y+a.y),6*(n.y-2*r.y+i.y),3*(r.y-n.y)),c=[0,1,...o,...s];for(let n of c){let r=this.getPoint(n);e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),t.x=Math.max(t.x,r.x),t.y=Math.max(t.y,r.y)}return{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return[{type:`M`,x:e.x,y:e.y},{type:`C`,x1:t.x,y1:t.y,x2:n.x,y2:n.y,x:r.x,y:r.y}]}drawTo(e){let{p1:t,cp1:n,cp2:r,p2:i}=this;return e.lineTo(t.x,t.y),e.bezierCurveTo(n.x,n.y,r.x,r.y,i.x,i.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp1.copyFrom(e.cp1),this.cp2.copyFrom(e.cp2),this.p2.copyFrom(e.p2),this}},Pr=class extends Cr{constructor(e=0,t=0,n=1,r=1,i=0,a=0,o=Math.PI*2,s=!1){super(new U(e,t),new U(n,r),new U,i,a,o,s)}drawTo(e){return e.ellipse(this.cx,this.cy,this.rx,this.ry,this.rotate,this.startAngle,this.endAngle,!this.clockwise),this}},Fr=class extends Mr{},Ir=class e extends vr{constructor(e=new U,t=new U,n=new U){super(),this.p1=e,this.cp=t,this.p2=n}static from(t,n,r,i,a,o){return new e(new U(t,n),new U(r,i),new U(a,o))}getPoint(e,t=new U){let{p1:n,cp:r,p2:i}=this;return t.set(Nn(e,n.x,r.x,i.x),Nn(e,n.y,r.y,i.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return gn(this.p1.x,this.p1.y,this.cp.x,this.cp.y,this.p2.x,this.p2.y,.5,e)}getMinMax(e=U.MAX,t=U.MIN){let{p1:n,cp:r,p2:i}=this,a=(e,t,n)=>{let r=e-2*t+n;if(Math.abs(r)<1e-12)return null;let i=(e-t)/r;return i>0&&i<1?i:null},o=a(n.x,r.x,i.x),s=a(n.y,r.y,i.y),c=[n.x,i.x],l=[n.y,i.y];return o!==null&&c.push(Nn(o,n.x,r.x,i.x)),s!==null&&l.push(Nn(s,n.y,r.y,i.y)),e.x=Math.min(e.x,...c),e.y=Math.min(e.y,...l),t.x=Math.max(t.x,...c),t.y=Math.max(t.y,...l),{min:e.finite(),max:t.finite()}}toCommands(){let{p1:e,cp:t,p2:n}=this;return[{type:`M`,x:e.x,y:e.y},{type:`Q`,x1:t.x,y1:t.y,x:n.x,y:n.y}]}drawTo(e){let{p1:t,cp:n,p2:r}=this;return e.lineTo(t.x,t.y),e.quadraticCurveTo(n.x,n.y,r.x,r.y),this}copyFrom(e){return super.copyFrom(e),this.p1.copyFrom(e.p1),this.cp.copyFrom(e.cp),this.p2.copyFrom(e.p2),this}},Lr=class extends Fr{constructor(e=0,t=0,n=0,r=0){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,i=[new U(e,t),new U(e+n,t),new U(e+n,t+r),new U(e,t+r)];return this.curves=[new jr(i[0],i[1]),new jr(i[1],i[2]),new jr(i[2],i[3]),new jr(i[3],i[0])],this}drawTo(e){return e.rect(this.x,this.y,this.width,this.height),this}getFillVertices(e={}){let{x:t,y:n,width:r,height:i}=this;return[t,n,t+r,n,t+r,n+i,t,n+i]}copyFrom(e){return super.copyFrom(e),this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.update(),this}},Rr=class extends Mr{constructor(e=0,t=0,n=1,r=1,i=1){super(),this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.update()}update(){let{x:e,y:t,width:n,height:r}=this,i=Math.max(0,Math.min(this.radius,Math.abs(n)/2,Math.abs(r)/2)),a=e,o=e+i,s=e+n-i,c=e+n,l=t,u=t+i,d=t+r-i,f=t+r;if(i<=0)this.curves=[jr.from(a,l,c,l),jr.from(c,l,c,f),jr.from(c,f,a,f),jr.from(a,f,a,l)];else{let e=Math.PI/2;this.curves=[jr.from(o,l,s,l),new Ar(s,u,i,-e,0,!0),jr.from(c,u,c,d),new Ar(s,d,i,0,e,!0),jr.from(s,f,o,f),new Ar(o,d,i,e,Math.PI,!0),jr.from(a,d,a,u),new Ar(o,u,i,Math.PI,Math.PI*1.5,!0)]}return this.invalidate(),this}drawTo(e){return e.roundRect(this.x,this.y,this.width,this.height,this.radius),this}copyFrom(e){return this.arcLengthDivision=e.arcLengthDivision,this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.radius=e.radius,this.update(),this}},zr=class extends vr{constructor(e=[]){super(),this.points=e}getPoint(e,t=new U){let{points:n}=this,r=(n.length-1)*e,i=Math.floor(r),a=r-i,o=n[i===0?i:i-1],s=n[i],c=n[i>n.length-2?n.length-1:i+1],l=n[i>n.length-3?n.length-1:i+2];return t.set(Gt(a,o.x,s.x,c.x,l.x),Gt(a,o.y,s.y,c.y,l.y)),t}getControlPointRefs(){return this.points}copyFrom(e){super.copyFrom(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++)this.points.push(e.points[t].clone());return this}},Br=class extends Mr{startPoint;currentPoint;autoClose=!1;constructor(e){super(),e&&this.addPoints(e)}addPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++){let{x:n,y:r}=e[t];this.lineTo(n,r)}return this}addCommands(e){return Gn(e,this),this}addData(e){return this.addCommands(Jn(e)),this}_closeVertices(e){return this.autoClose&&e.length>=4&&e[0]!==e[e.length-2]&&e[1]!==e[e.length-1]&&e.push(e[0],e[1]),e}getUnevenVertices(e=40,t=[]){return this._closeVertices(super.getUnevenVertices(e,t))}getSpacedVertices(e=40,t=[]){return this._closeVertices(super.getSpacedVertices(e,t))}getAdaptiveVertices(e=[]){return this._closeVertices(super.getAdaptiveVertices(e))}getFillVertices(e){return this._closeVertices(super.getFillVertices(e))}isPointInStroke(e,t={}){let{strokeWidth:n=1,tolerance:r=0}=t,i=this._getCachedAdaptiveVertices(),a=i.length;return kn(e,i,t.closed??(this.autoClose||a>=6&&i[0]===i[a-2]&&i[1]===i[a-1]))<=n/2+r}_setCurrentPoint(e){return this.currentPoint=new U(e.x,e.y),this.startPoint||=this.currentPoint.clone(),this}_connetLineTo(e){if(this.curves.length>0){let t=e.getPoint(0);(!this.currentPoint||!t.equals(this.currentPoint))&&this.lineTo(t.x,t.y)}return this}closePath(){let e=this.startPoint;if(e){let t=this.currentPoint;t&&!e.equals(t)&&(this.curves.push(new jr(t.clone(),e.clone())),t.copyFrom(e)),this.startPoint=void 0}return this}moveTo(e,t){return this.currentPoint=new U(e,t),this.startPoint=this.currentPoint.clone(),this}lineTo(e,t){let n=this.currentPoint;return n?.equals({x:e,y:t})||this.curves.push(jr.from(n?.x??0,n?.y??0,e,t)),this._setCurrentPoint({x:e,y:t}),this}bezierCurveTo(e,t,n,r,i,a){let o=this.currentPoint;return o?.equals({x:i,y:a})||this.curves.push(Nr.from(o?.x??0,o?.y??0,e,t,n,r,i,a)),this._setCurrentPoint({x:i,y:a}),this}quadraticCurveTo(e,t,n,r){let i=this.currentPoint;return i?.equals({x:n,y:r})||this.curves.push(Ir.from(i?.x??0,i?.y??0,e,t,n,r)),this._setCurrentPoint({x:n,y:r}),this}arc(e,t,n,r,i,a){let o=new Ar(e,t,n,r,i,!a);return this._connetLineTo(o),this.curves.push(o),this._setCurrentPoint(o.getPoint(1)),this}relativeArc(e,t,n,r,i,a){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return console.warn(`Method arcTo not supported yet`),this}ellipse(e,t,n,r,i,a,o,s=!0){let c=new Pr(e,t,n,r,i,a,o,!s);return this._connetLineTo(c),this.curves.push(c),this._setCurrentPoint(c.getPoint(1)),this}relativeEllipse(e,t,n,r,i,a,o,s){return e+=this.currentPoint?.x??0,t+=this.currentPoint?.y??0,this.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){let i=new Lr(e,t,n,r);return this._connetLineTo(i),this.curves.push(i),this._setCurrentPoint({x:e,y:t}),this}roundRect(e,t,n,r,i){let a=new Rr(e,t,n,r,i);return this._connetLineTo(a),this.curves.push(a),this._setCurrentPoint({x:e,y:t}),this}splineThru(e){let t=this.currentPoint??new U;return this.curves.push(new zr([t].concat(e))),this._setCurrentPoint(e[e.length-1]),this}drawTo(e){let t=this.curves[0]?.getPoint(0);return t&&e.moveTo(t.x,t.y),this.curves.forEach(t=>t.drawTo(e)),this.autoClose&&e.closePath(),this}copyFrom(e){return super.copyFrom(e),this.autoClose=e.autoClose,this.currentPoint=e.currentPoint?.clone(),this}},Vr=class e extends Mr{_meta;_ringsCache;_ringsCacheLen=-1;currentCurve=new Br;style;get startPoint(){return this.currentCurve.startPoint}get currentPoint(){return this.currentCurve.currentPoint}get strokeWidth(){return this.style.strokeWidth??((this.style.stroke??`none`)===`none`?0:1)}constructor(t,n={}){super(),this.curves.push(this.currentCurve),this.style=n,t&&(t instanceof e?this.addPath(t):Array.isArray(t)?this.addCommands(t):this.addData(t))}getMeta(){return this._meta}setMeta(e){return this._meta=e,this}addPath(t){let n=t instanceof e?t.curves:[t];if(n.filter(e=>e.curves.length).length===0)return this;if(!this.currentCurve.curves.length){let e=this.curves.findIndex(e=>e===this.currentCurve);e>-1&&this.curves.splice(e,1)}return this.curves.push(...n.map(e=>e.clone())),this.currentCurve=this.curves[this.curves.length-1],this}closePath(){let e=this.startPoint;return e&&this.currentCurve.curves.length&&(this.currentCurve.closePath(),this.currentCurve=new Br().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.curves.length&&(this.currentCurve=new Br,this.curves.push(this.currentCurve)),this.currentCurve.moveTo(e,t),this}lineTo(e,t){return this.currentCurve.lineTo(e,t),this}bezierCurveTo(e,t,n,r,i,a){return this.currentCurve.bezierCurveTo(e,t,n,r,i,a),this}quadraticCurveTo(e,t,n,r){return this.currentCurve.quadraticCurveTo(e,t,n,r),this}arc(e,t,n,r,i,a){return this.currentCurve.arc(e,t,n,r,i,a),this}arcTo(e,t,n,r,i){return this.currentCurve.arcTo(e,t,n,r,i),this}ellipse(e,t,n,r,i,a,o,s){return this.currentCurve.ellipse(e,t,n,r,i,a,o,s),this}rect(e,t,n,r){return this.currentCurve.rect(e,t,n,r),this}roundRect(e,t,n,r,i){return this.currentCurve.roundRect(e,t,n,r,i),this}reset(){return this.currentCurve=new Br,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return Gn(e,this),this}addData(e){return this.addCommands(Jn(e)),this}splineThru(e){return this.currentCurve.splineThru(e),this}scale(e,t=e,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.scale(e,t,n)}),this.invalidate(),this}skew(e,t=0,n={x:0,y:0}){return this.getControlPointRefs().forEach(r=>{r.skew(e,t,n)}),this.invalidate(),this}rotate(e,t={x:0,y:0}){return this.getControlPointRefs().forEach(n=>{n.rotate(e,t)}),this.invalidate(),this}bold(e){if(e===0)return this;let t=this.getFlatCurves(),n=[],r=[],i=[];t.forEach((e,t)=>{let a=e.getControlPointRefs(),o=e.isClockwise();i[t]=a,r[t]=o;let s=a[0],c=a[a.length-1]??s;n.push({start:o?c:s,end:o?s:c,index:t})});let a=[];return n.forEach((e,t)=>{a[t]=[],n.forEach((n,r)=>{n.start&&e.end&&r!==t&&n.start?.equals(e.end)&&a[t].push(n.index)})}),t.forEach((t,n)=>{let a=r[n];i[n].forEach(n=>{n.add(t.getNormal(t.getTForPoint(n)).scale(a?e:-e))})}),a.forEach((e,t)=>{let n=i[t];e.forEach(e=>{let t=i[e],r=Jt(n[n.length-1],n[n.length-2]??n[n.length-1],t[0],t[1]??t[0]);r&&(n[n.length-1].copyFrom(r),t[0].copyFrom(r))})}),this.invalidate(),this}_invalidateSelf(){super._invalidateSelf(),this._ringsCache=void 0,this._ringsCacheLen=-1}_getRings(){return(!this._ringsCache||this._ringsCacheLen!==this.curves.length)&&(this._ringsCache=this.curves.map(e=>(e._owner=this,e.getAdaptiveVertices())),this._ringsCacheLen=this.curves.length),this._ringsCache}isPointInFill(e,t={}){let n=t.fillRule??this.style.fillRule??`nonzero`;return On(e,this._getRings(),n)}isPointInStroke(e,t={}){let n=t.strokeWidth??this.strokeWidth,{tolerance:r=0,closed:i}=t;return this.curves.some(t=>t.isPointInStroke(e,{strokeWidth:n,tolerance:r,closed:i}))}getMinMax(e=U.MAX,t=U.MIN,n=!0){if(this.curves.forEach(n=>{n.getMinMax(e,t)}),n){let n=this.strokeWidth;if(n>1&&Number.isFinite(e.x)){let r=n/2;e.set(e.x-r,e.y-r),t.set(t.x+r,t.y+r)}}return{min:e.finite(),max:t.finite()}}strokeTriangulate(e){let t=e?.indices??[],n=e?.vertices??[];return this.curves.forEach(r=>{r.strokeTriangulate({...e,indices:t,vertices:n,style:{...this.style}})}),{indices:t,vertices:n}}fillTriangulate(e){let t={...e,style:{...this.style,...e?.style}},n=t.indices??[],r=t.vertices??[];if((t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=Sn(i),o=a.length;for(let t=0;t<o;t++){let s=a[t],c=i[t];if(s.winding||!c.length)continue;let l=c.slice(),u=[];for(let e=0;e<o;e++){let n=a[e];n.parentIndex===t&&(u.push(l.length/2),l.push(...i[n.index]))}sn(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else this.curves.forEach(t=>{t.fillTriangulate({...e,indices:n,vertices:r,style:{...this.style}})});return{indices:n,vertices:r}}getBoundingBox(e=!0){let{min:t,max:n}=this.getMinMax(void 0,void 0,e);return new W(t.x,t.y,n.x-t.x,n.y-t.y)}drawTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:r=`none`}=t;return e.beginPath(),e.save(),Wt(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(),r!==`none`&&e.stroke(),e.restore(),this}drawControlPointsTo(e,t={}){t={...this.style,...t};let{fill:n=`#000`,stroke:r=`none`}=t;return e.beginPath(),e.save(),Wt(e,t),this.getControlPointRefs().forEach(t=>{Ht(e,t.x,t.y,{radius:4})}),n!==`none`&&e.fill(),r!==`none`&&e.stroke(),e.restore(),this}toCommands(){return this.curves.flatMap(e=>e.toCommands())}toData(){return this.curves.filter(e=>e.curves.length).map(e=>e.toData()).join(` `)}toSvgPathString(){let e={...this.style,fill:this.style.fill??`#000`,stroke:this.style.stroke??`none`},t={};for(let n in e)e[n]!==void 0&&(t[qt(n)]=e[n]);Object.assign(t,{"stroke-width":`${this.strokeWidth}px`});let n=``;for(let e in t)t[e]!==void 0&&(n+=`${e}:${t[e]};`);return`<path d="${this.toData()}" style="${n}"></path>`}copyFrom(e){return super.copyFrom(e),this.currentCurve=e.currentCurve.clone(),this.style={...e.style},this}},Hr=class{constructor(e=[],t){this.paths=e,this.viewBox=t}isPointInFill(e,t={}){return this.paths.some(n=>n.isPointInFill(e,t))}contains(e,t,n={}){return this.isPointInFill({x:e,y:t},n)}hitTest(e,t={}){let{stroke:n=!0,tolerance:r,fillRule:i}=t;for(let t=this.paths.length-1;t>=0;t--){let a=this.paths[t];if((a.style.fill??`#000`)!==`none`&&a.isPointInFill(e,{fillRule:i})||n&&(a.style.stroke??`none`)!==`none`&&a.isPointInStroke(e,{tolerance:r}))return a}}getBoundingBox(e=!0){if(!this.paths.length)return;let t=U.MAX,n=U.MIN;return this.paths.forEach(r=>r.getMinMax(t,n,e)),new W(t.x,t.y,n.x-t.x,n.y-t.y)}toTriangulatedSvgString(e=this.paths.map(e=>e.fillTriangulate()),t=0){let n=``,r=``,i={x:-t,y:-t},a={x:t,y:t};(Array.isArray(e)?e:[e]).forEach(({vertices:e,indices:o,points:s=[]})=>{let c=n=>{let r=e[n*2],o=e[n*2+1];return i.x=Math.min(i.x,r+t),a.x=Math.max(a.x,r+t),i.y=Math.min(i.y,o+t),a.y=Math.max(a.y,o+t),[r,o]};for(let e=0,t=o.length;e<t;e+=3){let t=c(o[e]),r=c(o[e+1]),i=c(o[e+2]);n+=`<polygon
4
4
  points="${t.join(`,`)} ${r.join(`,`)} ${i.join(`,`)}"
5
5
  stroke="#28a745"
6
6
  stroke-width="#stroke-width"
@@ -27,10 +27,10 @@ ${t}`);return n.documentElement}else return e}var Gn=`px`,Kn=90,qn=[`mm`,`cm`,`i
27
27
  xmlns="http://www.w3.org/2000/svg"
28
28
  >
29
29
  ${this.paths.map(e=>e.toSvgPathString()).join(``)}
30
- </svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),`image/svg+xml`).documentElement}toCanvas(e={}){let{pixelRatio:t=2,...n}=e,{left:r,top:i,width:a,height:o}=this.getBoundingBox(),s=document.createElement(`canvas`);s.width=a*t,s.height=o*t,s.style.width=`${a}px`,s.style.height=`${o}px`;let c=s.getContext(`2d`);return c&&(c.scale(t,t),c.translate(-r,-i),this.paths.forEach(e=>{e.drawTo(c,n)})),s}};function Pr(){let e=new Map;async function t(t){if(!e.has(t)){e.set(t,``);try{e.set(t,await fetch(t).then(e=>e.text()))}catch(n){console.warn(n),e.delete(t)}}}function n(e){return e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`blob://`)}return{loaded:e,needsLoad:n,load:t}}function Fr(e){let t=new Map;function n(n){let r=t.get(n);if(!r){let i=e.needsLoad(n)?e.loaded.get(n):n;if(i){let e=Wn(i);r={dom:e,pathSet:lr(e)},t.set(n,r)}else{let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.setAttribute(`viewBox`,`0 0 0 0`),r={dom:e,pathSet:new Nr}}}return r}return{parsed:t,parse:n}}function Ir(e,t){let{transform:n,transformOrigin:r}=t,{fontSize:i,lineBox:a}=e,{left:o,top:s,width:c,height:l}=a,{x:u,y:d}=Lr(r??`center`,o,s,c,l),f=new Mn;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Lr(e,t,n,r,i){let a={left:0,center:.5,right:1},o={top:0,center:.5,bottom:1},s=e.trim().split(/\s+/),c=s[0]??`center`,l=s[1]??`center`,u;u=c in a?t+a[c]*r:c.endsWith(`%`)?t+Number.parseFloat(c)/100*r:t+Number.parseFloat(c);let d;return d=l in o?n+o[l]*i:l.endsWith(`%`)?n+Number.parseFloat(l)/100*i:n+Number.parseFloat(l),{x:u,y:d}}function Rr(e,t){return typeof e==`number`?e:e.endsWith(`%`)?(e=e.substring(0,e.length-1),Math.ceil(Number(e)/100*t.total)):e.endsWith(`rem`)?(e=e.substring(0,e.length-3),Number(e)*t.fontSize):e.endsWith(`em`)?(e=e.substring(0,e.length-2),Number(e)*t.fontSize):Number(e)}function zr(e){return O(e)?{}:e}function Br(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Vr(e[n],t[n]))}function Vr(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Br(e,t):e===t:!1}var Hr=class{text;context;pixelRatio=window?.devicePixelRatio||1;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,{left:n,top:r,width:i,height:a}=this.text.boundingBox,o=t.canvas;o.dataset.viewBox=String(`${n} ${r} ${i} ${a}`),o.dataset.pixelRatio=String(e);let s=i,c=a;o.width=Math.max(1,Math.ceil(s*e)),o.height=Math.max(1,Math.ceil(c*e)),o.style.width=`${s}px`,o.style.height=`${c}px`,t.clearRect(0,0,o.width,o.height),t.scale(e,e),t.translate(-n,-r)};_setupColors=()=>{this.uploadColor(this.text.glyphBox,{style:this.text.computedStyle,fill:this.text.computedFill,outline:this.text.computedOutline}),this.text.paragraphs.forEach(e=>{this.uploadColor(e.lineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline}),e.fragments.forEach(e=>{this.uploadColor(e.inlineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline})})})};setup=()=>(this._setupView(),this._setupColors(),this);_parseColor=(e,t)=>{if(typeof e==`string`&&ve(e)&&(e=ye(e)[0]),typeof e==`object`&&`type`in e)switch(e.type){case`linear-gradient`:{let{left:n,top:r,width:i,height:a}=t,{angle:o=0,stops:s}=e,c=n+i/2,l=r+a/2,u=(o+90)*Math.PI/180,d=Math.sin(u),f=-Math.cos(u),p=Math.abs(i*Math.sin(u))+Math.abs(a*Math.cos(u)),m=c-p/2*d,h=l-p/2*f,g=c+p/2*d,_=l+p/2*f,v=this.context.createLinearGradient(m,h,g,_);for(let e of s)v.addColorStop(e.offset,e.color);return v}case`radial-gradient`:break}return e};_uploadedStyles=[`color`,`backgroundColor`,`textStrokeColor`];uploadColor=(e,t)=>{let{style:n,fill:r,outline:i}=t;n&&this._uploadedStyles.forEach(t=>{n[t]=this._parseColor(n[t],e)}),r?.enabled&&r.linearGradient&&(r._linearGradient=this._parseColor({type:`linear-gradient`,...r.linearGradient},e)),i?.enabled&&i.linearGradient&&(i._linearGradient=this._parseColor({type:`linear-gradient`,...i.linearGradient},e))};_mergePathStyle(e,t){let n=e.style,r=t.stroke??n.stroke,i=t.strokeWidth?t.strokeWidth:n.strokeWidth;return{...A(n),...A(t),stroke:i===void 0||i>0?r:void 0,strokeLinecap:t.strokeLinecap??n.strokeLinecap??`round`,strokeLinejoin:t.strokeLinejoin??n.strokeLinejoin??`round`,strokeWidth:i}}drawPath=(e,t={})=>{let{clipRect:n,...r}=t,i=this.context;i.save(),i.beginPath(),n&&(i.rect(n.left,n.top,n.width,n.height),i.clip(),i.beginPath()),e.drawTo(i,this._mergePathStyle(e,r)),i.restore()};effectToPathStyle(e){let t=this.text.computedStyle.fontSize,n={};return e.fill?.enabled&&(n={...n,fill:e.fill.color}),e.outline?.enabled&&(n={...n,stroke:e.outline.color,strokeWidth:(e.outline.width??0)*t}),e.shadow?.enabled&&(n={...n,shadowOffsetX:(e.shadow.offsetX??0)*t,shadowOffsetY:(e.shadow.offsetY??0)*t,shadowBlur:(e.shadow.blur??0)*t,shadowColor:e.shadow.color}),n}transformEffect(e){let{a:t,b:n,c:r,d:i,tx:a,ty:o}=Ir(this.text,e);this.context.transform(t,n,r,i,a,o)}_shadowCanvas;_shadowCtx;drawWithShadow=(e,t)=>{let n=this.context,r=n.canvas;this._shadowCanvas||(this._shadowCanvas=document.createElement(`canvas`),this._shadowCtx=this._shadowCanvas.getContext(`2d`));let i=this._shadowCanvas,a=this._shadowCtx;if(!a){t();return}i.width<r.width&&(i.width=r.width),i.height<r.height&&(i.height=r.height),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.width,r.height);let o=n.getTransform();a.setTransform(o.a,o.b,o.c,o.d,o.e,o.f);let s=this.context;this.context=a;try{t()}finally{this.context=s}let c=this.text.computedStyle.fontSize,l=this.pixelRatio;n.save(),n.setTransform(1,0,0,1,0,0),n.shadowOffsetX=(e.offsetX??0)*c*l,n.shadowOffsetY=(e.offsetY??0)*c*l,n.shadowBlur=(e.blur??0)*c*l,n.shadowColor=e.color,n.drawImage(i,0,0,r.width,r.height,0,0,r.width,r.height),n.restore()};drawCharacter=(e,t={})=>{let n=this.context,{computedStyle:r,path:i,glyphBox:a,isVertical:o,content:s,inlineBox:c,baseline:l,computedFill:u,computedOutline:d}=e,f=u?.enabled?u:void 0,p=d?.enabled?d:void 0,m=this.effectToPathStyle(t),h={strokeLinecap:p?.lineCap,strokeLinejoin:p?.lineJoin,...r,...m,fill:m.fill??f?._linearGradient??f?.color??r.color,strokeWidth:m.strokeWidth??p?.width??r.textStrokeWidth,stroke:m.stroke??p?._linearGradient??p?.color??r.textStrokeColor};a?this.drawPath(i,h):(n.save(),n.beginPath(),Wt(n,this._mergePathStyle(i,h)),n.font=`${r.fontSize}px ${r.fontFamily||this.text.defaultFamily}`,o?(n.textBaseline=`middle`,n.fillText(s,c.left,c.top+c.height/2)):(n.textBaseline=`alphabetic`,n.fillText(s,c.left,c.top+l)),n.restore())}},Ur={},Wr=(function(e,t,n,r,i){var a=new Worker(Ur[t]||(Ur[t]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}),Gr=Uint8Array,Kr=Uint16Array,qr=Int32Array,Jr=new Gr([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]),Yr=new Gr([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]),Xr=new Gr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zr=function(e,t){for(var n=new Kr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new qr(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},Qr=Zr(Jr,2),$r=Qr.b,ei=Qr.r;$r[28]=258,ei[258]=28;for(var ti=Zr(Yr,0),ni=ti.b,ri=ti.r,ii=new Kr(32768),q=0;q<32768;++q){var ai=(q&43690)>>1|(q&21845)<<1;ai=(ai&52428)>>2|(ai&13107)<<2,ai=(ai&61680)>>4|(ai&3855)<<4,ii[q]=((ai&65280)>>8|(ai&255)<<8)>>1}for(var oi=(function(e,t,n){for(var r=e.length,i=0,a=new Kr(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Kr(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Kr(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ii[d]>>c]=l}else for(s=new Kr(r),i=0;i<r;++i)e[i]&&(s[i]=ii[o[e[i]-1]++]>>15-e[i]);return s}),si=new Gr(288),q=0;q<144;++q)si[q]=8;for(var q=144;q<256;++q)si[q]=9;for(var q=256;q<280;++q)si[q]=7;for(var q=280;q<288;++q)si[q]=8;for(var ci=new Gr(32),q=0;q<32;++q)ci[q]=5;var li=oi(si,9,0),ui=oi(si,9,1),di=oi(ci,5,0),fi=oi(ci,5,1),pi=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},mi=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},hi=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},gi=function(e){return(e+7)/8|0},_i=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Gr(e.subarray(t,n))},vi=[`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`],yi=function(e,t,n){var r=Error(t||vi[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,yi),!n)throw r;return r},bi=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Gr(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Gr(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Gr(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=mi(e,d,1);var v=mi(e,d+1,3);if(d+=3,!v){var y=gi(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&yi(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=ui,m=fi,h=9,g=5;else if(v==2){var S=mi(e,d,31)+257,C=mi(e,d+10,15)+4,w=S+mi(e,d+5,31)+1;d+=14;for(var T=new Gr(w),E=new Gr(19),D=0;D<C;++D)E[Xr[D]]=mi(e,d+D*3,7);d+=C*3;for(var O=pi(E),k=(1<<O)-1,A=oi(E,O,1),D=0;D<w;){var j=A[mi(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+mi(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+mi(e,d,7),d+=3):y==18&&(N=11+mi(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=pi(P),g=pi(F),p=oi(P,h,1),m=oi(F,g,1)}else yi(1);if(d>_){c&&yi(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[hi(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&yi(0);break}if(M||yi(2),z<256)n[f++]=z;else if(z==256){R=d,p=null;break}else{var B=z-254;if(z>264){var D=z-257,V=Jr[D];B=mi(e,d,(1<<V)-1)+$r[D],d+=V}var ee=m[hi(e,d)&L],te=ee>>4;ee||yi(3),d+=ee&15;var F=ni[te];if(te>3){var V=Yr[te];F+=hi(e,d)&(1<<V)-1,d+=V}if(d>_){c&&yi(0);break}s&&l(f+131072);var ne=f+B;if(f<F){var re=a-F,ie=Math.min(F,ne);for(re+f<0&&yi(3);f<ie;++f)n[f]=r[re+f]}for(;f<ne;++f)n[f]=n[f-F]}}t.l=p,t.p=R,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?_i(n,0,f):n.subarray(0,f)},xi=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Si=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Ci=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Ai,l:0};if(i==1){var o=new Gr(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new Kr(f+1),m=wi(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new Gr(p),l:m}},wi=function(e,t,n){return e.s==-1?Math.max(wi(e.l,t,n+1),wi(e.r,t,n+1)):t[e.s]=n},Ti=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Kr(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Ei=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Di=function(e,t,n){var r=n.length,i=gi(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Oi=function(e,t,n,r,i,a,o,s,c,l,u){xi(t,u++,n),++i[256];for(var d=Ci(i,15),f=d.t,p=d.l,m=Ci(a,15),h=m.t,g=m.l,_=Ti(f),v=_.c,y=_.n,b=Ti(h),x=b.c,S=b.n,C=new Kr(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=Ci(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Xr[O-1]];--O);var k=l+5<<3,A=Ei(i,si)+Ei(a,ci)+o,j=Ei(i,f)+Ei(a,h)+o+14+3*O+Ei(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Di(t,u,e.subarray(c,c+l));var M,N,P,F;if(xi(t,u,1+(j<A)),u+=2,j<A){M=oi(f,p,0),N=f,P=oi(h,g,0),F=h;var I=oi(E,D,0);xi(t,u,y-257),xi(t,u+5,S-1),xi(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)xi(t,u+3*w,E[Xr[w]]);u+=3*O;for(var L=[v,x],R=0;R<2;++R)for(var z=L[R],w=0;w<z.length;++w){var B=z[w]&31;xi(t,u,I[B]),u+=E[B],B>15&&(xi(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=li,N=si,P=di,F=ci;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;Si(t,u,M[B+257]),u+=N[B+257],B>7&&(xi(t,u,V>>23&31),u+=Jr[B]);var ee=V&31;Si(t,u,P[ee]),u+=F[ee],ee>3&&(Si(t,u,V>>5&8191),u+=Yr[ee])}else Si(t,u,M[V]),u+=N[V]}return Si(t,u,M[256]),u+N[256]},ki=new qr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ai=new Gr(0),ji=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Gr(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=ki[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Kr(32768),g=a.h||new Kr(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new qr(25e3),x=new Kr(288),S=new Kr(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=Oi(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,I=p,L=A-j&32767;if(M>2&&k==y(T-L))for(var R=Math.min(f,M)-1,z=Math.min(32767,T),B=Math.min(258,M);L<=z&&--I&&A!=j;){if(e[T+P]==e[T+P-L]){for(var V=0;V<B&&e[T+V]==e[T+V-L];++V);if(V>P){if(P=V,F=L,V>R)break;for(var ee=Math.min(L,V-2),te=0,N=0;N<ee;++N){var ne=T-L+N&32767,re=ne-h[ne]&32767;re>te&&(te=re,j=ne)}}}A=j,j=h[A],L+=A-j&32767}if(F){b[E++]=268435456|ei[P]<<18|ri[F];var ie=ei[P]&31,ae=ri[F]&31;w+=Jr[ie]+Yr[ae],++x[257+ie],++S[ae],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=Oi(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var oe=T+65535;oe>=o&&(c[u/8|0]=l,oe=o),u=Di(c,u+1,e.subarray(T,oe))}a.i=o}return _i(s,0,r+gi(u)+i)},Mi=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},Ni=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Gr(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ji(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Pi=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Fi=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype)if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString();else t+=l}else n[c]=s}return t},Ii=[],Li=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},Ri=function(e,t,n,r){if(!Ii[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=Fi(e[s],i,a);Ii[n]={c:Fi(e[o],i,a),e:a}}var c=Pi({},Ii[n].e);return Wr(Ii[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,Li(c),r)},zi=function(){return[Gr,Kr,qr,Jr,Yr,Xr,$r,ni,ui,fi,ii,vi,oi,pi,mi,hi,gi,_i,yi,bi,Xi,Ui,Wi]},Bi=function(){return[Gr,Kr,qr,Jr,Yr,Xr,ei,ri,li,si,di,ci,ii,ki,Ai,oi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,gi,_i,ji,Ni,Yi,Ui]},Vi=function(){return[qi,Ki,Mi]},Hi=function(){return[Ji]},Ui=function(e){return postMessage(e,[e.buffer])},Wi=function(e){return e&&{out:e.size&&new Gr(e.size),dictionary:e.dictionary}},Gi=function(e,t,n,r,i,a){var o=Ri(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Ki=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},qi=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=Mi();i.p(t.dictionary),Ki(e,2,i.d())}},Ji=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&yi(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&yi(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Yi(e,t){return Ni(e,t||{},0,0)}function Xi(e,t){return bi(e,{i:2},t&&t.out,t&&t.dictionary)}function Zi(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&yi(7),Gi(e,t,[Bi,Vi,function(){return[Qi]}],function(e){return Ui(Qi(e.data[0],e.data[1]))},4,n)}function Qi(e,t){t||={};var n=Mi();n.p(e);var r=Ni(e,t,t.dictionary?6:2,4);return qi(r,t),Ki(r,r.length-4,n.d()),r}function $i(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&yi(7),Gi(e,t,[zi,Hi,function(){return[ea]}],function(e){return Ui(ea(e.data[0],Wi(e.data[1])))},5,n)}function ea(e,t){return bi(e.subarray(Ji(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var ta=typeof TextDecoder<`u`&&new TextDecoder;try{ta.decode(Ai,{stream:!0})}catch{}var na=`modern-font`;function ra(e,t){if(!e)throw Error(`[${na}] ${t}`)}function ia(e){if(`buffer`in e){let t=e.buffer;return e.byteOffset>0||e.byteLength<e.buffer.byteLength?t.slice(e.byteOffset,e.byteOffset+e.byteLength):t}else return e}function aa(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function oa(e){let t=``;for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),i!==0&&(t+=String.fromCharCode(i));return t}function sa(e){e=oa(e);let t=[];for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),t.push(i>>8),t.push(i&255);return t}function ca(e){return new TextDecoder().decode(Uint8Array.from(e))}function la(e){let t=``;for(let n=0,r=e.length;n<r;n+=2)t+=String.fromCharCode((e[n]<<8)+e[n+1]);return t}var ua={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},da=class extends DataView{constructor(e,t,n,r){super(ia(e),t,n),this.littleEndian=r}cursor=0;readInt8=e=>this.read(`int8`,e);readInt16=(e,t)=>this.read(`int16`,e,t);readInt32=(e,t)=>this.read(`int32`,e,t);readUint8=e=>this.read(`uint8`,e);readUint16=(e,t)=>this.read(`uint16`,e,t);readUint32=(e,t)=>this.read(`uint32`,e,t);readFloat32=(e,t)=>this.read(`float32`,e,t);readFloat64=(e,t)=>this.read(`float64`,e,t);writeInt8=(e,t)=>this.write(`int8`,e,t);writeInt16=(e,t,n)=>this.write(`int16`,e,t,n);writeInt32=(e,t,n)=>this.write(`int32`,e,t,n);writeUint8=(e,t)=>this.write(`uint8`,e,t);writeUint16=(e,t,n)=>this.write(`uint16`,e,t,n);writeUint32=(e,t,n)=>this.write(`uint32`,e,t,n);writeFloat32=(e,t,n)=>this.write(`float32`,e,t,n);writeFloat64=(e,t,n)=>this.write(`float64`,e,t,n);readColumn(e){if(e.size){let t=Array.from({length:e.size},(t,n)=>this.read(e.type,e.offset+n));switch(e.type){case`char`:return t.join(``);default:return t}}else return this.read(e.type,e.offset)}writeColumn(e,t){e.size?Array.from({length:e.size},(n,r)=>{this.write(e.type,t[r],e.offset+r)}):this.write(e.type,t,e.offset)}read(e,t=this.cursor,n=this.littleEndian){let r;switch(e){case`int8`:r=this.getInt8(t);break;case`int16`:r=this.getInt16(t,n);break;case`int32`:r=this.getInt32(t,n);break;case`uint8`:r=this.getUint8(t);break;case`uint16`:r=this.getUint16(t,n);break;case`uint32`:r=this.getUint32(t,n);break;case`float32`:r=this.getFloat32(t,n);break;case`float64`:r=this.getFloat64(t,n);break;case`fixed`:r=this.readFixed(t,n);break;case`longDateTime`:r=this.readLongDateTime(t,n);break;case`char`:r=this.readChar(t);break}return this.cursor+=ua[e],r}readUint24(e=this.cursor){let[t,n,r]=this.readBytes(e,3);return(t<<16)+(n<<8)+r}readBytes(e,t){t??(t=e,e=this.cursor);let n=[];for(let r=0;r<t;++r)n.push(this.getUint8(e+r));return this.cursor=e+t,n}readString(e,t){let n=this.readBytes(e,t),r=``;for(let e=0,t=n.length;e<t;e++)r+=String.fromCharCode(n[e]);return r}readFixed(e,t){let n=this.readInt32(e,t)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(e=this.cursor,t){let n=this.readUint32(e+4,t),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(e){return this.readString(e,1)}write(e,t,n=this.cursor,r=this.littleEndian){switch(e){case`int8`:this.setInt8(n,t);break;case`int16`:this.setInt16(n,t,r);break;case`int32`:this.setInt32(n,t,r);break;case`uint8`:this.setUint8(n,t);break;case`uint16`:this.setUint16(n,t,r);break;case`uint32`:this.setUint32(n,t,r);break;case`float32`:this.setFloat32(n,t,r);break;case`float64`:this.setFloat64(n,t,r);break;case`char`:this.writeChar(t,n);break;case`fixed`:this.writeFixed(t,n);break;case`longDateTime`:this.writeLongDateTime(t,n);break}return this.cursor+=ua[e],this}writeString(e=``,t=this.cursor){let n=e.replace(/[^\x00-\xFF]/g,`11`).length;this.seek(t);for(let t=0,n=e.length,r;t<n;++t)r=e.charCodeAt(t)||0,r>127?this.writeUint16(r):this.writeUint8(r);return this.cursor+=n,this}writeChar(e,t){return this.writeString(e,t)}writeFixed(e,t){return this.writeInt32(Math.round(e*65536),t),this}writeLongDateTime(e,t=this.cursor){let n=-20775456e5;e=e===void 0?n:typeof e.getTime==`function`?e.getTime():/^\d+$/.test(e)?+e:Date.parse(e);let r=Math.round((e-n)/1e3);return this.writeUint32(0,t),this.writeUint32(r,t+4),this}writeBytes(e,t=this.cursor){let n;if(Array.isArray(e)){n=e.length;for(let r=0;r<n;++r)this.setUint8(t+r,e[r])}else{let r=aa(e);n=r.byteLength;for(let e=0;e<n;++e)this.setUint8(t+e,r.getUint8(e))}return this.cursor=t+n,this}seek(e){return this.cursor=e,this}},fa=new WeakMap;function J(e){let t=typeof e==`object`?e:{type:e},{size:n=1,type:r}=t;return(e,i)=>{if(typeof i!=`string`)return;let a=fa.get(e);a||(a={columns:[],byteLength:0},fa.set(e,a));let o={...t,name:i,byteLength:n*ua[r],offset:t.offset??a.columns.reduce((e,t)=>e+t.byteLength,0)};a.columns.push(o),a.byteLength=a.columns.reduce((e,t)=>e+ua[t.type]*(t.size??1),0),Object.defineProperty(e.constructor.prototype,i,{get(){return this.view.readColumn(o)},set(e){this.view.writeColumn(o,e)},configurable:!0,enumerable:!0})}}var pa=class{view;constructor(e,t,n,r){this.view=new da(e,t,n,r)}},ma=class extends pa{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}},ha=Object.defineProperty,ga=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ha(t,n,i),i},_a=class e extends ma{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=sa(r.fontFamily||``),a=i.length,o=sa(r.fontSubFamily||``),s=o.length,c=sa(r.version||``),l=c.length,u=sa(r.fullName||``),d=u.length,f=86+a+4+s+4+l+4+d+2+t.view.byteLength,p=new e(new ArrayBuffer(f),0,f,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=t.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=n.head.checkSumAdjustment;let m=n.os2;return m&&(p.FontPANOSE=m.fontPANOSE,p.Italic=m.fsSelection,p.Weight=m.usWeightClass,p.fsType=m.fsType,p.UnicodeRange=m.ulUnicodeRange,p.CodePageRange=m.version>0?m.ulCodePageRange:[]),p.view.seek(82),p.view.writeUint16(a),p.view.writeBytes(i),p.view.writeUint16(0),p.view.writeUint16(s),p.view.writeBytes(o),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(d),p.view.writeBytes(u),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(t.view),p}};ga([J(`uint32`)],_a.prototype,`EOTSize`),ga([J(`uint32`)],_a.prototype,`FontDataSize`),ga([J(`uint32`)],_a.prototype,`Version`),ga([J(`uint32`)],_a.prototype,`Flags`),ga([J({type:`uint8`,size:10})],_a.prototype,`FontPANOSE`),ga([J(`uint8`)],_a.prototype,`Charset`),ga([J(`uint8`)],_a.prototype,`Italic`),ga([J(`uint32`)],_a.prototype,`Weight`),ga([J(`uint16`)],_a.prototype,`fsType`),ga([J(`uint16`)],_a.prototype,`MagicNumber`),ga([J({type:`uint32`,size:4})],_a.prototype,`UnicodeRange`),ga([J({type:`uint8`,size:8})],_a.prototype,`CodePageRange`),ga([J(`uint32`)],_a.prototype,`CheckSumAdjustment`),ga([J({type:`uint8`,size:16})],_a.prototype,`Reserved`),ga([J(`uint16`)],_a.prototype,`Padding1`);var va=Object.defineProperty,ya=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&va(t,n,i),i},ba=class extends pa{constructor(e,t){super(e,t,16)}};ya([J({type:`char`,size:4})],ba.prototype,`tag`),ya([J(`uint32`)],ba.prototype,`checkSum`),ya([J(`uint32`)],ba.prototype,`offset`),ya([J(`uint32`)],ba.prototype,`length`);var xa=`................................space.exclam.quotedbl.numbersign.dollar.percent.ampersand.quoteright.parenleft.parenright.asterisk.plus.comma.hyphen.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.at.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.bracketleft.backslash.bracketright.asciicircum.underscore.quoteleft.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.braceleft.bar.braceright.asciitilde...................................exclamdown.cent.sterling.fraction.yen.florin.section.currency.quotesingle.quotedblleft.guillemotleft.guilsinglleft.guilsinglright.fi.fl..endash.dagger.daggerdbl.periodcentered..paragraph.bullet.quotesinglbase.quotedblbase.quotedblright.guillemotright.ellipsis.perthousand..questiondown..grave.acute.circumflex.tilde.macron.breve.dotaccent.dieresis..ring.cedilla..hungarumlaut.ogonek.caron.emdash.................AE..ordfeminine.....Lslash.Oslash.OE.ordmasculine......ae....dotlessi...lslash.oslash.oe.germandbls`.split(`.`),Sa=`................................space.exclamsmall.Hungarumlautsmall..dollaroldstyle.dollarsuperior.ampersandsmall.Acutesmall.parenleftsuperior.parenrightsuperior.twodotenleader.onedotenleader.comma.hyphen.period.fraction.zerooldstyle.oneoldstyle.twooldstyle.threeoldstyle.fouroldstyle.fiveoldstyle.sixoldstyle.sevenoldstyle.eightoldstyle.nineoldstyle.colon.semicolon.commasuperior.threequartersemdash.periodsuperior.questionsmall..asuperior.bsuperior.centsuperior.dsuperior.esuperior...isuperior...lsuperior.msuperior.nsuperior.osuperior...rsuperior.ssuperior.tsuperior..ff.fi.fl.ffi.ffl.parenleftinferior..parenrightinferior.Circumflexsmall.hyphensuperior.Gravesmall.Asmall.Bsmall.Csmall.Dsmall.Esmall.Fsmall.Gsmall.Hsmall.Ismall.Jsmall.Ksmall.Lsmall.Msmall.Nsmall.Osmall.Psmall.Qsmall.Rsmall.Ssmall.Tsmall.Usmall.Vsmall.Wsmall.Xsmall.Ysmall.Zsmall.colonmonetary.onefitted.rupiah.Tildesmall...................................exclamdownsmall.centoldstyle.Lslashsmall...Scaronsmall.Zcaronsmall.Dieresissmall.Brevesmall.Caronsmall..Dotaccentsmall...Macronsmall...figuredash.hypheninferior...Ogoneksmall.Ringsmall.Cedillasmall....onequarter.onehalf.threequarters.questiondownsmall.oneeighth.threeeighths.fiveeighths.seveneighths.onethird.twothirds...zerosuperior.onesuperior.twosuperior.threesuperior.foursuperior.fivesuperior.sixsuperior.sevensuperior.eightsuperior.ninesuperior.zeroinferior.oneinferior.twoinferior.threeinferior.fourinferior.fiveinferior.sixinferior.seveninferior.eightinferior.nineinferior.centinferior.dollarinferior.periodinferior.commainferior.Agravesmall.Aacutesmall.Acircumflexsmall.Atildesmall.Adieresissmall.Aringsmall.AEsmall.Ccedillasmall.Egravesmall.Eacutesmall.Ecircumflexsmall.Edieresissmall.Igravesmall.Iacutesmall.Icircumflexsmall.Idieresissmall.Ethsmall.Ntildesmall.Ogravesmall.Oacutesmall.Ocircumflexsmall.Otildesmall.Odieresissmall.OEsmall.Oslashsmall.Ugravesmall.Uacutesmall.Ucircumflexsmall.Udieresissmall.Yacutesmall.Thornsmall.Ydieresissmall`.split(`.`),Ca=class{index;name;isComposite=!1;components=[];pathCommands=[];constructor(e){let t={...e};if(this.index=t.index??0,t.name===`.notdef`?t.unicode=void 0:t.name===`.null`&&(t.unicode=0),t.unicode===0&&t.name!==`.null`)throw Error(`The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.`);this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},i){let a=1/(i?.unitsPerEm??1e3)*n,{xScale:o=a,yScale:s=a}=r,c=this.pathCommands,l=[];for(let n=0,r=c.length;n<r;n+=1){let r=c[n];r.type===`M`?l.push({type:`M`,x:e+r.x*o,y:t+-r.y*s}):r.type===`L`?l.push({type:`L`,x:e+r.x*o,y:t+-r.y*s}):r.type===`Q`?l.push({type:`Q`,x1:e+r.x1*o,y1:t+-r.y1*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`C`?l.push({type:`C`,x1:e+r.x1*o,y1:t+-r.y1*s,x2:e+r.x2*o,y2:t+-r.y2*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`Z`&&l.push({type:`Z`})}return l}getPathData(e=0,t=0,n=72,r={},i,a=2){return wa(this.getPathCommands(e,t,n,r,i),a)}};function wa(e,t=2){let n=e=>String(Number(e.toFixed(t))),r=``;for(let t=0;t<e.length;t++){let i=e[t];switch(i.type){case`M`:r+=`M${n(i.x)} ${n(i.y)}`;break;case`L`:r+=`L${n(i.x)} ${n(i.y)}`;break;case`Q`:r+=`Q${n(i.x1)} ${n(i.y1)} ${n(i.x)} ${n(i.y)}`;break;case`C`:r+=`C${n(i.x1)} ${n(i.y1)} ${n(i.x2)} ${n(i.y2)} ${n(i.x)} ${n(i.y)}`;break;case`Z`:r+=`Z`;break}}return r}var Ta=class extends Ca{parse(e,t,n){let r=this,{nominalWidthX:i,defaultWidthX:a,gsubrsBias:o,subrsBias:s}=e,c=e.topDict.paintType,l=this.index,u,d,f,p,m=[],h=[],g=0,_=!1,v=!1,y=a,b=0,x=0;function S(e,t){m.push({type:`L`,x:e,y:t})}function C(e,t,n,r,i,a){m.push({type:`C`,x1:e,y1:t,x2:n,y2:r,x:i,y:a})}function w(e,t){v&&c!==2&&T(),v=!0,m.push({type:`M`,x:e,y:t})}function T(){m.push({type:`Z`})}function E(e){m.push(...e)}function D(){h.length%2!=0&&!_&&(y=h.shift()+i),g+=h.length>>1,h.length=0,_=!0}function O(t){let a,m,k,A,j,M,N,P,F,I,L,R,z=0;for(;z<t.length;){let B=t[z++];switch(B){case 1:D();break;case 3:D();break;case 4:h.length>1&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),w(b,x);break;case 5:for(;h.length>0;)b+=h.shift(),x+=h.shift(),S(b,x);break;case 6:for(;h.length>0&&(b+=h.shift(),S(b,x),h.length!==0);)x+=h.shift(),S(b,x);break;case 7:for(;h.length>0&&(x+=h.shift(),S(b,x),h.length!==0);)b+=h.shift(),S(b,x);break;case 8:for(;h.length>0;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 10:j=h.pop()+s,M=e.subrs[j],M&&O(M);break;case 11:return;case 12:switch(B=t[z],z+=1,B){case 35:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),x=R+h.shift(),h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 34:u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=x,b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 36:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 37:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),Math.abs(L-b)>Math.abs(R-x)?b=L+h.shift():x=R+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;default:console.warn(`Glyph ${l}: unknown operator ${1200+B}`),h.length=0}break;case 14:if(h.length>=4){let t=xa[h.pop()],i=xa[h.pop()],a=h.pop(),o=h.pop();if(t&&i){r.isComposite=!0,r.components=[];let s=e.charset.indexOf(t),c=e.charset.indexOf(i);r.components.push({glyphIndex:c,dx:0,dy:0}),r.components.push({glyphIndex:s,dx:o,dy:a}),E(n.get(c).pathCommands);let l=JSON.parse(JSON.stringify(n.get(s).pathCommands));for(let e=0;e<l.length;e+=1){let t=l[e];t.type!==`Z`&&(t.x+=o,t.y+=a),(t.type===`Q`||t.type===`C`)&&(t.x1+=o,t.y1+=a),t.type===`C`&&(t.x2+=o,t.y2+=a)}E(l)}}else h.length>0&&!_&&(y=h.shift()+i,_=!0);v&&c!==2&&(T(),v=!1);break;case 18:D();break;case 19:case 20:D(),z+=g+7>>3;break;case 21:h.length>2&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),b+=h.pop(),w(b,x);break;case 22:h.length>1&&!_&&(y=h.shift()+i,_=!0),b+=h.pop(),w(b,x);break;case 23:D();break;case 24:for(;h.length>2;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);b+=h.shift(),x+=h.shift(),S(b,x);break;case 25:for(;h.length>6;)b+=h.shift(),x+=h.shift(),S(b,x);u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 26:for(h.length%2&&(b+=h.shift());h.length>0;)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f,x=p+h.shift(),C(u,d,f,p,b,x);break;case 27:for(h.length%2&&(x+=h.shift());h.length>0;)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p,C(u,d,f,p,b,x);break;case 28:a=t[z],m=t[z+1],h.push((a<<24|m<<16)>>16),z+=2;break;case 29:j=h.pop()+o,M=e.gsubrs[j],M&&O(M);break;case 30:for(;h.length>0&&(u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;case 31:for(;h.length>0&&(u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;default:B<32?console.warn(`Glyph ${l}: unknown operator ${B}`):B<247?h.push(B-139):B<251?(a=t[z],z+=1,h.push((B-247)*256+a+108)):B<255?(a=t[z],z+=1,h.push(-(B-251)*256-a-108)):(a=t[z],m=t[z+1],k=t[z+2],A=t[z+3],z+=4,h.push((a<<24|m<<16|k<<8|A)/65536))}}}O(t),this.pathCommands=m,_&&(this.advanceWidth=y)}},Ea=class{constructor(e){this._sfnt=e}_items=[];get(e){let t=this._items[e],n;if(t)n=t;else{n=this._get(e);let t=this._sfnt.hmtx.metrics[e];t&&(n.advanceWidth=n.advanceWidth||t.advanceWidth,n.leftSideBearing=n.leftSideBearing||t.leftSideBearing);let r=this._sfnt.vmtx?.metrics[e];r&&(n.advanceHeight=n.advanceHeight||r.advanceHeight,n.topSideBearing=n.topSideBearing||r.topSideBearing);let i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);if(i&&(n.unicode??=i[0],n.unicodes??=i),n.name==null){let t=this._sfnt.post?.getGlyphName(e);t&&(n.name=t)}this._items[e]=n}return n}},Da=class extends Ea{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new Ta({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},Oa=Object.defineProperty,ka=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Oa(t,n,i),i},Aa=class extends pa{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let e=this.view,t=this.count,n=this.offsetSize;this.objectOffset=(t+1)*n+2,this.endOffset=e.byteOffset+this.objectOffset+this.offsets[t]}readOffsets(){let e=this.view,t=this.count,n=this.offsetSize;e.seek(3);let r=[];for(let e=0,i=t+1;e<i;e++){let e=this.view,t=0;for(let r=0;r<n;r++)t<<=8,t+=e.readUint8();r.push(t)}return r}readObjects(){let e=[];for(let t=0,n=this.count;t<n;t++)e.push(this.get(t));return e}get(e){let t=this.offsets,n=this.objectOffset,r=n+t[e],i=n+t[e+1]-r;return this._isString?this.view.readString(r,i):this.view.readBytes(r,i)}};ka([J(`uint16`)],Aa.prototype,`count`),ka([J(`uint8`)],Aa.prototype,`offsetSize`);var ja=class extends Aa{_isString=!1},Ma=class extends Aa{_isString=!0},Na=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,266 ff,onedotenleader,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall,001.000,001.001,001.002,001.003,Black,Bold,Book,Light,Medium,Regular,Roman,Semibold`.split(`,`),Pa=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron`.split(`,`),Fa=`.notdef,space,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,twodotenleader,onedotenleader,comma,hyphen,period,fraction,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,colon,semicolon,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,fi,fl,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,onequarter,onehalf,threequarters,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,onesuperior,twosuperior,threesuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall`.split(`,`),Ia=`.notdef,space,dollaroldstyle,dollarsuperior,parenleftsuperior,parenrightsuperior,twodotenleader,onedotenleader,comma,hyphen,period,fraction,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,colon,semicolon,commasuperior,threequartersemdash,periodsuperior,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,fi,fl,ffi,ffl,parenleftinferior,parenrightinferior,hyphensuperior,colonmonetary,onefitted,rupiah,centoldstyle,figuredash,hypheninferior,onequarter,onehalf,threequarters,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,onesuperior,twosuperior,threesuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior`.split(`,`);function La(e,t){return t<=390?Na[t]:e[t-391]}function Y(e,t=`number`,n){return(r,i)=>{if(typeof i!=`string`)return;let a={type:t,operator:e,default:n};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(a)},set(e){this._setProp(a,e)},configurable:!0,enumerable:!0})}}var Ra=class extends pa{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(e){return this._stringIndex=e,this}_readFloatOperand(){let e=this.view,t=``,n=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`.`,`E`,`E-`,null,`-`];for(;;){let r=e.readUint8(),i=r>>4,a=r&15;if(i===15||(t+=n[i],a===15))break;t+=n[a]}return Number.parseFloat(t)}_readOperand(e){let t=this.view,n,r,i,a;if(e===28)return n=t.readUint8(),r=t.readUint8(),n<<8|r;if(e===29)return n=t.readUint8(),r=t.readUint8(),i=t.readUint8(),a=t.readUint8(),n<<24|r<<16|i<<8|a;if(e===30)return this._readFloatOperand();if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return n=t.readUint8(),(e-247)*256+n+108;if(e>=251&&e<=254)return n=t.readUint8(),-(e-251)*256-n-108;throw Error(`invalid b0 ${e}, at: ${t.cursor}`)}_readDict(){let e=this.view;e.seek(0);let t=[],n=e.cursor+e.byteLength,r={};for(;e.cursor<n;){let n=e.readUint8();n<=21?(n===12&&(n=1200+e.readUint8()),r[n]=t,t=[]):t.push(this._readOperand(n))}return r}_getProp(e){let t=this.dict[e.operator];switch(e.type){case`number`:return t?t[0]:e.default??0;case`string`:return t?La(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},za=Object.defineProperty,Ba=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&za(t,n,i),i},Va=class extends Ra{};Ba([Y(19)],Va.prototype,`subrs`),Ba([Y(20)],Va.prototype,`defaultWidthX`),Ba([Y(21)],Va.prototype,`nominalWidthX`);var Ha=Object.defineProperty,X=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ha(t,n,i),i},Z=class extends Ra{};X([Y(0,`string`)],Z.prototype,`version`),X([Y(1,`string`)],Z.prototype,`notice`),X([Y(1200,`string`)],Z.prototype,`copyright`),X([Y(2,`string`)],Z.prototype,`fullName`),X([Y(3,`string`)],Z.prototype,`familyName`),X([Y(4,`string`)],Z.prototype,`weight`),X([Y(1201)],Z.prototype,`isFixedPitch`),X([Y(1202)],Z.prototype,`italicAngle`),X([Y(1203,`number`,-100)],Z.prototype,`underlinePosition`),X([Y(1204,`number`,50)],Z.prototype,`underlineThickness`),X([Y(1205)],Z.prototype,`paintType`),X([Y(1206,`number`,2)],Z.prototype,`charstringType`),X([Y(1207,`number[]`,[.001,0,0,.001,0,0])],Z.prototype,`fontMatrix`),X([Y(13)],Z.prototype,`uniqueId`),X([Y(5,`number[]`,[0,0,0,0])],Z.prototype,`fontBBox`),X([Y(1208)],Z.prototype,`strokeWidth`),X([Y(14)],Z.prototype,`xuid`),X([Y(15)],Z.prototype,`charset`),X([Y(16)],Z.prototype,`encoding`),X([Y(17)],Z.prototype,`charStrings`),X([Y(18,`number[]`,[0,0])],Z.prototype,`private`);function Ua(e,t=e){return n=>{Wa.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(Wa.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var Wa=class e{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;_viewLoaders=new Map;get tableTags(){return[...new Set([...this.tableViews.keys(),...this._viewLoaders.keys()])]}hasTable(e){return this.tableViews.has(e)||this._viewLoaders.has(e)}getTableView(e){let t=this.tableViews.get(e);if(!t){let n=this._viewLoaders.get(e);n&&(t=n(),this.tableViews.set(e,t),this._viewLoaders.delete(e))}return t}get hasGlyf(){return this.hasTable(`glyf`)}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}get defaultAdvanceHeight(){return this.ascender+Math.abs(this.descender)}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){let{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}getSubstituteGlyphIndex(e,t){return this.gsub?.getSingleSubstitutions(t).get(e)??e}applyLigatures(e,t=`liga`){let n=this.gsub?.getLigatures(t);if(!n||!n.size)return e.slice();let r=[];for(let t=0;t<e.length;){let i=n.get(e[t]),a=!1;if(i)for(let n of i){let i=n.components.length,o=!0;for(let r=0;r<i;r++)if(e[t+1+r]!==n.components[r]){o=!1;break}if(o){r.push(n.ligatureGlyph),t+=i+1,a=!0;break}}a||(r.push(e[t]),t++)}return r}textToGlyphIndexes(e){let t=[];for(let n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){let t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,i=Array.from({length:r}),a=t.get(0);for(let e=0;e<r;e+=1)i[e]=t.get(n[e])||a;return i}getPathCommands(e,t,n,r,i){let a=[];return this.forEachGlyph(e,t,n,r,i,(e,t,n,r,i)=>{a.push(...e.getPathCommands(t,n,r,i,this))}),a}getPathData(e,t,n,r,i,a=2){return wa(this.getPathCommands(e,t,n,r,i),a)}getKerningValue(e,t){return(this.gpos?.getKerningValue(e,t)??0)||(this.kern?.getKerningValue(e,t)??0)}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}getAdvanceHeight(e,t=72,n={}){let r=1/this.unitsPerEm*t,i=this.defaultAdvanceHeight,a=this.textToGlyphs(e),o=0;for(let e=0;e<a.length;e+=1)o+=(a[e].advanceHeight||i)*r,n.letterSpacing?o+=n.letterSpacing*t:n.tracking&&(o+=n.tracking/1e3*t);return o}forEachGlyph(e,t=0,n=0,r=72,i={},a){let o=1/this.unitsPerEm*r,s=this.textToGlyphs(e);for(let e=0;e<s.length;e+=1){let c=s[e];a.call(this,c,t,n,r,i),c.advanceWidth&&(t+=c.advanceWidth*o),i.letterSpacing?t+=i.letterSpacing*r:i.tracking&&(t+=i.tracking/1e3*r)}return t}constructor(e,t){e&&(e instanceof Map?e:new Map(Object.entries(e))).forEach((e,t)=>this.tableViews.set(t,e)),t?.forEach((e,t)=>this._viewLoaders.set(t,e))}clone(){let t=new Map;return this.tableTags.forEach(e=>{let n=this.getTableView(e);t.set(e,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))}),new e(t)}delete(t){let n=e.tableDefinitions.get(t);return n?(this.tableViews.delete(t),this._viewLoaders.delete(t),this.tables.delete(n.prop),this):this}set(t,n){let r=e.tableDefinitions.get(t);return r&&this.tables.set(r.prop,n),this.tableViews.set(t,n.view),this._viewLoaders.delete(t),this}get(t){let n=e.tableDefinitions.get(t);if(!n)return;let r=this.tables.get(n.prop);if(!r){let e=n.class;if(e){let i=this.getTableView(t);if(!i)return;r=new e(i.buffer,i.byteOffset,i.byteLength).setSFNT(this),this.tables.set(n.prop,r)}}return r}},Ga=class extends pa{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},Ka=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,Ja=(e,t,n,r)=>{for(var i=r>1?void 0:r?qa(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ka(t,n,i),i},Ya=class extends Ga{_glyphs;get glyphs(){return this._glyphs??=new Da(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let{buffer:e,byteOffset:t}=this.view,n=t+4;this.nameIndex=new Ma(e,n),this.topDictIndex=new ja(e,this.nameIndex.endOffset),this.stringIndex=new Ma(e,this.topDictIndex.endOffset),this.globalSubrIndex=new ja(e,this.stringIndex.endOffset),this.topDict=new Z(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);let r=this.topDict.private[0],i=this.topDict.private[1];r&&(this.privateDict=new Va(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new ja(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new ja(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Pa:this.topDict.charset===1?this.charset=Fa:this.topDict.charset===2?this.charset=Ia:this.charset=this._readCharset(t+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=xa:this.topDict.encoding===1?this.encoding=Sa:this.encoding=this._readEncoding(t+this.topDict.encoding)}_readCharset(e,t,n){let r=this.view;r.seek(e);let i,a,o;--t;let s=[`.notdef`],c=r.readUint8();if(c===0)for(i=0;i<t;i+=1)a=r.readUint16(),s.push(La(n,a));else if(c===1)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint8(),i=0;i<=o;i+=1)s.push(La(n,a)),a+=1;else if(c===2)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint16(),i=0;i<=o;i+=1)s.push(La(n,a)),a+=1;else throw Error(`Unknown charset format ${c}`);return s}_readEncoding(e){let t=this.view;t.seek(e);let n,r,i={},a=t.readUint8();if(a===0){let e=t.readUint8();for(n=0;n<e;n+=1)r=t.readUint8(),i[r]=n}else if(a===1){let e=t.readUint8();for(r=1,n=0;n<e;n+=1){let e=t.readUint8(),n=t.readUint8();for(let t=e;t<=e+n;t+=1)i[t]=r,r+=1}}else console.warn(`unknown encoding format:${a}`);return i}blankGlyphsExcept(e){let t=this.charStringsIndex.offsets,n=t.length-1,r=this.topDict.charStrings+this.charStringsIndex.objectOffset;for(let i=0;i<n;i++){if(e.has(i))continue;let n=r+t[i+1];for(let e=r+t[i];e<n;e++)this.view.setUint8(e,14)}return this}_calcSubroutineBias(e){let t;return t=e.length<1240?107:e.length<33900?1131:32768,t}};Ja([J(`uint8`)],Ya.prototype,`majorVersion`,2),Ja([J(`uint8`)],Ya.prototype,`minorVersion`,2),Ja([J(`uint8`)],Ya.prototype,`headerSize`,2),Ja([J(`uint8`)],Ya.prototype,`offsetSize`,2),Ya=Ja([Ua(`CFF `,`cff`)],Ya);var Xa=Object.defineProperty,Za=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Xa(t,n,i),i},Qa=class e extends pa{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(t){let n=new e;return n.format=0,n.length=n.view.byteLength,n.language=0,t.forEach((e,t)=>{t<256&&e<256&&n.view.writeUint8(e,6+t)}),n}getUnicodeToGlyphIndexMap(){let e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};Za([J(`uint16`)],Qa.prototype,`format`),Za([J(`uint16`)],Qa.prototype,`length`),Za([J(`uint16`)],Qa.prototype,`language`),Za([J({type:`uint8`,size:256})],Qa.prototype,`glyphIndexArray`);var $a=Qa,eo=Object.defineProperty,to=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&eo(t,n,i),i},no=class extends pa{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){let e=this.maxSubHeaderKey;return this.view.seek(518),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){let e=518+this.maxSubHeaderKey*8;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){let t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,i=this.subHeaders,a=this.glyphIndexArray,o=n.findIndex(e=>e===r),s=0;for(let r=0;r<256;r++)if(n[r]===0)r>=o||r<i[0].firstCode||r>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(r-i[0].firstCode)>=a.length?s=0:(s=a[i[0].idRangeOffset+(r-i[0].firstCode)],s!==0&&(s+=i[0].idDelta)),s!==0&&s<e&&t.set(r,s);else{let o=n[r];for(let n=0,c=i[o].entryCount;n<c;n++)if(i[o].idRangeOffset+n>=a.length?s=0:(s=a[i[o].idRangeOffset+n],s!==0&&(s+=i[o].idDelta)),s!==0&&s<e){let e=(r<<8|n+i[o].firstCode)&65535;t.set(e,s)}}return t}};to([J(`uint16`)],no.prototype,`format`),to([J(`uint16`)],no.prototype,`length`),to([J(`uint16`)],no.prototype,`language`);function ro(e){return e>32767?e-65536:e<-32767?e+65536:e}function io(e,t){let n,r=[],i={};return e.forEach((e,a)=>{t&&a>t||((!n||a!==n.unicode+1||e!==n.glyphIndex+1)&&(n?(i.end=n.unicode,r.push(i),i={start:a,startId:e,delta:ro(e-a)}):(i.start=Number(a),i.startId=e,i.delta=ro(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var ao=Object.defineProperty,oo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ao(t,n,i),i},so=class e extends pa{get endCode(){let e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){let e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(e=>this.view.writeUint16(e))}get idDelta(){let e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){let t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(e=>this.view.writeUint16(e))}get idRangeOffsetCursor(){let e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){let e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){let e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){let e=this.glyphIndexArrayCursor;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(t){let n=io(t,65535),r=n.length+1,i=Math.floor(Math.log(r)/Math.LN2),a=2*2**i,o=new e(new ArrayBuffer(24+n.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=a,o.entrySelector=i,o.rangeShift=2*r-a,o.endCode=[...n.map(e=>e.end),65535],o.reservedPad=0,o.startCode=[...n.map(e=>e.start),65535],o.idDelta=[...n.map(e=>e.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,i=this.endCode,a=this.idRangeOffset,o=this.idDelta,s=this.glyphIndexArray;for(let c=0;c<t;++c)for(let t=r[c],l=i[c];t<=l;++t)if(a[c]===0)e.set(t,(t+o[c])%65536);else{let i=s[c+a[c]/2+(t-r[c])-n];i===0?e.set(t,0):e.set(t,(i+o[c])%65536)}return e.delete(65535),e}};oo([J(`uint16`)],so.prototype,`format`),oo([J(`uint16`)],so.prototype,`length`),oo([J(`uint16`)],so.prototype,`language`),oo([J(`uint16`)],so.prototype,`segCountX2`),oo([J(`uint16`)],so.prototype,`searchRange`),oo([J(`uint16`)],so.prototype,`entrySelector`),oo([J(`uint16`)],so.prototype,`rangeShift`);var co=so,lo=Object.defineProperty,uo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&lo(t,n,i),i},fo=class extends pa{get glyphIndexArray(){let e=this.entryCount;return Array.from({length:e},(e,t)=>this.view.readUint16(10+t*2))}getUnicodeToGlyphIndexMap(){let e=this.glyphIndexArray,t=this.firstCode,n=new Map;return e.forEach((e,r)=>{n.set(t+r,e)}),n}};uo([J(`uint16`)],fo.prototype,`format`),uo([J(`uint16`)],fo.prototype,`length`),uo([J(`uint16`)],fo.prototype,`language`),uo([J(`uint16`)],fo.prototype,`firstCode`),uo([J(`uint16`)],fo.prototype,`entryCount`);var po=Object.defineProperty,mo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&po(t,n,i),i},ho=class e extends pa{get groups(){let e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){let n=io(t),r=new e(new ArrayBuffer(16+n.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=n.length,n.forEach(e=>{r.view.writeUint32(e.start),r.view.writeUint32(e.end),r.view.writeUint32(e.startId)}),r}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){let r=t[n],i=r.startGlyphCode,a=r.startCharCode,o=r.endCharCode;for(;a<=o;)e.set(a++,i++)}return e}};mo([J(`uint16`)],ho.prototype,`format`),mo([J(`uint16`)],ho.prototype,`reserved`),mo([J(`uint32`)],ho.prototype,`length`),mo([J(`uint32`)],ho.prototype,`language`),mo([J(`uint32`)],ho.prototype,`nGroups`);var go=ho,_o=Object.defineProperty,vo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&_o(t,n,i),i},yo=class extends pa{getVarSelectorRecords(){let e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{let e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);let t=this.view.readUint32();e.unicodeValueRanges=Array.from({length:t},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);let t=this.view.readUint32();e.uVSMappings=Array.from({length:t},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){let{uVSMappings:r}=t[n];r.forEach(t=>{e.set(t.unicodeValue,t.glyphID)})}return e}};vo([J(`uint16`)],yo.prototype,`format`),vo([J(`uint32`)],yo.prototype,`length`),vo([J(`uint32`)],yo.prototype,`numVarSelectorRecords`);var bo=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,So=(e,t,n,r)=>{for(var i=r>1?void 0:r?xo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&bo(t,n,i),i},Co=class extends Ga{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=co.from(e),r=$a.from(e),i=t?go.from(e):void 0,a=4+(i?32:24),o=a+n.view.byteLength,s=o+r.view.byteLength,c=[{platformID:0,platformSpecificID:3,offset:a},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:a},i&&{platformID:3,platformSpecificID:10,offset:s}].filter(Boolean),l=new Co(new ArrayBuffer(4+8*c.length+n.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return l.numberSubtables=c.length,l.view.seek(4),c.forEach(e=>{l.view.writeUint16(e.platformID),l.view.writeUint16(e.platformSpecificID),l.view.writeUint32(e.offset)}),l.view.writeBytes(n.view,a),l.view.writeBytes(r.view,o),i&&l.view.writeBytes(i.view,s),l}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){let e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,i=n.length;r<i;r++){let i=n[r],a=t.get(i);e.has(a)?e.get(a).push(i):e.set(a,[i])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){let e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);let t=this.view.readUint16(),n;switch(t){case 0:n=new $a(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new no(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new co(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new fo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new go(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new yo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32());break}return{...e,format:t,view:n}})}readunicodeToGlyphIndexMap(){let e=this.readSubtables(),t=e.find(e=>e.format===0)?.view,n=e.find(e=>e.platformID===3&&e.platformSpecificID===3&&e.format===2)?.view,r=e.find(e=>e.platformID===3&&e.platformSpecificID===1&&e.format===4)?.view,i=e.find(e=>e.platformID===3&&e.platformSpecificID===10&&e.format===12)?.view,a=e.find(e=>e.platformID===0&&e.platformSpecificID===5&&e.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...n?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...a?.getUnicodeToGlyphIndexMap()??[]])}};So([J(`uint16`)],Co.prototype,`version`,2),So([J(`uint16`)],Co.prototype,`numberSubtables`,2),Co=So([Ua(`cmap`)],Co);var wo=class extends Ca{_parseContours(e){let t=[],n=[];for(let r=0;r<e.length;r+=1){let i=e[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return ra(n.length===0,`There are still points left in the current contour.`),t}_transformPoints(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=e[r],a={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(a)}return n}_parseGlyphCoordinate(e,t,n,r,i){let a;return(t&r)>0?(a=e.view.readUint8(),(t&i)===0&&(a=-a),a=n+a):a=(t&i)>0?n:n+e.view.readInt16(),a}parse(e,t,n){e.view.seek(t);let r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){let t=this.endPointIndices=[];for(let n=0;n<r;n++)t.push(e.view.readUint16());let n=this.instructionLength=e.view.readUint16();ra(n<5e3,`Bad instructionLength:${n}`);let i=this.instructions=[];for(let t=0;t<n;++t)i.push(e.view.readUint8());let a=e.view.byteOffset,o=t[t.length-1]+1;ra(o<2e4,`Bad numberOfCoordinates:${a}`);let s=[],c,l=0;for(;l<o;)if(c=e.view.readUint8(),s.push(c),l++,c&8&&l<o){let t=e.view.readUint8();for(let e=0;e<t;e++)s.push(c),l++}if(ra(s.length===o,`Bad flags length: ${s.length}, numberOfCoordinates: ${o}`),t.length>0){let n=[],r;if(o>0){for(let e=0;e<o;e+=1)c=s[e],r={},r.onCurve=!!(c&1),r.lastPointOfContour=t.includes(e),n.push(r);let i=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.x=this._parseGlyphCoordinate(e,c,i,2,16),i=r.x;let a=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.y=this._parseGlyphCoordinate(e,c,a,4,32),a=r.y}this.points=n}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let t,n=!0;for(;n;){t=e.view.readUint16();let r={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(t&1)>0?(t&2)>0?(r.dx=e.view.readInt16(),r.dy=e.view.readInt16()):r.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(t&2)>0?(r.dx=e.view.readInt8(),r.dy=e.view.readInt8()):r.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(t&8)>0?r.xScale=r.yScale=e.view.readInt16()/16384:(t&64)>0?(r.xScale=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384):(t&128)>0&&(r.xScale=e.view.readInt16()/16384,r.scale01=e.view.readInt16()/16384,r.scale10=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384),this.components.push(r),n=!!(t&32)}if(t&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let t=0;t<this.instructionLength;t+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let e=0;e<this.components.length;e+=1){let t=this.components[e],r=n.get(t.glyphIndex);if(r.getPathCommands(),r.points){let e;if(t.matchedPoints===void 0)e=this._transformPoints(r.points,t);else{ra(t.matchedPoints[0]>this.points.length-1||t.matchedPoints[1]>r.points.length-1,`Matched points out of range in ${this.name}`);let n=this.points[t.matchedPoints[0]],i=r.points[t.matchedPoints[1]],a={xScale:t.xScale,scale01:t.scale01,scale10:t.scale10,yScale:t.yScale,dx:0,dy:0};i=this._transformPoints([i],a)[0],a.dx=n.x-i.x,a.dy=n.y-i.y,e=this._transformPoints(r.points,a)}this.points=this.points.concat(e)}}let i=[],a=this._parseContours(this.points);for(let e=0,t=a.length;e<t;++e){let t=a[e],n=t[t.length-1],r=t[0];n.onCurve?i.push({type:`M`,x:n.x,y:n.y}):r.onCurve?i.push({type:`M`,x:r.x,y:r.y}):i.push({type:`M`,x:(n.x+r.x)*.5,y:(n.y+r.y)*.5});for(let e=0,a=t.length;e<a;++e)if(n=r,r=t[(e+1)%a],n.onCurve)i.push({type:`L`,x:n.x,y:n.y});else{let e=r;r.onCurve||(e={x:(n.x+r.x)*.5,y:(n.y+r.y)*.5}),i.push({type:`Q`,x1:n.x,y1:n.y,x:e.x,y:e.y})}i.push({type:`Z`})}this.pathCommands=i}},To=class extends Ea{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new wo({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Eo=Object.getOwnPropertyDescriptor,Do=(e,t,n,r)=>{for(var i=r>1?void 0:r?Eo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Oo=class extends Ga{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Oo(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new To(this._sfnt)}};Oo=Do([Ua(`glyf`)],Oo);function ko(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function Ao(e,t,n){if(!t)return[];let r=e.getUint16(t,!1),i=new Set;for(let a=0;a<r;a++){let r=t+2+a*6;if(ko(e,r)!==n)continue;let o=t+e.getUint16(r+4,!1),s=e.getUint16(o+2,!1);for(let t=0;t<s;t++)i.add(e.getUint16(o+4+t*2,!1))}return[...i]}function jo(e,t,n){if(!t||n>=e.getUint16(t,!1))return;let r=t+e.getUint16(t+2+n*2,!1),i=e.getUint16(r+4,!1),a=[];for(let t=0;t<i;t++)a.push(r+e.getUint16(r+6+t*2,!1));return{lookupType:e.getUint16(r,!1),lookupFlag:e.getUint16(r+2,!1),subtableOffsets:a}}function Mo(e,t){let n=e.getUint16(t,!1),r=[];if(n===1){let n=e.getUint16(t+2,!1);for(let i=0;i<n;i++)r.push(e.getUint16(t+4+i*2,!1))}else if(n===2){let n=e.getUint16(t+2,!1);for(let i=0;i<n;i++){let n=t+4+i*6,a=e.getUint16(n,!1),o=e.getUint16(n+2,!1),s=e.getUint16(n+4,!1);for(let e=a;e<=o;e++)r[s++]=e}}return r}function No(e,t){let n=new Map,r=e.getUint16(t,!1);if(r===1){let r=e.getUint16(t+2,!1),i=e.getUint16(t+4,!1);for(let a=0;a<i;a++)n.set(r+a,e.getUint16(t+6+a*2,!1))}else if(r===2){let r=e.getUint16(t+2,!1);for(let i=0;i<r;i++){let r=t+4+i*6,a=e.getUint16(r,!1),o=e.getUint16(r+2,!1),s=e.getUint16(r+4,!1);for(let e=a;e<=o;e++)n.set(e,s)}}return n}function Po(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function Fo(e,t,n){if(!(n&4))return 0;let r=t;return n&1&&(r+=2),n&2&&(r+=2),e.getInt16(r,!1)}var Io=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Ro=(e,t,n,r)=>{for(var i=r>1?void 0:r?Lo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Io(t,n,i),i},zo=class extends Ga{_format1Pairs;_classSubtables;getKerningValue(e,t){this._ensureKerning();let n=this._format1Pairs.get(e*65536+t);if(n!==void 0)return n;for(let n of this._classSubtables){if(!n.coverage.has(e))continue;let r=n.classDef1.get(e)??0,i=n.classDef2.get(t)??0,a=n.class1RecordsOffset+(r*n.class2Count+i)*n.recordSize,o=Fo(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],Ao(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=jo(this.view,this.lookupListOffset,e);t?.subtableOffsets.forEach(e=>this._collectPairPos(e,t.lookupType))}))}_collectPairPos(e,t){let n=this.view;if(t===9){let t=n.readUint16(e+2),r=n.readUint32(e+4);this._collectPairPos(e+r,t);return}if(t!==2)return;let r=n.readUint16(e),i=Mo(n,e+n.readUint16(e+2)),a=n.readUint16(e+4),o=n.readUint16(e+6);if(r===1){let t=n.readUint16(e+8),r=2+Po(a)+Po(o);for(let o=0;o<t&&o<i.length;o++){let t=i[o],s=e+n.readUint16(e+10+o*2),c=n.readUint16(s),l=s+2;for(let e=0;e<c;e++){let e=n.readUint16(l),i=Fo(n,l+2,a);i&&this._format1Pairs.set(t*65536+e,i),l+=r}}}else r===2&&this._classSubtables.push({coverage:new Set(i),classDef1:No(n,e+n.readUint16(e+8)),classDef2:No(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Po(a)+Po(o),valueFormat1:a})}};Ro([J(`uint16`)],zo.prototype,`majorVersion`,2),Ro([J(`uint16`)],zo.prototype,`minorVersion`,2),Ro([J(`uint16`)],zo.prototype,`scriptListOffset`,2),Ro([J(`uint16`)],zo.prototype,`featureListOffset`,2),Ro([J(`uint16`)],zo.prototype,`lookupListOffset`,2),zo=Ro([Ua(`GPOS`,`gpos`)],zo);var Bo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Ho=(e,t,n,r)=>{for(var i=r>1?void 0:r?Vo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Bo(t,n,i),i},Uo=class extends Ga{_singleSubstitutions;_ligatures;getSingleSubstitutions(e){let t=this._singleSubstitutions??=new Map,n=t.get(e);return n||(n=new Map,this._featureLookupIndices(e).forEach(e=>{let t=this.readLookup(e);t?.subtableOffsets.forEach(e=>{this._collectSingleSubstitutions(e,t.lookupType,n)})}),t.set(e,n)),n}getLigatures(e){let t=this._ligatures??=new Map,n=t.get(e);return n||(n=new Map,this._featureLookupIndices(e).forEach(e=>{let t=this.readLookup(e);t?.subtableOffsets.forEach(e=>{this._collectLigatures(e,t.lookupType,n)})}),t.set(e,n)),n}_collectLigatures(e,t,n){let r=this.view;if(t===7){let t=r.readUint16(e+2),i=r.readUint32(e+4);this._collectLigatures(e+i,t,n);return}if(t!==4)return;let i=this._readCoverage(e+r.readUint16(e+2)),a=r.readUint16(e+4);for(let t=0;t<a&&t<i.length;t++){let a=i[t],o=e+r.readUint16(e+6+t*2),s=r.readUint16(o),c=n.get(a)??[];for(let e=0;e<s;e++){let t=o+r.readUint16(o+2+e*2),n=r.readUint16(t),i=r.readUint16(t+2),a=[];for(let e=0;e<i-1;e++)a.push(r.readUint16(t+4+e*2));c.push({components:a,ligatureGlyph:n})}n.has(a)||n.set(a,c)}}readLookup(e){let t=this.lookupListOffset;if(!t)return;let n=this.view;if(e>=n.readUint16(t))return;let r=t+n.readUint16(t+2+e*2),i=n.readUint16(r+4),a=[];for(let e=0;e<i;e++)a.push(r+n.readUint16(r+6+e*2));return{lookupType:n.readUint16(r),lookupFlag:n.readUint16(r+2),subtableOffsets:a}}_featureLookupIndices(e){let t=this.featureListOffset;if(!t)return[];let n=this.view,r=n.readUint16(t),i=new Set;for(let a=0;a<r;a++){let r=t+2+a*6;if(n.readString(r,4)!==e)continue;let o=t+n.readUint16(r+4),s=n.readUint16(o+2);for(let e=0;e<s;e++)i.add(n.readUint16(o+4+e*2))}return Array.from(i)}_collectSingleSubstitutions(e,t,n){let r=this.view;if(t===7){let t=r.readUint16(e+2),i=r.readUint32(e+4);this._collectSingleSubstitutions(e+i,t,n);return}if(t!==1)return;let i=r.readUint16(e),a=this._readCoverage(e+r.readUint16(e+2));if(i===1){let t=r.readInt16(e+4);a.forEach(e=>{n.set(e,e+t&65535)})}else if(i===2){let t=r.readUint16(e+4);for(let i=0;i<t&&i<a.length;i++)n.set(a[i],r.readUint16(e+6+i*2))}}_readCoverage(e){let t=this.view,n=t.readUint16(e),r=[];if(n===1){let n=t.readUint16(e+2);for(let i=0;i<n;i++)r.push(t.readUint16(e+4+i*2))}else if(n===2){let n=t.readUint16(e+2);for(let i=0;i<n;i++){let n=e+4+i*6,a=t.readUint16(n),o=t.readUint16(n+2),s=t.readUint16(n+4);for(let e=a;e<=o;e++)r[s++]=e}}return r}};Ho([J(`uint16`)],Uo.prototype,`majorVersion`,2),Ho([J(`uint16`)],Uo.prototype,`minorVersion`,2),Ho([J(`uint16`)],Uo.prototype,`scriptListOffset`,2),Ho([J(`uint16`)],Uo.prototype,`featureListOffset`,2),Ho([J(`uint16`)],Uo.prototype,`lookupListOffset`,2),Uo=Ho([Ua(`GSUB`,`gsub`)],Uo);var Wo=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,Ko=(e,t,n,r)=>{for(var i=r>1?void 0:r?Go(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Wo(t,n,i),i},qo=class extends Ga{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};Ko([J(`fixed`)],qo.prototype,`version`,2),Ko([J(`fixed`)],qo.prototype,`fontRevision`,2),Ko([J(`uint32`)],qo.prototype,`checkSumAdjustment`,2),Ko([J(`uint32`)],qo.prototype,`magickNumber`,2),Ko([J(`uint16`)],qo.prototype,`flags`,2),Ko([J(`uint16`)],qo.prototype,`unitsPerEm`,2),Ko([J({type:`longDateTime`})],qo.prototype,`created`,2),Ko([J({type:`longDateTime`})],qo.prototype,`modified`,2),Ko([J(`int16`)],qo.prototype,`xMin`,2),Ko([J(`int16`)],qo.prototype,`yMin`,2),Ko([J(`int16`)],qo.prototype,`xMax`,2),Ko([J(`int16`)],qo.prototype,`yMax`,2),Ko([J(`uint16`)],qo.prototype,`macStyle`,2),Ko([J(`uint16`)],qo.prototype,`lowestRecPPEM`,2),Ko([J(`int16`)],qo.prototype,`fontDirectionHint`,2),Ko([J(`int16`)],qo.prototype,`indexToLocFormat`,2),Ko([J(`int16`)],qo.prototype,`glyphDataFormat`,2),qo=Ko([Ua(`head`)],qo);var Jo=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,Xo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Yo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Jo(t,n,i),i},Zo=class extends Ga{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Xo([J(`fixed`)],Zo.prototype,`version`,2),Xo([J(`int16`)],Zo.prototype,`ascent`,2),Xo([J(`int16`)],Zo.prototype,`descent`,2),Xo([J(`int16`)],Zo.prototype,`lineGap`,2),Xo([J(`uint16`)],Zo.prototype,`advanceWidthMax`,2),Xo([J(`int16`)],Zo.prototype,`minLeftSideBearing`,2),Xo([J(`int16`)],Zo.prototype,`minRightSideBearing`,2),Xo([J(`int16`)],Zo.prototype,`xMaxExtent`,2),Xo([J(`int16`)],Zo.prototype,`caretSlopeRise`,2),Xo([J(`int16`)],Zo.prototype,`caretSlopeRun`,2),Xo([J(`int16`)],Zo.prototype,`caretOffset`,2),Xo([J({type:`int16`,size:4})],Zo.prototype,`reserved`,2),Xo([J(`int16`)],Zo.prototype,`metricDataFormat`,2),Xo([J(`uint16`)],Zo.prototype,`numOfLongHorMetrics`,2),Zo=Xo([Ua(`hhea`)],Zo);var Qo=Object.getOwnPropertyDescriptor,$o=(e,t,n,r)=>{for(var i=r>1?void 0:r?Qo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},es=class extends Ga{static from(e){let t=e.length*4,n=new es(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceWidth),n.view.writeUint16(e.leftSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics,n=0,r=this.view;return r.seek(0),Array.from({length:e}).map((e,i)=>(i<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};es=$o([Ua(`hmtx`)],es);var ts=Object.getOwnPropertyDescriptor,ns=(e,t,n,r)=>{for(var i=r>1?void 0:r?ts(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},rs=class extends Ga{_pairs;get pairs(){return this._pairs??=this._readPairs()}getKerningValue(e,t){return this.pairs.get(e*65536+t)??0}_readPairs(){let e=this.view,t=new Map;if(e.byteLength<4||e.readUint16(0)!==0)return t;let n=e.readUint16(2),r=4;for(let i=0;i<n&&r+6<=e.byteLength;i++){let n=e.readUint16(r+2),i=e.readUint16(r+4),a=i>>8,o=(i&1)!=0;if(a===0&&o){let n=e.readUint16(r+6),i=r+14;for(let r=0;r<n;r++){let n=e.readUint16(i),r=e.readUint16(i+2),a=e.readInt16(i+4);t.set(n*65536+r,a),i+=6}}if(n<=0)break;r+=n}return t}};rs=ns([Ua(`kern`,`kern`)],rs);var is=Object.getOwnPropertyDescriptor,as=(e,t,n,r)=>{for(var i=r>1?void 0:r?is(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},os=class extends Ga{static from(e,t=1){let n=e.length*(t?4:2),r=new os(new ArrayBuffer(n));return e.forEach(e=>{t?r.view.writeUint32(e):r.view.writeUint16(e/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};os=as([Ua(`loca`)],os);var ss=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,ls=(e,t,n,r)=>{for(var i=r>1?void 0:r?cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ss(t,n,i),i},us=class extends Ga{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};ls([J(`fixed`)],us.prototype,`version`,2),ls([J(`uint16`)],us.prototype,`numGlyphs`,2),ls([J(`uint16`)],us.prototype,`maxPoints`,2),ls([J(`uint16`)],us.prototype,`maxContours`,2),ls([J(`uint16`)],us.prototype,`maxComponentPoints`,2),ls([J(`uint16`)],us.prototype,`maxComponentContours`,2),ls([J(`uint16`)],us.prototype,`maxZones`,2),ls([J(`uint16`)],us.prototype,`maxTwilightPoints`,2),ls([J(`uint16`)],us.prototype,`maxStorage`,2),ls([J(`uint16`)],us.prototype,`maxFunctionDefs`,2),ls([J(`uint16`)],us.prototype,`maxInstructionDefs`,2),ls([J(`uint16`)],us.prototype,`maxStackElements`,2),ls([J(`uint16`)],us.prototype,`maxSizeOfInstructions`,2),ls([J(`uint16`)],us.prototype,`maxComponentElements`,2),ls([J(`uint16`)],us.prototype,`maxComponentDepth`,2),us=ls([Ua(`maxp`)],us);var ds=Object.defineProperty,fs=Object.getOwnPropertyDescriptor,ps=(e,t,n,r)=>{for(var i=r>1?void 0:r?fs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ds(t,n,i),i},ms={0:`copyright`,1:`fontFamily`,2:`fontSubFamily`,3:`uniqueSubFamily`,4:`fullName`,5:`version`,6:`postScriptName`,7:`tradeMark`,8:`manufacturer`,9:`designer`,10:`description`,11:`urlOfFontVendor`,12:`urlOfFontDesigner`,13:`licence`,14:`urlOfLicence`,16:`preferredFamily`,17:`preferredSubFamily`,18:`compatibleFull`,19:`sampleText`},hs={Macintosh:1,Microsoft:3},gs={Default:0},_s={UCS2:1},vs=class extends Ga{_names;get names(){return this._names??=this.readNames()}readNames(){let e=this.count;this.view.seek(6);let t=[];for(let n=0;n<e;++n)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});let n=this.stringOffset;for(let r=0;r<e;++r){let e=t[r];e.name=this.view.readBytes(n+e.offset,e.length)}let r=hs.Macintosh,i=gs.Default,a=0;t.some(e=>e.platform===hs.Microsoft&&e.encoding===_s.UCS2&&e.language===1033)&&(r=hs.Microsoft,i=_s.UCS2,a=1033);let o={};for(let n=0;n<e;++n){let e=t[n];e.platform===r&&e.encoding===i&&e.language===a&&ms[e.nameId]&&(o[ms[e.nameId]]=a===0?ca(e.name):la(e.name))}return o}};ps([J(`uint16`)],vs.prototype,`format`,2),ps([J(`uint16`)],vs.prototype,`count`,2),ps([J(`uint16`)],vs.prototype,`stringOffset`,2),vs=ps([Ua(`name`)],vs);var ys=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?bs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ys(t,n,i),i},$=class extends Ga{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};Q([J(`uint16`)],$.prototype,`version`,2),Q([J(`int16`)],$.prototype,`xAvgCharWidth`,2),Q([J(`uint16`)],$.prototype,`usWeightClass`,2),Q([J(`uint16`)],$.prototype,`usWidthClass`,2),Q([J(`uint16`)],$.prototype,`fsType`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutSize`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutPosition`,2),Q([J(`uint16`)],$.prototype,`sFamilyClass`,2),Q([J({type:`uint8`})],$.prototype,`bFamilyType`,2),Q([J({type:`uint8`})],$.prototype,`bSerifStyle`,2),Q([J({type:`uint8`})],$.prototype,`bWeight`,2),Q([J({type:`uint8`})],$.prototype,`bProportion`,2),Q([J({type:`uint8`})],$.prototype,`bContrast`,2),Q([J({type:`uint8`})],$.prototype,`bStrokeVariation`,2),Q([J({type:`uint8`})],$.prototype,`bArmStyle`,2),Q([J({type:`uint8`})],$.prototype,`bLetterform`,2),Q([J({type:`uint8`})],$.prototype,`bMidline`,2),Q([J({type:`uint8`})],$.prototype,`bXHeight`,2),Q([J({type:`uint32`,size:4})],$.prototype,`ulUnicodeRange`,2),Q([J({type:`char`,size:4})],$.prototype,`achVendID`,2),Q([J(`uint16`)],$.prototype,`fsSelection`,2),Q([J(`uint16`)],$.prototype,`usFirstCharIndex`,2),Q([J(`uint16`)],$.prototype,`usLastCharIndex`,2),Q([J(`int16`)],$.prototype,`sTypoAscender`,2),Q([J(`int16`)],$.prototype,`sTypoDescender`,2),Q([J(`int16`)],$.prototype,`sTypoLineGap`,2),Q([J(`uint16`)],$.prototype,`usWinAscent`,2),Q([J(`uint16`)],$.prototype,`usWinDescent`,2),Q([J({offset:78,type:`uint32`,size:2})],$.prototype,`ulCodePageRange`,2),Q([J({offset:86,type:`int16`})],$.prototype,`sxHeight`,2),Q([J(`int16`)],$.prototype,`sCapHeight`,2),Q([J(`uint16`)],$.prototype,`usDefaultChar`,2),Q([J(`uint16`)],$.prototype,`usBreakChar`,2),Q([J(`uint16`)],$.prototype,`usMaxContext`,2),$=Q([Ua(`OS/2`,`os2`)],$);var xs=`.notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quotesingle,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,grave,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,Adieresis,Aring,Ccedilla,Eacute,Ntilde,Odieresis,Udieresis,aacute,agrave,acircumflex,adieresis,atilde,aring,ccedilla,eacute,egrave,ecircumflex,edieresis,iacute,igrave,icircumflex,idieresis,ntilde,oacute,ograve,ocircumflex,odieresis,otilde,uacute,ugrave,ucircumflex,udieresis,dagger,degree,cent,sterling,section,bullet,paragraph,germandbls,registered,copyright,trademark,acute,dieresis,notequal,AE,Oslash,infinity,plusminus,lessequal,greaterequal,yen,mu,partialdiff,summation,product,pi,integral,ordfeminine,ordmasculine,Omega,ae,oslash,questiondown,exclamdown,logicalnot,radical,florin,approxequal,Delta,guillemotleft,guillemotright,ellipsis,nonbreakingspace,Agrave,Atilde,Otilde,OE,oe,endash,emdash,quotedblleft,quotedblright,quoteleft,quoteright,divide,lozenge,ydieresis,Ydieresis,fraction,currency,guilsinglleft,guilsinglright,fi,fl,daggerdbl,periodcentered,quotesinglbase,quotedblbase,perthousand,Acircumflex,Ecircumflex,Aacute,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Oacute,Ocircumflex,apple,Ograve,Uacute,Ucircumflex,Ugrave,dotlessi,circumflex,tilde,macron,breve,dotaccent,ring,cedilla,hungarumlaut,ogonek,caron,Lslash,lslash,Scaron,scaron,Zcaron,zcaron,brokenbar,Eth,eth,Yacute,yacute,Thorn,thorn,minus,multiply,onesuperior,twosuperior,threesuperior,onehalf,onequarter,threequarters,franc,Gbreve,gbreve,Idotaccent,Scedilla,scedilla,Cacute,cacute,Ccaron,ccaron,dcroat`.split(`,`),Ss=Object.defineProperty,Cs=Object.getOwnPropertyDescriptor,ws=(e,t,n,r)=>{for(var i=r>1?void 0:r?Cs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ss(t,n,i),i},Ts=class extends Ga{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return xs.slice();if(e!==2)return[];let t=this.view,n=t.readUint16(32),r=[];for(let e=0;e<n;e++)r.push(t.readUint16(34+e*2));let i=[],a=34+n*2,o=t.byteLength;for(;a<o;){let e=t.readUint8(a);a+=1,i.push(t.readString(a,e)),a+=e}return r.map(e=>e<258?xs[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};ws([J(`fixed`)],Ts.prototype,`format`,2),ws([J(`fixed`)],Ts.prototype,`italicAngle`,2),ws([J(`int16`)],Ts.prototype,`underlinePosition`,2),ws([J(`int16`)],Ts.prototype,`underlineThickness`,2),ws([J(`uint32`)],Ts.prototype,`isFixedPitch`,2),ws([J(`uint32`)],Ts.prototype,`minMemType42`,2),ws([J(`uint32`)],Ts.prototype,`maxMemType42`,2),ws([J(`uint32`)],Ts.prototype,`minMemType1`,2),ws([J(`uint32`)],Ts.prototype,`maxMemType1`,2),Ts=ws([Ua(`post`)],Ts);var Es=Object.defineProperty,Ds=Object.getOwnPropertyDescriptor,Os=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ds(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Es(t,n,i),i},ks=class extends Ga{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Os([J(`fixed`)],ks.prototype,`version`,2),Os([J(`int16`)],ks.prototype,`vertTypoAscender`,2),Os([J(`int16`)],ks.prototype,`vertTypoDescender`,2),Os([J(`int16`)],ks.prototype,`vertTypoLineGap`,2),Os([J(`int16`)],ks.prototype,`advanceHeightMax`,2),Os([J(`int16`)],ks.prototype,`minTopSideBearing`,2),Os([J(`int16`)],ks.prototype,`minBottomSideBearing`,2),Os([J(`int16`)],ks.prototype,`yMaxExtent`,2),Os([J(`int16`)],ks.prototype,`caretSlopeRise`,2),Os([J(`int16`)],ks.prototype,`caretSlopeRun`,2),Os([J(`int16`)],ks.prototype,`caretOffset`,2),Os([J({type:`int16`,size:4})],ks.prototype,`reserved`,2),Os([J(`int16`)],ks.prototype,`metricDataFormat`,2),Os([J(`int16`)],ks.prototype,`numOfLongVerMetrics`,2),ks=Os([Ua(`vhea`)],ks);var As=Object.getOwnPropertyDescriptor,js=(e,t,n,r)=>{for(var i=r>1?void 0:r?As(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Ms=class extends Ga{static from(e){let t=e.length*4,n=new Ms(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceHeight),n.view.writeInt16(e.topSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((e,i)=>(i<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readInt16()}))}};Ms=js([Ua(`vmtx`)],Ms);var Ns=Object.defineProperty,Ps=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ns(t,n,i),i},Fs=class extends ma{format=`TrueType`;mimeType=`font/ttf`;_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(aa(e).getUint32(0))}static checksum(e){let t=aa(e),n=t.byteLength,r=Math.floor(n/4),i=0;for(let e=0;e<r;e++)i+=t.getUint32(e*4,!1);let a=n-r*4;if(a>0){let e=0,n=r*4;for(let r=0;r<4;r++)e=e*256+(r<a?t.getUint8(n+r):0);i+=e}return i%4294967296}static from(e){let t=e=>e+3&-4,n=e.tableTags,r=n.map(t=>e.getTableView(t)),i=n.length,a=r.reduce((e,n)=>e+t(n.byteLength),0),o=new this(new ArrayBuffer(12+i*16+a));o.scalerType=65536,o.numTables=i;let s=Math.floor(Math.log2(i));o.searchRange=2**s*16,o.entrySelector=s,o.rangeShift=i*16-o.searchRange;let c=12+i*16,l=o.getDirectories();n.forEach((e,n)=>{let i=r[n],a=l[n];a.tag=e,a.checkSum=this.checksum(i),a.offset=c,a.length=i.byteLength,o.view.writeBytes(i,c),c+=t(a.length)});let u=l.find(e=>e.tag===`head`);if(u){let e=u.offset+8;o.view.writeUint32(0,e),o.view.writeUint32(2981146554-this.checksum(o.view)>>>0,e)}return o}getDirectories(){let e=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{let t=new ba(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new Wa(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Ps([J(`uint32`)],Fs.prototype,`scalerType`),Ps([J(`uint16`)],Fs.prototype,`numTables`),Ps([J(`uint16`)],Fs.prototype,`searchRange`),Ps([J(`uint16`)],Fs.prototype,`entrySelector`),Ps([J(`uint16`)],Fs.prototype,`rangeShift`);var Is=class extends Fs{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},Ls=class{static signature=1953784678;static is(e){let t=aa(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=aa(e),this.numFonts=this.view.getUint32(8,!1)}get sfnts(){return Array.from({length:this.numFonts},(e,t)=>this._readSFNT(this.view.getUint32(12+t*4,!1)))}get fonts(){return this.sfnts.map(e=>e.hasTable(`CFF `)?Is.from(e):Fs.from(e))}_readSFNT(e){let t=this.view,n=t.byteOffset,r=t.getUint16(e+4,!1),i=new Map;for(let a=0;a<r;a++){let r=e+12+a*16,o=String.fromCharCode(t.getUint8(r),t.getUint8(r+1),t.getUint8(r+2),t.getUint8(r+3)),s=t.getUint32(r+8,!1),c=t.getUint32(r+12,!1);i.set(o,new DataView(t.buffer,n+s,c))}return new Wa(i)}},Rs=Object.defineProperty,zs=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Rs(t,n,i),i},Bs=class extends pa{constructor(e,t){super(e,t,20)}};zs([J({type:`char`,size:4})],Bs.prototype,`tag`),zs([J(`uint32`)],Bs.prototype,`offset`),zs([J(`uint32`)],Bs.prototype,`compLength`),zs([J(`uint32`)],Bs.prototype,`origLength`),zs([J(`uint32`)],Bs.prototype,`origChecksum`);var Vs=Object.defineProperty,Hs=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Vs(t,n,i),i};function Us(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Ws(e){return new Promise((t,n)=>{Zi(e,(e,r)=>e?n(e):t(r))})}function Gs(e){return new Promise((t,n)=>{$i(e,(e,r)=>e?n(e):t(r))})}var Ks=class e extends ma{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return Fs.is(this.flavor)?`TrueType`:Is.is(this.flavor)?`OpenType`:`Open`}_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([2001684038]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(aa(e).getUint32(0))}static checkSum(e){let t=aa(e),n=t.byteLength,r=Math.floor(n/4),i=0,a=0;for(;a<r;)i+=t.getUint32(4*a++,!1);let o=n-r*4;if(o){let e=r*4;for(;o>0;)i+=t.getUint8(e)<<o*8,e++,o--}return i%4294967296}static _pickTable(e,t,n){return{tag:e,view:n.byteLength<t.byteLength?n:t,rawView:t}}static from(e,t=new ArrayBuffer(0)){let n=e.tableTags.map(t=>{let n=e.getTableView(t);return this._pickTable(t,n,aa(Qi(Us(n))))});return this._assemble(n,t)}static async fromAsync(e,t=new ArrayBuffer(0)){let n=await Promise.all(e.tableTags.map(async t=>{let n=e.getTableView(t);return this._pickTable(t,n,aa(await Ws(Us(n))))}));return this._assemble(n,t)}static _assemble(t,n){let r=e=>e+3&-4,i=t.length,a=t.reduce((e,t)=>e+r(t.view.byteLength),0),o=new e(new ArrayBuffer(44+20*i+a+n.byteLength));o.signature=2001684038,o.flavor=65536,o.length=o.view.byteLength,o.numTables=i,o.totalSFNTSize=12+16*i+t.reduce((e,t)=>e+r(t.rawView.byteLength),0);let s=44+i*20,c=0,l=o.getDirectories();return t.forEach(t=>{let n=l[c++];n.tag=t.tag,n.offset=s,n.compLength=t.view.byteLength,n.origChecksum=e.checkSum(t.rawView),n.origLength=t.rawView.byteLength,o.view.writeBytes(t.view,s),s+=r(n.compLength)}),o.view.writeBytes(n),o}getDirectories(){let e=44;return Array.from({length:this.numTables},()=>{let t=new Bs(this.view.buffer,e);return e+=t.view.byteLength,t})}_decodeTable(e,t,n){if(t>=n)return new DataView(this.view.buffer,e,t);let r=ea(new Uint8Array(this.view.buffer.slice(e,e+t)));return new DataView(r.buffer,r.byteOffset,r.byteLength)}createSFNT(){let e=new Map;return this.getDirectories().forEach(t=>{let n=t.tag,r=this.view.byteOffset+t.offset,i=t.compLength,a=t.origLength;e.set(n,()=>this._decodeTable(r,i,a))}),new Wa(void 0,e)}async createSFNTAsync(){let e=await Promise.all(this.getDirectories().map(async e=>{let t=e.tag,n=this.view.byteOffset+e.offset,r=e.compLength,i=e.origLength,a;if(r>=i)a=new DataView(this.view.buffer,n,r);else{let e=await Gs(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new Wa(new Map(e))}};Hs([J(`uint32`)],Ks.prototype,`signature`),Hs([J(`uint32`)],Ks.prototype,`flavor`),Hs([J(`uint32`)],Ks.prototype,`length`),Hs([J(`uint16`)],Ks.prototype,`numTables`),Hs([J(`uint16`)],Ks.prototype,`reserved`),Hs([J(`uint32`)],Ks.prototype,`totalSFNTSize`),Hs([J(`uint16`)],Ks.prototype,`majorVersion`),Hs([J(`uint16`)],Ks.prototype,`minorVersion`),Hs([J(`uint32`)],Ks.prototype,`metaOffset`),Hs([J(`uint32`)],Ks.prototype,`metaLength`),Hs([J(`uint32`)],Ks.prototype,`metaOrigLength`),Hs([J(`uint32`)],Ks.prototype,`privOffset`),Hs([J(`uint32`)],Ks.prototype,`privLength`);var qs=Ks;function Js(e,t=!0){if(Fs.is(e))return new Fs(e);if(Is.is(e))return new Is(e);if(qs.is(e))return new qs(e);if(Ls.is(e)){let t=new Ls(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function Ys(e,t=!0){let n=Js(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var Xs=new class e{static defaultRequestInit={cache:`force-cache`};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(t,n){let r=new AbortController;return{url:t,when:fetch(t,{...e.defaultRequestInit,...n,signal:r.signal}).then(e=>e.arrayBuffer()),cancel:()=>r.abort()}}async injectFontFace(e,t){if(!document.fonts.check(`14px "${e}"`)){let n=new FontFace(e,t);await n.load(),document.fonts.add(n)}}injectStyleTag(e,t){let n=CSS.escape(e);if(!document.querySelector(`style[data-family="${n}"]`)){let n=document.createElement(`style`);n.type=`text/css`,n.dataset.family=e,n.appendChild(document.createTextNode(`@font-face {
30
+ </svg>`}toSvgUrl(){return`data:image/svg+xml;base64,${btoa(this.toSvgString())}`}toSvg(){return new DOMParser().parseFromString(this.toSvgString(),`image/svg+xml`).documentElement}toCanvas(e={}){let{pixelRatio:t=2,...n}=e,{left:r,top:i,width:a,height:o}=this.getBoundingBox(),s=document.createElement(`canvas`);s.width=a*t,s.height=o*t,s.style.width=`${a}px`,s.style.height=`${o}px`;let c=s.getContext(`2d`);return c&&(c.scale(t,t),c.translate(-r,-i),this.paths.forEach(e=>{e.drawTo(c,n)})),s}};function Ur(){let e=new Map;async function t(t){if(!e.has(t)){e.set(t,``);try{e.set(t,await fetch(t).then(e=>e.text()))}catch(n){console.warn(n),e.delete(t)}}}function n(e){return e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`blob://`)}return{loaded:e,needsLoad:n,load:t}}function Wr(e){let t=new Map;function n(n){let r=t.get(n);if(!r){let i=e.needsLoad(n)?e.loaded.get(n):n;if(i){let e=Qn(i);r={dom:e,pathSet:_r(e)},t.set(n,r)}else{let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.setAttribute(`viewBox`,`0 0 0 0`),r={dom:e,pathSet:new Hr}}}return r}return{parsed:t,parse:n}}function Gr(e,t){let{transform:n,transformOrigin:r}=t,{fontSize:i,lineBox:a}=e,{left:o,top:s,width:c,height:l}=a,{x:u,y:d}=Kr(r??`center`,o,s,c,l),f=new Bn;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Kr(e,t,n,r,i){let a={left:0,center:.5,right:1},o={top:0,center:.5,bottom:1},s=e.trim().split(/\s+/),c=s[0]??`center`,l=s[1]??`center`,u;u=c in a?t+a[c]*r:c.endsWith(`%`)?t+Number.parseFloat(c)/100*r:t+Number.parseFloat(c);let d;return d=l in o?n+o[l]*i:l.endsWith(`%`)?n+Number.parseFloat(l)/100*i:n+Number.parseFloat(l),{x:u,y:d}}function qr(e,t){return typeof e==`number`?e:e.endsWith(`%`)?(e=e.substring(0,e.length-1),Math.ceil(Number(e)/100*t.total)):e.endsWith(`rem`)?(e=e.substring(0,e.length-3),Number(e)*t.fontSize):e.endsWith(`em`)?(e=e.substring(0,e.length-2),Number(e)*t.fontSize):Number(e)}function Jr(e){return O(e)?{}:e}function Yr(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Xr(e[n],t[n]))}function Xr(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Yr(e,t):e===t:!1}var Zr=class{text;context;pixelRatio=window?.devicePixelRatio||1;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,{left:n,top:r,width:i,height:a}=this.text.boundingBox,o=t.canvas;o.dataset.viewBox=String(`${n} ${r} ${i} ${a}`),o.dataset.pixelRatio=String(e);let s=i,c=a;o.width=Math.max(1,Math.ceil(s*e)),o.height=Math.max(1,Math.ceil(c*e)),o.style.width=`${s}px`,o.style.height=`${c}px`,t.clearRect(0,0,o.width,o.height),t.scale(e,e),t.translate(-n,-r)};_setupColors=()=>{this.uploadColor(this.text.glyphBox,{style:this.text.computedStyle,fill:this.text.computedFill,outline:this.text.computedOutline}),this.text.paragraphs.forEach(e=>{this.uploadColor(e.lineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline}),e.fragments.forEach(e=>{this.uploadColor(e.inlineBox,{style:e.computedStyle,fill:e.computedFill,outline:e.computedOutline})})})};setup=()=>(this._setupView(),this._setupColors(),this);_parseColor=(e,t)=>{if(typeof e==`string`&&ve(e)&&(e=ye(e)[0]),typeof e==`object`&&`type`in e)switch(e.type){case`linear-gradient`:{let{left:n,top:r,width:i,height:a}=t,{angle:o=0,stops:s}=e,c=n+i/2,l=r+a/2,u=(o+90)*Math.PI/180,d=Math.sin(u),f=-Math.cos(u),p=Math.abs(i*Math.sin(u))+Math.abs(a*Math.cos(u)),m=c-p/2*d,h=l-p/2*f,g=c+p/2*d,_=l+p/2*f,v=this.context.createLinearGradient(m,h,g,_);for(let e of s)v.addColorStop(e.offset,e.color);return v}case`radial-gradient`:break}return e};_uploadedStyles=[`color`,`backgroundColor`,`textStrokeColor`];uploadColor=(e,t)=>{let{style:n,fill:r,outline:i}=t;n&&this._uploadedStyles.forEach(t=>{n[t]=this._parseColor(n[t],e)}),r?.enabled&&r.linearGradient&&(r._linearGradient=this._parseColor({type:`linear-gradient`,...r.linearGradient},e)),i?.enabled&&i.linearGradient&&(i._linearGradient=this._parseColor({type:`linear-gradient`,...i.linearGradient},e))};_mergePathStyle(e,t){let n=e.style,r=t.stroke??n.stroke,i=t.strokeWidth?t.strokeWidth:n.strokeWidth;return{...A(n),...A(t),stroke:i===void 0||i>0?r:void 0,strokeLinecap:t.strokeLinecap??n.strokeLinecap??`round`,strokeLinejoin:t.strokeLinejoin??n.strokeLinejoin??`round`,strokeWidth:i}}drawPath=(e,t={})=>{let{clipRect:n,...r}=t,i=this.context;i.save(),i.beginPath(),n&&(i.rect(n.left,n.top,n.width,n.height),i.clip(),i.beginPath()),e.drawTo(i,this._mergePathStyle(e,r)),i.restore()};effectToPathStyle(e){let t=this.text.computedStyle.fontSize,n={};return e.fill?.enabled&&(n={...n,fill:e.fill.color}),e.outline?.enabled&&(n={...n,stroke:e.outline.color,strokeWidth:(e.outline.width??0)*t}),e.shadow?.enabled&&(n={...n,shadowOffsetX:(e.shadow.offsetX??0)*t,shadowOffsetY:(e.shadow.offsetY??0)*t,shadowBlur:(e.shadow.blur??0)*t,shadowColor:e.shadow.color}),n}transformEffect(e){let{a:t,b:n,c:r,d:i,tx:a,ty:o}=Gr(this.text,e);this.context.transform(t,n,r,i,a,o)}_shadowCanvas;_shadowCtx;drawWithShadow=(e,t)=>{let n=this.context,r=n.canvas;this._shadowCanvas||(this._shadowCanvas=document.createElement(`canvas`),this._shadowCtx=this._shadowCanvas.getContext(`2d`));let i=this._shadowCanvas,a=this._shadowCtx;if(!a){t();return}i.width<r.width&&(i.width=r.width),i.height<r.height&&(i.height=r.height),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.width,r.height);let o=n.getTransform();a.setTransform(o.a,o.b,o.c,o.d,o.e,o.f);let s=this.context;this.context=a;try{t()}finally{this.context=s}let c=this.text.computedStyle.fontSize,l=this.pixelRatio;n.save(),n.setTransform(1,0,0,1,0,0),n.shadowOffsetX=(e.offsetX??0)*c*l,n.shadowOffsetY=(e.offsetY??0)*c*l,n.shadowBlur=(e.blur??0)*c*l,n.shadowColor=e.color,n.drawImage(i,0,0,r.width,r.height,0,0,r.width,r.height),n.restore()};drawCharacter=(e,t={})=>{let n=this.context,{computedStyle:r,path:i,glyphBox:a,isVertical:o,content:s,inlineBox:c,baseline:l,computedFill:u,computedOutline:d}=e,f=u?.enabled?u:void 0,p=d?.enabled?d:void 0,m=this.effectToPathStyle(t),h={strokeLinecap:p?.lineCap,strokeLinejoin:p?.lineJoin,...r,...m,fill:m.fill??f?._linearGradient??f?.color??r.color,strokeWidth:m.strokeWidth??p?.width??r.textStrokeWidth,stroke:m.stroke??p?._linearGradient??p?.color??r.textStrokeColor};a?this.drawPath(i,h):(n.save(),n.beginPath(),Wt(n,this._mergePathStyle(i,h)),n.font=`${r.fontSize}px ${r.fontFamily||this.text.defaultFamily}`,o?(n.textBaseline=`middle`,n.fillText(s,c.left,c.top+c.height/2)):(n.textBaseline=`alphabetic`,n.fillText(s,c.left,c.top+l)),n.restore())}},Qr={},$r=(function(e,t,n,r,i){var a=new Worker(Qr[t]||(Qr[t]=URL.createObjectURL(new Blob([e+`;addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})`],{type:`text/javascript`}))));return a.onmessage=function(e){var t=e.data,n=t.$e$;if(n){var r=Error(n[0]);r.code=n[1],r.stack=n[2],i(r,null)}else i(null,t)},a.postMessage(n,r),a}),ei=Uint8Array,ti=Uint16Array,ni=Int32Array,ri=new ei([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]),ii=new ei([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]),ai=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oi=function(e,t){for(var n=new ti(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ni(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},si=oi(ri,2),ci=si.b,li=si.r;ci[28]=258,li[258]=28;for(var ui=oi(ii,0),di=ui.b,fi=ui.r,pi=new ti(32768),q=0;q<32768;++q){var mi=(q&43690)>>1|(q&21845)<<1;mi=(mi&52428)>>2|(mi&13107)<<2,mi=(mi&61680)>>4|(mi&3855)<<4,pi[q]=((mi&65280)>>8|(mi&255)<<8)>>1}for(var hi=(function(e,t,n){for(var r=e.length,i=0,a=new ti(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new ti(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new ti(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[pi[d]>>c]=l}else for(s=new ti(r),i=0;i<r;++i)e[i]&&(s[i]=pi[o[e[i]-1]++]>>15-e[i]);return s}),gi=new ei(288),q=0;q<144;++q)gi[q]=8;for(var q=144;q<256;++q)gi[q]=9;for(var q=256;q<280;++q)gi[q]=7;for(var q=280;q<288;++q)gi[q]=8;for(var _i=new ei(32),q=0;q<32;++q)_i[q]=5;var vi=hi(gi,9,0),yi=hi(gi,9,1),bi=hi(_i,5,0),xi=hi(_i,5,1),Si=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ci=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},wi=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Ti=function(e){return(e+7)/8|0},Ei=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ei(e.subarray(t,n))},Di=[`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`],Oi=function(e,t,n){var r=Error(t||Di[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Oi),!n)throw r;return r},ki=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new ei(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new ei(i*3));var l=function(e){var t=n.length;if(e>t){var r=new ei(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Ci(e,d,1);var v=Ci(e,d+1,3);if(d+=3,!v){var y=Ti(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&Oi(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}else if(v==1)p=yi,m=xi,h=9,g=5;else if(v==2){var S=Ci(e,d,31)+257,C=Ci(e,d+10,15)+4,w=S+Ci(e,d+5,31)+1;d+=14;for(var T=new ei(w),E=new ei(19),D=0;D<C;++D)E[ai[D]]=Ci(e,d+D*3,7);d+=C*3;for(var O=Si(E),k=(1<<O)-1,A=hi(E,O,1),D=0;D<w;){var j=A[Ci(e,d,k)];d+=j&15;var y=j>>4;if(y<16)T[D++]=y;else{var M=0,N=0;for(y==16?(N=3+Ci(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+Ci(e,d,7),d+=3):y==18&&(N=11+Ci(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=Si(P),g=Si(F),p=hi(P,h,1),m=hi(F,g,1)}else Oi(1);if(d>_){c&&Oi(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[wi(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&Oi(0);break}if(M||Oi(2),z<256)n[f++]=z;else if(z==256){R=d,p=null;break}else{var B=z-254;if(z>264){var D=z-257,V=ri[D];B=Ci(e,d,(1<<V)-1)+ci[D],d+=V}var ee=m[wi(e,d)&L],te=ee>>4;ee||Oi(3),d+=ee&15;var F=di[te];if(te>3){var V=ii[te];F+=wi(e,d)&(1<<V)-1,d+=V}if(d>_){c&&Oi(0);break}s&&l(f+131072);var ne=f+B;if(f<F){var re=a-F,ie=Math.min(F,ne);for(re+f<0&&Oi(3);f<ie;++f)n[f]=r[re+f]}for(;f<ne;++f)n[f]=n[f-F]}}t.l=p,t.p=R,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Ei(n,0,f):n.subarray(0,f)},Ai=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},ji=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Mi=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:zi,l:0};if(i==1){var o=new ei(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new ti(f+1),m=Ni(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new ei(p),l:m}},Ni=function(e,t,n){return e.s==-1?Math.max(Ni(e.l,t,n+1),Ni(e.r,t,n+1)):t[e.s]=n},Pi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ti(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},Fi=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ii=function(e,t,n){var r=n.length,i=Ti(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Li=function(e,t,n,r,i,a,o,s,c,l,u){Ai(t,u++,n),++i[256];for(var d=Mi(i,15),f=d.t,p=d.l,m=Mi(a,15),h=m.t,g=m.l,_=Pi(f),v=_.c,y=_.n,b=Pi(h),x=b.c,S=b.n,C=new ti(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=Mi(C,7),E=T.t,D=T.l,O=19;O>4&&!E[ai[O-1]];--O);var k=l+5<<3,A=Fi(i,gi)+Fi(a,_i)+o,j=Fi(i,f)+Fi(a,h)+o+14+3*O+Fi(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Ii(t,u,e.subarray(c,c+l));var M,N,P,F;if(Ai(t,u,1+(j<A)),u+=2,j<A){M=hi(f,p,0),N=f,P=hi(h,g,0),F=h;var I=hi(E,D,0);Ai(t,u,y-257),Ai(t,u+5,S-1),Ai(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)Ai(t,u+3*w,E[ai[w]]);u+=3*O;for(var L=[v,x],R=0;R<2;++R)for(var z=L[R],w=0;w<z.length;++w){var B=z[w]&31;Ai(t,u,I[B]),u+=E[B],B>15&&(Ai(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=vi,N=gi,P=bi,F=_i;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;ji(t,u,M[B+257]),u+=N[B+257],B>7&&(Ai(t,u,V>>23&31),u+=ri[B]);var ee=V&31;ji(t,u,P[ee]),u+=F[ee],ee>3&&(ji(t,u,V>>5&8191),u+=ii[ee])}else ji(t,u,M[V]),u+=N[V]}return ji(t,u,M[256]),u+N[256]},Ri=new ni([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zi=new ei(0),Bi=function(e,t,n,r,i,a){var o=a.z||e.length,s=new ei(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=Ri[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new ti(32768),g=a.h||new ti(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ni(25e3),x=new ti(288),S=new ti(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,j=g[k];if(h[A]=j,g[k]=A,D<=T){var M=o-T;if((C>7e3||E>24576)&&(M>423||!l)){u=Li(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var N=0;N<286;++N)x[N]=0;for(var N=0;N<30;++N)S[N]=0}var P=2,F=0,I=p,L=A-j&32767;if(M>2&&k==y(T-L))for(var R=Math.min(f,M)-1,z=Math.min(32767,T),B=Math.min(258,M);L<=z&&--I&&A!=j;){if(e[T+P]==e[T+P-L]){for(var V=0;V<B&&e[T+V]==e[T+V-L];++V);if(V>P){if(P=V,F=L,V>R)break;for(var ee=Math.min(L,V-2),te=0,N=0;N<ee;++N){var ne=T-L+N&32767,re=ne-h[ne]&32767;re>te&&(te=re,j=ne)}}}A=j,j=h[A],L+=A-j&32767}if(F){b[E++]=268435456|li[P]<<18|fi[F];var ie=li[P]&31,ae=fi[F]&31;w+=ri[ie]+ii[ae],++x[257+ie],++S[ae],D=T+P,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=Li(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var oe=T+65535;oe>=o&&(c[u/8|0]=l,oe=o),u=Ii(c,u+1,e.subarray(T,oe))}a.i=o}return Ei(s,0,r+Ti(u)+i)},Vi=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length|0,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(r&65535)+15*(r>>16),i=(i&65535)+15*(i>>16)}e=r,t=i},d:function(){return e%=65521,t%=65521,(e&255)<<24|(e&65280)<<8|(t&255)<<8|t>>8}}},Hi=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new ei(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Bi(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Ui=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Wi=function(e,t,n){for(var r=e(),i=e.toString(),a=i.slice(i.indexOf(`[`)+1,i.lastIndexOf(`]`)).replace(/\s+/g,``).split(`,`),o=0;o<r.length;++o){var s=r[o],c=a[o];if(typeof s==`function`){t+=`;`+c+`=`;var l=s.toString();if(s.prototype)if(l.indexOf(`[native code]`)!=-1){var u=l.indexOf(` `,8)+1;t+=l.slice(u,l.indexOf(`(`,u))}else for(var d in t+=l,s.prototype)t+=`;`+c+`.prototype.`+d+`=`+s.prototype[d].toString();else t+=l}else n[c]=s}return t},Gi=[],Ki=function(e){var t=[];for(var n in e)e[n].buffer&&t.push((e[n]=new e[n].constructor(e[n])).buffer);return t},qi=function(e,t,n,r){if(!Gi[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=Wi(e[s],i,a);Gi[n]={c:Wi(e[o],i,a),e:a}}var c=Ui({},Gi[n].e);return $r(Gi[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,Ki(c),r)},Ji=function(){return[ei,ti,ni,ri,ii,ai,ci,di,yi,xi,pi,Di,hi,Si,Ci,wi,Ti,Ei,Oi,ki,aa,Qi,$i]},Yi=function(){return[ei,ti,ni,ri,ii,ai,li,fi,vi,gi,bi,_i,pi,Ri,zi,hi,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ti,Ei,Bi,Hi,ia,Qi]},Xi=function(){return[na,ta,Vi]},Zi=function(){return[ra]},Qi=function(e){return postMessage(e,[e.buffer])},$i=function(e){return e&&{out:e.size&&new ei(e.size),dictionary:e.dictionary}},ea=function(e,t,n,r,i,a){var o=qi(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},ta=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},na=function(e,t){var n=t.level,r=n==0?0:n<6?1:n==9?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var i=Vi();i.p(t.dictionary),ta(e,2,i.d())}},ra=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&Oi(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&Oi(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function ia(e,t){return Hi(e,t||{},0,0)}function aa(e,t){return ki(e,{i:2},t&&t.out,t&&t.dictionary)}function oa(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&Oi(7),ea(e,t,[Yi,Xi,function(){return[sa]}],function(e){return Qi(sa(e.data[0],e.data[1]))},4,n)}function sa(e,t){t||={};var n=Vi();n.p(e);var r=Hi(e,t,t.dictionary?6:2,4);return na(r,t),ta(r,r.length-4,n.d()),r}function ca(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&Oi(7),ea(e,t,[Ji,Zi,function(){return[la]}],function(e){return Qi(la(e.data[0],$i(e.data[1])))},5,n)}function la(e,t){return ki(e.subarray(ra(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var ua=typeof TextDecoder<`u`&&new TextDecoder;try{ua.decode(zi,{stream:!0})}catch{}var da=`modern-font`;function fa(e,t){if(!e)throw Error(`[${da}] ${t}`)}function pa(e){if(`buffer`in e){let t=e.buffer;return e.byteOffset>0||e.byteLength<e.buffer.byteLength?t.slice(e.byteOffset,e.byteOffset+e.byteLength):t}else return e}function ma(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function ha(e){let t=``;for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),i!==0&&(t+=String.fromCharCode(i));return t}function ga(e){e=ha(e);let t=[];for(let n=0,r=e.length,i;n<r;n++)i=e.charCodeAt(n),t.push(i>>8),t.push(i&255);return t}function _a(e){return new TextDecoder().decode(Uint8Array.from(e))}function va(e){let t=``;for(let n=0,r=e.length;n<r;n+=2)t+=String.fromCharCode((e[n]<<8)+e[n+1]);return t}var ya={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},ba=class extends DataView{constructor(e,t,n,r){super(pa(e),t,n),this.littleEndian=r}cursor=0;readInt8=e=>this.read(`int8`,e);readInt16=(e,t)=>this.read(`int16`,e,t);readInt32=(e,t)=>this.read(`int32`,e,t);readUint8=e=>this.read(`uint8`,e);readUint16=(e,t)=>this.read(`uint16`,e,t);readUint32=(e,t)=>this.read(`uint32`,e,t);readFloat32=(e,t)=>this.read(`float32`,e,t);readFloat64=(e,t)=>this.read(`float64`,e,t);writeInt8=(e,t)=>this.write(`int8`,e,t);writeInt16=(e,t,n)=>this.write(`int16`,e,t,n);writeInt32=(e,t,n)=>this.write(`int32`,e,t,n);writeUint8=(e,t)=>this.write(`uint8`,e,t);writeUint16=(e,t,n)=>this.write(`uint16`,e,t,n);writeUint32=(e,t,n)=>this.write(`uint32`,e,t,n);writeFloat32=(e,t,n)=>this.write(`float32`,e,t,n);writeFloat64=(e,t,n)=>this.write(`float64`,e,t,n);readColumn(e){if(e.size){let t=Array.from({length:e.size},(t,n)=>this.read(e.type,e.offset+n));switch(e.type){case`char`:return t.join(``);default:return t}}else return this.read(e.type,e.offset)}writeColumn(e,t){e.size?Array.from({length:e.size},(n,r)=>{this.write(e.type,t[r],e.offset+r)}):this.write(e.type,t,e.offset)}read(e,t=this.cursor,n=this.littleEndian){let r;switch(e){case`int8`:r=this.getInt8(t);break;case`int16`:r=this.getInt16(t,n);break;case`int32`:r=this.getInt32(t,n);break;case`uint8`:r=this.getUint8(t);break;case`uint16`:r=this.getUint16(t,n);break;case`uint32`:r=this.getUint32(t,n);break;case`float32`:r=this.getFloat32(t,n);break;case`float64`:r=this.getFloat64(t,n);break;case`fixed`:r=this.readFixed(t,n);break;case`longDateTime`:r=this.readLongDateTime(t,n);break;case`char`:r=this.readChar(t);break}return this.cursor+=ya[e],r}readUint24(e=this.cursor){let[t,n,r]=this.readBytes(e,3);return(t<<16)+(n<<8)+r}readBytes(e,t){t??(t=e,e=this.cursor);let n=[];for(let r=0;r<t;++r)n.push(this.getUint8(e+r));return this.cursor=e+t,n}readString(e,t){let n=this.readBytes(e,t),r=``;for(let e=0,t=n.length;e<t;e++)r+=String.fromCharCode(n[e]);return r}readFixed(e,t){let n=this.readInt32(e,t)/65536;return Math.ceil(n*1e5)/1e5}readLongDateTime(e=this.cursor,t){let n=this.readUint32(e+4,t),r=new Date;return r.setTime(n*1e3+-20775456e5),r}readChar(e){return this.readString(e,1)}write(e,t,n=this.cursor,r=this.littleEndian){switch(e){case`int8`:this.setInt8(n,t);break;case`int16`:this.setInt16(n,t,r);break;case`int32`:this.setInt32(n,t,r);break;case`uint8`:this.setUint8(n,t);break;case`uint16`:this.setUint16(n,t,r);break;case`uint32`:this.setUint32(n,t,r);break;case`float32`:this.setFloat32(n,t,r);break;case`float64`:this.setFloat64(n,t,r);break;case`char`:this.writeChar(t,n);break;case`fixed`:this.writeFixed(t,n);break;case`longDateTime`:this.writeLongDateTime(t,n);break}return this.cursor+=ya[e],this}writeString(e=``,t=this.cursor){let n=e.replace(/[^\x00-\xFF]/g,`11`).length;this.seek(t);for(let t=0,n=e.length,r;t<n;++t)r=e.charCodeAt(t)||0,r>127?this.writeUint16(r):this.writeUint8(r);return this.cursor+=n,this}writeChar(e,t){return this.writeString(e,t)}writeFixed(e,t){return this.writeInt32(Math.round(e*65536),t),this}writeLongDateTime(e,t=this.cursor){let n=-20775456e5;e=e===void 0?n:typeof e.getTime==`function`?e.getTime():/^\d+$/.test(e)?+e:Date.parse(e);let r=Math.round((e-n)/1e3);return this.writeUint32(0,t),this.writeUint32(r,t+4),this}writeBytes(e,t=this.cursor){let n;if(Array.isArray(e)){n=e.length;for(let r=0;r<n;++r)this.setUint8(t+r,e[r])}else{let r=ma(e);n=r.byteLength;for(let e=0;e<n;++e)this.setUint8(t+e,r.getUint8(e))}return this.cursor=t+n,this}seek(e){return this.cursor=e,this}},xa=new WeakMap;function J(e){let t=typeof e==`object`?e:{type:e},{size:n=1,type:r}=t;return(e,i)=>{if(typeof i!=`string`)return;let a=xa.get(e);a||(a={columns:[],byteLength:0},xa.set(e,a));let o={...t,name:i,byteLength:n*ya[r],offset:t.offset??a.columns.reduce((e,t)=>e+t.byteLength,0)};a.columns.push(o),a.byteLength=a.columns.reduce((e,t)=>e+ya[t.type]*(t.size??1),0),Object.defineProperty(e.constructor.prototype,i,{get(){return this.view.readColumn(o)},set(e){this.view.writeColumn(o,e)},configurable:!0,enumerable:!0})}}var Sa=class{view;constructor(e,t,n,r){this.view=new ba(e,t,n,r)}},Ca=class extends Sa{get buffer(){return this.view.buffer}toBuffer(){return this.view.buffer.slice(this.view.byteOffset,this.view.byteOffset+this.view.byteLength)}toBlob(){return new Blob([new Uint8Array(this.view.buffer,this.view.byteOffset,this.view.byteLength)],{type:this.mimeType})}toFontFace(e){return new FontFace(e,this.view.buffer)}},wa=Object.defineProperty,Ta=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&wa(t,n,i),i},Ea=class e extends Ca{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=ga(r.fontFamily||``),a=i.length,o=ga(r.fontSubFamily||``),s=o.length,c=ga(r.version||``),l=c.length,u=ga(r.fullName||``),d=u.length,f=86+a+4+s+4+l+4+d+2+t.view.byteLength,p=new e(new ArrayBuffer(f),0,f,!0);p.EOTSize=p.view.byteLength,p.FontDataSize=t.view.byteLength,p.Version=131073,p.Flags=0,p.Charset=1,p.MagicNumber=20556,p.Padding1=0,p.CheckSumAdjustment=n.head.checkSumAdjustment;let m=n.os2;return m&&(p.FontPANOSE=m.fontPANOSE,p.Italic=m.fsSelection,p.Weight=m.usWeightClass,p.fsType=m.fsType,p.UnicodeRange=m.ulUnicodeRange,p.CodePageRange=m.version>0?m.ulCodePageRange:[]),p.view.seek(82),p.view.writeUint16(a),p.view.writeBytes(i),p.view.writeUint16(0),p.view.writeUint16(s),p.view.writeBytes(o),p.view.writeUint16(0),p.view.writeUint16(l),p.view.writeBytes(c),p.view.writeUint16(0),p.view.writeUint16(d),p.view.writeBytes(u),p.view.writeUint16(0),p.view.writeUint16(0),p.view.writeBytes(t.view),p}};Ta([J(`uint32`)],Ea.prototype,`EOTSize`),Ta([J(`uint32`)],Ea.prototype,`FontDataSize`),Ta([J(`uint32`)],Ea.prototype,`Version`),Ta([J(`uint32`)],Ea.prototype,`Flags`),Ta([J({type:`uint8`,size:10})],Ea.prototype,`FontPANOSE`),Ta([J(`uint8`)],Ea.prototype,`Charset`),Ta([J(`uint8`)],Ea.prototype,`Italic`),Ta([J(`uint32`)],Ea.prototype,`Weight`),Ta([J(`uint16`)],Ea.prototype,`fsType`),Ta([J(`uint16`)],Ea.prototype,`MagicNumber`),Ta([J({type:`uint32`,size:4})],Ea.prototype,`UnicodeRange`),Ta([J({type:`uint8`,size:8})],Ea.prototype,`CodePageRange`),Ta([J(`uint32`)],Ea.prototype,`CheckSumAdjustment`),Ta([J({type:`uint8`,size:16})],Ea.prototype,`Reserved`),Ta([J(`uint16`)],Ea.prototype,`Padding1`);var Da=Object.defineProperty,Oa=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Da(t,n,i),i},ka=class extends Sa{constructor(e,t){super(e,t,16)}};Oa([J({type:`char`,size:4})],ka.prototype,`tag`),Oa([J(`uint32`)],ka.prototype,`checkSum`),Oa([J(`uint32`)],ka.prototype,`offset`),Oa([J(`uint32`)],ka.prototype,`length`);var Aa=`................................space.exclam.quotedbl.numbersign.dollar.percent.ampersand.quoteright.parenleft.parenright.asterisk.plus.comma.hyphen.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.at.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.bracketleft.backslash.bracketright.asciicircum.underscore.quoteleft.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.braceleft.bar.braceright.asciitilde...................................exclamdown.cent.sterling.fraction.yen.florin.section.currency.quotesingle.quotedblleft.guillemotleft.guilsinglleft.guilsinglright.fi.fl..endash.dagger.daggerdbl.periodcentered..paragraph.bullet.quotesinglbase.quotedblbase.quotedblright.guillemotright.ellipsis.perthousand..questiondown..grave.acute.circumflex.tilde.macron.breve.dotaccent.dieresis..ring.cedilla..hungarumlaut.ogonek.caron.emdash.................AE..ordfeminine.....Lslash.Oslash.OE.ordmasculine......ae....dotlessi...lslash.oslash.oe.germandbls`.split(`.`),ja=`................................space.exclamsmall.Hungarumlautsmall..dollaroldstyle.dollarsuperior.ampersandsmall.Acutesmall.parenleftsuperior.parenrightsuperior.twodotenleader.onedotenleader.comma.hyphen.period.fraction.zerooldstyle.oneoldstyle.twooldstyle.threeoldstyle.fouroldstyle.fiveoldstyle.sixoldstyle.sevenoldstyle.eightoldstyle.nineoldstyle.colon.semicolon.commasuperior.threequartersemdash.periodsuperior.questionsmall..asuperior.bsuperior.centsuperior.dsuperior.esuperior...isuperior...lsuperior.msuperior.nsuperior.osuperior...rsuperior.ssuperior.tsuperior..ff.fi.fl.ffi.ffl.parenleftinferior..parenrightinferior.Circumflexsmall.hyphensuperior.Gravesmall.Asmall.Bsmall.Csmall.Dsmall.Esmall.Fsmall.Gsmall.Hsmall.Ismall.Jsmall.Ksmall.Lsmall.Msmall.Nsmall.Osmall.Psmall.Qsmall.Rsmall.Ssmall.Tsmall.Usmall.Vsmall.Wsmall.Xsmall.Ysmall.Zsmall.colonmonetary.onefitted.rupiah.Tildesmall...................................exclamdownsmall.centoldstyle.Lslashsmall...Scaronsmall.Zcaronsmall.Dieresissmall.Brevesmall.Caronsmall..Dotaccentsmall...Macronsmall...figuredash.hypheninferior...Ogoneksmall.Ringsmall.Cedillasmall....onequarter.onehalf.threequarters.questiondownsmall.oneeighth.threeeighths.fiveeighths.seveneighths.onethird.twothirds...zerosuperior.onesuperior.twosuperior.threesuperior.foursuperior.fivesuperior.sixsuperior.sevensuperior.eightsuperior.ninesuperior.zeroinferior.oneinferior.twoinferior.threeinferior.fourinferior.fiveinferior.sixinferior.seveninferior.eightinferior.nineinferior.centinferior.dollarinferior.periodinferior.commainferior.Agravesmall.Aacutesmall.Acircumflexsmall.Atildesmall.Adieresissmall.Aringsmall.AEsmall.Ccedillasmall.Egravesmall.Eacutesmall.Ecircumflexsmall.Edieresissmall.Igravesmall.Iacutesmall.Icircumflexsmall.Idieresissmall.Ethsmall.Ntildesmall.Ogravesmall.Oacutesmall.Ocircumflexsmall.Otildesmall.Odieresissmall.OEsmall.Oslashsmall.Ugravesmall.Uacutesmall.Ucircumflexsmall.Udieresissmall.Yacutesmall.Thornsmall.Ydieresissmall`.split(`.`),Ma=class{index;name;isComposite=!1;components=[];pathCommands=[];constructor(e){let t={...e};if(this.index=t.index??0,t.name===`.notdef`?t.unicode=void 0:t.name===`.null`&&(t.unicode=0),t.unicode===0&&t.name!==`.null`)throw Error(`The unicode value "0" is reserved for the glyph name ".null" and cannot be used by any other glyph.`);this.name=t.name??null,t.unicode&&(this.unicode=t.unicode),t.unicodes?this.unicodes=t.unicodes:t.unicode&&(this.unicodes=[t.unicode])}getPathCommands(e=0,t=0,n=72,r={},i){let a=1/(i?.unitsPerEm??1e3)*n,{xScale:o=a,yScale:s=a}=r,c=this.pathCommands,l=[];for(let n=0,r=c.length;n<r;n+=1){let r=c[n];r.type===`M`?l.push({type:`M`,x:e+r.x*o,y:t+-r.y*s}):r.type===`L`?l.push({type:`L`,x:e+r.x*o,y:t+-r.y*s}):r.type===`Q`?l.push({type:`Q`,x1:e+r.x1*o,y1:t+-r.y1*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`C`?l.push({type:`C`,x1:e+r.x1*o,y1:t+-r.y1*s,x2:e+r.x2*o,y2:t+-r.y2*s,x:e+r.x*o,y:t+-r.y*s}):r.type===`Z`&&l.push({type:`Z`})}return l}getPathData(e=0,t=0,n=72,r={},i,a=2){return Na(this.getPathCommands(e,t,n,r,i),a)}};function Na(e,t=2){let n=e=>String(Number(e.toFixed(t))),r=``;for(let t=0;t<e.length;t++){let i=e[t];switch(i.type){case`M`:r+=`M${n(i.x)} ${n(i.y)}`;break;case`L`:r+=`L${n(i.x)} ${n(i.y)}`;break;case`Q`:r+=`Q${n(i.x1)} ${n(i.y1)} ${n(i.x)} ${n(i.y)}`;break;case`C`:r+=`C${n(i.x1)} ${n(i.y1)} ${n(i.x2)} ${n(i.y2)} ${n(i.x)} ${n(i.y)}`;break;case`Z`:r+=`Z`;break}}return r}var Pa=class extends Ma{parse(e,t,n){let r=this,{nominalWidthX:i,defaultWidthX:a,gsubrsBias:o,subrsBias:s}=e,c=e.topDict.paintType,l=this.index,u,d,f,p,m=[],h=[],g=0,_=!1,v=!1,y=a,b=0,x=0;function S(e,t){m.push({type:`L`,x:e,y:t})}function C(e,t,n,r,i,a){m.push({type:`C`,x1:e,y1:t,x2:n,y2:r,x:i,y:a})}function w(e,t){v&&c!==2&&T(),v=!0,m.push({type:`M`,x:e,y:t})}function T(){m.push({type:`Z`})}function E(e){m.push(...e)}function D(){h.length%2!=0&&!_&&(y=h.shift()+i),g+=h.length>>1,h.length=0,_=!0}function O(t){let a,m,k,A,j,M,N,P,F,I,L,R,z=0;for(;z<t.length;){let B=t[z++];switch(B){case 1:D();break;case 3:D();break;case 4:h.length>1&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),w(b,x);break;case 5:for(;h.length>0;)b+=h.shift(),x+=h.shift(),S(b,x);break;case 6:for(;h.length>0&&(b+=h.shift(),S(b,x),h.length!==0);)x+=h.shift(),S(b,x);break;case 7:for(;h.length>0&&(x+=h.shift(),S(b,x),h.length!==0);)b+=h.shift(),S(b,x);break;case 8:for(;h.length>0;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 10:j=h.pop()+s,M=e.subrs[j],M&&O(M);break;case 11:return;case 12:switch(B=t[z],z+=1,B){case 35:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),x=R+h.shift(),h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 34:u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=x,b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 36:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p,F=N+h.shift(),I=p,L=F+h.shift(),R=I+h.shift(),b=L+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;case 37:u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),N=f+h.shift(),P=p+h.shift(),F=N+h.shift(),I=P+h.shift(),L=F+h.shift(),R=I+h.shift(),Math.abs(L-b)>Math.abs(R-x)?b=L+h.shift():x=R+h.shift(),C(u,d,f,p,N,P),C(F,I,L,R,b,x);break;default:console.warn(`Glyph ${l}: unknown operator ${1200+B}`),h.length=0}break;case 14:if(h.length>=4){let t=Aa[h.pop()],i=Aa[h.pop()],a=h.pop(),o=h.pop();if(t&&i){r.isComposite=!0,r.components=[];let s=e.charset.indexOf(t),c=e.charset.indexOf(i);r.components.push({glyphIndex:c,dx:0,dy:0}),r.components.push({glyphIndex:s,dx:o,dy:a}),E(n.get(c).pathCommands);let l=JSON.parse(JSON.stringify(n.get(s).pathCommands));for(let e=0;e<l.length;e+=1){let t=l[e];t.type!==`Z`&&(t.x+=o,t.y+=a),(t.type===`Q`||t.type===`C`)&&(t.x1+=o,t.y1+=a),t.type===`C`&&(t.x2+=o,t.y2+=a)}E(l)}}else h.length>0&&!_&&(y=h.shift()+i,_=!0);v&&c!==2&&(T(),v=!1);break;case 18:D();break;case 19:case 20:D(),z+=g+7>>3;break;case 21:h.length>2&&!_&&(y=h.shift()+i,_=!0),x+=h.pop(),b+=h.pop(),w(b,x);break;case 22:h.length>1&&!_&&(y=h.shift()+i,_=!0),b+=h.pop(),w(b,x);break;case 23:D();break;case 24:for(;h.length>2;)u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);b+=h.shift(),x+=h.shift(),S(b,x);break;case 25:for(;h.length>6;)b+=h.shift(),x+=h.shift(),S(b,x);u=b+h.shift(),d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+h.shift(),C(u,d,f,p,b,x);break;case 26:for(h.length%2&&(b+=h.shift());h.length>0;)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f,x=p+h.shift(),C(u,d,f,p,b,x);break;case 27:for(h.length%2&&(x+=h.shift());h.length>0;)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p,C(u,d,f,p,b,x);break;case 28:a=t[z],m=t[z+1],h.push((a<<24|m<<16)>>16),z+=2;break;case 29:j=h.pop()+o,M=e.gsubrs[j],M&&O(M);break;case 30:for(;h.length>0&&(u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;case 31:for(;h.length>0&&(u=b+h.shift(),d=x,f=u+h.shift(),p=d+h.shift(),x=p+h.shift(),b=f+(h.length===1?h.shift():0),C(u,d,f,p,b,x),h.length!==0);)u=b,d=x+h.shift(),f=u+h.shift(),p=d+h.shift(),b=f+h.shift(),x=p+(h.length===1?h.shift():0),C(u,d,f,p,b,x);break;default:B<32?console.warn(`Glyph ${l}: unknown operator ${B}`):B<247?h.push(B-139):B<251?(a=t[z],z+=1,h.push((B-247)*256+a+108)):B<255?(a=t[z],z+=1,h.push(-(B-251)*256-a-108)):(a=t[z],m=t[z+1],k=t[z+2],A=t[z+3],z+=4,h.push((a<<24|m<<16|k<<8|A)/65536))}}}O(t),this.pathCommands=m,_&&(this.advanceWidth=y)}},Fa=class{constructor(e){this._sfnt=e}_items=[];get(e){let t=this._items[e],n;if(t)n=t;else{n=this._get(e);let t=this._sfnt.hmtx.metrics[e];t&&(n.advanceWidth=n.advanceWidth||t.advanceWidth,n.leftSideBearing=n.leftSideBearing||t.leftSideBearing);let r=this._sfnt.vmtx?.metrics[e];r&&(n.advanceHeight=n.advanceHeight||r.advanceHeight,n.topSideBearing=n.topSideBearing||r.topSideBearing);let i=this._sfnt.cmap.glyphIndexToUnicodesMap.get(e);if(i&&(n.unicode??=i[0],n.unicodes??=i),n.name==null){let t=this._sfnt.post?.getGlyphName(e);t&&(n.name=t)}this._items[e]=n}return n}},Ia=class extends Fa{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new Pa({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},La=Object.defineProperty,Ra=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&La(t,n,i),i},za=class extends Sa{_offsets;get offsets(){return this._offsets??=this.readOffsets()}_objects;get objects(){return this._objects??=this.readObjects()}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let e=this.view,t=this.count,n=this.offsetSize;this.objectOffset=(t+1)*n+2,this.endOffset=e.byteOffset+this.objectOffset+this.offsets[t]}readOffsets(){let e=this.view,t=this.count,n=this.offsetSize;e.seek(3);let r=[];for(let e=0,i=t+1;e<i;e++){let e=this.view,t=0;for(let r=0;r<n;r++)t<<=8,t+=e.readUint8();r.push(t)}return r}readObjects(){let e=[];for(let t=0,n=this.count;t<n;t++)e.push(this.get(t));return e}get(e){let t=this.offsets,n=this.objectOffset,r=n+t[e],i=n+t[e+1]-r;return this._isString?this.view.readString(r,i):this.view.readBytes(r,i)}};Ra([J(`uint16`)],za.prototype,`count`),Ra([J(`uint8`)],za.prototype,`offsetSize`);var Ba=class extends za{_isString=!1},Va=class extends za{_isString=!0},Ha=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,266 ff,onedotenleader,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall,001.000,001.001,001.002,001.003,Black,Bold,Book,Light,Medium,Regular,Roman,Semibold`.split(`,`),Ua=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron`.split(`,`),Wa=`.notdef,space,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,twodotenleader,onedotenleader,comma,hyphen,period,fraction,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,colon,semicolon,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,fi,fl,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,onequarter,onehalf,threequarters,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,onesuperior,twosuperior,threesuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall`.split(`,`),Ga=`.notdef,space,dollaroldstyle,dollarsuperior,parenleftsuperior,parenrightsuperior,twodotenleader,onedotenleader,comma,hyphen,period,fraction,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,colon,semicolon,commasuperior,threequartersemdash,periodsuperior,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,fi,fl,ffi,ffl,parenleftinferior,parenrightinferior,hyphensuperior,colonmonetary,onefitted,rupiah,centoldstyle,figuredash,hypheninferior,onequarter,onehalf,threequarters,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,onesuperior,twosuperior,threesuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior`.split(`,`);function Ka(e,t){return t<=390?Ha[t]:e[t-391]}function Y(e,t=`number`,n){return(r,i)=>{if(typeof i!=`string`)return;let a={type:t,operator:e,default:n};Object.defineProperty(r.constructor.prototype,i,{get(){return this._getProp(a)},set(e){this._setProp(a,e)},configurable:!0,enumerable:!0})}}var qa=class extends Sa{_dict;get dict(){return this._dict??=this._readDict()}_stringIndex;setStringIndex(e){return this._stringIndex=e,this}_readFloatOperand(){let e=this.view,t=``,n=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`.`,`E`,`E-`,null,`-`];for(;;){let r=e.readUint8(),i=r>>4,a=r&15;if(i===15||(t+=n[i],a===15))break;t+=n[a]}return Number.parseFloat(t)}_readOperand(e){let t=this.view,n,r,i,a;if(e===28)return n=t.readUint8(),r=t.readUint8(),n<<8|r;if(e===29)return n=t.readUint8(),r=t.readUint8(),i=t.readUint8(),a=t.readUint8(),n<<24|r<<16|i<<8|a;if(e===30)return this._readFloatOperand();if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return n=t.readUint8(),(e-247)*256+n+108;if(e>=251&&e<=254)return n=t.readUint8(),-(e-251)*256-n-108;throw Error(`invalid b0 ${e}, at: ${t.cursor}`)}_readDict(){let e=this.view;e.seek(0);let t=[],n=e.cursor+e.byteLength,r={};for(;e.cursor<n;){let n=e.readUint8();n<=21?(n===12&&(n=1200+e.readUint8()),r[n]=t,t=[]):t.push(this._readOperand(n))}return r}_getProp(e){let t=this.dict[e.operator];switch(e.type){case`number`:return t?t[0]:e.default??0;case`string`:return t?Ka(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},Ja=Object.defineProperty,Ya=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Ja(t,n,i),i},Xa=class extends qa{};Ya([Y(19)],Xa.prototype,`subrs`),Ya([Y(20)],Xa.prototype,`defaultWidthX`),Ya([Y(21)],Xa.prototype,`nominalWidthX`);var Za=Object.defineProperty,X=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Za(t,n,i),i},Z=class extends qa{};X([Y(0,`string`)],Z.prototype,`version`),X([Y(1,`string`)],Z.prototype,`notice`),X([Y(1200,`string`)],Z.prototype,`copyright`),X([Y(2,`string`)],Z.prototype,`fullName`),X([Y(3,`string`)],Z.prototype,`familyName`),X([Y(4,`string`)],Z.prototype,`weight`),X([Y(1201)],Z.prototype,`isFixedPitch`),X([Y(1202)],Z.prototype,`italicAngle`),X([Y(1203,`number`,-100)],Z.prototype,`underlinePosition`),X([Y(1204,`number`,50)],Z.prototype,`underlineThickness`),X([Y(1205)],Z.prototype,`paintType`),X([Y(1206,`number`,2)],Z.prototype,`charstringType`),X([Y(1207,`number[]`,[.001,0,0,.001,0,0])],Z.prototype,`fontMatrix`),X([Y(13)],Z.prototype,`uniqueId`),X([Y(5,`number[]`,[0,0,0,0])],Z.prototype,`fontBBox`),X([Y(1208)],Z.prototype,`strokeWidth`),X([Y(14)],Z.prototype,`xuid`),X([Y(15)],Z.prototype,`charset`),X([Y(16)],Z.prototype,`encoding`),X([Y(17)],Z.prototype,`charStrings`),X([Y(18,`number[]`,[0,0])],Z.prototype,`private`);function Qa(e,t=e){return n=>{$a.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty($a.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var $a=class e{static tableDefinitions=new Map;tables=new Map;tableViews=new Map;_viewLoaders=new Map;get tableTags(){return[...new Set([...this.tableViews.keys(),...this._viewLoaders.keys()])]}hasTable(e){return this.tableViews.has(e)||this._viewLoaders.has(e)}getTableView(e){let t=this.tableViews.get(e);if(!t){let n=this._viewLoaders.get(e);n&&(t=n(),this.tableViews.set(e,t),this._viewLoaders.delete(e))}return t}get hasGlyf(){return this.hasTable(`glyf`)}get names(){return this.name.names}get unitsPerEm(){return this.head.unitsPerEm}get ascender(){return this.hhea.ascent}get descender(){return this.hhea.descent}get createdTimestamp(){return this.head.created}get modifiedTimestamp(){return this.head.modified}get numGlyphs(){return this.maxp.numGlyphs}get unicodes(){return this.cmap.glyphIndexToUnicodesMap}get glyphs(){return this.hasGlyf?this.glyf.glyphs:this.cff.glyphs}get defaultAdvanceHeight(){return this.ascender+Math.abs(this.descender)}charToGlyphIndex(e){let t=this.cmap.unicodeToGlyphIndexMap.get(e.codePointAt(0));if(t===void 0&&!this.hasGlyf){let{encoding:n,charset:r}=this.cff;t=r.indexOf(n[e.codePointAt(0)])}return t??0}charToGlyph(e){return this.glyphs.get(this.charToGlyphIndex(e))}getSubstituteGlyphIndex(e,t){return this.gsub?.getSingleSubstitutions(t).get(e)??e}applyLigatures(e,t=`liga`){let n=this.gsub?.getLigatures(t);if(!n||!n.size)return e.slice();let r=[];for(let t=0;t<e.length;){let i=n.get(e[t]),a=!1;if(i)for(let n of i){let i=n.components.length,o=!0;for(let r=0;r<i;r++)if(e[t+1+r]!==n.components[r]){o=!1;break}if(o){r.push(n.ligatureGlyph),t+=i+1,a=!0;break}}a||(r.push(e[t]),t++)}return r}textToGlyphIndexes(e){let t=[];for(let n of e)t.push(this.charToGlyphIndex(n));return t}textToGlyphs(e){let t=this.glyphs,n=this.textToGlyphIndexes(e),r=n.length,i=Array.from({length:r}),a=t.get(0);for(let e=0;e<r;e+=1)i[e]=t.get(n[e])||a;return i}getPathCommands(e,t,n,r,i){let a=[];return this.forEachGlyph(e,t,n,r,i,(e,t,n,r,i)=>{a.push(...e.getPathCommands(t,n,r,i,this))}),a}getPathData(e,t,n,r,i,a=2){return Na(this.getPathCommands(e,t,n,r,i),a)}getKerningValue(e,t){return(this.gpos?.getKerningValue(e,t)??0)||(this.kern?.getKerningValue(e,t)??0)}getAdvanceWidth(e,t,n){return this.forEachGlyph(e,0,0,t,n,()=>{})}getAdvanceHeight(e,t=72,n={}){let r=1/this.unitsPerEm*t,i=this.defaultAdvanceHeight,a=this.textToGlyphs(e),o=0;for(let e=0;e<a.length;e+=1)o+=(a[e].advanceHeight||i)*r,n.letterSpacing?o+=n.letterSpacing*t:n.tracking&&(o+=n.tracking/1e3*t);return o}forEachGlyph(e,t=0,n=0,r=72,i={},a){let o=1/this.unitsPerEm*r,s=this.textToGlyphs(e);for(let e=0;e<s.length;e+=1){let c=s[e];a.call(this,c,t,n,r,i),c.advanceWidth&&(t+=c.advanceWidth*o),i.letterSpacing?t+=i.letterSpacing*r:i.tracking&&(t+=i.tracking/1e3*r)}return t}constructor(e,t){e&&(e instanceof Map?e:new Map(Object.entries(e))).forEach((e,t)=>this.tableViews.set(t,e)),t?.forEach((e,t)=>this._viewLoaders.set(t,e))}clone(){let t=new Map;return this.tableTags.forEach(e=>{let n=this.getTableView(e);t.set(e,new DataView(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)))}),new e(t)}delete(t){let n=e.tableDefinitions.get(t);return n?(this.tableViews.delete(t),this._viewLoaders.delete(t),this.tables.delete(n.prop),this):this}set(t,n){let r=e.tableDefinitions.get(t);return r&&this.tables.set(r.prop,n),this.tableViews.set(t,n.view),this._viewLoaders.delete(t),this}get(t){let n=e.tableDefinitions.get(t);if(!n)return;let r=this.tables.get(n.prop);if(!r){let e=n.class;if(e){let i=this.getTableView(t);if(!i)return;r=new e(i.buffer,i.byteOffset,i.byteLength).setSFNT(this),this.tables.set(n.prop,r)}}return r}},eo=class extends Sa{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},to=Object.defineProperty,no=Object.getOwnPropertyDescriptor,ro=(e,t,n,r)=>{for(var i=r>1?void 0:r?no(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&to(t,n,i),i},io=class extends eo{_glyphs;get glyphs(){return this._glyphs??=new Ia(this._sfnt)}get gsubrs(){return this.globalSubrIndex.objects}get gsubrsBias(){return this._calcSubroutineBias(this.globalSubrIndex.objects)}privateDict;subrsIndex;get defaultWidthX(){return this.privateDict?.defaultWidthX??0}get nominalWidthX(){return this.privateDict?.nominalWidthX??0}get subrs(){return this.subrsIndex?.objects??[]}get subrsBias(){return this._calcSubroutineBias(this.subrs)}constructor(e,t,n,r){super(e,t,n,r),this._init()}_init(){let{buffer:e,byteOffset:t}=this.view,n=t+4;this.nameIndex=new Va(e,n),this.topDictIndex=new Ba(e,this.nameIndex.endOffset),this.stringIndex=new Va(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ba(e,this.stringIndex.endOffset),this.topDict=new Z(new Uint8Array(this.topDictIndex.objects[0]).buffer).setStringIndex(this.stringIndex);let r=this.topDict.private[0],i=this.topDict.private[1];r&&(this.privateDict=new Xa(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ba(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new Ba(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ua:this.topDict.charset===1?this.charset=Wa:this.topDict.charset===2?this.charset=Ga:this.charset=this._readCharset(t+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Aa:this.topDict.encoding===1?this.encoding=ja:this.encoding=this._readEncoding(t+this.topDict.encoding)}_readCharset(e,t,n){let r=this.view;r.seek(e);let i,a,o;--t;let s=[`.notdef`],c=r.readUint8();if(c===0)for(i=0;i<t;i+=1)a=r.readUint16(),s.push(Ka(n,a));else if(c===1)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint8(),i=0;i<=o;i+=1)s.push(Ka(n,a)),a+=1;else if(c===2)for(;s.length<=t;)for(a=r.readUint16(),o=r.readUint16(),i=0;i<=o;i+=1)s.push(Ka(n,a)),a+=1;else throw Error(`Unknown charset format ${c}`);return s}_readEncoding(e){let t=this.view;t.seek(e);let n,r,i={},a=t.readUint8();if(a===0){let e=t.readUint8();for(n=0;n<e;n+=1)r=t.readUint8(),i[r]=n}else if(a===1){let e=t.readUint8();for(r=1,n=0;n<e;n+=1){let e=t.readUint8(),n=t.readUint8();for(let t=e;t<=e+n;t+=1)i[t]=r,r+=1}}else console.warn(`unknown encoding format:${a}`);return i}blankGlyphsExcept(e){let t=this.charStringsIndex.offsets,n=t.length-1,r=this.topDict.charStrings+this.charStringsIndex.objectOffset;for(let i=0;i<n;i++){if(e.has(i))continue;let n=r+t[i+1];for(let e=r+t[i];e<n;e++)this.view.setUint8(e,14)}return this}_calcSubroutineBias(e){let t;return t=e.length<1240?107:e.length<33900?1131:32768,t}};ro([J(`uint8`)],io.prototype,`majorVersion`,2),ro([J(`uint8`)],io.prototype,`minorVersion`,2),ro([J(`uint8`)],io.prototype,`headerSize`,2),ro([J(`uint8`)],io.prototype,`offsetSize`,2),io=ro([Qa(`CFF `,`cff`)],io);var ao=Object.defineProperty,oo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ao(t,n,i),i},so=class e extends Sa{constructor(e=new ArrayBuffer(262),t){super(e,t,262)}static from(t){let n=new e;return n.format=0,n.length=n.view.byteLength,n.language=0,t.forEach((e,t)=>{t<256&&e<256&&n.view.writeUint8(e,6+t)}),n}getUnicodeToGlyphIndexMap(){let e=new Map;return this.glyphIndexArray.forEach((t,n)=>{e.set(n,t)}),e}};oo([J(`uint16`)],so.prototype,`format`),oo([J(`uint16`)],so.prototype,`length`),oo([J(`uint16`)],so.prototype,`language`),oo([J({type:`uint8`,size:256})],so.prototype,`glyphIndexArray`);var co=so,lo=Object.defineProperty,uo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&lo(t,n,i),i},fo=class extends Sa{get subHeaderKeys(){return this.view.seek(6),Array.from({length:256},()=>this.view.readUint16()/8)}get maxSubHeaderKey(){return this.subHeaderKeys.reduce((e,t)=>Math.max(e,t),0)}get subHeaders(){let e=this.maxSubHeaderKey;return this.view.seek(518),Array.from({length:e},(t,n)=>({firstCode:this.view.readUint16(),entryCount:this.view.readUint16(),idDelta:this.view.readUint16(),idRangeOffset:(this.view.readUint16()-(e-n)*8-2)/2}))}get glyphIndexArray(){let e=518+this.maxSubHeaderKey*8;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}getUnicodeToGlyphIndexMap(e){let t=new Map,n=this.subHeaderKeys,r=this.maxSubHeaderKey,i=this.subHeaders,a=this.glyphIndexArray,o=n.findIndex(e=>e===r),s=0;for(let r=0;r<256;r++)if(n[r]===0)r>=o||r<i[0].firstCode||r>=i[0].firstCode+i[0].entryCount||i[0].idRangeOffset+(r-i[0].firstCode)>=a.length?s=0:(s=a[i[0].idRangeOffset+(r-i[0].firstCode)],s!==0&&(s+=i[0].idDelta)),s!==0&&s<e&&t.set(r,s);else{let o=n[r];for(let n=0,c=i[o].entryCount;n<c;n++)if(i[o].idRangeOffset+n>=a.length?s=0:(s=a[i[o].idRangeOffset+n],s!==0&&(s+=i[o].idDelta)),s!==0&&s<e){let e=(r<<8|n+i[o].firstCode)&65535;t.set(e,s)}}return t}};uo([J(`uint16`)],fo.prototype,`format`),uo([J(`uint16`)],fo.prototype,`length`),uo([J(`uint16`)],fo.prototype,`language`);function po(e){return e>32767?e-65536:e<-32767?e+65536:e}function mo(e,t){let n,r=[],i={};return e.forEach((e,a)=>{t&&a>t||((!n||a!==n.unicode+1||e!==n.glyphIndex+1)&&(n?(i.end=n.unicode,r.push(i),i={start:a,startId:e,delta:po(e-a)}):(i.start=Number(a),i.startId=e,i.delta=po(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var ho=Object.defineProperty,go=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&ho(t,n,i),i},_o=class e extends Sa{get endCode(){let e=this.segCountX2;return this.view.seek(14),Array.from({length:e/2},()=>this.view.readUint16())}set endCode(e){this.view.seek(14),e.forEach(e=>this.view.writeUint16(e))}get reservedPad(){return this.view.readUint16(14+this.segCountX2)}set reservedPad(e){this.view.writeUint16(e,14+this.segCountX2)}get startCode(){let e=this.segCountX2;return this.view.seek(14+e+2),Array.from({length:e/2},()=>this.view.readUint16())}set startCode(e){this.view.seek(14+this.segCountX2+2),e.forEach(e=>this.view.writeUint16(e))}get idDelta(){let e=this.segCountX2;return this.view.seek(14+e+2+e),Array.from({length:e/2},()=>this.view.readUint16())}set idDelta(e){let t=this.segCountX2;this.view.seek(14+t+2+t),e.forEach(e=>this.view.writeUint16(e))}get idRangeOffsetCursor(){let e=this.segCountX2;return 14+e+2+e*2}get idRangeOffset(){let e=this.segCountX2;return this.view.seek(this.idRangeOffsetCursor),Array.from({length:e/2},()=>this.view.readUint16())}set idRangeOffset(e){this.view.seek(this.idRangeOffsetCursor),e.forEach(e=>this.view.writeUint16(e))}get glyphIndexArrayCursor(){let e=this.segCountX2;return 14+e+2+e*3}get glyphIndexArray(){let e=this.glyphIndexArrayCursor;this.view.seek(e);let t=(this.view.byteLength-e)/2;return Array.from({length:t},()=>this.view.readUint16())}static from(t){let n=mo(t,65535),r=n.length+1,i=Math.floor(Math.log(r)/Math.LN2),a=2*2**i,o=new e(new ArrayBuffer(24+n.length*8));return o.format=4,o.length=o.view.byteLength,o.language=0,o.segCountX2=r*2,o.searchRange=a,o.entrySelector=i,o.rangeShift=2*r-a,o.endCode=[...n.map(e=>e.end),65535],o.reservedPad=0,o.startCode=[...n.map(e=>e.start),65535],o.idDelta=[...n.map(e=>e.delta),1],o.idRangeOffset=Array.from({length:r},()=>0),o}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.segCountX2/2,n=(this.glyphIndexArrayCursor-this.idRangeOffsetCursor)/2,r=this.startCode,i=this.endCode,a=this.idRangeOffset,o=this.idDelta,s=this.glyphIndexArray;for(let c=0;c<t;++c)for(let t=r[c],l=i[c];t<=l;++t)if(a[c]===0)e.set(t,(t+o[c])%65536);else{let i=s[c+a[c]/2+(t-r[c])-n];i===0?e.set(t,0):e.set(t,(i+o[c])%65536)}return e.delete(65535),e}};go([J(`uint16`)],_o.prototype,`format`),go([J(`uint16`)],_o.prototype,`length`),go([J(`uint16`)],_o.prototype,`language`),go([J(`uint16`)],_o.prototype,`segCountX2`),go([J(`uint16`)],_o.prototype,`searchRange`),go([J(`uint16`)],_o.prototype,`entrySelector`),go([J(`uint16`)],_o.prototype,`rangeShift`);var vo=_o,yo=Object.defineProperty,bo=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&yo(t,n,i),i},xo=class extends Sa{get glyphIndexArray(){let e=this.entryCount;return Array.from({length:e},(e,t)=>this.view.readUint16(10+t*2))}getUnicodeToGlyphIndexMap(){let e=this.glyphIndexArray,t=this.firstCode,n=new Map;return e.forEach((e,r)=>{n.set(t+r,e)}),n}};bo([J(`uint16`)],xo.prototype,`format`),bo([J(`uint16`)],xo.prototype,`length`),bo([J(`uint16`)],xo.prototype,`language`),bo([J(`uint16`)],xo.prototype,`firstCode`),bo([J(`uint16`)],xo.prototype,`entryCount`);var So=Object.defineProperty,Co=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&So(t,n,i),i},wo=class e extends Sa{get groups(){let e=this.nGroups;return this.view.seek(16),Array.from({length:e},()=>({startCharCode:this.view.readUint32(),endCharCode:this.view.readUint32(),startGlyphCode:this.view.readUint32()}))}static from(t){let n=mo(t),r=new e(new ArrayBuffer(16+n.length*12));return r.format=12,r.reserved=0,r.length=r.view.byteLength,r.language=0,r.nGroups=n.length,n.forEach(e=>{r.view.writeUint32(e.start),r.view.writeUint32(e.end),r.view.writeUint32(e.startId)}),r}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.groups;for(let n=0,r=t.length;n<r;n++){let r=t[n],i=r.startGlyphCode,a=r.startCharCode,o=r.endCharCode;for(;a<=o;)e.set(a++,i++)}return e}};Co([J(`uint16`)],wo.prototype,`format`),Co([J(`uint16`)],wo.prototype,`reserved`),Co([J(`uint32`)],wo.prototype,`length`),Co([J(`uint32`)],wo.prototype,`language`),Co([J(`uint32`)],wo.prototype,`nGroups`);var To=wo,Eo=Object.defineProperty,Do=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Eo(t,n,i),i},Oo=class extends Sa{getVarSelectorRecords(){let e=this.numVarSelectorRecords;return this.view.seek(10),Array.from({length:e},()=>{let e={varSelector:this.view.readUint24(),defaultUVSOffset:this.view.readUint32(),unicodeValueRanges:[],nonDefaultUVSOffset:this.view.readUint32(),uVSMappings:[]};if(e.defaultUVSOffset){this.view.seek(e.defaultUVSOffset);let t=this.view.readUint32();e.unicodeValueRanges=Array.from({length:t},()=>({startUnicodeValue:this.view.readUint24(),additionalCount:this.view.readUint8()}))}if(e.nonDefaultUVSOffset){this.view.seek(e.nonDefaultUVSOffset);let t=this.view.readUint32();e.uVSMappings=Array.from({length:t},()=>({unicodeValue:this.view.readUint24(),glyphID:this.view.readUint16()}))}return e})}getUnicodeToGlyphIndexMap(){let e=new Map,t=this.getVarSelectorRecords();for(let n=0,r=t.length;n<r;n++){let{uVSMappings:r}=t[n];r.forEach(t=>{e.set(t.unicodeValue,t.glyphID)})}return e}};Do([J(`uint16`)],Oo.prototype,`format`),Do([J(`uint32`)],Oo.prototype,`length`),Do([J(`uint32`)],Oo.prototype,`numVarSelectorRecords`);var ko=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,jo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ao(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ko(t,n,i),i},Mo=class extends eo{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=vo.from(e),r=co.from(e),i=t?To.from(e):void 0,a=4+(i?32:24),o=a+n.view.byteLength,s=o+r.view.byteLength,c=[{platformID:0,platformSpecificID:3,offset:a},{platformID:1,platformSpecificID:0,offset:o},{platformID:3,platformSpecificID:1,offset:a},i&&{platformID:3,platformSpecificID:10,offset:s}].filter(Boolean),l=new Mo(new ArrayBuffer(4+8*c.length+n.view.byteLength+r.view.byteLength+(i?.view.byteLength??0)));return l.numberSubtables=c.length,l.view.seek(4),c.forEach(e=>{l.view.writeUint16(e.platformID),l.view.writeUint16(e.platformSpecificID),l.view.writeUint32(e.offset)}),l.view.writeBytes(n.view,a),l.view.writeBytes(r.view,o),i&&l.view.writeBytes(i.view,s),l}_unicodeToGlyphIndexMap;get unicodeToGlyphIndexMap(){return this._unicodeToGlyphIndexMap??=this.readunicodeToGlyphIndexMap()}_glyphIndexToUnicodesMap;get glyphIndexToUnicodesMap(){if(!this._glyphIndexToUnicodesMap){let e=new Map,t=this.unicodeToGlyphIndexMap,n=Array.from(t.keys());for(let r=0,i=n.length;r<i;r++){let i=n[r],a=t.get(i);e.has(a)?e.get(a).push(i):e.set(a,[i])}this._glyphIndexToUnicodesMap=e}return this._glyphIndexToUnicodesMap}readSubtables(){let e=this.numberSubtables;return this.view.seek(4),Array.from({length:e},()=>({platformID:this.view.readUint16(),platformSpecificID:this.view.readUint16(),offset:this.view.readUint32()})).map(e=>{this.view.seek(e.offset);let t=this.view.readUint16(),n;switch(t){case 0:n=new co(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new fo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new vo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new xo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new To(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new Oo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32());break}return{...e,format:t,view:n}})}readunicodeToGlyphIndexMap(){let e=this.readSubtables(),t=e.find(e=>e.format===0)?.view,n=e.find(e=>e.platformID===3&&e.platformSpecificID===3&&e.format===2)?.view,r=e.find(e=>e.platformID===3&&e.platformSpecificID===1&&e.format===4)?.view,i=e.find(e=>e.platformID===3&&e.platformSpecificID===10&&e.format===12)?.view,a=e.find(e=>e.platformID===0&&e.platformSpecificID===5&&e.format===14)?.view;return new Map([...t?.getUnicodeToGlyphIndexMap()??[],...n?.getUnicodeToGlyphIndexMap(this._sfnt.maxp.numGlyphs)??[],...r?.getUnicodeToGlyphIndexMap()??[],...i?.getUnicodeToGlyphIndexMap()??[],...a?.getUnicodeToGlyphIndexMap()??[]])}};jo([J(`uint16`)],Mo.prototype,`version`,2),jo([J(`uint16`)],Mo.prototype,`numberSubtables`,2),Mo=jo([Qa(`cmap`)],Mo);var No=class extends Ma{_parseContours(e){let t=[],n=[];for(let r=0;r<e.length;r+=1){let i=e[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return fa(n.length===0,`There are still points left in the current contour.`),t}_transformPoints(e,t){let n=[];for(let r=0;r<e.length;r+=1){let i=e[r],a={x:t.xScale*i.x+t.scale10*i.y+t.dx,y:t.scale01*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(a)}return n}_parseGlyphCoordinate(e,t,n,r,i){let a;return(t&r)>0?(a=e.view.readUint8(),(t&i)===0&&(a=-a),a=n+a):a=(t&i)>0?n:n+e.view.readInt16(),a}parse(e,t,n){e.view.seek(t);let r=this.numberOfContours=e.view.readInt16();if(this.xMin=e.view.readInt16(),this.yMin=e.view.readInt16(),this.xMax=e.view.readInt16(),this.yMax=e.view.readInt16(),r>0){let t=this.endPointIndices=[];for(let n=0;n<r;n++)t.push(e.view.readUint16());let n=this.instructionLength=e.view.readUint16();fa(n<5e3,`Bad instructionLength:${n}`);let i=this.instructions=[];for(let t=0;t<n;++t)i.push(e.view.readUint8());let a=e.view.byteOffset,o=t[t.length-1]+1;fa(o<2e4,`Bad numberOfCoordinates:${a}`);let s=[],c,l=0;for(;l<o;)if(c=e.view.readUint8(),s.push(c),l++,c&8&&l<o){let t=e.view.readUint8();for(let e=0;e<t;e++)s.push(c),l++}if(fa(s.length===o,`Bad flags length: ${s.length}, numberOfCoordinates: ${o}`),t.length>0){let n=[],r;if(o>0){for(let e=0;e<o;e+=1)c=s[e],r={},r.onCurve=!!(c&1),r.lastPointOfContour=t.includes(e),n.push(r);let i=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.x=this._parseGlyphCoordinate(e,c,i,2,16),i=r.x;let a=0;for(let t=0;t<o;t+=1)c=s[t],r=n[t],r.y=this._parseGlyphCoordinate(e,c,a,4,32),a=r.y}this.points=n}else this.points=[]}else if(r===0)this.points=[];else{this.isComposite=!0,this.points=[],this.components=[];let t,n=!0;for(;n;){t=e.view.readUint16();let r={glyphIndex:e.view.readUint16(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(t&1)>0?(t&2)>0?(r.dx=e.view.readInt16(),r.dy=e.view.readInt16()):r.matchedPoints=[e.view.readUint16(),e.view.readUint16()]:(t&2)>0?(r.dx=e.view.readInt8(),r.dy=e.view.readInt8()):r.matchedPoints=[e.view.readUint8(),e.view.readUint8()],(t&8)>0?r.xScale=r.yScale=e.view.readInt16()/16384:(t&64)>0?(r.xScale=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384):(t&128)>0&&(r.xScale=e.view.readInt16()/16384,r.scale01=e.view.readInt16()/16384,r.scale10=e.view.readInt16()/16384,r.yScale=e.view.readInt16()/16384),this.components.push(r),n=!!(t&32)}if(t&256){this.instructionLength=e.view.readUint16(),this.instructions=[];for(let t=0;t<this.instructionLength;t+=1)this.instructions.push(e.view.readUint8())}}if(this.isComposite)for(let e=0;e<this.components.length;e+=1){let t=this.components[e],r=n.get(t.glyphIndex);if(r.getPathCommands(),r.points){let e;if(t.matchedPoints===void 0)e=this._transformPoints(r.points,t);else{fa(t.matchedPoints[0]>this.points.length-1||t.matchedPoints[1]>r.points.length-1,`Matched points out of range in ${this.name}`);let n=this.points[t.matchedPoints[0]],i=r.points[t.matchedPoints[1]],a={xScale:t.xScale,scale01:t.scale01,scale10:t.scale10,yScale:t.yScale,dx:0,dy:0};i=this._transformPoints([i],a)[0],a.dx=n.x-i.x,a.dy=n.y-i.y,e=this._transformPoints(r.points,a)}this.points=this.points.concat(e)}}let i=[],a=this._parseContours(this.points);for(let e=0,t=a.length;e<t;++e){let t=a[e],n=t[t.length-1],r=t[0];n.onCurve?i.push({type:`M`,x:n.x,y:n.y}):r.onCurve?i.push({type:`M`,x:r.x,y:r.y}):i.push({type:`M`,x:(n.x+r.x)*.5,y:(n.y+r.y)*.5});for(let e=0,a=t.length;e<a;++e)if(n=r,r=t[(e+1)%a],n.onCurve)i.push({type:`L`,x:n.x,y:n.y});else{let e=r;r.onCurve||(e={x:(n.x+r.x)*.5,y:(n.y+r.y)*.5}),i.push({type:`Q`,x1:n.x,y1:n.y,x:e.x,y:e.y})}i.push({type:`Z`})}this.pathCommands=i}},Po=class extends Fa{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new No({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Fo=Object.getOwnPropertyDescriptor,Io=(e,t,n,r)=>{for(var i=r>1?void 0:r?Fo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Lo=class extends eo{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Lo(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new Po(this._sfnt)}};Lo=Io([Qa(`glyf`)],Lo);function Ro(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function zo(e,t,n){if(!t)return[];let r=e.getUint16(t,!1),i=new Set;for(let a=0;a<r;a++){let r=t+2+a*6;if(Ro(e,r)!==n)continue;let o=t+e.getUint16(r+4,!1),s=e.getUint16(o+2,!1);for(let t=0;t<s;t++)i.add(e.getUint16(o+4+t*2,!1))}return[...i]}function Bo(e,t,n){if(!t||n>=e.getUint16(t,!1))return;let r=t+e.getUint16(t+2+n*2,!1),i=e.getUint16(r+4,!1),a=[];for(let t=0;t<i;t++)a.push(r+e.getUint16(r+6+t*2,!1));return{lookupType:e.getUint16(r,!1),lookupFlag:e.getUint16(r+2,!1),subtableOffsets:a}}function Vo(e,t){let n=e.getUint16(t,!1),r=[];if(n===1){let n=e.getUint16(t+2,!1);for(let i=0;i<n;i++)r.push(e.getUint16(t+4+i*2,!1))}else if(n===2){let n=e.getUint16(t+2,!1);for(let i=0;i<n;i++){let n=t+4+i*6,a=e.getUint16(n,!1),o=e.getUint16(n+2,!1),s=e.getUint16(n+4,!1);for(let e=a;e<=o;e++)r[s++]=e}}return r}function Ho(e,t){let n=new Map,r=e.getUint16(t,!1);if(r===1){let r=e.getUint16(t+2,!1),i=e.getUint16(t+4,!1);for(let a=0;a<i;a++)n.set(r+a,e.getUint16(t+6+a*2,!1))}else if(r===2){let r=e.getUint16(t+2,!1);for(let i=0;i<r;i++){let r=t+4+i*6,a=e.getUint16(r,!1),o=e.getUint16(r+2,!1),s=e.getUint16(r+4,!1);for(let e=a;e<=o;e++)n.set(e,s)}}return n}function Uo(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function Wo(e,t,n){if(!(n&4))return 0;let r=t;return n&1&&(r+=2),n&2&&(r+=2),e.getInt16(r,!1)}var Go=Object.defineProperty,Ko=Object.getOwnPropertyDescriptor,qo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ko(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Go(t,n,i),i},Jo=class extends eo{_format1Pairs;_classSubtables;getKerningValue(e,t){this._ensureKerning();let n=this._format1Pairs.get(e*65536+t);if(n!==void 0)return n;for(let n of this._classSubtables){if(!n.coverage.has(e))continue;let r=n.classDef1.get(e)??0,i=n.classDef2.get(t)??0,a=n.class1RecordsOffset+(r*n.class2Count+i)*n.recordSize,o=Wo(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],zo(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=Bo(this.view,this.lookupListOffset,e);t?.subtableOffsets.forEach(e=>this._collectPairPos(e,t.lookupType))}))}_collectPairPos(e,t){let n=this.view;if(t===9){let t=n.readUint16(e+2),r=n.readUint32(e+4);this._collectPairPos(e+r,t);return}if(t!==2)return;let r=n.readUint16(e),i=Vo(n,e+n.readUint16(e+2)),a=n.readUint16(e+4),o=n.readUint16(e+6);if(r===1){let t=n.readUint16(e+8),r=2+Uo(a)+Uo(o);for(let o=0;o<t&&o<i.length;o++){let t=i[o],s=e+n.readUint16(e+10+o*2),c=n.readUint16(s),l=s+2;for(let e=0;e<c;e++){let e=n.readUint16(l),i=Wo(n,l+2,a);i&&this._format1Pairs.set(t*65536+e,i),l+=r}}}else r===2&&this._classSubtables.push({coverage:new Set(i),classDef1:Ho(n,e+n.readUint16(e+8)),classDef2:Ho(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Uo(a)+Uo(o),valueFormat1:a})}};qo([J(`uint16`)],Jo.prototype,`majorVersion`,2),qo([J(`uint16`)],Jo.prototype,`minorVersion`,2),qo([J(`uint16`)],Jo.prototype,`scriptListOffset`,2),qo([J(`uint16`)],Jo.prototype,`featureListOffset`,2),qo([J(`uint16`)],Jo.prototype,`lookupListOffset`,2),Jo=qo([Qa(`GPOS`,`gpos`)],Jo);var Yo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,Zo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Xo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Yo(t,n,i),i},Qo=class extends eo{_singleSubstitutions;_ligatures;getSingleSubstitutions(e){let t=this._singleSubstitutions??=new Map,n=t.get(e);return n||(n=new Map,this._featureLookupIndices(e).forEach(e=>{let t=this.readLookup(e);t?.subtableOffsets.forEach(e=>{this._collectSingleSubstitutions(e,t.lookupType,n)})}),t.set(e,n)),n}getLigatures(e){let t=this._ligatures??=new Map,n=t.get(e);return n||(n=new Map,this._featureLookupIndices(e).forEach(e=>{let t=this.readLookup(e);t?.subtableOffsets.forEach(e=>{this._collectLigatures(e,t.lookupType,n)})}),t.set(e,n)),n}_collectLigatures(e,t,n){let r=this.view;if(t===7){let t=r.readUint16(e+2),i=r.readUint32(e+4);this._collectLigatures(e+i,t,n);return}if(t!==4)return;let i=this._readCoverage(e+r.readUint16(e+2)),a=r.readUint16(e+4);for(let t=0;t<a&&t<i.length;t++){let a=i[t],o=e+r.readUint16(e+6+t*2),s=r.readUint16(o),c=n.get(a)??[];for(let e=0;e<s;e++){let t=o+r.readUint16(o+2+e*2),n=r.readUint16(t),i=r.readUint16(t+2),a=[];for(let e=0;e<i-1;e++)a.push(r.readUint16(t+4+e*2));c.push({components:a,ligatureGlyph:n})}n.has(a)||n.set(a,c)}}readLookup(e){let t=this.lookupListOffset;if(!t)return;let n=this.view;if(e>=n.readUint16(t))return;let r=t+n.readUint16(t+2+e*2),i=n.readUint16(r+4),a=[];for(let e=0;e<i;e++)a.push(r+n.readUint16(r+6+e*2));return{lookupType:n.readUint16(r),lookupFlag:n.readUint16(r+2),subtableOffsets:a}}_featureLookupIndices(e){let t=this.featureListOffset;if(!t)return[];let n=this.view,r=n.readUint16(t),i=new Set;for(let a=0;a<r;a++){let r=t+2+a*6;if(n.readString(r,4)!==e)continue;let o=t+n.readUint16(r+4),s=n.readUint16(o+2);for(let e=0;e<s;e++)i.add(n.readUint16(o+4+e*2))}return Array.from(i)}_collectSingleSubstitutions(e,t,n){let r=this.view;if(t===7){let t=r.readUint16(e+2),i=r.readUint32(e+4);this._collectSingleSubstitutions(e+i,t,n);return}if(t!==1)return;let i=r.readUint16(e),a=this._readCoverage(e+r.readUint16(e+2));if(i===1){let t=r.readInt16(e+4);a.forEach(e=>{n.set(e,e+t&65535)})}else if(i===2){let t=r.readUint16(e+4);for(let i=0;i<t&&i<a.length;i++)n.set(a[i],r.readUint16(e+6+i*2))}}_readCoverage(e){let t=this.view,n=t.readUint16(e),r=[];if(n===1){let n=t.readUint16(e+2);for(let i=0;i<n;i++)r.push(t.readUint16(e+4+i*2))}else if(n===2){let n=t.readUint16(e+2);for(let i=0;i<n;i++){let n=e+4+i*6,a=t.readUint16(n),o=t.readUint16(n+2),s=t.readUint16(n+4);for(let e=a;e<=o;e++)r[s++]=e}}return r}};Zo([J(`uint16`)],Qo.prototype,`majorVersion`,2),Zo([J(`uint16`)],Qo.prototype,`minorVersion`,2),Zo([J(`uint16`)],Qo.prototype,`scriptListOffset`,2),Zo([J(`uint16`)],Qo.prototype,`featureListOffset`,2),Zo([J(`uint16`)],Qo.prototype,`lookupListOffset`,2),Qo=Zo([Qa(`GSUB`,`gsub`)],Qo);var $o=Object.defineProperty,es=Object.getOwnPropertyDescriptor,ts=(e,t,n,r)=>{for(var i=r>1?void 0:r?es(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&$o(t,n,i),i},ns=class extends eo{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};ts([J(`fixed`)],ns.prototype,`version`,2),ts([J(`fixed`)],ns.prototype,`fontRevision`,2),ts([J(`uint32`)],ns.prototype,`checkSumAdjustment`,2),ts([J(`uint32`)],ns.prototype,`magickNumber`,2),ts([J(`uint16`)],ns.prototype,`flags`,2),ts([J(`uint16`)],ns.prototype,`unitsPerEm`,2),ts([J({type:`longDateTime`})],ns.prototype,`created`,2),ts([J({type:`longDateTime`})],ns.prototype,`modified`,2),ts([J(`int16`)],ns.prototype,`xMin`,2),ts([J(`int16`)],ns.prototype,`yMin`,2),ts([J(`int16`)],ns.prototype,`xMax`,2),ts([J(`int16`)],ns.prototype,`yMax`,2),ts([J(`uint16`)],ns.prototype,`macStyle`,2),ts([J(`uint16`)],ns.prototype,`lowestRecPPEM`,2),ts([J(`int16`)],ns.prototype,`fontDirectionHint`,2),ts([J(`int16`)],ns.prototype,`indexToLocFormat`,2),ts([J(`int16`)],ns.prototype,`glyphDataFormat`,2),ns=ts([Qa(`head`)],ns);var rs=Object.defineProperty,is=Object.getOwnPropertyDescriptor,as=(e,t,n,r)=>{for(var i=r>1?void 0:r?is(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&rs(t,n,i),i},os=class extends eo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};as([J(`fixed`)],os.prototype,`version`,2),as([J(`int16`)],os.prototype,`ascent`,2),as([J(`int16`)],os.prototype,`descent`,2),as([J(`int16`)],os.prototype,`lineGap`,2),as([J(`uint16`)],os.prototype,`advanceWidthMax`,2),as([J(`int16`)],os.prototype,`minLeftSideBearing`,2),as([J(`int16`)],os.prototype,`minRightSideBearing`,2),as([J(`int16`)],os.prototype,`xMaxExtent`,2),as([J(`int16`)],os.prototype,`caretSlopeRise`,2),as([J(`int16`)],os.prototype,`caretSlopeRun`,2),as([J(`int16`)],os.prototype,`caretOffset`,2),as([J({type:`int16`,size:4})],os.prototype,`reserved`,2),as([J(`int16`)],os.prototype,`metricDataFormat`,2),as([J(`uint16`)],os.prototype,`numOfLongHorMetrics`,2),os=as([Qa(`hhea`)],os);var ss=Object.getOwnPropertyDescriptor,cs=(e,t,n,r)=>{for(var i=r>1?void 0:r?ss(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},ls=class extends eo{static from(e){let t=e.length*4,n=new ls(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceWidth),n.view.writeUint16(e.leftSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.hhea.numOfLongHorMetrics,n=0,r=this.view;return r.seek(0),Array.from({length:e}).map((e,i)=>(i<t&&(n=r.readUint16()),{advanceWidth:n,leftSideBearing:r.readUint16()}))}};ls=cs([Qa(`hmtx`)],ls);var us=Object.getOwnPropertyDescriptor,ds=(e,t,n,r)=>{for(var i=r>1?void 0:r?us(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},fs=class extends eo{_pairs;get pairs(){return this._pairs??=this._readPairs()}getKerningValue(e,t){return this.pairs.get(e*65536+t)??0}_readPairs(){let e=this.view,t=new Map;if(e.byteLength<4||e.readUint16(0)!==0)return t;let n=e.readUint16(2),r=4;for(let i=0;i<n&&r+6<=e.byteLength;i++){let n=e.readUint16(r+2),i=e.readUint16(r+4),a=i>>8,o=(i&1)!=0;if(a===0&&o){let n=e.readUint16(r+6),i=r+14;for(let r=0;r<n;r++){let n=e.readUint16(i),r=e.readUint16(i+2),a=e.readInt16(i+4);t.set(n*65536+r,a),i+=6}}if(n<=0)break;r+=n}return t}};fs=ds([Qa(`kern`,`kern`)],fs);var ps=Object.getOwnPropertyDescriptor,ms=(e,t,n,r)=>{for(var i=r>1?void 0:r?ps(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},hs=class extends eo{static from(e,t=1){let n=e.length*(t?4:2),r=new hs(new ArrayBuffer(n));return e.forEach(e=>{t?r.view.writeUint32(e):r.view.writeUint16(e/2)}),r}_locations;get locations(){return this._locations??=this.readLocations()}readLocations(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.head.indexToLocFormat,n=this.view;return n.seek(0),Array.from({length:e}).map(()=>t?n.readUint32():n.readUint16()*2)}};hs=ms([Qa(`loca`)],hs);var gs=Object.defineProperty,_s=Object.getOwnPropertyDescriptor,vs=(e,t,n,r)=>{for(var i=r>1?void 0:r?_s(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&gs(t,n,i),i},ys=class extends eo{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};vs([J(`fixed`)],ys.prototype,`version`,2),vs([J(`uint16`)],ys.prototype,`numGlyphs`,2),vs([J(`uint16`)],ys.prototype,`maxPoints`,2),vs([J(`uint16`)],ys.prototype,`maxContours`,2),vs([J(`uint16`)],ys.prototype,`maxComponentPoints`,2),vs([J(`uint16`)],ys.prototype,`maxComponentContours`,2),vs([J(`uint16`)],ys.prototype,`maxZones`,2),vs([J(`uint16`)],ys.prototype,`maxTwilightPoints`,2),vs([J(`uint16`)],ys.prototype,`maxStorage`,2),vs([J(`uint16`)],ys.prototype,`maxFunctionDefs`,2),vs([J(`uint16`)],ys.prototype,`maxInstructionDefs`,2),vs([J(`uint16`)],ys.prototype,`maxStackElements`,2),vs([J(`uint16`)],ys.prototype,`maxSizeOfInstructions`,2),vs([J(`uint16`)],ys.prototype,`maxComponentElements`,2),vs([J(`uint16`)],ys.prototype,`maxComponentDepth`,2),ys=vs([Qa(`maxp`)],ys);var bs=Object.defineProperty,xs=Object.getOwnPropertyDescriptor,Ss=(e,t,n,r)=>{for(var i=r>1?void 0:r?xs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&bs(t,n,i),i},Cs={0:`copyright`,1:`fontFamily`,2:`fontSubFamily`,3:`uniqueSubFamily`,4:`fullName`,5:`version`,6:`postScriptName`,7:`tradeMark`,8:`manufacturer`,9:`designer`,10:`description`,11:`urlOfFontVendor`,12:`urlOfFontDesigner`,13:`licence`,14:`urlOfLicence`,16:`preferredFamily`,17:`preferredSubFamily`,18:`compatibleFull`,19:`sampleText`},ws={Macintosh:1,Microsoft:3},Ts={Default:0},Es={UCS2:1},Ds=class extends eo{_names;get names(){return this._names??=this.readNames()}readNames(){let e=this.count;this.view.seek(6);let t=[];for(let n=0;n<e;++n)t.push({platform:this.view.readUint16(),encoding:this.view.readUint16(),language:this.view.readUint16(),nameId:this.view.readUint16(),length:this.view.readUint16(),offset:this.view.readUint16()});let n=this.stringOffset;for(let r=0;r<e;++r){let e=t[r];e.name=this.view.readBytes(n+e.offset,e.length)}let r=ws.Macintosh,i=Ts.Default,a=0;t.some(e=>e.platform===ws.Microsoft&&e.encoding===Es.UCS2&&e.language===1033)&&(r=ws.Microsoft,i=Es.UCS2,a=1033);let o={};for(let n=0;n<e;++n){let e=t[n];e.platform===r&&e.encoding===i&&e.language===a&&Cs[e.nameId]&&(o[Cs[e.nameId]]=a===0?_a(e.name):va(e.name))}return o}};Ss([J(`uint16`)],Ds.prototype,`format`,2),Ss([J(`uint16`)],Ds.prototype,`count`,2),Ss([J(`uint16`)],Ds.prototype,`stringOffset`,2),Ds=Ss([Qa(`name`)],Ds);var Os=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?ks(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Os(t,n,i),i},$=class extends eo{get fontPANOSE(){return[this.bFamilyType,this.bSerifStyle,this.bWeight,this.bProportion,this.bContrast,this.bStrokeVariation,this.bArmStyle,this.bLetterform,this.bMidline,this.bXHeight]}};Q([J(`uint16`)],$.prototype,`version`,2),Q([J(`int16`)],$.prototype,`xAvgCharWidth`,2),Q([J(`uint16`)],$.prototype,`usWeightClass`,2),Q([J(`uint16`)],$.prototype,`usWidthClass`,2),Q([J(`uint16`)],$.prototype,`fsType`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySubscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySubscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYSize`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptXOffset`,2),Q([J(`uint16`)],$.prototype,`ySuperscriptYOffset`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutSize`,2),Q([J(`uint16`)],$.prototype,`yStrikeoutPosition`,2),Q([J(`uint16`)],$.prototype,`sFamilyClass`,2),Q([J({type:`uint8`})],$.prototype,`bFamilyType`,2),Q([J({type:`uint8`})],$.prototype,`bSerifStyle`,2),Q([J({type:`uint8`})],$.prototype,`bWeight`,2),Q([J({type:`uint8`})],$.prototype,`bProportion`,2),Q([J({type:`uint8`})],$.prototype,`bContrast`,2),Q([J({type:`uint8`})],$.prototype,`bStrokeVariation`,2),Q([J({type:`uint8`})],$.prototype,`bArmStyle`,2),Q([J({type:`uint8`})],$.prototype,`bLetterform`,2),Q([J({type:`uint8`})],$.prototype,`bMidline`,2),Q([J({type:`uint8`})],$.prototype,`bXHeight`,2),Q([J({type:`uint32`,size:4})],$.prototype,`ulUnicodeRange`,2),Q([J({type:`char`,size:4})],$.prototype,`achVendID`,2),Q([J(`uint16`)],$.prototype,`fsSelection`,2),Q([J(`uint16`)],$.prototype,`usFirstCharIndex`,2),Q([J(`uint16`)],$.prototype,`usLastCharIndex`,2),Q([J(`int16`)],$.prototype,`sTypoAscender`,2),Q([J(`int16`)],$.prototype,`sTypoDescender`,2),Q([J(`int16`)],$.prototype,`sTypoLineGap`,2),Q([J(`uint16`)],$.prototype,`usWinAscent`,2),Q([J(`uint16`)],$.prototype,`usWinDescent`,2),Q([J({offset:78,type:`uint32`,size:2})],$.prototype,`ulCodePageRange`,2),Q([J({offset:86,type:`int16`})],$.prototype,`sxHeight`,2),Q([J(`int16`)],$.prototype,`sCapHeight`,2),Q([J(`uint16`)],$.prototype,`usDefaultChar`,2),Q([J(`uint16`)],$.prototype,`usBreakChar`,2),Q([J(`uint16`)],$.prototype,`usMaxContext`,2),$=Q([Qa(`OS/2`,`os2`)],$);var As=`.notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quotesingle,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,grave,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,Adieresis,Aring,Ccedilla,Eacute,Ntilde,Odieresis,Udieresis,aacute,agrave,acircumflex,adieresis,atilde,aring,ccedilla,eacute,egrave,ecircumflex,edieresis,iacute,igrave,icircumflex,idieresis,ntilde,oacute,ograve,ocircumflex,odieresis,otilde,uacute,ugrave,ucircumflex,udieresis,dagger,degree,cent,sterling,section,bullet,paragraph,germandbls,registered,copyright,trademark,acute,dieresis,notequal,AE,Oslash,infinity,plusminus,lessequal,greaterequal,yen,mu,partialdiff,summation,product,pi,integral,ordfeminine,ordmasculine,Omega,ae,oslash,questiondown,exclamdown,logicalnot,radical,florin,approxequal,Delta,guillemotleft,guillemotright,ellipsis,nonbreakingspace,Agrave,Atilde,Otilde,OE,oe,endash,emdash,quotedblleft,quotedblright,quoteleft,quoteright,divide,lozenge,ydieresis,Ydieresis,fraction,currency,guilsinglleft,guilsinglright,fi,fl,daggerdbl,periodcentered,quotesinglbase,quotedblbase,perthousand,Acircumflex,Ecircumflex,Aacute,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Oacute,Ocircumflex,apple,Ograve,Uacute,Ucircumflex,Ugrave,dotlessi,circumflex,tilde,macron,breve,dotaccent,ring,cedilla,hungarumlaut,ogonek,caron,Lslash,lslash,Scaron,scaron,Zcaron,zcaron,brokenbar,Eth,eth,Yacute,yacute,Thorn,thorn,minus,multiply,onesuperior,twosuperior,threesuperior,onehalf,onequarter,threequarters,franc,Gbreve,gbreve,Idotaccent,Scedilla,scedilla,Cacute,cacute,Ccaron,ccaron,dcroat`.split(`,`),js=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,Ns=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ms(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&js(t,n,i),i},Ps=class extends eo{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return As.slice();if(e!==2)return[];let t=this.view,n=t.readUint16(32),r=[];for(let e=0;e<n;e++)r.push(t.readUint16(34+e*2));let i=[],a=34+n*2,o=t.byteLength;for(;a<o;){let e=t.readUint8(a);a+=1,i.push(t.readString(a,e)),a+=e}return r.map(e=>e<258?As[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};Ns([J(`fixed`)],Ps.prototype,`format`,2),Ns([J(`fixed`)],Ps.prototype,`italicAngle`,2),Ns([J(`int16`)],Ps.prototype,`underlinePosition`,2),Ns([J(`int16`)],Ps.prototype,`underlineThickness`,2),Ns([J(`uint32`)],Ps.prototype,`isFixedPitch`,2),Ns([J(`uint32`)],Ps.prototype,`minMemType42`,2),Ns([J(`uint32`)],Ps.prototype,`maxMemType42`,2),Ns([J(`uint32`)],Ps.prototype,`minMemType1`,2),Ns([J(`uint32`)],Ps.prototype,`maxMemType1`,2),Ps=Ns([Qa(`post`)],Ps);var Fs=Object.defineProperty,Is=Object.getOwnPropertyDescriptor,Ls=(e,t,n,r)=>{for(var i=r>1?void 0:r?Is(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Fs(t,n,i),i},Rs=class extends eo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Ls([J(`fixed`)],Rs.prototype,`version`,2),Ls([J(`int16`)],Rs.prototype,`vertTypoAscender`,2),Ls([J(`int16`)],Rs.prototype,`vertTypoDescender`,2),Ls([J(`int16`)],Rs.prototype,`vertTypoLineGap`,2),Ls([J(`int16`)],Rs.prototype,`advanceHeightMax`,2),Ls([J(`int16`)],Rs.prototype,`minTopSideBearing`,2),Ls([J(`int16`)],Rs.prototype,`minBottomSideBearing`,2),Ls([J(`int16`)],Rs.prototype,`yMaxExtent`,2),Ls([J(`int16`)],Rs.prototype,`caretSlopeRise`,2),Ls([J(`int16`)],Rs.prototype,`caretSlopeRun`,2),Ls([J(`int16`)],Rs.prototype,`caretOffset`,2),Ls([J({type:`int16`,size:4})],Rs.prototype,`reserved`,2),Ls([J(`int16`)],Rs.prototype,`metricDataFormat`,2),Ls([J(`int16`)],Rs.prototype,`numOfLongVerMetrics`,2),Rs=Ls([Qa(`vhea`)],Rs);var zs=Object.getOwnPropertyDescriptor,Bs=(e,t,n,r)=>{for(var i=r>1?void 0:r?zs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Vs=class extends eo{static from(e){let t=e.length*4,n=new Vs(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeUint16(e.advanceHeight),n.view.writeInt16(e.topSideBearing)}),n}_metrics;get metrics(){return this._metrics??=this.readMetrics()}readMetrics(){let e=this._sfnt.maxp.numGlyphs,t=this._sfnt.vhea?.numOfLongVerMetrics??0,n=this.view;n.seek(0);let r=0;return Array.from({length:e}).map((e,i)=>(i<t&&(r=n.readUint16()),{advanceHeight:r,topSideBearing:n.readInt16()}))}};Vs=Bs([Qa(`vmtx`)],Vs);var Hs=Object.defineProperty,Us=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Hs(t,n,i),i},Ws=class extends Ca{format=`TrueType`;mimeType=`font/ttf`;_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([65536,1953658213,1954115633]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(ma(e).getUint32(0))}static checksum(e){let t=ma(e),n=t.byteLength,r=Math.floor(n/4),i=0;for(let e=0;e<r;e++)i+=t.getUint32(e*4,!1);let a=n-r*4;if(a>0){let e=0,n=r*4;for(let r=0;r<4;r++)e=e*256+(r<a?t.getUint8(n+r):0);i+=e}return i%4294967296}static from(e){let t=e=>e+3&-4,n=e.tableTags,r=n.map(t=>e.getTableView(t)),i=n.length,a=r.reduce((e,n)=>e+t(n.byteLength),0),o=new this(new ArrayBuffer(12+i*16+a));o.scalerType=65536,o.numTables=i;let s=Math.floor(Math.log2(i));o.searchRange=2**s*16,o.entrySelector=s,o.rangeShift=i*16-o.searchRange;let c=12+i*16,l=o.getDirectories();n.forEach((e,n)=>{let i=r[n],a=l[n];a.tag=e,a.checkSum=this.checksum(i),a.offset=c,a.length=i.byteLength,o.view.writeBytes(i,c),c+=t(a.length)});let u=l.find(e=>e.tag===`head`);if(u){let e=u.offset+8;o.view.writeUint32(0,e),o.view.writeUint32(2981146554-this.checksum(o.view)>>>0,e)}return o}getDirectories(){let e=this.view.byteOffset+12;return Array.from({length:this.numTables},()=>{let t=new ka(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new $a(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Us([J(`uint32`)],Ws.prototype,`scalerType`),Us([J(`uint16`)],Ws.prototype,`numTables`),Us([J(`uint16`)],Ws.prototype,`searchRange`),Us([J(`uint16`)],Ws.prototype,`entrySelector`),Us([J(`uint16`)],Ws.prototype,`rangeShift`);var Gs=class extends Ws{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},Ks=class{static signature=1953784678;static is(e){let t=ma(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=ma(e),this.numFonts=this.view.getUint32(8,!1)}get sfnts(){return Array.from({length:this.numFonts},(e,t)=>this._readSFNT(this.view.getUint32(12+t*4,!1)))}get fonts(){return this.sfnts.map(e=>e.hasTable(`CFF `)?Gs.from(e):Ws.from(e))}_readSFNT(e){let t=this.view,n=t.byteOffset,r=t.getUint16(e+4,!1),i=new Map;for(let a=0;a<r;a++){let r=e+12+a*16,o=String.fromCharCode(t.getUint8(r),t.getUint8(r+1),t.getUint8(r+2),t.getUint8(r+3)),s=t.getUint32(r+8,!1),c=t.getUint32(r+12,!1);i.set(o,new DataView(t.buffer,n+s,c))}return new $a(i)}},qs=Object.defineProperty,Js=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&qs(t,n,i),i},Ys=class extends Sa{constructor(e,t){super(e,t,20)}};Js([J({type:`char`,size:4})],Ys.prototype,`tag`),Js([J(`uint32`)],Ys.prototype,`offset`),Js([J(`uint32`)],Ys.prototype,`compLength`),Js([J(`uint32`)],Ys.prototype,`origLength`),Js([J(`uint32`)],Ys.prototype,`origChecksum`);var Xs=Object.defineProperty,Zs=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&Xs(t,n,i),i};function Qs(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function $s(e){return new Promise((t,n)=>{oa(e,(e,r)=>e?n(e):t(r))})}function ec(e){return new Promise((t,n)=>{ca(e,(e,r)=>e?n(e):t(r))})}var tc=class e extends Ca{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return Ws.is(this.flavor)?`TrueType`:Gs.is(this.flavor)?`OpenType`:`Open`}_sfnt;get sfnt(){return this._sfnt||=this.createSFNT(),this._sfnt}static signature=new Set([2001684038]);static is(e){return typeof e==`number`?this.signature.has(e):this.signature.has(ma(e).getUint32(0))}static checkSum(e){let t=ma(e),n=t.byteLength,r=Math.floor(n/4),i=0,a=0;for(;a<r;)i+=t.getUint32(4*a++,!1);let o=n-r*4;if(o){let e=r*4;for(;o>0;)i+=t.getUint8(e)<<o*8,e++,o--}return i%4294967296}static _pickTable(e,t,n){return{tag:e,view:n.byteLength<t.byteLength?n:t,rawView:t}}static from(e,t=new ArrayBuffer(0)){let n=e.tableTags.map(t=>{let n=e.getTableView(t);return this._pickTable(t,n,ma(sa(Qs(n))))});return this._assemble(n,t)}static async fromAsync(e,t=new ArrayBuffer(0)){let n=await Promise.all(e.tableTags.map(async t=>{let n=e.getTableView(t);return this._pickTable(t,n,ma(await $s(Qs(n))))}));return this._assemble(n,t)}static _assemble(t,n){let r=e=>e+3&-4,i=t.length,a=t.reduce((e,t)=>e+r(t.view.byteLength),0),o=new e(new ArrayBuffer(44+20*i+a+n.byteLength));o.signature=2001684038,o.flavor=65536,o.length=o.view.byteLength,o.numTables=i,o.totalSFNTSize=12+16*i+t.reduce((e,t)=>e+r(t.rawView.byteLength),0);let s=44+i*20,c=0,l=o.getDirectories();return t.forEach(t=>{let n=l[c++];n.tag=t.tag,n.offset=s,n.compLength=t.view.byteLength,n.origChecksum=e.checkSum(t.rawView),n.origLength=t.rawView.byteLength,o.view.writeBytes(t.view,s),s+=r(n.compLength)}),o.view.writeBytes(n),o}getDirectories(){let e=44;return Array.from({length:this.numTables},()=>{let t=new Ys(this.view.buffer,e);return e+=t.view.byteLength,t})}_decodeTable(e,t,n){if(t>=n)return new DataView(this.view.buffer,e,t);let r=la(new Uint8Array(this.view.buffer.slice(e,e+t)));return new DataView(r.buffer,r.byteOffset,r.byteLength)}createSFNT(){let e=new Map;return this.getDirectories().forEach(t=>{let n=t.tag,r=this.view.byteOffset+t.offset,i=t.compLength,a=t.origLength;e.set(n,()=>this._decodeTable(r,i,a))}),new $a(void 0,e)}async createSFNTAsync(){let e=await Promise.all(this.getDirectories().map(async e=>{let t=e.tag,n=this.view.byteOffset+e.offset,r=e.compLength,i=e.origLength,a;if(r>=i)a=new DataView(this.view.buffer,n,r);else{let e=await ec(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new $a(new Map(e))}};Zs([J(`uint32`)],tc.prototype,`signature`),Zs([J(`uint32`)],tc.prototype,`flavor`),Zs([J(`uint32`)],tc.prototype,`length`),Zs([J(`uint16`)],tc.prototype,`numTables`),Zs([J(`uint16`)],tc.prototype,`reserved`),Zs([J(`uint32`)],tc.prototype,`totalSFNTSize`),Zs([J(`uint16`)],tc.prototype,`majorVersion`),Zs([J(`uint16`)],tc.prototype,`minorVersion`),Zs([J(`uint32`)],tc.prototype,`metaOffset`),Zs([J(`uint32`)],tc.prototype,`metaLength`),Zs([J(`uint32`)],tc.prototype,`metaOrigLength`),Zs([J(`uint32`)],tc.prototype,`privOffset`),Zs([J(`uint32`)],tc.prototype,`privLength`);var nc=tc;function rc(e,t=!0){if(Ws.is(e))return new Ws(e);if(Gs.is(e))return new Gs(e);if(nc.is(e))return new nc(e);if(Ks.is(e)){let t=new Ks(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function ic(e,t=!0){let n=rc(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var ac=new class e{static defaultRequestInit={cache:`force-cache`};fallbackFont;loading=new Map;loaded=new Map;familyToUrl=new Map;setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){this.fallbackFont=await this.load(e,t)}_createRequest(t,n){let r=new AbortController;return{url:t,when:fetch(t,{...e.defaultRequestInit,...n,signal:r.signal}).then(e=>e.arrayBuffer()),cancel:()=>r.abort()}}async injectFontFace(e,t){if(!document.fonts.check(`14px "${e}"`)){let n=new FontFace(e,t);await n.load(),document.fonts.add(n)}}injectStyleTag(e,t){let n=CSS.escape(e);if(!document.querySelector(`style[data-family="${n}"]`)){let n=document.createElement(`style`);n.type=`text/css`,n.dataset.family=e,n.appendChild(document.createTextNode(`@font-face {
31
31
  font-family: "${e}";
32
32
  src: url(${t});
33
- }`)),document.head.appendChild(n)}return this}_parseUrls(e){let t=[...new Set([...e.split(`,`),e])];return[...new Set(t.map(e=>this.familyToUrl.get(e.trim())??this.familyToUrl.get(e)??e))]}get(e){let t;return e&&(t=this._parseUrls(e).reduce((e,t)=>e||this.loaded.get(t),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(e){return e?(Array.isArray(e)?e:[e]).flatMap(e=>e.split(`,`).map(e=>e.trim())):[]}async load(e,t={}){let{cancelOther:n,injectStyleTag:r=!1,injectFontFace:i=!1,...a}=t,o,s;typeof e==`string`?o=e:{src:o,family:s}=e;let c=this._parseFamilies(s);if(this.loaded.has(o))return n&&(this.loading.forEach(e=>e.cancel()),this.loading.clear()),u(this.loaded.get(o));let l=this.loading.get(o);return l||(l=this._createRequest(o,a),this.loading.set(o,l)),n&&this.loading.forEach((e,t)=>{e!==l&&(e.cancel(),this.loading.delete(t))}),l.when.then(e=>{let n;return this.loaded.has(o)?n=u(this.loaded.get(o)):(n=d(e),t.noAdd||this.loaded.set(o,n)),Promise.all(Array.from(n.familySet,async t=>{if(this.familyToUrl.set(t,o),typeof document<`u`&&(i&&await this.injectFontFace(t,e),r&&this.injectStyleTag(t,o),i||r))return await document.fonts.load(`14px "${t}"`)})).then(()=>n)}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return d();throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}function d(e=new ArrayBuffer(0)){let t;function n(){return t||=e.byteLength?Ys(e,!1):void 0,t}function r(){let e=n();if(e instanceof Fs||e instanceof qs)return e.sfnt}return{src:o,family:s,buffer:e,familySet:new Set(c),getFont:n,getSFNT:r}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},Zs=new Set([`©`,`®`,`÷`]),Qs=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),$s={1:`italic`,32:`bold`},ec={1:`italic`,2:`bold`},tc={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},nc=class{content;index;parent;path=new Mr().setMeta(this);lineBox=new W;inlineBox=new W;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){let e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new W(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new W(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}constructor(e,t,n){this.content=e,this.index=t,this.parent=n}_getFontSFNT(e){let t=this.computedStyle.fontFamily,n=e??Xs,r=(t?n.get(t):n.fallbackFont)?.getSFNT();return r?.textToGlyphIndexes(this.content).includes(0)&&(r=n.fallbackFont?.getSFNT()),r}updateGlyph(e=this._getFontSFNT()){if(!e)return this;let{hhea:t,os2:n,post:r,head:i}=e,a=i.unitsPerEm,o=t.ascent,s=t.descent,{content:c,computedStyle:l}=this,{fontSize:u}=l,d=a/u,f=e.getAdvanceWidth(c,u),p=(o+Math.abs(s))/d,m=o/d;return this.advanceWidth=f,this.advanceHeight=p,this.underlinePosition=(o-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(o-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=o/d,this.descender=s/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.version>1?n.sxHeight/d:0,this.capHeight=n.version>1?n.sCapHeight/d:0,this.baseline=m,this.centerDiviation=p/2-m,this.fontStyle=$s[n.fsSelection]??ec[i.macStyle],this}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let{isVertical:n,content:r,computedStyle:i,baseline:a,inlineBox:o,ascender:s,descender:c,typoAscender:l,fontStyle:u,advanceWidth:d,advanceHeight:f}=this,{left:p,top:m}=o,h=i.fontStyle===`italic`&&u!==`italic`,g=p,_=m+a,v,y=new Mr().setMeta(this);if(n&&(g+=(f-d)/2,Math.abs(d-f)>.1&&(_-=(s-l)/(s+Math.abs(c))*f),v=void 0),n&&!Zs.has(r)&&(r.codePointAt(0)<=256||Qs.has(r))){y.addCommands(t.getPathCommands(r,g,m+a-(f-d)/2,i.fontSize));let e={y:m-(f-d)/2+f/2,x:g+d/2};h&&this._italic(y,{x:e.x,y:m-(f-d)/2+a}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(r,g,_,i.fontSize)),h&&this._italic(y,n?{x:g+f/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,i.fontSize)),h&&this._italic(y,n?{x:g+d/2,y:m+l/(s+Math.abs(c))*f}:void 0));let b=i.fontWeight??400;return b in tc&&(b===700||b===`bold`)&&u!==`bold`&&y.bold(tc[b]*i.fontSize*.05),y.style=A({fill:i.color,fillRule:`nonzero`,stroke:i.textStrokeWidth?i.textStrokeColor:void 0,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:void 0}),this.path=y,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){let t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;let{min:n,max:r}=t;return new W(n.x,n.y,r.x-n.x,r.y-n.y)}},rc=class{content;style;fill;outline;index;parent;inlineBox=new W;get computedContent(){let e=this.computedStyle;return e.textTransform===`uppercase`?this.content.toUpperCase():e.textTransform===`lowercase`?this.content.toLowerCase():this.content}constructor(e,t={},n,r,i,a){this.content=e,this.style=t,this.fill=n,this.outline=r,this.index=i,this.parent=a,this.update().initCharacters()}update(){this.computedStyle={...this.parent.computedStyle,...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new nc(n,t++,this));return this.characters=e,this}},ic=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...A(this.parent.computedStyle),...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}};function ac(e){return e}var oc;function sc(){if(oc?.isConnected)return oc;let e=document.createElement(`div`);return e.dataset.modernText=`measurer`,Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,visibility:`hidden`,pointerEvents:`none`}),document.body.appendChild(e),oc=e,e}var cc=class e{static notZeroStyles=new Set([`width`,`height`]);static pxStyles=new Set([`width`,`height`,`fontSize`,`letterSpacing`,`textStrokeWidth`,`textIndent`,`shadowOffsetX`,`shadowOffsetY`,`shadowBlur`,`margin`,`marginLeft`,`marginTop`,`marginRight`,`marginBottom`,`padding`,`paddingLeft`,`paddingTop`,`paddingRight`,`paddingBottom`]);_styleCache=new WeakMap;_mountedDom;_mountedSignature;_toDomStyle(t){let n=this._styleCache.get(t);if(n)return n;let r={},{notZeroStyles:i,pxStyles:a}=e;for(let e in t){let n=t[e];i.has(e)&&n===0||(r[e]=typeof n==`number`&&a.has(e)?`${n}px`:n)}return this._styleCache.set(t,r),r}_resolveRootStyles(e){let t={...e},n=e.writingMode.includes(`horizontal`);switch(e.textAlign){case`start`:case`left`:t.justifyContent=`flex-start`;break;case`center`:t.justifyContent=`center`;break;case`end`:case`right`:t.justifyContent=`flex-end`;break}switch(e.verticalAlign){case`top`:t.alignItems=`flex-start`;break;case`middle`:t.alignItems=`center`;break;case`bottom`:t.alignItems=`flex-end`;break}let r=!!(t.justifyContent||t.alignItems);return{section:{...this._toDomStyle({...t,boxSizing:t.boxSizing??`border-box`,display:t.display??(r?`inline-flex`:void 0),width:t.width??`max-content`,height:t.height??`max-content`}),whiteSpace:`pre-wrap`,wordBreak:`break-all`},ul:{verticalAlign:`inherit`,listStyleType:`inherit`,padding:`0`,margin:`0`,width:r&&n?`100%`:void 0,height:r&&!n?`100%`:void 0}}}_applyRootStyle(e,t,n){let r=this._resolveRootStyles(n);e.removeAttribute(`style`),Object.assign(e.style,r.section),t.removeAttribute(`style`),Object.assign(t.style,r.ul)}_applyLiStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applySpanStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applyFragmentContent(e,t){let n=e.firstChild;n?n.data!==t.content&&(n.data=t.content):e.appendChild(document.createTextNode(t.content))}_hide(e){e.style.visibility=`hidden`}_signature(e){let t=`${e.length}`;for(let n=0;n<e.length;n++)t+=`:${e[n].fragments.length}`;return t}createDom(e,t){let n=document.createElement(`section`),r=document.createElement(`ul`);return this._applyRootStyle(n,r,t),e.forEach(e=>{let t=document.createElement(`li`);this._applyLiStyle(t,e),e.fragments.forEach(e=>{let n=document.createElement(`span`);this._applySpanStyle(n,e),this._applyFragmentContent(n,e),t.appendChild(n)}),r.appendChild(t)}),n.appendChild(r),n}_patchDom(e,t,n,r){let i=e.firstChild;this._applyRootStyle(e,i,n),r&&this._hide(e);let a=i.children;for(let e=0;e<t.length;e++){let n=a[e];this._applyLiStyle(n,t[e]);let r=t[e].fragments,i=n.children;for(let e=0;e<r.length;e++){let t=i[e];this._applySpanStyle(t,r[e]),this._applyFragmentContent(t,r[e])}}}measureDomText(e){let t=e.data??``,n=[];if(!t.length)return n;let r=document.createRange(),i=0;for(;i<t.length;){let a=t.codePointAt(i),o=i+(a>65535?2:1);r.setStart(e,i),r.setEnd(e,o);let s=r.getClientRects?.(),c;s&&s.length?(c=s[s.length-1],s.length>1&&c.width<2&&(c=s[s.length-2])):c=r.getBoundingClientRect(),c&&c.width+c.height!==0&&n.push({content:t.slice(i,o),top:c.top,left:c.left,width:c.width,height:c.height}),i=o}return n}measureDom(e){let t=[],n=[],r=[];return e.querySelectorAll(`li`).forEach((e,i)=>{let a=e.getBoundingClientRect();t.push({paragraphIndex:i,left:a.x,top:a.y,width:a.width,height:a.height}),e.querySelectorAll(`:scope > *`).forEach((e,t)=>{let a=e.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:t,left:a.x,top:a.y,width:a.width,height:a.height});let o=0,s=e=>{this.measureDomText(e).forEach(e=>{r.push({...e,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:t,characterIndex:o++,textWidth:-1,textHeight:-1})})};!e.children.length&&e.firstChild instanceof window.Text?s(e.firstChild):e.querySelectorAll(`:scope > *`).forEach(e=>{e.firstChild instanceof window.Text&&s(e.firstChild)})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){let n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(t=>{let r=e[t.paragraphIndex].lineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height}),r.fragments.forEach(t=>{let r=e[t.paragraphIndex].fragments[t.fragmentIndex].inlineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height});let i=[];return r.characters.forEach(t=>{let{paragraphIndex:r,fragmentIndex:a,characterIndex:o}=t,s=t.left-n.left,c=t.top-n.top;i.push({...t,newParagraphIndex:r,left:s,top:c});let{fontHeight:l,isVertical:u,inlineBox:d,lineBox:f}=e[r].fragments[a].characters[o];d.left=s,d.top=c,d.width=t.width,d.height=t.height,u?(f.left=s+(t.width-l)/2,f.top=c,f.width=l,f.height=t.height):(f.left=s,f.top=c+(t.height-l)/2,f.width=t.width,f.height=l)}),{paragraphs:e,boundingBox:new W(0,0,n.width,n.height)}}measure(e,t,n){return this.measureParagraphDom(e,n??this._mount(e,t))}_mount(e,t){let n=this._signature(e);if(this._mountedDom?.isConnected&&this._mountedSignature===n)return this._patchDom(this._mountedDom,e,t,!0),this._mountedDom;this._unmount();let r=this.createDom(e,t);return this._hide(r),sc().appendChild(r),this._mountedDom=r,this._mountedSignature=n,r}_unmount(){this._mountedDom?.parentNode?.removeChild(this._mountedDom),this._mountedDom=void 0,this._mountedSignature=void 0}dispose(){this._unmount()}};function lc(e,t,n){return e[`${t}${n}`]??e[t]??0}var uc=class{measure(e,t,n,r){let i=r??Xs;for(let t of e)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:lc(e,`padding`,`Top`),right:lc(e,`padding`,`Right`),bottom:lc(e,`padding`,`Bottom`),left:lc(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=r?t.width-n.left-n.right:1/0,a=n.top,o=n.left;for(let t of e){let e=t.computedStyle,r=t.style,s=lc(r,`margin`,`Top`),c=lc(r,`margin`,`Bottom`),l=lc(r,`margin`,`Left`),u=lc(r,`margin`,`Right`),d=lc(r,`padding`,`Top`),f=lc(r,`padding`,`Bottom`),p=lc(r,`padding`,`Left`),m=lc(r,`padding`,`Right`),h=n.left+l+p,g=i===1/0?1/0:i-l-u-p-m;a+=s+d;let _=a,v=h,y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,o=0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),o+=this._advance(e);let s=h+r;if(g!==1/0){let e=g-r-o;b===`center`?s+=e/2:(b===`end`||b===`right`)&&(s+=e)}for(let e of n){let t=e.advanceWidth,n=e.advanceHeight,r=e.fontHeight;e.inlineBox.left=s,e.inlineBox.top=a+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,e.lineBox.left=s,e.lineBox.top=e.inlineBox.top+(n-r)/2,e.lineBox.width=t,e.lineBox.height=r,s+=this._advance(e)}s>v&&(v=s),a+=i}v>o&&(o=v);for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));t.lineBox.left=h,t.lineBox.top=_,t.lineBox.width=g===1/0?v-h:g,t.lineBox.height=a-_,a+=f+c}let s=a+n.bottom,c=r?t.width:o+n.right,l=typeof t.height==`number`?t.height:s;if(typeof t.height==`number`){let n=l-s,r=t.verticalAlign,i=r===`middle`?n/2:r===`bottom`?n:0;i&&this._shiftAll(e,i)}return{paragraphs:e,boundingBox:new W(0,0,c,l)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=r?t.height-n.top-n.bottom:1/0,a=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,i)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);a.push({chars:n,thickness:t})}}let o=a.reduce((e,t)=>e+t.thickness,0),s=typeof t.width==`number`,c=s?Math.max(t.width-n.left-n.right,o):o,l=n.left+c,u=n.top;for(let e of a){l-=e.thickness;let t=l,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight,o=n.fontHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,n.lineBox.left=n.inlineBox.left+(a-o)/2,n.lineBox.top=r,n.lineBox.width=o,n.lineBox.height=i,r+=this._advance(n)}r>u&&(u=r)}for(let t of e){for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));this._unionInto(t.lineBox,t.fragments.flatMap(e=>e.characters.map(e=>e.inlineBox)))}return{paragraphs:e,boundingBox:new W(0,0,s?t.width:c+n.left+n.right,r?t.height:u+n.bottom)}}_advance(e){return e.advanceWidth+(e.computedStyle.letterSpacing??0)}_breakLines(e,t){let n=[],r=[],i=0,a=()=>{n.push(r),r=[],i=0};for(let n of e.fragments)for(let e of n.characters){if(e.content===`
34
- `||e.content===`\r`){a();continue}t!==1/0&&r.length>0&&i+e.advanceWidth>t&&a(),r.push(e),i+=this._advance(e)}return a(),n}_unionInto(e,t){let n=t.filter(e=>e.width!==0||e.height!==0);if(!n.length)return;let r=W.from(...n);e.left=r.left,e.top=r.top,e.width=r.width,e.height=r.height}_shiftAll(e,t){for(let n of e){n.lineBox.top+=t;for(let e of n.fragments){e.inlineBox.top+=t;for(let n of e.characters)n.inlineBox.top+=t,n.lineBox.top+=t}}}dispose(){}};function dc(){let e=new Nr,t=Pr(),n=Fr(t);return{name:`background`,pathSet:e,context:{loader:t,parser:n},load:async e=>{let{backgroundImage:n}=e.computedStyle;n&&t.needsLoad(n)&&await t.load(n)},update:t=>{e.paths.length=0;let{computedStyle:r,lineBox:i,isVertical:a}=t,{backgroundImage:o,backgroundSize:s,backgroundColormap:c}=r;if(O(o))return;let{pathSet:l}=n.parse(o),u=l.getBoundingBox(!0)??new W,d,f,p,m;a?{x:f,y:d,width:m,height:p}=i:{x:d,y:f,width:p,height:m}=i;let h=zr(c??`none`),g=l.paths.map(e=>{let t=e.clone();return t.style.fill&&t.style.fill in h&&(t.style.fill=h[t.style.fill]),t.style.stroke&&t.style.stroke in h&&(t.style.stroke=h[t.style.stroke]),t}),_,v;if(s===`rigid`){_=t.fontSize*5/u.width,v=_;let e=new U;e.x=u.width-p/_,e.y=u.height-m/v,g.forEach(t=>{t.applyTransform(t=>{let n=t.x>u.left+u.width/2,r=t.y>u.top+u.height/2;n&&(t.x-=e.x),r&&(t.y-=e.y)})})}else _=p/u.width,v=m/u.height;let y=new Mn;y.translate(-u.x,-u.y),y.scale(_,v),a&&(y.translate(-p/2,-m/2),y.rotate(Math.PI/2),y.translate(m/2,p/2)),y.translate(d,f),g.forEach(e=>{e.applyTransform(y)}),e.paths.push(...g)},renderOrder:-2,render:t=>{let{text:n,context:r}=t,{lineBox:i,computedStyle:a}=n;O(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Nr([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function fc(e,t){let{x:n,y:r}=t;if(e instanceof Dr){let{p1:t,cp:i,p2:a}=e,o=n!==void 0&&Math.abs(Math.sign(t.x-n)+Math.sign(i.x-n)+Math.sign(a.x-n))===1,s=r!==void 0&&Math.abs(Math.sign(t.y-r)+Math.sign(i.y-r)+Math.sign(a.y-r))===1,c,l,u,d;if(o&&(c=t.x-2*i.x+a.x,l=2*(-t.x+i.x),u=t.x-n),s&&(c=t.y-2*i.y+a.y,l=2*(-t.y+i.y),u=t.y-r),(o||s)&&(d=l*l-4*c*u,d>0)){let e=Math.sqrt(d),n=[(-l+e)/2/c,(-l-e)/2/c].find(e=>e>0&&e<1);if(n){let e=U.lerp(t,i,n),r=U.lerp(i,a,n),o=U.lerp(e,r,n);return[new Dr(t,e,o),new Dr(o.clone(),r,a)]}}}else if(e instanceof wr){let{p1:t,cp1:i,cp2:a,p2:o}=e,{min:s,max:c}=e.getMinMax(),l=n!==void 0&&(s.x-n)*(c.x-n)<0,u=r!==void 0&&(s.y-r)*(c.y-r)<0;if(l||u){n=.5*t.x+.5*i.x,r=.5*t.y+.5*i.y;let e=new U(n,r);n=.25*t.x+.5*i.x+.25*a.x,r=.25*t.y+.5*i.y+.25*a.y;let s=new U(n,r);n=.125*t.x+.375*i.x+.375*a.x+.125*o.x,r=.125*t.y+.375*i.y+.375*a.y+.125*o.y;let c=new U(n,r);n=.25*i.x+.5*a.x+.25*o.x,r=.25*i.y+.5*a.y+.25*o.y;let l=new U(n,r);n=.5*a.x+.5*o.x,r=.5*a.y+.5*o.y;let u=new U(n,r);return[new wr(t,e,s,c),new wr(c.clone(),l,u,o)]}}else if(e instanceof Sr){let{p1:t,p2:i}=e,a=n!==void 0&&(t.x-n)*(i.x-n)<0,o=r!==void 0&&(t.y-r)*(i.y-r)<0;if(a&&(r=t.y+(i.y-t.y)/(i.x-t.x)*(n-t.x)),o&&(n=t.x+(i.x-t.x)/(i.y-t.y)*(r-t.y)),a||o)return[new Sr(t,new U(n,r)),new Sr(new U(n,r),i)]}return[e]}var pc=class{get boundingBox(){return this.text.lineBox}get paragraphs(){return this.text.paragraphs}get isHorizontal(){return this.text.computedStyle.writingMode.startsWith(`horizontal`)}get baseWidth(){return this.isHorizontal?this.boundingBox.width:this.boundingBox.height}get baseHeight(){return this.isHorizontal?this.boundingBox.height:this.boundingBox.width}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(e=>e.characters))}constructor({text:e,intensities:t=[],maxFontSize:n=100}){this.text=e,this.intensities=t.map(e=>e/100),this.lineHeight=n}_breakLine(){let e=!this.isHorizontal,{left:t,top:n,bottom:r,right:i}=this.boundingBox,a=.5*(t+i),o=.5*(n+r);this.characters.forEach(t=>{t.glyphBox&&t.path.curves.forEach(t=>{t.curves=t.curves.flatMap(t=>fc(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Dr&&e.isFromLine){let{p1:t,cp:n,p2:r}=e;n.x=2*n.x-.5*(t.x+r.x),n.y=2*n.y-.5*(t.y+r.y)}})})}_lineToQuadraticBezier(){this.characters.forEach(e=>{e.glyphBox&&e.path.curves.forEach(e=>{e.curves=e.curves.map(e=>{if(e instanceof Sr&&e.getLength()>5){let{p1:t,p2:n}=e,r=new Dr(t.clone(),new U(.5*(t.x+n.x),.5*(t.y+n.y)),n.clone());return r.isFromLine=!0,r}return e})})})}_transform(e,t,n){let r=this.text.plugins.get(`highlight`),i=n?.(),a=0,o=this.characters.filter(e=>e.glyphBox).length;this.paragraphs.forEach((n,s)=>{n.fragments.forEach((n,c)=>{n.characters.forEach((n,l)=>{if(!n.glyphBox)return;let u=t?.({paragraphIndex:s,fragmentIndex:c,characterIndex:l,character:n},i);if(n.path.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)}),t&&r?.pathSet?.paths){let t=r.pathSet.paths.length/o,n=a*t;for(let i=0;i<t;i++)r?.pathSet?.paths[n+i]?.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)});a++}})})}),this.paragraphs.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{e.glyphBox=e.getGlyphBoundingBox(),e.glyphBox&&(e.inlineBox=e.glyphBox)})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},mc=class extends pc{preset;constructor(e,t){super(e),this.preset=t}deform(){Math.hypot(...this.intensities)&&(this._lineToQuadraticBezier(),this._bend(),this._makeTheJointSmooth())}_bend(){let{boundingBox:e,baseWidth:t,baseHeight:n,preset:r}=this,i=this.lineHeight*2/Math.sin(this.intensities[0]*Math.PI*.5),a=r.vertical===void 0||r.vertical===`auto`?!this.isHorizontal:r.vertical,{left:o,top:s,width:c,height:l}=e,u=(a?l:c)/2/i,d={x:o+c/2,y:s+l/2},f,p={x:d.x,y:d.y};a?(f=0,p.x-=n/2/Math.tan(u)+Math.sign(u)*c/2):(f=1.5*Math.PI,p.y+=t/2/Math.tan(u)+Math.sign(u)*l/2);let m=r.transform({lineHeight:i,size:u,center:d,centerDist:p,centerDistAngle:f,width:c,height:l,isHorizontal:this.isHorizontal});this._transform(m)}},hc=class{arcLengthDivisions=200;_cacheArcLengths;_needsUpdate=!1;getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;let t=[0],n=this.getPoint(0),r=0;for(let i=1;i<=e;i++){let a=this.getPoint(i/e);r+=a.distanceTo(n),t.push(r),n=a}return this._cacheArcLengths=t,t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t===void 0?e*n[r-1]:t,a=0,o=r-1,s=0;for(;a<=o;){s=Math.floor(a+(o-a)/2);let e=n[s]-i;if(e<0)a=s+1;else if(e>0)o=s-1;else{o=s;break}}if(s=o,n[s]===i)return s/(r-1);let c=n[s],l=n[s+1]-c,u=(i-c)/l;return(s+u)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}},gc=class extends hc{curveT=0;getPoint(e,t=new U){return this.getCurve(e).getPoint(this.curveT,t)}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return this.getCurve(e).getTangent(this.curveT,t)}getNormal(e,t=new U){return this.getCurve(e).getNormal(this.curveT,t)}},_c=class extends hc{start;end;constructor(e,t){super(),this.start=e,this.end=t}getPoint(e,t=new U){return e===1?t.copyFrom(this.end):t.copyFrom(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.end,this.start).normalize()}},vc=class extends hc{center;radius;start;end;constructor(e,t,n=0,r=Math.PI*2){super(),this.center=e,this.radius=t,this.start=n,this.end=r}getPoint(e,t=new U){return t.copyFrom(this.center).add(this.getNormal(e).scale(this.radius))}getTangent(e,t=new U){let{x:n,y:r}=this.getNormal(e);return t.set(-r,n)}getNormal(e,t=new U){let{start:n,end:r}=this,i=e*(r-n)+n-.5*Math.PI;return t.set(Math.cos(i),Math.sin(i))}},yc=class extends hc{center;radiusX;radiusY;rotation;startAngle;endAngle;clockwise;constructor(e=new U,t=1,n=1,r=0,i=0,a=Math.PI*2,o=!1){super(),this.center=e,this.radiusX=t,this.radiusY=n,this.rotation=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}getPoint(e,t=new U){let n=Math.PI*2,r=this.endAngle-this.startAngle,i=Math.abs(r)<2**-52;for(;r<0;)r+=n;for(;r>n;)r-=n;r<2**-52&&(r=i?0:n),this.clockwise&&!i&&(r=r===n?-n:r-n);let a=this.startAngle+e*r,o=this.center.x+this.radiusX*Math.cos(a),s=this.center.y+this.radiusY*Math.sin(a);if(this.rotation!==0){let e=Math.cos(this.rotation),t=Math.sin(this.rotation),n=o-this.center.x,r=s-this.center.y;o=n*e-r*t+this.center.x,s=n*t+r*e+this.center.y}return t.set(o,s)}},bc=class extends gc{center;size;start;end;curves=[];constructor(e,t,n=0,r=1){super(),this.center=e,this.size=t,this.start=n,this.end=r,this.update()}update(){let{x:e,y:t}=this.center,n=new U(e+.5*this.size,t-.5*this.size),r=new U(e-.5*this.size,t-.5*this.size),i=new U(e,t+.5*this.size),a=new vc(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new vc(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new vc(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),c=new U(e,t+this.size),l=new U(e+this.size,t),u=U.lerp(l,c,.75),d=new U(e-this.size,t),f=U.lerp(d,c,.75),p=new _c(l,u),m=new _c(f,d);return this.curves=[a,p,s,m,o],this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=9*Math.PI/8+1.5;let n=.5*Math.PI,r;return t<n?(r=0,this.curveT=t/n):t<n+.75?(r=1,this.curveT=(t-n)/.75):t<5*Math.PI/8+.75?(r=2,this.curveT=(t-n-.75)/(Math.PI/8)):t<5*Math.PI/8+1.5?(r=3,this.curveT=(t-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(t-5*Math.PI/8-1.5)/n),this.curves[r]}},xc=class extends gc{center;radius;number;start;end;curves=[];points=[];constructor(e,t=0,n=0,r=0,i=1){super(),this.center=e,this.radius=t,this.number=n,this.start=r,this.end=i,this.update()}update(){for(let e=0;e<this.number;e++){let t=e*2*Math.PI/this.number;t-=.5*Math.PI,this.points.push(new U(this.radius*Math.cos(t),this.radius*Math.sin(t)).add(this.center))}for(let e=0;e<this.number;e++)this.curves.push(new _c(this.points[e],this.points[(e+1)%this.number]));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1);let n=t*this.number,r=Math.floor(n);return this.curveT=n-r,this.curves[r]}},Sc=class extends gc{center;rx;aspectRatio;start;end;curves=[];constructor(e,t,n=1,r=0,i=1){super(),this.center=e,this.rx=t,this.aspectRatio=n,this.start=r,this.end=i,this.update()}update(){let{x:e,y:t}=this.center,n=this.rx,r=this.rx/this.aspectRatio,i=[new U(e-n,t-r),new U(e+n,t-r),new U(e+n,t+r),new U(e-n,t+r)];for(let e=0;e<4;e++)this.curves.push(new _c(i[e].clone(),i[(e+1)%4].clone()));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=(1+this.aspectRatio)*2;let n;return t<this.aspectRatio?(n=0,this.curveT=t/this.aspectRatio):t<this.aspectRatio+1?(n=1,this.curveT=t-this.aspectRatio):t<2*this.aspectRatio+1?(n=2,this.curveT=(t-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=t-2*this.aspectRatio-1),this.curves[n]}},Cc=class extends pc{preset;constructor(e,t){super(e),this.preset=t}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this;e.breakLine&&this._breakLine(),e.lineToQuad&&this._lineToQuadraticBezier();let[t,n]=this.intensities,r=this._createFFDControlPoints(e.hBlocks,e.vBlocks);e.build(r,{a:t,b:n,baseWidth:this.baseWidth,baseHeight:this.baseHeight,lineHeight:this.lineHeight,adjust:(e,t,n)=>this._adjustControlPoints(e,{x:t,y:n})}),e.bezier?(this._calculateForBezierFFD(r,e.hBlocks,e.vBlocks),this._makeTheJointSmooth()):this._calculateForLinearFFD(r,e.hBlocks,e.vBlocks)}_calculateForFFD(e,t,n,r){let{left:i,top:a,right:o,width:s,height:c}=this.boundingBox;this._transform(this.isHorizontal?o=>{let l=(o.x-i)/s,u=(o.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,l);for(let n=0;n<r+2;n++){let o=e(r,n,u),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]}:i=>{let l=(o-i.x)/s,u=(i.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,u);for(let n=0;n<r+2;n++){let o=e(r,n,l),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]})}_createFFDControlPoints(e,t){let{left:n,top:r,right:i,width:a,height:o}=this.boundingBox,s=[];if(this.isHorizontal){let i=a/(e+1),c=o/(t+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(n+a*i,r+e*c))}else{let n=a/(t+1),c=o/(e+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(i-e*n,r+a*c))}return s}_adjustControlPoints(e,t){this.isHorizontal?(e.x+=t.x,e.y+=t.y):(e.x-=t.y,e.y+=t.x)}_factorialForFFD(e){let t=1;for(let n=2;n<=e;n++)t*=n;return t}_combineForFFD(e,t){return this._factorialForFFD(e)/this._factorialForFFD(e-t)/this._factorialForFFD(t)}_calculateForBezierFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._combineForFFD(e+1,t)*(1-n)**(e+1-t)*n**t,e,t,n)}_linearBasis(e,t,n){let r=t<n*e?t+1-n*e:n*e-t+1;return Math.max(0,r)}_calculateForLinearFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._linearBasis(e+1,t,n),e,t,n)}},wc=class extends pc{preset;constructor(e,t){super(e),this.preset=t}_context(){return{intensities:this.intensities,baseWidth:this.baseWidth,lineHeight:this.lineHeight,isHorizontal:this.isHorizontal,boundingBox:this.boundingBox}}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this,t=this._context();if(e.engine===`offset`)this._transform(e.point,e.perChar?n=>e.perChar(t,n):void 0);else{let n=e.followTangent??!0,{funcPerChar:r,funcPerPoint:i}=this._getPerCharAndPointFunc(n);this._transform(i,r,()=>{let{width:n,height:r,left:i,top:a}=this.boundingBox;return{width:n,height:r,left:i,top:a,curve:e.makeCurve(t),isHorizontal:this.isHorizontal,needExpandAlongNormal:e.expandAlongNormal??!1}})}}_getPerCharAndPointFunc(e=!1){let t,n;return e?(n=this._resetPointPos,t=this._calculateNewCenter):(n=this._resetPointPosWithoutRotate,t=this._calculateNewCenterWithoutRotate),{funcPerPoint:n,funcPerChar:t}}_calculateNewCenter({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s,needExpandAlongNormal:c=!1}=t,{center:l,centerDiviation:u}=e,d=s?(l.x-i)/n:(l.y-a)/r,f=s?new U(0,l.y-a):new U(l.x-i,0);if(c){let e=o.getNormal(d);f.x+=e.x*-u,f.y+=e.y*-u}let p=o.getPointAt(d).add(f),m=o.getTangent(d);return{cos:m.x,sin:m.y,newCenter:p,center:l}}_calculateNewCenterWithoutRotate({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s}=t,{center:c}=e,l=s?(c.x-i)/n:(c.y-a)/r,u=s?new U(0,c.y-a):new U(c.x-i,0);return{newCenter:o.getPointAt(l).add(u),center:c}}_resetPointPos(e,t){let{cos:n=1,sin:r=0,center:i,newCenter:a}=t,o=e.x-i.x,s=e.y-i.y;return[a.x+o*n-s*r,a.y+o*r+s*n]}_resetPointPosWithoutRotate(e,t){let{center:n,newCenter:r}=t;return[e.x-n.x+r.x,e.y-n.y+r.y]}},Tc=new Map;function Ec(e,t){Tc.set(e,t)}function Dc(e){Tc.delete(e)}function Oc(){return[...Tc.keys()]}function kc(){return ac({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(O(n)||!n)return;let r=Tc.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize},a;switch(r.engine){case`ffd`:a=new Cc(i,r);break;case`bend`:a=new mc(i,r);break;case`curve`:case`offset`:a=new wc(i,r);break}a.deform();let o=e.getGlyphBox();e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Ac(e){let{highlight:t,highlightImage:n,highlightReferImage:r,highlightColormap:i,highlightLine:a,highlightSize:o,highlightThickness:s}=e;return{image:t?.image??n??`none`,referImage:t?.referImage??r??`none`,colormap:t?.colormap??i??`none`,line:t?.line??a??`none`,size:t?.size??o??`cover`,thickness:t?.thickness??s??`100%`}}function jc(){let e=new Nr,t=[],n=Pr(),r=Fr(n);return ac({name:`highlight`,pathSet:e,context:{clipRects:t,loader:n,parser:r},load:async e=>{let t=new Set;e.forEachCharacter(e=>{let{computedStyle:r}=e,{image:i,referImage:a}=Ac(r);i&&n.needsLoad(i)&&t.add(i),a&&n.needsLoad(a)&&t.add(a)}),await Promise.all(Array.from(t).map(e=>n.load(e)))},update:n=>{t.length=0,e.paths.length=0;let i=[],a,o;n.forEachCharacter(e=>{let{computedStyle:t}=e,n=Ac(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(O(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Vr(o.image,r)&&Vr(o.colormap,s)&&Vr(o.line,c)&&Vr(o.size,l)&&Vr(o.thickness,u))&&a?.length&&(d?a[0].inlineBox.left===n.left:a[0].inlineBox.top===n.top)&&a[0].fontSize===f?a.push(e):(a=[],a.push(e),i.push(a))}o=n}),i=i.filter(e=>e.length);for(let n=0;n<i.length;n++){let a=i[n],o=a[0],s=W.from(...a.map(e=>e.compatibleGlyphBox));if(!s.height||!s.width)continue;let{computedStyle:c,isVertical:l,inlineBox:u,compatibleGlyphBox:d,strikeoutPosition:f,underlinePosition:p}=o,{fontSize:m}=c,{image:h,referImage:g,colormap:_,line:v,size:y,thickness:b}=Ac(c),x=Rr(b,{fontSize:m,total:s.width})/s.width,S=zr(_),{pathSet:C,dom:w}=r.parse(h),T=C.getBoundingBox(!0)??new W,E=m/T.width*2,D=new W().copy(s);l&&(D.width=s.height,D.height=s.width,D.left=s.left+s.width);let k=Math.floor(D.width),A=k;y!==`cover`&&(A=Rr(y,{fontSize:m,total:s.width})||k,D.width=A);let j=!O(g)&&O(v);if(j)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(O(v))if(T.width/T.height>4){e=`underline`;let t=w.getAttribute(`viewBox`);if(t){let[n,r,i,a]=t.split(` `).map(e=>Number(e)),o=r+a/2;e=T.y<o&&T.y+T.height>o?`line-through`:T.y+T.height<o?`overline`:`underline`}}else e=`outline`;else e=v;switch(e){case`outline`:{let e=D.width*.2,t=D.height*.2;l?(D.x-=t/2,D.y-=e/2,D.x-=D.height):(D.x-=e/2,D.y-=t/2),D.width+=e,D.height+=t;break}case`overline`:D.height=T.height*E,l?D.x=u.left+u.width:D.y=u.top;break;case`line-through`:D.height=T.height*E,l?D.x=u.left+u.width-f+D.height/2:D.y=u.top+f-D.height/2;break;case`underline`:D.height=T.height*E,l?D.x=d.left+d.width-p:D.y=u.top+p;break}}let M=new Mn;if(M.translate(-T.x,-T.y),M.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;j||M.translate(-e,-t),M.rotate(Math.PI/2),j||M.translate(t,e)}M.translate(D.x,D.y);for(let n=0;n<Math.ceil(k/A);n++){let r=M.clone();l?r.translate(0,n*D.width):r.translate(n*D.width,0),C.paths.forEach(n=>{let i=n.clone().applyTransform(r);i.style.strokeWidth&&(i.style.strokeWidth*=E*x),i.style.strokeMiterlimit&&(i.style.strokeMiterlimit*=E),i.style.strokeDashoffset&&(i.style.strokeDashoffset*=E),i.style.strokeDasharray&&(i.style.strokeDasharray=i.style.strokeDasharray.map(e=>e*E)),i.style.fill&&i.style.fill in S&&(i.style.fill=S[i.style.fill]),i.style.stroke&&i.style.stroke in S&&(i.style.stroke=S[i.style.stroke]),e.paths.push(i),k!==A&&(l?t[e.paths.length-1]=new W(s.left-s.width*2,s.top,s.width*4,s.height):t[e.paths.length-1]=new W(s.left,s.top-s.height*2,s.width,s.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{let n=[];return e.paths.forEach((e,r)=>{let i=t[r],a=e.getBoundingBox();if(i){let e=Math.max(a.x,i.x),t=Math.max(a.y,i.y),n=Math.min(a.right,i.right),r=Math.min(a.bottom,i.bottom);a=new W(e,t,n-e,r-t)}n.push(a)}),n.length?W.from(...n):void 0},render:n=>{let{text:r,context:i}=n;e.paths.forEach((e,a)=>{if(n.drawPath(e,{clipRect:t[a]}),r.debug){let t=new Nr([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Mc(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
33
+ }`)),document.head.appendChild(n)}return this}_parseUrls(e){let t=[...new Set([...e.split(`,`),e])];return[...new Set(t.map(e=>this.familyToUrl.get(e.trim())??this.familyToUrl.get(e)??e))]}get(e){let t;return e&&(t=this._parseUrls(e).reduce((e,t)=>e||this.loaded.get(t),void 0)),t??this.fallbackFont}set(e,t){return this.familyToUrl.set(e,t.src),this.loaded.set(t.src,t),this}delete(e){return this._parseUrls(e).forEach(e=>{this.familyToUrl.delete(e),this.loaded.delete(e)}),this}clear(){return this.familyToUrl.clear(),this.loading.clear(),this.loaded.clear(),this}_parseFamilies(e){return e?(Array.isArray(e)?e:[e]).flatMap(e=>e.split(`,`).map(e=>e.trim())):[]}async load(e,t={}){let{cancelOther:n,injectStyleTag:r=!1,injectFontFace:i=!1,...a}=t,o,s;typeof e==`string`?o=e:{src:o,family:s}=e;let c=this._parseFamilies(s);if(this.loaded.has(o))return n&&(this.loading.forEach(e=>e.cancel()),this.loading.clear()),u(this.loaded.get(o));let l=this.loading.get(o);return l||(l=this._createRequest(o,a),this.loading.set(o,l)),n&&this.loading.forEach((e,t)=>{e!==l&&(e.cancel(),this.loading.delete(t))}),l.when.then(e=>{let n;return this.loaded.has(o)?n=u(this.loaded.get(o)):(n=d(e),t.noAdd||this.loaded.set(o,n)),Promise.all(Array.from(n.familySet,async t=>{if(this.familyToUrl.set(t,o),typeof document<`u`&&(i&&await this.injectFontFace(t,e),r&&this.injectStyleTag(t,o),i||r))return await document.fonts.load(`14px "${t}"`)})).then(()=>n)}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return d();throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}function d(e=new ArrayBuffer(0)){let t;function n(){return t||=e.byteLength?ic(e,!1):void 0,t}function r(){let e=n();if(e instanceof Ws||e instanceof nc)return e.sfnt}return{src:o,family:s,buffer:e,familySet:new Set(c),getFont:n,getSFNT:r}}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},oc=new Set([`©`,`®`,`÷`]),sc=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),cc={1:`italic`,32:`bold`},lc={1:`italic`,2:`bold`},uc={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},dc=class{content;index;parent;path=new Vr().setMeta(this);lineBox=new W;inlineBox=new W;glyphBox;advanceWidth=0;advanceHeight=0;underlinePosition=0;underlineThickness=0;strikeoutPosition=0;strikeoutSize=0;ascender=0;descender=0;typoAscender=0;typoDescender=0;typoLineGap=0;winAscent=0;winDescent=0;xHeight=0;capHeight=0;baseline=0;centerDiviation=0;fontStyle;get compatibleGlyphBox(){let e=this.computedStyle.fontSize*.8;return this.glyphBox??(this.isVertical?new W(this.lineBox.left+this.lineBox.width/2-e/2,this.lineBox.top,e,this.lineBox.height):new W(this.lineBox.left,this.lineBox.top+this.lineBox.height/2-e/2,this.lineBox.width,e))}get center(){return this.compatibleGlyphBox.center}get computedFill(){return this.parent.computedFill}get computedOutline(){return this.parent.computedOutline}get computedStyle(){return this.parent.computedStyle}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get fontSize(){return this.computedStyle.fontSize}get fontHeight(){return this.fontSize*this.computedStyle.lineHeight}constructor(e,t,n){this.content=e,this.index=t,this.parent=n}_getFontSFNT(e){let t=this.computedStyle.fontFamily,n=e??ac,r=(t?n.get(t):n.fallbackFont)?.getSFNT();return r?.textToGlyphIndexes(this.content).includes(0)&&(r=n.fallbackFont?.getSFNT()),r}updateGlyph(e=this._getFontSFNT()){if(!e)return this;let{hhea:t,os2:n,post:r,head:i}=e,a=i.unitsPerEm,o=t.ascent,s=t.descent,{content:c,computedStyle:l}=this,{fontSize:u}=l,d=a/u,f=e.getAdvanceWidth(c,u),p=(o+Math.abs(s))/d,m=o/d;return this.advanceWidth=f,this.advanceHeight=p,this.underlinePosition=(o-r.underlinePosition)/d,this.underlineThickness=r.underlineThickness/d,this.strikeoutPosition=(o-n.yStrikeoutPosition)/d,this.strikeoutSize=n.yStrikeoutSize/d,this.ascender=o/d,this.descender=s/d,this.typoAscender=n.sTypoAscender/d,this.typoDescender=n.sTypoDescender/d,this.typoLineGap=n.sTypoLineGap/d,this.winAscent=n.usWinAscent/d,this.winDescent=n.usWinDescent/d,this.xHeight=n.version>1?n.sxHeight/d:0,this.capHeight=n.version>1?n.sCapHeight/d:0,this.baseline=m,this.centerDiviation=p/2-m,this.fontStyle=cc[n.fsSelection]??lc[i.macStyle],this}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let{isVertical:n,content:r,computedStyle:i,baseline:a,inlineBox:o,ascender:s,descender:c,typoAscender:l,fontStyle:u,advanceWidth:d,advanceHeight:f}=this,{left:p,top:m}=o,h=i.fontStyle===`italic`&&u!==`italic`,g=p,_=m+a,v,y=new Vr().setMeta(this);if(n&&(g+=(f-d)/2,Math.abs(d-f)>.1&&(_-=(s-l)/(s+Math.abs(c))*f),v=void 0),n&&!oc.has(r)&&(r.codePointAt(0)<=256||sc.has(r))){y.addCommands(t.getPathCommands(r,g,m+a-(f-d)/2,i.fontSize));let e={y:m-(f-d)/2+f/2,x:g+d/2};h&&this._italic(y,{x:e.x,y:m-(f-d)/2+a}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(r,g,_,i.fontSize)),h&&this._italic(y,n?{x:g+f/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,i.fontSize)),h&&this._italic(y,n?{x:g+d/2,y:m+l/(s+Math.abs(c))*f}:void 0));let b=i.fontWeight??400;return b in uc&&(b===700||b===`bold`)&&u!==`bold`&&y.bold(uc[b]*i.fontSize*.05),y.style=A({fill:i.color,fillRule:`nonzero`,stroke:i.textStrokeWidth?i.textStrokeColor:void 0,strokeWidth:i.textStrokeWidth?i.textStrokeWidth*i.fontSize*.03:void 0}),this.path=y,this.glyphBox=this.getGlyphBoundingBox(),this}_italic(e,t){e.skew(-.24,0,t||{y:this.inlineBox.top+this.baseline,x:this.inlineBox.left+this.inlineBox.width/2})}getGlyphMinMax(e,t,n){if(this.path.curves[0]?.curves.length)return this.path.getMinMax(e,t,n)}getGlyphBoundingBox(e){let t=this.getGlyphMinMax(void 0,void 0,e);if(!t)return;let{min:n,max:r}=t;return new W(n.x,n.y,r.x-n.x,r.y-n.y)}},fc=class{content;style;fill;outline;index;parent;inlineBox=new W;get computedContent(){let e=this.computedStyle;return e.textTransform===`uppercase`?this.content.toUpperCase():e.textTransform===`lowercase`?this.content.toLowerCase():this.content}constructor(e,t={},n,r,i,a){this.content=e,this.style=t,this.fill=n,this.outline=r,this.index=i,this.parent=a,this.update().initCharacters()}update(){this.computedStyle={...this.parent.computedStyle,...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new dc(n,t++,this));return this.characters=e,this}},pc=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...A(this.parent.computedStyle),...A(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?A(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?A(t):void 0,this}};function mc(e){return e}var hc;function gc(){if(hc?.isConnected)return hc;let e=document.createElement(`div`);return e.dataset.modernText=`measurer`,Object.assign(e.style,{position:`fixed`,left:`0`,top:`0`,visibility:`hidden`,pointerEvents:`none`}),document.body.appendChild(e),hc=e,e}var _c=class e{static notZeroStyles=new Set([`width`,`height`]);static pxStyles=new Set([`width`,`height`,`fontSize`,`letterSpacing`,`textStrokeWidth`,`textIndent`,`shadowOffsetX`,`shadowOffsetY`,`shadowBlur`,`margin`,`marginLeft`,`marginTop`,`marginRight`,`marginBottom`,`padding`,`paddingLeft`,`paddingTop`,`paddingRight`,`paddingBottom`]);_styleCache=new WeakMap;_mountedDom;_mountedSignature;_toDomStyle(t){let n=this._styleCache.get(t);if(n)return n;let r={},{notZeroStyles:i,pxStyles:a}=e;for(let e in t){let n=t[e];i.has(e)&&n===0||(r[e]=typeof n==`number`&&a.has(e)?`${n}px`:n)}return this._styleCache.set(t,r),r}_resolveRootStyles(e){let t={...e},n=e.writingMode.includes(`horizontal`);switch(e.textAlign){case`start`:case`left`:t.justifyContent=`flex-start`;break;case`center`:t.justifyContent=`center`;break;case`end`:case`right`:t.justifyContent=`flex-end`;break}switch(e.verticalAlign){case`top`:t.alignItems=`flex-start`;break;case`middle`:t.alignItems=`center`;break;case`bottom`:t.alignItems=`flex-end`;break}let r=!!(t.justifyContent||t.alignItems);return{section:{...this._toDomStyle({...t,boxSizing:t.boxSizing??`border-box`,display:t.display??(r?`inline-flex`:void 0),width:t.width??`max-content`,height:t.height??`max-content`}),whiteSpace:`pre-wrap`,wordBreak:`break-all`},ul:{verticalAlign:`inherit`,listStyleType:`inherit`,padding:`0`,margin:`0`,width:r&&n?`100%`:void 0,height:r&&!n?`100%`:void 0}}}_applyRootStyle(e,t,n){let r=this._resolveRootStyles(n);e.removeAttribute(`style`),Object.assign(e.style,r.section),t.removeAttribute(`style`),Object.assign(t.style,r.ul)}_applyLiStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applySpanStyle(e,t){e.removeAttribute(`style`),e.style.verticalAlign=`inherit`,Object.assign(e.style,this._toDomStyle(t.style))}_applyFragmentContent(e,t){let n=e.firstChild;n?n.data!==t.content&&(n.data=t.content):e.appendChild(document.createTextNode(t.content))}_hide(e){e.style.visibility=`hidden`}_signature(e){let t=`${e.length}`;for(let n=0;n<e.length;n++)t+=`:${e[n].fragments.length}`;return t}createDom(e,t){let n=document.createElement(`section`),r=document.createElement(`ul`);return this._applyRootStyle(n,r,t),e.forEach(e=>{let t=document.createElement(`li`);this._applyLiStyle(t,e),e.fragments.forEach(e=>{let n=document.createElement(`span`);this._applySpanStyle(n,e),this._applyFragmentContent(n,e),t.appendChild(n)}),r.appendChild(t)}),n.appendChild(r),n}_patchDom(e,t,n,r){let i=e.firstChild;this._applyRootStyle(e,i,n),r&&this._hide(e);let a=i.children;for(let e=0;e<t.length;e++){let n=a[e];this._applyLiStyle(n,t[e]);let r=t[e].fragments,i=n.children;for(let e=0;e<r.length;e++){let t=i[e];this._applySpanStyle(t,r[e]),this._applyFragmentContent(t,r[e])}}}measureDomText(e){let t=e.data??``,n=[];if(!t.length)return n;let r=document.createRange(),i=0;for(;i<t.length;){let a=t.codePointAt(i),o=i+(a>65535?2:1);r.setStart(e,i),r.setEnd(e,o);let s=r.getClientRects?.(),c;s&&s.length?(c=s[s.length-1],s.length>1&&c.width<2&&(c=s[s.length-2])):c=r.getBoundingClientRect(),c&&c.width+c.height!==0&&n.push({content:t.slice(i,o),top:c.top,left:c.left,width:c.width,height:c.height}),i=o}return n}measureDom(e){let t=[],n=[],r=[];return e.querySelectorAll(`li`).forEach((e,i)=>{let a=e.getBoundingClientRect();t.push({paragraphIndex:i,left:a.x,top:a.y,width:a.width,height:a.height}),e.querySelectorAll(`:scope > *`).forEach((e,t)=>{let a=e.getBoundingClientRect();n.push({paragraphIndex:i,fragmentIndex:t,left:a.x,top:a.y,width:a.width,height:a.height});let o=0,s=e=>{this.measureDomText(e).forEach(e=>{r.push({...e,newParagraphIndex:-1,paragraphIndex:i,fragmentIndex:t,characterIndex:o++,textWidth:-1,textHeight:-1})})};!e.children.length&&e.firstChild instanceof window.Text?s(e.firstChild):e.querySelectorAll(`:scope > *`).forEach(e=>{e.firstChild instanceof window.Text&&s(e.firstChild)})})}),{paragraphs:t,fragments:n,characters:r}}measureParagraphDom(e,t){let n=t.getBoundingClientRect(),r=this.measureDom(t);r.paragraphs.forEach(t=>{let r=e[t.paragraphIndex].lineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height}),r.fragments.forEach(t=>{let r=e[t.paragraphIndex].fragments[t.fragmentIndex].inlineBox;r.left=t.left-n.left,r.top=t.top-n.top,r.width=t.width,r.height=t.height});let i=[];return r.characters.forEach(t=>{let{paragraphIndex:r,fragmentIndex:a,characterIndex:o}=t,s=t.left-n.left,c=t.top-n.top;i.push({...t,newParagraphIndex:r,left:s,top:c});let{fontHeight:l,isVertical:u,inlineBox:d,lineBox:f}=e[r].fragments[a].characters[o];d.left=s,d.top=c,d.width=t.width,d.height=t.height,u?(f.left=s+(t.width-l)/2,f.top=c,f.width=l,f.height=t.height):(f.left=s,f.top=c+(t.height-l)/2,f.width=t.width,f.height=l)}),{paragraphs:e,boundingBox:new W(0,0,n.width,n.height)}}measure(e,t,n){return this.measureParagraphDom(e,n??this._mount(e,t))}_mount(e,t){let n=this._signature(e);if(this._mountedDom?.isConnected&&this._mountedSignature===n)return this._patchDom(this._mountedDom,e,t,!0),this._mountedDom;this._unmount();let r=this.createDom(e,t);return this._hide(r),gc().appendChild(r),this._mountedDom=r,this._mountedSignature=n,r}_unmount(){this._mountedDom?.parentNode?.removeChild(this._mountedDom),this._mountedDom=void 0,this._mountedSignature=void 0}dispose(){this._unmount()}};function vc(e,t,n){return e[`${t}${n}`]??e[t]??0}var yc=class{measure(e,t,n,r){let i=r??ac;for(let t of e)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:vc(e,`padding`,`Top`),right:vc(e,`padding`,`Right`),bottom:vc(e,`padding`,`Bottom`),left:vc(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=r?t.width-n.left-n.right:1/0,a=n.top,o=n.left;for(let t of e){let e=t.computedStyle,r=t.style,s=vc(r,`margin`,`Top`),c=vc(r,`margin`,`Bottom`),l=vc(r,`margin`,`Left`),u=vc(r,`margin`,`Right`),d=vc(r,`padding`,`Top`),f=vc(r,`padding`,`Bottom`),p=vc(r,`padding`,`Left`),m=vc(r,`padding`,`Right`),h=n.left+l+p,g=i===1/0?1/0:i-l-u-p-m;a+=s+d;let _=a,v=h,y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,o=0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),o+=this._advance(e);let s=h+r;if(g!==1/0){let e=g-r-o;b===`center`?s+=e/2:(b===`end`||b===`right`)&&(s+=e)}for(let e of n){let t=e.advanceWidth,n=e.advanceHeight,r=e.fontHeight;e.inlineBox.left=s,e.inlineBox.top=a+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,e.lineBox.left=s,e.lineBox.top=e.inlineBox.top+(n-r)/2,e.lineBox.width=t,e.lineBox.height=r,s+=this._advance(e)}s>v&&(v=s),a+=i}v>o&&(o=v);for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));t.lineBox.left=h,t.lineBox.top=_,t.lineBox.width=g===1/0?v-h:g,t.lineBox.height=a-_,a+=f+c}let s=a+n.bottom,c=r?t.width:o+n.right,l=typeof t.height==`number`?t.height:s;if(typeof t.height==`number`){let n=l-s,r=t.verticalAlign,i=r===`middle`?n/2:r===`bottom`?n:0;i&&this._shiftAll(e,i)}return{paragraphs:e,boundingBox:new W(0,0,c,l)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=r?t.height-n.top-n.bottom:1/0,a=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,i)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);a.push({chars:n,thickness:t})}}let o=a.reduce((e,t)=>e+t.thickness,0),s=typeof t.width==`number`,c=s?Math.max(t.width-n.left-n.right,o):o,l=n.left+c,u=n.top;for(let e of a){l-=e.thickness;let t=l,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight,o=n.fontHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,n.lineBox.left=n.inlineBox.left+(a-o)/2,n.lineBox.top=r,n.lineBox.width=o,n.lineBox.height=i,r+=this._advance(n)}r>u&&(u=r)}for(let t of e){for(let e of t.fragments)this._unionInto(e.inlineBox,e.characters.map(e=>e.inlineBox));this._unionInto(t.lineBox,t.fragments.flatMap(e=>e.characters.map(e=>e.inlineBox)))}return{paragraphs:e,boundingBox:new W(0,0,s?t.width:c+n.left+n.right,r?t.height:u+n.bottom)}}_advance(e){return e.advanceWidth+(e.computedStyle.letterSpacing??0)}_breakLines(e,t){let n=[],r=[],i=0,a=()=>{n.push(r),r=[],i=0};for(let n of e.fragments)for(let e of n.characters){if(e.content===`
34
+ `||e.content===`\r`){a();continue}t!==1/0&&r.length>0&&i+e.advanceWidth>t&&a(),r.push(e),i+=this._advance(e)}return a(),n}_unionInto(e,t){let n=t.filter(e=>e.width!==0||e.height!==0);if(!n.length)return;let r=W.from(...n);e.left=r.left,e.top=r.top,e.width=r.width,e.height=r.height}_shiftAll(e,t){for(let n of e){n.lineBox.top+=t;for(let e of n.fragments){e.inlineBox.top+=t;for(let n of e.characters)n.inlineBox.top+=t,n.lineBox.top+=t}}}dispose(){}};function bc(){let e=new Hr,t=Ur(),n=Wr(t);return{name:`background`,pathSet:e,context:{loader:t,parser:n},load:async e=>{let{backgroundImage:n}=e.computedStyle;n&&t.needsLoad(n)&&await t.load(n)},update:t=>{e.paths.length=0;let{computedStyle:r,lineBox:i,isVertical:a}=t,{backgroundImage:o,backgroundSize:s,backgroundColormap:c}=r;if(O(o))return;let{pathSet:l}=n.parse(o),u=l.getBoundingBox(!0)??new W,d,f,p,m;a?{x:f,y:d,width:m,height:p}=i:{x:d,y:f,width:p,height:m}=i;let h=Jr(c??`none`),g=l.paths.map(e=>{let t=e.clone();return t.style.fill&&t.style.fill in h&&(t.style.fill=h[t.style.fill]),t.style.stroke&&t.style.stroke in h&&(t.style.stroke=h[t.style.stroke]),t}),_,v;if(s===`rigid`){_=t.fontSize*5/u.width,v=_;let e=new U;e.x=u.width-p/_,e.y=u.height-m/v,g.forEach(t=>{t.applyTransform(t=>{let n=t.x>u.left+u.width/2,r=t.y>u.top+u.height/2;n&&(t.x-=e.x),r&&(t.y-=e.y)})})}else _=p/u.width,v=m/u.height;let y=new Bn;y.translate(-u.x,-u.y),y.scale(_,v),a&&(y.translate(-p/2,-m/2),y.rotate(Math.PI/2),y.translate(m/2,p/2)),y.translate(d,f),g.forEach(e=>{e.applyTransform(y)}),e.paths.push(...g)},renderOrder:-2,render:t=>{let{text:n,context:r}=t,{lineBox:i,computedStyle:a}=n;O(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Hr([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;O(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function xc(e,t){let{x:n,y:r}=t;if(e instanceof Ir){let{p1:t,cp:i,p2:a}=e,o=n!==void 0&&Math.abs(Math.sign(t.x-n)+Math.sign(i.x-n)+Math.sign(a.x-n))===1,s=r!==void 0&&Math.abs(Math.sign(t.y-r)+Math.sign(i.y-r)+Math.sign(a.y-r))===1,c,l,u,d;if(o&&(c=t.x-2*i.x+a.x,l=2*(-t.x+i.x),u=t.x-n),s&&(c=t.y-2*i.y+a.y,l=2*(-t.y+i.y),u=t.y-r),(o||s)&&(d=l*l-4*c*u,d>0)){let e=Math.sqrt(d),n=[(-l+e)/2/c,(-l-e)/2/c].find(e=>e>0&&e<1);if(n){let e=U.lerp(t,i,n),r=U.lerp(i,a,n),o=U.lerp(e,r,n);return[new Ir(t,e,o),new Ir(o.clone(),r,a)]}}}else if(e instanceof Nr){let{p1:t,cp1:i,cp2:a,p2:o}=e,{min:s,max:c}=e.getMinMax(),l=n!==void 0&&(s.x-n)*(c.x-n)<0,u=r!==void 0&&(s.y-r)*(c.y-r)<0;if(l||u){n=.5*t.x+.5*i.x,r=.5*t.y+.5*i.y;let e=new U(n,r);n=.25*t.x+.5*i.x+.25*a.x,r=.25*t.y+.5*i.y+.25*a.y;let s=new U(n,r);n=.125*t.x+.375*i.x+.375*a.x+.125*o.x,r=.125*t.y+.375*i.y+.375*a.y+.125*o.y;let c=new U(n,r);n=.25*i.x+.5*a.x+.25*o.x,r=.25*i.y+.5*a.y+.25*o.y;let l=new U(n,r);n=.5*a.x+.5*o.x,r=.5*a.y+.5*o.y;let u=new U(n,r);return[new Nr(t,e,s,c),new Nr(c.clone(),l,u,o)]}}else if(e instanceof jr){let{p1:t,p2:i}=e,a=n!==void 0&&(t.x-n)*(i.x-n)<0,o=r!==void 0&&(t.y-r)*(i.y-r)<0;if(a&&(r=t.y+(i.y-t.y)/(i.x-t.x)*(n-t.x)),o&&(n=t.x+(i.x-t.x)/(i.y-t.y)*(r-t.y)),a||o)return[new jr(t,new U(n,r)),new jr(new U(n,r),i)]}return[e]}var Sc=class{get boundingBox(){return this.text.lineBox}get paragraphs(){return this.text.paragraphs}get isHorizontal(){return this.text.computedStyle.writingMode.startsWith(`horizontal`)}get baseWidth(){return this.isHorizontal?this.boundingBox.width:this.boundingBox.height}get baseHeight(){return this.isHorizontal?this.boundingBox.height:this.boundingBox.width}get characters(){return this.paragraphs.flatMap(e=>e.fragments.flatMap(e=>e.characters))}constructor({text:e,intensities:t=[],maxFontSize:n=100}){this.text=e,this.intensities=t.map(e=>e/100),this.lineHeight=n}_breakLine(){let e=!this.isHorizontal,{left:t,top:n,bottom:r,right:i}=this.boundingBox,a=.5*(t+i),o=.5*(n+r);this.characters.forEach(t=>{t.glyphBox&&t.path.curves.forEach(t=>{t.curves=t.curves.flatMap(t=>xc(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Ir&&e.isFromLine){let{p1:t,cp:n,p2:r}=e;n.x=2*n.x-.5*(t.x+r.x),n.y=2*n.y-.5*(t.y+r.y)}})})}_lineToQuadraticBezier(){this.characters.forEach(e=>{e.glyphBox&&e.path.curves.forEach(e=>{e.curves=e.curves.map(e=>{if(e instanceof jr&&e.getLength()>5){let{p1:t,p2:n}=e,r=new Ir(t.clone(),new U(.5*(t.x+n.x),.5*(t.y+n.y)),n.clone());return r.isFromLine=!0,r}return e})})})}_transform(e,t,n){let r=this.text.plugins.get(`highlight`),i=n?.(),a=0,o=this.characters.filter(e=>e.glyphBox).length;this.paragraphs.forEach((n,s)=>{n.fragments.forEach((n,c)=>{n.characters.forEach((n,l)=>{if(!n.glyphBox)return;let u=t?.({paragraphIndex:s,fragmentIndex:c,characterIndex:l,character:n},i);if(n.path.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)}),t&&r?.pathSet?.paths){let t=r.pathSet.paths.length/o,n=a*t;for(let i=0;i<t;i++)r?.pathSet?.paths[n+i]?.getControlPointRefs().forEach(t=>{let[n,r]=e(t,u);t.set(n,r)});a++}})})}),this.paragraphs.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{e.glyphBox=e.getGlyphBoundingBox(),e.glyphBox&&(e.inlineBox=e.glyphBox)})})}),t||r?.pathSet?.paths?.forEach(t=>{t.getControlPointRefs().forEach(t=>{let[n,r]=e(t);t.set(n,r)})})}},Cc=class extends Sc{preset;constructor(e,t){super(e),this.preset=t}deform(){Math.hypot(...this.intensities)&&(this._lineToQuadraticBezier(),this._bend(),this._makeTheJointSmooth())}_bend(){let{boundingBox:e,baseWidth:t,baseHeight:n,preset:r}=this,i=this.lineHeight*2/Math.sin(this.intensities[0]*Math.PI*.5),a=r.vertical===void 0||r.vertical===`auto`?!this.isHorizontal:r.vertical,{left:o,top:s,width:c,height:l}=e,u=(a?l:c)/2/i,d={x:o+c/2,y:s+l/2},f,p={x:d.x,y:d.y};a?(f=0,p.x-=n/2/Math.tan(u)+Math.sign(u)*c/2):(f=1.5*Math.PI,p.y+=t/2/Math.tan(u)+Math.sign(u)*l/2);let m=r.transform({lineHeight:i,size:u,center:d,centerDist:p,centerDistAngle:f,width:c,height:l,isHorizontal:this.isHorizontal});this._transform(m)}},wc=class{arcLengthDivisions=200;_cacheArcLengths;_needsUpdate=!1;getPointAt(e,t=new U){return this.getPoint(this.getUToTMapping(e),t)}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this._cacheArcLengths&&this._cacheArcLengths.length===e+1&&!this._needsUpdate)return this._cacheArcLengths;this._needsUpdate=!1;let t=[0],n=this.getPoint(0),r=0;for(let i=1;i<=e;i++){let a=this.getPoint(i/e);r+=a.distanceTo(n),t.push(r),n=a}return this._cacheArcLengths=t,t}getUToTMapping(e,t){let n=this.getLengths(),r=n.length,i=t===void 0?e*n[r-1]:t,a=0,o=r-1,s=0;for(;a<=o;){s=Math.floor(a+(o-a)/2);let e=n[s]-i;if(e<0)a=s+1;else if(e>0)o=s-1;else{o=s;break}}if(s=o,n[s]===i)return s/(r-1);let c=n[s],l=n[s+1]-c,u=(i-c)/l;return(s+u)/(r-1)}getTangent(e,t=new U){let n=1e-4,r=Math.max(0,e-n),i=Math.min(1,e+n);return t.copyFrom(this.getPoint(i).sub(this.getPoint(r)).normalize())}getNormal(e,t=new U){return this.getTangent(e,t),t.set(-t.y,t.x).normalize()}},Tc=class extends wc{curveT=0;getPoint(e,t=new U){return this.getCurve(e).getPoint(this.curveT,t)}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return this.getCurve(e).getTangent(this.curveT,t)}getNormal(e,t=new U){return this.getCurve(e).getNormal(this.curveT,t)}},Ec=class extends wc{start;end;constructor(e,t){super(),this.start=e,this.end=t}getPoint(e,t=new U){return e===1?t.copyFrom(this.end):t.copyFrom(this.end).sub(this.start).scale(e).add(this.start),t}getPointAt(e,t=new U){return this.getPoint(e,t)}getTangent(e,t=new U){return t.subVectors(this.end,this.start).normalize()}},Dc=class extends wc{center;radius;start;end;constructor(e,t,n=0,r=Math.PI*2){super(),this.center=e,this.radius=t,this.start=n,this.end=r}getPoint(e,t=new U){return t.copyFrom(this.center).add(this.getNormal(e).scale(this.radius))}getTangent(e,t=new U){let{x:n,y:r}=this.getNormal(e);return t.set(-r,n)}getNormal(e,t=new U){let{start:n,end:r}=this,i=e*(r-n)+n-.5*Math.PI;return t.set(Math.cos(i),Math.sin(i))}},Oc=class extends wc{center;radiusX;radiusY;rotation;startAngle;endAngle;clockwise;constructor(e=new U,t=1,n=1,r=0,i=0,a=Math.PI*2,o=!1){super(),this.center=e,this.radiusX=t,this.radiusY=n,this.rotation=r,this.startAngle=i,this.endAngle=a,this.clockwise=o}getPoint(e,t=new U){let n=Math.PI*2,r=this.endAngle-this.startAngle,i=Math.abs(r)<2**-52;for(;r<0;)r+=n;for(;r>n;)r-=n;r<2**-52&&(r=i?0:n),this.clockwise&&!i&&(r=r===n?-n:r-n);let a=this.startAngle+e*r,o=this.center.x+this.radiusX*Math.cos(a),s=this.center.y+this.radiusY*Math.sin(a);if(this.rotation!==0){let e=Math.cos(this.rotation),t=Math.sin(this.rotation),n=o-this.center.x,r=s-this.center.y;o=n*e-r*t+this.center.x,s=n*t+r*e+this.center.y}return t.set(o,s)}},kc=class extends Tc{center;size;start;end;curves=[];constructor(e,t,n=0,r=1){super(),this.center=e,this.size=t,this.start=n,this.end=r,this.update()}update(){let{x:e,y:t}=this.center,n=new U(e+.5*this.size,t-.5*this.size),r=new U(e-.5*this.size,t-.5*this.size),i=new U(e,t+.5*this.size),a=new Dc(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new Dc(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new Dc(i,.5*Math.SQRT1_2*this.size,.75*Math.PI,1.25*Math.PI),c=new U(e,t+this.size),l=new U(e+this.size,t),u=U.lerp(l,c,.75),d=new U(e-this.size,t),f=U.lerp(d,c,.75),p=new Ec(l,u),m=new Ec(f,d);return this.curves=[a,p,s,m,o],this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=9*Math.PI/8+1.5;let n=.5*Math.PI,r;return t<n?(r=0,this.curveT=t/n):t<n+.75?(r=1,this.curveT=(t-n)/.75):t<5*Math.PI/8+.75?(r=2,this.curveT=(t-n-.75)/(Math.PI/8)):t<5*Math.PI/8+1.5?(r=3,this.curveT=(t-5*Math.PI/8-.75)/.75):(r=4,this.curveT=(t-5*Math.PI/8-1.5)/n),this.curves[r]}},Ac=class extends Tc{center;radius;number;start;end;curves=[];points=[];constructor(e,t=0,n=0,r=0,i=1){super(),this.center=e,this.radius=t,this.number=n,this.start=r,this.end=i,this.update()}update(){for(let e=0;e<this.number;e++){let t=e*2*Math.PI/this.number;t-=.5*Math.PI,this.points.push(new U(this.radius*Math.cos(t),this.radius*Math.sin(t)).add(this.center))}for(let e=0;e<this.number;e++)this.curves.push(new Ec(this.points[e],this.points[(e+1)%this.number]));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1);let n=t*this.number,r=Math.floor(n);return this.curveT=n-r,this.curves[r]}},jc=class extends Tc{center;rx;aspectRatio;start;end;curves=[];constructor(e,t,n=1,r=0,i=1){super(),this.center=e,this.rx=t,this.aspectRatio=n,this.start=r,this.end=i,this.update()}update(){let{x:e,y:t}=this.center,n=this.rx,r=this.rx/this.aspectRatio,i=[new U(e-n,t-r),new U(e+n,t-r),new U(e+n,t+r),new U(e-n,t+r)];for(let e=0;e<4;e++)this.curves.push(new Ec(i[e].clone(),i[(e+1)%4].clone()));return this}getCurve(e){let t=(e*(this.end-this.start)+this.start)%1;t<0&&(t+=1),t*=(1+this.aspectRatio)*2;let n;return t<this.aspectRatio?(n=0,this.curveT=t/this.aspectRatio):t<this.aspectRatio+1?(n=1,this.curveT=t-this.aspectRatio):t<2*this.aspectRatio+1?(n=2,this.curveT=(t-this.aspectRatio-1)/this.aspectRatio):(n=3,this.curveT=t-2*this.aspectRatio-1),this.curves[n]}},Mc=class extends Sc{preset;constructor(e,t){super(e),this.preset=t}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this;e.breakLine&&this._breakLine(),e.lineToQuad&&this._lineToQuadraticBezier();let[t,n]=this.intensities,r=this._createFFDControlPoints(e.hBlocks,e.vBlocks);e.build(r,{a:t,b:n,baseWidth:this.baseWidth,baseHeight:this.baseHeight,lineHeight:this.lineHeight,adjust:(e,t,n)=>this._adjustControlPoints(e,{x:t,y:n})}),e.bezier?(this._calculateForBezierFFD(r,e.hBlocks,e.vBlocks),this._makeTheJointSmooth()):this._calculateForLinearFFD(r,e.hBlocks,e.vBlocks)}_calculateForFFD(e,t,n,r){let{left:i,top:a,right:o,width:s,height:c}=this.boundingBox;this._transform(this.isHorizontal?o=>{let l=(o.x-i)/s,u=(o.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,l);for(let n=0;n<r+2;n++){let o=e(r,n,u),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]}:i=>{let l=(o-i.x)/s,u=(i.y-a)/c,[d,f]=[0,0];for(let i=0;i<n+2;i++){let a=e(n,i,u);for(let n=0;n<r+2;n++){let o=e(r,n,l),s=t[i*(r+2)+n];d+=a*o*s.x,f+=a*o*s.y}}return[d,f]})}_createFFDControlPoints(e,t){let{left:n,top:r,right:i,width:a,height:o}=this.boundingBox,s=[];if(this.isHorizontal){let i=a/(e+1),c=o/(t+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(n+a*i,r+e*c))}else{let n=a/(t+1),c=o/(e+1);for(let a=0;a<e+2;a++)for(let e=0;e<t+2;e++)s.push(new U(i-e*n,r+a*c))}return s}_adjustControlPoints(e,t){this.isHorizontal?(e.x+=t.x,e.y+=t.y):(e.x-=t.y,e.y+=t.x)}_factorialForFFD(e){let t=1;for(let n=2;n<=e;n++)t*=n;return t}_combineForFFD(e,t){return this._factorialForFFD(e)/this._factorialForFFD(e-t)/this._factorialForFFD(t)}_calculateForBezierFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._combineForFFD(e+1,t)*(1-n)**(e+1-t)*n**t,e,t,n)}_linearBasis(e,t,n){let r=t<n*e?t+1-n*e:n*e-t+1;return Math.max(0,r)}_calculateForLinearFFD(e,t,n){this._calculateForFFD((e,t,n)=>this._linearBasis(e+1,t,n),e,t,n)}},Nc=class extends Sc{preset;constructor(e,t){super(e),this.preset=t}_context(){return{intensities:this.intensities,baseWidth:this.baseWidth,lineHeight:this.lineHeight,isHorizontal:this.isHorizontal,boundingBox:this.boundingBox}}deform(){if(!Math.hypot(...this.intensities))return;let{preset:e}=this,t=this._context();if(e.engine===`offset`)this._transform(e.point,e.perChar?n=>e.perChar(t,n):void 0);else{let n=e.followTangent??!0,{funcPerChar:r,funcPerPoint:i}=this._getPerCharAndPointFunc(n);this._transform(i,r,()=>{let{width:n,height:r,left:i,top:a}=this.boundingBox;return{width:n,height:r,left:i,top:a,curve:e.makeCurve(t),isHorizontal:this.isHorizontal,needExpandAlongNormal:e.expandAlongNormal??!1}})}}_getPerCharAndPointFunc(e=!1){let t,n;return e?(n=this._resetPointPos,t=this._calculateNewCenter):(n=this._resetPointPosWithoutRotate,t=this._calculateNewCenterWithoutRotate),{funcPerPoint:n,funcPerChar:t}}_calculateNewCenter({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s,needExpandAlongNormal:c=!1}=t,{center:l,centerDiviation:u}=e,d=s?(l.x-i)/n:(l.y-a)/r,f=s?new U(0,l.y-a):new U(l.x-i,0);if(c){let e=o.getNormal(d);f.x+=e.x*-u,f.y+=e.y*-u}let p=o.getPointAt(d).add(f),m=o.getTangent(d);return{cos:m.x,sin:m.y,newCenter:p,center:l}}_calculateNewCenterWithoutRotate({character:e},t){let{width:n,height:r,left:i,top:a,curve:o,isHorizontal:s}=t,{center:c}=e,l=s?(c.x-i)/n:(c.y-a)/r,u=s?new U(0,c.y-a):new U(c.x-i,0);return{newCenter:o.getPointAt(l).add(u),center:c}}_resetPointPos(e,t){let{cos:n=1,sin:r=0,center:i,newCenter:a}=t,o=e.x-i.x,s=e.y-i.y;return[a.x+o*n-s*r,a.y+o*r+s*n]}_resetPointPosWithoutRotate(e,t){let{center:n,newCenter:r}=t;return[e.x-n.x+r.x,e.y-n.y+r.y]}},Pc=new Map;function Fc(e,t){Pc.set(e,t)}function Ic(e){Pc.delete(e)}function Lc(){return[...Pc.keys()]}function Rc(){return mc({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(O(n)||!n)return;let r=Pc.get(n);if(!r)return;let i={text:e,intensities:t.intensities??r.defaultIntensities,maxFontSize:t.maxFontSize},a;switch(r.engine){case`ffd`:a=new Mc(i,r);break;case`bend`:a=new Cc(i,r);break;case`curve`:case`offset`:a=new Nc(i,r);break}a.deform();let o=e.getGlyphBox();e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function zc(e){let{highlight:t,highlightImage:n,highlightReferImage:r,highlightColormap:i,highlightLine:a,highlightSize:o,highlightThickness:s}=e;return{image:t?.image??n??`none`,referImage:t?.referImage??r??`none`,colormap:t?.colormap??i??`none`,line:t?.line??a??`none`,size:t?.size??o??`cover`,thickness:t?.thickness??s??`100%`}}function Bc(){let e=new Hr,t=[],n=Ur(),r=Wr(n);return mc({name:`highlight`,pathSet:e,context:{clipRects:t,loader:n,parser:r},load:async e=>{let t=new Set;e.forEachCharacter(e=>{let{computedStyle:r}=e,{image:i,referImage:a}=zc(r);i&&n.needsLoad(i)&&t.add(i),a&&n.needsLoad(a)&&t.add(a)}),await Promise.all(Array.from(t).map(e=>n.load(e)))},update:n=>{t.length=0,e.paths.length=0;let i=[],a,o;n.forEachCharacter(e=>{let{computedStyle:t}=e,n=zc(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(O(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Xr(o.image,r)&&Xr(o.colormap,s)&&Xr(o.line,c)&&Xr(o.size,l)&&Xr(o.thickness,u))&&a?.length&&(d?a[0].inlineBox.left===n.left:a[0].inlineBox.top===n.top)&&a[0].fontSize===f?a.push(e):(a=[],a.push(e),i.push(a))}o=n}),i=i.filter(e=>e.length);for(let n=0;n<i.length;n++){let a=i[n],o=a[0],s=W.from(...a.map(e=>e.compatibleGlyphBox));if(!s.height||!s.width)continue;let{computedStyle:c,isVertical:l,inlineBox:u,compatibleGlyphBox:d,strikeoutPosition:f,underlinePosition:p}=o,{fontSize:m}=c,{image:h,referImage:g,colormap:_,line:v,size:y,thickness:b}=zc(c),x=qr(b,{fontSize:m,total:s.width})/s.width,S=Jr(_),{pathSet:C,dom:w}=r.parse(h),T=C.getBoundingBox(!0)??new W,E=m/T.width*2,D=new W().copy(s);l&&(D.width=s.height,D.height=s.width,D.left=s.left+s.width);let k=Math.floor(D.width),A=k;y!==`cover`&&(A=qr(y,{fontSize:m,total:s.width})||k,D.width=A);let j=!O(g)&&O(v);if(j)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(O(v))if(T.width/T.height>4){e=`underline`;let t=w.getAttribute(`viewBox`);if(t){let[n,r,i,a]=t.split(` `).map(e=>Number(e)),o=r+a/2;e=T.y<o&&T.y+T.height>o?`line-through`:T.y+T.height<o?`overline`:`underline`}}else e=`outline`;else e=v;switch(e){case`outline`:{let e=D.width*.2,t=D.height*.2;l?(D.x-=t/2,D.y-=e/2,D.x-=D.height):(D.x-=e/2,D.y-=t/2),D.width+=e,D.height+=t;break}case`overline`:D.height=T.height*E,l?D.x=u.left+u.width:D.y=u.top;break;case`line-through`:D.height=T.height*E,l?D.x=u.left+u.width-f+D.height/2:D.y=u.top+f-D.height/2;break;case`underline`:D.height=T.height*E,l?D.x=d.left+d.width-p:D.y=u.top+p;break}}let M=new Bn;if(M.translate(-T.x,-T.y),M.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;j||M.translate(-e,-t),M.rotate(Math.PI/2),j||M.translate(t,e)}M.translate(D.x,D.y);for(let n=0;n<Math.ceil(k/A);n++){let r=M.clone();l?r.translate(0,n*D.width):r.translate(n*D.width,0),C.paths.forEach(n=>{let i=n.clone().applyTransform(r);i.style.strokeWidth&&(i.style.strokeWidth*=E*x),i.style.strokeMiterlimit&&(i.style.strokeMiterlimit*=E),i.style.strokeDashoffset&&(i.style.strokeDashoffset*=E),i.style.strokeDasharray&&(i.style.strokeDasharray=i.style.strokeDasharray.map(e=>e*E)),i.style.fill&&i.style.fill in S&&(i.style.fill=S[i.style.fill]),i.style.stroke&&i.style.stroke in S&&(i.style.stroke=S[i.style.stroke]),e.paths.push(i),k!==A&&(l?t[e.paths.length-1]=new W(s.left-s.width*2,s.top,s.width*4,s.height):t[e.paths.length-1]=new W(s.left,s.top-s.height*2,s.width,s.height*4))})}}},renderOrder:-1,getBoundingBox:()=>{let n=[];return e.paths.forEach((e,r)=>{let i=t[r],a=e.getBoundingBox();if(i){let e=Math.max(a.x,i.x),t=Math.max(a.y,i.y),n=Math.min(a.right,i.right),r=Math.min(a.bottom,i.bottom);a=new W(e,t,n-e,r-t)}n.push(a)}),n.length?W.from(...n):void 0},render:n=>{let{text:r,context:i}=n;e.paths.forEach((e,a)=>{if(n.drawPath(e,{clipRect:t[a]}),r.debug){let t=new Hr([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Vc(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
35
35
  <circle cx="${e}" cy="${e}" r="${e}" fill="${t}" />
36
- </svg>`}function Nc(){let e=new Nr;return ac({name:`listStyle`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n,isVertical:r,fontSize:i}=t,a=i*.45;n.forEach(t=>{let{computedStyle:n}=t,{color:o,listStyleImage:s,listStyleColormap:c,listStyleSize:l,listStyleType:u}=n,d=zr(c),f=l,p;if(!O(s))p=s;else if(!O(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Mc(e,String(o));break}}if(!p)return;let m=lr(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:Rr(f,{total:i,fontSize:i})/i,y=new Mn;if(r){let e=i/h.height*v;y.translate(-h.left,-h.top).rotate(-Math.PI/2).scale(e,e).translate(_.left+(_.width-h.height*e)/2,_.top-a)}else{let e=i/h.height*v;y.translate(-h.left,-h.top).scale(e,e).translate(_.left-h.width*e-a,_.top+(_.height-h.height*e)/2)}e.paths.push(...m.paths.map(e=>{let t=e.clone();return t.applyTransform(y),t.style.fill&&t.style.fill in d&&(t.style.fill=d[t.style.fill]),t.style.stroke&&t.style.stroke in d&&(t.style.stroke=d[t.style.stroke]),t}))})}})}function Pc(){return{name:`outline`}}function Fc(){let e=new Nr;return ac({name:`render`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n}=t;n.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.paths.push(t.path)})})})},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Ir(e,n);t.forEach(e=>{if(!e.glyphBox)return;let t=e.glyphBox.clone(),o=a.apply({x:t.left,y:t.top}),s=a.apply({x:t.right,y:t.top}),c=a.apply({x:t.right,y:t.bottom}),l=a.apply({x:t.left,y:t.bottom}),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);if(t.left=u,t.top=d,t.width=f-u,t.height=p-d,n.shadow?.enabled){let e=(n.shadow.offsetX??0)*r,i=(n.shadow.offsetY??0)*r,a=(n.shadow.blur??0)*r,o=t.left+Math.min(0,e-a),s=t.top+Math.min(0,i-a),c=t.left+t.width+Math.max(0,e+a),l=t.top+t.height+Math.max(0,i+a);t.left=o,t.top=s,t.width=c-o,t.height=l-s}if(n.outline?.enabled){let e=Math.max(.1,n.outline.width??0);t.left-=e,t.top-=e,t.width+=e*2,t.height+=e*2}i.push(t)})}),i.length?W.from(...i):void 0},render:e=>{let{text:t,context:n}=e,{paragraphs:r,glyphBox:i,computedEffects:a}=t;r.length&&(a.length?a.forEach(r=>{if(e.uploadColor(i,r),n.save(),e.transformEffect(r),r.shadow?.enabled){let n={...r,shadow:{...r.shadow,enabled:!1}};e.drawWithShadow(r.shadow,()=>{t.forEachCharacter(t=>{e.drawCharacter(t,n)})})}else t.forEachCharacter(t=>{e.drawCharacter(t,r)});n.restore()}):r.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.drawCharacter(t)})})}),t.debug&&r.forEach(e=>{n.strokeRect(e.lineBox.x,e.lineBox.y,e.lineBox.width,e.lineBox.height)}))}})}function Ic(){let e=new Nr;return ac({name:`textDecoration`,pathSet:e,update:t=>{e.paths.length=0;let n=[],r,i;t.forEachCharacter(e=>{let{computedStyle:t,isVertical:a,inlineBox:o,underlinePosition:s,underlineThickness:c,strikeoutPosition:l,strikeoutSize:u}=e,{color:d,textDecoration:f,writingMode:p}=t;if(O(f))i=void 0;else{let m=!1;if(i?.textDecoration===f&&i?.writingMode===p&&i?.color===d&&(a?r[0].inlineBox.left===o.left:r[0].inlineBox.top===o.top))switch(f){case`underline`:r[0].underlinePosition===s&&r[0].underlineThickness===c&&(m=!0);break;case`line-through`:r[0].strikeoutPosition===l&&r[0].strikeoutSize===u&&(m=!0);break}m?r.push(e):(r=[],r.push(e),n.push(r)),i=t}}),n.forEach(t=>{let{computedStyle:n,isVertical:r,underlinePosition:i,underlineThickness:a,strikeoutPosition:o,strikeoutSize:s}=t[0],{color:c,textDecoration:l}=n,{left:u,top:d,width:f,height:p}=W.from(...t.map(e=>e.inlineBox)),m=r?u+f:d,h=r?-1:1,g=0;switch(l){case`overline`:g=a*2;break;case`underline`:m+=h*i,g=a*2;break;case`line-through`:m+=h*o,g=s*2;break}m-=g;let _;_=r?new Mr([{type:`M`,x:m,y:d},{type:`L`,x:m,y:d+p},{type:`L`,x:m+g,y:d+p},{type:`L`,x:m+g,y:d},{type:`Z`}],{fill:c}):new Mr([{type:`M`,x:u,y:m},{type:`L`,x:u+f,y:m},{type:`L`,x:u+f,y:m+g},{type:`L`,x:u,y:m+g},{type:`Z`}],{fill:c}),e.paths.push(_)})},render:t=>{let{text:n,context:r}=t,{computedEffects:i}=n;i.length?i.forEach(n=>{r.save(),t.transformEffect(n),e.paths.forEach(e=>{t.drawPath(e,t.effectToPathStyle(n))}),r.restore()}):e.paths.forEach(e=>{t.drawPath(e)})}})}function Lc(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Rc(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var zc,Bc=et(),Vc=class extends ae{needsUpdate=!0;computedStyle={...Bc};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new cc;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;_pluginsByUpdateOrder=[];_pluginsByRenderOrder=[];_renderer;_rendererCtx;get paragraphs(){return this._paragraphs}set paragraphs(e){this._paragraphs=e,this._cachedCharacters=void 0}get fontSize(){return this.computedStyle.fontSize}get defaultFamily(){return this.fonts?.fallbackFont?.familySet.values().next().value??`sans-serif`}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get characters(){if(this._cachedCharacters)return this._cachedCharacters;let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let n=r[t].characters;for(let t=0;t<n.length;t++)e.push(n[t])}}return this._cachedCharacters=e,e}constructor(e={}){super(),this.set(e)}set(e={}){let{content:t,effects:n,style:r,measureDom:i,fonts:a,fill:o,outline:s,deformation:c}=lt(e);if(e.measurer&&typeof e.measurer!=`string`)this.measurer=e.measurer;else{let t=e.measurer??(a?`font`:`dom`);this.measurer=t===`font`?new uc:new cc}this.debug=e.debug??!1,this.content=t,this.effects=n,this.style=r,this.measureDom=i,this.fonts=a,this.fill=o,this.outline=s,this.deformation=c,this.use(dc()).use(Pc()).use(Nc()).use(Ic()).use(jc()).use(Fc()).use(kc()),(e.plugins??[]).forEach(e=>{this.use(e)}),this._update()}use(e){return this.plugins.set(e.name,e),this._resortPlugins(),this}_resortPlugins(){this._pluginsByUpdateOrder=[...this.plugins.values()].sort((e,t)=>(e.updateOrder??0)-(t.updateOrder??0)),this._pluginsByRenderOrder=[...this.plugins.values()].sort((e,t)=>(e.renderOrder??0)-(t.renderOrder??0))}forEachCharacter(e){let t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let i=r[t].characters;for(let r=0;r<i.length;r++)e(i[r],{paragraphIndex:n,fragmentIndex:t,characterIndex:r})}}return this}async load(){this._update(),await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))])}async _decodeFonts(){let e=this.fonts??Xs,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}t.add(e.fallbackFont),await Promise.all(Array.from(t,async e=>{let t=e?.getFont();t&&typeof t.createSFNTAsync==`function`&&!t._sfnt&&(t._sfnt=await t.createSFNTAsync())}))}_update(){this.computedStyle={...Bc,...this.style},this.computedFill=this.fill?{...this.fill}:void 0,this.computedOutline=this.outline?{...this.outline}:void 0,this.computedEffects=this.effects?.map(e=>e)??[];let e=[];return this.content.forEach((t,n)=>{let{fragments:r,fill:i,outline:a,...o}=t,s=new ic(o,n,this);s.fill=i,s.outline=a,r.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&s.fragments.push(new rc(n,a,r,i,t,s))}),e.push(s)}),this.paragraphs=e,this}createDom(){if(this._update(),!this.measurer.createDom)throw Error(`current measurer does not support createDom()`);return this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(e=this.measureDom){let t={paragraphs:this.paragraphs,inlineBox:this.inlineBox,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();let n=this.measurer.measure(this.paragraphs,this.computedStyle,e,this.fonts);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox;let r=this.characters;for(let e=0;e<r.length;e++)r[e].update(this.fonts);let i=this.getGlyphBox();this.rawGlyphBox=i,this.glyphBox=i;let a=this._pluginsByUpdateOrder;for(let e=0;e<a.length;e++)a[e].update?.(this);let o=this._pluginsByRenderOrder;this.pathSets.length=0;for(let e=0;e<o.length;e++){let t=o[e];t.pathSet?.paths.length&&this.pathSets.push(t.pathSet)}this._updateInlineBox()._updatePathBox()._updateBoundingBox();for(let e in t){let r=this[e];this[e]=t[e],n[e]=r}return this.emit(`measure`,{text:this,result:n}),n}getGlyphBox(){let e=U.MAX,t=U.MIN,n=this.characters;for(let r=0;r<n.length;r++){let i=n[r];if(i.getGlyphMinMax(e,t))continue;let{left:a,top:o,width:s,height:c}=i.inlineBox,l=new U(a,o),u=new U(a+s,o+c);e.clampMin(l,u),t.clampMax(l,u)}return e.x===-(2**53-1)||e.y===-(2**53-1)||t.x===2**53-1||t.y===2**53-1?new W(0,0,0,0):new W(e.x,e.y,t.x-e.x,t.y-e.y)}_updateInlineBox(){let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++)e.push(r[t].inlineBox)}return this.inlineBox=W.from(...e),this}_updatePathBox(){let e=[this.glyphBox];for(let t of this.plugins.values()){let n=t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox();n&&e.push(n)}return this.pathBox=W.from(...e),this}_updateBoundingBox(){return this.boundingBox=W.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(e=this.measureDom){return this.needsUpdate=!1,Object.assign(this,this.measure(e)),this.emit(`update`,{text:this}),this}_getRenderer(e){return(!this._renderer||this._rendererCtx!==e)&&(this._renderer=new Hr(this,e),this._rendererCtx=e),this._renderer}render(e){let{view:t,pixelRatio:n=2}=e,r=t.getContext(`2d`);if(!r)return;this.needsUpdate&&this.update();let i=this._getRenderer(r);i.pixelRatio=n,i.setup();let a=this._pluginsByRenderOrder;for(let e=0;e<a.length;e++){let t=a[e];if(t.render)t.render(i);else if(t.pathSet){let e=t.pathSet.paths;for(let t=0;t<e.length;t++)i.drawPath(e[t])}}this.emit(`render`,{text:this,view:t,pixelRatio:n}),e.onContext?.(r)}dispose(){this.measurer.dispose?.(),this._renderer=void 0,this._rendererCtx=void 0}toString(){return this.content.flatMap(e=>e.fragments.map(e=>e.content)).join(``)}};Rc([ie({internal:!0}),Lc(`design:type`,Boolean)],Vc.prototype,`debug`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`content`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`style`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`effects`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`fill`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`outline`,void 0),Rc([ie(),Lc(`design:type`,Object)],Vc.prototype,`deformation`,void 0),Rc([ie({internal:!0}),Lc(`design:type`,typeof(zc=typeof HTMLElement<`u`&&HTMLElement)==`function`?zc:Object)],Vc.prototype,`measureDom`,void 0),Rc([ie({internal:!0}),Lc(`design:type`,Object)],Vc.prototype,`fonts`,void 0);function Hc(e,t){let n=new Vc(e);return t?n.load().then(()=>n.measure()):n.measure()}function Uc(e,t){let n=new Vc(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Hr,e.Character=nc,e.CircleCurve=vc,e.DomMeasurer=cc,e.EllipseCurve=yc,e.FontMeasurer=uc,e.Fragment=rc,e.HeartCurve=bc,e.Paragraph=ic,e.PolygonCurve=xc,e.RectangularCurve=Sc,e.Text=Vc,e.backgroundPlugin=dc,e.createSvgLoader=Pr,e.createSvgParser=Fr,e.defineDeformation=Ec,e.definePlugin=ac,e.deformationPlugin=kc,e.getDeformationNames=Oc,e.getEffectTransform2D=Ir,e.getHighlightStyle=Ac,e.highlightPlugin=jc,e.isEqualObject=Br,e.isEqualValue=Vr,e.listStylePlugin=Nc,e.measureText=Hc,e.outlinePlugin=Pc,e.parseColormap=zr,e.parseTransformOrigin=Lr,e.parseValueNumber=Rr,e.removeDeformation=Dc,e.renderPlugin=Fc,e.renderText=Uc,e.textDecorationPlugin=Ic,e.textDefaultStyle=Bc});
36
+ </svg>`}function Hc(){let e=new Hr;return mc({name:`listStyle`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n,isVertical:r,fontSize:i}=t,a=i*.45;n.forEach(t=>{let{computedStyle:n}=t,{color:o,listStyleImage:s,listStyleColormap:c,listStyleSize:l,listStyleType:u}=n,d=Jr(c),f=l,p;if(!O(s))p=s;else if(!O(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Vc(e,String(o));break}}if(!p)return;let m=_r(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:qr(f,{total:i,fontSize:i})/i,y=new Bn;if(r){let e=i/h.height*v;y.translate(-h.left,-h.top).rotate(-Math.PI/2).scale(e,e).translate(_.left+(_.width-h.height*e)/2,_.top-a)}else{let e=i/h.height*v;y.translate(-h.left,-h.top).scale(e,e).translate(_.left-h.width*e-a,_.top+(_.height-h.height*e)/2)}e.paths.push(...m.paths.map(e=>{let t=e.clone();return t.applyTransform(y),t.style.fill&&t.style.fill in d&&(t.style.fill=d[t.style.fill]),t.style.stroke&&t.style.stroke in d&&(t.style.stroke=d[t.style.stroke]),t}))})}})}function Uc(){return{name:`outline`}}function Wc(){let e=new Hr;return mc({name:`render`,pathSet:e,update:t=>{e.paths.length=0;let{paragraphs:n}=t;n.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.paths.push(t.path)})})})},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Gr(e,n);t.forEach(e=>{if(!e.glyphBox)return;let t=e.glyphBox.clone(),o=a.apply({x:t.left,y:t.top}),s=a.apply({x:t.right,y:t.top}),c=a.apply({x:t.right,y:t.bottom}),l=a.apply({x:t.left,y:t.bottom}),u=Math.min(o.x,s.x,c.x,l.x),d=Math.min(o.y,s.y,c.y,l.y),f=Math.max(o.x,s.x,c.x,l.x),p=Math.max(o.y,s.y,c.y,l.y);if(t.left=u,t.top=d,t.width=f-u,t.height=p-d,n.shadow?.enabled){let e=(n.shadow.offsetX??0)*r,i=(n.shadow.offsetY??0)*r,a=(n.shadow.blur??0)*r,o=t.left+Math.min(0,e-a),s=t.top+Math.min(0,i-a),c=t.left+t.width+Math.max(0,e+a),l=t.top+t.height+Math.max(0,i+a);t.left=o,t.top=s,t.width=c-o,t.height=l-s}if(n.outline?.enabled){let e=Math.max(.1,n.outline.width??0);t.left-=e,t.top-=e,t.width+=e*2,t.height+=e*2}i.push(t)})}),i.length?W.from(...i):void 0},render:e=>{let{text:t,context:n}=e,{paragraphs:r,glyphBox:i,computedEffects:a}=t;r.length&&(a.length?a.forEach(r=>{if(e.uploadColor(i,r),n.save(),e.transformEffect(r),r.shadow?.enabled){let n={...r,shadow:{...r.shadow,enabled:!1}};e.drawWithShadow(r.shadow,()=>{t.forEachCharacter(t=>{e.drawCharacter(t,n)})})}else t.forEachCharacter(t=>{e.drawCharacter(t,r)});n.restore()}):r.forEach(t=>{t.fragments.forEach(t=>{t.characters.forEach(t=>{e.drawCharacter(t)})})}),t.debug&&r.forEach(e=>{n.strokeRect(e.lineBox.x,e.lineBox.y,e.lineBox.width,e.lineBox.height)}))}})}function Gc(){let e=new Hr;return mc({name:`textDecoration`,pathSet:e,update:t=>{e.paths.length=0;let n=[],r,i;t.forEachCharacter(e=>{let{computedStyle:t,isVertical:a,inlineBox:o,underlinePosition:s,underlineThickness:c,strikeoutPosition:l,strikeoutSize:u}=e,{color:d,textDecoration:f,writingMode:p}=t;if(O(f))i=void 0;else{let m=!1;if(i?.textDecoration===f&&i?.writingMode===p&&i?.color===d&&(a?r[0].inlineBox.left===o.left:r[0].inlineBox.top===o.top))switch(f){case`underline`:r[0].underlinePosition===s&&r[0].underlineThickness===c&&(m=!0);break;case`line-through`:r[0].strikeoutPosition===l&&r[0].strikeoutSize===u&&(m=!0);break}m?r.push(e):(r=[],r.push(e),n.push(r)),i=t}}),n.forEach(t=>{let{computedStyle:n,isVertical:r,underlinePosition:i,underlineThickness:a,strikeoutPosition:o,strikeoutSize:s}=t[0],{color:c,textDecoration:l}=n,{left:u,top:d,width:f,height:p}=W.from(...t.map(e=>e.inlineBox)),m=r?u+f:d,h=r?-1:1,g=0;switch(l){case`overline`:g=a*2;break;case`underline`:m+=h*i,g=a*2;break;case`line-through`:m+=h*o,g=s*2;break}m-=g;let _;_=r?new Vr([{type:`M`,x:m,y:d},{type:`L`,x:m,y:d+p},{type:`L`,x:m+g,y:d+p},{type:`L`,x:m+g,y:d},{type:`Z`}],{fill:c}):new Vr([{type:`M`,x:u,y:m},{type:`L`,x:u+f,y:m},{type:`L`,x:u+f,y:m+g},{type:`L`,x:u,y:m+g},{type:`Z`}],{fill:c}),e.paths.push(_)})},render:t=>{let{text:n,context:r}=t,{computedEffects:i}=n;i.length?i.forEach(n=>{r.save(),t.transformEffect(n),e.paths.forEach(e=>{t.drawPath(e,t.effectToPathStyle(n))}),r.restore()}):e.paths.forEach(e=>{t.drawPath(e)})}})}function Kc(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function qc(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var Jc,Yc=et(),Xc=class extends ae{needsUpdate=!0;computedStyle={...Yc};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new _c;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;_pluginsByUpdateOrder=[];_pluginsByRenderOrder=[];_renderer;_rendererCtx;get paragraphs(){return this._paragraphs}set paragraphs(e){this._paragraphs=e,this._cachedCharacters=void 0}get fontSize(){return this.computedStyle.fontSize}get defaultFamily(){return this.fonts?.fallbackFont?.familySet.values().next().value??`sans-serif`}get isVertical(){return this.computedStyle.writingMode.includes(`vertical`)}get characters(){if(this._cachedCharacters)return this._cachedCharacters;let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let n=r[t].characters;for(let t=0;t<n.length;t++)e.push(n[t])}}return this._cachedCharacters=e,e}constructor(e={}){super(),this.set(e)}set(e={}){let{content:t,effects:n,style:r,measureDom:i,fonts:a,fill:o,outline:s,deformation:c}=lt(e);if(e.measurer&&typeof e.measurer!=`string`)this.measurer=e.measurer;else{let t=e.measurer??`font`;this.measurer=t===`font`?new yc:new _c}this.debug=e.debug??!1,this.content=t,this.effects=n,this.style=r,this.measureDom=i,this.fonts=a,this.fill=o,this.outline=s,this.deformation=c,this.use(bc()).use(Uc()).use(Hc()).use(Gc()).use(Bc()).use(Wc()).use(Rc()),(e.plugins??[]).forEach(e=>{this.use(e)}),this._update()}use(e){return this.plugins.set(e.name,e),this._resortPlugins(),this}_resortPlugins(){this._pluginsByUpdateOrder=[...this.plugins.values()].sort((e,t)=>(e.updateOrder??0)-(t.updateOrder??0)),this._pluginsByRenderOrder=[...this.plugins.values()].sort((e,t)=>(e.renderOrder??0)-(t.renderOrder??0))}forEachCharacter(e){let t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++){let i=r[t].characters;for(let r=0;r<i.length;r++)e(i[r],{paragraphIndex:n,fragmentIndex:t,characterIndex:r})}}return this}async load(){this._update(),await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))])}async _decodeFonts(){let e=this.fonts??ac,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}t.add(e.fallbackFont),await Promise.all(Array.from(t,async e=>{let t=e?.getFont();t&&typeof t.createSFNTAsync==`function`&&!t._sfnt&&(t._sfnt=await t.createSFNTAsync())}))}_update(){this.computedStyle={...Yc,...this.style},this.computedFill=this.fill?{...this.fill}:void 0,this.computedOutline=this.outline?{...this.outline}:void 0,this.computedEffects=this.effects?.map(e=>e)??[];let e=[];return this.content.forEach((t,n)=>{let{fragments:r,fill:i,outline:a,...o}=t,s=new pc(o,n,this);s.fill=i,s.outline=a,r.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&s.fragments.push(new fc(n,a,r,i,t,s))}),e.push(s)}),this.paragraphs=e,this}createDom(){if(this._update(),!this.measurer.createDom)throw Error(`current measurer does not support createDom()`);return this.measurer.createDom(this.paragraphs,this.computedStyle)}measure(e=this.measureDom){let t={paragraphs:this.paragraphs,inlineBox:this.inlineBox,lineBox:this.lineBox,rawGlyphBox:this.rawGlyphBox,glyphBox:this.glyphBox,pathBox:this.pathBox,boundingBox:this.boundingBox};this._update();let n=this.measurer.measure(this.paragraphs,this.computedStyle,e,this.fonts);this.paragraphs=n.paragraphs,this.lineBox=n.boundingBox;let r=this.characters;for(let e=0;e<r.length;e++)r[e].update(this.fonts);let i=this.getGlyphBox();this.rawGlyphBox=i,this.glyphBox=i;let a=this._pluginsByUpdateOrder;for(let e=0;e<a.length;e++)a[e].update?.(this);let o=this._pluginsByRenderOrder;this.pathSets.length=0;for(let e=0;e<o.length;e++){let t=o[e];t.pathSet?.paths.length&&this.pathSets.push(t.pathSet)}this._updateInlineBox()._updatePathBox()._updateBoundingBox();for(let e in t){let r=this[e];this[e]=t[e],n[e]=r}return this.emit(`measure`,{text:this,result:n}),n}getGlyphBox(){let e=U.MAX,t=U.MIN,n=this.characters;for(let r=0;r<n.length;r++){let i=n[r];if(i.getGlyphMinMax(e,t))continue;let{left:a,top:o,width:s,height:c}=i.inlineBox,l=new U(a,o),u=new U(a+s,o+c);e.clampMin(l,u),t.clampMax(l,u)}return e.x===-(2**53-1)||e.y===-(2**53-1)||t.x===2**53-1||t.y===2**53-1?new W(0,0,0,0):new W(e.x,e.y,t.x-e.x,t.y-e.y)}_updateInlineBox(){let e=[],t=this._paragraphs;for(let n=0;n<t.length;n++){let r=t[n].fragments;for(let t=0;t<r.length;t++)e.push(r[t].inlineBox)}return this.inlineBox=W.from(...e),this}_updatePathBox(){let e=[this.glyphBox];for(let t of this.plugins.values()){let n=t.getBoundingBox?t.getBoundingBox(this):t.pathSet?.getBoundingBox();n&&e.push(n)}return this.pathBox=W.from(...e),this}_updateBoundingBox(){return this.boundingBox=W.from(this.rawGlyphBox,this.lineBox,this.pathBox),this}requestUpdate(){return this.needsUpdate=!0,this}update(e=this.measureDom){return this.needsUpdate=!1,Object.assign(this,this.measure(e)),this.emit(`update`,{text:this}),this}_getRenderer(e){return(!this._renderer||this._rendererCtx!==e)&&(this._renderer=new Zr(this,e),this._rendererCtx=e),this._renderer}render(e){let{view:t,pixelRatio:n=2}=e,r=t.getContext(`2d`);if(!r)return;this.needsUpdate&&this.update();let i=this._getRenderer(r);i.pixelRatio=n,i.setup();let a=this._pluginsByRenderOrder;for(let e=0;e<a.length;e++){let t=a[e];if(t.render)t.render(i);else if(t.pathSet){let e=t.pathSet.paths;for(let t=0;t<e.length;t++)i.drawPath(e[t])}}this.emit(`render`,{text:this,view:t,pixelRatio:n}),e.onContext?.(r)}dispose(){this.measurer.dispose?.(),this._renderer=void 0,this._rendererCtx=void 0}toString(){return this.content.flatMap(e=>e.fragments.map(e=>e.content)).join(``)}};qc([ie({internal:!0}),Kc(`design:type`,Boolean)],Xc.prototype,`debug`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`content`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`style`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`effects`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`fill`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`outline`,void 0),qc([ie(),Kc(`design:type`,Object)],Xc.prototype,`deformation`,void 0),qc([ie({internal:!0}),Kc(`design:type`,typeof(Jc=typeof HTMLElement<`u`&&HTMLElement)==`function`?Jc:Object)],Xc.prototype,`measureDom`,void 0),qc([ie({internal:!0}),Kc(`design:type`,Object)],Xc.prototype,`fonts`,void 0);function Zc(e,t){let n=new Xc(e);return t?n.load().then(()=>n.measure()):n.measure()}function Qc(e,t){let n=new Xc(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Zr,e.Character=dc,e.CircleCurve=Dc,e.DomMeasurer=_c,e.EllipseCurve=Oc,e.FontMeasurer=yc,e.Fragment=fc,e.HeartCurve=kc,e.Paragraph=pc,e.PolygonCurve=Ac,e.RectangularCurve=jc,e.Text=Xc,e.backgroundPlugin=bc,e.createSvgLoader=Ur,e.createSvgParser=Wr,e.defineDeformation=Fc,e.definePlugin=mc,e.deformationPlugin=Rc,e.getDeformationNames=Lc,e.getEffectTransform2D=Gr,e.getHighlightStyle=zc,e.highlightPlugin=Bc,e.isEqualObject=Yr,e.isEqualValue=Xr,e.listStylePlugin=Hc,e.measureText=Zc,e.outlinePlugin=Uc,e.parseColormap=Jr,e.parseTransformOrigin=Kr,e.parseValueNumber=qr,e.removeDeformation=Ic,e.renderPlugin=Wc,e.renderText=Qc,e.textDecorationPlugin=Gc,e.textDefaultStyle=Yc});