modern-text 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +27 -18
  2. package/dist/deformations/index.cjs +1 -1
  3. package/dist/deformations/index.d.cts +2 -2
  4. package/dist/deformations/index.d.mts +2 -2
  5. package/dist/deformations/index.d.ts +2 -2
  6. package/dist/deformations/index.mjs +1 -1
  7. package/dist/index.cjs +2 -2
  8. package/dist/index.d.cts +4 -4
  9. package/dist/index.d.mts +4 -4
  10. package/dist/index.d.ts +4 -4
  11. package/dist/index.js +8 -7
  12. package/dist/index.mjs +3 -3
  13. package/dist/shared/{modern-text.CGZmjNV0.d.ts → modern-text.1LMQ6ZWb.d.ts} +3 -3
  14. package/dist/shared/{modern-text.BBDyCm63.cjs → modern-text.BAnUZM0U.cjs} +1 -1
  15. package/dist/shared/{modern-text.DNvXuVjw.mjs → modern-text.BdF52nXP.mjs} +1 -1
  16. package/dist/shared/{modern-text.K8BlyK2j.mjs → modern-text.CdKp2H-o.mjs} +13 -4
  17. package/dist/shared/{modern-text.DNXfZmiT.d.mts → modern-text.CjkLMv3V.d.cts} +3 -3
  18. package/dist/shared/{modern-text.DzBaDwbG.d.cts → modern-text.Cv-GZog_.d.mts} +3 -3
  19. package/dist/shared/{modern-text.DG27jpKj.d.ts → modern-text.DENkEKJN.d.cts} +38 -38
  20. package/dist/shared/{modern-text.DG27jpKj.d.cts → modern-text.DENkEKJN.d.mts} +38 -38
  21. package/dist/shared/{modern-text.DG27jpKj.d.mts → modern-text.DENkEKJN.d.ts} +38 -38
  22. package/dist/shared/{modern-text.DQWdaYoZ.cjs → modern-text._10DVHum.cjs} +13 -4
  23. package/dist/web-components/index.cjs +2 -2
  24. package/dist/web-components/index.d.cts +2 -2
  25. package/dist/web-components/index.d.mts +2 -2
  26. package/dist/web-components/index.d.ts +2 -2
  27. package/dist/web-components/index.mjs +2 -2
  28. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
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){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}function j(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>j(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=j(i,t):n[r]=i)}return n}function M(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function N(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 P(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 F(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 I(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),P(e,t.split(`.`),n)):e[t]}function L(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),F(e,t.split(`.`),n)}var R=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()}},z=Symbol.for(`declarations`),B=Symbol.for(`inited`);function V(e){let t;if(Object.hasOwn(e,z))t=e[z];else{let n=Object.getPrototypeOf(e);t={...n?V(n):{}},e[z]=t}return t}function ee(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?L(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??ne(e,t,r),o)}function te(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?I(e,r):e[i],a??=ne(e,t,n),a}function ne(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[B]?.[t]){e[B]||(e[B]={}),e[B][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 re(e,t){function n(){return this.getProperty?this.getProperty(e):te(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):ee(this,e,n,t)}return{get:n,set:r}}function ie(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=V(e);i[t]=r;let{get:a,set:o}=re(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function ae(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);ie(t.constructor,n,e)}}var oe=class extends R{_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){t===void 0?delete this._properties[e]: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 te(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??ne(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)ee(this,e,t,n);else{let r=this.offsetGetProperty(e);if(Object.is(r,t))return;let i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??ne(this,e,n),i)}}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 V(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 se(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 ce(e){return{r:k(e.r),g:k(e.g),b:k(e.b),a:k(e.a,3)}}function le(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ue=`#000000FF`;function de(e){return se(e).isValid()}function fe(e,t=!1){let n=se(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),ue}let{r,g:i,b:a,a:o}=ce(n.rgba);return`#${le(r)}${le(i)}${le(a)}${le(k(o*255))}`}var pe=pe||{};pe.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 me=pe.parse.bind(pe),he=he||{};he.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)}})(),he.stringify.bind(he);function ge(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=fe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=fe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=fe(e.value);break;case`hex`:a=fe(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break}return{offset:i,color:a}})}function _e(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break}return{type:`linear-gradient`,angle:t,stops:ge(e.colorStops)}}function ve(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:ge(e.colorStops)}}function ye(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function be(e){return me(e).map(e=>{switch(e?.type){case`linear-gradient`:return _e(e);case`repeating-linear-gradient`:return{..._e(e),repeat:!0};case`radial-gradient`:return ve(e);case`repeating-radial-gradient`:return{...ve(e),repeat:!0};default:return}}).filter(Boolean)}var xe=[`color`];function Se(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=fe(t.color),M(t,xe)}var Ce=[`linearGradient`,`radialGradient`,`rotateWithShape`];function we(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=be(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return M(t,Ce)}var Te=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Ee(e){let t;return t=typeof e==`string`?{image:e}:{...e},M(t,Te)}var De=[`preset`,`foregroundColor`,`backgroundColor`];function Oe(e){let t;return t=typeof e==`string`?{preset:e}:{...e},O(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=fe(t.foregroundColor),O(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=fe(t.backgroundColor),M(t,De)}function ke(e){return!O(e.color)}function Ae(e){return typeof e==`string`?de(e):ke(e)}function je(e){return!O(e.image)&&ye(e.image)||!!e.linearGradient||!!e.radialGradient}function Me(e){return typeof e==`string`?ye(e):je(e)}function Ne(e){return!O(e.image)&&!ye(e.image)}function Pe(e){return typeof e==`string`?!de(e)&&!ye(e):Ne(e)}function Fe(e){return!O(e.preset)}function Ie(e){return typeof e==`string`?!1:Fe(e)}function Le(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return Ae(e)&&Object.assign(t,Se(e)),Me(e)&&Object.assign(t,we(e)),Pe(e)&&Object.assign(t,Ee(e)),Ie(e)&&Object.assign(t,Oe(e)),M(j(t),Array.from(new Set([`enabled`,...xe,...Te,...Ce,...De])))}function Re(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function ze(e){return typeof e==`string`?{...Le(e)}:{...Le(e),...M(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Be(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Ve(e){return typeof e==`string`?{enabled:!0,color:fe(e)}:{...e,enabled:e.enabled??!0,color:O(e.color)?ue:fe(e.color)}}function He(){return{boxShadow:`none`}}function Ue(e){return j({blur:e.blur,brightness:e.brightness,contrast:e.contrast,grayscale:e.grayscale,hueRotate:e.hueRotate,invert:e.invert,opacity:e.opacity,saturate:e.saturate,sepia:e.sepia,duotone:e.duotone?[fe(e.duotone[0]),fe(e.duotone[1])]:void 0,biLevel:e.biLevel,colorChange:e.colorChange?{from:fe(e.colorChange.from),to:fe(e.colorChange.to)}:void 0})}var We=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`,`filter`];function Ge(e){let t=M(e,We),{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 Ke(e){let t=Ge(e);return j({fill:O(t.fill)?void 0:Le(t.fill),outline:O(t.outline)?void 0:ze(t.outline),shadow:O(t.shadow)?void 0:Ve(t.shadow),transform:O(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin,filter:t.filter?Ue(t.filter):void 0})}function qe(){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 Je(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function Ye(){return{...qe(),...Je(),...He(),...Re(),...Be(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function Xe(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function Ze(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function Qe(){return{...Xe(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function $e(){return{...Ze(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function et(){return{...$e(),...Qe(),textStrokeWidth:0,textStrokeColor:`none`}}var tt=[`textIndent`,`lineHeight`,`letterSpacing`,`wordSpacing`,`fontSize`,`textStrokeWidth`,`borderRadius`,`opacity`,`rotate`,`scaleX`,`scaleY`,`skewX`,`skewY`,`translateX`,`translateY`,`borderWidth`,`flex`,`flexGrow`,`flexShrink`];function nt(e){let t=j({...e,color:O(e.color)?void 0:fe(e.color),backgroundColor:O(e.backgroundColor)?void 0:fe(e.backgroundColor),borderColor:O(e.borderColor)?void 0:fe(e.borderColor),outlineColor:O(e.outlineColor)?void 0:fe(e.outlineColor),shadowColor:O(e.shadowColor)?void 0:fe(e.shadowColor),textStrokeColor:O(e.textStrokeColor)?void 0:fe(e.textStrokeColor)});for(let e of tt)if(e in t){let n=A(t[e]);n===void 0?delete t[e]:t[e]=n}return t}function rt(){return{...Ye(),...et()}}var it=/\r\n|\n\r|\n|\r/;RegExp(`${it.source}|<br\\/>`,`g`);var at=RegExp(`^(${it.source})$`),ot=`
2
- `;function st(e){return at.test(e)}function ct(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?nt(e):{},a=n?Le(n):void 0,o=r?ze(r):void 0,s=j({...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?nt(t):{},s=i?Le(i):void 0,c=a?ze(a):void 0;Array.from(e).forEach(e=>{if(st(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(j({...o,fill:s,outline:c,content:ot})),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(N(s,n)&&N(c,r)&&N(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(j({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(ut(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(lt(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(ut(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 lt(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function ut(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function dt(e){return j({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function ft(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:ct(e)}:j({enabled:e.enabled??!0,content:ct(e.content??``),style:e.style?nt(e.style):void 0,deformation:e.deformation?dt(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...Ke(e),effects:e.effects?e.effects.map(e=>Ke(e)):void 0})}function pt(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=mt(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=xt(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 gt(a,o,n,s,c,l,0),o}function mt(e,t,n,r,i){let a;if(i===Wt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Vt(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Vt(i/r|0,e[i],e[i+1],a);return a&&Nt(a,a.next)&&(Ht(a),a=a.next),a}function ht(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(Nt(n,n.next)||H(n.prev,n,n.next)===0)){if(Ht(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function gt(e,t,n,r,i,a,o){if(!e)return;!o&&a&&Et(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?vt(e,r,i,a):_t(e)){t.push(c.i,e.i,l.i),Ht(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=yt(ht(e),t),gt(e,t,n,r,i,a,2)):o===2&&bt(e,t,n,r,i,a):gt(ht(e),t,n,r,i,a,1);break}}}function _t(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&&jt(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 vt(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),_=Ot(p,m,t,n,r),v=Ot(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&&jt(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&&jt(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&&jt(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&&jt(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 yt(e,t){let n=e;do{let r=n.prev,i=n.next.next;!Nt(r,i)&&Pt(r,n,n.next,i)&&Rt(r,i)&&Rt(i,r)&&(t.push(r.i,n.i,i.i),Ht(n),Ht(n.next),n=e=i),n=n.next}while(n!==e);return ht(n)}function bt(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Mt(o,e)){let s=Bt(o,e);o=ht(o,o.next),s=ht(s,s.next),gt(o,t,n,r,i,a,0),gt(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function xt(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=mt(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(kt(o))}i.sort(St);for(let e=0;e<i.length;e++)n=Ct(i[e],n);return n}function St(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 Ct(e,t){let n=wt(e,t);if(!n)return t;let r=Bt(n,e);return ht(r,r.next),ht(n,n.next)}function wt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(Nt(e,n))return n;do{if(Nt(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&&At(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);Rt(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&Tt(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function Tt(e,t){return H(e.prev,e,t.prev)<0&&H(t.next,e,e.next)<0}function Et(e,t,n,r){let i=e;do i.z===0&&(i.z=Ot(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,Dt(i)}function Dt(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 Ot(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 kt(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 At(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 jt(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&At(e,t,n,r,i,a,o,s)}function Mt(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Lt(e,t)&&(Rt(e,t)&&Rt(t,e)&&zt(e,t)&&(H(e.prev,e,t.prev)||H(e,t.prev,t))||Nt(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 Nt(e,t){return e.x===t.x&&e.y===t.y}function Pt(e,t,n,r){let i=It(H(e,t,n)),a=It(H(e,t,r)),o=It(H(n,r,e)),s=It(H(n,r,t));return!!(i!==a&&o!==s||i===0&&Ft(e,n,t)||a===0&&Ft(e,r,t)||o===0&&Ft(n,e,r)||s===0&&Ft(n,t,r))}function Ft(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 It(e){return e>0?1:e<0?-1:0}function Lt(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&&Pt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Rt(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 zt(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 Bt(e,t){let n=Ut(e.i,e.x,e.y),r=Ut(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 Vt(e,t,n,r){let i=Ut(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 Ht(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 Ut(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Wt(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 Gt(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var Kt={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function qt(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=Kt[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 Jt(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 Yt=Math.PI*2;function Xt(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function Zt(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 Qt=/([\w-]+)\((.+?)\)/g,$t=/[^,]+/g,en=/([-e.\d]+)(.*)/;function tn(e,t={}){let n=[],r;for(;(r=Qt.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:nn(e,i,t)})}return n}function nn(e,t,n={}){let r=[],i,a=0;for(;(i=$t.exec(t))!==null;)r.push(rn(e,i[0],{...n,index:a++}));return r}function rn(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(en),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/Yt;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 an(e,t){let n=1-e;return n*n*n*t}function on(e,t){let n=1-e;return 3*n*n*e*t}function sn(e,t){return 3*(1-e)*e*e*t}function cn(e,t){return e*e*e*t}function ln(e,t,n,r,i){return an(e,t)+on(e,n)+sn(e,r)+cn(e,i)}function un(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t,c=pt(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 dn=8,fn=1.1920929e-7,pn=1;function mn(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(pn-Math.min(.99,Math.max(0,c)))/1;return u*=u,hn(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function hn(e,t,n,r,i,a,o,s,c,l,u){if(u>dn)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>fn&&p>fn){if((f+p)*(f+p)<=l*(u*u+d*d)){c.push(x,S);return}}else if(f>fn){if(f*f<=l*(u*u+d*d)){c.push(x,S);return}}else if(p>fn){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}}hn(e,t,d,f,_,v,x,S,c,l,u+1),hn(x,S,y,b,h,g,o,s,c,l,u+1)}var gn=8,_n=1.1920929e-7,vn=1;function yn(e,t,n,r,i,a,o=.5,s=[]){let c=(vn-Math.min(.99,Math.max(0,o)))/1;return c*=c,bn(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function bn(e,t,n,r,i,a,o,s,c){if(c>gn)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(_>_n){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}bn(e,t,n,l,u,p,m,s,c+1),bn(e,p,m,d,f,a,o,s,c+1)}function xn(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function Sn(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&&xn(c,l,r,s,e,t)>0&&i++:l<=t&&xn(c,l,r,s,e,t)<0&&i--}return i}function Cn(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function wn(e,t){return e.minX<=t.maxX&&e.maxX>=t.minX&&e.minY<=t.maxY&&e.maxY>=t.minY}function Tn(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||!wn(c,a))continue;let l={},u=[];for(let n=0,r=s.length;n<r;n++){let[r,i]=s[n],a=Sn(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:Cn(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 En(e,t,n,r,i,a){return(n-e)*(a-t)-(i-e)*(r-t)}function Dn(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&&En(o,s,l,u,e,t)>0&&i++:u<=t&&En(o,s,l,u,e,t)<0&&i--}return i}function On(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 kn(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 An(e,t,n=`nonzero`){return t.length<6?!1:n===`evenodd`?(On(e.x,e.y,t)&1)==1:Dn(e.x,e.y,t)!==0}function jn(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+=On(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+=Dn(r,i,n))}return a!==0}function Mn(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=kn(i,a,t[e],t[e+1],t[e+2],t[e+3]);n<o&&(o=n)}if(n&&r>=6){let e=kn(i,a,t[r-2],t[r-1],t[0],t[1]);e<o&&(o=e)}return o}function Nn(e,t){let n=1-e;return n*n*t}function Pn(e,t){return 2*(1-e)*e*t}function Fn(e,t){return e*e*t}function In(e,t,n,r){return Nn(e,t)+Pn(e,n)+Fn(e,r)}var Ln=1e-4,Rn=1e-4;function zn(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=Ln;if(e.length===0)return{vertices:n,indices:r};let c=i,l=c.alignment;if(i.alignment!==.5){let t=Bn(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+=Hn(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+=Vn(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+=Hn(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+=Hn(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+=Hn(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+=Hn(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=Hn(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+=Hn(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+=Vn(C,w,D,O,N,P,!1,m)));let F=Rn*Rn;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 Bn(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 Vn(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 Hn(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 Un=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/Yt;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(Yt-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 tn(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]*Yt);break;case`rotateY`:a.rotateY(n[0]*Yt);break;case`rotateZ`:a.rotateZ(n[0]*Yt);break;case`rotate`:a.rotate(n[0]*Yt);break;case`rotate3d`:a.rotate3d(n[0]*Yt,(n[1]??n[0])*Yt,(n[2]??n[1]??n[0])*Yt,(n[3]??n[2]??n[1]??n[0])*Yt);break;case`skewX`:a.skewX(n[0]*Yt);break;case`skewY`:a.skewY(n[0]*Yt);break;case`skew`:a.skew(n[0]*Yt,(n[0]??n[1])*Yt);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 Wn(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 Gn(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=Wn(1,0,(u-b)/t,(d-x)/n),T=Wn((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 Kn(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 qn(e,t){return e-(t-e)}function Jn(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(qn(n.x,r.x),qn(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(qn(n.x,r.x),qn(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=qn(n.x,r.x),i=qn(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),Gn(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 Yn(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 Xn=/[a-df-z][^a-df-z]*/gi;function Zn(e){let t=[],n=e.match(Xn);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=Kn(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=Kn(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=Kn(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=Kn(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=Kn(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=Kn(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=Kn(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=Kn(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=Kn(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 Qn=`data:image/svg+xml;`,$n=`${Qn}base64,`,er=`${Qn}charset=utf8,`;function tr(e){if(typeof e==`string`){let t;e.startsWith($n)?(e=e.substring($n.length,e.length),t=atob(e)):e.startsWith(er)?(e=e.substring(er.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 nr=`px`,rr=90,ir=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],ar={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=ir.length;n<r;n++){let r=ir[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return n=ar[t][nr],n<0&&(n=ar[t].in*rr),n*Number.parseFloat(e)}function or(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=sr(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function sr(e){let t=new Un;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 cr(e){return new Wr().arc(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`r`)||0),0,Math.PI*2)}function lr(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 ur(e){return new Wr().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 dr(e){return new Wr().moveTo(K(e.getAttribute(`x1`)||0),K(e.getAttribute(`y1`)||0)).lineTo(K(e.getAttribute(`x2`)||0),K(e.getAttribute(`y2`)||0))}function fr(e){let t=new Wr,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var pr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function mr(e){let t=new Wr,n=0;return e.getAttribute(`points`)?.replace(pr,(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 hr=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function gr(e){let t=new Wr,n=0;return e.getAttribute(`points`)?.replace(hr,(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 _r(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 Wr;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 vr(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 yr(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=vr(e,o,r);break;case`style`:lr(e,r);break;case`g`:o=vr(e,o,r);break;case`path`:o=vr(e,o,r),e.hasAttribute(`d`)&&(a=fr(e));break;case`rect`:o=vr(e,o,r),a=_r(e);break;case`polygon`:o=vr(e,o,r),a=mr(e);break;case`polyline`:o=vr(e,o,r),a=gr(e);break;case`circle`:o=vr(e,o,r),a=cr(e);break;case`ellipse`:o=vr(e,o,r),a=ur(e);break;case`line`:o=vr(e,o,r),a=dr(e);break;case`defs`:i=!0;break;case`use`:{o=vr(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?yr(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 Un,c=[],l=or(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`||yr(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function br(e){let t=tr(e);return new Gr(yr(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var xr=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 An(e,this._getCachedAdaptiveVertices(),t.fillRule)}isPointInStroke(e,t={}){let{strokeWidth:n=1,tolerance:r=0,closed:i=!1}=t;return Mn(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 un(this.getFillVertices(e),e)}strokeTriangulate(e){return zn(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 Yn(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)}},Sr=new Un,Cr=new Un,wr=new Un,Tr=new U,Er=class extends xr{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=Tr,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++)Dr(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 Tr.set(this.cx,this.cy),e.apply(Tr,Tr),this.cx=Tr.x,this.cy=Tr.y,jr(e)?Or(this,e):kr(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 Dr(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 Or(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=Sr.set(c,l,u,d,0,0),{a:p,b:m,c:h,d:g}=Cr.copyFrom(f).affineInvert(),_=Mr(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=Cr.set(v,0,0,y,0,0),r=wr.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),Ar(t)&&(e.clockwise=!e.clockwise)}}function kr(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,Ar(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function Ar(e){return e.a*e.d-e.c*e.b<0}function jr(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 Mr(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 Nr=class extends Er{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}},Pr=class e extends xr{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}},Fr=class e extends xr{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 Pr?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}},Ir=class e extends xr{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(ln(e,n.x,r.x,i.x,a.x),ln(e,n.y,r.y,i.y,a.y))}getAdaptiveVertices(e=[]){return mn(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}},Lr=class extends Er{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}},Rr=class extends Fr{},zr=class e extends xr{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(In(e,n.x,r.x,i.x),In(e,n.y,r.y,i.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}getAdaptiveVertices(e=[]){return yn(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(In(o,n.x,r.x,i.x)),s!==null&&l.push(In(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}},Br=class extends Rr{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 Pr(i[0],i[1]),new Pr(i[1],i[2]),new Pr(i[2],i[3]),new Pr(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}},Vr=class extends Fr{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=[Pr.from(a,l,c,l),Pr.from(c,l,c,f),Pr.from(c,f,a,f),Pr.from(a,f,a,l)];else{let e=Math.PI/2;this.curves=[Pr.from(o,l,s,l),new Nr(s,u,i,-e,0,!0),Pr.from(c,u,c,d),new Nr(s,d,i,0,e,!0),Pr.from(s,f,o,f),new Nr(o,d,i,e,Math.PI,!0),Pr.from(a,d,a,u),new Nr(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}},Hr=class extends xr{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(Jt(a,o.x,s.x,c.x,l.x),Jt(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}},Ur=class extends Fr{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 Jn(e,this),this}addData(e){return this.addCommands(Zn(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 Mn(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 Pr(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(Pr.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(Ir.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(zr.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 Nr(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 Lr(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 Br(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 Vr(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 Hr([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}},Wr=class e extends Fr{_meta;_ringsCache;_ringsCacheLen=-1;currentCurve=new Ur;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 Ur().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.curves.length&&(this.currentCurve=new Ur,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 Ur,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return Jn(e,this),this}addData(e){return this.addCommands(Zn(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=Zt(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 jn(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=Tn(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]))}un(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(),qt(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(),qt(e,t),this.getControlPointRefs().forEach(t=>{Gt(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[Xt(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}},Gr=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
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=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),u={grad:.9,turn:360,rad:360/(2*Math.PI)},d=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},f=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},p=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},m=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},h=function(e){return{r:p(e.r,0,255),g:p(e.g,0,255),b:p(e.b,0,255),a:p(e.a)}},g=function(e){return{r:f(e.r),g:f(e.g),b:f(e.b),a:f(e.a,3)}},_=/^#([0-9a-f]{3,8})$/i,v=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},y=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}},b=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}},x=function(e){return{h:m(e.h),s:p(e.s,0,100),l:p(e.l,0,100),a:p(e.a)}},S=function(e){return{h:f(e.h),s:f(e.s),l:f(e.l),a:f(e.a,3)}},C=function(e){return b((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},w=function(e){return{h:(t=y(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},T=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,E=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,D=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,O=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,k={string:[[function(e){var t=_.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?f(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?f(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=D.exec(e)||O.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:h({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 t=T.exec(e)||E.exec(e);if(!t)return null;var n,r;return C(x({h:(n=t[1],r=t[2],r===void 0&&(r=`deg`),Number(n)*(u[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i===void 0?1:i;return d(t)&&d(n)&&d(r)?h({r:Number(t),g:Number(n),b:Number(r),a:Number(a)}):null},`rgb`],[function(e){var t=e.h,n=e.s,r=e.l,i=e.a,a=i===void 0?1:i;return!d(t)||!d(n)||!d(r)?null:C(x({h:Number(t),s:Number(n),l:Number(r),a:Number(a)}))},`hsl`],[function(e){var t=e.h,n=e.s,r=e.v,i=e.a,a=i===void 0?1:i;return!d(t)||!d(n)||!d(r)?null:b(function(e){return{h:m(e.h),s:p(e.s,0,100),v:p(e.v,0,100),a:p(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(a)}))},`hsv`]]},A=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]},j=function(e){return typeof e==`string`?A(e.trim(),k.string):typeof e==`object`&&e?A(e,k.object):[null,void 0]},M=function(e,t){var n=w(e);return{h:n.h,s:p(n.s+100*t,0,100),l:n.l,a:n.a}},N=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},P=function(e,t){var n=w(e);return{h:n.h,s:n.s,l:p(n.l+100*t,0,100),a:n.a}},F=function(){function e(e){this.parsed=j(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 f(N(this.rgba),2)},e.prototype.isDark=function(){return N(this.rgba)<.5},e.prototype.isLight=function(){return N(this.rgba)>=.5},e.prototype.toHex=function(){return e=g(this.rgba),t=e.r,n=e.g,r=e.b,a=(i=e.a)<1?v(f(255*i)):``,`#`+v(t)+v(n)+v(r)+a;var e,t,n,r,i,a},e.prototype.toRgb=function(){return g(this.rgba)},e.prototype.toRgbString=function(){return e=g(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 S(w(this.rgba))},e.prototype.toHslString=function(){return e=S(w(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=y(this.rgba),{h:f(e.h),s:f(e.s),v:f(e.v),a:f(e.a,3)};var e},e.prototype.invert=function(){return I({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),I(M(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),I(M(this.rgba,-e))},e.prototype.grayscale=function(){return I(M(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),I(P(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),I(P(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`?I({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):f(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=w(this.rgba);return typeof e==`number`?I({h:e,s:t.s,l:t.l,a:t.a}):f(t.h)},e.prototype.isEqual=function(e){return this.toHex()===I(e).toHex()},e}(),I=function(e){return e instanceof F?e:new F(e)};function L(e){return e==null||e===``||e===`none`}function R(e,t=0,n=10**t){return Math.round(n*e)/n+0}function z(e,t){if(typeof e==`number`)return Number.isFinite(e)?e:t;if(typeof e==`string`){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}return t}function B(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>B(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=B(i,t):n[r]=i)}return n}function V(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function ee(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 te(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 ne(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 re(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),te(e,t.split(`.`),n)):e[t]}function ie(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),ne(e,t.split(`.`),n)}var ae=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()}},oe=Symbol.for(`declarations`),se=Symbol.for(`inited`);function ce(e){let t;if(Object.hasOwn(e,oe))t=e[oe];else{let n=Object.getPrototypeOf(e);t={...n?ce(n):{}},e[oe]=t}return t}function le(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?ie(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??de(e,t,r),o)}function ue(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?re(e,r):e[i],a??=de(e,t,n),a}function de(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[se]?.[t]){e[se]||(e[se]={}),e[se][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 fe(e,t){function n(){return this.getProperty?this.getProperty(e):ue(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):le(this,e,n,t)}return{get:n,set:r}}function pe(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=ce(e);i[t]=r;let{get:a,set:o}=fe(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function me(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);pe(t.constructor,n,e)}}var he=class extends ae{_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){t===void 0?delete this._properties[e]: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 ue(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??de(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)le(this,e,t,n);else{let r=this.offsetGetProperty(e);if(Object.is(r,t))return;let i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??de(this,e,n),i)}}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 ce(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 ge(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,I(t)}function _e(e){return{r:R(e.r),g:R(e.g),b:R(e.b),a:R(e.a,3)}}function ve(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ye=`#000000FF`;function be(e){return ge(e).isValid()}function xe(e,t=!1){let n=ge(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),ye}let{r,g:i,b:a,a:o}=_e(n.rgba);return`#${ve(r)}${ve(i)}${ve(a)}${ve(R(o*255))}`}var Se=Se||{};Se.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 Ce=Se.parse.bind(Se),we=we||{};we.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)}})(),we.stringify.bind(we);function Te(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=R(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=xe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=xe({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=xe(e.value);break;case`hex`:a=xe(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break}return{offset:i,color:a}})}function Ee(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break}return{type:`linear-gradient`,angle:t,stops:Te(e.colorStops)}}function De(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:Te(e.colorStops)}}function Oe(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function ke(e){return Ce(e).map(e=>{switch(e?.type){case`linear-gradient`:return Ee(e);case`repeating-linear-gradient`:return{...Ee(e),repeat:!0};case`radial-gradient`:return De(e);case`repeating-radial-gradient`:return{...De(e),repeat:!0};default:return}}).filter(Boolean)}var Ae=[`color`];function je(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=xe(t.color),V(t,Ae)}var Me=[`linearGradient`,`radialGradient`,`rotateWithShape`];function Ne(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=ke(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return V(t,Me)}function Pe(e){return B({name:e.name,params:e.params})}var Fe=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`,`imagePipelines`];function Ie(e){let t;t=typeof e==`string`?{image:e}:{...e};let n=V(t,Fe);return n.imagePipelines=t.imagePipelines?.length?t.imagePipelines.map(Pe):void 0,B(n)}var Le=[`preset`,`foregroundColor`,`backgroundColor`];function Re(e){let t;return t=typeof e==`string`?{preset:e}:{...e},L(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=xe(t.foregroundColor),L(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=xe(t.backgroundColor),V(t,Le)}function ze(e){return!L(e.color)}function Be(e){return typeof e==`string`?be(e):ze(e)}function Ve(e){return!L(e.image)&&Oe(e.image)||!!e.linearGradient||!!e.radialGradient}function He(e){return typeof e==`string`?Oe(e):Ve(e)}function Ue(e){return!L(e.image)&&!Oe(e.image)}function We(e){return typeof e==`string`?!be(e)&&!Oe(e):Ue(e)}function Ge(e){return!L(e.preset)}function Ke(e){return typeof e==`string`?!1:Ge(e)}function qe(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return Be(e)&&Object.assign(t,je(e)),He(e)&&Object.assign(t,Ne(e)),We(e)&&Object.assign(t,Ie(e)),Ke(e)&&Object.assign(t,Re(e)),V(B(t),Array.from(new Set([`enabled`,...Ae,...Fe,...Me,...Le])))}function Je(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function Ye(e){return typeof e==`string`?{...qe(e)}:{...qe(e),...V(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Xe(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Ze(e){return typeof e==`string`?{enabled:!0,color:xe(e)}:{...e,enabled:e.enabled??!0,color:L(e.color)?ye:xe(e.color)}}function Qe(){return{boxShadow:`none`}}function $e(e){return B({blur:e.blur,brightness:e.brightness,contrast:e.contrast,grayscale:e.grayscale,hueRotate:e.hueRotate,invert:e.invert,opacity:e.opacity,saturate:e.saturate,sepia:e.sepia,duotone:e.duotone?[xe(e.duotone[0]),xe(e.duotone[1])]:void 0,biLevel:e.biLevel,colorChange:e.colorChange?{from:xe(e.colorChange.from),to:xe(e.colorChange.to)}:void 0})}var et=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`,`filter`];function tt(e){let t=V(e,et),{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 nt(e){let t=tt(e);return B({fill:L(t.fill)?void 0:qe(t.fill),outline:L(t.outline)?void 0:Ye(t.outline),shadow:L(t.shadow)?void 0:Ze(t.shadow),transform:L(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin,filter:t.filter?$e(t.filter):void 0})}function rt(){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 it(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function at(){return{...rt(),...it(),...Qe(),...Je(),...Xe(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function ot(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function st(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function ct(){return{...ot(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function lt(){return{...st(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function ut(){return{...lt(),...ct(),textStrokeWidth:0,textStrokeColor:`none`}}var dt=[`textIndent`,`lineHeight`,`letterSpacing`,`wordSpacing`,`fontSize`,`textStrokeWidth`,`borderRadius`,`opacity`,`rotate`,`scaleX`,`scaleY`,`skewX`,`skewY`,`translateX`,`translateY`,`borderWidth`,`flex`,`flexGrow`,`flexShrink`];function ft(e){let t=B({...e,color:L(e.color)?void 0:xe(e.color),backgroundColor:L(e.backgroundColor)?void 0:xe(e.backgroundColor),borderColor:L(e.borderColor)?void 0:xe(e.borderColor),outlineColor:L(e.outlineColor)?void 0:xe(e.outlineColor),shadowColor:L(e.shadowColor)?void 0:xe(e.shadowColor),textStrokeColor:L(e.textStrokeColor)?void 0:xe(e.textStrokeColor)});for(let e of dt)if(e in t){let n=z(t[e]);n===void 0?delete t[e]:t[e]=n}return t}function pt(){return{...at(),...ut()}}var mt=/\r\n|\n\r|\n|\r/;RegExp(`${mt.source}|<br\\/>`,`g`);var ht=RegExp(`^(${mt.source})$`),gt=`
2
+ `;function _t(e){return ht.test(e)}function vt(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?ft(e):{},a=n?qe(n):void 0,o=r?Ye(r):void 0,s=B({...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?ft(t):{},s=i?qe(i):void 0,c=a?Ye(a):void 0;Array.from(e).forEach(e=>{if(_t(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(B({...o,fill:s,outline:c,content:gt})),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(ee(s,n)&&ee(c,r)&&ee(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(B({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(bt(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(yt(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(bt(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 yt(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function bt(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function xt(e){return B({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function St(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:vt(e)}:B({enabled:e.enabled??!0,content:vt(e.content??``),style:e.style?ft(e.style):void 0,deformation:e.deformation?xt(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...nt(e),effects:e.effects?e.effects.map(e=>nt(e)):void 0})}var Ct=new Set,wt=!1;function Tt(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length;Ct.size&&Ct.clear();let a=Et(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s=0,c=0,l=0;if(r&&(a=Pt(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 Ot(a,o,s,c,l),o}function Et(e,t,n,r,i){let a=null;if(i===vn(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=hn(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=hn(i/r|0,e[i],e[i+1],a);return a&&cn(a,a.next)&&(gn(a),a=a.next),a}function Dt(e,t=e){let n=t===e,r=e,i;do i=!1,r!==r.next&&(Ct.size===0||!Ct.has(r))&&(cn(r,r.next)||sn(r.prev,r,r.next)===0)?((n||r===t)&&(t=r.prev),wt=!0,gn(r),r=r.prev,i=!0):(n||r!==t)&&(r=r.next,i=!n);while(i||r!==t);return t}function Ot(e,t,n,r,i){i&&$t(e,n,r,i);let a=e,o=!1;for(;e.prev!==e.next;){let s=e.prev,c=e.next;if(sn(s,e,c)<0&&(i?At(e,n,r,i):kt(e))){t.push(s.i,e.i,c.i),gn(e),e=c,a=c;continue}if(e=c,e===a){if(wt=!1,e=Dt(e),wt){a=e;continue}if(!o){e=jt(e,t),a=e,o=!0;continue}Mt(e,t,n,r,i);break}}}function kt(e){let t=e.prev,n=e,r=e.next,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&&!(i===m.x&&s===m.y)&&an(i,s,a,c,o,l,m.x,m.y)&&sn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function At(e,t,n,r){let i=e.prev,a=e,o=e.next,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),_=nn(p,m,t,n,r),v=nn(h,g,t,n,r),y=e.prevZ;for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==o&&!(s===y.x&&u===y.y)&&an(s,u,c,d,l,f,y.x,y.y)&&sn(y.prev,y,y.next)>=0)return!1;y=y.prevZ}let b=e.nextZ;for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==o&&!(s===b.x&&u===b.y)&&an(s,u,c,d,l,f,b.x,b.y)&&sn(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function jt(e,t){let n=e,r=!1;do{let i=n.prev,a=n.next.next;ln(i,n,n.next,a,!1)&&fn(i,a)&&fn(a,i)&&(t.push(i.i,n.i,a.i),gn(n),gn(n.next),n=e=a,r=!0),n=n.next}while(n!==e);return r?Dt(n):n}function Mt(e,t,n,r,i){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&on(a,e)){let o=mn(a,e);a=Dt(a,a.next),o=Dt(o,o.next),Ot(a,t,n,r,i),Ot(o,t,n,r,i);return}e=e.next}a=a.next}while(a!==e)}var Nt=!1;function Pt(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Et(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&Ct.add(o),i.push(rn(o))}i.sort(Ft),Vt(e.length/r,t.length),Ht(n,n),Nt=!0;for(let e=0;e<i.length;e++)n=It(i[e],n);return Nt=!1,Dt(n)}function Ft(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function It(e,t){let n=Kt(e,t);if(!n)return t;let r=mn(n,e),i=r.next;return Ht(n,i.next),Dt(r,r.next),Dt(n,n.next)}var Lt=16,H=new Float64Array,Rt=0,zt=[],Bt=[];function Vt(e,t){let n=Math.ceil((e+2*t)/Lt)+t+2;H.length<n*4&&(H=new Float64Array(n*4)),Rt=0}function Ht(e,t){let n=e;do{let e=Rt++;zt[e]=n;let r=1/0,i=1/0,a=-1/0,o=-1/0,s=0;do{let t=n.next;n.z=e,n.x<r&&(r=n.x),n.x>a&&(a=n.x),n.y<i&&(i=n.y),n.y>o&&(o=n.y),t.x<r&&(r=t.x),t.x>a&&(a=t.x),t.y<i&&(i=t.y),t.y>o&&(o=t.y),n=t}while(++s<Lt&&n!==t);Bt[e]=n;let c=e*4;H[c]=r,H[c+1]=i,H[c+2]=a,H[c+3]=o}while(n!==t)}function Ut(e,t){let n=e.z*4;t.x<H[n]&&(H[n]=t.x),t.y<H[n+1]&&(H[n+1]=t.y),t.x>H[n+2]&&(H[n+2]=t.x),t.y>H[n+3]&&(H[n+3]=t.y)}function Wt(e){let t=Bt[e];for(;t.prev.next!==t;)t=t.next;return Bt[e]=t,t}function Gt(e){let t=zt[e];for(;t.prev.next!==t;)t=t.next;return zt[e]=t,t}function Kt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(cn(e,n))return n;for(let t=0,s=0;t<Rt;t++,s+=4){if(i<H[s+1]||i>H[s+3]||H[s]>r||H[s+2]<=a)continue;let c=Wt(t);n=Gt(t);do{if(n.prev.next===n){if(cn(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!==c)}if(!o)return null;let s=o.x,c=o.y,l=Math.min(i,c),u=Math.max(i,c),d=1/0;for(let t=0,f=0;t<Rt;t++,f+=4){if(H[f+2]<s||H[f]>r||H[f+3]<l||H[f+1]>u)continue;let p=Wt(t);n=Gt(t);do{if(n.prev.next===n&&r>=n.x&&n.x>=s&&r!==n.x&&an(i<c?r:a,i,s,c,i<c?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);(fn(n,e)||n.y===i&&n.next.y===i&&n.next.x>r)&&(t<d||t===d&&(n.x>o.x||n.x===o.x&&qt(o,n)))&&(o=n,d=t)}n=n.next}while(n!==p)}return o}function qt(e,t){return sn(e.prev,e,t.prev)<0&&sn(t.next,e,e.next)<0}var Jt=[],Yt=[],Xt=new Uint32Array,Zt=new Uint32Array,Qt=new Uint32Array(256);function $t(e,t,n,r){let i=e,a=0;do i.z=nn(i.x,i.y,t,n,r),Jt[a++]=i,i=i.next;while(i!==e);en(a);let o=null;for(let e=0;e<a;e++){let t=Jt[e];t.prevZ=o,o&&(o.nextZ=t),o=t}o.nextZ=null}function en(e){if(e<=32){for(let t=1;t<e;t++){let e=Jt[t],n=e.z,r=t-1;for(;r>=0&&Jt[r].z>n;)Jt[r+1]=Jt[r],r--;Jt[r+1]=e}return}Xt.length<e&&(Xt=new Uint32Array(e),Zt=new Uint32Array(e),Yt=Array(e));for(let t=0;t<e;t++)Xt[t]=Jt[t].z;tn(e,Jt,Xt,Yt,Zt,0),tn(e,Yt,Zt,Jt,Xt,8),tn(e,Jt,Xt,Yt,Zt,16),tn(e,Yt,Zt,Jt,Xt,24)}function tn(e,t,n,r,i,a){Qt.fill(0);for(let t=0;t<e;t++)Qt[n[t]>>>a&255]++;let o=0;for(let e=0;e<256;e++){let t=Qt[e];Qt[e]=o,o+=t}for(let o=0;o<e;o++){let e=n[o],s=Qt[e>>>a&255]++;r[s]=t[o],i[s]=e}}function nn(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 rn(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 an(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 on(e,t){let n=cn(e,t)&&sn(e.prev,e,e.next)>0&&sn(t.prev,t,t.next)>0;return e.next.i!==t.i&&(n||fn(e,t)&&fn(t,e)&&(sn(e.prev,e,t.prev)!==0||sn(e,t.prev,t)!==0))&&!dn(e,t)&&(n||pn(e,t))}function sn(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function cn(e,t){return e.x===t.x&&e.y===t.y}function ln(e,t,n,r,i=!0){let a=sn(e,t,n),o=sn(e,t,r),s=sn(n,r,e),c=sn(n,r,t);return(a>0&&o<0||a<0&&o>0)&&(s>0&&c<0||s<0&&c>0)?!0:i?!!(a===0&&un(e,n,t)||o===0&&un(e,r,t)||s===0&&un(n,e,r)||c===0&&un(n,t,r)):!1}function un(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 dn(e,t){let n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y),o=e;do{let s=o.next;if(o.x>r&&s.x>r||o.x<n&&s.x<n||o.y>a&&s.y>a||o.y<i&&s.y<i){o=s;continue}if(o.i!==e.i&&s.i!==e.i&&o.i!==t.i&&s.i!==t.i&&ln(o,s,e,t))return!0;o=s}while(o!==e);return!1}function fn(e,t){return sn(e.prev,e,e.next)<0?sn(e,t,e.next)>=0&&sn(e,e.prev,t)>=0:sn(e,t,e.prev)<0||sn(e,e.next,t)<0}function pn(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{let e=n.next;n.y>a!=e.y>a&&i<(e.x-n.x)*(a-n.y)/(e.y-n.y)+n.x&&(r=!r),n=e}while(n!==e);return r}function mn(e,t){let n=_n(e.i,e.x,e.y),r=_n(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 hn(e,t,n,r){let i=_n(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 gn(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),Nt&&Ut(e.prev,e.next)}function _n(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function vn(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}var yn=l(s(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.polygonClipping=r())})(e,(function(){"use strict";function e(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var t=function(){function e(e,t){this.next=null,this.key=e,this.data=t,this.left=null,this.right=null}return e}();function n(e,t){return e>t?1:e<t?-1:0}function r(e,n,r){for(var i=new t(null,null),a=i,o=i;;){var s=r(e,n.key);if(s<0){if(n.left===null)break;if(r(e,n.left.key)<0){var c=n.left;if(n.left=c.right,c.right=n,n=c,n.left===null)break}o.left=n,o=n,n=n.left}else if(s>0){if(n.right===null)break;if(r(e,n.right.key)>0){var c=n.right;if(n.right=c.left,c.left=n,n=c,n.right===null)break}a.right=n,a=n,n=n.right}else break}return a.right=n.left,o.left=n.right,n.left=i.right,n.right=i.left,n}function i(e,n,i,a){var o=new t(e,n);if(i===null)return o.left=o.right=null,o;i=r(e,i,a);var s=a(e,i.key);return s<0?(o.left=i.left,o.right=i,i.left=null):s>=0&&(o.right=i.right,o.left=i,i.right=null),o}function a(e,t,n){var i=null,a=null;if(t){t=r(e,t,n);var o=n(t.key,e);o===0?(i=t.left,a=t.right):o<0?(a=t.right,t.right=null,i=t):(i=t.left,t.left=null,a=t)}return{left:i,right:a}}function o(e,t,n){return t===null?e:e===null?t:(t=r(e.key,t,n),t.left=e,t)}function s(e,t,n,r,i){if(e){r(``+t+(n?`└── `:`├── `)+i(e)+`
3
+ `);var a=t+(n?` `:`│ `);e.left&&s(e.left,a,!1,r,i),e.right&&s(e.right,a,!0,r,i)}}var c=function(){function c(e){e===void 0&&(e=n),this._root=null,this._size=0,this._comparator=e}return c.prototype.insert=function(e,t){return this._size++,this._root=i(e,t,this._root,this._comparator)},c.prototype.add=function(e,n){var i=new t(e,n);this._root===null&&(i.left=i.right=null,this._size++,this._root=i);var a=this._comparator,o=r(e,this._root,a),s=a(e,o.key);return s===0?this._root=o:(s<0?(i.left=o.left,i.right=o,o.left=null):s>0&&(i.right=o.right,i.left=o,o.right=null),this._size++,this._root=i),this._root},c.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},c.prototype._remove=function(e,t,n){var i;return t===null?null:(t=r(e,t,n),n(e,t.key)===0?(t.left===null?i=t.right:(i=r(e,t.left,n),i.right=t.right),this._size--,i):t)},c.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=r(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},c.prototype.findStatic=function(e){for(var t=this._root,n=this._comparator;t;){var r=n(e,t.key);if(r===0)return t;t=r<0?t.left:t.right}return null},c.prototype.find=function(e){return this._root&&(this._root=r(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},c.prototype.contains=function(e){for(var t=this._root,n=this._comparator;t;){var r=n(e,t.key);if(r===0)return!0;t=r<0?t.left:t.right}return!1},c.prototype.forEach=function(e,t){for(var n=this._root,r=[],i=!1;!i;)n===null?r.length===0?i=!0:(n=r.pop(),e.call(t,n),n=n.right):(r.push(n),n=n.left);return this},c.prototype.range=function(e,t,n,r){for(var i=[],a=this._comparator,o=this._root,s;i.length!==0||o;)if(o)i.push(o),o=o.left;else{if(o=i.pop(),s=a(o.key,t),s>0)break;if(a(o.key,e)>=0&&n.call(r,o))return this;o=o.right}return this},c.prototype.keys=function(){var e=[];return this.forEach(function(t){var n=t.key;return e.push(n)}),e},c.prototype.values=function(){var e=[];return this.forEach(function(t){var n=t.data;return e.push(n)}),e},c.prototype.min=function(){return this._root?this.minNode(this._root).key:null},c.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},c.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},c.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},c.prototype.at=function(e){for(var t=this._root,n=!1,r=0,i=[];!n;)if(t)i.push(t),t=t.left;else if(i.length>0){if(t=i.pop(),r===e)return t;r++,t=t.right}else n=!0;return null},c.prototype.next=function(e){var t=this._root,n=null;if(e.right){for(n=e.right;n.left;)n=n.left;return n}for(var r=this._comparator;t;){var i=r(e.key,t.key);if(i===0)break;i<0?(n=t,t=t.left):t=t.right}return n},c.prototype.prev=function(e){var t=this._root,n=null;if(e.left!==null){for(n=e.left;n.right;)n=n.right;return n}for(var r=this._comparator;t;){var i=r(e.key,t.key);if(i===0)break;i<0?t=t.left:(n=t,t=t.right)}return n},c.prototype.clear=function(){return this._root=null,this._size=0,this},c.prototype.toList=function(){return d(this._root)},c.prototype.load=function(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!1);var r=e.length,i=this._comparator;if(n&&m(e,t,0,r-1,i),this._root===null)this._root=l(e,t,0,r),this._size=r;else{var a=p(this.toList(),u(e,t),i);r=this._size+r,this._root=f({head:a},0,r)}return this},c.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(c.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),c.prototype.toString=function(e){e===void 0&&(e=function(e){return String(e.key)});var t=[];return s(this._root,``,!0,function(e){return t.push(e)},e),t.join(``)},c.prototype.update=function(e,t,n){var r=this._comparator,s=a(e,this._root,r),c=s.left,l=s.right;r(e,t)<0?l=i(t,n,l,r):c=i(t,n,c,r),this._root=o(c,l,r)},c.prototype.split=function(e){return a(e,this._root,this._comparator)},c.prototype[Symbol.iterator]=function(){var t,n,r;return e(this,function(e){switch(e.label){case 0:t=this._root,n=[],r=!1,e.label=1;case 1:return r?[3,6]:t===null?[3,2]:(n.push(t),t=t.left,[3,5]);case 2:return n.length===0?[3,4]:(t=n.pop(),[4,t]);case 3:return e.sent(),t=t.right,[3,5];case 4:r=!0,e.label=5;case 5:return[3,1];case 6:return[2]}})},c}();function l(e,n,r,i){var a=i-r;if(a>0){var o=r+Math.floor(a/2),s=e[o],c=n[o],u=new t(s,c);return u.left=l(e,n,r,o),u.right=l(e,n,o+1,i),u}return null}function u(e,n){for(var r=new t(null,null),i=r,a=0;a<e.length;a++)i=i.next=new t(e[a],n[a]);return i.next=null,r.next}function d(e){for(var n=e,r=[],i=!1,a=new t(null,null),o=a;!i;)n?(r.push(n),n=n.left):r.length>0?(n=o=o.next=r.pop(),n=n.right):i=!0;return o.next=null,a.next}function f(e,t,n){var r=n-t;if(r>0){var i=t+Math.floor(r/2),a=f(e,t,i),o=e.head;return o.left=a,e.head=e.head.next,o.right=f(e,i+1,n),o}return null}function p(e,n,r){for(var i=new t(null,null),a=i,o=e,s=n;o!==null&&s!==null;)r(o.key,s.key)<0?(a.next=o,o=o.next):(a.next=s,s=s.next),a=a.next;return o===null?s!==null&&(a.next=s):a.next=o,i.next}function m(e,t,n,r,i){if(!(n>=r)){for(var a=e[n+r>>1],o=n-1,s=r+1;;){do o++;while(i(e[o],a)<0);do s--;while(i(e[s],a)>0);if(o>=s)break;var c=e[o];e[o]=e[s],e[s]=c,c=t[o],t[o]=t[s],t[s]=c}m(e,t,n,s,i),m(e,t,s+1,r,i)}}let h=(e,t)=>e.ll.x<=t.x&&t.x<=e.ur.x&&e.ll.y<=t.y&&t.y<=e.ur.y,g=(e,t)=>{if(t.ur.x<e.ll.x||e.ur.x<t.ll.x||t.ur.y<e.ll.y||e.ur.y<t.ll.y)return null;let n=e.ll.x<t.ll.x?t.ll.x:e.ll.x,r=e.ur.x<t.ur.x?e.ur.x:t.ur.x,i=e.ll.y<t.ll.y?t.ll.y:e.ll.y,a=e.ur.y<t.ur.y?e.ur.y:t.ur.y;return{ll:{x:n,y:i},ur:{x:r,y:a}}},_=2**-52;_===void 0&&(_=2**-52);let v=_*_,y=(e,t)=>{if(-_<e&&e<_&&-_<t&&t<_)return 0;let n=e-t;return n*n<v*e*t?0:e<t?-1:1};class b{constructor(){this.reset()}reset(){this.xRounder=new x,this.yRounder=new x}round(e,t){return{x:this.xRounder.round(e),y:this.yRounder.round(t)}}}class x{constructor(){this.tree=new c,this.round(0)}round(e){let t=this.tree.add(e),n=this.tree.prev(t);if(n!==null&&y(t.key,n.key)===0)return this.tree.remove(e),n.key;let r=this.tree.next(t);return r!==null&&y(t.key,r.key)===0?(this.tree.remove(e),r.key):e}}let S=new b,C=134217729;function w(e,t,n,r,i){let a,o,s,c,l=t[0],u=r[0],d=0,f=0;u>l==u>-l?(a=l,l=t[++d]):(a=u,u=r[++f]);let p=0;if(d<e&&f<n)for(u>l==u>-l?(o=l+a,s=a-(o-l),l=t[++d]):(o=u+a,s=a-(o-u),u=r[++f]),a=o,s!==0&&(i[p++]=s);d<e&&f<n;)u>l==u>-l?(o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d]):(o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f]),a=o,s!==0&&(i[p++]=s);for(;d<e;)o=a+l,c=o-a,s=a-(o-c)+(l-c),l=t[++d],a=o,s!==0&&(i[p++]=s);for(;f<n;)o=a+u,c=o-a,s=a-(o-c)+(u-c),u=r[++f],a=o,s!==0&&(i[p++]=s);return(a!==0||p===0)&&(i[p++]=a),p}function T(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function E(e){return new Float64Array(e)}let D=E(4),O=E(8),k=E(12),A=E(16),j=E(4);function M(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,E,M,N=e-i,P=n-i,F=t-a,I=r-a;b=N*I,f=C*N,p=f-(f-N),m=N-p,f=C*I,h=f-(f-I),g=I-h,x=m*g-(b-p*h-m*h-p*g),S=F*P,f=C*F,p=f-(f-F),m=F-p,f=C*P,h=f-(f-P),g=P-h,E=m*g-(S-p*h-m*h-p*g),_=x-E,d=x-_,D[0]=x-(_+d)+(d-E),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,D[1]=y-(_+d)+(d-S),M=v+_,d=M-v,D[2]=v-(M-d)+(_-d),D[3]=M;let L=T(4,D),R=22204460492503146e-32*o;if(L>=R||-L>=R||(d=e-N,s=e-(N+d)+(d-i),d=n-P,l=n-(P+d)+(d-i),d=t-F,c=t-(F+d)+(d-a),d=r-I,u=r-(I+d)+(d-a),s===0&&c===0&&l===0&&u===0)||(R=11093356479670487e-47*o+33306690738754706e-32*Math.abs(L),L+=N*u+I*s-(F*l+P*c),L>=R||-L>=R))return L;b=s*I,f=C*s,p=f-(f-s),m=s-p,f=C*I,h=f-(f-I),g=I-h,x=m*g-(b-p*h-m*h-p*g),S=c*P,f=C*c,p=f-(f-c),m=c-p,f=C*P,h=f-(f-P),g=P-h,E=m*g-(S-p*h-m*h-p*g),_=x-E,d=x-_,j[0]=x-(_+d)+(d-E),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,j[1]=y-(_+d)+(d-S),M=v+_,d=M-v,j[2]=v-(M-d)+(_-d),j[3]=M;let z=w(4,D,4,j,O);b=N*u,f=C*N,p=f-(f-N),m=N-p,f=C*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=F*l,f=C*F,p=f-(f-F),m=F-p,f=C*l,h=f-(f-l),g=l-h,E=m*g-(S-p*h-m*h-p*g),_=x-E,d=x-_,j[0]=x-(_+d)+(d-E),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,j[1]=y-(_+d)+(d-S),M=v+_,d=M-v,j[2]=v-(M-d)+(_-d),j[3]=M;let B=w(z,O,4,j,k);return b=s*u,f=C*s,p=f-(f-s),m=s-p,f=C*u,h=f-(f-u),g=u-h,x=m*g-(b-p*h-m*h-p*g),S=c*l,f=C*c,p=f-(f-c),m=c-p,f=C*l,h=f-(f-l),g=l-h,E=m*g-(S-p*h-m*h-p*g),_=x-E,d=x-_,j[0]=x-(_+d)+(d-E),v=b+_,d=v-b,y=b-(v-d)+(_-d),_=y-S,d=y-_,j[1]=y-(_+d)+(d-S),M=v+_,d=M-v,j[2]=v-(M-d)+(_-d),j[3]=M,A[w(B,k,4,j,A)-1]}function N(e,t,n,r,i,a){let o=(t-a)*(n-i),s=(e-i)*(r-a),c=o-s,l=Math.abs(o+s);return Math.abs(c)>=33306690738754716e-32*l?c:-M(e,t,n,r,i,a,l)}let P=(e,t)=>e.x*t.y-e.y*t.x,F=(e,t)=>e.x*t.x+e.y*t.y,I=(e,t,n)=>{let r=N(e.x,e.y,t.x,t.y,n.x,n.y);return r>0?-1:+(r<0)},L=e=>Math.sqrt(F(e,e)),R=(e,t,n)=>{let r={x:t.x-e.x,y:t.y-e.y},i={x:n.x-e.x,y:n.y-e.y};return P(i,r)/L(i)/L(r)},z=(e,t,n)=>{let r={x:t.x-e.x,y:t.y-e.y},i={x:n.x-e.x,y:n.y-e.y};return F(i,r)/L(i)/L(r)},B=(e,t,n)=>t.y===0?null:{x:e.x+t.x/t.y*(n-e.y),y:n},V=(e,t,n)=>t.x===0?null:{x:n,y:e.y+t.y/t.x*(n-e.x)},ee=(e,t,n,r)=>{if(t.x===0)return V(n,r,e.x);if(r.x===0)return V(e,t,n.x);if(t.y===0)return B(n,r,e.y);if(r.y===0)return B(e,t,n.y);let i=P(t,r);if(i==0)return null;let a={x:n.x-e.x,y:n.y-e.y},o=P(a,t)/i,s=P(a,r)/i,c=e.x+s*t.x,l=n.x+o*r.x,u=e.y+s*t.y,d=n.y+o*r.y;return{x:(c+l)/2,y:(u+d)/2}};class te{static compare(e,t){let n=te.comparePoints(e.point,t.point);return n===0?(e.point!==t.point&&e.link(t),e.isLeft===t.isLeft?re.compare(e.segment,t.segment):e.isLeft?1:-1):n}static comparePoints(e,t){return e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw Error(`Tried to link already linked events`);let t=e.point.events;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){let e=this.point.events.length;for(let t=0;t<e;t++){let n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){let e=this.point.events[r];e.consumedBy===void 0&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){let e=[];for(let t=0,n=this.point.events.length;t<n;t++){let n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){let t=new Map,n=n=>{let r=n.otherSE;t.set(n,{sine:R(this.point,e.point,r.point),cosine:z(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);let{sine:i,cosine:a}=t.get(e),{sine:o,cosine:s}=t.get(r);return i>=0&&o>=0?a<s?1:a>s?-1:0:i<0&&o<0?a<s?-1:+(a>s):o<i?-1:+(o>i)}}}let ne=0;class re{static compare(e,t){let n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,a=t.rightSE.point.x;if(a<n)return 1;if(i<r)return-1;let o=e.leftSE.point.y,s=t.leftSE.point.y,c=e.rightSE.point.y,l=t.rightSE.point.y;if(n<r){if(s<o&&s<c)return 1;if(s>o&&s>c)return-1;let n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;let r=t.comparePoint(e.rightSE.point);return r===0?-1:r}if(n>r){if(o<s&&o<l)return-1;if(o>s&&o>l)return 1;let n=t.comparePoint(e.leftSE.point);if(n!==0)return n;let r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(o<s)return-1;if(o>s)return 1;if(i<a){let n=t.comparePoint(e.rightSE.point);if(n!==0)return n}if(i>a){let n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==a){let e=c-o,t=i-n,u=l-s,d=a-r;if(e>t&&u<d)return 1;if(e<t&&u>d)return-1}return i>a?1:i<a||c<l?-1:c>l?1:e.id<t.id?-1:+(e.id>t.id)}constructor(e,t,n,r){this.id=++ne,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(e,t,n){let r,i,a,o=te.comparePoints(e,t);if(o<0)r=e,i=t,a=1;else if(o>0)r=t,i=e,a=-1;else throw Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);return new re(new te(r,!0),new te(i,!1),[n],[a])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e<t?e:t},ur:{x:this.rightSE.point.x,y:e>t?e:t}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}comparePoint(e){if(this.isAnEndpoint(e))return 0;let t=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(t.x===n.x)return e.x===t.x?0:e.x<t.x?1:-1;let i=(e.y-t.y)/r.y,a=t.x+i*r.x;if(e.x===a)return 0;let o=(e.x-t.x)/r.x,s=t.y+o*r.y;return e.y===s?0:e.y<s?-1:1}getIntersection(e){let t=this.bbox(),n=e.bbox(),r=g(t,n);if(r===null)return null;let i=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,s=e.rightSE.point,c=h(t,o)&&this.comparePoint(o)===0,l=h(n,i)&&e.comparePoint(i)===0,u=h(t,s)&&this.comparePoint(s)===0,d=h(n,a)&&e.comparePoint(a)===0;if(l&&c)return d&&!u?a:!d&&u?s:null;if(l)return u&&i.x===s.x&&i.y===s.y?null:i;if(c)return d&&a.x===o.x&&a.y===o.y?null:o;if(d&&u)return null;if(d)return a;if(u)return s;let f=ee(i,this.vector(),o,e.vector());return f===null||!h(r,f)?null:S.round(f.x,f.y)}split(e){let t=[],n=e.events!==void 0,r=new te(e,!0),i=new te(e,!1),a=this.rightSE;this.replaceRightSE(i),t.push(i),t.push(r);let o=new re(r,a,this.rings.slice(),this.windings.slice());return te.comparePoints(o.leftSE.point,o.rightSE.point)>0&&o.swapEvents(),te.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),t}swapEvents(){let e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(e){let t=this,n=e;for(;t.consumedBy;)t=t.consumedBy;for(;n.consumedBy;)n=n.consumedBy;let r=re.compare(t,n);if(r!==0){if(r>0){let e=t;t=n,n=e}if(t.prev===n){let e=t;t=n,n=e}for(let e=0,r=n.rings.length;e<r;e++){let r=n.rings[e],i=n.windings[e],a=t.rings.indexOf(r);a===-1?(t.rings.push(r),t.windings.push(i)):t.windings[a]+=i}n.rings=null,n.windings=null,n.consumedBy=t,n.leftSE.consumedBy=t.leftSE,n.rightSE.consumedBy=t.rightSE}}prevInResult(){return this._prevInResult===void 0&&(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};let t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){let r=this.rings[e],i=this.windings[e],a=t.indexOf(r);a===-1?(t.push(r),n.push(i)):n[a]+=i}let i=[],a=[];for(let e=0,r=t.length;e<r;e++){if(n[e]===0)continue;let r=t[e],o=r.poly;if(a.indexOf(o)===-1)if(r.isExterior)i.push(o);else{a.indexOf(o)===-1&&a.push(o);let e=i.indexOf(r.poly);e!==-1&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){let t=i[e].multiPoly;r.indexOf(t)===-1&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch(me.type){case`union`:{let n=e.length===0,r=t.length===0;this._isInResult=n!==r;break}case`intersection`:{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===me.numMultiPolys&&n<r;break}case`xor`:{let n=Math.abs(e.length-t.length);this._isInResult=n%2==1;break}case`difference`:{let n=e=>e.length===1&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}default:throw Error(`Unrecognized operation type found ${me.type}`)}return this._isInResult}}class ie{constructor(e,t,n){if(!Array.isArray(e)||e.length===0||(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!=`number`||typeof e[0][1]!=`number`))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let r=S.round(e[0][0],e[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if(typeof e[t][0]!=`number`||typeof e[t][1]!=`number`)throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let n=S.round(e[t][0],e[t][1]);n.x===i.x&&n.y===i.y||(this.segments.push(re.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}(r.x!==i.x||r.y!==i.y)&&this.segments.push(re.fromRing(i,r,this))}getSweepEvents(){let e=[];for(let t=0,n=this.segments.length;t<n;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}}class ae{constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);this.exteriorRing=new ie(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){let n=new ie(e[t],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){let n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}}class oe{constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);try{typeof e[0][0][0]==`number`&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:1/0,y:1/0},ur:{x:-1/0,y:-1/0}};for(let t=0,n=e.length;t<n;t++){let n=new ae(e[t],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}}class se{static factory(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(!r.isInResult()||r.ringOut)continue;let i=null,a=r.leftSE,o=r.rightSE,s=[a],c=a.point,l=[];for(;i=a,a=o,s.push(a),a.point!==c;)for(;;){let e=a.getAvailableLinkedEvents();if(e.length===0){let e=s[0].point,t=s[s.length-1].point;throw Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(e.length===1){o=e[0].otherSE;break}let n=null;for(let e=0,t=l.length;e<t;e++)if(l[e].point===a.point){n=e;break}if(n!==null){let e=l.splice(n)[0],r=s.splice(e.index);r.unshift(r[0].otherSE),t.push(new se(r.reverse()));continue}l.push({index:s.length,point:a.point});let r=a.getLeftmostComparator(i);o=e.sort(r)[0].otherSE;break}t.push(new se(s))}return t}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point,t=[e];for(let n=1,r=this.events.length-1;n<r;n++){let r=this.events[n].point,i=this.events[n+1].point;I(r,e,i)!==0&&(t.push(r),e=r)}if(t.length===1)return null;let n=t[0],r=t[1];I(n,e,r)===0&&t.shift(),t.push(t[0]);let i=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,s=[];for(let e=a;e!=o;e+=i)s.push([t[e].x,t[e].y]);return s}isExteriorRing(){if(this._isExteriorRing===void 0){let e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){let n=this.events[t];te.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut.enclosingRing()===t.ringOut?t.ringOut.enclosingRing():t.ringOut;t=n.prevInResult(),n=t?t.prevInResult():null}}}class ce{constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(let t=0,n=this.interiorRings.length;t<n;t++){let n=this.interiorRings[t].getGeom();n!==null&&e.push(n)}return e}}class le{constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new ce(r));else{let e=r.enclosingRing();e.poly||t.push(new ce(e)),e.poly.addInterior(r)}}return t}}class ue{constructor(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:re.compare;this.queue=e,this.tree=new c(t),this.segments=[]}process(e){let t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(t),n;let r=e.isLeft?this.tree.add(t):this.tree.find(t);if(!r)throw Error(`Unable to find segment #${t.id} [${t.leftSE.point.x}, ${t.leftSE.point.y}] -> [${t.rightSE.point.x}, ${t.rightSE.point.y}] in SweepLine tree.`);let i=r,a=r,o,s;for(;o===void 0;)i=this.tree.prev(i),i===null?o=null:i.key.consumedBy===void 0&&(o=i.key);for(;s===void 0;)a=this.tree.next(a),a===null?s=null:a.key.consumedBy===void 0&&(s=a.key);if(e.isLeft){let r=null;if(o){let e=o.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(r=e),!o.isAnEndpoint(e))){let t=this._splitSafely(o,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let i=null;if(s){let e=s.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(i=e),!s.isAnEndpoint(e))){let t=this._splitSafely(s,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(r!==null||i!==null){let e=null;e=r===null?i:i===null||te.comparePoints(r,i)<=0?r:i,this.queue.remove(t.rightSE),n.push(t.rightSE);let a=t.split(e);for(let e=0,t=a.length;e<t;e++)n.push(a[e])}n.length>0?(this.tree.remove(t),n.push(e)):(this.segments.push(t),t.prev=o)}else{if(o&&s){let e=o.getIntersection(s);if(e!==null){if(!o.isAnEndpoint(e)){let t=this._splitSafely(o,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!s.isAnEndpoint(e)){let t=this._splitSafely(s,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.remove(t)}return n}_splitSafely(e,t){this.tree.remove(e);let n=e.rightSE;this.queue.remove(n);let r=e.split(t);return r.push(n),e.consumedBy===void 0&&this.tree.add(e),r}}let de=typeof process<`u`&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,fe=typeof process<`u`&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class pe{run(e,t,n){me.type=e,S.reset();let r=[new oe(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new oe(n[e],!1));if(me.numMultiPolys=r.length,me.type===`difference`){let e=r[0],t=1;for(;t<r.length;)g(r[t].bbox,e.bbox)===null?r.splice(t,1):t++}if(me.type===`intersection`)for(let e=0,t=r.length;e<t;e++){let t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(g(t.bbox,r[n].bbox)===null)return[]}let i=new c(te.compare);for(let e=0,t=r.length;e<t;e++){let t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)if(i.insert(t[e]),i.size>de)throw Error(`Infinite loop when putting segment endpoints in a priority queue (queue size too big).`)}let a=new ue(i),o=i.size,s=i.pop();for(;s;){let e=s.key;if(i.size===o){let t=e.segment;throw Error(`Unable to pop() ${e.isLeft?`left`:`right`} SweepEvent [${e.point.x}, ${e.point.y}] from segment #${t.id} [${t.leftSE.point.x}, ${t.leftSE.point.y}] -> [${t.rightSE.point.x}, ${t.rightSE.point.y}] from queue.`)}if(i.size>de)throw Error(`Infinite loop when passing sweep line over endpoints (queue size too big).`);if(a.segments.length>fe)throw Error(`Infinite loop when passing sweep line over endpoints (too many sweep line segments).`);let t=a.process(e);for(let e=0,n=t.length;e<n;e++){let n=t[e];n.consumedBy===void 0&&i.insert(n)}o=i.size,s=i.pop()}return S.reset(),new le(se.factory(a.segments)).getGeom()}}let me=new pe;return{union:function(e){var t=[...arguments].slice(1);return me.run(`union`,e,t)},intersection:function(e){var t=[...arguments].slice(1);return me.run(`intersection`,e,t)},xor:function(e){var t=[...arguments].slice(1);return me.run(`xor`,e,t)},difference:function(e){var t=[...arguments].slice(1);return me.run(`difference`,e,t)}}}))}))(),1);function bn(e,t,n,r={}){let{radius:i=1}=r;e.moveTo(t,n),e.arc(t,n,i,0,Math.PI*2)}var xn={arcs:`bevel`,bevel:`bevel`,miter:`miter`,"miter-clip":`miter`,round:`round`};function Sn(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=xn[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 Cn(e){let t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);let n=t[0],r=t[t.length-1];return n&&r&&(n[0]!==r[0]||n[1]!==r[1])&&t.push([n[0],n[1]]),t}function wn(e){let t=e.filter(e=>e.length>=6).map(Cn);if(!t.length)return[];let n=[[t[0]]];for(let e=1;e<t.length;e++)n=yn.default.xor(n,[[t[e]]]);return n}function Tn(e){let t=[];for(let n of e)for(let e of n){let n=[];for(let[t,r]of e)n.push(t,r);t.push(n)}return t}function En(e,t,n){let r=wn(t),i=wn(n),a;switch(e){case`union`:a=yn.default.union(r,i);break;case`intersection`:a=yn.default.intersection(r,i);break;case`difference`:a=yn.default.difference(r,i);break;case`xor`:a=yn.default.xor(r,i);break}return Tn(a)}function Dn(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 On=Math.PI*2;function kn(e){return e.replace(/[^a-z0-9]/gi,`-`).replace(/\B([A-Z])/g,`-$1`).toLowerCase()}function An(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 jn=/([\w-]+)\((.+?)\)/g,Mn=/[^,]+/g,Nn=/([-e.\d]+)(.*)/;function Pn(e,t={}){let n=[],r;for(;(r=jn.exec(e))!==null;){let[,e,i]=r;e&&n.push({name:e,args:Fn(e,i,t)})}return n}function Fn(e,t,n={}){let r=[],i,a=0;for(;(i=Mn.exec(t))!==null;)r.push(In(e,i[0],{...n,index:a++}));return r}function In(e,t,n={}){let{width:r=1,height:i=1,index:a=0}=n,o=t.match(Nn),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/On;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 Ln(e,t){let n=1-e;return n*n*n*t}function Rn(e,t){let n=1-e;return 3*n*n*e*t}function zn(e,t){return 3*(1-e)*e*e*t}function Bn(e,t){return e*e*e*t}function Vn(e,t,n,r,i){return Ln(e,t)+Rn(e,n)+zn(e,r)+Bn(e,i)}function Hn(e,t,n,r,i,a){return(n-e)*(a-t)-(i-e)*(r-t)}function Un(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&&Hn(o,s,l,u,e,t)>0&&i++:u<=t&&Hn(o,s,l,u,e,t)<0&&i--}return i}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||s>t&&u<=t)&&e<o+(t-s)/(u-s)*(l-o)&&i++}return i}function Gn(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 Kn(e,t,n=`nonzero`){return t.length<6?!1:n===`evenodd`?(Wn(e.x,e.y,t)&1)==1:Un(e.x,e.y,t)!==0}function qn(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+=Wn(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+=Un(r,i,n))}return a!==0}function Jn(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=Gn(i,a,t[e],t[e+1],t[e+2],t[e+3]);n<o&&(o=n)}if(n&&r>=6){let e=Gn(i,a,t[r-2],t[r-1],t[0],t[1]);e<o&&(o=e)}return o}function Yn(e){if(e.length<6)return null;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a=0;a<e.length;a+=2){let o=e[a],s=e[a+1];o<t&&(t=o),s<n&&(n=s),o>r&&(r=o),s>i&&(i=s)}return{minX:t,minY:n,maxX:r,maxY:i}}function Xn(e,t){return e.minX>=t.minX&&e.maxX<=t.maxX&&e.minY>=t.minY&&e.maxY<=t.maxY}function Zn(e,t){let n=e.length/2,r=Math.max(1,Math.floor(n/9)),i=0,a=0;for(let o=0;o<n;o+=r)i++,Kn({x:e[o*2],y:e[o*2+1]},t,`evenodd`)&&a++;return i>0&&a*2>i}function Qn(e){let t=e.length,n=e.map(Yn),r=Array.from({length:t}).fill(0),i=e.map(()=>[]);for(let a=0;a<t;a++){let o=n[a];if(o)for(let s=0;s<t;s++){if(a===s)continue;let t=n[s];!t||!Xn(o,t)||Zn(e[a],e[s])&&(r[a]++,i[a].push(s))}}return e.map((e,t)=>{let n=-1,a=-1;for(let e of i[t])r[e]>a&&(a=r[e],n=e);return{index:t,depth:r[t],parentIndex:n}})}var $n=1e-7;function er(e,t,n){let r=e.length/2,i=[0,...t,r],a=[],o=[];for(let t=0;t<i.length-1;t++){let r=i[t],s=i[t+1];t>0&&o.push(a.length/2);let c=a.length;for(let t=r;t<s;t++){let r=e[t*2],i=e[t*2+1],o=a.length;o>c&&Math.abs(r-a[o-2])<n&&Math.abs(i-a[o-1])<n||a.push(r,i)}a.length-c>=4&&Math.abs(a[a.length-2]-a[c])<n&&Math.abs(a[a.length-1]-a[c+1])<n&&(a.length-=2)}return{points:a,holes:o}}function tr(e,t={}){let{vertices:n=[],indices:r=[],holes:i=[],verticesStride:a=2,verticesOffset:o=n.length/a,indicesOffset:s=r.length}=t;({points:e,holes:i}=er(e,i,$n));let c=Tt(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 nr=8,rr=1.1920929e-7,ir=1;function ar(e,t,n,r,i,a,o,s,c=.5,l=[]){let u=(ir-Math.min(.99,Math.max(0,c)))/1;return u*=u,or(e,t,n,r,i,a,o,s,l,u,0),l.push(o,s),l}function or(e,t,n,r,i,a,o,s,c,l,u){if(u>nr)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>rr&&p>rr){if((f+p)*(f+p)<=l*(u*u+d*d)){c.push(x,S);return}}else if(f>rr){if(f*f<=l*(u*u+d*d)){c.push(x,S);return}}else if(p>rr){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}}or(e,t,d,f,_,v,x,S,c,l,u+1),or(x,S,y,b,h,g,o,s,c,l,u+1)}var sr=8,cr=1.1920929e-7,lr=1;function ur(e,t,n,r,i,a,o=.5,s=[]){let c=(lr-Math.min(.99,Math.max(0,o)))/1;return c*=c,dr(s,e,t,n,r,i,a,c,0),s.push(i,a),s}function dr(e,t,n,r,i,a,o,s,c){if(c>sr)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(_>cr){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}dr(e,t,n,l,u,p,m,s,c+1),dr(e,p,m,d,f,a,o,s,c+1)}function fr(e,t,n,r,i,a){return(n-e)*(a-t)-(r-t)*(i-e)}function pr(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&&fr(c,l,r,s,e,t)>0&&i++:l<=t&&fr(c,l,r,s,e,t)<0&&i--}return i}function mr(e,t){let n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)}function hr(e){let t=0,n=e.length;for(let r=0,i=n-2;r<n;i=r,r+=2)t+=e[i]*e[r+1]-e[r]*e[i+1];return Math.sign(t)}function gr(e,t){return e.minX<=t.maxX&&e.maxX>=t.minX&&e.minY<=t.maxY&&e.maxY>=t.minY}function _r(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||!gr(c,a))continue;let l={},u=[];for(let n=0,r=s.length;n<r;n++){let[r,i]=s[n],a=pr(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:mr(r[i][0],r[t][0])})}let l=o.reduce((e,t)=>e+t.winding,0);o.length&&l+hr(e[i])===0&&(o.sort((e,t)=>e.dist-t.dist),t[i]=o[0])}return t}function vr(e,t){let n=1-e;return n*n*t}function yr(e,t){return 2*(1-e)*e*t}function br(e,t){return e*e*t}function xr(e,t,n,r){return vr(e,t)+yr(e,n)+br(e,r)}function Sr(e){switch(e){case`round`:case`bevel`:case`miter`:return e;default:return`miter`}}function Cr(e){return{width:e?.strokeWidth??1,alignment:.5,join:Sr(e?.strokeLinejoin),cap:e?.strokeLinecap??`butt`,miterLimit:e?.strokeMiterlimit??10}}var wr=1e-4,Tr=1e-4;function Er(e,t={}){let{vertices:n=[],indices:r=[],flipAlignment:i=!1,closed:a=!0}=t,o=t.lineStyle??Cr(t.style),s=wr;if(e.length===0||(e=Dr(e,s),e.length<4))return{vertices:n,indices:r};let c=o,l=c.alignment;if(o.alignment!==.5){let t=Or(e);i&&(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=a,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+=Ar(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+=kr(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+=Ar(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+=Ar(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+=Ar(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+=Ar(C,w,C+D*P,w+O*P,C+k*P,w+A*P,m,!0)+2:g+=Ar(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+=Ar(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+=kr(C,w,D,O,N,P,!1,m)));let F=Tr*Tr;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 Dr(e,t){let n=[e[0],e[1]];for(let r=2;r<e.length;r+=2){let i=e[r],a=e[r+1];(Math.abs(i-n[n.length-2])>=t||Math.abs(a-n[n.length-1])>=t)&&n.push(i,a)}return n}function Or(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 kr(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 Ar(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 jr=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/On;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(On-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 Pn(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]*On);break;case`rotateY`:a.rotateY(n[0]*On);break;case`rotateZ`:a.rotateZ(n[0]*On);break;case`rotate`:a.rotate(n[0]*On);break;case`rotate3d`:a.rotate3d(n[0]*On,(n[1]??n[0])*On,(n[2]??n[1]??n[0])*On,(n[3]??n[2]??n[1]??n[0])*On);break;case`skewX`:a.skewX(n[0]*On);break;case`skewY`:a.skewY(n[0]*On);break;case`skew`:a.skew(n[0]*On,(n[0]??n[1])*On);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 Mr(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 Nr(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=Mr(1,0,(u-b)/t,(d-x)/n),T=Mr((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 Pr(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 Fr(e,t){return e-(t-e)}function Ir(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(Fr(n.x,r.x),Fr(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(Fr(n.x,r.x),Fr(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=Fr(n.x,r.x),i=Fr(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),Nr(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 Lr(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 Rr=/[a-df-z][^a-df-z]*/gi;function zr(e){let t=[],n=e.match(Rr);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=Pr(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=Pr(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,x:o[e]});break;case`v`:case`V`:o=Pr(a);for(let e=0,n=o.length;e<n;e++)t.push({type:i,y:o[e]});break;case`l`:case`L`:o=Pr(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=Pr(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=Pr(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=Pr(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=Pr(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=Pr(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 Br=`data:image/svg+xml;`,Vr=`${Br}base64,`,Hr=`${Br}charset=utf8,`;function Ur(e){if(typeof e==`string`){let t;e.startsWith(Vr)?(e=e.substring(Vr.length,e.length),t=atob(e)):e.startsWith(Hr)?(e=e.substring(Hr.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`}
4
+ ${t}`);return n.documentElement}else return e}var Wr=`px`,Gr=90,Kr=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],qr={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=Kr.length;n<r;n++){let r=Kr[n];if(e.endsWith(r)){t=r,e=e.substring(0,e.length-r.length);break}}let n;return n=qr[t][Wr],n<0&&(n=qr[t].in*Gr),n*Number.parseFloat(e)}function Jr(e,t,n){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let r=Yr(e);return n.length>0&&r.prepend(n[n.length-1]),t.copyFrom(r),n.push(r),r}function Yr(e){let t=new jr;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 Xr(e){return new Mi().arc(K(e.getAttribute(`cx`)||0),K(e.getAttribute(`cy`)||0),K(e.getAttribute(`r`)||0),0,Math.PI*2)}function Zr(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 Qr(e){return new Mi().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 $r(e){return new Mi().moveTo(K(e.getAttribute(`x1`)||0),K(e.getAttribute(`y1`)||0)).lineTo(K(e.getAttribute(`x2`)||0),K(e.getAttribute(`y2`)||0))}function ei(e){let t=new Mi,n=e.getAttribute(`d`);return!n||n===`none`?null:(t.addData(n),t)}var ti=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ni(e){let t=new Mi,n=0;return e.getAttribute(`points`)?.replace(ti,(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 ri=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g;function ii(e){let t=new Mi,n=0;return e.getAttribute(`points`)?.replace(ri,(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 ai(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 Mi;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 oi(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 si(e,t,n=[],r={}){if(e.nodeType!==1)return n;let i=!1,a=null,o={...t};switch(e.nodeName){case`svg`:o=oi(e,o,r);break;case`style`:Zr(e,r);break;case`g`:o=oi(e,o,r);break;case`path`:o=oi(e,o,r),e.hasAttribute(`d`)&&(a=ei(e));break;case`rect`:o=oi(e,o,r),a=ai(e);break;case`polygon`:o=oi(e,o,r),a=ni(e);break;case`polyline`:o=oi(e,o,r),a=ii(e);break;case`circle`:o=oi(e,o,r),a=Xr(e);break;case`ellipse`:o=oi(e,o,r),a=Qr(e);break;case`line`:o=oi(e,o,r),a=$r(e);break;case`defs`:i=!0;break;case`use`:{o=oi(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?si(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 jr,c=[],l=Jr(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`||si(t,o,n,r)}return l&&(c.pop(),c.length>0?s.copyFrom(c[c.length-1]):s.identity()),n}function ci(e){let t=Ur(e);return new Ni(si(t,{}),t.getAttribute(`viewBox`)?.trim().split(` `).map(e=>Number(e)))}var li=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[]}reverse(){let e=this.getControlPointRefs(),t=e.length,n=e.map(e=>e.clone());for(let r=0;r<t;r++)e[r].copyFrom(n[t-1-r]);return this.invalidate(),this}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)}getPosTan(e){let t=this.getLength(),n=t>0?Math.min(Math.max(e/t,0),1):0,r=this.getUToTMapping(n),i=this.getTangent(r);return{position:this.getPoint(r),tangent:i,angle:Math.atan2(i.y,i.x)}}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 Kn(e,this._getCachedAdaptiveVertices(),t.fillRule)}isPointInStroke(e,t={}){let{strokeWidth:n=1,tolerance:r=0,closed:i=!1}=t;return Jn(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 tr(this.getFillVertices(e),e)}isClosed(){let e=this._getCachedAdaptiveVertices(),t=e.length;if(t<6)return!1;let n=1e-4;return Math.abs(e[0]-e[t-2])<n&&Math.abs(e[1]-e[t-1])<n}strokeTriangulate(e){return Er(this.getAdaptiveVertices(),{...e,closed:e?.closed??this.isClosed()})}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 Lr(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)}},ui=new jr,di=new jr,fi=new jr,pi=new U,mi=class extends li{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}isClosed(){return Math.abs(this.endAngle-this.startAngle)>=Math.PI*2-1e-9||super.isClosed()}reverse(){let{startAngle:e,endAngle:t}=this;return this.startAngle=t,this.endAngle=e,this.clockwise=!this.clockwise,this.invalidate(),this}_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=pi,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++)hi(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 pi.set(this.cx,this.cy),e.apply(pi,pi),this.cx=pi.x,this.cy=pi.y,yi(e)?gi(this,e):_i(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=[]){let t=Math.PI*2;if(this.startAngle===0&&this.endAngle===t)return this._getAdaptiveVerticesByCircle(e);if(Math.abs(this.endAngle-this.startAngle)>=t-1e-9){let t=this._getAdaptiveVerticesByCircle([]),n=t.length/2;if(this.endAngle>this.startAngle)for(let n=0;n<t.length;n++)e.push(t[n]);else{e.push(t[0],t[1]);for(let r=n-1;r>=1;r--)e.push(t[r*2],t[r*2+1])}return e}return 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 hi(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 gi(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=ui.set(c,l,u,d,0,0),{a:p,b:m,c:h,d:g}=di.copyFrom(f).affineInvert(),_=bi(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=di.set(v,0,0,y,0,0),r=fi.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),vi(t)&&(e.clockwise=!e.clockwise)}}function _i(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,vi(t)&&(e.startAngle*=-1,e.endAngle*=-1,e.clockwise=!e.clockwise)}function vi(e){return e.a*e.d-e.c*e.b<0}function yi(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 bi(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 xi=class extends mi{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}},Si=class e extends li{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]}reverse(){let{p1:e,p2:t}=this;return this.p1=t,this.p2=e,this.invalidate(),this}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}},Ci=class e extends li{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}isClosed(){return this.curves.length===1?this.curves[0].isClosed():super.isClosed()}strokeTriangulate(e){return this.curves.length===1?this.curves[0].strokeTriangulate(e):super.strokeTriangulate(e)}reverse(){return this.curves.reverse(),this.curves.forEach(e=>e.reverse()),this.invalidate(),this}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 Si?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}},wi=class e extends li{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(Vn(e,n.x,r.x,i.x,a.x),Vn(e,n.y,r.y,i.y,a.y))}getAdaptiveVertices(e=[]){return ar(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]}reverse(){let{p1:e,cp1:t,cp2:n,p2:r}=this;return this.p1=r,this.cp1=n,this.cp2=t,this.p2=e,this.invalidate(),this}_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}},Ti=class extends mi{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}},Ei=class extends Ci{},Di=class e extends li{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(xr(e,n.x,r.x,i.x),xr(e,n.y,r.y,i.y)),t}getControlPointRefs(){return[this.p1,this.cp,this.p2]}reverse(){let{p1:e,p2:t}=this;return this.p1=t,this.p2=e,this.invalidate(),this}getAdaptiveVertices(e=[]){return ur(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(xr(o,n.x,r.x,i.x)),s!==null&&l.push(xr(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}},Oi=class extends Ei{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 Si(i[0],i[1]),new Si(i[1],i[2]),new Si(i[2],i[3]),new Si(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}},ki=class extends Ci{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=[Si.from(a,l,c,l),Si.from(c,l,c,f),Si.from(c,f,a,f),Si.from(a,f,a,l)];else{let e=Math.PI/2;this.curves=[Si.from(o,l,s,l),new xi(s,u,i,-e,0,!0),Si.from(c,u,c,d),new xi(s,d,i,0,e,!0),Si.from(s,f,o,f),new xi(o,d,i,e,Math.PI,!0),Si.from(a,d,a,u),new xi(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}},Ai=class extends li{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(Dn(a,o.x,s.x,c.x,l.x),Dn(a,o.y,s.y,c.y,l.y)),t}getControlPointRefs(){return this.points}reverse(){return this.points.reverse(),this.invalidate(),this}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}},ji=class extends Ci{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 Ir(e,this),this}addData(e){return this.addCommands(zr(e)),this}isClosed(){return this.autoClose||super.isClosed()}reverse(){return super.reverse(),this.curves.length&&(this.startPoint=this.getPoint(0),this.currentPoint=this.getPoint(1)),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 Jn(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 Si(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(Si.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(wi.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(Di.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 xi(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 Ti(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 Oi(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 ki(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 Ai([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}},Mi=class e extends Ci{_meta;_ringsCache;_ringsCacheLen=-1;currentCurve=new ji;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 ji().moveTo(e.x,e.y),this.curves.push(this.currentCurve)),this}moveTo(e,t){return this.currentCurve.curves.length&&(this.currentCurve=new ji,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 ji,this.curves=[this.currentCurve],this.style={},this}addCommands(e){return Ir(e,this),this}addData(e){return this.addCommands(zr(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=An(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 qn(e,this._getRings(),n)}static fromRings(t,n={}){let r=new e(void 0,n);for(let e of t){if(e.length<6)continue;let t=e.length;e[0]===e[t-2]&&e[1]===e[t-1]&&(t-=2),r.moveTo(e[0],e[1]);for(let n=2;n<t;n+=2)r.lineTo(e[n],e[n+1]);r.closePath()}return r}booleanOp(t,n,r){let i=En(t,this._getRings(),n._getRings());return e.fromRings(i,{...this.style,...r})}union(e,t){return this.booleanOp(`union`,e,t)}intersection(e,t){return this.booleanOp(`intersection`,e,t)}difference(e,t){return this.booleanOp(`difference`,e,t)}xor(e,t){return this.booleanOp(`xor`,e,t)}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((e?.fillRule??t.style.fillRule??`nonzero`)===`nonzero`){let i=this.curves.map(e=>e.getFillVertices(t)),a=_r(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]))}tr(l,{...e,indices:n,vertices:r,holes:u,style:{...this.style}})}}else{let i=this.curves.map(e=>e.getFillVertices(t)),a=Qn(i),o=a.length;for(let t=0;t<o;t++){let s=i[t];if((a[t].depth&1)==1||!s.length)continue;let c=s.slice(),l=[];for(let e=0;e<o;e++)a[e].parentIndex===t&&(a[e].depth&1)==1&&(l.push(c.length/2),c.push(...i[e]));tr(c,{...e,indices:n,vertices:r,holes:l,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`,fillRule:i=`nonzero`}=t;return e.beginPath(),e.save(),Sn(e,t),this.curves.forEach(t=>{t.drawTo(e)}),n!==`none`&&e.fill(i),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(),Sn(e,t),this.getControlPointRefs().forEach(t=>{bn(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[kn(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}},Ni=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,forceStroke:r=!1,tolerance:i,fillRule:a}=t;for(let t=this.paths.length-1;t>=0;t--){let o=this.paths[t];if((o.style.fill??`#000`)!==`none`&&o.isPointInFill(e,{fillRule:a})||n&&(r||(o.style.stroke??`none`)!==`none`)&&o.isPointInStroke(e,{tolerance:i}))return o}}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
5
  points="${t.join(`,`)} ${r.join(`,`)} ${i.join(`,`)}"
5
6
  stroke="#28a745"
6
7
  stroke-width="#stroke-width"
@@ -27,10 +28,10 @@ ${t}`);return n.documentElement}else return e}var nr=`px`,rr=90,ir=[`mm`,`cm`,`i
27
28
  xmlns="http://www.w3.org/2000/svg"
28
29
  >
29
30
  ${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 Kr(){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 qr(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=tr(i);r={dom:e,pathSet:br(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 Gr}}}return r}return{parsed:t,parse:n}}function Jr(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}=Yr(r??`center`,o,s,c,l),f=new Un;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Yr(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 Xr(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 Qr(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>$r(e[n],t[n]))}function $r(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Qr(e,t):e===t:!1}var ei=class{text;context;pixelRatio=window?.devicePixelRatio||1;region;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,n=this.text.boundingBox,r=this.region,i=n.left+(r?.x??0),a=n.top+(r?.y??0),o=r?.width??n.width,s=r?.height??n.height,c=t.canvas;c.dataset.viewBox=String(`${i} ${a} ${o} ${s}`),c.dataset.pixelRatio=String(e),c.width=Math.max(1,Math.ceil(o*e)),c.height=Math.max(1,Math.ceil(s*e)),c.style.width=`${o}px`,c.style.height=`${s}px`,t.clearRect(0,0,c.width,c.height),t.scale(e,e),t.translate(-i,-a)};_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`&&ye(e)&&(e=be(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;if(![n,r,i,a,o].every(Number.isFinite))return s?.find(e=>e?.color)?.color??`transparent`;let 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){let t=Number.isFinite(e.offset)?Math.min(1,Math.max(0,e.offset)):0;try{v.addColorStop(t,e.color)}catch{}}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{...j(n),...j(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}=Jr(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(),qt(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())}},ti={},ni=(function(e,t,n,r,i){var a=new Worker(ti[t]||(ti[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}),ri=Uint8Array,ii=Uint16Array,ai=Int32Array,oi=new ri([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]),si=new ri([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]),ci=new ri([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),li=function(e,t){for(var n=new ii(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ai(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}},ui=li(oi,2),di=ui.b,fi=ui.r;di[28]=258,fi[258]=28;for(var pi=li(si,0),mi=pi.b,hi=pi.r,gi=new ii(32768),q=0;q<32768;++q){var _i=(q&43690)>>1|(q&21845)<<1;_i=(_i&52428)>>2|(_i&13107)<<2,_i=(_i&61680)>>4|(_i&3855)<<4,gi[q]=((_i&65280)>>8|(_i&255)<<8)>>1}for(var vi=(function(e,t,n){for(var r=e.length,i=0,a=new ii(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new ii(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new ii(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[gi[d]>>c]=l}else for(s=new ii(r),i=0;i<r;++i)e[i]&&(s[i]=gi[o[e[i]-1]++]>>15-e[i]);return s}),yi=new ri(288),q=0;q<144;++q)yi[q]=8;for(var q=144;q<256;++q)yi[q]=9;for(var q=256;q<280;++q)yi[q]=7;for(var q=280;q<288;++q)yi[q]=8;for(var bi=new ri(32),q=0;q<32;++q)bi[q]=5;var xi=vi(yi,9,0),Si=vi(yi,9,1),Ci=vi(bi,5,0),wi=vi(bi,5,1),Ti=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ei=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Di=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Oi=function(e){return(e+7)/8|0},ki=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ri(e.subarray(t,n))},Ai=[`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`],ji=function(e,t,n){var r=Error(t||Ai[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ji),!n)throw r;return r},Mi=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new ri(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new ri(i*3));var l=function(e){var t=n.length;if(e>t){var r=new ri(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=Ei(e,d,1);var v=Ei(e,d+1,3);if(d+=3,!v){var y=Oi(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&ji(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=Si,m=wi,h=9,g=5;else if(v==2){var S=Ei(e,d,31)+257,C=Ei(e,d+10,15)+4,w=S+Ei(e,d+5,31)+1;d+=14;for(var T=new ri(w),E=new ri(19),D=0;D<C;++D)E[ci[D]]=Ei(e,d+D*3,7);d+=C*3;for(var O=Ti(E),k=(1<<O)-1,A=vi(E,O,1),D=0;D<w;){var j=A[Ei(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+Ei(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+Ei(e,d,7),d+=3):y==18&&(N=11+Ei(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=Ti(P),g=Ti(F),p=vi(P,h,1),m=vi(F,g,1)}else ji(1);if(d>_){c&&ji(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[Di(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&ji(0);break}if(M||ji(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=oi[D];B=Ei(e,d,(1<<V)-1)+di[D],d+=V}var ee=m[Di(e,d)&L],te=ee>>4;ee||ji(3),d+=ee&15;var F=mi[te];if(te>3){var V=si[te];F+=Di(e,d)&(1<<V)-1,d+=V}if(d>_){c&&ji(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&&ji(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?ki(n,0,f):n.subarray(0,f)},Ni=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Pi=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},Fi=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:Hi,l:0};if(i==1){var o=new ri(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 ii(f+1),m=Ii(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 ri(p),l:m}},Ii=function(e,t,n){return e.s==-1?Math.max(Ii(e.l,t,n+1),Ii(e.r,t,n+1)):t[e.s]=n},Li=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ii(++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}},Ri=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},zi=function(e,t,n){var r=n.length,i=Oi(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},Bi=function(e,t,n,r,i,a,o,s,c,l,u){Ni(t,u++,n),++i[256];for(var d=Fi(i,15),f=d.t,p=d.l,m=Fi(a,15),h=m.t,g=m.l,_=Li(f),v=_.c,y=_.n,b=Li(h),x=b.c,S=b.n,C=new ii(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=Fi(C,7),E=T.t,D=T.l,O=19;O>4&&!E[ci[O-1]];--O);var k=l+5<<3,A=Ri(i,yi)+Ri(a,bi)+o,j=Ri(i,f)+Ri(a,h)+o+14+3*O+Ri(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return zi(t,u,e.subarray(c,c+l));var M,N,P,F;if(Ni(t,u,1+(j<A)),u+=2,j<A){M=vi(f,p,0),N=f,P=vi(h,g,0),F=h;var I=vi(E,D,0);Ni(t,u,y-257),Ni(t,u+5,S-1),Ni(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)Ni(t,u+3*w,E[ci[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;Ni(t,u,I[B]),u+=E[B],B>15&&(Ni(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=xi,N=yi,P=Ci,F=bi;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;Pi(t,u,M[B+257]),u+=N[B+257],B>7&&(Ni(t,u,V>>23&31),u+=oi[B]);var ee=V&31;Pi(t,u,P[ee]),u+=F[ee],ee>3&&(Pi(t,u,V>>5&8191),u+=si[ee])}else Pi(t,u,M[V]),u+=N[V]}return Pi(t,u,M[256]),u+N[256]},Vi=new ai([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hi=new ri(0),Ui=function(e,t,n,r,i,a){var o=a.z||e.length,s=new ri(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=Vi[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new ii(32768),g=a.h||new ii(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new ai(25e3),x=new ii(288),S=new ii(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=Bi(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|fi[P]<<18|hi[F];var ie=fi[P]&31,ae=hi[F]&31;w+=oi[ie]+si[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=Bi(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=zi(c,u+1,e.subarray(T,oe))}a.i=o}return ki(s,0,r+Oi(u)+i)},Wi=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}}},Gi=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new ri(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Ui(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)},Ki=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},qi=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},Ji=[],Yi=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},Xi=function(e,t,n,r){if(!Ji[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=qi(e[s],i,a);Ji[n]={c:qi(e[o],i,a),e:a}}var c=Ki({},Ji[n].e);return ni(Ji[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,Yi(c),r)},Zi=function(){return[ri,ii,ai,oi,si,ci,di,mi,Si,wi,gi,Ai,vi,Ti,Ei,Di,Oi,ki,ji,Mi,ca,ta,na]},Qi=function(){return[ri,ii,ai,oi,si,ci,fi,hi,xi,yi,Ci,bi,gi,Vi,Hi,vi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Oi,ki,Ui,Gi,sa,ta]},$i=function(){return[aa,ia,Wi]},ea=function(){return[oa]},ta=function(e){return postMessage(e,[e.buffer])},na=function(e){return e&&{out:e.size&&new ri(e.size),dictionary:e.dictionary}},ra=function(e,t,n,r,i,a){var o=Xi(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},ia=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},aa=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=Wi();i.p(t.dictionary),ia(e,2,i.d())}},oa=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&ji(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&ji(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function sa(e,t){return Gi(e,t||{},0,0)}function ca(e,t){return Mi(e,{i:2},t&&t.out,t&&t.dictionary)}function la(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ji(7),ra(e,t,[Qi,$i,function(){return[ua]}],function(e){return ta(ua(e.data[0],e.data[1]))},4,n)}function ua(e,t){t||={};var n=Wi();n.p(e);var r=Gi(e,t,t.dictionary?6:2,4);return aa(r,t),ia(r,r.length-4,n.d()),r}function da(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ji(7),ra(e,t,[Zi,ea,function(){return[fa]}],function(e){return ta(fa(e.data[0],na(e.data[1])))},5,n)}function fa(e,t){return Mi(e.subarray(oa(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var pa=typeof TextDecoder<`u`&&new TextDecoder;try{pa.decode(Hi,{stream:!0})}catch{}var ma=`modern-font`;function ha(e,t){if(!e)throw Error(`[${ma}] ${t}`)}function ga(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 _a(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function va(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 ya(e){e=va(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 ba(e){return new TextDecoder().decode(Uint8Array.from(e))}function xa(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 Sa={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},Ca=class extends DataView{constructor(e,t,n,r){super(ga(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+=Sa[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+=Sa[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=_a(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}},wa=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=wa.get(e);a||(a={columns:[],byteLength:0},wa.set(e,a));let o={...t,name:i,byteLength:n*Sa[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+Sa[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 Ta=class{view;constructor(e,t,n,r){this.view=new Ca(e,t,n,r)}},Ea=class extends Ta{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)}},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 e extends Ea{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=ya(r.fontFamily||``),a=i.length,o=ya(r.fontSubFamily||``),s=o.length,c=ya(r.version||``),l=c.length,u=ya(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}};Oa([J(`uint32`)],ka.prototype,`EOTSize`),Oa([J(`uint32`)],ka.prototype,`FontDataSize`),Oa([J(`uint32`)],ka.prototype,`Version`),Oa([J(`uint32`)],ka.prototype,`Flags`),Oa([J({type:`uint8`,size:10})],ka.prototype,`FontPANOSE`),Oa([J(`uint8`)],ka.prototype,`Charset`),Oa([J(`uint8`)],ka.prototype,`Italic`),Oa([J(`uint32`)],ka.prototype,`Weight`),Oa([J(`uint16`)],ka.prototype,`fsType`),Oa([J(`uint16`)],ka.prototype,`MagicNumber`),Oa([J({type:`uint32`,size:4})],ka.prototype,`UnicodeRange`),Oa([J({type:`uint8`,size:8})],ka.prototype,`CodePageRange`),Oa([J(`uint32`)],ka.prototype,`CheckSumAdjustment`),Oa([J({type:`uint8`,size:16})],ka.prototype,`Reserved`),Oa([J(`uint16`)],ka.prototype,`Padding1`);var Aa=Object.defineProperty,ja=(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&&Aa(t,n,i),i},Ma=class extends Ta{constructor(e,t){super(e,t,16)}};ja([J({type:`char`,size:4})],Ma.prototype,`tag`),ja([J(`uint32`)],Ma.prototype,`checkSum`),ja([J(`uint32`)],Ma.prototype,`offset`),ja([J(`uint32`)],Ma.prototype,`length`);var Na=`................................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(`.`),Pa=`................................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(`.`),Fa=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 Ia(this.getPathCommands(e,t,n,r,i),a)}};function Ia(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 La=class extends Fa{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=Na[h.pop()],i=Na[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)}},Ra=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}},za=class extends Ra{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new La({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},Ba=Object.defineProperty,Va=(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&&Ba(t,n,i),i},Ha=class extends Ta{_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)}};Va([J(`uint16`)],Ha.prototype,`count`),Va([J(`uint8`)],Ha.prototype,`offsetSize`);var Ua=class extends Ha{_isString=!1},Wa=class extends Ha{_isString=!0},Ga=`.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(`,`),Ka=`.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(`,`),qa=`.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(`,`),Ja=`.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 Ya(e,t){return t<=390?Ga[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 Xa=class extends Ta{_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?Ya(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},Za=Object.defineProperty,Qa=(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},$a=class extends Xa{};Qa([Y(19)],$a.prototype,`subrs`),Qa([Y(20)],$a.prototype,`defaultWidthX`),Qa([Y(21)],$a.prototype,`nominalWidthX`);var eo=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&&eo(t,n,i),i},Z=class extends Xa{};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 to(e,t=e){return n=>{no.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(no.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var no=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 Ia(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}},ro=class extends Ta{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},io=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,oo=(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&&io(t,n,i),i},so=class extends ro{_glyphs;get glyphs(){return this._glyphs??=new za(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 Wa(e,n),this.topDictIndex=new Ua(e,this.nameIndex.endOffset),this.stringIndex=new Wa(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Ua(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 $a(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Ua(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new Ua(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Ka:this.topDict.charset===1?this.charset=qa:this.topDict.charset===2?this.charset=Ja:this.charset=this._readCharset(t+this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=Na:this.topDict.encoding===1?this.encoding=Pa: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(Ya(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(Ya(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(Ya(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}};oo([J(`uint8`)],so.prototype,`majorVersion`,2),oo([J(`uint8`)],so.prototype,`minorVersion`,2),oo([J(`uint8`)],so.prototype,`headerSize`,2),oo([J(`uint8`)],so.prototype,`offsetSize`,2),so=oo([to(`CFF `,`cff`)],so);var co=Object.defineProperty,lo=(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&&co(t,n,i),i},uo=class e extends Ta{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}};lo([J(`uint16`)],uo.prototype,`format`),lo([J(`uint16`)],uo.prototype,`length`),lo([J(`uint16`)],uo.prototype,`language`),lo([J({type:`uint8`,size:256})],uo.prototype,`glyphIndexArray`);var fo=uo,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 extends Ta{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}};mo([J(`uint16`)],ho.prototype,`format`),mo([J(`uint16`)],ho.prototype,`length`),mo([J(`uint16`)],ho.prototype,`language`);function go(e){return e>32767?e-65536:e<-32767?e+65536:e}function _o(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:go(e-a)}):(i.start=Number(a),i.startId=e,i.delta=go(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var vo=Object.defineProperty,yo=(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&&vo(t,n,i),i},bo=class e extends Ta{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=_o(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}};yo([J(`uint16`)],bo.prototype,`format`),yo([J(`uint16`)],bo.prototype,`length`),yo([J(`uint16`)],bo.prototype,`language`),yo([J(`uint16`)],bo.prototype,`segCountX2`),yo([J(`uint16`)],bo.prototype,`searchRange`),yo([J(`uint16`)],bo.prototype,`entrySelector`),yo([J(`uint16`)],bo.prototype,`rangeShift`);var xo=bo,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 extends Ta{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}};Co([J(`uint16`)],wo.prototype,`format`),Co([J(`uint16`)],wo.prototype,`length`),Co([J(`uint16`)],wo.prototype,`language`),Co([J(`uint16`)],wo.prototype,`firstCode`),Co([J(`uint16`)],wo.prototype,`entryCount`);var To=Object.defineProperty,Eo=(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&&To(t,n,i),i},Do=class e extends Ta{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=_o(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}};Eo([J(`uint16`)],Do.prototype,`format`),Eo([J(`uint16`)],Do.prototype,`reserved`),Eo([J(`uint32`)],Do.prototype,`length`),Eo([J(`uint32`)],Do.prototype,`language`),Eo([J(`uint32`)],Do.prototype,`nGroups`);var Oo=Do,ko=Object.defineProperty,Ao=(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&&ko(t,n,i),i},jo=class extends Ta{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}};Ao([J(`uint16`)],jo.prototype,`format`),Ao([J(`uint32`)],jo.prototype,`length`),Ao([J(`uint32`)],jo.prototype,`numVarSelectorRecords`);var Mo=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Po=(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&&Mo(t,n,i),i},Fo=class extends ro{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=xo.from(e),r=fo.from(e),i=t?Oo.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 Fo(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 fo(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new ho(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new xo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new wo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new Oo(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new jo(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()??[]])}};Po([J(`uint16`)],Fo.prototype,`version`,2),Po([J(`uint16`)],Fo.prototype,`numberSubtables`,2),Fo=Po([to(`cmap`)],Fo);var Io=class extends Fa{_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 ha(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();ha(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;ha(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(ha(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{ha(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}},Lo=class extends Ra{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new Io({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Ro=Object.getOwnPropertyDescriptor,zo=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ro(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Bo=class extends ro{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Bo(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new Lo(this._sfnt)}};Bo=zo([to(`glyf`)],Bo);function Vo(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function Ho(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(Vo(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 Uo(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 Wo(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 Go(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 Ko(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function qo(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 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 ro{_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=qo(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],Ho(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=Uo(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=Wo(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+Ko(a)+Ko(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=qo(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:Go(n,e+n.readUint16(e+8)),classDef2:Go(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Ko(a)+Ko(o),valueFormat1:a})}};Xo([J(`uint16`)],Zo.prototype,`majorVersion`,2),Xo([J(`uint16`)],Zo.prototype,`minorVersion`,2),Xo([J(`uint16`)],Zo.prototype,`scriptListOffset`,2),Xo([J(`uint16`)],Zo.prototype,`featureListOffset`,2),Xo([J(`uint16`)],Zo.prototype,`lookupListOffset`,2),Zo=Xo([to(`GPOS`,`gpos`)],Zo);var Qo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,es=(e,t,n,r)=>{for(var i=r>1?void 0:r?$o(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&&Qo(t,n,i),i},ts=class extends ro{_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}};es([J(`uint16`)],ts.prototype,`majorVersion`,2),es([J(`uint16`)],ts.prototype,`minorVersion`,2),es([J(`uint16`)],ts.prototype,`scriptListOffset`,2),es([J(`uint16`)],ts.prototype,`featureListOffset`,2),es([J(`uint16`)],ts.prototype,`lookupListOffset`,2),ts=es([to(`GSUB`,`gsub`)],ts);var ns=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(e,t,n,r)=>{for(var i=r>1?void 0:r?rs(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&&ns(t,n,i),i},as=class extends ro{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};is([J(`fixed`)],as.prototype,`version`,2),is([J(`fixed`)],as.prototype,`fontRevision`,2),is([J(`uint32`)],as.prototype,`checkSumAdjustment`,2),is([J(`uint32`)],as.prototype,`magickNumber`,2),is([J(`uint16`)],as.prototype,`flags`,2),is([J(`uint16`)],as.prototype,`unitsPerEm`,2),is([J({type:`longDateTime`})],as.prototype,`created`,2),is([J({type:`longDateTime`})],as.prototype,`modified`,2),is([J(`int16`)],as.prototype,`xMin`,2),is([J(`int16`)],as.prototype,`yMin`,2),is([J(`int16`)],as.prototype,`xMax`,2),is([J(`int16`)],as.prototype,`yMax`,2),is([J(`uint16`)],as.prototype,`macStyle`,2),is([J(`uint16`)],as.prototype,`lowestRecPPEM`,2),is([J(`int16`)],as.prototype,`fontDirectionHint`,2),is([J(`int16`)],as.prototype,`indexToLocFormat`,2),is([J(`int16`)],as.prototype,`glyphDataFormat`,2),as=is([to(`head`)],as);var os=Object.defineProperty,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=(r?o(t,n,i):o(i))||i);return r&&i&&os(t,n,i),i},ls=class extends ro{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};cs([J(`fixed`)],ls.prototype,`version`,2),cs([J(`int16`)],ls.prototype,`ascent`,2),cs([J(`int16`)],ls.prototype,`descent`,2),cs([J(`int16`)],ls.prototype,`lineGap`,2),cs([J(`uint16`)],ls.prototype,`advanceWidthMax`,2),cs([J(`int16`)],ls.prototype,`minLeftSideBearing`,2),cs([J(`int16`)],ls.prototype,`minRightSideBearing`,2),cs([J(`int16`)],ls.prototype,`xMaxExtent`,2),cs([J(`int16`)],ls.prototype,`caretSlopeRise`,2),cs([J(`int16`)],ls.prototype,`caretSlopeRun`,2),cs([J(`int16`)],ls.prototype,`caretOffset`,2),cs([J({type:`int16`,size:4})],ls.prototype,`reserved`,2),cs([J(`int16`)],ls.prototype,`metricDataFormat`,2),cs([J(`uint16`)],ls.prototype,`numOfLongHorMetrics`,2),ls=cs([to(`hhea`)],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 ro{static from(e){let t=e.length*4,n=new fs(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()}))}};fs=ds([to(`hmtx`)],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 ro{_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}};hs=ms([to(`kern`,`kern`)],hs);var gs=Object.getOwnPropertyDescriptor,_s=(e,t,n,r)=>{for(var i=r>1?void 0:r?gs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},vs=class extends ro{static from(e,t=1){let n=e.length*(t?4:2),r=new vs(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)}};vs=_s([to(`loca`)],vs);var ys=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,xs=(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},Ss=class extends ro{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};xs([J(`fixed`)],Ss.prototype,`version`,2),xs([J(`uint16`)],Ss.prototype,`numGlyphs`,2),xs([J(`uint16`)],Ss.prototype,`maxPoints`,2),xs([J(`uint16`)],Ss.prototype,`maxContours`,2),xs([J(`uint16`)],Ss.prototype,`maxComponentPoints`,2),xs([J(`uint16`)],Ss.prototype,`maxComponentContours`,2),xs([J(`uint16`)],Ss.prototype,`maxZones`,2),xs([J(`uint16`)],Ss.prototype,`maxTwilightPoints`,2),xs([J(`uint16`)],Ss.prototype,`maxStorage`,2),xs([J(`uint16`)],Ss.prototype,`maxFunctionDefs`,2),xs([J(`uint16`)],Ss.prototype,`maxInstructionDefs`,2),xs([J(`uint16`)],Ss.prototype,`maxStackElements`,2),xs([J(`uint16`)],Ss.prototype,`maxSizeOfInstructions`,2),xs([J(`uint16`)],Ss.prototype,`maxComponentElements`,2),xs([J(`uint16`)],Ss.prototype,`maxComponentDepth`,2),Ss=xs([to(`maxp`)],Ss);var Cs=Object.defineProperty,ws=Object.getOwnPropertyDescriptor,Ts=(e,t,n,r)=>{for(var i=r>1?void 0:r?ws(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&&Cs(t,n,i),i},Es={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`},Ds={Macintosh:1,Microsoft:3},Os={Default:0},ks={UCS2:1},As=class extends ro{_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=Ds.Macintosh,i=Os.Default,a=0;t.some(e=>e.platform===Ds.Microsoft&&e.encoding===ks.UCS2&&e.language===1033)&&(r=Ds.Microsoft,i=ks.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&&Es[e.nameId]&&(o[Es[e.nameId]]=a===0?ba(e.name):xa(e.name))}return o}};Ts([J(`uint16`)],As.prototype,`format`,2),Ts([J(`uint16`)],As.prototype,`count`,2),Ts([J(`uint16`)],As.prototype,`stringOffset`,2),As=Ts([to(`name`)],As);var js=Object.defineProperty,Ms=Object.getOwnPropertyDescriptor,Q=(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},$=class extends ro{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([to(`OS/2`,`os2`)],$);var Ns=`.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(`,`),Ps=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,Is=(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&&Ps(t,n,i),i},Ls=class extends ro{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return Ns.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?Ns[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};Is([J(`fixed`)],Ls.prototype,`format`,2),Is([J(`fixed`)],Ls.prototype,`italicAngle`,2),Is([J(`int16`)],Ls.prototype,`underlinePosition`,2),Is([J(`int16`)],Ls.prototype,`underlineThickness`,2),Is([J(`uint32`)],Ls.prototype,`isFixedPitch`,2),Is([J(`uint32`)],Ls.prototype,`minMemType42`,2),Is([J(`uint32`)],Ls.prototype,`maxMemType42`,2),Is([J(`uint32`)],Ls.prototype,`minMemType1`,2),Is([J(`uint32`)],Ls.prototype,`maxMemType1`,2),Ls=Is([to(`post`)],Ls);var Rs=Object.defineProperty,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=(r?o(t,n,i):o(i))||i);return r&&i&&Rs(t,n,i),i},Vs=class extends ro{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Bs([J(`fixed`)],Vs.prototype,`version`,2),Bs([J(`int16`)],Vs.prototype,`vertTypoAscender`,2),Bs([J(`int16`)],Vs.prototype,`vertTypoDescender`,2),Bs([J(`int16`)],Vs.prototype,`vertTypoLineGap`,2),Bs([J(`int16`)],Vs.prototype,`advanceHeightMax`,2),Bs([J(`int16`)],Vs.prototype,`minTopSideBearing`,2),Bs([J(`int16`)],Vs.prototype,`minBottomSideBearing`,2),Bs([J(`int16`)],Vs.prototype,`yMaxExtent`,2),Bs([J(`int16`)],Vs.prototype,`caretSlopeRise`,2),Bs([J(`int16`)],Vs.prototype,`caretSlopeRun`,2),Bs([J(`int16`)],Vs.prototype,`caretOffset`,2),Bs([J({type:`int16`,size:4})],Vs.prototype,`reserved`,2),Bs([J(`int16`)],Vs.prototype,`metricDataFormat`,2),Bs([J(`int16`)],Vs.prototype,`numOfLongVerMetrics`,2),Vs=Bs([to(`vhea`)],Vs);var Hs=Object.getOwnPropertyDescriptor,Us=(e,t,n,r)=>{for(var i=r>1?void 0:r?Hs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Ws=class extends ro{static from(e){let t=e.length*4,n=new Ws(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()}))}};Ws=Us([to(`vmtx`)],Ws);var Gs=Object.defineProperty,Ks=(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&&Gs(t,n,i),i},qs=class extends Ea{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(_a(e).getUint32(0))}static checksum(e){let t=_a(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 Ma(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new no(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Ks([J(`uint32`)],qs.prototype,`scalerType`),Ks([J(`uint16`)],qs.prototype,`numTables`),Ks([J(`uint16`)],qs.prototype,`searchRange`),Ks([J(`uint16`)],qs.prototype,`entrySelector`),Ks([J(`uint16`)],qs.prototype,`rangeShift`);var Js=class extends qs{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},Ys=class{static signature=1953784678;static is(e){let t=_a(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=_a(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 `)?Js.from(e):qs.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 no(i)}},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},Qs=class extends Ta{constructor(e,t){super(e,t,20)}};Zs([J({type:`char`,size:4})],Qs.prototype,`tag`),Zs([J(`uint32`)],Qs.prototype,`offset`),Zs([J(`uint32`)],Qs.prototype,`compLength`),Zs([J(`uint32`)],Qs.prototype,`origLength`),Zs([J(`uint32`)],Qs.prototype,`origChecksum`);var $s=Object.defineProperty,ec=(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&&$s(t,n,i),i};function tc(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function nc(e){return new Promise((t,n)=>{la(e,(e,r)=>e?n(e):t(r))})}function rc(e){return new Promise((t,n)=>{da(e,(e,r)=>e?n(e):t(r))})}var ic=class e extends Ea{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return qs.is(this.flavor)?`TrueType`:Js.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(_a(e).getUint32(0))}static checkSum(e){let t=_a(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,_a(ua(tc(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,_a(await nc(tc(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 Qs(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=fa(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 no(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 rc(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new no(new Map(e))}};ec([J(`uint32`)],ic.prototype,`signature`),ec([J(`uint32`)],ic.prototype,`flavor`),ec([J(`uint32`)],ic.prototype,`length`),ec([J(`uint16`)],ic.prototype,`numTables`),ec([J(`uint16`)],ic.prototype,`reserved`),ec([J(`uint32`)],ic.prototype,`totalSFNTSize`),ec([J(`uint16`)],ic.prototype,`majorVersion`),ec([J(`uint16`)],ic.prototype,`minorVersion`),ec([J(`uint32`)],ic.prototype,`metaOffset`),ec([J(`uint32`)],ic.prototype,`metaLength`),ec([J(`uint32`)],ic.prototype,`metaOrigLength`),ec([J(`uint32`)],ic.prototype,`privOffset`),ec([J(`uint32`)],ic.prototype,`privLength`);var ac=ic;function oc(e,t=!0){if(qs.is(e))return new qs(e);if(Js.is(e))return new Js(e);if(ac.is(e))return new ac(e);if(Ys.is(e)){let t=new Ys(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function sc(e,t=!0){let n=oc(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var cc=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
+ </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 Pi(){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 Fi(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=Ur(i);r={dom:e,pathSet:ci(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 Ni}}}return r}return{parsed:t,parse:n}}function Ii(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}=Li(r??`center`,o,s,c,l),f=new jr;return n&&(f.translate(u,d),f.prependCssTransform(n,{width:i,height:i}),f.translate(-u,-d)),f}function Li(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 Ri(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 zi(e){return L(e)?{}:e}function Bi(e,t){let n=Object.keys(e),r=Object.keys(t);return Array.from(new Set([...n,...r])).every(n=>Vi(e[n],t[n]))}function Vi(e,t){let n=typeof e;return n===typeof t?n&&n===`object`?Bi(e,t):e===t:!1}var Hi=class{text;context;pixelRatio=window?.devicePixelRatio||1;region;constructor(e,t){this.text=e,this.context=t}_setupView=()=>{let e=this.pixelRatio,t=this.context,n=this.text.boundingBox,r=this.region,i=n.left+(r?.x??0),a=n.top+(r?.y??0),o=r?.width??n.width,s=r?.height??n.height,c=t.canvas;c.dataset.viewBox=String(`${i} ${a} ${o} ${s}`),c.dataset.pixelRatio=String(e),c.width=Math.max(1,Math.ceil(o*e)),c.height=Math.max(1,Math.ceil(s*e)),c.style.width=`${o}px`,c.style.height=`${s}px`,t.clearRect(0,0,c.width,c.height),t.scale(e,e),t.translate(-i,-a)};_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`&&Oe(e)&&(e=ke(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;if(![n,r,i,a,o].every(Number.isFinite))return s?.find(e=>e?.color)?.color??`transparent`;let 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){let t=Number.isFinite(e.offset)?Math.min(1,Math.max(0,e.offset)):0;try{v.addColorStop(t,e.color)}catch{}}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{...B(n),...B(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}=Ii(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(),Sn(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())}},Ui={},Wi=(function(e,t,n,r,i){var a=new Worker(Ui[t]||(Ui[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}),Gi=Uint8Array,Ki=Uint16Array,qi=Int32Array,Ji=new Gi([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]),Yi=new Gi([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]),Xi=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zi=function(e,t){for(var n=new Ki(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new qi(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}},Qi=Zi(Ji,2),$i=Qi.b,ea=Qi.r;$i[28]=258,ea[258]=28;for(var ta=Zi(Yi,0),na=ta.b,ra=ta.r,ia=new Ki(32768),q=0;q<32768;++q){var aa=(q&43690)>>1|(q&21845)<<1;aa=(aa&52428)>>2|(aa&13107)<<2,aa=(aa&61680)>>4|(aa&3855)<<4,ia[q]=((aa&65280)>>8|(aa&255)<<8)>>1}for(var oa=(function(e,t,n){for(var r=e.length,i=0,a=new Ki(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Ki(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Ki(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[ia[d]>>c]=l}else for(s=new Ki(r),i=0;i<r;++i)e[i]&&(s[i]=ia[o[e[i]-1]++]>>15-e[i]);return s}),sa=new Gi(288),q=0;q<144;++q)sa[q]=8;for(var q=144;q<256;++q)sa[q]=9;for(var q=256;q<280;++q)sa[q]=7;for(var q=280;q<288;++q)sa[q]=8;for(var ca=new Gi(32),q=0;q<32;++q)ca[q]=5;var la=oa(sa,9,0),ua=oa(sa,9,1),da=oa(ca,5,0),fa=oa(ca,5,1),pa=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},ma=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},ha=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},ga=function(e){return(e+7)/8|0},_a=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Gi(e.subarray(t,n))},va=[`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`],ya=function(e,t,n){var r=Error(t||va[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ya),!n)throw r;return r},ba=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Gi(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Gi(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Gi(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=ma(e,d,1);var v=ma(e,d+1,3);if(d+=3,!v){var y=ga(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&ya(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=ua,m=fa,h=9,g=5;else if(v==2){var S=ma(e,d,31)+257,C=ma(e,d+10,15)+4,w=S+ma(e,d+5,31)+1;d+=14;for(var T=new Gi(w),E=new Gi(19),D=0;D<C;++D)E[Xi[D]]=ma(e,d+D*3,7);d+=C*3;for(var O=pa(E),k=(1<<O)-1,A=oa(E,O,1),D=0;D<w;){var j=A[ma(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+ma(e,d,3),d+=2,M=T[D-1]):y==17?(N=3+ma(e,d,7),d+=3):y==18&&(N=11+ma(e,d,127),d+=7);N--;)T[D++]=M}}var P=T.subarray(0,S),F=T.subarray(S);h=pa(P),g=pa(F),p=oa(P,h,1),m=oa(F,g,1)}else ya(1);if(d>_){c&&ya(0);break}}s&&l(f+131072);for(var I=(1<<h)-1,L=(1<<g)-1,R=d;;R=d){var M=p[ha(e,d)&I],z=M>>4;if(d+=M&15,d>_){c&&ya(0);break}if(M||ya(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=Ji[D];B=ma(e,d,(1<<V)-1)+$i[D],d+=V}var ee=m[ha(e,d)&L],te=ee>>4;ee||ya(3),d+=ee&15;var F=na[te];if(te>3){var V=Yi[te];F+=ha(e,d)&(1<<V)-1,d+=V}if(d>_){c&&ya(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&&ya(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?_a(n,0,f):n.subarray(0,f)},xa=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},Sa=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},Ca=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:Aa,l:0};if(i==1){var o=new Gi(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 Ki(f+1),m=wa(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 Gi(p),l:m}},wa=function(e,t,n){return e.s==-1?Math.max(wa(e.l,t,n+1),wa(e.r,t,n+1)):t[e.s]=n},Ta=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ki(++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}},Ea=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Da=function(e,t,n){var r=n.length,i=ga(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},Oa=function(e,t,n,r,i,a,o,s,c,l,u){xa(t,u++,n),++i[256];for(var d=Ca(i,15),f=d.t,p=d.l,m=Ca(a,15),h=m.t,g=m.l,_=Ta(f),v=_.c,y=_.n,b=Ta(h),x=b.c,S=b.n,C=new Ki(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=Ca(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Xi[O-1]];--O);var k=l+5<<3,A=Ea(i,sa)+Ea(a,ca)+o,j=Ea(i,f)+Ea(a,h)+o+14+3*O+Ea(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=j)return Da(t,u,e.subarray(c,c+l));var M,N,P,F;if(xa(t,u,1+(j<A)),u+=2,j<A){M=oa(f,p,0),N=f,P=oa(h,g,0),F=h;var I=oa(E,D,0);xa(t,u,y-257),xa(t,u+5,S-1),xa(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)xa(t,u+3*w,E[Xi[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;xa(t,u,I[B]),u+=E[B],B>15&&(xa(t,u,z[w]>>5&127),u+=z[w]>>12)}}else M=la,N=sa,P=da,F=ca;for(var w=0;w<s;++w){var V=r[w];if(V>255){var B=V>>18&31;Sa(t,u,M[B+257]),u+=N[B+257],B>7&&(xa(t,u,V>>23&31),u+=Ji[B]);var ee=V&31;Sa(t,u,P[ee]),u+=F[ee],ee>3&&(Sa(t,u,V>>5&8191),u+=Yi[ee])}else Sa(t,u,M[V]),u+=N[V]}return Sa(t,u,M[256]),u+N[256]},ka=new qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Aa=new Gi(0),ja=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Gi(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=ka[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Ki(32768),g=a.h||new Ki(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new qi(25e3),x=new Ki(288),S=new Ki(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=Oa(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|ea[P]<<18|ra[F];var ie=ea[P]&31,ae=ra[F]&31;w+=Ji[ie]+Yi[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=Oa(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=Da(c,u+1,e.subarray(T,oe))}a.i=o}return _a(s,0,r+ga(u)+i)},Ma=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}}},Na=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Gi(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return ja(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)},Pa=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},Fa=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},Ia=[],La=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},Ra=function(e,t,n,r){if(!Ia[n]){for(var i=``,a={},o=e.length-1,s=0;s<o;++s)i=Fa(e[s],i,a);Ia[n]={c:Fa(e[o],i,a),e:a}}var c=Pa({},Ia[n].e);return Wi(Ia[n].c+`;onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=`+t.toString()+`}`,n,c,La(c),r)},za=function(){return[Gi,Ki,qi,Ji,Yi,Xi,$i,na,ua,fa,ia,va,oa,pa,ma,ha,ga,_a,ya,ba,Xa,Ua,Wa]},Ba=function(){return[Gi,Ki,qi,Ji,Yi,Xi,ea,ra,la,sa,da,ca,ia,ka,Aa,oa,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ga,_a,ja,Na,Ya,Ua]},Va=function(){return[qa,Ka,Ma]},Ha=function(){return[Ja]},Ua=function(e){return postMessage(e,[e.buffer])},Wa=function(e){return e&&{out:e.size&&new Gi(e.size),dictionary:e.dictionary}},Ga=function(e,t,n,r,i,a){var o=Ra(n,r,i,function(e,t){o.terminate(),a(e,t)});return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Ka=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},qa=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=Ma();i.p(t.dictionary),Ka(e,2,i.d())}},Ja=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&ya(6,`invalid zlib data`),(e[1]>>5&1)==+!t&&ya(6,`invalid zlib data: `+(e[1]&32?`need`:`unexpected`)+` dictionary`),(e[1]>>3&4)+2};function Ya(e,t){return Na(e,t||{},0,0)}function Xa(e,t){return ba(e,{i:2},t&&t.out,t&&t.dictionary)}function Za(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ya(7),Ga(e,t,[Ba,Va,function(){return[Qa]}],function(e){return Ua(Qa(e.data[0],e.data[1]))},4,n)}function Qa(e,t){t||={};var n=Ma();n.p(e);var r=Na(e,t,t.dictionary?6:2,4);return qa(r,t),Ka(r,r.length-4,n.d()),r}function $a(e,t,n){return n||(n=t,t={}),typeof n!=`function`&&ya(7),Ga(e,t,[za,Ha,function(){return[eo]}],function(e){return Ua(eo(e.data[0],Wa(e.data[1])))},5,n)}function eo(e,t){return ba(e.subarray(Ja(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var to=typeof TextDecoder<`u`&&new TextDecoder;try{to.decode(Aa,{stream:!0})}catch{}var no=`modern-font`;function ro(e,t){if(!e)throw Error(`[${no}] ${t}`)}function io(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 ao(e){return`buffer`in e?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e)}function oo(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 so(e){e=oo(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 co(e){return new TextDecoder().decode(Uint8Array.from(e))}function lo(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 uo={int8:1,int16:2,int32:4,uint8:1,uint16:2,uint32:4,float32:4,float64:8,fixed:4,longDateTime:8,char:1},fo=class extends DataView{constructor(e,t,n,r){super(io(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+=uo[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+=uo[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=ao(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}},po=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=po.get(e);a||(a={columns:[],byteLength:0},po.set(e,a));let o={...t,name:i,byteLength:n*uo[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+uo[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 mo=class{view;constructor(e,t,n,r){this.view=new fo(e,t,n,r)}},ho=class extends mo{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)}},go=Object.defineProperty,_o=(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&&go(t,n,i),i},vo=class e extends ho{format=`EmbeddedOpenType`;mimeType=`application/vnd.ms-fontobject`;static from(t){let n=t.sfnt,r=n.name.names,i=so(r.fontFamily||``),a=i.length,o=so(r.fontSubFamily||``),s=o.length,c=so(r.version||``),l=c.length,u=so(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}};_o([J(`uint32`)],vo.prototype,`EOTSize`),_o([J(`uint32`)],vo.prototype,`FontDataSize`),_o([J(`uint32`)],vo.prototype,`Version`),_o([J(`uint32`)],vo.prototype,`Flags`),_o([J({type:`uint8`,size:10})],vo.prototype,`FontPANOSE`),_o([J(`uint8`)],vo.prototype,`Charset`),_o([J(`uint8`)],vo.prototype,`Italic`),_o([J(`uint32`)],vo.prototype,`Weight`),_o([J(`uint16`)],vo.prototype,`fsType`),_o([J(`uint16`)],vo.prototype,`MagicNumber`),_o([J({type:`uint32`,size:4})],vo.prototype,`UnicodeRange`),_o([J({type:`uint8`,size:8})],vo.prototype,`CodePageRange`),_o([J(`uint32`)],vo.prototype,`CheckSumAdjustment`),_o([J({type:`uint8`,size:16})],vo.prototype,`Reserved`),_o([J(`uint16`)],vo.prototype,`Padding1`);var yo=`AAEAAAAKAIAAAwAgT1MvMl9CWIkAAACsAAAAYGNtYXAADAAmAAABDAAAACRnbHlmA74GaAAAATAAAAAkaGVhZGEnQtkAAAFUAAAANmhoZWEFegHiAAABjAAAACRobXR4AlgAUAAAAbAAAAAEbG9jYQAAABIAAAG0AAAABG1heHAAAwAGAAABuAAAACBuYW1lAu8GwwAAAdgAAAAucG9zdP+fADIAAAIIAAAAIAADAlgBkAAFAAACigK8AAAAAAKKArwAAAHgADIBLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABOT05FAEAAIP//AyD/OAAAAyAAyAAAAAAAAAAAAAACvAAAACAAAAAAAAEAAwABAAAADAAEABgAAAACAAIAAAAA//8AAP//AAEAAAABAFAAAAIIArwAAwAAAQEBAQBQAbgAAP5IAAAAAAK8AAAAAAABAAAAAQAACGtGkV8PPPUACwPoAAAAAAAAAAAAAAAAAAAAAAAA/zgCCAK8AAAACAACAAAAAAAAAAEAAAMg/zgAAAJYAFAAUAIIAAEAAAAAAAAAAAAAAAAAAAABAlgAUAAAABIAAQAAAAEABAABAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAEAEgADAAEECQABABwAAABNAG8AZABlAHIAbgBGAGEAbABsAGIAYQBjAGsAAAADAAAAAAAA/5wAMgAAAAAAAAAAAAAAAAAAAAAAAAAA`;function bo(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n.buffer}var xo=Object.defineProperty,So=(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&&xo(t,n,i),i},Co=class extends mo{constructor(e,t){super(e,t,16)}};So([J({type:`char`,size:4})],Co.prototype,`tag`),So([J(`uint32`)],Co.prototype,`checkSum`),So([J(`uint32`)],Co.prototype,`offset`),So([J(`uint32`)],Co.prototype,`length`);var wo=`................................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(`.`),To=`................................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(`.`),Eo=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 Do(this.getPathCommands(e,t,n,r,i),a)}};function Do(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 Oo=class extends Eo{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=wo[h.pop()],i=wo[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)}},ko=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}},Ao=class extends ko{get length(){return this._sfnt.cff.charStringsIndex.offsets.length-1}_get(e){let t=this._sfnt.cff,n=new Oo({index:e});return n.parse(t,t.charStringsIndex.get(e),this),n.name=t.charset[e],n}},jo=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&&jo(t,n,i),i},No=class extends mo{_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)}};Mo([J(`uint16`)],No.prototype,`count`),Mo([J(`uint8`)],No.prototype,`offsetSize`);var Po=class extends No{_isString=!1},Fo=class extends No{_isString=!0},Io=`.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(`,`),Lo=`.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(`,`),Ro=`.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(`,`),zo=`.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 Bo(e,t){return t<=390?Io[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 Vo=class extends mo{_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?Bo(this._stringIndex?.objects??[],t[0]):e.default;case`number[]`:return t??e.default}return t??e.default}_setProp(e,t){}},Ho=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&&Ho(t,n,i),i},Wo=class extends Vo{};Uo([Y(19)],Wo.prototype,`subrs`),Uo([Y(20)],Wo.prototype,`defaultWidthX`),Uo([Y(21)],Wo.prototype,`nominalWidthX`);var Go=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&&Go(t,n,i),i},Z=class extends Vo{};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 Ko(e,t=e){return n=>{qo.tableDefinitions.set(e,{tag:e,prop:t,class:n}),Object.defineProperty(qo.prototype,t,{get(){return this.get(e)},set(t){return this.set(e,t)},configurable:!0,enumerable:!0})}}var qo=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,i=r.indexOf(n[e.codePointAt(0)]);t=i>=0?i:void 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 Do(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}},Jo=class extends mo{setSFNT(e){return this._sfnt=e,this}getSFNT(){return this._sfnt}},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 Jo{_glyphs;get glyphs(){return this._glyphs??=new Ao(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 Fo(e,n),this.topDictIndex=new Po(e,this.nameIndex.endOffset),this.stringIndex=new Fo(e,this.topDictIndex.endOffset),this.globalSubrIndex=new Po(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 Wo(e,t+i,r).setStringIndex(this.stringIndex),this.privateDict.subrs&&(this.subrsIndex=new Po(e,t+i+this.privateDict.subrs))),this.charStringsIndex=new Po(e,t+this.topDict.charStrings);let a=this.charStringsIndex.offsets.length-1;this.topDict.charset===0?this.charset=Lo:this.topDict.charset===1?this.charset=Ro:this.topDict.charset===2?this.charset=zo:this.charset=this._readCharset(this.topDict.charset,a,this.stringIndex.objects),this.topDict.encoding===0?this.encoding=wo:this.topDict.encoding===1?this.encoding=To:this.encoding=this._readEncoding(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(Bo(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(Bo(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(Bo(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}};Zo([J(`uint8`)],Qo.prototype,`majorVersion`,2),Zo([J(`uint8`)],Qo.prototype,`minorVersion`,2),Zo([J(`uint8`)],Qo.prototype,`headerSize`,2),Zo([J(`uint8`)],Qo.prototype,`offsetSize`,2),Qo=Zo([Ko(`CFF `,`cff`)],Qo);var $o=Object.defineProperty,es=(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},ts=class e extends mo{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}};es([J(`uint16`)],ts.prototype,`format`),es([J(`uint16`)],ts.prototype,`length`),es([J(`uint16`)],ts.prototype,`language`),es([J({type:`uint8`,size:256})],ts.prototype,`glyphIndexArray`);var ns=ts,rs=Object.defineProperty,is=(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},as=class extends mo{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}};is([J(`uint16`)],as.prototype,`format`),is([J(`uint16`)],as.prototype,`length`),is([J(`uint16`)],as.prototype,`language`);function os(e){return e>32767?e-65536:e<-32767?e+65536:e}function ss(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:os(e-a)}):(i.start=Number(a),i.startId=e,i.delta=os(e-a))),n={unicode:a,glyphIndex:e})}),n&&(i.end=n.unicode,r.push(i)),r}var cs=Object.defineProperty,ls=(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&&cs(t,n,i),i},us=class e extends mo{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=ss(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}};ls([J(`uint16`)],us.prototype,`format`),ls([J(`uint16`)],us.prototype,`length`),ls([J(`uint16`)],us.prototype,`language`),ls([J(`uint16`)],us.prototype,`segCountX2`),ls([J(`uint16`)],us.prototype,`searchRange`),ls([J(`uint16`)],us.prototype,`entrySelector`),ls([J(`uint16`)],us.prototype,`rangeShift`);var ds=us,fs=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&&fs(t,n,i),i},ms=class extends mo{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}};ps([J(`uint16`)],ms.prototype,`format`),ps([J(`uint16`)],ms.prototype,`length`),ps([J(`uint16`)],ms.prototype,`language`),ps([J(`uint16`)],ms.prototype,`firstCode`),ps([J(`uint16`)],ms.prototype,`entryCount`);var hs=Object.defineProperty,gs=(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},_s=class e extends mo{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=ss(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}};gs([J(`uint16`)],_s.prototype,`format`),gs([J(`uint16`)],_s.prototype,`reserved`),gs([J(`uint32`)],_s.prototype,`length`),gs([J(`uint32`)],_s.prototype,`language`),gs([J(`uint32`)],_s.prototype,`nGroups`);var vs=_s,ys=Object.defineProperty,bs=(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&&ys(t,n,i),i},xs=class extends mo{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}};bs([J(`uint16`)],xs.prototype,`format`),bs([J(`uint32`)],xs.prototype,`length`),bs([J(`uint32`)],xs.prototype,`numVarSelectorRecords`);var 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 Jo{static from(e){let t=Array.from(e.keys()).some(e=>e>65535),n=ds.from(e),r=ns.from(e),i=t?vs.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 Ts(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 ns(this.view.buffer,this.view.byteOffset+e.offset);break;case 2:n=new as(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 4:n=new ds(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 6:n=new ms(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint16());break;case 12:n=new vs(this.view.buffer,this.view.byteOffset+e.offset,this.view.readUint32(e.offset+4));break;default:n=new xs(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()??[]])}};ws([J(`uint16`)],Ts.prototype,`version`,2),ws([J(`uint16`)],Ts.prototype,`numberSubtables`,2),Ts=ws([Ko(`cmap`)],Ts);var Es=class extends Eo{_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 ro(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();ro(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;ro(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(ro(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{ro(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}},Ds=class extends ko{get length(){return this._sfnt.loca.locations.length}_get(e){let t=this._sfnt.loca.locations,n=t[e],r=new Es({index:e});return n!==t[e+1]&&r.parse(this._sfnt.glyf,n,this),r}},Os=Object.getOwnPropertyDescriptor,ks=(e,t,n,r)=>{for(var i=r>1?void 0:r?Os(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},As=class extends Jo{static from(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new As(new ArrayBuffer(t));return e.forEach(e=>{n.view.writeBytes(e)}),n}_glyphs;get glyphs(){return this._glyphs??=new Ds(this._sfnt)}};As=ks([Ko(`glyf`)],As);function js(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function Ms(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(js(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 Ns(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 Ps(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 Fs(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 Is(e){let t=e,n=0;for(;t;)n+=t&1,t>>=1;return n*2}function Ls(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 Rs=Object.defineProperty,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=(r?o(t,n,i):o(i))||i);return r&&i&&Rs(t,n,i),i},Vs=class extends Jo{_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=Ls(this.view,a,n.valueFormat1);if(o)return o}return 0}_ensureKerning(){this._format1Pairs||(this._format1Pairs=new Map,this._classSubtables=[],Ms(this.view,this.featureListOffset,`kern`).forEach(e=>{let t=Ns(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=Ps(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+Is(a)+Is(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=Ls(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:Fs(n,e+n.readUint16(e+8)),classDef2:Fs(n,e+n.readUint16(e+10)),class2Count:n.readUint16(e+14),class1RecordsOffset:e+16,recordSize:Is(a)+Is(o),valueFormat1:a})}};Bs([J(`uint16`)],Vs.prototype,`majorVersion`,2),Bs([J(`uint16`)],Vs.prototype,`minorVersion`,2),Bs([J(`uint16`)],Vs.prototype,`scriptListOffset`,2),Bs([J(`uint16`)],Vs.prototype,`featureListOffset`,2),Bs([J(`uint16`)],Vs.prototype,`lookupListOffset`,2),Vs=Bs([Ko(`GPOS`,`gpos`)],Vs);var Hs=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,Ws=(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=(r?o(t,n,i):o(i))||i);return r&&i&&Hs(t,n,i),i},Gs=class extends Jo{_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}};Ws([J(`uint16`)],Gs.prototype,`majorVersion`,2),Ws([J(`uint16`)],Gs.prototype,`minorVersion`,2),Ws([J(`uint16`)],Gs.prototype,`scriptListOffset`,2),Ws([J(`uint16`)],Gs.prototype,`featureListOffset`,2),Ws([J(`uint16`)],Gs.prototype,`lookupListOffset`,2),Gs=Ws([Ko(`GSUB`,`gsub`)],Gs);var Ks=Object.defineProperty,qs=Object.getOwnPropertyDescriptor,Js=(e,t,n,r)=>{for(var i=r>1?void 0:r?qs(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&&Ks(t,n,i),i},Ys=class extends Jo{constructor(e=new ArrayBuffer(54),t){super(e,t,Math.min(54,e.byteLength-(t??0)))}};Js([J(`fixed`)],Ys.prototype,`version`,2),Js([J(`fixed`)],Ys.prototype,`fontRevision`,2),Js([J(`uint32`)],Ys.prototype,`checkSumAdjustment`,2),Js([J(`uint32`)],Ys.prototype,`magickNumber`,2),Js([J(`uint16`)],Ys.prototype,`flags`,2),Js([J(`uint16`)],Ys.prototype,`unitsPerEm`,2),Js([J({type:`longDateTime`})],Ys.prototype,`created`,2),Js([J({type:`longDateTime`})],Ys.prototype,`modified`,2),Js([J(`int16`)],Ys.prototype,`xMin`,2),Js([J(`int16`)],Ys.prototype,`yMin`,2),Js([J(`int16`)],Ys.prototype,`xMax`,2),Js([J(`int16`)],Ys.prototype,`yMax`,2),Js([J(`uint16`)],Ys.prototype,`macStyle`,2),Js([J(`uint16`)],Ys.prototype,`lowestRecPPEM`,2),Js([J(`int16`)],Ys.prototype,`fontDirectionHint`,2),Js([J(`int16`)],Ys.prototype,`indexToLocFormat`,2),Js([J(`int16`)],Ys.prototype,`glyphDataFormat`,2),Ys=Js([Ko(`head`)],Ys);var Xs=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,Qs=(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=(r?o(t,n,i):o(i))||i);return r&&i&&Xs(t,n,i),i},$s=class extends Jo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Qs([J(`fixed`)],$s.prototype,`version`,2),Qs([J(`int16`)],$s.prototype,`ascent`,2),Qs([J(`int16`)],$s.prototype,`descent`,2),Qs([J(`int16`)],$s.prototype,`lineGap`,2),Qs([J(`uint16`)],$s.prototype,`advanceWidthMax`,2),Qs([J(`int16`)],$s.prototype,`minLeftSideBearing`,2),Qs([J(`int16`)],$s.prototype,`minRightSideBearing`,2),Qs([J(`int16`)],$s.prototype,`xMaxExtent`,2),Qs([J(`int16`)],$s.prototype,`caretSlopeRise`,2),Qs([J(`int16`)],$s.prototype,`caretSlopeRun`,2),Qs([J(`int16`)],$s.prototype,`caretOffset`,2),Qs([J({type:`int16`,size:4})],$s.prototype,`reserved`,2),Qs([J(`int16`)],$s.prototype,`metricDataFormat`,2),Qs([J(`uint16`)],$s.prototype,`numOfLongHorMetrics`,2),$s=Qs([Ko(`hhea`)],$s);var ec=Object.getOwnPropertyDescriptor,tc=(e,t,n,r)=>{for(var i=r>1?void 0:r?ec(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},nc=class extends Jo{static from(e){let t=e.length*4,n=new nc(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()}))}};nc=tc([Ko(`hmtx`)],nc);var rc=Object.getOwnPropertyDescriptor,ic=(e,t,n,r)=>{for(var i=r>1?void 0:r?rc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},ac=class extends Jo{_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}};ac=ic([Ko(`kern`,`kern`)],ac);var oc=Object.getOwnPropertyDescriptor,sc=(e,t,n,r)=>{for(var i=r>1?void 0:r?oc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},cc=class extends Jo{static from(e,t=1){let n=e.length*(t?4:2),r=new cc(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)}};cc=sc([Ko(`loca`)],cc);var lc=Object.defineProperty,uc=Object.getOwnPropertyDescriptor,dc=(e,t,n,r)=>{for(var i=r>1?void 0:r?uc(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&&lc(t,n,i),i},fc=class extends Jo{constructor(e=new ArrayBuffer(32),t){super(e,t,Math.min(32,e.byteLength-(t??0)))}};dc([J(`fixed`)],fc.prototype,`version`,2),dc([J(`uint16`)],fc.prototype,`numGlyphs`,2),dc([J(`uint16`)],fc.prototype,`maxPoints`,2),dc([J(`uint16`)],fc.prototype,`maxContours`,2),dc([J(`uint16`)],fc.prototype,`maxComponentPoints`,2),dc([J(`uint16`)],fc.prototype,`maxComponentContours`,2),dc([J(`uint16`)],fc.prototype,`maxZones`,2),dc([J(`uint16`)],fc.prototype,`maxTwilightPoints`,2),dc([J(`uint16`)],fc.prototype,`maxStorage`,2),dc([J(`uint16`)],fc.prototype,`maxFunctionDefs`,2),dc([J(`uint16`)],fc.prototype,`maxInstructionDefs`,2),dc([J(`uint16`)],fc.prototype,`maxStackElements`,2),dc([J(`uint16`)],fc.prototype,`maxSizeOfInstructions`,2),dc([J(`uint16`)],fc.prototype,`maxComponentElements`,2),dc([J(`uint16`)],fc.prototype,`maxComponentDepth`,2),fc=dc([Ko(`maxp`)],fc);var pc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,hc=(e,t,n,r)=>{for(var i=r>1?void 0:r?mc(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&&pc(t,n,i),i},gc={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`},_c={Macintosh:1,Microsoft:3},vc={Default:0},yc={UCS2:1},bc=class extends Jo{_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=_c.Macintosh,i=vc.Default,a=0;t.some(e=>e.platform===_c.Microsoft&&e.encoding===yc.UCS2&&e.language===1033)&&(r=_c.Microsoft,i=yc.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&&gc[e.nameId]&&(o[gc[e.nameId]]=a===0?co(e.name):lo(e.name))}return o}};hc([J(`uint16`)],bc.prototype,`format`,2),hc([J(`uint16`)],bc.prototype,`count`,2),hc([J(`uint16`)],bc.prototype,`stringOffset`,2),bc=hc([Ko(`name`)],bc);var xc=Object.defineProperty,Sc=Object.getOwnPropertyDescriptor,Q=(e,t,n,r)=>{for(var i=r>1?void 0:r?Sc(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&&xc(t,n,i),i},$=class extends Jo{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([Ko(`OS/2`,`os2`)],$);var Cc=`.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(`,`),wc=Object.defineProperty,Tc=Object.getOwnPropertyDescriptor,Ec=(e,t,n,r)=>{for(var i=r>1?void 0:r?Tc(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&&wc(t,n,i),i},Dc=class extends Jo{_glyphNames;get glyphNames(){return this._glyphNames??=this._readGlyphNames()}getGlyphName(e){return this.glyphNames[e]}_readGlyphNames(){let e=this.format;if(e===1)return Cc.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?Cc[e]:i[e-258]??``)}constructor(e=new ArrayBuffer(32),t,n){super(e,t,n)}};Ec([J(`fixed`)],Dc.prototype,`format`,2),Ec([J(`fixed`)],Dc.prototype,`italicAngle`,2),Ec([J(`int16`)],Dc.prototype,`underlinePosition`,2),Ec([J(`int16`)],Dc.prototype,`underlineThickness`,2),Ec([J(`uint32`)],Dc.prototype,`isFixedPitch`,2),Ec([J(`uint32`)],Dc.prototype,`minMemType42`,2),Ec([J(`uint32`)],Dc.prototype,`maxMemType42`,2),Ec([J(`uint32`)],Dc.prototype,`minMemType1`,2),Ec([J(`uint32`)],Dc.prototype,`maxMemType1`,2),Dc=Ec([Ko(`post`)],Dc);var Oc=Object.defineProperty,kc=Object.getOwnPropertyDescriptor,Ac=(e,t,n,r)=>{for(var i=r>1?void 0:r?kc(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&&Oc(t,n,i),i},jc=class extends Jo{constructor(e=new ArrayBuffer(36),t){super(e,t,Math.min(36,e.byteLength-(t??0)))}};Ac([J(`fixed`)],jc.prototype,`version`,2),Ac([J(`int16`)],jc.prototype,`vertTypoAscender`,2),Ac([J(`int16`)],jc.prototype,`vertTypoDescender`,2),Ac([J(`int16`)],jc.prototype,`vertTypoLineGap`,2),Ac([J(`int16`)],jc.prototype,`advanceHeightMax`,2),Ac([J(`int16`)],jc.prototype,`minTopSideBearing`,2),Ac([J(`int16`)],jc.prototype,`minBottomSideBearing`,2),Ac([J(`int16`)],jc.prototype,`yMaxExtent`,2),Ac([J(`int16`)],jc.prototype,`caretSlopeRise`,2),Ac([J(`int16`)],jc.prototype,`caretSlopeRun`,2),Ac([J(`int16`)],jc.prototype,`caretOffset`,2),Ac([J({type:`int16`,size:4})],jc.prototype,`reserved`,2),Ac([J(`int16`)],jc.prototype,`metricDataFormat`,2),Ac([J(`int16`)],jc.prototype,`numOfLongVerMetrics`,2),jc=Ac([Ko(`vhea`)],jc);var Mc=Object.getOwnPropertyDescriptor,Nc=(e,t,n,r)=>{for(var i=r>1?void 0:r?Mc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Pc=class extends Jo{static from(e){let t=e.length*4,n=new Pc(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()}))}};Pc=Nc([Ko(`vmtx`)],Pc);var Fc=Object.defineProperty,Ic=(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&&Fc(t,n,i),i},Lc=class extends ho{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(ao(e).getUint32(0))}static checksum(e){let t=ao(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 Co(this.view.buffer,e);return e+=t.view.byteLength,t})}createSFNT(){return new qo(this.getDirectories().reduce((e,t)=>(e[t.tag]=new DataView(this.view.buffer,this.view.byteOffset+t.offset,t.length),e),{}))}};Ic([J(`uint32`)],Lc.prototype,`scalerType`),Ic([J(`uint16`)],Lc.prototype,`numTables`),Ic([J(`uint16`)],Lc.prototype,`searchRange`),Ic([J(`uint16`)],Lc.prototype,`entrySelector`),Ic([J(`uint16`)],Lc.prototype,`rangeShift`);var Rc=class extends Lc{format=`OpenType`;mimeType=`font/otf`;static signature=new Set([1330926671]);static from(e){return super.from(e)}},zc=class{static signature=1953784678;static is(e){let t=ao(e);return t.byteLength>=12&&t.getUint32(0,!1)===this.signature}view;numFonts;constructor(e){this.view=ao(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 `)?Rc.from(e):Lc.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 qo(i)}},Bc=Object.defineProperty,Vc=(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&&Bc(t,n,i),i},Hc=class extends mo{constructor(e,t){super(e,t,20)}};Vc([J({type:`char`,size:4})],Hc.prototype,`tag`),Vc([J(`uint32`)],Hc.prototype,`offset`),Vc([J(`uint32`)],Hc.prototype,`compLength`),Vc([J(`uint32`)],Hc.prototype,`origLength`),Vc([J(`uint32`)],Hc.prototype,`origChecksum`);var Uc=Object.defineProperty,Wc=(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&&Uc(t,n,i),i};function Gc(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Kc(e){return new Promise((t,n)=>{Za(e,(e,r)=>e?n(e):t(r))})}function qc(e){return new Promise((t,n)=>{$a(e,(e,r)=>e?n(e):t(r))})}var Jc=class e extends ho{format=`WOFF`;mimeType=`font/woff`;get subfontFormat(){return Lc.is(this.flavor)?`TrueType`:Rc.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(ao(e).getUint32(0))}static checkSum(e){let t=ao(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,ao(Qa(Gc(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,ao(await Kc(Gc(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 Hc(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=eo(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 qo(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 qc(new Uint8Array(this.view.buffer.slice(n,n+r)));a=new DataView(e.buffer,e.byteOffset,e.byteLength)}return[t,a]}));return new qo(new Map(e))}};Wc([J(`uint32`)],Jc.prototype,`signature`),Wc([J(`uint32`)],Jc.prototype,`flavor`),Wc([J(`uint32`)],Jc.prototype,`length`),Wc([J(`uint16`)],Jc.prototype,`numTables`),Wc([J(`uint16`)],Jc.prototype,`reserved`),Wc([J(`uint32`)],Jc.prototype,`totalSFNTSize`),Wc([J(`uint16`)],Jc.prototype,`majorVersion`),Wc([J(`uint16`)],Jc.prototype,`minorVersion`),Wc([J(`uint32`)],Jc.prototype,`metaOffset`),Wc([J(`uint32`)],Jc.prototype,`metaLength`),Wc([J(`uint32`)],Jc.prototype,`metaOrigLength`),Wc([J(`uint32`)],Jc.prototype,`privOffset`),Wc([J(`uint32`)],Jc.prototype,`privLength`);var Yc=Jc;function Xc(e,t=!0){if(Lc.is(e))return new Lc(e);if(Rc.is(e))return new Rc(e);if(Yc.is(e))return new Yc(e);if(zc.is(e)){let t=new zc(e).fonts;if(t.length)return t[0]}if(t)throw Error(`Failed to parseFont`)}function Zc(e,t=!0){let n=Xc(e,!1);if(n)return n;if(t)throw Error(`Failed to parseFont`)}var Qc=new class e{static defaultRequestInit={cache:`force-cache`};loading=new Map;loaded=new Map;familyToUrl=new Map;_loadListeners=new Set;on(e,t){return e===`load`&&this._loadListeners.add(t),this}off(e,t){return e===`load`&&this._loadListeners.delete(t),this}_emitLoad(e){this._loadListeners.forEach(t=>t(e))}_fallbackFont;get fallbackFont(){return this._fallbackFont}set fallbackFont(e){this._fallbackFont=e,e&&this._emitLoad(e)}setFallbackFont(e){this.fallbackFont=e}async loadFallbackFont(e,t={}){if(e!=null){this.fallbackFont=await this.load(e,t);return}let n=await this._loadSystemFallbackFont().catch(()=>void 0);this.fallbackFont=n??this._loadEmbeddedFallbackFont()}async _loadSystemFallbackFont(){let e=globalThis?.queryLocalFonts;if(typeof e!=`function`)return;let t=await e();if(!t?.length)return;let n=[`Arial`,`Helvetica`,`Helvetica Neue`,`Roboto`,`Segoe UI`,`Microsoft YaHei`,`PingFang SC`,`Noto Sans`],r=t.find(e=>n.includes(e.family))??t[0],i=await(await r.blob()).arrayBuffer(),a=r.family??r.fullName??r.postscriptName??`system-fallback`;return this._createLoadedFont(`local-font:${a}`,[a],i)}_loadEmbeddedFallbackFont(){let e=bo(yo);return this._createLoadedFont(`modern-font:embedded-fallback`,[`ModernFallback`],e)}_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
32
  font-family: "${e}";
32
33
  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?sc(e,!1):void 0,t}function r(){let e=n();if(e instanceof qs||e instanceof ac)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))}},lc=new Set([`©`,`®`,`÷`]),uc=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),dc={1:`italic`,32:`bold`},fc={1:`italic`,2:`bold`},pc={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},mc=4096,hc=new Map;function gc(e,t){hc.set(e,t),hc.size>mc&&hc.delete(hc.keys().next().value)}var _c=0,vc=new WeakMap;function yc(e){let t=vc.get(e);return t===void 0&&(t=++_c,vc.set(e,t)),t}var bc=256,xc=new Map;function Sc(e,t){let n=`${yc(e)}|${t}`,r=xc.get(n);if(r)return r;let{hhea:i,os2:a,post:o,head:s}=e,c=s.unitsPerEm,l=i.ascent,u=i.descent,d=c/t,f=(l+Math.abs(u))/d,p=l/d,m={sfnt:e,unitsPerEm:c,advanceHeight:f,baseline:p,ascender:l/d,descender:u/d,underlinePosition:(l-o.underlinePosition)/d,underlineThickness:o.underlineThickness/d,strikeoutPosition:(l-a.yStrikeoutPosition)/d,strikeoutSize:a.yStrikeoutSize/d,typoAscender:a.sTypoAscender/d,typoDescender:a.sTypoDescender/d,typoLineGap:a.sTypoLineGap/d,winAscent:a.usWinAscent/d,winDescent:a.usWinDescent/d,xHeight:a.version>1?a.sxHeight/d:0,capHeight:a.version>1?a.sCapHeight/d:0,centerDiviation:f/2-p,fontStyle:dc[a.fsSelection]??fc[s.macStyle]};return xc.size>=bc&&xc.delete(xc.keys().next().value),xc.set(n,m),m}var Cc=class{content;index;parent;_path;_lazyPath;get path(){if(this._path)return this._path;let e=this._lazyPath;if(e){let{x:t,y:n}=e,r=e.tmpl.path.clone().setMeta(this);return r.applyTransform(e=>{e.x+=t,e.y+=n}),r.style=e.style,this._path=r,this._lazyPath=void 0,r}let t=new Wr().setMeta(this);return this._path=t,t}set path(e){this._path=e,this._lazyPath=void 0}inlineBox=new W;get lineBox(){let e=this.inlineBox,t=this.fontHeight;return this.isVertical?new W(e.left+(e.width-t)/2,e.top,t,e.height):new W(e.left,e.top+(e.height-t)/2,e.width,t)}glyphBox;advanceWidth=0;kerningBefore=0;_glyphIndex;_metrics;get advanceHeight(){return this._metrics?.advanceHeight??0}get baseline(){return this._metrics?.baseline??0}get ascender(){return this._metrics?.ascender??0}get descender(){return this._metrics?.descender??0}get underlinePosition(){return this._metrics?.underlinePosition??0}get underlineThickness(){return this._metrics?.underlineThickness??0}get strikeoutPosition(){return this._metrics?.strikeoutPosition??0}get strikeoutSize(){return this._metrics?.strikeoutSize??0}get typoAscender(){return this._metrics?.typoAscender??0}get typoDescender(){return this._metrics?.typoDescender??0}get typoLineGap(){return this._metrics?.typoLineGap??0}get winAscent(){return this._metrics?.winAscent??0}get winDescent(){return this._metrics?.winDescent??0}get xHeight(){return this._metrics?.xHeight??0}get capHeight(){return this._metrics?.capHeight??0}get centerDiviation(){return this._metrics?.centerDiviation??0}get fontStyle(){return this._metrics?.fontStyle}translateY(e){e&&(this.inlineBox.top+=e,this.glyphBox&&(this.glyphBox.top+=e),this._lazyPath?this._lazyPath.y+=e:this._path&&this._path.applyTransform(t=>{t.y+=e}))}get compatibleGlyphBox(){if(this.glyphBox)return this.glyphBox;let e=this.computedStyle.fontSize*.8,t=this.lineBox;return this.isVertical?new W(t.left+t.width/2-e/2,t.top,e,t.height):new W(t.left,t.top+t.height/2-e/2,t.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??cc,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{content:t,computedStyle:n}=this,r=n.fontSize;return this._metrics=Sc(e,r),this.advanceWidth=e.getAdvanceWidth(t,r),this._glyphIndex=e.textToGlyphIndexes(t)[0],this}computeKerningBefore(e){let t=this._metrics;if(!e||!t||e._metrics?.sfnt!==t.sfnt||e._glyphIndex===void 0||this._glyphIndex===void 0)return 0;let n=t.sfnt.getKerningValue(e._glyphIndex,this._glyphIndex);return n?n*this.computedStyle.fontSize/t.unitsPerEm:0}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let n=this.computedStyle,r=n.fontStyle===`italic`&&this.fontStyle!==`italic`;if(!this.isVertical&&!r&&!n.textStrokeWidth)return this._updateFromCache(t,n),this;let{isVertical:i,content:a,baseline:o,inlineBox:s,ascender:c,descender:l,typoAscender:u,fontStyle:d,advanceWidth:f,advanceHeight:p}=this,{left:m,top:h}=s,g=m,_=h+o,v,y=new Wr().setMeta(this);if(i&&(g+=(p-f)/2,Math.abs(f-p)>.1&&(_-=(c-u)/(c+Math.abs(l))*p),v=void 0),i&&!lc.has(a)&&(a.codePointAt(0)<=256||uc.has(a))){y.addCommands(t.getPathCommands(a,g,h+o-(p-f)/2,n.fontSize));let e={y:h-(p-f)/2+p/2,x:g+f/2};r&&this._italic(y,{x:e.x,y:h-(p-f)/2+o}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(a,g,_,n.fontSize)),r&&this._italic(y,i?{x:g+p/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,n.fontSize)),r&&this._italic(y,i?{x:g+f/2,y:h+u/(c+Math.abs(l))*p}:void 0));let b=n.fontWeight??400;return b in pc&&(b===700||b===`bold`)&&d!==`bold`&&y.bold(pc[b]*n.fontSize*.05),y.style=j({fill:n.color,fillRule:`nonzero`,stroke:n.textStrokeWidth?n.textStrokeColor:void 0,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize*.03:void 0}),this.path=y,this.glyphBox=this.getGlyphBoundingBox(),this}_updateFromCache(e,t){let n=this.content,r=t.fontSize,i=this.inlineBox.left,a=this.inlineBox.top+this.baseline,o=t.fontWeight??400,s=o in pc&&(o===700||o===`bold`)&&this.fontStyle!==`bold`?pc[o]*r*.05:0,c=`${n}|${yc(e)}|${r}|${s}`,l=hc.get(c);if(!l){let t=new Wr;t.addCommands(e.getPathCommands(n,0,0,r)),s&&t.bold(s);let i;if(t.curves[0]?.curves.length){let{min:e,max:n}=t.getMinMax(void 0,void 0,!0);i=new W(e.x,e.y,n.x-e.x,n.y-e.y)}l={path:t,glyphBox:i},gc(c,l)}this._path=void 0,this._lazyPath={tmpl:l,x:i,y:a,style:j({fill:t.color,fillRule:`nonzero`})},this.glyphBox=l.glyphBox?new W(l.glyphBox.left+i,l.glyphBox.top+a,l.glyphBox.width,l.glyphBox.height):void 0}_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===void 0&&this._lazyPath!==void 0){let n=this.glyphBox;if(!n)return;let r=new U(n.left,n.top),i=new U(n.left+n.width,n.top+n.height),a=e??new U(2**53-1,2**53-1),o=t??new U(-(2**53-1),-(2**53-1));return a.clampMin(r,i),o.clampMax(r,i),{min:a,max:o}}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)}},wc=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,...j(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?j(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?j(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new Cc(n,t++,this));return this.characters=e,this}},Tc=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;_layoutDirty=!0;_layoutTop=0;_layoutHeight=0;_layoutRight=0;_glyphBox;_layoutValid=!1;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...j(this.parent.computedStyle),...j(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?j(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?j(t):void 0,this}};function Ec(e){return e}function Dc(e,t,n){return e[`${t}${n}`]??e[t]??0}var Oc=class{measure(e,t,n,r){let i=r??cc;for(let t of e)if(t._layoutDirty)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)||this._applyKerning(e),t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:Dc(e,`padding`,`Top`),right:Dc(e,`padding`,`Right`),bottom:Dc(e,`padding`,`Bottom`),left:Dc(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=t.textWrap===`nowrap`,a=r&&!i?t.width-n.left-n.right:1/0,o=n.top,s=n.left;for(let t of e){let e=t.computedStyle,r=t.style,i=Dc(r,`margin`,`Top`),c=Dc(r,`margin`,`Bottom`),l=Dc(r,`margin`,`Left`),u=Dc(r,`margin`,`Right`),d=Dc(r,`padding`,`Top`),f=Dc(r,`padding`,`Bottom`),p=Dc(r,`padding`,`Left`),m=Dc(r,`padding`,`Right`),h=n.left+l+p,g=a===1/0?1/0:a-l-u-p-m;o+=i+d;let _=o,v=h;if(!t._layoutDirty){let e=_-t._layoutTop;if(e){for(let n of t.fragments){for(let t of n.characters)t.translateY(e);n.inlineBox.top+=e}t.lineBox.top+=e,t._glyphBox&&(t._glyphBox.top+=e)}t._layoutTop=_,v=t._layoutRight,o=_+t.lineBox.height,v>s&&(s=v),o+=f+c;continue}let y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0,S=!1,C=!1;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,a=0,s=!0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),s||(a+=e.kerningBefore),s=!1,a+=this._advance(e);let c=h+r;if(g!==1/0){let e=g-r-a;b===`center`?c+=e/2:(b===`end`||b===`right`)&&(c+=e)}let l=!0;for(let e of n){S=!0,e.advanceWidth>0&&(C=!0),l||(c+=e.kerningBefore),l=!1;let t=e.advanceWidth,n=e.advanceHeight;e.inlineBox.left=c,e.inlineBox.top=o+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,c+=this._advance(e)}c>v&&(v=c),o+=i}v>s&&(s=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=o-_,t._layoutTop=_,t._layoutHeight=t.lineBox.height,t._layoutRight=v,t._glyphBox=void 0,t._layoutValid=!S||C,o+=f+c}let c=o+n.bottom,l=r?t.width:s+n.right,u=typeof t.height==`number`?t.height:c;if(typeof t.height==`number`){let n=u-c,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,l,u)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=t.textWrap===`nowrap`,a=r&&!i?t.height-n.top-n.bottom:1/0,o=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,a)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);o.push({chars:n,thickness:t})}}let s=o.reduce((e,t)=>e+t.thickness,0),c=typeof t.width==`number`,l=c?Math.max(t.width-n.left-n.right,s):s,u=n.left+l,d=n.top;for(let e of o){u-=e.thickness;let t=u,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,r+=this._advance(n)}r>d&&(d=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,c?t.width:l+n.left+n.right,r?t.height:d+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}let n=r.length>0?e.kerningBefore:0;t!==1/0&&r.length>0&&i+n+e.advanceWidth>t&&a(),r.length>0&&(i+=e.kerningBefore),r.push(e),i+=this._advance(e)}return a(),n}_applyKerning(e){for(let t of e){if(!t._layoutDirty)continue;let e;for(let n of t.fragments)for(let t of n.characters)t.kerningBefore=t.computeKerningBefore(e),e=t}}_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}}}dispose(){}};function kc(){let e=new Gr,t=Kr(),n=qr(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 Un;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 Gr([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 Ac(e,t){let{x:n,y:r}=t;if(e instanceof zr){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 zr(t,e,o),new zr(o.clone(),r,a)]}}}else if(e instanceof Ir){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 Ir(t,e,s,c),new Ir(c.clone(),l,u,o)]}}else if(e instanceof Pr){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 Pr(t,new U(n,r)),new Pr(new U(n,r),i)]}return[e]}var jc=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=>Ac(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof zr&&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 Pr&&e.getLength()>5){let{p1:t,p2:n}=e,r=new zr(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 jc{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)}},Nc=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()}},Pc=class extends Nc{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)}},Fc=class extends Nc{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()}},Ic=class extends Nc{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))}},Lc=class extends Nc{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)}},Rc=class extends Pc{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 Ic(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new Ic(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new Ic(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 Fc(l,u),m=new Fc(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]}},zc=class extends Pc{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 Fc(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]}},Bc=class extends Pc{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 Fc(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]}},Vc=class extends jc{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)}},Hc=class extends jc{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]}},Uc=new Map;function Wc(e,t){Uc.set(e,t)}function Gc(e){Uc.delete(e)}function Kc(){return[...Uc.keys()]}function qc(){return Ec({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(O(n)||!n)return;let r=Uc.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 Vc(i,r);break;case`bend`:a=new Mc(i,r);break;case`curve`:case`offset`:a=new Hc(i,r);break}a.deform();let o=e.getGlyphBox(),s=o.left,c=o.top;if(s||c){let t=e.plugins.get(`highlight`);for(let t of e.characters)t.glyphBox&&(t.path.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)}),t.glyphBox=t.getGlyphBoundingBox(),t.glyphBox&&(t.inlineBox=t.glyphBox));t?.pathSet?.paths?.forEach(e=>{e.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)})}),o=e.getGlyphBox()}e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Jc(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 Yc(){let e=new Gr,t=[],n=Kr(),r=qr(n);return Ec({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}=Jc(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=Jc(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||$r(o.image,r)&&$r(o.colormap,s)&&$r(o.line,c)&&$r(o.size,l)&&$r(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}=Jc(c),x=Xr(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=Xr(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 Un;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 Gr([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Xc(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
34
+ }`)),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=this._createLoadedFont(o,c,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(()=>(this._emitLoad(n),n))}).catch(e=>{if(e instanceof DOMException&&e.message===`The user aborted a request.`)return this._createLoadedFont(o,c);throw e}).finally(()=>{this.loading.delete(o)});function u(e){return c.forEach(t=>{e.familySet.add(t)}),e}}_createLoadedFont(e,t,n=new ArrayBuffer(0)){let r;function i(){return r||=n.byteLength?Zc(n,!1):void 0,r}function a(){let e=i();if(e instanceof Lc||e instanceof Yc)return e.sfnt}return{src:e,family:t.length===1?t[0]:t,buffer:n,familySet:new Set(t),getFont:i,getSFNT:a}}async waitUntilLoad(){await Promise.all(Array.from(this.loading.values(),e=>e.when))}},$c=new Set([`©`,`®`,`÷`]),el=new Set([`—`,`…`,`“`,`”`,`﹏`,`﹋`,`﹌`,`‘`,`’`,`˜`]),tl={1:`italic`,32:`bold`},nl={1:`italic`,2:`bold`},rl={100:-.2,200:-.1,300:0,400:0,normal:0,500:.1,600:.2,700:.3,bold:.3,800:.4,900:.5},il=4096,al=new Map;function ol(e,t){al.set(e,t),al.size>il&&al.delete(al.keys().next().value)}var sl=0,cl=new WeakMap;function ll(e){let t=cl.get(e);return t===void 0&&(t=++sl,cl.set(e,t)),t}var ul=256,dl=new Map;function fl(e,t){let n=`${ll(e)}|${t}`,r=dl.get(n);if(r)return r;let{hhea:i,os2:a,post:o,head:s}=e,c=s.unitsPerEm,l=i.ascent,u=i.descent,d=c/t,f=(l+Math.abs(u))/d,p=l/d,m={sfnt:e,unitsPerEm:c,advanceHeight:f,baseline:p,ascender:l/d,descender:u/d,underlinePosition:(l-o.underlinePosition)/d,underlineThickness:o.underlineThickness/d,strikeoutPosition:(l-a.yStrikeoutPosition)/d,strikeoutSize:a.yStrikeoutSize/d,typoAscender:a.sTypoAscender/d,typoDescender:a.sTypoDescender/d,typoLineGap:a.sTypoLineGap/d,winAscent:a.usWinAscent/d,winDescent:a.usWinDescent/d,xHeight:a.version>1?a.sxHeight/d:0,capHeight:a.version>1?a.sCapHeight/d:0,centerDiviation:f/2-p,fontStyle:tl[a.fsSelection]??nl[s.macStyle]};return dl.size>=ul&&dl.delete(dl.keys().next().value),dl.set(n,m),m}var pl=class{content;index;parent;_path;_lazyPath;get path(){if(this._path)return this._path;let e=this._lazyPath;if(e){let{x:t,y:n}=e,r=e.tmpl.path.clone().setMeta(this);return r.applyTransform(e=>{e.x+=t,e.y+=n}),r.style=e.style,this._path=r,this._lazyPath=void 0,r}let t=new Mi().setMeta(this);return this._path=t,t}set path(e){this._path=e,this._lazyPath=void 0}inlineBox=new W;get lineBox(){let e=this.inlineBox,t=this.fontHeight;return this.isVertical?new W(e.left+(e.width-t)/2,e.top,t,e.height):new W(e.left,e.top+(e.height-t)/2,e.width,t)}glyphBox;advanceWidth=0;kerningBefore=0;_glyphIndex;_metrics;get advanceHeight(){return this._metrics?.advanceHeight??0}get baseline(){return this._metrics?.baseline??0}get ascender(){return this._metrics?.ascender??0}get descender(){return this._metrics?.descender??0}get underlinePosition(){return this._metrics?.underlinePosition??0}get underlineThickness(){return this._metrics?.underlineThickness??0}get strikeoutPosition(){return this._metrics?.strikeoutPosition??0}get strikeoutSize(){return this._metrics?.strikeoutSize??0}get typoAscender(){return this._metrics?.typoAscender??0}get typoDescender(){return this._metrics?.typoDescender??0}get typoLineGap(){return this._metrics?.typoLineGap??0}get winAscent(){return this._metrics?.winAscent??0}get winDescent(){return this._metrics?.winDescent??0}get xHeight(){return this._metrics?.xHeight??0}get capHeight(){return this._metrics?.capHeight??0}get centerDiviation(){return this._metrics?.centerDiviation??0}get fontStyle(){return this._metrics?.fontStyle}translateY(e){e&&(this.inlineBox.top+=e,this.glyphBox&&(this.glyphBox.top+=e),this._lazyPath?this._lazyPath.y+=e:this._path&&this._path.applyTransform(t=>{t.y+=e}))}get compatibleGlyphBox(){if(this.glyphBox)return this.glyphBox;let e=this.computedStyle.fontSize*.8,t=this.lineBox;return this.isVertical?new W(t.left+t.width/2-e/2,t.top,e,t.height):new W(t.left,t.top+t.height/2-e/2,t.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??Qc,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{content:t,computedStyle:n}=this,r=n.fontSize;return this._metrics=fl(e,r),this.advanceWidth=e.getAdvanceWidth(t,r),this._glyphIndex=e.textToGlyphIndexes(t)[0],this}computeKerningBefore(e){let t=this._metrics;if(!e||!t||e._metrics?.sfnt!==t.sfnt||e._glyphIndex===void 0||this._glyphIndex===void 0)return 0;let n=t.sfnt.getKerningValue(e._glyphIndex,this._glyphIndex);return n?n*this.computedStyle.fontSize/t.unitsPerEm:0}measureGlyph(e){return this.updateGlyph(this._getFontSFNT(e))}update(e){let t=this._getFontSFNT(e);if(!t)return this;this.updateGlyph(t);let n=this.computedStyle,r=n.fontStyle===`italic`&&this.fontStyle!==`italic`;if(!this.isVertical&&!r&&!n.textStrokeWidth)return this._updateFromCache(t,n),this;let{isVertical:i,content:a,baseline:o,inlineBox:s,ascender:c,descender:l,typoAscender:u,fontStyle:d,advanceWidth:f,advanceHeight:p}=this,{left:m,top:h}=s,g=m,_=h+o,v,y=new Mi().setMeta(this);if(i&&(g+=(p-f)/2,Math.abs(f-p)>.1&&(_-=(c-u)/(c+Math.abs(l))*p),v=void 0),i&&!$c.has(a)&&(a.codePointAt(0)<=256||el.has(a))){y.addCommands(t.getPathCommands(a,g,h+o-(p-f)/2,n.fontSize));let e={y:h-(p-f)/2+p/2,x:g+f/2};r&&this._italic(y,{x:e.x,y:h-(p-f)/2+o}),y.rotate(Math.PI/2,e)}else v===void 0?(y.addCommands(t.getPathCommands(a,g,_,n.fontSize)),r&&this._italic(y,i?{x:g+p/2,y:_}:void 0)):(y.addCommands(t.glyphs.get(v).getPathCommands(g,_,n.fontSize)),r&&this._italic(y,i?{x:g+f/2,y:h+u/(c+Math.abs(l))*p}:void 0));let b=n.fontWeight??400;return b in rl&&(b===700||b===`bold`)&&d!==`bold`&&y.bold(rl[b]*n.fontSize*.05),y.style=B({fill:n.color,fillRule:`nonzero`,stroke:n.textStrokeWidth?n.textStrokeColor:void 0,strokeWidth:n.textStrokeWidth?n.textStrokeWidth*n.fontSize*.03:void 0}),this.path=y,this.glyphBox=this.getGlyphBoundingBox(),this}_updateFromCache(e,t){let n=this.content,r=t.fontSize,i=this.inlineBox.left,a=this.inlineBox.top+this.baseline,o=t.fontWeight??400,s=o in rl&&(o===700||o===`bold`)&&this.fontStyle!==`bold`?rl[o]*r*.05:0,c=`${n}|${ll(e)}|${r}|${s}`,l=al.get(c);if(!l){let t=new Mi;t.addCommands(e.getPathCommands(n,0,0,r)),s&&t.bold(s);let i;if(t.curves[0]?.curves.length){let{min:e,max:n}=t.getMinMax(void 0,void 0,!0);i=new W(e.x,e.y,n.x-e.x,n.y-e.y)}l={path:t,glyphBox:i},ol(c,l)}this._path=void 0,this._lazyPath={tmpl:l,x:i,y:a,style:B({fill:t.color,fillRule:`nonzero`})},this.glyphBox=l.glyphBox?new W(l.glyphBox.left+i,l.glyphBox.top+a,l.glyphBox.width,l.glyphBox.height):void 0}_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===void 0&&this._lazyPath!==void 0){let n=this.glyphBox;if(!n)return;let r=new U(n.left,n.top),i=new U(n.left+n.width,n.top+n.height),a=e??new U(2**53-1,2**53-1),o=t??new U(-(2**53-1),-(2**53-1));return a.clampMin(r,i),o.clampMax(r,i),{min:a,max:o}}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)}},ml=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,...B(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?B(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?B(t):void 0,this}initCharacters(){let e=[],t=0;for(let n of this.computedContent)e.push(new pl(n,t++,this));return this.characters=e,this}},hl=class{style;index;parent;lineBox=new W;fragments=[];fill;outline;_layoutDirty=!0;_layoutTop=0;_layoutHeight=0;_layoutRight=0;_glyphBox;_layoutValid=!1;constructor(e,t,n){this.style=e,this.index=t,this.parent=n,this.update()}update(){this.computedStyle={...B(this.parent.computedStyle),...B(this.style)};let e=this.fill??this.parent.computedFill;this.computedFill=e?B(e):void 0;let t=this.outline??this.parent.computedOutline;return this.computedOutline=t?B(t):void 0,this}};function gl(e){return e}function _l(e,t,n){return e[`${t}${n}`]??e[t]??0}var vl=class{measure(e,t,n,r){let i=r??Qc;for(let t of e)if(t._layoutDirty)for(let e of t.fragments)for(let t of e.characters)t.measureGlyph(i);return t.writingMode.includes(`vertical`)||this._applyKerning(e),t.writingMode.includes(`vertical`)?this._measureVertical(e,t):this._measureHorizontal(e,t)}_rootPadding(e){return{top:_l(e,`padding`,`Top`),right:_l(e,`padding`,`Right`),bottom:_l(e,`padding`,`Bottom`),left:_l(e,`padding`,`Left`)}}_measureHorizontal(e,t){let n=this._rootPadding(t),r=typeof t.width==`number`,i=t.textWrap===`nowrap`,a=r&&!i?t.width-n.left-n.right:1/0,o=n.top,s=n.left;for(let t of e){let e=t.computedStyle,r=t.style,i=_l(r,`margin`,`Top`),c=_l(r,`margin`,`Bottom`),l=_l(r,`margin`,`Left`),u=_l(r,`margin`,`Right`),d=_l(r,`padding`,`Top`),f=_l(r,`padding`,`Bottom`),p=_l(r,`padding`,`Left`),m=_l(r,`padding`,`Right`),h=n.left+l+p,g=a===1/0?1/0:a-l-u-p-m;o+=i+d;let _=o,v=h;if(!t._layoutDirty){let e=_-t._layoutTop;if(e){for(let n of t.fragments){for(let t of n.characters)t.translateY(e);n.inlineBox.top+=e}t.lineBox.top+=e,t._glyphBox&&(t._glyphBox.top+=e)}t._layoutTop=_,v=t._layoutRight,o=_+t.lineBox.height,v>s&&(s=v),o+=f+c;continue}let y=this._breakLines(t,g),b=e.textAlign,x=e.textIndent??0,S=!1,C=!1;for(let t=0;t<y.length;t++){let n=y[t],r=t===0?x:0,i=e.fontSize*e.lineHeight,a=0,s=!0;for(let e of n)e.fontHeight>i&&(i=e.fontHeight),s||(a+=e.kerningBefore),s=!1,a+=this._advance(e);let c=h+r;if(g!==1/0){let e=g-r-a;b===`center`?c+=e/2:(b===`end`||b===`right`)&&(c+=e)}let l=!0;for(let e of n){S=!0,e.advanceWidth>0&&(C=!0),l||(c+=e.kerningBefore),l=!1;let t=e.advanceWidth,n=e.advanceHeight;e.inlineBox.left=c,e.inlineBox.top=o+(i-n)/2,e.inlineBox.width=t,e.inlineBox.height=n,c+=this._advance(e)}c>v&&(v=c),o+=i}v>s&&(s=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=o-_,t._layoutTop=_,t._layoutHeight=t.lineBox.height,t._layoutRight=v,t._glyphBox=void 0,t._layoutValid=!S||C,o+=f+c}let c=o+n.bottom,l=r?t.width:s+n.right,u=typeof t.height==`number`?t.height:c;if(typeof t.height==`number`){let n=u-c,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,l,u)}}_measureVertical(e,t){let n=this._rootPadding(t),r=typeof t.height==`number`,i=t.textWrap===`nowrap`,a=r&&!i?t.height-n.top-n.bottom:1/0,o=[];for(let t of e){let e=t.computedStyle.fontSize*t.computedStyle.lineHeight;for(let n of this._breakLines(t,a)){let t=e;for(let e of n)e.fontHeight>t&&(t=e.fontHeight);o.push({chars:n,thickness:t})}}let s=o.reduce((e,t)=>e+t.thickness,0),c=typeof t.width==`number`,l=c?Math.max(t.width-n.left-n.right,s):s,u=n.left+l,d=n.top;for(let e of o){u-=e.thickness;let t=u,r=n.top;for(let n of e.chars){let i=n.advanceWidth,a=n.advanceHeight;n.inlineBox.top=r,n.inlineBox.height=i,n.inlineBox.width=a,n.inlineBox.left=t+(e.thickness-a)/2,r+=this._advance(n)}r>d&&(d=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,c?t.width:l+n.left+n.right,r?t.height:d+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===`
35
+ `||e.content===`\r`){a();continue}let n=r.length>0?e.kerningBefore:0;t!==1/0&&r.length>0&&i+n+e.advanceWidth>t&&a(),r.length>0&&(i+=e.kerningBefore),r.push(e),i+=this._advance(e)}return a(),n}_applyKerning(e){for(let t of e){if(!t._layoutDirty)continue;let e;for(let n of t.fragments)for(let t of n.characters)t.kerningBefore=t.computeKerningBefore(e),e=t}}_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}}}dispose(){}};function yl(){let e=new Ni,t=Pi(),n=Fi(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(L(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=zi(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 jr;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;L(a.backgroundColor)||(r.fillStyle=a.backgroundColor,r.fillRect(...i.array)),e.paths.forEach(e=>{if(t.drawPath(e),n.debug){let t=new Ni([e]).getBoundingBox();t&&r.strokeRect(t.x,t.y,t.width,t.height)}}),n.paragraphs.forEach(e=>{let{lineBox:t,style:n}=e;L(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array)),e.fragments.forEach(e=>{let{inlineBox:t,style:n}=e;L(n.backgroundColor)||(r.fillStyle=n.backgroundColor,r.fillRect(...t.array))})})}}}function bl(e,t){let{x:n,y:r}=t;if(e instanceof Di){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 Di(t,e,o),new Di(o.clone(),r,a)]}}}else if(e instanceof wi){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 wi(t,e,s,c),new wi(c.clone(),l,u,o)]}}else if(e instanceof Si){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 Si(t,new U(n,r)),new Si(new U(n,r),i)]}return[e]}var xl=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}){this.text=e,this.intensities=t.map(e=>e/100),this.lineHeight=this._maxFontSize()||n||100}_maxFontSize(){let e=0;return this.characters.forEach(t=>{t.glyphBox&&(e=Math.max(e,t.fontSize))}),e}_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=>bl(t,e?{y:o}:{x:a}))})})}_makeTheJointSmooth(){this.characters.forEach(e=>{e.glyphBox&&e.path.getFlatCurves().forEach(e=>{if(e instanceof Di&&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 Si&&e.getLength()>this.lineHeight*.05){let{p1:t,p2:n}=e,r=new Di(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)})})}},Sl=class extends xl{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)}},Cl=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()}},wl=class extends Cl{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)}},Tl=class extends Cl{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()}},El=class extends Cl{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))}},Dl=class extends Cl{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)}},Ol=class extends wl{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 El(n,Math.SQRT1_2*this.size,-.25*Math.PI,.75*Math.PI),o=new El(r,Math.SQRT1_2*this.size,-.75*Math.PI,.25*Math.PI),s=new El(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 Tl(l,u),m=new Tl(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]}},kl=class extends wl{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 Tl(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]}},Al=class extends wl{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 Tl(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]}},jl=class extends xl{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=0,n=0]=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)}},Ml=class extends xl{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]}},Nl=new Map;function Pl(e,t){Nl.set(e,t)}function Fl(e){Nl.delete(e)}function Il(){return[...Nl.keys()]}function Ll(){return gl({name:`deformation`,updateOrder:2,update:e=>{let t=e.deformation,n=t?.type;if(L(n)||!n)return;let r=Nl.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 jl(i,r);break;case`bend`:a=new Sl(i,r);break;case`curve`:case`offset`:a=new Ml(i,r);break}a.deform();let o=e.getGlyphBox(),s=o.left,c=o.top;if(s||c){let t=e.plugins.get(`highlight`);for(let t of e.characters)t.glyphBox&&(t.path.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)}),t.glyphBox=t.getGlyphBoundingBox(),t.glyphBox&&(t.inlineBox=t.glyphBox));t?.pathSet?.paths?.forEach(e=>{e.getControlPointRefs().forEach(e=>{e.set(e.x-s,e.y-c)})}),o=e.getGlyphBox()}e.rawGlyphBox=o,e.glyphBox=o,e.lineBox=o}})}function Rl(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 zl(){let e=new Ni,t=[],n=Pi(),r=Fi(n);return gl({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}=Rl(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=Rl(t),{image:r,colormap:s,line:c,size:l,thickness:u}=n;if(L(r))a?.length&&(a=[],i.push(a));else{let{inlineBox:n,isVertical:d}=e,{fontSize:f}=t;(!o||Vi(o.image,r)&&Vi(o.colormap,s)&&Vi(o.line,c)&&Vi(o.size,l)&&Vi(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}=Rl(c),x=Ri(b,{fontSize:m,total:s.width})/s.width,S=zi(_),{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 O=Math.floor(D.width),k=O;y!==`cover`&&(k=Ri(y,{fontSize:m,total:s.width})||O,D.width=k);let A=!L(g)&&L(v);if(A)T.copy(r.parse(g).pathSet.getBoundingBox(!0)??new W);else{let e;if(L(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 j=new jr;if(j.translate(-T.x,-T.y),j.scale(D.width/T.width,D.height/T.height),l){let e=D.width/2,t=D.height/2;A||j.translate(-e,-t),j.rotate(Math.PI/2),A||j.translate(t,e)}j.translate(D.x,D.y);for(let n=0;n<Math.ceil(O/k);n++){let r=j.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),O!==k&&(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 Ni([e]).getBoundingBox();t&&i.strokeRect(t.x,t.y,t.width,t.height)}})}})}function Bl(e,t){return`<svg width="${e*2}" height="${e*2}" xmlns="http://www.w3.org/2000/svg">
35
36
  <circle cx="${e}" cy="${e}" r="${e}" fill="${t}" />
36
- </svg>`}function Zc(){let e=new Gr;return Ec({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=Xc(e,String(o));break}}if(!p)return;let m=br(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:Xr(f,{total:i,fontSize:i})/i,y=new Un;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 Qc(){return{name:`outline`}}function $c(){let e=new Gr,t=[],n=[];return Object.defineProperty(e,"paths",{configurable:!0,enumerable:!0,get(){return n===null&&(n=t.map(e=>e.path)),n},set(e){n=e}}),Ec({name:`render`,pathSet:e,update:r=>{let i=[],{paragraphs:a}=r;a.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{i.push(e)})})}),t=i,n=null,e._lazyCount=i.length},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Jr(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 el(){let e=new Gr;return Ec({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 Wr([{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 Wr([{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 tl(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function nl(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 rl,il=rt(),al=class extends oe{needsUpdate=!0;computedStyle={...il};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new Oc;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;incrementalLayout=!0;_prevParagraphs=[];_prevContentKeys=[];_prevStyleKey=``;_prevFonts;_prevFontsSet=!1;_pendingContentKeys=[];_pendingStyleKey=``;_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}=ft(e);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(kc()).use(Qc()).use(Zc()).use(el()).use(Yc()).use($c()).use(qc()),(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();let[e]=await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))]);e>0&&(this._prevParagraphs=[])}async _decodeFonts(){let e=this.fonts??cc,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}return t.add(e.fallbackFont),(await Promise.all(Array.from(t,async e=>{let t=e?.getFont();return t&&typeof t.createSFNTAsync==`function`&&!t._sfnt?(t._sfnt=await t.createSFNTAsync(),1):0}))).reduce((e,t)=>e+t,0)}_normalizeComputedStyle(e){let t=e;for(let e in il){let n=il[e];if(typeof n!=`number`)continue;let r=t[e];if(typeof r==`number`)Number.isFinite(r)||(t[e]=n);else{let i=Number.parseFloat(r);t[e]=Number.isFinite(i)?i:n}}return e}_buildParagraph(e,t){let{fragments:n,fill:r,outline:i,...a}=e,o=new Tc(a,t,this);return o.fill=r,o.outline=i,n.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&o.fragments.push(new wc(n,a,r,i,t,o))}),o}_canReuseLayout(e){if(!this.incrementalLayout||!this._prevParagraphs.length||e!==this._prevStyleKey||!this._prevFontsSet||this.fonts!==this._prevFonts)return!1;let t=this.computedStyle;return!(t.writingMode.includes(`vertical`)||typeof t.height==`number`&&(t.verticalAlign===`middle`||t.verticalAlign===`bottom`))}_update(){this.computedStyle=this._normalizeComputedStyle({...il,...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=JSON.stringify([this.style,this.fill,this.outline,this.effects,this.deformation]),t=this._canReuseLayout(e),n=this.content,r=Array.from({length:n.length}),i=Array.from({length:n.length});for(let e=0;e<n.length;e++){let a=JSON.stringify(n[e]);r[e]=a;let o=this._prevParagraphs[e];if(t&&o&&o._layoutValid&&this._prevContentKeys[e]===a)o._layoutDirty=!1,i[e]=o;else{let t=this._buildParagraph(n[e],e);t._layoutDirty=!0,i[e]=t}}return this.paragraphs=i,this._pendingContentKeys=r,this._pendingStyleKey=e,this}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.paragraphs;for(let e=0;e<r.length;e++){let t=r[e];if(t._layoutDirty)for(let e of t.fragments){let t=e.characters;for(let e=0;e<t.length;e++)t[e].update(this.fonts)}}let i=this._computeGlyphBox();this.rawGlyphBox=i,this.glyphBox=i,this._prevParagraphs=this.paragraphs,this._prevContentKeys=this._pendingContentKeys,this._prevStyleKey=this._pendingStyleKey,this._prevFonts=this.fonts,this._prevFontsSet=!0;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].pathSet,n=t?._lazyCount??t?.paths.length;t&&n&&this.pathSets.push(t)}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)}_paragraphGlyphBox(e){let t=U.MAX,n=U.MIN,r=e.fragments;for(let e=0;e<r.length;e++){let i=r[e].characters;for(let e=0;e<i.length;e++){let r=i[e];if(r.getGlyphMinMax(t,n))continue;let{left:a,top:o,width:s,height:c}=r.inlineBox;t.clampMin(new U(a,o),new U(a+s,o+c)),n.clampMax(new U(a,o),new U(a+s,o+c))}}if(!(!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(n.x)||!Number.isFinite(n.y)))return new W(t.x,t.y,n.x-t.x,n.y-t.y)}_computeGlyphBox(){let e=this.paragraphs,t=[];for(let n=0;n<e.length;n++){let r=e[n],i=r._glyphBox;(r._layoutDirty||!i)&&(i=this._paragraphGlyphBox(r),r._glyphBox=i),i&&t.push(i)}return t.length?W.from(...t):new W(0,0,0,0)}_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 ei(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.region=e.region,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(``)}};nl([ae({internal:!0}),tl(`design:type`,Boolean)],al.prototype,`debug`,void 0),nl([ae(),tl(`design:type`,Object)],al.prototype,`content`,void 0),nl([ae(),tl(`design:type`,Object)],al.prototype,`style`,void 0),nl([ae(),tl(`design:type`,Object)],al.prototype,`effects`,void 0),nl([ae(),tl(`design:type`,Object)],al.prototype,`fill`,void 0),nl([ae(),tl(`design:type`,Object)],al.prototype,`outline`,void 0),nl([ae(),tl(`design:type`,Object)],al.prototype,`deformation`,void 0),nl([ae({internal:!0}),tl(`design:type`,typeof(rl=typeof HTMLElement<`u`&&HTMLElement)==`function`?rl:Object)],al.prototype,`measureDom`,void 0),nl([ae({internal:!0}),tl(`design:type`,Object)],al.prototype,`fonts`,void 0);function ol(e,t){let n=new al(e);return t?n.load().then(()=>n.measure()):n.measure()}function sl(e,t){let n=new al(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=ei,e.Character=Cc,e.CircleCurve=Ic,e.EllipseCurve=Lc,e.Fragment=wc,e.HeartCurve=Rc,e.Measurer=Oc,e.Paragraph=Tc,e.PolygonCurve=zc,e.RectangularCurve=Bc,e.Text=al,e.backgroundPlugin=kc,e.createSvgLoader=Kr,e.createSvgParser=qr,e.defineDeformation=Wc,e.definePlugin=Ec,e.deformationPlugin=qc,e.getDeformationNames=Kc,e.getEffectTransform2D=Jr,e.getHighlightStyle=Jc,e.highlightPlugin=Yc,e.isEqualObject=Qr,e.isEqualValue=$r,e.listStylePlugin=Zc,e.measureText=ol,e.outlinePlugin=Qc,e.parseColormap=Zr,e.parseTransformOrigin=Yr,e.parseValueNumber=Xr,e.removeDeformation=Gc,e.renderPlugin=$c,e.renderText=sl,e.textDecorationPlugin=el,e.textDefaultStyle=il});
37
+ </svg>`}function Vl(){let e=new Ni;return gl({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=zi(c),f=l,p;if(!L(s))p=s;else if(!L(u)){let e=i*.38/2;switch(f=f===`cover`?e*2:f,u){case`disc`:p=Bl(e,String(o));break}}if(!p)return;let m=ci(p),h=m.getBoundingBox()??new W,g=t.fragments[0]?.characters[0];if(!g)return;let{inlineBox:_}=g,v=f===`cover`?1:Ri(f,{total:i,fontSize:i})/i,y=new jr;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 Hl(){return{name:`outline`}}function Ul(){let e=new Ni,t=[],n=[];return Object.defineProperty(e,"paths",{configurable:!0,enumerable:!0,get(){return n===null&&(n=t.map(e=>e.path)),n},set(e){n=e}}),gl({name:`render`,pathSet:e,update:r=>{let i=[],{paragraphs:a}=r;a.forEach(e=>{e.fragments.forEach(e=>{e.characters.forEach(e=>{i.push(e)})})}),t=i,n=null,e._lazyCount=i.length},getBoundingBox:e=>{let{characters:t,computedEffects:n,fontSize:r}=e,i=[];return n.forEach(n=>{let a=Ii(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 Wl(){let e=new Ni;return gl({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(L(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 Mi([{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 Mi([{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 Gl(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Kl(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 ql=pt(),Jl=class extends he{needsUpdate=!0;computedStyle={...ql};computedFill;computedOutline;computedEffects=[];inlineBox=new W;lineBox=new W;rawGlyphBox=new W;glyphBox=new W;pathBox=new W;boundingBox=new W;measurer=new vl;plugins=new Map;pathSets=[];_paragraphs=[];_cachedCharacters;incrementalLayout=!0;_prevParagraphs=[];_prevContentKeys=[];_prevStyleKey=``;_prevFonts;_prevFontsSet=!1;_pendingContentKeys=[];_pendingStyleKey=``;_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}=St(e);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(yl()).use(Hl()).use(Vl()).use(Wl()).use(zl()).use(Ul()).use(Ll()),(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();let[e]=await Promise.all([this._decodeFonts(),...Array.from(this.plugins.values()).map(e=>e.load?.(this))]);e>0&&(this._prevParagraphs=[])}async _decodeFonts(){let e=this.fonts??Qc,t=new Set;for(let n of this.characters){let r=n.computedStyle.fontFamily;r&&t.add(e.get(r))}return t.add(e.fallbackFont),(await Promise.all(Array.from(t,async e=>{let t=e?.getFont();return t&&typeof t.createSFNTAsync==`function`&&!t._sfnt?(t._sfnt=await t.createSFNTAsync(),1):0}))).reduce((e,t)=>e+t,0)}_normalizeComputedStyle(e){let t=e;for(let e in ql){let n=ql[e];if(typeof n!=`number`)continue;let r=t[e];if(typeof r==`number`)Number.isFinite(r)||(t[e]=n);else{let i=Number.parseFloat(r);t[e]=Number.isFinite(i)?i:n}}return e}_buildParagraph(e,t){let{fragments:n,fill:r,outline:i,...a}=e,o=new hl(a,t,this);return o.fill=r,o.outline=i,n.forEach((e,t)=>{let{content:n,fill:r,outline:i,...a}=e;n!==void 0&&o.fragments.push(new ml(n,a,r,i,t,o))}),o}_canReuseLayout(e){if(!this.incrementalLayout||!this._prevParagraphs.length||e!==this._prevStyleKey||!this._prevFontsSet||this.fonts!==this._prevFonts)return!1;let t=this.computedStyle;return!(t.writingMode.includes(`vertical`)||typeof t.height==`number`&&(t.verticalAlign===`middle`||t.verticalAlign===`bottom`))}_update(){this.computedStyle=this._normalizeComputedStyle({...ql,...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=JSON.stringify([this.style,this.fill,this.outline,this.effects,this.deformation]),t=this._canReuseLayout(e),n=this.content,r=Array.from({length:n.length}),i=Array.from({length:n.length});for(let e=0;e<n.length;e++){let a=JSON.stringify(n[e]);r[e]=a;let o=this._prevParagraphs[e];if(t&&o&&o._layoutValid&&this._prevContentKeys[e]===a)o._layoutDirty=!1,i[e]=o;else{let t=this._buildParagraph(n[e],e);t._layoutDirty=!0,i[e]=t}}return this.paragraphs=i,this._pendingContentKeys=r,this._pendingStyleKey=e,this}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.paragraphs;for(let e=0;e<r.length;e++){let t=r[e];if(t._layoutDirty)for(let e of t.fragments){let t=e.characters;for(let e=0;e<t.length;e++)t[e].update(this.fonts)}}let i=this._computeGlyphBox();this.rawGlyphBox=i,this.glyphBox=i,this._prevParagraphs=this.paragraphs,this._prevContentKeys=this._pendingContentKeys,this._prevStyleKey=this._pendingStyleKey,this._prevFonts=this.fonts,this._prevFontsSet=!0;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].pathSet,n=t?._lazyCount??t?.paths.length;t&&n&&this.pathSets.push(t)}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)}_paragraphGlyphBox(e){let t=U.MAX,n=U.MIN,r=e.fragments;for(let e=0;e<r.length;e++){let i=r[e].characters;for(let e=0;e<i.length;e++){let r=i[e];if(r.getGlyphMinMax(t,n))continue;let{left:a,top:o,width:s,height:c}=r.inlineBox;t.clampMin(new U(a,o),new U(a+s,o+c)),n.clampMax(new U(a,o),new U(a+s,o+c))}}if(!(!Number.isFinite(t.x)||!Number.isFinite(t.y)||!Number.isFinite(n.x)||!Number.isFinite(n.y)))return new W(t.x,t.y,n.x-t.x,n.y-t.y)}_computeGlyphBox(){let e=this.paragraphs,t=[];for(let n=0;n<e.length;n++){let r=e[n],i=r._glyphBox;(r._layoutDirty||!i)&&(i=this._paragraphGlyphBox(r),r._glyphBox=i),i&&t.push(i)}return t.length?W.from(...t):new W(0,0,0,0)}_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 Hi(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.region=e.region,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(``)}};Kl([me({internal:!0}),Gl(`design:type`,Boolean)],Jl.prototype,`debug`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`content`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`style`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`effects`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`fill`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`outline`,void 0),Kl([me(),Gl(`design:type`,Object)],Jl.prototype,`deformation`,void 0),Kl([me({internal:!0}),Gl(`design:type`,typeof HTMLElement>`u`?Object:HTMLElement)],Jl.prototype,`measureDom`,void 0),Kl([me({internal:!0}),Gl(`design:type`,Object)],Jl.prototype,`fonts`,void 0);function Yl(e,t){let n=new Jl(e);return t?n.load().then(()=>n.measure()):n.measure()}function Xl(e,t){let n=new Jl(e);return t?n.load().then(()=>n.render(e)):n.render(e)}e.Canvas2DRenderer=Hi,e.Character=pl,e.CircleCurve=El,e.EllipseCurve=Dl,e.Fragment=ml,e.HeartCurve=Ol,e.Measurer=vl,e.Paragraph=hl,e.PolygonCurve=kl,e.RectangularCurve=Al,e.Text=Jl,e.backgroundPlugin=yl,e.createSvgLoader=Pi,e.createSvgParser=Fi,e.defineDeformation=Pl,e.definePlugin=gl,e.deformationPlugin=Ll,e.getDeformationNames=Il,e.getEffectTransform2D=Ii,e.getHighlightStyle=Rl,e.highlightPlugin=zl,e.isEqualObject=Bi,e.isEqualValue=Vi,e.listStylePlugin=Vl,e.measureText=Yl,e.outlinePlugin=Hl,e.parseColormap=zi,e.parseTransformOrigin=Li,e.parseValueNumber=Ri,e.removeDeformation=Fl,e.renderPlugin=Ul,e.renderText=Xl,e.textDecorationPlugin=Wl,e.textDefaultStyle=ql});