UNPKG

396 kBSource Map (JSON)View Raw
1{"version":3,"file":"index.js","sources":["../src/presets/offscreen.ts","../src/presets/node.ts","../src/util/string.ts","../src/util/styles.ts","../src/util/math.ts","../src/Property.ts","../src/ViewPort.ts","../src/Point.ts","../src/Mouse.ts","../src/Screen.ts","../src/Parser.ts","../src/Transform/Translate.ts","../src/Transform/Rotate.ts","../src/Transform/Scale.ts","../src/Transform/Matrix.ts","../src/Transform/Skew.ts","../src/Transform/SkewX.ts","../src/Transform/SkewY.ts","../src/Transform/Transform.ts","../src/Document/Element.ts","../src/Document/UnknownElement.ts","../src/Font.ts","../src/BoundingBox.ts","../src/Document/RenderedElement.ts","../src/Document/TextElement.ts","../src/Document/TSpanElement.ts","../src/Document/TextNode.ts","../src/PathParser.ts","../src/Document/PathElement.ts","../src/Document/SVGElement.ts","../src/Document/RectElement.ts","../src/Document/CircleElement.ts","../src/Document/EllipseElement.ts","../src/Document/LineElement.ts","../src/Document/PolylineElement.ts","../src/Document/PolygonElement.ts","../src/Document/PatternElement.ts","../src/Document/MarkerElement.ts","../src/Document/DefsElement.ts","../src/Document/GElement.ts","../src/Document/GradientElement.ts","../src/Document/LinearGradientElement.ts","../src/Document/RadialGradientElement.ts","../src/Document/StopElement.ts","../src/Document/AnimateElement.ts","../src/Document/AnimateColorElement.ts","../src/Document/AnimateTransformElement.ts","../src/Document/FontFaceElement.ts","../src/Document/GlyphElement.ts","../src/Document/MissingGlyphElement.ts","../src/Document/FontElement.ts","../src/Document/TRefElement.ts","../src/Document/AElement.ts","../src/Document/TextPathElement.ts","../src/Document/ImageElement.ts","../src/Document/SymbolElement.ts","../src/SVGFontLoader.ts","../src/Document/StyleElement.ts","../src/Document/UseElement.ts","../src/Document/FeColorMatrixElement.ts","../src/Document/MaskElement.ts","../src/Document/ClipPathElement.ts","../src/Document/FilterElement.ts","../src/Document/FeDropShadowElement.ts","../src/Document/FeMorphologyElement.ts","../src/Document/FeCompositeElement.ts","../src/Document/FeGaussianBlurElement.ts","../src/Document/TitleElement.ts","../src/Document/DescElement.ts","../src/Document/elements.ts","../src/Document/Document.ts","../src/Canvg.ts"],"sourcesContent":["import { DOMParser } from './types'\n\ninterface IConfig {\n /**\n * XML/HTML parser from string into DOM Document.\n */\n DOMParser?: DOMParser\n}\n\n/**\n * Options preset for `OffscreenCanvas`.\n * @param config - Preset requirements.\n * @param config.DOMParser - XML/HTML parser from string into DOM Document.\n * @returns Preset object.\n */\nexport function offscreen({ DOMParser: DOMParserFallback }: IConfig = {}) {\n const preset = {\n window: null,\n ignoreAnimation: true,\n ignoreMouse: true,\n DOMParser: DOMParserFallback,\n createCanvas(width: number, height: number) {\n return new OffscreenCanvas(width, height)\n },\n async createImage(url: string) {\n const response = await fetch(url)\n const blob = await response.blob()\n const img = await createImageBitmap(blob)\n\n return img\n }\n }\n\n if (typeof globalThis.DOMParser !== 'undefined'\n || typeof DOMParserFallback === 'undefined'\n ) {\n Reflect.deleteProperty(preset, 'DOMParser')\n }\n\n return preset\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { DOMParser } from './types'\n\n/**\n * `node-canvas` exports.\n */\ninterface ICanvas {\n createCanvas(width: number, height: number): any\n loadImage(src: string): Promise<any>\n}\n\n/**\n * WHATWG-compatible `fetch` function.\n */\ntype Fetch = (input: any, config?: any) => Promise<any>\n\ninterface IConfig {\n /**\n * XML/HTML parser from string into DOM Document.\n */\n DOMParser: DOMParser\n /**\n * `node-canvas` exports.\n */\n canvas: ICanvas\n /**\n * WHATWG-compatible `fetch` function.\n */\n fetch: Fetch\n}\n\n/**\n * Options preset for `node-canvas`.\n * @param config - Preset requirements.\n * @param config.DOMParser - XML/HTML parser from string into DOM Document.\n * @param config.canvas - `node-canvas` exports.\n * @param config.fetch - WHATWG-compatible `fetch` function.\n * @returns Preset object.\n */\nexport function node({\n DOMParser,\n canvas,\n fetch\n}: IConfig) {\n return {\n window: null,\n ignoreAnimation: true,\n ignoreMouse: true,\n DOMParser,\n fetch,\n createCanvas: canvas.createCanvas,\n createImage: canvas.loadImage\n }\n}\n","import { MatrixValue } from '../types'\n\n/**\n * HTML-safe compress white-spaces.\n * @param str - String to compress.\n * @returns String.\n */\nexport function compressSpaces(str: string) {\n return str.replace(/(?!\\u3000)\\s+/gm, ' ')\n}\n\n/**\n * HTML-safe left trim.\n * @param str - String to trim.\n * @returns String.\n */\nexport function trimLeft(str: string) {\n return str.replace(/^[\\n \\t]+/, '')\n}\n\n/**\n * HTML-safe right trim.\n * @param str - String to trim.\n * @returns String.\n */\nexport function trimRight(str: string) {\n return str.replace(/[\\n \\t]+$/, '')\n}\n\n/**\n * String to numbers array.\n * @param str - Numbers string.\n * @returns Numbers array.\n */\nexport function toNumbers(str: string) {\n const matches = str.match(/-?(\\d+(?:\\.\\d*(?:[eE][+-]?\\d+)?)?|\\.\\d+)(?=\\D|$)/gm)\n\n return matches ? matches.map(parseFloat) : []\n}\n\n/**\n * String to matrix value.\n * @param str - Numbers string.\n * @returns Matrix value.\n */\nexport function toMatrixValue(str: string): MatrixValue {\n const numbers = toNumbers(str)\n const matrix = [\n numbers[0] || 0,\n numbers[1] || 0,\n numbers[2] || 0,\n numbers[3] || 0,\n numbers[4] || 0,\n numbers[5] || 0\n ] as const\n\n return matrix\n}\n\n// Microsoft Edge fix\nconst allUppercase = /^[A-Z-]+$/\n\n/**\n * Normalize attribute name.\n * @param name - Attribute name.\n * @returns Normalized attribute name.\n */\nexport function normalizeAttributeName(name: string) {\n if (allUppercase.test(name)) {\n return name.toLowerCase()\n }\n\n return name\n}\n\n/**\n * Parse external URL.\n * @param url - CSS url string.\n * @returns Parsed URL.\n */\nexport function parseExternalUrl(url: string): string {\n // single quotes [2]\n // v double quotes [3]\n // v v no quotes [4]\n // v v v\n const urlMatch = /url\\(('([^']+)'|\"([^\"]+)\"|([^'\")]+))\\)/.exec(url)\n\n if (!urlMatch) {\n return ''\n }\n\n return urlMatch[2] || urlMatch[3] || urlMatch[4] || ''\n}\n\n/**\n * Transform floats to integers in rgb colors.\n * @param color - Color to normalize.\n * @returns Normalized color.\n */\nexport function normalizeColor(color: string) {\n if (!color.startsWith('rgb')) {\n return color\n }\n\n let rgbParts = 3\n const normalizedColor = color.replace(\n /\\d+(\\.\\d+)?/g,\n (num, isFloat) => (rgbParts-- && isFloat\n ? String(Math.round(parseFloat(num)))\n : num)\n )\n\n return normalizedColor\n}\n","\n// slightly modified version of https://github.com/keeganstreet/specificity/blob/master/specificity.js\nconst attributeRegex = /(\\[[^\\]]+\\])/g\nconst idRegex = /(#[^\\s+>~.[:]+)/g\nconst classRegex = /(\\.[^\\s+>~.[:]+)/g\nconst pseudoElementRegex = /(::[^\\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi\nconst pseudoClassWithBracketsRegex = /(:[\\w-]+\\([^)]*\\))/gi\nconst pseudoClassRegex = /(:[^\\s+>~.[:]+)/g\nconst elementRegex = /([^\\s+>~.[:]+)/g\n\nfunction findSelectorMatch(selector: string, regex: RegExp): [string, number] {\n const matches = regex.exec(selector)\n\n if (!matches) {\n return [selector, 0]\n }\n\n return [selector.replace(regex, ' '), matches.length]\n}\n\n/**\n * Measure selector specificity.\n * @param selector - Selector to measure.\n * @returns Specificity.\n */\nexport function getSelectorSpecificity(selector: string) {\n const specificity = [\n 0,\n 0,\n 0\n ]\n let currentSelector = selector\n .replace(/:not\\(([^)]*)\\)/g, ' $1 ')\n .replace(/{[\\s\\S]*/gm, ' ')\n let delta = 0;\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, attributeRegex)\n specificity[1] += delta;\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, idRegex)\n specificity[0] += delta;\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, classRegex)\n specificity[1] += delta;\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, pseudoElementRegex)\n specificity[2] += delta;\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, pseudoClassWithBracketsRegex)\n specificity[1] += delta;\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, pseudoClassRegex)\n specificity[1] += delta\n\n currentSelector = currentSelector\n .replace(/[*\\s+>~]/g, ' ')\n .replace(/[#.]/g, ' ');\n\n [currentSelector, delta] = findSelectorMatch(currentSelector, elementRegex) // lgtm [js/useless-assignment-to-local]\n specificity[2] += delta\n\n return specificity.join('')\n}\n","import { VectorValue } from '../types'\n\nexport const PSEUDO_ZERO = .00000001\n\n/**\n * Vector magnitude.\n * @param v\n * @returns Number result.\n */\nexport function vectorMagnitude(v: VectorValue) {\n return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2))\n}\n\n/**\n * Ratio between two vectors.\n * @param u\n * @param v\n * @returns Number result.\n */\nexport function vectorsRatio(u: VectorValue, v: VectorValue) {\n return (u[0] * v[0] + u[1] * v[1]) / (vectorMagnitude(u) * vectorMagnitude(v))\n}\n\n/**\n * Angle between two vectors.\n * @param u\n * @param v\n * @returns Number result.\n */\nexport function vectorsAngle(u: VectorValue, v: VectorValue) {\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vectorsRatio(u, v))\n}\n\nexport function CB1(t: number) {\n return t * t * t\n}\n\nexport function CB2(t: number) {\n return 3 * t * t * (1 - t)\n}\n\nexport function CB3(t: number) {\n return 3 * t * (1 - t) * (1 - t)\n}\n\nexport function CB4(t: number) {\n return (1 - t) * (1 - t) * (1 - t)\n}\n\nexport function QB1(t: number) {\n return t * t\n}\n\nexport function QB2(t: number) {\n return 2 * t * (1 - t)\n}\n\nexport function QB3(t: number) {\n return (1 - t) * (1 - t)\n}\n","import RGBColor from 'rgbcolor'\nimport {\n compressSpaces,\n normalizeColor\n} from './util'\nimport { Axis } from './ViewPort'\nimport {\n Document,\n Element,\n PathElement,\n PatternElement,\n GradientElement\n} from './Document'\n\nexport class Property<T = unknown> {\n static empty(document: Document) {\n return new Property(document, 'EMPTY', '')\n }\n\n static readonly textBaselineMapping: Record<string, string> = {\n 'baseline': 'alphabetic',\n 'before-edge': 'top',\n 'text-before-edge': 'top',\n 'middle': 'middle',\n 'central': 'middle',\n 'after-edge': 'bottom',\n 'text-after-edge': 'bottom',\n 'ideographic': 'ideographic',\n 'alphabetic': 'alphabetic',\n 'hanging': 'hanging',\n 'mathematical': 'alphabetic'\n }\n\n private isNormalizedColor = false\n\n constructor(\n private readonly document: Document,\n private readonly name: string,\n private value: T\n ) {}\n\n split(separator = ' ') {\n const {\n document,\n name\n } = this\n\n return compressSpaces(this.getString())\n .trim()\n .split(separator)\n .map(value => new Property<string>(document, name, value))\n }\n\n hasValue(zeroIsValue?: boolean) {\n const value = this.value as unknown\n\n return value !== null\n && value !== ''\n && (zeroIsValue || value !== 0)\n && typeof value !== 'undefined'\n }\n\n isString(regexp?: RegExp) {\n const { value } = this\n const result = typeof value === 'string'\n\n if (!result || !regexp) {\n return result\n }\n\n return regexp.test(value)\n }\n\n isUrlDefinition() {\n return this.isString(/^url\\(/)\n }\n\n isPixels() {\n if (!this.hasValue()) {\n return false\n }\n\n const asString = this.getString()\n\n switch (true) {\n case asString.endsWith('px'):\n case /^[0-9]+$/.test(asString):\n return true\n\n default:\n return false\n }\n }\n\n setValue(value: T) {\n this.value = value\n return this\n }\n\n getValue(def?: T) {\n if (typeof def === 'undefined' || this.hasValue()) {\n return this.value\n }\n\n return def\n }\n\n getNumber(def?: T) {\n if (!this.hasValue()) {\n if (typeof def === 'undefined') {\n return 0\n }\n\n // @ts-expect-error Parse unknown value.\n return parseFloat(def)\n }\n\n const { value } = this\n // @ts-expect-error Parse unknown value.\n let n = parseFloat(value)\n\n if (this.isString(/%$/)) {\n n /= 100.0\n }\n\n return n\n }\n\n getString(def?: T) {\n if (typeof def === 'undefined' || this.hasValue()) {\n return typeof this.value === 'undefined'\n ? ''\n : String(this.value)\n }\n\n return String(def)\n }\n\n getColor(def?: T) {\n let color = this.getString(def)\n\n if (this.isNormalizedColor) {\n return color\n }\n\n this.isNormalizedColor = true\n color = normalizeColor(color)\n this.value = color as unknown as T\n\n return color\n }\n\n getDpi() {\n return 96.0 // TODO: compute?\n }\n\n getRem() {\n return this.document.rootEmSize\n }\n\n getEm() {\n return this.document.emSize\n }\n\n getUnits() {\n return this.getString().replace(/[0-9.-]/g, '')\n }\n\n getPixels(axis?: Axis, processPercent?: boolean): number\n getPixels(isFontSize?: boolean): number\n getPixels(axisOrIsFontSize?: Axis | boolean, processPercent = false): number {\n if (!this.hasValue()) {\n return 0\n }\n\n const [axis, isFontSize] = typeof axisOrIsFontSize === 'boolean'\n ? [undefined, axisOrIsFontSize]\n : [axisOrIsFontSize]\n const { viewPort } = this.document.screen\n\n switch (true) {\n case this.isString(/vmin$/):\n return this.getNumber()\n / 100.0\n * Math.min(\n viewPort.computeSize('x'),\n viewPort.computeSize('y')\n )\n\n case this.isString(/vmax$/):\n return this.getNumber()\n / 100.0\n * Math.max(\n viewPort.computeSize('x'),\n viewPort.computeSize('y')\n )\n\n case this.isString(/vw$/):\n return this.getNumber()\n / 100.0\n * viewPort.computeSize('x')\n\n case this.isString(/vh$/):\n return this.getNumber()\n / 100.0\n * viewPort.computeSize('y')\n\n case this.isString(/rem$/):\n return this.getNumber() * this.getRem(/* viewPort */)\n\n case this.isString(/em$/):\n return this.getNumber() * this.getEm(/* viewPort */)\n\n case this.isString(/ex$/):\n return this.getNumber() * this.getEm(/* viewPort */) / 2.0\n\n case this.isString(/px$/):\n return this.getNumber()\n\n case this.isString(/pt$/):\n return this.getNumber() * this.getDpi(/* viewPort */) * (1.0 / 72.0)\n\n case this.isString(/pc$/):\n return this.getNumber() * 15\n\n case this.isString(/cm$/):\n return this.getNumber() * this.getDpi(/* viewPort */) / 2.54\n\n case this.isString(/mm$/):\n return this.getNumber() * this.getDpi(/* viewPort */) / 25.4\n\n case this.isString(/in$/):\n return this.getNumber() * this.getDpi(/* viewPort */)\n\n case this.isString(/%$/) && isFontSize:\n return this.getNumber() * this.getEm(/* viewPort */)\n\n case this.isString(/%$/):\n return this.getNumber() * viewPort.computeSize(axis)\n\n default: {\n const n = this.getNumber()\n\n if (processPercent && n < 1.0) {\n return n * viewPort.computeSize(axis)\n }\n\n return n\n }\n }\n }\n\n getMilliseconds() {\n if (!this.hasValue()) {\n return 0\n }\n\n if (this.isString(/ms$/)) {\n return this.getNumber()\n }\n\n return this.getNumber() * 1000\n }\n\n getRadians() {\n if (!this.hasValue()) {\n return 0\n }\n\n switch (true) {\n case this.isString(/deg$/):\n return this.getNumber() * (Math.PI / 180.0)\n\n case this.isString(/grad$/):\n return this.getNumber() * (Math.PI / 200.0)\n\n case this.isString(/rad$/):\n return this.getNumber()\n\n default:\n return this.getNumber() * (Math.PI / 180.0)\n }\n }\n\n getDefinition<T extends Element>() {\n const asString = this.getString()\n const match = /#([^)'\"]+)/.exec(asString)\n const name = match?.[1] || asString\n\n return this.document.definitions[name] as T | undefined\n }\n\n getFillStyleDefinition(element: Element | PathElement, opacity: Property) {\n let def = this.getDefinition<PatternElement & GradientElement>()\n\n if (!def) {\n return null\n }\n\n // gradient\n if (typeof def.createGradient === 'function' && 'getBoundingBox' in element) {\n return def.createGradient(\n this.document.ctx,\n element,\n opacity\n )\n }\n\n // pattern\n if (typeof def.createPattern === 'function') {\n if (def.getHrefAttribute().hasValue()) {\n const patternTransform = def.getAttribute('patternTransform')\n\n def = def.getHrefAttribute().getDefinition()\n\n if (def && patternTransform.hasValue()) {\n def.getAttribute('patternTransform', true).setValue(patternTransform.value)\n }\n }\n\n if (def) {\n return def.createPattern(this.document.ctx, element, opacity)\n }\n }\n\n return null\n }\n\n getTextBaseline() {\n if (!this.hasValue()) {\n return null\n }\n\n const key = this.getString()\n\n return Property.textBaselineMapping[key] || null\n }\n\n addOpacity(opacity: Property) {\n let value = this.getColor()\n const len = value.length\n let commas = 0\n\n // Simulate old RGBColor version, which can't parse rgba.\n for (let i = 0; i < len; i++) {\n if (value[i] === ',') {\n commas++\n }\n\n if (commas === 3) {\n break\n }\n }\n\n if (opacity.hasValue() && this.isString() && commas !== 3) {\n const color = new RGBColor(value)\n\n if (color.ok) {\n color.alpha = opacity.getNumber()\n value = color.toRGBA()\n }\n }\n\n return new Property<string>(this.document, this.name, value)\n }\n}\n","\nexport interface IViewPortSize {\n width: number\n height: number\n}\n\nexport type Axis = 'x' | 'y'\n\nexport class ViewPort {\n static DEFAULT_VIEWPORT_WIDTH = 800\n static DEFAULT_VIEWPORT_HEIGHT = 600\n\n viewPorts: IViewPortSize[] = []\n\n clear() {\n this.viewPorts = []\n }\n\n setCurrent(width: number, height: number) {\n this.viewPorts.push({\n width,\n height\n })\n }\n\n removeCurrent() {\n this.viewPorts.pop()\n }\n\n getRoot() {\n const [root] = this.viewPorts\n\n if (!root) {\n return getDefault()\n }\n\n return root\n }\n\n getCurrent() {\n const { viewPorts } = this\n const current = viewPorts[viewPorts.length - 1]\n\n if (!current) {\n return getDefault()\n }\n\n return current\n }\n\n get width() {\n return this.getCurrent().width\n }\n\n get height() {\n return this.getCurrent().height\n }\n\n computeSize(d?: number|Axis) {\n if (typeof d === 'number') {\n return d\n }\n\n if (d === 'x') {\n return this.width\n }\n\n if (d === 'y') {\n return this.height\n }\n\n return Math.sqrt(\n Math.pow(this.width, 2) + Math.pow(this.height, 2)\n ) / Math.sqrt(2)\n }\n}\n\nfunction getDefault() {\n return {\n width: ViewPort.DEFAULT_VIEWPORT_WIDTH,\n height: ViewPort.DEFAULT_VIEWPORT_HEIGHT\n }\n}\n","import { MatrixValue } from './types'\nimport { toNumbers } from './util'\n\nexport class Point {\n static parse(point: string, defaultValue = 0) {\n const [x = defaultValue, y = defaultValue] = toNumbers(point)\n\n return new Point(x, y)\n }\n\n static parseScale(scale: string, defaultValue = 1) {\n const [x = defaultValue, y = x] = toNumbers(scale)\n\n return new Point(x, y)\n }\n\n static parsePath(path: string) {\n const points = toNumbers(path)\n const len = points.length\n const pathPoints: Point[] = []\n\n for (let i = 0; i < len; i += 2) {\n pathPoints.push(new Point(points[i], points[i + 1]))\n }\n\n return pathPoints\n }\n\n constructor(\n public x: number,\n public y: number\n ) {}\n\n angleTo(point: Point) {\n return Math.atan2(point.y - this.y, point.x - this.x)\n }\n\n applyTransform(transform: MatrixValue) {\n const {\n x,\n y\n } = this\n const xp = x * transform[0] + y * transform[2] + transform[4]\n const yp = x * transform[1] + y * transform[3] + transform[5]\n\n this.x = xp\n this.y = yp\n }\n}\n","import { RenderingContext2D } from './types'\nimport { BoundingBox } from './BoundingBox'\nimport { Point } from './Point'\nimport { Screen } from './Screen'\nimport { Element } from './Document'\n\ninterface IEventTarget {\n onClick?(): void\n onMouseMove?(): void\n}\n\nexport interface IEvent {\n type: string\n x: number\n y: number\n run(eventTarget: IEventTarget): void\n}\n\nexport class Mouse {\n private working = false\n private events: IEvent[] = []\n private eventElements: Element[] = []\n\n constructor(\n private readonly screen: Screen\n ) {\n this.onClick = this.onClick.bind(this)\n this.onMouseMove = this.onMouseMove.bind(this)\n }\n\n isWorking() {\n return this.working\n }\n\n start() {\n if (this.working) {\n return\n }\n\n const {\n screen,\n onClick,\n onMouseMove\n } = this\n const canvas = screen.ctx.canvas as HTMLCanvasElement\n\n canvas.onclick = onClick\n canvas.onmousemove = onMouseMove\n this.working = true\n }\n\n stop() {\n if (!this.working) {\n return\n }\n\n const canvas = this.screen.ctx.canvas as HTMLCanvasElement\n\n this.working = false\n canvas.onclick = null\n canvas.onmousemove = null\n }\n\n hasEvents() {\n return this.working && this.events.length > 0\n }\n\n runEvents() {\n if (!this.working) {\n return\n }\n\n const {\n screen: document,\n events,\n eventElements\n } = this\n const { style } = document.ctx.canvas as HTMLCanvasElement\n let element: Element | null | undefined\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (style) {\n style.cursor = ''\n }\n\n events.forEach(({ run }, i) => {\n element = eventElements[i]\n\n while (element) {\n run(element as IEventTarget)\n element = element.parent\n }\n })\n\n // done running, clear\n this.events = []\n this.eventElements = []\n }\n\n checkPath(element: Element, ctx: RenderingContext2D | null) {\n if (!this.working || !ctx) {\n return\n }\n\n const {\n events,\n eventElements\n } = this\n\n events.forEach(({ x, y }, i) => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!eventElements[i] && ctx.isPointInPath && ctx.isPointInPath(x, y)) {\n eventElements[i] = element\n }\n })\n }\n\n checkBoundingBox(element: Element, boundingBox: BoundingBox | null) {\n if (!this.working || !boundingBox) {\n return\n }\n\n const {\n events,\n eventElements\n } = this\n\n events.forEach(({ x, y }, i) => {\n if (!eventElements[i] && boundingBox.isPointInBox(x, y)) {\n eventElements[i] = element\n }\n })\n }\n\n private mapXY(x: number, y: number) {\n const {\n window,\n ctx\n } = this.screen\n const point = new Point(x, y)\n let element = ctx.canvas as HTMLElement | null\n\n while (element) {\n point.x -= element.offsetLeft\n point.y -= element.offsetTop\n element = element.offsetParent as HTMLElement | null\n }\n\n if (window?.scrollX) {\n point.x += window.scrollX\n }\n\n if (window?.scrollY) {\n point.y += window.scrollY\n }\n\n return point\n }\n\n private onClick(event: MouseEvent) {\n const {\n x,\n y\n } = this.mapXY(\n event.clientX,\n event.clientY\n )\n\n this.events.push({\n type: 'onclick',\n x,\n y,\n run(eventTarget) {\n if (eventTarget.onClick) {\n eventTarget.onClick()\n }\n }\n })\n }\n\n private onMouseMove(event: MouseEvent) {\n const {\n x,\n y\n } = this.mapXY(\n event.clientX,\n event.clientY\n )\n\n this.events.push({\n type: 'onmousemove',\n x,\n y,\n run(eventTarget) {\n if (eventTarget.onMouseMove) {\n eventTarget.onMouseMove()\n }\n }\n })\n }\n}\n","import requestAnimationFrame from 'raf'\nimport {\n RenderingContext2D,\n Fetch\n} from './types'\nimport {\n compressSpaces,\n toNumbers\n} from './util'\nimport { Property } from './Property'\nimport { ViewPort } from './ViewPort'\nimport { Mouse } from './Mouse'\nimport {\n Document,\n Element,\n AnimateElement\n} from './Document'\n\nexport interface IScreenOptions {\n /**\n * Window object.\n */\n window?: Window | null\n /**\n * WHATWG-compatible `fetch` function.\n */\n fetch?: Fetch\n}\n\nexport interface IScreenStartOptions {\n /**\n * Whether enable the redraw.\n */\n enableRedraw?: boolean\n /**\n * Ignore mouse events.\n */\n ignoreMouse?: boolean\n /**\n * Ignore animations.\n */\n ignoreAnimation?: boolean\n /**\n * Does not try to resize canvas.\n */\n ignoreDimensions?: boolean\n /**\n * Does not clear canvas.\n */\n ignoreClear?: boolean\n /**\n * Scales horizontally to width.\n */\n scaleWidth?: number\n /**\n * Scales vertically to height.\n */\n scaleHeight?: number\n /**\n * Draws at a x offset.\n */\n offsetX?: number\n /**\n * Draws at a y offset.\n */\n offsetY?: number\n /**\n * Will call the function on every frame, if it returns true, will redraw.\n */\n forceRedraw?(): boolean\n}\n\nexport interface IScreenViewBoxConfig {\n document: Document\n ctx: RenderingContext2D\n aspectRatio: string\n width: number\n desiredWidth: number\n height: number\n desiredHeight: number\n minX?: number\n minY?: number\n refX?: number\n refY?: number\n clip?: boolean\n clipX?: number\n clipY?: number\n}\n\nconst defaultWindow = typeof window !== 'undefined'\n ? window\n : null\nconst defaultFetch = typeof fetch !== 'undefined'\n ? fetch.bind(undefined) // `fetch` depends on context: `someObject.fetch(...)` will throw error.\n : undefined\n\nexport class Screen {\n static readonly defaultWindow = defaultWindow\n static readonly defaultFetch = defaultFetch\n static FRAMERATE = 30\n static MAX_VIRTUAL_PIXELS = 30000\n\n readonly window: Window | null\n readonly fetch: Fetch\n readonly viewPort = new ViewPort()\n readonly mouse = new Mouse(this)\n readonly animations: AnimateElement[] = []\n private readyPromise: Promise<void> | undefined\n private resolveReady: (() => void) | undefined\n private waits: (() => boolean)[] = []\n private frameDuration = 0\n private isReadyLock = false\n private isFirstRender = true\n private intervalId: number | null = null\n\n constructor(\n readonly ctx: RenderingContext2D,\n {\n fetch = defaultFetch,\n window = defaultWindow\n }: IScreenOptions = {}\n ) {\n this.window = window\n\n if (!fetch) {\n throw new Error(`Can't find 'fetch' in 'globalThis', please provide it via options`)\n }\n\n this.fetch = fetch\n }\n\n wait(checker: () => boolean) {\n this.waits.push(checker)\n }\n\n ready() {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (!this.readyPromise) {\n return Promise.resolve()\n }\n\n return this.readyPromise\n }\n\n isReady() {\n if (this.isReadyLock) {\n return true\n }\n\n const isReadyLock = this.waits.every(_ => _())\n\n if (isReadyLock) {\n this.waits = []\n\n if (this.resolveReady) {\n this.resolveReady()\n }\n }\n\n this.isReadyLock = isReadyLock\n\n return isReadyLock\n }\n\n setDefaults(ctx: RenderingContext2D) {\n // initial values and defaults\n ctx.strokeStyle = 'rgba(0,0,0,0)'\n ctx.lineCap = 'butt'\n ctx.lineJoin = 'miter'\n ctx.miterLimit = 4\n }\n\n setViewBox({\n document,\n ctx,\n aspectRatio,\n width,\n desiredWidth,\n height,\n desiredHeight,\n minX = 0,\n minY = 0,\n refX,\n refY,\n clip = false,\n clipX = 0,\n clipY = 0\n }: IScreenViewBoxConfig) {\n // aspect ratio - http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute\n const cleanAspectRatio = compressSpaces(aspectRatio).replace(/^defer\\s/, '') // ignore defer\n const [aspectRatioAlign, aspectRatioMeetOrSlice] = cleanAspectRatio.split(' ')\n const align = aspectRatioAlign || 'xMidYMid'\n const meetOrSlice = aspectRatioMeetOrSlice || 'meet'\n // calculate scale\n const scaleX = width / desiredWidth\n const scaleY = height / desiredHeight\n const scaleMin = Math.min(scaleX, scaleY)\n const scaleMax = Math.max(scaleX, scaleY)\n let finalDesiredWidth = desiredWidth\n let finalDesiredHeight = desiredHeight\n\n if (meetOrSlice === 'meet') {\n finalDesiredWidth *= scaleMin\n finalDesiredHeight *= scaleMin\n }\n\n if (meetOrSlice === 'slice') {\n finalDesiredWidth *= scaleMax\n finalDesiredHeight *= scaleMax\n }\n\n const refXProp = new Property(document, 'refX', refX)\n const refYProp = new Property(document, 'refY', refY)\n const hasRefs = refXProp.hasValue() && refYProp.hasValue()\n\n if (hasRefs) {\n ctx.translate(\n -scaleMin * refXProp.getPixels('x'),\n -scaleMin * refYProp.getPixels('y')\n )\n }\n\n if (clip) {\n const scaledClipX = scaleMin * clipX\n const scaledClipY = scaleMin * clipY\n\n ctx.beginPath()\n ctx.moveTo(scaledClipX, scaledClipY)\n ctx.lineTo(width, scaledClipY)\n ctx.lineTo(width, height)\n ctx.lineTo(scaledClipX, height)\n ctx.closePath()\n ctx.clip()\n }\n\n if (!hasRefs) {\n const isMeetMinY = meetOrSlice === 'meet' && scaleMin === scaleY\n const isSliceMaxY = meetOrSlice === 'slice' && scaleMax === scaleY\n const isMeetMinX = meetOrSlice === 'meet' && scaleMin === scaleX\n const isSliceMaxX = meetOrSlice === 'slice' && scaleMax === scaleX\n\n if (align.startsWith('xMid') && (\n isMeetMinY || isSliceMaxY\n )) {\n ctx.translate(width / 2.0 - finalDesiredWidth / 2.0, 0)\n }\n\n if (align.endsWith('YMid') && (\n isMeetMinX || isSliceMaxX\n )) {\n ctx.translate(0, height / 2.0 - finalDesiredHeight / 2.0)\n }\n\n if (align.startsWith('xMax') && (\n isMeetMinY || isSliceMaxY\n )) {\n ctx.translate(width - finalDesiredWidth, 0)\n }\n\n if (align.endsWith('YMax') && (\n isMeetMinX || isSliceMaxX\n )) {\n ctx.translate(0, height - finalDesiredHeight)\n }\n }\n\n // scale\n switch (true) {\n case align === 'none':\n ctx.scale(scaleX, scaleY)\n break\n\n case meetOrSlice === 'meet':\n ctx.scale(scaleMin, scaleMin)\n break\n\n case meetOrSlice === 'slice':\n ctx.scale(scaleMax, scaleMax)\n break\n }\n\n // translate\n ctx.translate(-minX, -minY)\n }\n\n start(\n element: Element,\n {\n enableRedraw = false,\n ignoreMouse = false,\n ignoreAnimation = false,\n ignoreDimensions = false,\n ignoreClear = false,\n forceRedraw,\n scaleWidth,\n scaleHeight,\n offsetX,\n offsetY\n }: IScreenStartOptions = {}\n ) {\n const { mouse } = this\n const frameDuration = 1000 / Screen.FRAMERATE\n\n this.isReadyLock = false\n this.frameDuration = frameDuration\n this.readyPromise = new Promise((resolve) => {\n this.resolveReady = resolve\n })\n\n if (this.isReady()) {\n this.render(\n element,\n ignoreDimensions,\n ignoreClear,\n scaleWidth,\n scaleHeight,\n offsetX,\n offsetY\n )\n }\n\n if (!enableRedraw) {\n return\n }\n\n let now = Date.now()\n let then = now\n let delta = 0\n const tick = () => {\n now = Date.now()\n delta = now - then\n\n if (delta >= frameDuration) {\n then = now - (delta % frameDuration)\n\n if (this.shouldUpdate(\n ignoreAnimation,\n forceRedraw\n )) {\n this.render(\n element,\n ignoreDimensions,\n ignoreClear,\n scaleWidth,\n scaleHeight,\n offsetX,\n offsetY\n )\n mouse.runEvents()\n }\n }\n\n this.intervalId = requestAnimationFrame(tick)\n }\n\n if (!ignoreMouse) {\n mouse.start()\n }\n\n this.intervalId = requestAnimationFrame(tick)\n }\n\n stop() {\n if (this.intervalId) {\n requestAnimationFrame.cancel(this.intervalId)\n this.intervalId = null\n }\n\n this.mouse.stop()\n }\n\n private shouldUpdate(\n ignoreAnimation: boolean,\n forceRedraw: (() => boolean) | undefined\n ) {\n // need update from animations?\n if (!ignoreAnimation) {\n const { frameDuration } = this\n const shouldUpdate = this.animations.reduce(\n (shouldUpdate, animation) => animation.update(frameDuration) || shouldUpdate,\n false\n )\n\n if (shouldUpdate) {\n return true\n }\n }\n\n // need update from redraw?\n if (typeof forceRedraw === 'function' && forceRedraw()) {\n return true\n }\n\n if (!this.isReadyLock && this.isReady()) {\n return true\n }\n\n // need update from mouse events?\n if (this.mouse.hasEvents()) {\n return true\n }\n\n return false\n }\n\n private render(\n element: Element,\n ignoreDimensions: boolean,\n ignoreClear: boolean,\n scaleWidth: number | undefined,\n scaleHeight: number | undefined,\n offsetX: number | undefined,\n offsetY: number | undefined\n ) {\n const {\n viewPort,\n ctx,\n isFirstRender\n } = this\n const canvas = ctx.canvas as HTMLCanvasElement\n\n viewPort.clear()\n\n if (canvas.width && canvas.height) {\n viewPort.setCurrent(canvas.width, canvas.height)\n }\n\n const widthStyle = element.getStyle('width')\n const heightStyle = element.getStyle('height')\n\n if (!ignoreDimensions && (\n isFirstRender\n || typeof scaleWidth !== 'number' && typeof scaleHeight !== 'number'\n )) {\n // set canvas size\n if (widthStyle.hasValue()) {\n canvas.width = widthStyle.getPixels('x')\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (canvas.style) {\n canvas.style.width = `${canvas.width}px`\n }\n }\n\n if (heightStyle.hasValue()) {\n canvas.height = heightStyle.getPixels('y')\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (canvas.style) {\n canvas.style.height = `${canvas.height}px`\n }\n }\n }\n\n let cWidth = canvas.clientWidth || canvas.width\n let cHeight = canvas.clientHeight || canvas.height\n\n if (ignoreDimensions && widthStyle.hasValue() && heightStyle.hasValue()) {\n cWidth = widthStyle.getPixels('x')\n cHeight = heightStyle.getPixels('y')\n }\n\n viewPort.setCurrent(cWidth, cHeight)\n\n if (typeof offsetX === 'number') {\n element.getAttribute('x', true).setValue(offsetX)\n }\n\n if (typeof offsetY === 'number') {\n element.getAttribute('y', true).setValue(offsetY)\n }\n\n if (typeof scaleWidth === 'number'\n || typeof scaleHeight === 'number'\n ) {\n const viewBox = toNumbers(element.getAttribute('viewBox').getString())\n let xRatio = 0\n let yRatio = 0\n\n if (typeof scaleWidth === 'number') {\n const widthStyle = element.getStyle('width')\n\n if (widthStyle.hasValue()) {\n xRatio = widthStyle.getPixels('x') / scaleWidth\n } else\n if (viewBox[2] && !isNaN(viewBox[2])) {\n xRatio = viewBox[2] / scaleWidth\n }\n }\n\n if (typeof scaleHeight === 'number') {\n const heightStyle = element.getStyle('height')\n\n if (heightStyle.hasValue()) {\n yRatio = heightStyle.getPixels('y') / scaleHeight\n } else\n if (viewBox[3] && !isNaN(viewBox[3])) {\n yRatio = viewBox[3] / scaleHeight\n }\n }\n\n if (!xRatio) {\n xRatio = yRatio\n }\n\n if (!yRatio) {\n yRatio = xRatio\n }\n\n element.getAttribute('width', true).setValue(scaleWidth)\n element.getAttribute('height', true).setValue(scaleHeight)\n\n const transformStyle = element.getStyle('transform', true, true)\n\n transformStyle.setValue(`${transformStyle.getString()} scale(${1.0 / xRatio}, ${1.0 / yRatio})`)\n }\n\n // clear and render\n if (!ignoreClear) {\n ctx.clearRect(0, 0, cWidth, cHeight)\n }\n\n element.render(ctx)\n\n if (isFirstRender) {\n this.isFirstRender = false\n }\n }\n}\n","import { Fetch } from './types'\nimport { Screen } from './Screen'\n\ntype DOMParserConstructor = typeof DOMParser\n\nexport interface IParserOptions {\n /**\n * WHATWG-compatible `fetch` function.\n */\n fetch?: Fetch\n /**\n * XML/HTML parser from string into DOM Document.\n */\n DOMParser?: DOMParserConstructor\n}\n\nconst { defaultFetch } = Screen\nconst DefaultDOMParser = typeof DOMParser !== 'undefined'\n ? DOMParser\n : undefined\n\nexport class Parser {\n private readonly fetch: Fetch\n private readonly DOMParser: DOMParserConstructor\n\n constructor({\n fetch = defaultFetch,\n DOMParser = DefaultDOMParser\n }: IParserOptions = {}) {\n if (!fetch) {\n throw new Error(`Can't find 'fetch' in 'globalThis', please provide it via options`)\n }\n\n if (!DOMParser) {\n throw new Error(`Can't find 'DOMParser' in 'globalThis', please provide it via options`)\n }\n\n this.fetch = fetch\n this.DOMParser = DOMParser\n }\n\n async parse(resource: string) {\n if (resource.startsWith('<')) {\n return this.parseFromString(resource)\n }\n\n return this.load(resource)\n }\n\n parseFromString(xml: string) {\n const parser = new this.DOMParser()\n\n try {\n return this.checkDocument(\n parser.parseFromString(xml, 'image/svg+xml')\n )\n } catch (err) {\n return this.checkDocument(\n parser.parseFromString(xml, 'text/xml')\n )\n }\n }\n\n private checkDocument(document: Document) {\n const parserError = document.getElementsByTagName('parsererror')[0]\n\n if (parserError) {\n throw new Error(parserError.textContent || 'Unknown parse error')\n }\n\n return document\n }\n\n async load(url: string) {\n const response = await this.fetch(url)\n const xml = await response.text()\n\n return this.parseFromString(xml)\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Document } from '../Document'\nimport { Point } from '../Point'\n\nexport class Translate {\n type = 'translate'\n private readonly point: Point\n\n constructor(\n _: Document,\n point: string\n ) {\n this.point = Point.parse(point)\n }\n\n apply(ctx: RenderingContext2D) {\n const {\n x,\n y\n } = this.point\n\n ctx.translate(\n x || 0.0,\n y || 0.0\n )\n }\n\n unapply(ctx: RenderingContext2D) {\n const {\n x,\n y\n } = this.point\n\n ctx.translate(\n -1.0 * x || 0.0,\n -1.0 * y || 0.0\n )\n }\n\n applyToPoint(point: Point) {\n const {\n x,\n y\n } = this.point\n\n point.applyTransform([\n 1,\n 0,\n 0,\n 1,\n x || 0.0,\n y || 0.0\n ])\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { toNumbers } from '../util'\nimport { Document } from '../Document'\nimport { Property } from '../Property'\nimport { Point } from '../Point'\n\nexport class Rotate {\n type = 'rotate'\n private readonly angle: Property\n private readonly originX: Property\n private readonly originY: Property\n private readonly cx: number\n private readonly cy: number\n\n constructor(\n document: Document,\n rotate: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n const numbers = toNumbers(rotate)\n\n this.angle = new Property(document, 'angle', numbers[0])\n this.originX = transformOrigin[0]\n this.originY = transformOrigin[1]\n this.cx = numbers[1] || 0\n this.cy = numbers[2] || 0\n }\n\n apply(ctx: RenderingContext2D) {\n const {\n cx,\n cy,\n originX,\n originY,\n angle\n } = this\n const tx = cx + originX.getPixels('x')\n const ty = cy + originY.getPixels('y')\n\n ctx.translate(tx, ty)\n ctx.rotate(angle.getRadians())\n ctx.translate(-tx, -ty)\n }\n\n unapply(ctx: RenderingContext2D) {\n const {\n cx,\n cy,\n originX,\n originY,\n angle\n } = this\n const tx = cx + originX.getPixels('x')\n const ty = cy + originY.getPixels('y')\n\n ctx.translate(tx, ty)\n ctx.rotate(-1.0 * angle.getRadians())\n ctx.translate(-tx, -ty)\n }\n\n applyToPoint(point: Point) {\n const {\n cx,\n cy,\n angle\n } = this\n const rad = angle.getRadians()\n\n point.applyTransform([\n 1,\n 0,\n 0,\n 1,\n cx || 0.0, // this.p.x\n cy || 0.0 // this.p.y\n ])\n point.applyTransform([\n Math.cos(rad),\n Math.sin(rad),\n -Math.sin(rad),\n Math.cos(rad),\n 0,\n 0\n ])\n point.applyTransform([\n 1,\n 0,\n 0,\n 1,\n -cx || 0.0, // -this.p.x\n -cy || 0.0 // -this.p.y\n ])\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { PSEUDO_ZERO } from '../util'\nimport { Document } from '../Document'\nimport { Point } from '../Point'\nimport { Property } from '../Property'\n\nexport class Scale {\n type = 'scale'\n private readonly scale: Point\n private readonly originX: Property\n private readonly originY: Property\n\n constructor(\n _: Document,\n scale: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n const scaleSize = Point.parseScale(scale)\n\n // Workaround for node-canvas\n if (scaleSize.x === 0\n || scaleSize.y === 0\n ) {\n scaleSize.x = PSEUDO_ZERO\n scaleSize.y = PSEUDO_ZERO\n }\n\n this.scale = scaleSize\n this.originX = transformOrigin[0]\n this.originY = transformOrigin[1]\n }\n\n apply(ctx: RenderingContext2D) {\n const {\n scale: {\n x,\n y\n },\n originX,\n originY\n } = this\n const tx = originX.getPixels('x')\n const ty = originY.getPixels('y')\n\n ctx.translate(tx, ty)\n ctx.scale(x, y || x)\n ctx.translate(-tx, -ty)\n }\n\n unapply(ctx: RenderingContext2D) {\n const {\n scale: {\n x,\n y\n },\n originX,\n originY\n } = this\n const tx = originX.getPixels('x')\n const ty = originY.getPixels('y')\n\n ctx.translate(tx, ty)\n ctx.scale(1.0 / x, 1.0 / y || x)\n ctx.translate(-tx, -ty)\n }\n\n applyToPoint(point: Point) {\n const {\n x,\n y\n } = this.scale\n\n point.applyTransform([\n x || 0.0,\n 0,\n 0,\n y || 0.0,\n 0,\n 0\n ])\n }\n}\n","import { MatrixValue, RenderingContext2D } from '../types'\nimport { toMatrixValue } from '../util'\nimport { Document } from '../Document'\nimport { Point } from '../Point'\nimport { Property } from '../Property'\nimport { ITransform } from './types'\n\nexport class Matrix implements ITransform {\n type = 'matrix'\n protected matrix: MatrixValue\n private readonly originX: Property\n private readonly originY: Property\n\n constructor(\n _: Document,\n matrix: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n this.matrix = toMatrixValue(matrix)\n this.originX = transformOrigin[0]\n this.originY = transformOrigin[1]\n }\n\n apply(ctx: RenderingContext2D) {\n const {\n originX,\n originY,\n matrix\n } = this\n const tx = originX.getPixels('x')\n const ty = originY.getPixels('y')\n\n ctx.translate(tx, ty)\n ctx.transform(\n matrix[0],\n matrix[1],\n matrix[2],\n matrix[3],\n matrix[4],\n matrix[5]\n )\n ctx.translate(-tx, -ty)\n }\n\n unapply(ctx: RenderingContext2D) {\n const {\n originX,\n originY,\n matrix\n } = this\n const a = matrix[0]\n const b = matrix[2]\n const c = matrix[4]\n const d = matrix[1]\n const e = matrix[3]\n const f = matrix[5]\n const g = 0.0\n const h = 0.0\n const i = 1.0\n const det = 1 / (a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g))\n const tx = originX.getPixels('x')\n const ty = originY.getPixels('y')\n\n ctx.translate(tx, ty)\n ctx.transform(\n det * (e * i - f * h),\n det * (f * g - d * i),\n det * (c * h - b * i),\n det * (a * i - c * g),\n det * (b * f - c * e),\n det * (c * d - a * f)\n )\n ctx.translate(-tx, -ty)\n }\n\n applyToPoint(point: Point) {\n point.applyTransform(this.matrix)\n }\n}\n","import { Document } from '../Document'\nimport { Property } from '../Property'\nimport { Matrix } from './Matrix'\n\nexport class Skew extends Matrix {\n override type = 'skew'\n protected readonly angle: Property\n\n constructor(\n document: Document,\n skew: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n super(document, skew, transformOrigin)\n\n this.angle = new Property(document, 'angle', skew)\n }\n}\n","import { Document } from '../Document'\nimport { Property } from '../Property'\nimport { Skew } from './Skew'\n\nexport class SkewX extends Skew {\n override type = 'skewX'\n\n constructor(\n document: Document,\n skew: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n super(document, skew, transformOrigin)\n\n this.matrix = [\n 1,\n 0,\n Math.tan(this.angle.getRadians()),\n 1,\n 0,\n 0\n ]\n }\n}\n","import { Document } from '../Document'\nimport { Property } from '../Property'\nimport { Skew } from './Skew'\n\nexport class SkewY extends Skew {\n override type = 'skewY'\n\n constructor(\n document: Document,\n skew: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n super(document, skew, transformOrigin)\n\n this.matrix = [\n 1,\n Math.tan(this.angle.getRadians()),\n 0,\n 1,\n 0,\n 0\n ]\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { compressSpaces } from '../util'\nimport { Property } from '../Property'\nimport { Point } from '../Point'\nimport { Document, Element } from '../Document'\nimport { ITransform } from './types'\nimport { Translate } from './Translate'\nimport { Rotate } from './Rotate'\nimport { Scale } from './Scale'\nimport { Matrix } from './Matrix'\nimport { SkewX } from './SkewX'\nimport { SkewY } from './SkewY'\n\nfunction parseTransforms(transform: string) {\n return compressSpaces(transform)\n .trim()\n .replace(/\\)([a-zA-Z])/g, ') $1')\n .replace(/\\)(\\s?,\\s?)/g, ') ')\n .split(/\\s(?=[a-z])/)\n}\n\nfunction parseTransform(transform: string) {\n const [type = '', value = ''] = transform.split('(')\n\n return [type.trim(), value.trim().replace(')', '')] as const\n}\n\ninterface ITransformConstructor {\n prototype: ITransform\n new (\n document: Document,\n value: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ): ITransform\n}\n\nexport class Transform {\n static fromElement(document: Document, element: Element) {\n const transformStyle = element.getStyle('transform', false, true)\n\n if (transformStyle.hasValue()) {\n const [transformOriginXProperty, transformOriginYProperty = transformOriginXProperty] = element.getStyle('transform-origin', false, true).split()\n\n if (transformOriginXProperty && transformOriginYProperty) {\n const transformOrigin = [transformOriginXProperty, transformOriginYProperty] as const\n\n return new Transform(\n document,\n transformStyle.getString(),\n transformOrigin\n )\n }\n }\n\n return null\n }\n\n static transformTypes: Record<string, ITransformConstructor> = {\n translate: Translate,\n rotate: Rotate,\n scale: Scale,\n matrix: Matrix,\n skewX: SkewX,\n skewY: SkewY\n }\n\n private readonly transforms: ITransform[] = []\n\n constructor(\n private readonly document: Document,\n transform: string,\n transformOrigin: readonly [Property<string>, Property<string>]\n ) {\n const data = parseTransforms(transform)\n\n data.forEach((transform) => {\n if (transform === 'none') {\n return\n }\n\n const [type, value] = parseTransform(transform)\n const TransformType = Transform.transformTypes[type]\n\n if (TransformType) {\n this.transforms.push(new TransformType(this.document, value, transformOrigin))\n }\n })\n }\n\n apply(ctx: RenderingContext2D) {\n this.transforms.forEach(transform => transform.apply(ctx))\n }\n\n unapply(ctx: RenderingContext2D) {\n this.transforms.forEach(transform => transform.unapply(ctx))\n }\n\n // TODO: applyToPoint unused ... remove?\n applyToPoint(point: Point) {\n this.transforms.forEach(transform => transform.applyToPoint(point))\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { normalizeAttributeName } from '../util'\nimport { Property } from '../Property'\nimport { Transform } from '../Transform'\nimport { Document } from './Document'\nimport { ClipPathElement } from './ClipPathElement'\nimport { MaskElement } from './MaskElement'\nimport { FilterElement } from './FilterElement'\n\nexport abstract class Element {\n static readonly ignoreChildTypes = ['title']\n\n readonly type: string = ''\n readonly attributes: Record<string, Property> = {}\n readonly styles: Record<string, Property> = {}\n readonly stylesSpecificity: Record<string, string> = {}\n animationFrozen = false\n animationFrozenValue = ''\n parent: Element | null = null\n children: Element[] = []\n\n constructor(\n protected readonly document: Document,\n protected readonly node?: HTMLElement,\n protected readonly captureTextNodes = false\n ) {\n if (!node || node.nodeType !== 1) { // ELEMENT_NODE\n return\n }\n\n // add attributes\n Array.from(node.attributes).forEach((attribute) => {\n const nodeName = normalizeAttributeName(attribute.nodeName)\n\n this.attributes[nodeName] = new Property(document, nodeName, attribute.value)\n })\n\n this.addStylesFromStyleDefinition()\n\n // add inline styles\n if (this.getAttribute('style').hasValue()) {\n const styles = this.getAttribute('style')\n .getString()\n .split(';')\n .map(_ => _.trim())\n\n styles.forEach((style) => {\n if (!style) {\n return\n }\n\n const [name, value] = style.split(':').map(_ => _.trim())\n\n if (name) {\n this.styles[name] = new Property(document, name, value)\n }\n })\n }\n\n const { definitions } = document\n const id = this.getAttribute('id')\n\n // add id\n if (id.hasValue()) {\n if (!definitions[id.getString()]) {\n definitions[id.getString()] = this\n }\n }\n\n Array.from(node.childNodes).forEach((childNode: HTMLElement) => {\n if (childNode.nodeType === 1) {\n this.addChild(childNode) // ELEMENT_NODE\n } else\n if (captureTextNodes && (\n childNode.nodeType === 3\n || childNode.nodeType === 4\n )) {\n const textNode = document.createTextNode(childNode)\n\n if (textNode.getText().length > 0) {\n this.addChild(textNode) // TEXT_NODE\n }\n }\n })\n }\n\n getAttribute(name: string, createIfNotExists = false): Property {\n const attr = this.attributes[name]\n\n if (!attr && createIfNotExists) {\n const attr = new Property(this.document, name, '')\n\n this.attributes[name] = attr\n\n return attr\n }\n\n return attr || Property.empty(this.document)\n }\n\n getHrefAttribute(): Property {\n let href: Property | undefined\n\n for (const key in this.attributes) {\n if (key === 'href' || key.endsWith(':href')) {\n href = this.attributes[key]\n break\n }\n }\n\n return href || Property.empty(this.document)\n }\n\n getStyle(name: string, createIfNotExists = false, skipAncestors = false): Property {\n const style = this.styles[name]\n\n if (style) {\n return style\n }\n\n const attr = this.getAttribute(name)\n\n if (attr.hasValue()) {\n this.styles[name] = attr // move up to me to cache\n return attr\n }\n\n if (!skipAncestors) {\n const { parent } = this\n\n if (parent) {\n const parentStyle = parent.getStyle(name)\n\n if (parentStyle.hasValue()) {\n return parentStyle\n }\n }\n }\n\n if (createIfNotExists) {\n const style = new Property(this.document, name, '')\n\n this.styles[name] = style\n\n return style\n }\n\n return Property.empty(this.document)\n }\n\n render(ctx: RenderingContext2D) {\n // don't render display=none\n // don't render visibility=hidden\n if (this.getStyle('display').getString() === 'none'\n || this.getStyle('visibility').getString() === 'hidden'\n ) {\n return\n }\n\n ctx.save()\n\n if (this.getStyle('mask').hasValue()) { // mask\n const mask = this.getStyle('mask').getDefinition<MaskElement>()\n\n if (mask) {\n this.applyEffects(ctx)\n mask.apply(ctx, this)\n }\n } else\n if (this.getStyle('filter').getValue('none') !== 'none') { // filter\n const filter = this.getStyle('filter').getDefinition<FilterElement>()\n\n if (filter) {\n this.applyEffects(ctx)\n filter.apply(ctx, this)\n }\n } else {\n this.setContext(ctx)\n this.renderChildren(ctx)\n this.clearContext(ctx)\n }\n\n ctx.restore()\n }\n\n setContext(_: RenderingContext2D) {\n // NO RENDER\n }\n\n protected applyEffects(ctx: RenderingContext2D) {\n // transform\n const transform = Transform.fromElement(this.document, this)\n\n if (transform) {\n transform.apply(ctx)\n }\n\n // clip\n const clipPathStyleProp = this.getStyle('clip-path', false, true)\n\n if (clipPathStyleProp.hasValue()) {\n const clip = clipPathStyleProp.getDefinition<ClipPathElement>()\n\n if (clip) {\n clip.apply(ctx)\n }\n }\n }\n\n clearContext(_: RenderingContext2D) {\n // NO RENDER\n }\n\n renderChildren(ctx: RenderingContext2D) {\n this.children.forEach((child) => {\n child.render(ctx)\n })\n }\n\n protected addChild(childNode: Element|HTMLElement) {\n const child = childNode instanceof Element\n ? childNode\n : this.document.createElement(childNode)\n\n child.parent = this\n\n if (!Element.ignoreChildTypes.includes(child.type)) {\n this.children.push(child)\n }\n }\n\n protected matchesSelector(selector: string) {\n const { node } = this\n\n if (typeof node.matches === 'function') {\n return node.matches(selector)\n }\n\n const styleClasses = node.getAttribute?.('class')\n\n if (!styleClasses || styleClasses === '') {\n return false\n }\n\n return styleClasses.split(' ').some(styleClass => `.${styleClass}` === selector)\n }\n\n addStylesFromStyleDefinition() {\n const {\n styles,\n stylesSpecificity\n } = this.document\n let styleProp: Property | undefined\n\n for (const selector in styles) {\n if (!selector.startsWith('@') && this.matchesSelector(selector)) {\n const style = styles[selector]\n const specificity = stylesSpecificity[selector]\n\n if (style) {\n for (const name in style) {\n let existingSpecificity = this.stylesSpecificity[name]\n\n if (typeof existingSpecificity === 'undefined') {\n existingSpecificity = '000'\n }\n\n if (specificity && specificity >= existingSpecificity) {\n styleProp = style[name]\n\n if (styleProp) {\n this.styles[name] = styleProp\n }\n\n this.stylesSpecificity[name] = specificity\n }\n }\n }\n }\n }\n }\n\n protected removeStyles(element: Element, ignoreStyles: string[]) {\n const toRestore = ignoreStyles.reduce<[string, string][]>((toRestore, name) => {\n const styleProp = element.getStyle(name)\n\n if (!styleProp.hasValue()) {\n return toRestore\n }\n\n const value = styleProp.getString()\n\n styleProp.setValue('')\n\n return [...toRestore, [name, value]]\n }, [])\n\n return toRestore\n }\n\n protected restoreStyles(element: Element, styles: [string, string][]) {\n styles.forEach(([name, value]) => {\n element.getStyle(name, true).setValue(value)\n })\n }\n\n isFirstChild() {\n return this.parent?.children.indexOf(this) === 0\n }\n}\n","import { Document } from './Document'\nimport { Element } from './Element'\n\nexport class UnknownElement extends Element {\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Element ${node.nodeName} not yet implemented.`)\n }\n }\n}\n","import { compressSpaces } from './util'\n\nfunction wrapFontFamily(fontFamily: string) {\n const trimmed = fontFamily.trim()\n\n return /^('|\")/.test(trimmed)\n ? trimmed\n : `\"${trimmed}\"`\n}\n\nfunction prepareFontFamily(fontFamily: string) {\n return typeof process === 'undefined'\n ? fontFamily\n : fontFamily\n .trim()\n .split(',')\n .map(wrapFontFamily)\n .join(',')\n}\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-style\n * @param fontStyle\n * @returns CSS font style.\n */\nfunction prepareFontStyle(fontStyle: string) {\n if (!fontStyle) {\n return ''\n }\n\n const targetFontStyle = fontStyle.trim().toLowerCase()\n\n switch (targetFontStyle) {\n case 'normal':\n case 'italic':\n case 'oblique':\n case 'inherit':\n case 'initial':\n case 'unset':\n return targetFontStyle\n\n default:\n\n if (/^oblique\\s+(-|)\\d+deg$/.test(targetFontStyle)) {\n return targetFontStyle\n }\n\n return ''\n }\n}\n\n/**\n * https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight\n * @param fontWeight\n * @returns CSS font weight.\n */\nfunction prepareFontWeight(fontWeight: string) {\n if (!fontWeight) {\n return ''\n }\n\n const targetFontWeight = fontWeight.trim().toLowerCase()\n\n switch (targetFontWeight) {\n case 'normal':\n case 'bold':\n case 'lighter':\n case 'bolder':\n case 'inherit':\n case 'initial':\n case 'unset':\n return targetFontWeight\n\n default:\n\n if (/^[\\d.]+$/.test(targetFontWeight)) {\n return targetFontWeight\n }\n\n return ''\n }\n}\n\nexport class Font {\n static parse(\n font = '',\n inherit?: string | Font\n ) {\n let fontStyle = ''\n let fontVariant = ''\n let fontWeight = ''\n let fontSize = ''\n let fontFamily = ''\n const parts = compressSpaces(font).trim().split(' ')\n const set = {\n fontSize: false,\n fontStyle: false,\n fontWeight: false,\n fontVariant: false\n }\n\n parts.forEach((part) => {\n switch (true) {\n case !set.fontStyle && Font.styles.includes(part):\n\n if (part !== 'inherit') {\n fontStyle = part\n }\n\n set.fontStyle = true\n break\n\n case !set.fontVariant && Font.variants.includes(part):\n\n if (part !== 'inherit') {\n fontVariant = part\n }\n\n set.fontStyle = true\n set.fontVariant = true\n break\n\n case !set.fontWeight && Font.weights.includes(part):\n\n if (part !== 'inherit') {\n fontWeight = part\n }\n\n set.fontStyle = true\n set.fontVariant = true\n set.fontWeight = true\n break\n\n case !set.fontSize:\n\n if (part !== 'inherit') {\n fontSize = part.split('/')[0] || ''\n }\n\n set.fontStyle = true\n set.fontVariant = true\n set.fontWeight = true\n set.fontSize = true\n break\n\n default:\n\n if (part !== 'inherit') {\n fontFamily += part\n }\n }\n })\n\n return new Font(\n fontStyle,\n fontVariant,\n fontWeight,\n fontSize,\n fontFamily,\n inherit\n )\n }\n\n static readonly styles = 'normal|italic|oblique|inherit'\n static readonly variants = 'normal|small-caps|inherit'\n static readonly weights = 'normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit'\n\n readonly fontFamily: string\n readonly fontSize: string\n readonly fontStyle: string\n readonly fontWeight: string\n readonly fontVariant: string\n\n constructor(\n fontStyle: string,\n fontVariant: string,\n fontWeight: string,\n fontSize: string,\n fontFamily: string,\n inherit?: string | Font\n ) {\n const inheritFont = inherit\n ? typeof inherit === 'string'\n ? Font.parse(inherit)\n : inherit\n : {} as Font\n\n this.fontFamily = fontFamily || inheritFont.fontFamily\n this.fontSize = fontSize || inheritFont.fontSize\n this.fontStyle = fontStyle || inheritFont.fontStyle\n this.fontWeight = fontWeight || inheritFont.fontWeight\n this.fontVariant = fontVariant || inheritFont.fontVariant\n }\n\n toString() {\n return [\n prepareFontStyle(this.fontStyle),\n this.fontVariant,\n prepareFontWeight(this.fontWeight),\n this.fontSize,\n // Wrap fontFamily only on nodejs and only for canvas.ctx\n prepareFontFamily(this.fontFamily)\n ].join(' ').trim()\n }\n}\n","\nexport class BoundingBox {\n constructor(\n public x1 = Number.NaN,\n public y1 = Number.NaN,\n public x2 = Number.NaN,\n public y2 = Number.NaN\n ) {\n this.addPoint(x1, y1)\n this.addPoint(x2, y2)\n }\n\n get x() {\n return this.x1\n }\n\n get y() {\n return this.y1\n }\n\n get width() {\n return this.x2 - this.x1\n }\n\n get height() {\n return this.y2 - this.y1\n }\n\n addPoint(x: number | undefined, y: number | undefined) {\n if (typeof x !== 'undefined') {\n if (isNaN(this.x1) || isNaN(this.x2)) {\n this.x1 = x\n this.x2 = x\n }\n\n if (x < this.x1) {\n this.x1 = x\n }\n\n if (x > this.x2) {\n this.x2 = x\n }\n }\n\n if (typeof y !== 'undefined') {\n if (isNaN(this.y1) || isNaN(this.y2)) {\n this.y1 = y\n this.y2 = y\n }\n\n if (y < this.y1) {\n this.y1 = y\n }\n\n if (y > this.y2) {\n this.y2 = y\n }\n }\n }\n\n addX(x: number) {\n this.addPoint(x, 0)\n }\n\n addY(y: number) {\n this.addPoint(0, y)\n }\n\n addBoundingBox(boundingBox: BoundingBox | null) {\n if (!boundingBox) {\n return\n }\n\n const {\n x1,\n y1,\n x2,\n y2\n } = boundingBox\n\n this.addPoint(x1, y1)\n this.addPoint(x2, y2)\n }\n\n private sumCubic(\n t: number,\n p0: number,\n p1: number,\n p2: number,\n p3: number\n ) {\n return (\n Math.pow(1 - t, 3) * p0\n + 3 * Math.pow(1 - t, 2) * t * p1\n + 3 * (1 - t) * Math.pow(t, 2) * p2\n + Math.pow(t, 3) * p3\n )\n }\n\n private bezierCurveAdd(\n forX: boolean,\n p0: number,\n p1: number,\n p2: number,\n p3: number\n ) {\n const b = 6 * p0 - 12 * p1 + 6 * p2\n const a = -3 * p0 + 9 * p1 - 9 * p2 + 3 * p3\n const c = 3 * p1 - 3 * p0\n\n if (a === 0) {\n if (b === 0) {\n return\n }\n\n const t = -c / b\n\n if (0 < t && t < 1) {\n if (forX) {\n this.addX(this.sumCubic(t, p0, p1, p2, p3))\n } else {\n this.addY(this.sumCubic(t, p0, p1, p2, p3))\n }\n }\n\n return\n }\n\n const b2ac = Math.pow(b, 2) - 4 * c * a\n\n if (b2ac < 0) {\n return\n }\n\n const t1 = (-b + Math.sqrt(b2ac)) / (2 * a)\n\n if (0 < t1 && t1 < 1) {\n if (forX) {\n this.addX(\n this.sumCubic(t1, p0, p1, p2, p3)\n )\n } else {\n this.addY(\n this.sumCubic(t1, p0, p1, p2, p3)\n )\n }\n }\n\n const t2 = (-b - Math.sqrt(b2ac)) / (2 * a)\n\n if (0 < t2 && t2 < 1) {\n if (forX) {\n this.addX(this.sumCubic(t2, p0, p1, p2, p3))\n } else {\n this.addY(this.sumCubic(t2, p0, p1, p2, p3))\n }\n }\n }\n\n // from http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html\n addBezierCurve(\n p0x: number,\n p0y: number,\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n p3x: number,\n p3y: number\n ) {\n this.addPoint(p0x, p0y)\n this.addPoint(p3x, p3y)\n this.bezierCurveAdd(true, p0x, p1x, p2x, p3x)\n this.bezierCurveAdd(false, p0y, p1y, p2y, p3y)\n }\n\n addQuadraticCurve(\n p0x: number,\n p0y: number,\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number\n ) {\n const cp1x = p0x + 2 / 3 * (p1x - p0x) // CP1 = QP0 + 2/3 *(QP1-QP0)\n const cp1y = p0y + 2 / 3 * (p1y - p0y) // CP1 = QP0 + 2/3 *(QP1-QP0)\n const cp2x = cp1x + 1 / 3 * (p2x - p0x) // CP2 = CP1 + 1/3 *(QP2-QP0)\n const cp2y = cp1y + 1 / 3 * (p2y - p0y) // CP2 = CP1 + 1/3 *(QP2-QP0)\n\n this.addBezierCurve(p0x, p0y, cp1x, cp2x, cp1y, cp2y, p2x, p2y)\n }\n\n isPointInBox(\n x: number,\n y: number\n ) {\n const {\n x1,\n y1,\n x2,\n y2\n } = this\n\n return (\n x1 <= x\n && x <= x2\n && y1 <= y\n && y <= y2\n )\n }\n}\n","import { RenderingContext2D } from '../types'\nimport {\n PSEUDO_ZERO,\n toNumbers\n} from '../util'\nimport { Font } from '../Font'\nimport { Property } from '../Property'\nimport { Element } from './Element'\n\nexport abstract class RenderedElement extends Element {\n private modifiedEmSizeStack = false\n\n protected calculateOpacity() {\n let opacity = 1.0\n // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n let element: Element | null = this\n\n while (element) {\n const opacityStyle = element.getStyle('opacity', false, true) // no ancestors on style call\n\n if (opacityStyle.hasValue(true)) {\n opacity *= opacityStyle.getNumber()\n }\n\n element = element.parent\n }\n\n return opacity\n }\n\n override setContext(ctx: RenderingContext2D, fromMeasure = false) {\n if (!fromMeasure) { // causes stack overflow when measuring text with gradients\n // fill\n const fillStyleProp = this.getStyle('fill')\n const fillOpacityStyleProp = this.getStyle('fill-opacity')\n const strokeStyleProp = this.getStyle('stroke')\n const strokeOpacityProp = this.getStyle('stroke-opacity')\n\n if (fillStyleProp.isUrlDefinition()) {\n const fillStyle = fillStyleProp.getFillStyleDefinition(this, fillOpacityStyleProp)\n\n if (fillStyle) {\n ctx.fillStyle = fillStyle\n }\n } else\n if (fillStyleProp.hasValue()) {\n if (fillStyleProp.getString() === 'currentColor') {\n fillStyleProp.setValue(this.getStyle('color').getColor())\n }\n\n const fillStyle = fillStyleProp.getColor()\n\n if (fillStyle !== 'inherit') {\n ctx.fillStyle = fillStyle === 'none'\n ? 'rgba(0,0,0,0)'\n : fillStyle\n }\n }\n\n if (fillOpacityStyleProp.hasValue()) {\n const fillStyle = new Property(this.document, 'fill', ctx.fillStyle)\n .addOpacity(fillOpacityStyleProp)\n .getColor()\n\n ctx.fillStyle = fillStyle\n }\n\n // stroke\n if (strokeStyleProp.isUrlDefinition()) {\n const strokeStyle = strokeStyleProp.getFillStyleDefinition(this, strokeOpacityProp)\n\n if (strokeStyle) {\n ctx.strokeStyle = strokeStyle\n }\n } else\n if (strokeStyleProp.hasValue()) {\n if (strokeStyleProp.getString() === 'currentColor') {\n strokeStyleProp.setValue(this.getStyle('color').getColor())\n }\n\n const strokeStyle = strokeStyleProp.getString()\n\n if (strokeStyle !== 'inherit') {\n ctx.strokeStyle = strokeStyle === 'none'\n ? 'rgba(0,0,0,0)'\n : strokeStyle\n }\n }\n\n if (strokeOpacityProp.hasValue()) {\n const strokeStyle = new Property(this.document, 'stroke', ctx.strokeStyle)\n .addOpacity(strokeOpacityProp)\n .getString()\n\n ctx.strokeStyle = strokeStyle\n }\n\n const strokeWidthStyleProp = this.getStyle('stroke-width')\n\n if (strokeWidthStyleProp.hasValue()) {\n const newLineWidth = strokeWidthStyleProp.getPixels()\n\n ctx.lineWidth = !newLineWidth\n ? PSEUDO_ZERO // browsers don't respect 0 (or node-canvas? :-)\n : newLineWidth\n }\n\n const strokeLinecapStyleProp = this.getStyle('stroke-linecap')\n const strokeLinejoinStyleProp = this.getStyle('stroke-linejoin')\n const strokeMiterlimitProp = this.getStyle('stroke-miterlimit')\n // NEED TEST\n // const pointOrderStyleProp = this.getStyle('paint-order');\n const strokeDasharrayStyleProp = this.getStyle('stroke-dasharray')\n const strokeDashoffsetProp = this.getStyle('stroke-dashoffset')\n\n if (strokeLinecapStyleProp.hasValue()) {\n ctx.lineCap = strokeLinecapStyleProp.getString() as CanvasLineCap\n }\n\n if (strokeLinejoinStyleProp.hasValue()) {\n ctx.lineJoin = strokeLinejoinStyleProp.getString() as CanvasLineJoin\n }\n\n if (strokeMiterlimitProp.hasValue()) {\n ctx.miterLimit = strokeMiterlimitProp.getNumber()\n }\n\n // NEED TEST\n // if (pointOrderStyleProp.hasValue()) {\n // // ?\n // ctx.paintOrder = pointOrderStyleProp.getValue();\n // }\n\n if (strokeDasharrayStyleProp.hasValue() && strokeDasharrayStyleProp.getString() !== 'none') {\n const gaps = toNumbers(strokeDasharrayStyleProp.getString())\n\n if (typeof ctx.setLineDash !== 'undefined') {\n ctx.setLineDash(gaps)\n } else\n // @ts-expect-error Handle browser prefix.\n if (typeof ctx.webkitLineDash !== 'undefined') {\n // @ts-expect-error Handle browser prefix.\n ctx.webkitLineDash = gaps\n } else\n // @ts-expect-error Handle browser prefix.\n if (typeof ctx.mozDash !== 'undefined' && !(gaps.length === 1 && gaps[0] === 0)) {\n // @ts-expect-error Handle browser prefix.\n ctx.mozDash = gaps\n }\n\n const offset = strokeDashoffsetProp.getPixels()\n\n if (typeof ctx.lineDashOffset !== 'undefined') {\n ctx.lineDashOffset = offset\n } else\n // @ts-expect-error Handle browser prefix.\n if (typeof ctx.webkitLineDashOffset !== 'undefined') {\n // @ts-expect-error Handle browser prefix.\n ctx.webkitLineDashOffset = offset\n } else\n // @ts-expect-error Handle browser prefix.\n if (typeof ctx.mozDashOffset !== 'undefined') {\n // @ts-expect-error Handle browser prefix.\n ctx.mozDashOffset = offset\n }\n }\n }\n\n // font\n this.modifiedEmSizeStack = false\n\n if (typeof ctx.font !== 'undefined') {\n const fontStyleProp = this.getStyle('font')\n const fontStyleStyleProp = this.getStyle('font-style')\n const fontVariantStyleProp = this.getStyle('font-variant')\n const fontWeightStyleProp = this.getStyle('font-weight')\n const fontSizeStyleProp = this.getStyle('font-size')\n const fontFamilyStyleProp = this.getStyle('font-family')\n const font = new Font(\n fontStyleStyleProp.getString(),\n fontVariantStyleProp.getString(),\n fontWeightStyleProp.getString(),\n fontSizeStyleProp.hasValue()\n ? `${fontSizeStyleProp.getPixels(true)}px`\n : '',\n fontFamilyStyleProp.getString(),\n Font.parse(\n fontStyleProp.getString(),\n ctx.font\n )\n )\n\n fontStyleStyleProp.setValue(font.fontStyle)\n fontVariantStyleProp.setValue(font.fontVariant)\n fontWeightStyleProp.setValue(font.fontWeight)\n fontSizeStyleProp.setValue(font.fontSize)\n fontFamilyStyleProp.setValue(font.fontFamily)\n\n ctx.font = font.toString()\n\n if (fontSizeStyleProp.isPixels()) {\n this.document.emSize = fontSizeStyleProp.getPixels()\n this.modifiedEmSizeStack = true\n }\n }\n\n if (!fromMeasure) {\n // effects\n this.applyEffects(ctx)\n // opacity\n ctx.globalAlpha = this.calculateOpacity()\n }\n }\n\n override clearContext(ctx: RenderingContext2D) {\n super.clearContext(ctx)\n\n if (this.modifiedEmSizeStack) {\n this.document.popEmSize()\n }\n }\n}\n","import { RenderingContext2D } from '../types'\nimport {\n toNumbers,\n compressSpaces,\n trimLeft,\n trimRight\n} from '../util'\nimport { Font } from '../Font'\nimport { BoundingBox } from '../BoundingBox'\nimport { Document } from './Document'\nimport { Element } from './Element'\nimport { FontElement } from './FontElement'\nimport { ArabicForm, GlyphElement } from './GlyphElement'\nimport { RenderedElement } from './RenderedElement'\n\nexport class TextElement extends RenderedElement {\n override type = 'text'\n protected x = 0\n protected y = 0\n private leafTexts: TextElement[] = []\n private textChunkStart = 0\n private minX = Number.POSITIVE_INFINITY\n private maxX = Number.NEGATIVE_INFINITY\n private measureCache = -1\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(\n document,\n node,\n new.target === TextElement\n ? true\n : captureTextNodes\n )\n }\n\n override setContext(ctx: RenderingContext2D, fromMeasure = false) {\n super.setContext(ctx, fromMeasure)\n\n const textBaseline = this.getStyle('dominant-baseline').getTextBaseline()\n || this.getStyle('alignment-baseline').getTextBaseline()\n\n if (textBaseline) {\n ctx.textBaseline = textBaseline as CanvasTextBaseline\n }\n }\n\n protected initializeCoordinates() {\n this.x = 0\n this.y = 0\n this.leafTexts = []\n this.textChunkStart = 0\n this.minX = Number.POSITIVE_INFINITY\n this.maxX = Number.NEGATIVE_INFINITY\n }\n\n getBoundingBox(ctx: RenderingContext2D) {\n if (this.type !== 'text') {\n return this.getTElementBoundingBox(ctx)\n }\n\n // first, calculate child positions\n this.initializeCoordinates()\n this.adjustChildCoordinatesRecursive(ctx)\n\n let boundingBox: BoundingBox | null = null\n\n // then calculate bounding box\n this.children.forEach((_, i) => {\n const childBoundingBox = this.getChildBoundingBox(ctx, this, this, i)\n\n if (!boundingBox) {\n boundingBox = childBoundingBox\n } else {\n boundingBox.addBoundingBox(childBoundingBox)\n }\n })\n\n return boundingBox\n }\n\n protected getFontSize() {\n const {\n document,\n parent\n } = this\n const inheritFontSize = Font.parse(document.ctx.font).fontSize\n const fontSize = parent.getStyle('font-size').getNumber(inheritFontSize)\n\n return fontSize\n }\n\n protected getTElementBoundingBox(ctx: RenderingContext2D) {\n const fontSize = this.getFontSize()\n\n return new BoundingBox(\n this.x,\n this.y - fontSize,\n this.x + this.measureText(ctx),\n this.y\n )\n }\n\n getGlyph(\n font: FontElement,\n text: string,\n i: number\n ) {\n const char = text[i]\n let glyph: GlyphElement | undefined\n\n if (font.isArabic) {\n const len = text.length\n const prevChar = text[i - 1]\n const nextChar = text[i + 1]\n let arabicForm: ArabicForm = 'isolated'\n\n if ((i === 0 || prevChar === ' ') && i < len - 1 && nextChar !== ' ') {\n arabicForm = 'terminal'\n }\n\n if (i > 0 && prevChar !== ' ' && i < len - 1 && nextChar !== ' ') {\n arabicForm = 'medial'\n }\n\n if (i > 0 && prevChar !== ' ' && (i === len - 1 || nextChar === ' ')) {\n arabicForm = 'initial'\n }\n\n glyph = font.arabicGlyphs[char]?.[arabicForm] || font.glyphs[char]\n } else {\n glyph = font.glyphs[char]\n }\n\n if (!glyph) {\n glyph = font.missingGlyph\n }\n\n return glyph\n }\n\n getText() {\n return ''\n }\n\n protected getTextFromNode(node?: ChildNode) {\n const textNode = node || this.node\n const childNodes = Array.from(textNode.parentNode.childNodes)\n const index = childNodes.indexOf(textNode)\n const lastIndex = childNodes.length - 1\n let text = compressSpaces(\n // textNode.value\n // || textNode.text\n textNode.textContent\n || ''\n )\n\n if (index === 0) {\n text = trimLeft(text)\n }\n\n if (index === lastIndex) {\n text = trimRight(text)\n }\n\n return text\n }\n\n override renderChildren(ctx: RenderingContext2D) {\n if (this.type !== 'text') {\n this.renderTElementChildren(ctx)\n return\n }\n\n // first, calculate child positions\n this.initializeCoordinates()\n this.adjustChildCoordinatesRecursive(ctx)\n\n // then render\n this.children.forEach((_, i) => {\n this.renderChild(ctx, this, this, i)\n })\n\n const { mouse } = this.document.screen\n\n // Do not calc bounding box if mouse is not working.\n if (mouse.isWorking()) {\n mouse.checkBoundingBox(\n this,\n this.getBoundingBox(ctx)\n )\n }\n }\n\n protected renderTElementChildren(ctx: RenderingContext2D) {\n const {\n document,\n parent\n } = this\n const renderText = this.getText()\n const customFont = parent.getStyle('font-family').getDefinition<FontElement>()\n\n if (customFont) {\n const { unitsPerEm } = customFont.fontFace\n const ctxFont = Font.parse(document.ctx.font)\n const fontSize = parent.getStyle('font-size').getNumber(ctxFont.fontSize)\n const fontStyle = parent.getStyle('font-style').getString(ctxFont.fontStyle)\n const scale = fontSize / unitsPerEm\n const text = customFont.isRTL\n ? renderText.split('').reverse().join('')\n : renderText\n const dx = toNumbers(parent.getAttribute('dx').getString())\n const len = text.length\n\n for (let i = 0; i < len; i++) {\n const glyph = this.getGlyph(customFont, text, i)\n\n ctx.translate(this.x, this.y)\n ctx.scale(scale, -scale)\n\n const lw = ctx.lineWidth\n\n ctx.lineWidth = ctx.lineWidth * unitsPerEm / fontSize\n\n if (fontStyle === 'italic') {\n ctx.transform(1, 0, .4, 1, 0, 0)\n }\n\n glyph.render(ctx)\n\n if (fontStyle === 'italic') {\n ctx.transform(1, 0, -.4, 1, 0, 0)\n }\n\n ctx.lineWidth = lw\n ctx.scale(1 / scale, -1 / scale)\n ctx.translate(-this.x, -this.y)\n\n this.x += fontSize * (glyph.horizAdvX || customFont.horizAdvX) / unitsPerEm\n\n if (typeof dx[i] !== 'undefined' && !isNaN(dx[i])) {\n this.x += dx[i]\n }\n }\n\n return\n }\n\n const {\n x,\n y\n } = this\n\n // NEED TEST\n // if (ctx.paintOrder === 'stroke') {\n // if (ctx.strokeStyle) {\n // ctx.strokeText(renderText, x, y);\n // }\n\n // if (ctx.fillStyle) {\n // ctx.fillText(renderText, x, y);\n // }\n // } else {\n if (ctx.fillStyle) {\n ctx.fillText(renderText, x, y)\n }\n\n if (ctx.strokeStyle) {\n ctx.strokeText(renderText, x, y)\n }\n // }\n }\n\n protected applyAnchoring() {\n if (this.textChunkStart >= this.leafTexts.length) {\n return\n }\n\n // This is basically the \"Apply anchoring\" part of https://www.w3.org/TR/SVG2/text.html#TextLayoutAlgorithm.\n // The difference is that we apply the anchoring as soon as a chunk is finished. This saves some extra looping.\n // Vertical text is not supported.\n\n const firstElement = this.leafTexts[this.textChunkStart]\n const textAnchor = firstElement.getStyle('text-anchor').getString('start')\n const isRTL = false // we treat RTL like LTR\n let shift = 0\n\n if (textAnchor === 'start' && !isRTL || textAnchor === 'end' && isRTL) {\n shift = firstElement.x - this.minX\n } else if (textAnchor === 'end' && !isRTL || textAnchor === 'start' && isRTL) {\n shift = firstElement.x - this.maxX\n } else {\n shift = firstElement.x - (this.minX + this.maxX) / 2\n }\n\n for (let i = this.textChunkStart; i < this.leafTexts.length; i++) {\n this.leafTexts[i].x += shift\n }\n\n // start new chunk\n this.minX = Number.POSITIVE_INFINITY\n this.maxX = Number.NEGATIVE_INFINITY\n this.textChunkStart = this.leafTexts.length\n }\n\n protected adjustChildCoordinatesRecursive(ctx: RenderingContext2D) {\n this.children.forEach((_, i) => {\n this.adjustChildCoordinatesRecursiveCore(ctx, this, this, i)\n })\n this.applyAnchoring()\n }\n\n protected adjustChildCoordinatesRecursiveCore(\n ctx: RenderingContext2D,\n textParent: TextElement,\n parent: Element,\n i: number\n ): void {\n const child = parent.children[i] as TextElement\n\n if (child.children.length > 0) {\n child.children.forEach((_, i) => {\n textParent.adjustChildCoordinatesRecursiveCore(ctx, textParent, child, i)\n })\n } else {\n // only leafs are relevant\n this.adjustChildCoordinates(ctx, textParent, parent, i)\n }\n }\n\n protected adjustChildCoordinates(\n ctx: RenderingContext2D,\n textParent: TextElement,\n parent: Element,\n i: number\n ) {\n const child = parent.children[i] as TextElement\n\n if (typeof child.measureText !== 'function') {\n return child\n }\n\n ctx.save()\n child.setContext(ctx, true)\n\n const xAttr = child.getAttribute('x')\n const yAttr = child.getAttribute('y')\n const dxAttr = child.getAttribute('dx')\n const dyAttr = child.getAttribute('dy')\n const customFont = child.getStyle('font-family').getDefinition<FontElement>()\n const isRTL = Boolean(customFont?.isRTL)\n\n if (i === 0) {\n // First children inherit attributes from parent(s). Positional attributes\n // are only inherited from a parent to it's first child.\n if (!xAttr.hasValue()) {\n xAttr.setValue(child.getInheritedAttribute('x'))\n }\n\n if (!yAttr.hasValue()) {\n yAttr.setValue(child.getInheritedAttribute('y'))\n }\n\n if (!dxAttr.hasValue()) {\n dxAttr.setValue(child.getInheritedAttribute('dx'))\n }\n\n if (!dyAttr.hasValue()) {\n dyAttr.setValue(child.getInheritedAttribute('dy'))\n }\n }\n\n const width = child.measureText(ctx)\n\n if (isRTL) {\n textParent.x -= width\n }\n\n if (xAttr.hasValue()) {\n // an \"x\" attribute marks the start of a new chunk\n textParent.applyAnchoring()\n\n child.x = xAttr.getPixels('x')\n\n if (dxAttr.hasValue()) {\n child.x += dxAttr.getPixels('x')\n }\n } else {\n if (dxAttr.hasValue()) {\n textParent.x += dxAttr.getPixels('x')\n }\n\n child.x = textParent.x\n }\n\n textParent.x = child.x\n\n if (!isRTL) {\n textParent.x += width\n }\n\n if (yAttr.hasValue()) {\n child.y = yAttr.getPixels('y')\n\n if (dyAttr.hasValue()) {\n child.y += dyAttr.getPixels('y')\n }\n } else {\n if (dyAttr.hasValue()) {\n textParent.y += dyAttr.getPixels('y')\n }\n\n child.y = textParent.y\n }\n\n textParent.y = child.y\n\n // update the current chunk and it's bounds\n textParent.leafTexts.push(child)\n textParent.minX = Math.min(textParent.minX, child.x, child.x + width)\n textParent.maxX = Math.max(textParent.maxX, child.x, child.x + width)\n\n child.clearContext(ctx)\n ctx.restore()\n\n return child\n }\n\n protected getChildBoundingBox(\n ctx: RenderingContext2D,\n textParent: TextElement,\n parent: Element,\n i: number\n ) {\n const child = parent.children[i] as TextElement\n\n // not a text node?\n if (typeof child.getBoundingBox !== 'function') {\n return null\n }\n\n const boundingBox = child.getBoundingBox(ctx)\n\n if (boundingBox) {\n child.children.forEach((_, i) => {\n const childBoundingBox = textParent.getChildBoundingBox(ctx, textParent, child, i)\n\n boundingBox.addBoundingBox(childBoundingBox)\n })\n }\n\n return boundingBox\n }\n\n protected renderChild(\n ctx: RenderingContext2D,\n textParent: TextElement,\n parent: Element,\n i: number\n ) {\n const child = parent.children[i] as TextElement\n\n child.render(ctx)\n child.children.forEach((_, i) => {\n textParent.renderChild(ctx, textParent, child, i)\n })\n }\n\n protected measureText(ctx: RenderingContext2D) {\n const { measureCache } = this\n\n if (~measureCache) {\n return measureCache\n }\n\n const renderText = this.getText()\n const measure = this.measureTargetText(ctx, renderText)\n\n this.measureCache = measure\n\n return measure\n }\n\n protected measureTargetText(\n ctx: RenderingContext2D,\n targetText: string\n ) {\n if (!targetText.length) {\n return 0\n }\n\n const { parent } = this\n const customFont = parent.getStyle('font-family').getDefinition<FontElement>()\n\n if (customFont) {\n const fontSize = this.getFontSize()\n const text = customFont.isRTL\n ? targetText.split('').reverse().join('')\n : targetText\n const dx = toNumbers(parent.getAttribute('dx').getString())\n const len = text.length\n let measure = 0\n\n for (let i = 0; i < len; i++) {\n const glyph = this.getGlyph(customFont, text, i)\n\n measure += (glyph.horizAdvX || customFont.horizAdvX)\n * fontSize\n / customFont.fontFace.unitsPerEm\n\n if (typeof dx[i] !== 'undefined' && !isNaN(dx[i])) {\n measure += dx[i]\n }\n }\n\n return measure\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!ctx.measureText) {\n return targetText.length * 10\n }\n\n ctx.save()\n this.setContext(ctx, true)\n\n const { width: measure } = ctx.measureText(targetText)\n\n this.clearContext(ctx)\n ctx.restore()\n\n return measure\n }\n\n /**\n * Inherits positional attributes from {@link TextElement} parent(s). Attributes\n * are only inherited from a parent to its first child.\n * @param name - The attribute name.\n * @returns The attribute value or null.\n */\n protected getInheritedAttribute(name: string): string | null {\n // eslint-disable-next-line @typescript-eslint/no-this-alias,consistent-this\n let current: Element | null = this\n\n while (current instanceof TextElement && current.isFirstChild() && current.parent) {\n const parentAttr = current.parent.getAttribute(name)\n\n if (parentAttr.hasValue(true)) {\n return parentAttr.getString('0')\n }\n\n current = current.parent\n }\n\n return null\n }\n}\n","import { Document } from './Document'\nimport { TextElement } from './TextElement'\n\nexport class TSpanElement extends TextElement {\n override type = 'tspan'\n protected readonly text: string\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(\n document,\n node,\n new.target === TSpanElement\n ? true\n : captureTextNodes\n )\n\n // if this node has children, then they own the text\n this.text = this.children.length > 0\n ? ''\n : this.getTextFromNode()\n }\n\n override getText() {\n return this.text\n }\n}\n","import { TSpanElement } from './TSpanElement'\n\nexport class TextNode extends TSpanElement {\n override type = 'textNode'\n}\n","import {\n SVGCommand,\n CommandM,\n CommandL,\n CommandH,\n CommandV,\n CommandZ,\n CommandQ,\n CommandT,\n CommandC,\n CommandS,\n CommandA\n} from 'svg-pathdata/lib/types'\nimport { SVGPathData } from 'svg-pathdata'\nimport { Point } from './Point'\n\nexport type CommandType = SVGCommand['type']\nexport type Command = { type: CommandType }\n & Omit<CommandM, 'type'>\n & Omit<CommandL, 'type'>\n & Omit<CommandH, 'type'>\n & Omit<CommandV, 'type'>\n & Omit<CommandZ, 'type'>\n & Omit<CommandQ, 'type'>\n & Omit<CommandT, 'type'>\n & Omit<CommandC, 'type'>\n & Omit<CommandS, 'type'>\n & Omit<CommandA, 'type'>\n\nexport class PathParser extends SVGPathData {\n control: Point = new Point(0, 0)\n start: Point = new Point(0, 0)\n current: Point = new Point(0, 0)\n command: Command | null = null\n override readonly commands: Command[] /* Babel fix: */ = this.commands\n private i = -1\n private previousCommand: Command | null = null\n private points: Point[] = []\n private angles: (number | null)[] = []\n\n constructor(path: string) {\n super(\n path\n // Fix spaces after signs.\n .replace(/([+\\-.])\\s+/gm, '$1')\n // Remove invalid part.\n .replace(/[^MmZzLlHhVvCcSsQqTtAae\\d\\s.,+-].*/g, '')\n )\n }\n\n reset() {\n this.i = -1\n this.command = null\n this.previousCommand = null\n this.start = new Point(0, 0)\n this.control = new Point(0, 0)\n this.current = new Point(0, 0)\n this.points = []\n this.angles = []\n }\n\n isEnd() {\n const {\n i,\n commands\n } = this\n\n return i >= commands.length - 1\n }\n\n next() {\n const command = this.commands[++this.i]\n\n this.previousCommand = this.command\n this.command = command\n\n return command\n }\n\n getPoint(xProp = 'x', yProp = 'y') {\n const point = new Point(\n this.command[xProp] as number,\n this.command[yProp] as number\n )\n\n return this.makeAbsolute(point)\n }\n\n getAsControlPoint(xProp?: string, yProp?: string) {\n const point = this.getPoint(xProp, yProp)\n\n this.control = point\n\n return point\n }\n\n getAsCurrentPoint(xProp?: string, yProp?: string) {\n const point = this.getPoint(xProp, yProp)\n\n this.current = point\n\n return point\n }\n\n getReflectedControlPoint() {\n const previousCommand = this.previousCommand.type\n\n if (previousCommand !== SVGPathData.CURVE_TO\n && previousCommand !== SVGPathData.SMOOTH_CURVE_TO\n && previousCommand !== SVGPathData.QUAD_TO\n && previousCommand !== SVGPathData.SMOOTH_QUAD_TO\n ) {\n return this.current\n }\n\n // reflect point\n const {\n current: {\n x: cx,\n y: cy\n },\n control: {\n x: ox,\n y: oy\n }\n } = this\n const point = new Point(2 * cx - ox, 2 * cy - oy)\n\n return point\n }\n\n makeAbsolute(point: Point) {\n if (this.command.relative) {\n const {\n x,\n y\n } = this.current\n\n point.x += x\n point.y += y\n }\n\n return point\n }\n\n addMarker(point: Point, from?: Point, priorTo?: Point) {\n const {\n points,\n angles\n } = this\n\n // if the last angle isn't filled in because we didn't have this point yet ...\n if (priorTo && angles.length > 0 && !angles[angles.length - 1]) {\n angles[angles.length - 1] = points[points.length - 1].angleTo(priorTo)\n }\n\n this.addMarkerAngle(point, from ? from.angleTo(point) : null)\n }\n\n addMarkerAngle(point: Point, angle: number) {\n this.points.push(point)\n this.angles.push(angle)\n }\n\n getMarkerPoints() {\n return this.points\n }\n\n getMarkerAngles() {\n const { angles } = this\n const len = angles.length\n\n for (let i = 0; i < len; i++) {\n if (!angles[i]) {\n for (let j = i + 1; j < len; j++) {\n if (angles[j]) {\n angles[i] = angles[j]\n break\n }\n }\n }\n }\n\n return angles\n }\n}\n","/* eslint-disable @typescript-eslint/member-ordering */\nimport { RenderingContext2D } from '../types'\nimport {\n vectorsRatio,\n vectorsAngle\n} from '../util'\nimport { Point } from '../Point'\nimport { BoundingBox } from '../BoundingBox'\nimport { PathParser } from '../PathParser'\nimport { Document } from './Document'\nimport { RenderedElement } from './RenderedElement'\nimport { MarkerElement } from './MarkerElement'\n\nexport type Marker = [Point, number]\n\nexport class PathElement extends RenderedElement {\n override type = 'path'\n readonly pathParser: PathParser\n\n constructor(\n document: Document,\n node?: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.pathParser = new PathParser(this.getAttribute('d').getString())\n }\n\n path(ctx?: RenderingContext2D) {\n const { pathParser } = this\n const boundingBox = new BoundingBox()\n\n pathParser.reset()\n\n if (ctx) {\n ctx.beginPath()\n }\n\n while (!pathParser.isEnd()) {\n switch (pathParser.next().type) {\n case PathParser.MOVE_TO:\n this.pathM(ctx, boundingBox)\n break\n\n case PathParser.LINE_TO:\n this.pathL(ctx, boundingBox)\n break\n\n case PathParser.HORIZ_LINE_TO:\n this.pathH(ctx, boundingBox)\n break\n\n case PathParser.VERT_LINE_TO:\n this.pathV(ctx, boundingBox)\n break\n\n case PathParser.CURVE_TO:\n this.pathC(ctx, boundingBox)\n break\n\n case PathParser.SMOOTH_CURVE_TO:\n this.pathS(ctx, boundingBox)\n break\n\n case PathParser.QUAD_TO:\n this.pathQ(ctx, boundingBox)\n break\n\n case PathParser.SMOOTH_QUAD_TO:\n this.pathT(ctx, boundingBox)\n break\n\n case PathParser.ARC:\n this.pathA(ctx, boundingBox)\n break\n\n case PathParser.CLOSE_PATH:\n this.pathZ(ctx, boundingBox)\n break\n\n default:\n }\n }\n\n return boundingBox\n }\n\n getBoundingBox(_ctx: RenderingContext2D) {\n return this.path()\n }\n\n getMarkers(): Marker[] {\n const { pathParser } = this\n const points = pathParser.getMarkerPoints()\n const angles = pathParser.getMarkerAngles()\n const markers = points.map((point, i): Marker => [point, angles[i]])\n\n return markers\n }\n\n override renderChildren(ctx: RenderingContext2D) {\n this.path(ctx)\n this.document.screen.mouse.checkPath(this, ctx)\n\n const fillRuleStyleProp = this.getStyle('fill-rule')\n\n if (ctx.fillStyle !== '') {\n if (fillRuleStyleProp.getString('inherit') !== 'inherit') {\n ctx.fill(fillRuleStyleProp.getString() as CanvasFillRule)\n } else {\n ctx.fill()\n }\n }\n\n if (ctx.strokeStyle !== '') {\n if (this.getAttribute('vector-effect').getString() === 'non-scaling-stroke') {\n ctx.save()\n ctx.setTransform(1, 0, 0, 1, 0, 0)\n ctx.stroke()\n ctx.restore()\n } else {\n ctx.stroke()\n }\n }\n\n const markers = this.getMarkers()\n\n if (markers) {\n const markersLastIndex = markers.length - 1\n const markerStartStyleProp = this.getStyle('marker-start')\n const markerMidStyleProp = this.getStyle('marker-mid')\n const markerEndStyleProp = this.getStyle('marker-end')\n\n if (markerStartStyleProp.isUrlDefinition()) {\n const marker = markerStartStyleProp.getDefinition<MarkerElement>()\n const [point, angle] = markers[0]\n\n marker.render(ctx, point, angle)\n }\n\n if (markerMidStyleProp.isUrlDefinition()) {\n const marker = markerMidStyleProp.getDefinition<MarkerElement>()\n\n for (let i = 1; i < markersLastIndex; i++) {\n const [point, angle] = markers[i]\n\n marker.render(ctx, point, angle)\n }\n }\n\n if (markerEndStyleProp.isUrlDefinition()) {\n const marker = markerEndStyleProp.getDefinition<MarkerElement>()\n const [point, angle] = markers[markersLastIndex]\n\n marker.render(ctx, point, angle)\n }\n }\n }\n\n static pathM(pathParser: PathParser) {\n const point = pathParser.getAsCurrentPoint()\n\n pathParser.start = pathParser.current\n\n return {\n point\n }\n }\n\n protected pathM(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const { point } = PathElement.pathM(pathParser)\n const {\n x,\n y\n } = point\n\n pathParser.addMarker(point)\n boundingBox.addPoint(x, y)\n\n if (ctx) {\n ctx.moveTo(x, y)\n }\n }\n\n static pathL(pathParser: PathParser) {\n const { current } = pathParser\n const point = pathParser.getAsCurrentPoint()\n\n return {\n current,\n point\n }\n }\n\n protected pathL(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n point\n } = PathElement.pathL(pathParser)\n const {\n x,\n y\n } = point\n\n pathParser.addMarker(point, current)\n boundingBox.addPoint(x, y)\n\n if (ctx) {\n ctx.lineTo(x, y)\n }\n }\n\n static pathH(pathParser: PathParser) {\n const {\n current,\n command\n } = pathParser\n const point = new Point(\n (command.relative ? current.x : 0) + command.x,\n current.y\n )\n\n pathParser.current = point\n\n return {\n current,\n point\n }\n }\n\n protected pathH(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n point\n } = PathElement.pathH(pathParser)\n const {\n x,\n y\n } = point\n\n pathParser.addMarker(point, current)\n boundingBox.addPoint(x, y)\n\n if (ctx) {\n ctx.lineTo(x, y)\n }\n }\n\n static pathV(pathParser: PathParser) {\n const {\n current,\n command\n } = pathParser\n const point = new Point(\n current.x,\n (command.relative ? current.y : 0) + command.y\n )\n\n pathParser.current = point\n\n return {\n current,\n point\n }\n }\n\n protected pathV(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n point\n } = PathElement.pathV(pathParser)\n const {\n x,\n y\n } = point\n\n pathParser.addMarker(point, current)\n boundingBox.addPoint(x, y)\n\n if (ctx) {\n ctx.lineTo(x, y)\n }\n }\n\n static pathC(pathParser: PathParser) {\n const { current } = pathParser\n const point = pathParser.getPoint('x1', 'y1')\n const controlPoint = pathParser.getAsControlPoint('x2', 'y2')\n const currentPoint = pathParser.getAsCurrentPoint()\n\n return {\n current,\n point,\n controlPoint,\n currentPoint\n }\n }\n\n protected pathC(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n point,\n controlPoint,\n currentPoint\n } = PathElement.pathC(pathParser)\n\n pathParser.addMarker(currentPoint, controlPoint, point)\n boundingBox.addBezierCurve(\n current.x,\n current.y,\n point.x,\n point.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n\n if (ctx) {\n ctx.bezierCurveTo(\n point.x,\n point.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n }\n }\n\n static pathS(pathParser: PathParser) {\n const { current } = pathParser\n const point = pathParser.getReflectedControlPoint()\n const controlPoint = pathParser.getAsControlPoint('x2', 'y2')\n const currentPoint = pathParser.getAsCurrentPoint()\n\n return {\n current,\n point,\n controlPoint,\n currentPoint\n }\n }\n\n protected pathS(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n point,\n controlPoint,\n currentPoint\n } = PathElement.pathS(pathParser)\n\n pathParser.addMarker(currentPoint, controlPoint, point)\n boundingBox.addBezierCurve(\n current.x,\n current.y,\n point.x,\n point.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n\n if (ctx) {\n ctx.bezierCurveTo(\n point.x,\n point.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n }\n }\n\n static pathQ(pathParser: PathParser) {\n const { current } = pathParser\n const controlPoint = pathParser.getAsControlPoint('x1', 'y1')\n const currentPoint = pathParser.getAsCurrentPoint()\n\n return {\n current,\n controlPoint,\n currentPoint\n }\n }\n\n protected pathQ(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n controlPoint,\n currentPoint\n } = PathElement.pathQ(pathParser)\n\n pathParser.addMarker(currentPoint, controlPoint, controlPoint)\n boundingBox.addQuadraticCurve(\n current.x,\n current.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n\n if (ctx) {\n ctx.quadraticCurveTo(\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n }\n }\n\n static pathT(pathParser: PathParser) {\n const { current } = pathParser\n const controlPoint = pathParser.getReflectedControlPoint()\n\n pathParser.control = controlPoint\n\n const currentPoint = pathParser.getAsCurrentPoint()\n\n return {\n current,\n controlPoint,\n currentPoint\n }\n }\n\n protected pathT(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n current,\n controlPoint,\n currentPoint\n } = PathElement.pathT(pathParser)\n\n pathParser.addMarker(currentPoint, controlPoint, controlPoint)\n boundingBox.addQuadraticCurve(\n current.x,\n current.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n\n if (ctx) {\n ctx.quadraticCurveTo(\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n }\n }\n\n static pathA(pathParser: PathParser) {\n const {\n current,\n command\n } = pathParser\n let {\n rX,\n rY,\n xRot,\n lArcFlag,\n sweepFlag\n } = command\n const xAxisRotation = xRot * (Math.PI / 180.0)\n const currentPoint = pathParser.getAsCurrentPoint()\n // Conversion from endpoint to center parameterization\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n // x1', y1'\n const currp = new Point(\n Math.cos(xAxisRotation) * (current.x - currentPoint.x) / 2.0\n + Math.sin(xAxisRotation) * (current.y - currentPoint.y) / 2.0,\n -Math.sin(xAxisRotation) * (current.x - currentPoint.x) / 2.0\n + Math.cos(xAxisRotation) * (current.y - currentPoint.y) / 2.0\n )\n // adjust radii\n const l =\n Math.pow(currp.x, 2) / Math.pow(rX, 2)\n + Math.pow(currp.y, 2) / Math.pow(rY, 2)\n\n if (l > 1) {\n rX *= Math.sqrt(l)\n rY *= Math.sqrt(l)\n }\n\n // cx', cy'\n let s = (lArcFlag === sweepFlag ? -1 : 1) * Math.sqrt(\n (\n (Math.pow(rX, 2) * Math.pow(rY, 2))\n - (Math.pow(rX, 2) * Math.pow(currp.y, 2))\n - (Math.pow(rY, 2) * Math.pow(currp.x, 2))\n ) / (\n Math.pow(rX, 2) * Math.pow(currp.y, 2)\n + Math.pow(rY, 2) * Math.pow(currp.x, 2)\n )\n )\n\n if (isNaN(s)) {\n s = 0\n }\n\n const cpp = new Point(\n s * rX * currp.y / rY,\n s * -rY * currp.x / rX\n )\n // cx, cy\n const centp = new Point(\n (current.x + currentPoint.x) / 2.0\n + Math.cos(xAxisRotation) * cpp.x\n - Math.sin(xAxisRotation) * cpp.y,\n (current.y + currentPoint.y) / 2.0\n + Math.sin(xAxisRotation) * cpp.x\n + Math.cos(xAxisRotation) * cpp.y\n )\n // initial angle\n const a1 = vectorsAngle([1, 0], [(currp.x - cpp.x) / rX, (currp.y - cpp.y) / rY]) // θ1\n // angle delta\n const u = [(currp.x - cpp.x) / rX, (currp.y - cpp.y) / rY] as const\n const v = [(-currp.x - cpp.x) / rX, (-currp.y - cpp.y) / rY] as const\n let ad = vectorsAngle(u, v) // Δθ\n\n if (vectorsRatio(u, v) <= -1) {\n ad = Math.PI\n }\n\n if (vectorsRatio(u, v) >= 1) {\n ad = 0\n }\n\n return {\n currentPoint,\n rX,\n rY,\n sweepFlag,\n xAxisRotation,\n centp,\n a1,\n ad\n }\n }\n\n protected pathA(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n const { pathParser } = this\n const {\n currentPoint,\n rX,\n rY,\n sweepFlag,\n xAxisRotation,\n centp,\n a1,\n ad\n } = PathElement.pathA(pathParser)\n // for markers\n const dir = 1 - sweepFlag ? 1.0 : -1.0\n const ah = a1 + dir * (ad / 2.0)\n const halfWay = new Point(\n centp.x + rX * Math.cos(ah),\n centp.y + rY * Math.sin(ah)\n )\n\n pathParser.addMarkerAngle(halfWay, ah - dir * Math.PI / 2)\n pathParser.addMarkerAngle(currentPoint, ah - dir * Math.PI)\n boundingBox.addPoint(currentPoint.x, currentPoint.y) // TODO: this is too naive, make it better\n\n if (ctx && !isNaN(a1) && !isNaN(ad)) {\n const r = rX > rY ? rX : rY\n const sx = rX > rY ? 1 : rX / rY\n const sy = rX > rY ? rY / rX : 1\n\n ctx.translate(centp.x, centp.y)\n ctx.rotate(xAxisRotation)\n ctx.scale(sx, sy)\n ctx.arc(0, 0, r, a1, a1 + ad, Boolean(1 - sweepFlag))\n ctx.scale(1 / sx, 1 / sy)\n ctx.rotate(-xAxisRotation)\n ctx.translate(-centp.x, -centp.y)\n }\n }\n\n static pathZ(pathParser: PathParser) {\n pathParser.current = pathParser.start\n }\n\n protected pathZ(\n ctx: RenderingContext2D | undefined,\n boundingBox: BoundingBox\n ) {\n PathElement.pathZ(this.pathParser)\n\n if (ctx) {\n // only close path if it is not a straight line\n if (boundingBox.x1 !== boundingBox.x2\n && boundingBox.y1 !== boundingBox.y2\n ) {\n ctx.closePath()\n }\n }\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { toNumbers } from '../util'\nimport { Property } from '../Property'\nimport { Font } from '../Font'\nimport { RenderedElement } from './RenderedElement'\n\nexport class SVGElement extends RenderedElement {\n override type = 'svg'\n root = false\n\n override setContext(ctx: RenderingContext2D) {\n const { document } = this\n const {\n screen,\n window\n } = document\n const canvas = ctx.canvas\n\n screen.setDefaults(ctx)\n\n if ('style' in canvas\n && typeof ctx.font !== 'undefined'\n && window\n && typeof window.getComputedStyle !== 'undefined'\n ) {\n ctx.font = window.getComputedStyle(canvas).getPropertyValue('font')\n\n const fontSizeProp = new Property(\n document,\n 'fontSize',\n Font.parse(ctx.font).fontSize\n )\n\n if (fontSizeProp.hasValue()) {\n document.rootEmSize = fontSizeProp.getPixels('y')\n document.emSize = document.rootEmSize\n }\n }\n\n // create new view port\n if (!this.getAttribute('x').hasValue()) {\n this.getAttribute('x', true).setValue(0)\n }\n\n if (!this.getAttribute('y').hasValue()) {\n this.getAttribute('y', true).setValue(0)\n }\n\n let {\n width,\n height\n } = screen.viewPort\n\n if (!this.getStyle('width').hasValue()) {\n this.getStyle('width', true).setValue('100%')\n }\n\n if (!this.getStyle('height').hasValue()) {\n this.getStyle('height', true).setValue('100%')\n }\n\n if (!this.getStyle('color').hasValue()) {\n this.getStyle('color', true).setValue('black')\n }\n\n const refXAttr = this.getAttribute('refX')\n const refYAttr = this.getAttribute('refY')\n const viewBoxAttr = this.getAttribute('viewBox')\n const viewBox = viewBoxAttr.hasValue()\n ? toNumbers(viewBoxAttr.getString())\n : null\n const clip = !this.root\n && this.getStyle('overflow').getValue('hidden') !== 'visible'\n let minX = 0\n let minY = 0\n let clipX = 0\n let clipY = 0\n\n if (viewBox) {\n minX = viewBox[0]\n minY = viewBox[1]\n }\n\n if (!this.root) {\n width = this.getStyle('width').getPixels('x')\n height = this.getStyle('height').getPixels('y')\n\n if (this.type === 'marker') {\n clipX = minX\n clipY = minY\n minX = 0\n minY = 0\n }\n }\n\n screen.viewPort.setCurrent(width, height)\n\n // Default value of transform-origin is center only for root SVG elements\n // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform-origin\n if (this.node // is not temporary SVGElement\n && (!this.parent || this.node.parentNode?.nodeName === 'foreignObject')\n && this.getStyle('transform', false, true).hasValue()\n && !this.getStyle('transform-origin', false, true).hasValue()\n ) {\n this.getStyle('transform-origin', true, true).setValue('50% 50%')\n }\n\n super.setContext(ctx)\n\n ctx.translate(\n this.getAttribute('x').getPixels('x'),\n this.getAttribute('y').getPixels('y')\n )\n\n if (viewBox) {\n width = viewBox[2]\n height = viewBox[3]\n }\n\n document.setViewBox({\n ctx,\n aspectRatio: this.getAttribute('preserveAspectRatio').getString(),\n width: screen.viewPort.width,\n desiredWidth: width,\n height: screen.viewPort.height,\n desiredHeight: height,\n minX,\n minY,\n refX: refXAttr.getValue() as number,\n refY: refYAttr.getValue() as number,\n clip,\n clipX,\n clipY\n })\n\n if (viewBox) {\n screen.viewPort.removeCurrent()\n screen.viewPort.setCurrent(width, height)\n }\n }\n\n override clearContext(ctx: RenderingContext2D) {\n super.clearContext(ctx)\n\n this.document.screen.viewPort.removeCurrent()\n }\n\n /**\n * Resize SVG to fit in given size.\n * @param width\n * @param height\n * @param preserveAspectRatio\n */\n resize(\n width: number,\n height = width,\n preserveAspectRatio: boolean | string = false\n ) {\n const widthAttr = this.getAttribute('width', true)\n const heightAttr = this.getAttribute('height', true)\n const viewBoxAttr = this.getAttribute('viewBox')\n const styleAttr = this.getAttribute('style')\n const originWidth = widthAttr.getNumber(0)\n const originHeight = heightAttr.getNumber(0)\n\n if (preserveAspectRatio) {\n if (typeof preserveAspectRatio === 'string') {\n this.getAttribute('preserveAspectRatio', true).setValue(preserveAspectRatio)\n } else {\n const preserveAspectRatioAttr = this.getAttribute('preserveAspectRatio')\n\n if (preserveAspectRatioAttr.hasValue()) {\n preserveAspectRatioAttr.setValue(preserveAspectRatioAttr.getString().replace(/^\\s*(\\S.*\\S)\\s*$/, '$1'))\n }\n }\n }\n\n widthAttr.setValue(width)\n heightAttr.setValue(height)\n\n if (!viewBoxAttr.hasValue()) {\n viewBoxAttr.setValue(`0 0 ${originWidth || width} ${originHeight || height}`)\n }\n\n if (styleAttr.hasValue()) {\n const widthStyle = this.getStyle('width')\n const heightStyle = this.getStyle('height')\n\n if (widthStyle.hasValue()) {\n widthStyle.setValue(`${width}px`)\n }\n\n if (heightStyle.hasValue()) {\n heightStyle.setValue(`${height}px`)\n }\n }\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { BoundingBox } from '../BoundingBox'\nimport { PathElement } from './PathElement'\n\nexport class RectElement extends PathElement {\n override type = 'rect'\n\n override path(ctx: RenderingContext2D) {\n const x = this.getAttribute('x').getPixels('x')\n const y = this.getAttribute('y').getPixels('y')\n const width = this.getStyle('width', false, true).getPixels('x')\n const height = this.getStyle('height', false, true).getPixels('y')\n const rxAttr = this.getAttribute('rx')\n const ryAttr = this.getAttribute('ry')\n let rx = rxAttr.getPixels('x')\n let ry = ryAttr.getPixels('y')\n\n if (rxAttr.hasValue() && !ryAttr.hasValue()) {\n ry = rx\n }\n\n if (ryAttr.hasValue() && !rxAttr.hasValue()) {\n rx = ry\n }\n\n rx = Math.min(rx, width / 2.0)\n ry = Math.min(ry, height / 2.0)\n\n if (ctx) {\n const KAPPA = 4 * ((Math.sqrt(2) - 1) / 3)\n\n ctx.beginPath() // always start the path so we don't fill prior paths\n\n if (height > 0 && width > 0) {\n ctx.moveTo(x + rx, y)\n ctx.lineTo(x + width - rx, y)\n ctx.bezierCurveTo(x + width - rx + (KAPPA * rx), y, x + width, y + ry - (KAPPA * ry), x + width, y + ry)\n ctx.lineTo(x + width, y + height - ry)\n ctx.bezierCurveTo(\n x + width,\n y + height - ry + (KAPPA * ry),\n x + width - rx + (KAPPA * rx),\n y + height,\n x + width - rx,\n y + height\n )\n ctx.lineTo(x + rx, y + height)\n ctx.bezierCurveTo(x + rx - (KAPPA * rx), y + height, x, y + height - ry + (KAPPA * ry), x, y + height - ry)\n ctx.lineTo(x, y + ry)\n ctx.bezierCurveTo(x, y + ry - (KAPPA * ry), x + rx - (KAPPA * rx), y, x + rx, y)\n ctx.closePath()\n }\n }\n\n return new BoundingBox(x, y, x + width, y + height)\n }\n\n override getMarkers() {\n return null\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { BoundingBox } from '../BoundingBox'\nimport { PathElement } from './PathElement'\n\nexport class CircleElement extends PathElement {\n override type = 'circle'\n\n override path(ctx: RenderingContext2D) {\n const cx = this.getAttribute('cx').getPixels('x')\n const cy = this.getAttribute('cy').getPixels('y')\n const r = this.getAttribute('r').getPixels()\n\n if (ctx && r > 0) {\n ctx.beginPath()\n ctx.arc(cx, cy, r, 0, Math.PI * 2, false)\n ctx.closePath()\n }\n\n return new BoundingBox(\n cx - r,\n cy - r,\n cx + r,\n cy + r\n )\n }\n\n override getMarkers() {\n return null\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { BoundingBox } from '../BoundingBox'\nimport { PathElement } from './PathElement'\n\nexport class EllipseElement extends PathElement {\n override type = 'ellipse'\n\n override path(ctx: RenderingContext2D) {\n const KAPPA = 4 * ((Math.sqrt(2) - 1) / 3)\n const rx = this.getAttribute('rx').getPixels('x')\n const ry = this.getAttribute('ry').getPixels('y')\n const cx = this.getAttribute('cx').getPixels('x')\n const cy = this.getAttribute('cy').getPixels('y')\n\n if (ctx && rx > 0 && ry > 0) {\n ctx.beginPath()\n ctx.moveTo(cx + rx, cy)\n ctx.bezierCurveTo(\n cx + rx,\n cy + (KAPPA * ry),\n cx + (KAPPA * rx),\n cy + ry,\n cx,\n cy + ry\n )\n ctx.bezierCurveTo(\n cx - (KAPPA * rx),\n cy + ry,\n cx - rx,\n cy + (KAPPA * ry),\n cx - rx,\n cy\n )\n ctx.bezierCurveTo(\n cx - rx,\n cy - (KAPPA * ry),\n cx - (KAPPA * rx),\n cy - ry,\n cx,\n cy - ry\n )\n ctx.bezierCurveTo(\n cx + (KAPPA * rx),\n cy - ry,\n cx + rx,\n cy - (KAPPA * ry),\n cx + rx,\n cy\n )\n ctx.closePath()\n }\n\n return new BoundingBox(\n cx - rx,\n cy - ry,\n cx + rx,\n cy + ry\n )\n }\n\n override getMarkers() {\n return null\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Point } from '../Point'\nimport { BoundingBox } from '../BoundingBox'\nimport { PathElement, Marker } from './PathElement'\n\nexport class LineElement extends PathElement {\n override type = 'line'\n\n getPoints() {\n return [\n new Point(\n this.getAttribute('x1').getPixels('x'),\n this.getAttribute('y1').getPixels('y')\n ),\n new Point(\n this.getAttribute('x2').getPixels('x'),\n this.getAttribute('y2').getPixels('y')\n )\n ]\n }\n\n override path(ctx: RenderingContext2D) {\n const [\n {\n x: x0,\n y: y0\n },\n {\n x: x1,\n y: y1\n }\n ] = this.getPoints()\n\n if (ctx) {\n ctx.beginPath()\n ctx.moveTo(x0, y0)\n ctx.lineTo(x1, y1)\n }\n\n return new BoundingBox(\n x0,\n y0,\n x1,\n y1\n )\n }\n\n override getMarkers(): Marker[] {\n const [p0, p1] = this.getPoints()\n const a = p0.angleTo(p1)\n\n return [[p0, a], [p1, a]]\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Point } from '../Point'\nimport { BoundingBox } from '../BoundingBox'\nimport { Document } from './Document'\nimport { PathElement, Marker } from './PathElement'\n\nexport class PolylineElement extends PathElement {\n override type = 'polyline'\n protected readonly points: Point[] = []\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.points = Point.parsePath(\n this.getAttribute('points').getString()\n )\n }\n\n override path(ctx: RenderingContext2D) {\n const { points } = this\n const [\n {\n x: x0,\n y: y0\n }\n ] = points\n const boundingBox = new BoundingBox(x0, y0)\n\n if (ctx) {\n ctx.beginPath()\n ctx.moveTo(x0, y0)\n }\n\n points.forEach(({\n x,\n y\n }) => {\n boundingBox.addPoint(x, y)\n\n if (ctx) {\n ctx.lineTo(x, y)\n }\n })\n\n return boundingBox\n }\n\n override getMarkers() {\n const { points } = this\n const lastIndex = points.length - 1\n const markers: Marker[] = []\n\n points.forEach((point, i) => {\n if (i === lastIndex) {\n return\n }\n\n markers.push([point, point.angleTo(points[i + 1])])\n })\n\n if (markers.length > 0) {\n markers.push([points[points.length - 1], markers[markers.length - 1][1]])\n }\n\n return markers\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { PolylineElement } from './PolylineElement'\n\nexport class PolygonElement extends PolylineElement {\n override type = 'polygon'\n\n override path(ctx: RenderingContext2D) {\n const boundingBox = super.path(ctx)\n const [\n {\n x,\n y\n }\n ] = this.points\n\n if (ctx) {\n ctx.lineTo(x, y)\n ctx.closePath()\n }\n\n return boundingBox\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Property } from '../Property'\nimport { Element } from './Element'\nimport { SVGElement } from './SVGElement'\n\nexport class PatternElement extends Element {\n override type = 'pattern'\n\n createPattern(\n ctx: RenderingContext2D,\n _: Element,\n parentOpacityProp: Property\n ) {\n const width = this.getStyle('width').getPixels('x', true)\n const height = this.getStyle('height').getPixels('y', true)\n // render me using a temporary svg element\n const patternSvg = new SVGElement(\n this.document,\n null\n )\n\n patternSvg.attributes.viewBox = new Property(\n this.document,\n 'viewBox',\n this.getAttribute('viewBox').getValue()\n )\n patternSvg.attributes.width = new Property(\n this.document,\n 'width',\n `${width}px`\n )\n patternSvg.attributes.height = new Property(\n this.document,\n 'height',\n `${height}px`\n )\n patternSvg.attributes.transform = new Property(\n this.document,\n 'transform',\n this.getAttribute('patternTransform').getValue()\n )\n patternSvg.children = this.children\n\n const patternCanvas = this.document.createCanvas(width, height)\n const patternCtx = patternCanvas.getContext('2d')\n const xAttr = this.getAttribute('x')\n const yAttr = this.getAttribute('y')\n\n if (xAttr.hasValue() && yAttr.hasValue()) {\n patternCtx.translate(\n xAttr.getPixels('x', true),\n yAttr.getPixels('y', true)\n )\n }\n\n if (parentOpacityProp.hasValue()) {\n this.styles['fill-opacity'] = parentOpacityProp\n } else {\n Reflect.deleteProperty(this.styles, 'fill-opacity')\n }\n\n // render 3x3 grid so when we transform there's no white space on edges\n for (let x = -1; x <= 1; x++) {\n for (let y = -1; y <= 1; y++) {\n patternCtx.save()\n patternSvg.attributes.x = new Property(\n this.document,\n 'x',\n x * patternCanvas.width\n )\n patternSvg.attributes.y = new Property(\n this.document,\n 'y',\n y * patternCanvas.height\n )\n patternSvg.render(patternCtx)\n patternCtx.restore()\n }\n }\n\n const pattern = ctx.createPattern(patternCanvas as CanvasImageSource, 'repeat')\n\n return pattern\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Point } from '../Point'\nimport { Property } from '../Property'\nimport { Element } from './Element'\nimport { SVGElement } from './SVGElement'\n\nexport class MarkerElement extends Element {\n override type = 'marker'\n\n override render(ctx: RenderingContext2D, point?: Point, angle?: number) {\n if (!point) {\n return\n }\n\n const {\n x,\n y\n } = point\n const orient = this.getAttribute('orient').getString('auto')\n const markerUnits = this.getAttribute('markerUnits').getString('strokeWidth')\n\n ctx.translate(x, y)\n\n if (orient === 'auto') {\n ctx.rotate(angle)\n }\n\n if (markerUnits === 'strokeWidth') {\n ctx.scale(ctx.lineWidth, ctx.lineWidth)\n }\n\n ctx.save()\n\n // render me using a temporary svg element\n const markerSvg = new SVGElement(this.document)\n\n markerSvg.type = this.type\n markerSvg.attributes.viewBox = new Property(\n this.document,\n 'viewBox',\n this.getAttribute('viewBox').getValue()\n )\n markerSvg.attributes.refX = new Property(\n this.document,\n 'refX',\n this.getAttribute('refX').getValue()\n )\n markerSvg.attributes.refY = new Property(\n this.document,\n 'refY',\n this.getAttribute('refY').getValue()\n )\n markerSvg.attributes.width = new Property(\n this.document,\n 'width',\n this.getAttribute('markerWidth').getValue()\n )\n markerSvg.attributes.height = new Property(\n this.document,\n 'height',\n this.getAttribute('markerHeight').getValue()\n )\n markerSvg.attributes.overflow = new Property(\n this.document,\n 'overflow',\n this.getAttribute('overflow').getValue()\n )\n markerSvg.attributes.fill = new Property(\n this.document,\n 'fill',\n this.getAttribute('fill').getColor('black')\n )\n markerSvg.attributes.stroke = new Property(\n this.document,\n 'stroke',\n this.getAttribute('stroke').getValue('none')\n )\n markerSvg.children = this.children\n\n markerSvg.render(ctx)\n\n ctx.restore()\n\n if (markerUnits === 'strokeWidth') {\n ctx.scale(1 / ctx.lineWidth, 1 / ctx.lineWidth)\n }\n\n if (orient === 'auto') {\n ctx.rotate(-angle)\n }\n\n ctx.translate(-x, -y)\n }\n}\n","import { Element } from './Element'\n\nexport class DefsElement extends Element {\n override type = 'defs'\n\n override render() {\n // NOOP\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { BoundingBox } from '../BoundingBox'\nimport { PathElement } from './PathElement'\nimport { RenderedElement } from './RenderedElement'\n\nexport class GElement extends RenderedElement {\n override type = 'g'\n\n getBoundingBox(ctx: RenderingContext2D) {\n const boundingBox = new BoundingBox()\n\n this.children.forEach((child: PathElement) => {\n boundingBox.addBoundingBox(child.getBoundingBox(ctx))\n })\n\n return boundingBox\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Screen } from '../Screen'\nimport { Property } from '../Property'\nimport { Document } from './Document'\nimport { Element } from './Element'\nimport { PathElement } from './PathElement'\nimport { SVGElement } from './SVGElement'\nimport { RectElement } from './RectElement'\nimport { StopElement } from './StopElement'\nimport { GElement } from './GElement'\n\nexport abstract class GradientElement extends Element {\n readonly attributesToInherit = ['gradientUnits']\n\n protected readonly stops: StopElement[] = []\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n const {\n stops,\n children\n } = this\n\n children.forEach((child) => {\n if (child.type === 'stop') {\n stops.push(child as StopElement)\n }\n })\n }\n\n abstract getGradient(ctx: RenderingContext2D, element: PathElement): CanvasGradient | null\n\n getGradientUnits() {\n return this.getAttribute('gradientUnits').getString('objectBoundingBox')\n }\n\n createGradient(\n ctx: RenderingContext2D,\n element: PathElement,\n parentOpacityProp: Property\n ) {\n // eslint-disable-next-line @typescript-eslint/no-this-alias, consistent-this\n let stopsContainer = this\n\n if (this.getHrefAttribute().hasValue()) {\n stopsContainer = this.getHrefAttribute().getDefinition()\n this.inheritStopContainer(stopsContainer)\n }\n\n const { stops } = stopsContainer\n const gradient = this.getGradient(ctx, element)\n\n if (!gradient) {\n return this.addParentOpacity(\n parentOpacityProp,\n stops[stops.length - 1].color\n )\n }\n\n stops.forEach((stop: StopElement) => {\n gradient.addColorStop(\n stop.offset,\n this.addParentOpacity(\n parentOpacityProp,\n stop.color\n )\n )\n })\n\n if (this.getAttribute('gradientTransform').hasValue()) {\n // render as transformed pattern on temporary canvas\n const { document } = this\n const { MAX_VIRTUAL_PIXELS } = Screen\n const { viewPort } = document.screen\n const rootView = viewPort.getRoot()\n const rect = new RectElement(document)\n\n rect.attributes.x = new Property(\n document,\n 'x',\n -MAX_VIRTUAL_PIXELS / 3.0\n )\n rect.attributes.y = new Property(\n document,\n 'y',\n -MAX_VIRTUAL_PIXELS / 3.0\n )\n rect.attributes.width = new Property(\n document,\n 'width',\n MAX_VIRTUAL_PIXELS\n )\n rect.attributes.height = new Property(\n document,\n 'height',\n MAX_VIRTUAL_PIXELS\n )\n\n const group = new GElement(document)\n\n group.attributes.transform = new Property(\n document,\n 'transform',\n this.getAttribute('gradientTransform').getValue()\n )\n group.children = [rect]\n\n const patternSvg = new SVGElement(document)\n\n patternSvg.attributes.x = new Property(\n document,\n 'x',\n 0\n )\n patternSvg.attributes.y = new Property(\n document,\n 'y',\n 0\n )\n patternSvg.attributes.width = new Property(\n document,\n 'width',\n rootView.width\n )\n patternSvg.attributes.height = new Property(\n document,\n 'height',\n rootView.height\n )\n patternSvg.children = [group]\n\n const patternCanvas = document.createCanvas(rootView.width, rootView.height)\n const patternCtx = patternCanvas.getContext('2d')\n\n patternCtx.fillStyle = gradient\n patternSvg.render(patternCtx)\n\n return patternCtx.createPattern(patternCanvas as CanvasImageSource, 'no-repeat')\n }\n\n return gradient\n }\n\n protected inheritStopContainer(stopsContainer: Element) {\n this.attributesToInherit.forEach((attributeToInherit) => {\n if (!this.getAttribute(attributeToInherit).hasValue()\n && stopsContainer.getAttribute(attributeToInherit).hasValue()\n ) {\n this.getAttribute(attributeToInherit, true)\n .setValue(stopsContainer.getAttribute(attributeToInherit).getValue())\n }\n })\n }\n\n protected addParentOpacity(parentOpacityProp: Property, color: string) {\n if (parentOpacityProp.hasValue()) {\n const colorProp = new Property(\n this.document,\n 'color',\n color\n )\n\n return colorProp.addOpacity(parentOpacityProp).getColor()\n }\n\n return color\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Document } from './Document'\nimport { PathElement } from './PathElement'\nimport { GradientElement } from './GradientElement'\n\nexport class LinearGradientElement extends GradientElement {\n override type = 'linearGradient'\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.attributesToInherit.push(\n 'x1',\n 'y1',\n 'x2',\n 'y2'\n )\n }\n\n getGradient(ctx: RenderingContext2D, element: PathElement) {\n const isBoundingBoxUnits = this.getGradientUnits() === 'objectBoundingBox'\n const boundingBox = isBoundingBoxUnits\n ? element.getBoundingBox(ctx)\n : null\n\n if (isBoundingBoxUnits && !boundingBox) {\n return null\n }\n\n if (!this.getAttribute('x1').hasValue()\n && !this.getAttribute('y1').hasValue()\n && !this.getAttribute('x2').hasValue()\n && !this.getAttribute('y2').hasValue()\n ) {\n this.getAttribute('x1', true).setValue(0)\n this.getAttribute('y1', true).setValue(0)\n this.getAttribute('x2', true).setValue(1)\n this.getAttribute('y2', true).setValue(0)\n }\n\n const x1 = isBoundingBoxUnits\n ? boundingBox.x + boundingBox.width * this.getAttribute('x1').getNumber()\n : this.getAttribute('x1').getPixels('x')\n const y1 = isBoundingBoxUnits\n ? boundingBox.y + boundingBox.height * this.getAttribute('y1').getNumber()\n : this.getAttribute('y1').getPixels('y')\n const x2 = isBoundingBoxUnits\n ? boundingBox.x + boundingBox.width * this.getAttribute('x2').getNumber()\n : this.getAttribute('x2').getPixels('x')\n const y2 = isBoundingBoxUnits\n ? boundingBox.y + boundingBox.height * this.getAttribute('y2').getNumber()\n : this.getAttribute('y2').getPixels('y')\n\n if (x1 === x2 && y1 === y2) {\n return null\n }\n\n return ctx.createLinearGradient(x1, y1, x2, y2)\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Document } from './Document'\nimport { PathElement } from './PathElement'\nimport { GradientElement } from './GradientElement'\n\nexport class RadialGradientElement extends GradientElement {\n override type = 'radialGradient'\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.attributesToInherit.push(\n 'cx',\n 'cy',\n 'r',\n 'fx',\n 'fy',\n 'fr'\n )\n }\n\n getGradient(ctx: RenderingContext2D, element: PathElement) {\n const isBoundingBoxUnits = this.getGradientUnits() === 'objectBoundingBox'\n const boundingBox = element.getBoundingBox(ctx)\n\n if (isBoundingBoxUnits && !boundingBox) {\n return null\n }\n\n if (!this.getAttribute('cx').hasValue()) {\n this.getAttribute('cx', true).setValue('50%')\n }\n\n if (!this.getAttribute('cy').hasValue()) {\n this.getAttribute('cy', true).setValue('50%')\n }\n\n if (!this.getAttribute('r').hasValue()) {\n this.getAttribute('r', true).setValue('50%')\n }\n\n const cx = isBoundingBoxUnits\n ? boundingBox.x + boundingBox.width * this.getAttribute('cx').getNumber()\n : this.getAttribute('cx').getPixels('x')\n const cy = isBoundingBoxUnits\n ? boundingBox.y + boundingBox.height * this.getAttribute('cy').getNumber()\n : this.getAttribute('cy').getPixels('y')\n let fx = cx\n let fy = cy\n\n if (this.getAttribute('fx').hasValue()) {\n fx = isBoundingBoxUnits\n ? boundingBox.x + boundingBox.width * this.getAttribute('fx').getNumber()\n : this.getAttribute('fx').getPixels('x')\n }\n\n if (this.getAttribute('fy').hasValue()) {\n fy = isBoundingBoxUnits\n ? boundingBox.y + boundingBox.height * this.getAttribute('fy').getNumber()\n : this.getAttribute('fy').getPixels('y')\n }\n\n const r = isBoundingBoxUnits\n ? (boundingBox.width + boundingBox.height) / 2.0 * this.getAttribute('r').getNumber()\n : this.getAttribute('r').getPixels()\n const fr = this.getAttribute('fr').getPixels()\n\n return ctx.createRadialGradient(fx, fy, fr, cx, cy, r)\n }\n}\n","import { Document } from './Document'\nimport { Element } from './Element'\n\nexport class StopElement extends Element {\n override type = 'stop'\n readonly offset: number\n readonly color: string\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n const offset = Math.max(0, Math.min(1, this.getAttribute('offset').getNumber()))\n const stopOpacity = this.getStyle('stop-opacity')\n let stopColor = this.getStyle('stop-color', true)\n\n if (stopColor.getString() === '') {\n stopColor.setValue('#000')\n }\n\n if (stopOpacity.hasValue()) {\n stopColor = stopColor.addOpacity(stopOpacity)\n }\n\n this.offset = offset\n this.color = stopColor.getColor()\n }\n}\n","import { Property } from '../Property'\nimport { Document } from './Document'\nimport { Element } from './Element'\n\nexport interface IProgress {\n from: Property\n to: Property\n progress: number\n}\n\nexport class AnimateElement extends Element {\n override type = 'animate'\n protected readonly begin: number\n protected readonly maxDuration: number\n protected readonly from: Property\n protected readonly to: Property\n protected readonly values: Property<string[]>\n protected duration = 0\n protected initialValue: string | undefined\n protected initialUnits = ''\n protected removed = false\n protected frozen = false\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n document.screen.animations.push(this)\n\n this.begin = this.getAttribute('begin').getMilliseconds()\n this.maxDuration = this.begin + this.getAttribute('dur').getMilliseconds()\n this.from = this.getAttribute('from')\n this.to = this.getAttribute('to')\n this.values = new Property<string[] | null>(document, 'values', null)\n\n const valuesAttr = this.getAttribute('values')\n\n if (valuesAttr.hasValue()) {\n this.values.setValue(valuesAttr.getString().split(';'))\n }\n }\n\n protected getProperty() {\n const attributeType = this.getAttribute('attributeType').getString()\n const attributeName = this.getAttribute('attributeName').getString()\n\n if (attributeType === 'CSS') {\n return this.parent.getStyle(attributeName, true)\n }\n\n return this.parent.getAttribute(attributeName, true)\n }\n\n calcValue() {\n const { initialUnits } = this\n const {\n progress,\n from,\n to\n } = this.getProgress()\n // tween value linearly\n let newValue = from.getNumber() + (to.getNumber() - from.getNumber()) * progress\n\n if (initialUnits === '%') {\n newValue *= 100.0 // numValue() returns 0-1 whereas properties are 0-100\n }\n\n return `${newValue}${initialUnits}`\n }\n\n update(delta: number) {\n const { parent } = this\n const prop = this.getProperty()\n\n // set initial value\n if (!this.initialValue) {\n this.initialValue = prop.getString()\n this.initialUnits = prop.getUnits()\n }\n\n // if we're past the end time\n if (this.duration > this.maxDuration) {\n const fill = this.getAttribute('fill').getString('remove')\n\n // loop for indefinitely repeating animations\n if (this.getAttribute('repeatCount').getString() === 'indefinite'\n || this.getAttribute('repeatDur').getString() === 'indefinite'\n ) {\n this.duration = 0\n } else\n if (fill === 'freeze' && !this.frozen) {\n this.frozen = true\n\n if (parent && prop) {\n parent.animationFrozen = true\n parent.animationFrozenValue = prop.getString()\n }\n } else\n if (fill === 'remove' && !this.removed) {\n this.removed = true\n\n if (parent && prop) {\n prop.setValue(\n parent.animationFrozen\n ? parent.animationFrozenValue\n : this.initialValue\n )\n }\n\n return true\n }\n\n return false\n }\n\n this.duration += delta\n\n // if we're past the begin time\n let updated = false\n\n if (this.begin < this.duration) {\n let newValue = this.calcValue() // tween\n const typeAttr = this.getAttribute('type')\n\n if (typeAttr.hasValue()) {\n // for transform, etc.\n const type = typeAttr.getString()\n\n newValue = `${type}(${newValue})`\n }\n\n prop.setValue(newValue)\n updated = true\n }\n\n return updated\n }\n\n getProgress(): IProgress {\n const {\n document,\n values\n } = this\n let progress = (this.duration - this.begin) / (this.maxDuration - this.begin)\n let from: Property\n let to: Property\n\n if (values.hasValue()) {\n const p = progress * (values.getValue().length - 1)\n const lb = Math.floor(p)\n const ub = Math.ceil(p)\n let value: string | undefined\n\n value = values.getValue()[lb]\n from = new Property(\n document,\n 'from',\n value ? parseFloat(value) : 0\n )\n\n value = values.getValue()[ub]\n to = new Property(\n document,\n 'to',\n value ? parseFloat(value) : 0\n )\n\n progress = (p - lb) / (ub - lb)\n } else {\n from = this.from\n to = this.to\n }\n\n return {\n progress,\n from,\n to\n }\n }\n}\n","import RGBColor from 'rgbcolor'\nimport { AnimateElement } from './AnimateElement'\n\nexport class AnimateColorElement extends AnimateElement {\n override type = 'animateColor'\n\n override calcValue() {\n const {\n progress,\n from,\n to\n } = this.getProgress()\n const colorFrom = new RGBColor(from.getColor())\n const colorTo = new RGBColor(to.getColor())\n\n if (colorFrom.ok && colorTo.ok) {\n // tween color linearly\n const r = colorFrom.r + (colorTo.r - colorFrom.r) * progress\n const g = colorFrom.g + (colorTo.g - colorFrom.g) * progress\n const b = colorFrom.b + (colorTo.b - colorFrom.b) * progress\n\n // ? alpha\n return `rgb(${\n Math.floor(r)\n }, ${\n Math.floor(g)\n }, ${\n Math.floor(b)\n })`\n }\n\n return this.getAttribute('from').getColor()\n }\n}\n","import { toNumbers } from '../util'\nimport { AnimateElement } from './AnimateElement'\n\nexport class AnimateTransformElement extends AnimateElement {\n override type = 'animateTransform'\n\n override calcValue() {\n const {\n progress,\n from,\n to\n } = this.getProgress()\n // tween value linearly\n const transformFrom = toNumbers(from.getString())\n const transformTo = toNumbers(to.getString())\n const newValue = transformFrom.map((from, i) => {\n const to = transformTo[i]\n\n return from + (to - from) * progress\n }).join(' ')\n\n return newValue\n }\n}\n","import { Document } from './Document'\nimport { Element } from './Element'\n\nexport class FontFaceElement extends Element {\n override type = 'font-face'\n readonly ascent: number\n readonly descent: number\n readonly unitsPerEm: number\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.ascent = this.getAttribute('ascent').getNumber()\n this.descent = this.getAttribute('descent').getNumber()\n this.unitsPerEm = this.getAttribute('units-per-em').getNumber()\n }\n}\n","import { Document } from './Document'\nimport { PathElement } from './PathElement'\n\nexport type ArabicForm = 'isolated' | 'terminal' | 'medial' | 'initial'\n\nexport class GlyphElement extends PathElement {\n override type = 'glyph'\n readonly horizAdvX: number\n readonly unicode: string\n readonly arabicForm: ArabicForm | undefined\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.horizAdvX = this.getAttribute('horiz-adv-x').getNumber()\n this.unicode = this.getAttribute('unicode').getString()\n this.arabicForm = this.getAttribute('arabic-form').getString() as ArabicForm\n }\n}\n","import { GlyphElement } from './GlyphElement'\n\nexport class MissingGlyphElement extends GlyphElement {\n override type = 'missing-glyph'\n override readonly horizAdvX = 0\n}\n","import { Document } from './Document'\nimport { Element } from './Element'\nimport { FontFaceElement } from './FontFaceElement'\nimport { MissingGlyphElement } from './MissingGlyphElement'\nimport { ArabicForm, GlyphElement } from './GlyphElement'\n\nexport class FontElement extends Element {\n override type = 'font'\n readonly isArabic: boolean = false\n readonly missingGlyph: MissingGlyphElement | undefined\n readonly glyphs: Record<string, GlyphElement> = {}\n readonly arabicGlyphs: Record<string, Partial<Record<ArabicForm, GlyphElement>>> = {}\n readonly horizAdvX: number\n readonly isRTL: boolean = false\n readonly fontFace: FontFaceElement | undefined\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.horizAdvX = this.getAttribute('horiz-adv-x').getNumber()\n\n const { definitions } = document\n const { children } = this\n\n for (const child of children) {\n if (child instanceof FontFaceElement) {\n this.fontFace = child\n\n const fontFamilyStyle = child.getStyle('font-family')\n\n if (fontFamilyStyle.hasValue()) {\n definitions[fontFamilyStyle.getString()] = this\n }\n } else\n if (child instanceof MissingGlyphElement) {\n this.missingGlyph = child\n } else\n if (child instanceof GlyphElement) {\n if (child.arabicForm) {\n this.isRTL = true\n this.isArabic = true\n\n const arabicGlyph = this.arabicGlyphs[child.unicode]\n\n if (typeof arabicGlyph === 'undefined') {\n this.arabicGlyphs[child.unicode] = {\n [child.arabicForm]: child\n }\n } else {\n arabicGlyph[child.arabicForm] = child\n }\n } else {\n this.glyphs[child.unicode] = child\n }\n }\n }\n }\n\n override render() {\n // NO RENDER\n }\n}\n","import { TextElement } from './TextElement'\n\nexport class TRefElement extends TextElement {\n override type = 'tref'\n\n override getText() {\n const element = this.getHrefAttribute().getDefinition()\n\n if (element) {\n const firstChild = element.children[0] as TextElement\n\n if (firstChild) {\n return firstChild.getText()\n }\n }\n\n return ''\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Property } from '../Property'\nimport { Font } from '../Font'\nimport { BoundingBox } from '../BoundingBox'\nimport { Document } from './Document'\nimport { TextElement } from './TextElement'\nimport { GElement } from './GElement'\n\nexport class AElement extends TextElement {\n override type = 'a'\n protected readonly hasText: boolean\n protected readonly text: string\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n const { childNodes } = node\n const firstChild = childNodes[0]\n const hasText = childNodes.length > 0\n && Array.from(childNodes).every(node => node.nodeType === 3)\n\n this.hasText = hasText\n this.text = hasText\n ? this.getTextFromNode(firstChild)\n : ''\n }\n\n override getText() {\n return this.text\n }\n\n override renderChildren(ctx: RenderingContext2D) {\n if (this.hasText) {\n // render as text element\n super.renderChildren(ctx)\n\n const {\n document,\n x,\n y\n } = this\n const { mouse } = document.screen\n const fontSize = new Property(\n document,\n 'fontSize',\n Font.parse(document.ctx.font).fontSize\n )\n\n // Do not calc bounding box if mouse is not working.\n if (mouse.isWorking()) {\n mouse.checkBoundingBox(\n this,\n new BoundingBox(\n x,\n y - fontSize.getPixels('y'),\n x + this.measureText(ctx),\n y\n )\n )\n }\n } else\n if (this.children.length > 0) {\n // render as temporary group\n const g = new GElement(this.document)\n\n g.children = this.children\n g.parent = this\n g.render(ctx)\n }\n }\n\n onClick() {\n const { window } = this.document\n\n if (window) {\n window.open(this.getHrefAttribute().getString())\n }\n }\n\n onMouseMove() {\n const ctx = this.document.ctx as CanvasRenderingContext2D\n\n ctx.canvas.style.cursor = 'pointer'\n }\n}\n","import { RenderingContext2D } from '../types'\nimport {\n PSEUDO_ZERO,\n CB1,\n CB2,\n CB3,\n CB4,\n QB1,\n QB2,\n QB3\n} from '../util'\nimport { PathParser, CommandType } from '../PathParser'\nimport { Document } from './Document'\nimport { TextElement } from './TextElement'\nimport { PathElement } from './PathElement'\n\nexport interface IPoint {\n x: number\n y: number\n}\n\nexport interface IPathCommand {\n type: CommandType\n points: number[]\n start?: IPoint\n pathLength: number\n}\n\ninterface ICachedPoint extends IPoint {\n distance: number\n}\n\ninterface IEquidistantCache {\n step: number\n precision: number\n points: ICachedPoint[]\n}\n\ninterface IGlyphInfo {\n // transposeX: number;\n // transposeY: number;\n text: string\n rotation: number\n p0: ICachedPoint\n p1: ICachedPoint\n}\n\nexport class TextPathElement extends TextElement {\n override type = 'textPath'\n protected textWidth = 0\n protected textHeight = 0\n protected pathLength = -1\n protected glyphInfo: IGlyphInfo[] = null\n protected readonly text: string\n protected readonly dataArray: IPathCommand[]\n private letterSpacingCache: number[] = []\n private equidistantCache: IEquidistantCache\n private readonly measuresCache = new Map<string, number>([['', 0]])\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n const pathElement = this.getHrefAttribute().getDefinition<PathElement>()\n\n this.text = this.getTextFromNode()\n this.dataArray = this.parsePathData(pathElement)\n }\n\n override getText() {\n return this.text\n }\n\n path(ctx: RenderingContext2D) {\n const { dataArray } = this\n\n if (ctx) {\n ctx.beginPath()\n }\n\n dataArray.forEach(({\n type,\n points\n }) => {\n switch (type) {\n case PathParser.LINE_TO:\n\n if (ctx) {\n ctx.lineTo(points[0], points[1])\n }\n\n break\n\n case PathParser.MOVE_TO:\n\n if (ctx) {\n ctx.moveTo(points[0], points[1])\n }\n\n break\n\n case PathParser.CURVE_TO:\n\n if (ctx) {\n ctx.bezierCurveTo(\n points[0],\n points[1],\n points[2],\n points[3],\n points[4],\n points[5]\n )\n }\n\n break\n\n case PathParser.QUAD_TO:\n\n if (ctx) {\n ctx.quadraticCurveTo(\n points[0],\n points[1],\n points[2],\n points[3]\n )\n }\n\n break\n\n case PathParser.ARC: {\n const [\n cx,\n cy,\n rx,\n ry,\n theta,\n dTheta,\n psi,\n fs\n ] = points\n const r = rx > ry ? rx : ry\n const scaleX = rx > ry ? 1 : rx / ry\n const scaleY = rx > ry ? ry / rx : 1\n\n if (ctx) {\n ctx.translate(cx, cy)\n ctx.rotate(psi)\n ctx.scale(scaleX, scaleY)\n ctx.arc(0, 0, r, theta, theta + dTheta, Boolean(1 - fs))\n ctx.scale(1 / scaleX, 1 / scaleY)\n ctx.rotate(-psi)\n ctx.translate(-cx, -cy)\n }\n\n break\n }\n\n case PathParser.CLOSE_PATH:\n\n if (ctx) {\n ctx.closePath()\n }\n\n break\n\n default:\n }\n })\n }\n\n override renderChildren(ctx: RenderingContext2D) {\n this.setTextData(ctx)\n ctx.save()\n\n const textDecoration = this.parent.getStyle('text-decoration').getString()\n const fontSize = this.getFontSize()\n const { glyphInfo } = this\n const fill = ctx.fillStyle\n\n if (textDecoration === 'underline') {\n ctx.beginPath()\n }\n\n glyphInfo.forEach((glyph, i) => {\n const {\n p0,\n p1,\n rotation,\n text: partialText\n } = glyph\n\n ctx.save()\n ctx.translate(p0.x, p0.y)\n ctx.rotate(rotation)\n\n if (ctx.fillStyle) {\n ctx.fillText(partialText, 0, 0)\n }\n\n if (ctx.strokeStyle) {\n ctx.strokeText(partialText, 0, 0)\n }\n\n ctx.restore()\n\n if (textDecoration === 'underline') {\n if (i === 0) {\n ctx.moveTo(p0.x, p0.y + fontSize / 8)\n }\n\n ctx.lineTo(p1.x, p1.y + fontSize / 5)\n }\n\n // // To assist with debugging visually, uncomment following\n //\n // ctx.beginPath();\n // if (i % 2)\n // ctx.strokeStyle = 'red';\n // else\n // ctx.strokeStyle = 'green';\n // ctx.moveTo(p0.x, p0.y);\n // ctx.lineTo(p1.x, p1.y);\n // ctx.stroke();\n // ctx.closePath();\n })\n\n if (textDecoration === 'underline') {\n ctx.lineWidth = fontSize / 20\n ctx.strokeStyle = fill\n ctx.stroke()\n ctx.closePath()\n }\n\n ctx.restore()\n }\n\n protected getLetterSpacingAt(idx = 0) {\n return this.letterSpacingCache[idx] || 0\n }\n\n protected findSegmentToFitChar(\n ctx: RenderingContext2D,\n anchor: string,\n textFullWidth: number,\n fullPathWidth: number,\n spacesNumber: number,\n inputOffset: number,\n dy: number,\n c: string,\n charI: number\n ) {\n let offset = inputOffset\n let glyphWidth = this.measureText(ctx, c)\n\n if (c === ' '\n && anchor === 'justify'\n && textFullWidth < fullPathWidth\n ) {\n glyphWidth += (fullPathWidth - textFullWidth) / spacesNumber\n }\n\n if (charI > -1) {\n offset += this.getLetterSpacingAt(charI)\n }\n\n const splineStep = this.textHeight / 20\n const p0 = this.getEquidistantPointOnPath(offset, splineStep, 0)\n const p1 = this.getEquidistantPointOnPath(offset + glyphWidth, splineStep, 0)\n const segment = {\n p0,\n p1\n }\n const rotation = p0 && p1\n ? Math.atan2(\n p1.y - p0.y,\n p1.x - p0.x\n )\n : 0\n\n if (dy) {\n const dyX = Math.cos(Math.PI / 2 + rotation) * dy\n const dyY = Math.cos(-rotation) * dy\n\n segment.p0 = {\n ...p0,\n x: p0.x + dyX,\n y: p0.y + dyY\n }\n segment.p1 = {\n ...p1,\n x: p1.x + dyX,\n y: p1.y + dyY\n }\n }\n\n offset += glyphWidth\n\n return {\n offset,\n segment,\n rotation\n }\n }\n\n protected override measureText(\n ctx: RenderingContext2D,\n text?: string\n ) {\n const { measuresCache } = this\n const targetText = text || this.getText()\n\n if (measuresCache.has(targetText)) {\n return measuresCache.get(targetText)\n }\n\n const measure = this.measureTargetText(ctx, targetText)\n\n measuresCache.set(targetText, measure)\n\n return measure\n }\n\n // This method supposes what all custom fonts already loaded.\n // If some font will be loaded after this method call, <textPath> will not be rendered correctly.\n // You need to call this method manually to update glyphs cache.\n protected setTextData(ctx: RenderingContext2D) {\n if (this.glyphInfo) {\n return\n }\n\n const renderText = this.getText()\n const chars = renderText.split('')\n const spacesNumber = renderText.split(' ').length - 1\n const dx = this.parent.getAttribute('dx').split().map(_ => _.getPixels('x'))\n const dy = this.parent.getAttribute('dy').getPixels('y')\n const anchor = this.parent.getStyle('text-anchor').getString('start')\n const thisSpacing = this.getStyle('letter-spacing')\n const parentSpacing = this.parent.getStyle('letter-spacing')\n let letterSpacing = 0\n\n if (!thisSpacing.hasValue()\n || thisSpacing.getValue() === 'inherit'\n ) {\n letterSpacing = parentSpacing.getPixels()\n } else\n if (thisSpacing.hasValue()) {\n if (thisSpacing.getValue() !== 'initial'\n && thisSpacing.getValue() !== 'unset'\n ) {\n letterSpacing = thisSpacing.getPixels()\n }\n }\n\n // fill letter-spacing cache\n const letterSpacingCache: number[] = []\n const textLen = renderText.length\n\n this.letterSpacingCache = letterSpacingCache\n\n for (let i = 0; i < textLen; i++) {\n letterSpacingCache.push(\n typeof dx[i] !== 'undefined'\n ? dx[i]\n : letterSpacing\n )\n }\n\n const dxSum = letterSpacingCache.reduce(\n (acc, cur, i) => (\n i === 0\n ? 0\n : acc + cur || 0\n ),\n 0\n )\n const textWidth = this.measureText(ctx)\n const textFullWidth = Math.max(textWidth + dxSum, 0)\n\n this.textWidth = textWidth\n this.textHeight = this.getFontSize()\n this.glyphInfo = []\n\n const fullPathWidth = this.getPathLength()\n const startOffset = this.getStyle('startOffset').getNumber(0) * fullPathWidth\n let offset = 0\n\n if (anchor === 'middle'\n || anchor === 'center'\n ) {\n offset = -textFullWidth / 2\n }\n\n if (anchor === 'end'\n || anchor === 'right'\n ) {\n offset = -textFullWidth\n }\n\n offset += startOffset\n\n chars.forEach((char, i) => {\n // Find such segment what distance between p0 and p1 is approx. width of glyph\n const {\n offset: nextOffset,\n segment,\n rotation\n } = this.findSegmentToFitChar(\n ctx,\n anchor,\n textFullWidth,\n fullPathWidth,\n spacesNumber,\n offset,\n dy,\n char,\n i\n )\n\n offset = nextOffset\n\n if (!segment.p0 || !segment.p1) {\n return\n }\n\n // const width = this.getLineLength(\n // segment.p0.x,\n // segment.p0.y,\n // segment.p1.x,\n // segment.p1.y\n // );\n // Note: Since glyphs are rendered one at a time, any kerning pair data built into the font will not be used.\n // Can foresee having a rough pair table built in that the developer can override as needed.\n // Or use \"dx\" attribute of the <text> node as a naive replacement\n // const kern = 0;\n // placeholder for future implementation\n // const midpoint = this.getPointOnLine(\n // kern + width / 2.0,\n // segment.p0.x, segment.p0.y, segment.p1.x, segment.p1.y\n // );\n\n this.glyphInfo.push({\n // transposeX: midpoint.x,\n // transposeY: midpoint.y,\n text: chars[i],\n p0: segment.p0,\n p1: segment.p1,\n rotation\n })\n })\n }\n\n protected parsePathData(path: PathElement) {\n this.pathLength = -1 // reset path length\n\n if (!path) {\n return []\n }\n\n const pathCommands: IPathCommand[] = []\n const { pathParser } = path\n\n pathParser.reset()\n\n // convert l, H, h, V, and v to L\n while (!pathParser.isEnd()) {\n const { current } = pathParser\n const startX = current ? current.x : 0\n const startY = current ? current.y : 0\n const command = pathParser.next()\n let nextCommandType: CommandType = command.type\n let points: number[] = []\n\n switch (command.type) {\n case PathParser.MOVE_TO:\n this.pathM(pathParser, points)\n break\n\n case PathParser.LINE_TO:\n nextCommandType = this.pathL(pathParser, points)\n break\n\n case PathParser.HORIZ_LINE_TO:\n nextCommandType = this.pathH(pathParser, points)\n break\n\n case PathParser.VERT_LINE_TO:\n nextCommandType = this.pathV(pathParser, points)\n break\n\n case PathParser.CURVE_TO:\n this.pathC(pathParser, points)\n break\n\n case PathParser.SMOOTH_CURVE_TO:\n nextCommandType = this.pathS(pathParser, points)\n break\n\n case PathParser.QUAD_TO:\n this.pathQ(pathParser, points)\n break\n\n case PathParser.SMOOTH_QUAD_TO:\n nextCommandType = this.pathT(pathParser, points)\n break\n\n case PathParser.ARC:\n points = this.pathA(pathParser)\n break\n\n case PathParser.CLOSE_PATH:\n PathElement.pathZ(pathParser)\n break\n\n default:\n }\n\n if (command.type !== PathParser.CLOSE_PATH) {\n pathCommands.push({\n type: nextCommandType,\n points,\n start: {\n x: startX,\n y: startY\n },\n pathLength: this.calcLength(startX, startY, nextCommandType, points)\n })\n } else {\n pathCommands.push({\n type: PathParser.CLOSE_PATH,\n points: [],\n pathLength: 0\n })\n }\n }\n\n return pathCommands\n }\n\n protected pathM(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n x,\n y\n } = PathElement.pathM(pathParser).point\n\n points.push(x, y)\n }\n\n protected pathL(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n x,\n y\n } = PathElement.pathL(pathParser).point\n\n points.push(x, y)\n\n return PathParser.LINE_TO\n }\n\n protected pathH(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n x,\n y\n } = PathElement.pathH(pathParser).point\n\n points.push(x, y)\n\n return PathParser.LINE_TO\n }\n\n protected pathV(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n x,\n y\n } = PathElement.pathV(pathParser).point\n\n points.push(x, y)\n\n return PathParser.LINE_TO\n }\n\n protected pathC(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n point,\n controlPoint,\n currentPoint\n } = PathElement.pathC(pathParser)\n\n points.push(\n point.x,\n point.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n }\n\n protected pathS(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n point,\n controlPoint,\n currentPoint\n } = PathElement.pathS(pathParser)\n\n points.push(\n point.x,\n point.y,\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n\n return PathParser.CURVE_TO\n }\n\n protected pathQ(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n controlPoint,\n currentPoint\n } = PathElement.pathQ(pathParser)\n\n points.push(\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n }\n\n protected pathT(\n pathParser: PathParser,\n points: number[]\n ) {\n const {\n controlPoint,\n currentPoint\n } = PathElement.pathT(pathParser)\n\n points.push(\n controlPoint.x,\n controlPoint.y,\n currentPoint.x,\n currentPoint.y\n )\n\n return PathParser.QUAD_TO\n }\n\n protected pathA(\n pathParser: PathParser\n ) {\n let {\n rX,\n rY,\n sweepFlag,\n xAxisRotation,\n centp,\n a1,\n ad\n } = PathElement.pathA(pathParser)\n\n if (sweepFlag === 0 && ad > 0) {\n ad -= 2 * Math.PI\n }\n\n if (sweepFlag === 1 && ad < 0) {\n ad += 2 * Math.PI\n }\n\n return [\n centp.x,\n centp.y,\n rX,\n rY,\n a1,\n ad,\n xAxisRotation,\n sweepFlag\n ]\n }\n\n protected calcLength(\n x: number,\n y: number,\n commandType: CommandType,\n points: number[]\n ) {\n let len = 0\n let p1: IPoint = null\n let p2: IPoint = null\n let t = 0\n\n switch (commandType) {\n case PathParser.LINE_TO:\n return this.getLineLength(x, y, points[0], points[1])\n\n case PathParser.CURVE_TO:\n // Approximates by breaking curve into 100 line segments\n len = 0.0\n p1 = this.getPointOnCubicBezier(\n 0,\n x,\n y,\n points[0],\n points[1],\n points[2],\n points[3],\n points[4],\n points[5]\n )\n\n for (t = 0.01; t <= 1; t += 0.01) {\n p2 = this.getPointOnCubicBezier(\n t,\n x,\n y,\n points[0],\n points[1],\n points[2],\n points[3],\n points[4],\n points[5]\n )\n len += this.getLineLength(p1.x, p1.y, p2.x, p2.y)\n p1 = p2\n }\n\n return len\n\n case PathParser.QUAD_TO:\n // Approximates by breaking curve into 100 line segments\n len = 0.0\n p1 = this.getPointOnQuadraticBezier(\n 0,\n x,\n y,\n points[0],\n points[1],\n points[2],\n points[3]\n )\n\n for (t = 0.01; t <= 1; t += 0.01) {\n p2 = this.getPointOnQuadraticBezier(\n t,\n x,\n y,\n points[0],\n points[1],\n points[2],\n points[3]\n )\n len += this.getLineLength(\n p1.x,\n p1.y,\n p2.x,\n p2.y\n )\n p1 = p2\n }\n\n return len\n\n case PathParser.ARC: {\n // Approximates by breaking curve into line segments\n len = 0.0\n\n const start = points[4]\n // 4 = theta\n const dTheta = points[5]\n // 5 = dTheta\n const end = points[4] + dTheta\n let inc = Math.PI / 180.0\n\n // 1 degree resolution\n if (Math.abs(start - end) < inc) {\n inc = Math.abs(start - end)\n }\n\n // Note: for purpose of calculating arc length, not going to worry about rotating X-axis by angle psi\n p1 = this.getPointOnEllipticalArc(\n points[0],\n points[1],\n points[2],\n points[3],\n start,\n 0\n )\n\n if (dTheta < 0) { // clockwise\n for (t = start - inc; t > end; t -= inc) {\n p2 = this.getPointOnEllipticalArc(\n points[0],\n points[1],\n points[2],\n points[3],\n t,\n 0\n )\n len += this.getLineLength(p1.x, p1.y, p2.x, p2.y)\n p1 = p2\n }\n } else { // counter-clockwise\n for (t = start + inc; t < end; t += inc) {\n p2 = this.getPointOnEllipticalArc(\n points[0],\n points[1],\n points[2],\n points[3],\n t,\n 0\n )\n len += this.getLineLength(p1.x, p1.y, p2.x, p2.y)\n p1 = p2\n }\n }\n\n p2 = this.getPointOnEllipticalArc(\n points[0],\n points[1],\n points[2],\n points[3],\n end,\n 0\n )\n len += this.getLineLength(p1.x, p1.y, p2.x, p2.y)\n\n return len\n }\n\n default:\n }\n\n return 0\n }\n\n protected getPointOnLine(\n dist: number,\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n fromX = p1x,\n fromY = p1y\n ) {\n const m = (p2y - p1y) / ((p2x - p1x) + PSEUDO_ZERO)\n let run = Math.sqrt(dist * dist / (1 + m * m))\n\n if (p2x < p1x) {\n run *= -1\n }\n\n let rise = m * run\n let pt: IPoint = null\n\n if (p2x === p1x) { // vertical line\n pt = {\n x: fromX,\n y: fromY + rise\n }\n } else\n if ((fromY - p1y) / ((fromX - p1x) + PSEUDO_ZERO) === m) {\n pt = {\n x: fromX + run,\n y: fromY + rise\n }\n } else {\n let ix = 0\n let iy = 0\n const len = this.getLineLength(p1x, p1y, p2x, p2y)\n\n if (len < PSEUDO_ZERO) {\n return null\n }\n\n let u =\n ((fromX - p1x) * (p2x - p1x))\n + ((fromY - p1y) * (p2y - p1y))\n\n u /= len * len\n ix = p1x + u * (p2x - p1x)\n iy = p1y + u * (p2y - p1y)\n\n const pRise = this.getLineLength(fromX, fromY, ix, iy)\n const pRun = Math.sqrt(dist * dist - pRise * pRise)\n\n run = Math.sqrt(pRun * pRun / (1 + m * m))\n\n if (p2x < p1x) {\n run *= -1\n }\n\n rise = m * run\n pt = {\n x: ix + run,\n y: iy + rise\n }\n }\n\n return pt\n }\n\n protected getPointOnPath(distance: number) {\n const fullLen = this.getPathLength()\n let cumulativePathLength = 0\n let p: IPoint = null\n\n if (distance < -0.00005\n || distance - 0.00005 > fullLen\n ) {\n return null\n }\n\n const { dataArray } = this\n\n for (const command of dataArray) {\n if (command\n && (\n command.pathLength < 0.00005\n || cumulativePathLength + command.pathLength + 0.00005 < distance\n )\n ) {\n cumulativePathLength += command.pathLength\n continue\n }\n\n const delta = distance - cumulativePathLength\n let currentT = 0\n\n switch (command.type) {\n case PathParser.LINE_TO:\n p = this.getPointOnLine(\n delta,\n command.start.x,\n command.start.y,\n command.points[0],\n command.points[1],\n command.start.x,\n command.start.y\n )\n break\n\n case PathParser.ARC: {\n const start = command.points[4]\n // 4 = theta\n const dTheta = command.points[5]\n // 5 = dTheta\n const end = command.points[4] + dTheta\n\n currentT = start + delta / command.pathLength * dTheta\n\n if (dTheta < 0 && currentT < end\n || dTheta >= 0 && currentT > end\n ) {\n break\n }\n\n p = this.getPointOnEllipticalArc(\n command.points[0],\n command.points[1],\n command.points[2],\n command.points[3],\n currentT,\n command.points[6]\n )\n break\n }\n\n case PathParser.CURVE_TO:\n\n currentT = delta / command.pathLength\n\n if (currentT > 1) {\n currentT = 1\n }\n\n p = this.getPointOnCubicBezier(\n currentT,\n command.start.x,\n command.start.y,\n command.points[0],\n command.points[1],\n command.points[2],\n command.points[3],\n command.points[4],\n command.points[5]\n )\n break\n\n case PathParser.QUAD_TO:\n\n currentT = delta / command.pathLength\n\n if (currentT > 1) {\n currentT = 1\n }\n\n p = this.getPointOnQuadraticBezier(\n currentT,\n command.start.x,\n command.start.y,\n command.points[0],\n command.points[1],\n command.points[2],\n command.points[3]\n )\n break\n\n default:\n }\n\n if (p) {\n return p\n }\n\n break\n }\n\n return null\n }\n\n protected getLineLength(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n ) {\n return Math.sqrt(\n (x2 - x1) * (x2 - x1)\n + (y2 - y1) * (y2 - y1)\n )\n }\n\n protected getPathLength() {\n if (this.pathLength === -1) {\n this.pathLength = this.dataArray.reduce<number>(\n (length, command: IPathCommand) => (\n command.pathLength > 0\n ? length + command.pathLength\n : length\n ),\n 0\n )\n }\n\n return this.pathLength\n }\n\n protected getPointOnCubicBezier(\n pct: number,\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n p3x: number,\n p3y: number,\n p4x: number,\n p4y: number\n ): IPoint {\n const x = p4x * CB1(pct) + p3x * CB2(pct) + p2x * CB3(pct) + p1x * CB4(pct)\n const y = p4y * CB1(pct) + p3y * CB2(pct) + p2y * CB3(pct) + p1y * CB4(pct)\n\n return {\n x,\n y\n }\n }\n\n protected getPointOnQuadraticBezier(\n pct: number,\n p1x: number,\n p1y: number,\n p2x: number,\n p2y: number,\n p3x: number,\n p3y: number\n ): IPoint {\n const x = p3x * QB1(pct) + p2x * QB2(pct) + p1x * QB3(pct)\n const y = p3y * QB1(pct) + p2y * QB2(pct) + p1y * QB3(pct)\n\n return {\n x,\n y\n }\n }\n\n protected getPointOnEllipticalArc(\n cx: number,\n cy: number,\n rx: number,\n ry: number,\n theta: number,\n psi: number\n ): IPoint {\n const cosPsi = Math.cos(psi)\n const sinPsi = Math.sin(psi)\n const pt = {\n x: rx * Math.cos(theta),\n y: ry * Math.sin(theta)\n }\n\n return {\n x: cx + (pt.x * cosPsi - pt.y * sinPsi),\n y: cy + (pt.x * sinPsi + pt.y * cosPsi)\n }\n }\n\n // TODO need some optimisations. possibly build cache only for curved segments?\n protected buildEquidistantCache(\n inputStep: number,\n inputPrecision: number\n ) {\n const fullLen = this.getPathLength()\n const precision = inputPrecision || 0.25 // accuracy vs performance\n const step = inputStep || fullLen / 100\n\n if (!this.equidistantCache\n || this.equidistantCache.step !== step\n || this.equidistantCache.precision !== precision\n ) {\n // Prepare cache\n this.equidistantCache = {\n step,\n precision,\n points: []\n }\n\n // Calculate points\n let s = 0\n\n for (let l = 0; l <= fullLen; l += precision) {\n const p0 = this.getPointOnPath(l)\n const p1 = this.getPointOnPath(l + precision)\n\n if (!p0 || !p1) {\n continue\n }\n\n s += this.getLineLength(p0.x, p0.y, p1.x, p1.y)\n\n if (s >= step) {\n this.equidistantCache.points.push({\n x: p0.x,\n y: p0.y,\n distance: l\n })\n s -= step\n }\n }\n }\n }\n\n protected getEquidistantPointOnPath(\n targetDistance: number,\n step?: number,\n precision?: number\n ) {\n this.buildEquidistantCache(step, precision)\n\n if (targetDistance < 0\n || targetDistance - this.getPathLength() > 0.00005\n ) {\n return null\n }\n\n const idx = Math.round(\n targetDistance\n / this.getPathLength()\n * (this.equidistantCache.points.length - 1)\n )\n\n return this.equidistantCache.points[idx] || null\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { BoundingBox } from '../BoundingBox'\nimport { Document } from './Document'\nimport { RenderedElement } from './RenderedElement'\n\n// groups: 1: mime-type (+ charset), 2: mime-type (w/o charset), 3: charset, 4: base64?, 5: body\nconst dataUriRegex = /^\\s*data:(([^/,;]+\\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i\n\nexport class ImageElement extends RenderedElement {\n override type = 'image'\n loaded = false\n protected image: CanvasImageSource | string | undefined\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n const href = this.getHrefAttribute().getString()\n\n if (!href) {\n return\n }\n\n const isSvg = href.endsWith('.svg') || /^\\s*data:image\\/svg\\+xml/i.test(href)\n\n document.images.push(this)\n\n if (!isSvg) {\n void this.loadImage(href)\n } else {\n void this.loadSvg(href)\n }\n }\n\n protected async loadImage(href: string) {\n try {\n const image = await this.document.createImage(href)\n\n this.image = image\n } catch (err) {\n console.error(`Error while loading image \"${href}\":`, err)\n }\n\n this.loaded = true\n }\n\n protected async loadSvg(href: string) {\n const match = dataUriRegex.exec(href)\n\n if (match) {\n const data = match[5]\n\n if (data) {\n if (match[4] === 'base64') {\n this.image = atob(data)\n } else {\n this.image = decodeURIComponent(data)\n }\n }\n } else {\n try {\n const response = await this.document.fetch(href)\n const svg = await response.text()\n\n this.image = svg\n } catch (err) {\n console.error(`Error while loading image \"${href}\":`, err)\n }\n }\n\n this.loaded = true\n }\n\n override renderChildren(ctx: RenderingContext2D) {\n const {\n document,\n image,\n loaded\n } = this\n const x = this.getAttribute('x').getPixels('x')\n const y = this.getAttribute('y').getPixels('y')\n const width = this.getStyle('width').getPixels('x')\n const height = this.getStyle('height').getPixels('y')\n\n if (!loaded || !image\n || !width || !height\n ) {\n return\n }\n\n ctx.save()\n ctx.translate(x, y)\n\n if (typeof image === 'string') {\n const subDocument = document.canvg.forkString(\n ctx,\n image,\n {\n ignoreMouse: true,\n ignoreAnimation: true,\n ignoreDimensions: true,\n ignoreClear: true,\n offsetX: 0,\n offsetY: 0,\n scaleWidth: width,\n scaleHeight: height\n }\n )\n const { documentElement } = subDocument.document\n\n if (documentElement) {\n documentElement.parent = this\n }\n\n void subDocument.render()\n } else {\n document.setViewBox({\n ctx,\n aspectRatio: this.getAttribute('preserveAspectRatio').getString(),\n width,\n desiredWidth: image.width as number,\n height,\n desiredHeight: image.height as number\n })\n\n if (this.loaded) {\n if (!('complete' in image) || image.complete) {\n ctx.drawImage(image, 0, 0)\n }\n }\n }\n\n ctx.restore()\n }\n\n getBoundingBox() {\n const x = this.getAttribute('x').getPixels('x')\n const y = this.getAttribute('y').getPixels('y')\n const width = this.getStyle('width').getPixels('x')\n const height = this.getStyle('height').getPixels('y')\n\n return new BoundingBox(x, y, x + width, y + height)\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { RenderedElement } from './RenderedElement'\n\nexport class SymbolElement extends RenderedElement {\n override type = 'symbol'\n\n override render(_: RenderingContext2D) {\n // NO RENDER\n }\n}\n","import { Document } from './Document'\n\nexport class SVGFontLoader {\n loaded = false\n\n constructor(\n private readonly document: Document\n ) {\n document.fonts.push(this)\n }\n\n async load(fontFamily: string, url: string) {\n try {\n const { document } = this\n const svgDocument = await document.canvg.parser.load(url)\n const fonts = svgDocument.getElementsByTagName('font')\n\n Array.from(fonts).forEach((fontNode: HTMLElement) => {\n const font = document.createElement(fontNode)\n\n document.definitions[fontFamily] = font\n })\n } catch (err) {\n console.error(`Error while loading font \"${url}\":`, err)\n }\n\n this.loaded = true\n }\n}\n","import {\n compressSpaces,\n getSelectorSpecificity,\n parseExternalUrl\n} from '../util'\nimport { Property } from '../Property'\nimport { SVGFontLoader } from '../SVGFontLoader'\nimport { Document } from './Document'\nimport { Element } from './Element'\n\nexport class StyleElement extends Element {\n static readonly parseExternalUrl = parseExternalUrl\n\n override type = 'style'\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n const css = compressSpaces(\n Array.from(node.childNodes)\n // NEED TEST\n .map(_ => _.textContent)\n .join('')\n .replace(/(\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+\\/)|(^[\\s]*\\/\\/.*)/gm, '') // remove comments\n .replace(/@import.*;/g, '') // remove imports\n )\n const cssDefs = css.split('}')\n\n cssDefs.forEach((_) => {\n const def = _.trim()\n\n if (!def) {\n return\n }\n\n const cssParts = def.split('{')\n const cssClasses = cssParts[0].split(',')\n const cssProps = cssParts[1].split(';')\n\n cssClasses.forEach((_) => {\n const cssClass = _.trim()\n\n if (!cssClass) {\n return\n }\n\n const props = document.styles[cssClass] || {}\n\n cssProps.forEach((cssProp) => {\n const prop = cssProp.indexOf(':')\n const name = cssProp.substr(0, prop).trim()\n const value = cssProp.substr(prop + 1, cssProp.length - prop).trim()\n\n if (name && value) {\n props[name] = new Property(document, name, value)\n }\n })\n\n document.styles[cssClass] = props\n document.stylesSpecificity[cssClass] = getSelectorSpecificity(cssClass)\n\n if (cssClass === '@font-face') { // && !nodeEnv\n const fontFamily = props['font-family'].getString().replace(/\"|'/g, '')\n const srcs = props.src.getString().split(',')\n\n srcs.forEach((src) => {\n if (src.indexOf('format(\"svg\")') > 0) {\n const url = parseExternalUrl(src)\n\n if (url) {\n void new SVGFontLoader(document).load(fontFamily, url)\n }\n }\n })\n }\n })\n })\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Property } from '../Property'\nimport { Transform } from '../Transform'\nimport { RenderedElement } from './RenderedElement'\nimport { PathElement } from './PathElement'\nimport { SVGElement } from './SVGElement'\n\nexport class UseElement extends RenderedElement {\n override type = 'use'\n private cachedElement: PathElement | undefined\n\n override setContext(ctx: RenderingContext2D) {\n super.setContext(ctx)\n\n const xAttr = this.getAttribute('x')\n const yAttr = this.getAttribute('y')\n\n if (xAttr.hasValue()) {\n ctx.translate(xAttr.getPixels('x'), 0)\n }\n\n if (yAttr.hasValue()) {\n ctx.translate(0, yAttr.getPixels('y'))\n }\n }\n\n path(ctx: RenderingContext2D) {\n const { element } = this\n\n if (element) {\n element.path(ctx)\n }\n }\n\n override renderChildren(ctx: RenderingContext2D) {\n const {\n document,\n element\n } = this\n\n if (element) {\n let tempSvg: RenderedElement = element\n\n if (element.type === 'symbol') {\n // render me using a temporary svg element in symbol cases (http://www.w3.org/TR/SVG/struct.html#UseElement)\n tempSvg = new SVGElement(document)\n tempSvg.attributes.viewBox = new Property(\n document,\n 'viewBox',\n element.getAttribute('viewBox').getString()\n )\n tempSvg.attributes.preserveAspectRatio = new Property(\n document,\n 'preserveAspectRatio',\n element.getAttribute('preserveAspectRatio').getString()\n )\n tempSvg.attributes.overflow = new Property(\n document,\n 'overflow',\n element.getAttribute('overflow').getString()\n )\n tempSvg.children = element.children\n\n // element is still the parent of the children\n element.styles.opacity = new Property(\n document,\n 'opacity',\n this.calculateOpacity()\n )\n }\n\n if (tempSvg.type === 'svg') {\n const widthStyle = this.getStyle('width', false, true)\n const heightStyle = this.getStyle('height', false, true)\n\n // if symbol or svg, inherit width/height from me\n if (widthStyle.hasValue()) {\n tempSvg.attributes.width = new Property(\n document,\n 'width',\n widthStyle.getString()\n )\n }\n\n if (heightStyle.hasValue()) {\n tempSvg.attributes.height = new Property(\n document,\n 'height',\n heightStyle.getString()\n )\n }\n }\n\n const oldParent = tempSvg.parent\n\n tempSvg.parent = this\n tempSvg.render(ctx)\n tempSvg.parent = oldParent\n }\n }\n\n getBoundingBox(ctx: CanvasRenderingContext2D) {\n const { element } = this\n\n if (element) {\n return element.getBoundingBox(ctx)\n }\n\n return null\n }\n\n elementTransform() {\n const {\n document,\n element\n } = this\n\n if (!element) {\n return null\n }\n\n return Transform.fromElement(document, element)\n }\n\n protected get element() {\n if (!this.cachedElement) {\n this.cachedElement = this.getHrefAttribute().getDefinition()\n }\n\n return this.cachedElement\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { toNumbers } from '../util'\nimport { Document } from './Document'\nimport { Element } from './Element'\n\nfunction imGet(\n img: Uint8ClampedArray,\n x: number,\n y: number,\n width: number,\n _height: number,\n rgba: number\n) {\n return img[y * width * 4 + x * 4 + rgba]\n}\n\nfunction imSet(\n img: Uint8ClampedArray,\n x: number,\n y: number,\n width: number,\n _height: number,\n rgba: number,\n val: number\n) {\n img[y * width * 4 + x * 4 + rgba] = val\n}\n\nfunction m(\n matrix: number[],\n i: number,\n v: number\n) {\n const mi = matrix[i]\n\n return mi * v\n}\n\nfunction c(\n a: number,\n m1: number,\n m2: number,\n m3: number\n) {\n return m1 + Math.cos(a) * m2 + Math.sin(a) * m3\n}\n\nexport class FeColorMatrixElement extends Element {\n override type = 'feColorMatrix'\n protected readonly matrix: number[]\n protected readonly includeOpacity: boolean\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n let matrix = toNumbers(this.getAttribute('values').getString())\n\n switch (this.getAttribute('type').getString('matrix')) { // http://www.w3.org/TR/SVG/filters.html#feColorMatrixElement\n case 'saturate': {\n const s = matrix[0]\n\n /* eslint-disable array-element-newline */\n matrix = [\n 0.213 + 0.787 * s, 0.715 - 0.715 * s, 0.072 - 0.072 * s, 0, 0,\n 0.213 - 0.213 * s, 0.715 + 0.285 * s, 0.072 - 0.072 * s, 0, 0,\n 0.213 - 0.213 * s, 0.715 - 0.715 * s, 0.072 + 0.928 * s, 0, 0,\n 0, 0, 0, 1, 0,\n 0, 0, 0, 0, 1\n ]\n /* eslint-enable array-element-newline */\n break\n }\n\n case 'hueRotate': {\n const a = matrix[0] * Math.PI / 180.0\n\n /* eslint-disable array-element-newline */\n matrix = [\n c(a, 0.213, 0.787, -0.213), c(a, 0.715, -0.715, -0.715), c(a, 0.072, -0.072, 0.928), 0, 0,\n c(a, 0.213, -0.213, 0.143), c(a, 0.715, 0.285, 0.140), c(a, 0.072, -0.072, -0.283), 0, 0,\n c(a, 0.213, -0.213, -0.787), c(a, 0.715, -0.715, 0.715), c(a, 0.072, 0.928, 0.072), 0, 0,\n 0, 0, 0, 1, 0,\n 0, 0, 0, 0, 1\n ]\n /* eslint-enable array-element-newline */\n break\n }\n\n case 'luminanceToAlpha':\n /* eslint-disable array-element-newline */\n matrix = [\n 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0,\n 0.2125, 0.7154, 0.0721, 0, 0,\n 0, 0, 0, 0, 1\n ]\n /* eslint-enable array-element-newline */\n break\n\n default:\n }\n\n this.matrix = matrix\n this.includeOpacity = this.getAttribute('includeOpacity').hasValue()\n }\n\n apply(\n ctx: RenderingContext2D,\n _x: number,\n _y: number,\n width: number,\n height: number\n ) {\n // assuming x==0 && y==0 for now\n const {\n includeOpacity,\n matrix\n } = this\n const srcData = ctx.getImageData(0, 0, width, height)\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n const r = imGet(srcData.data, x, y, width, height, 0)\n const g = imGet(srcData.data, x, y, width, height, 1)\n const b = imGet(srcData.data, x, y, width, height, 2)\n const a = imGet(srcData.data, x, y, width, height, 3)\n let nr = m(matrix, 0, r) + m(matrix, 1, g) + m(matrix, 2, b) + m(matrix, 3, a) + m(matrix, 4, 1)\n let ng = m(matrix, 5, r) + m(matrix, 6, g) + m(matrix, 7, b) + m(matrix, 8, a) + m(matrix, 9, 1)\n let nb = m(matrix, 10, r) + m(matrix, 11, g) + m(matrix, 12, b) + m(matrix, 13, a) + m(matrix, 14, 1)\n let na = m(matrix, 15, r) + m(matrix, 16, g) + m(matrix, 17, b) + m(matrix, 18, a) + m(matrix, 19, 1)\n\n if (includeOpacity) {\n nr = 0\n ng = 0\n nb = 0\n na *= a / 255\n }\n\n imSet(srcData.data, x, y, width, height, 0, nr)\n imSet(srcData.data, x, y, width, height, 1, ng)\n imSet(srcData.data, x, y, width, height, 2, nb)\n imSet(srcData.data, x, y, width, height, 3, na)\n }\n }\n\n ctx.clearRect(0, 0, width, height)\n ctx.putImageData(srcData, 0, 0)\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { BoundingBox } from '../BoundingBox'\nimport { Element } from './Element'\nimport { PathElement } from './PathElement'\nimport { FeColorMatrixElement } from './FeColorMatrixElement'\n\nexport class MaskElement extends Element {\n static ignoreStyles = [\n 'mask',\n 'transform',\n 'clip-path'\n ]\n\n override type = 'mask'\n\n apply(ctx: RenderingContext2D, element: Element) {\n const { document } = this\n // render as temp svg\n let x = this.getAttribute('x').getPixels('x')\n let y = this.getAttribute('y').getPixels('y')\n let width = this.getStyle('width').getPixels('x')\n let height = this.getStyle('height').getPixels('y')\n\n if (!width && !height) {\n const boundingBox = new BoundingBox()\n\n this.children.forEach((child: PathElement) => {\n boundingBox.addBoundingBox(child.getBoundingBox(ctx))\n })\n\n x = Math.floor(boundingBox.x1)\n y = Math.floor(boundingBox.y1)\n width = Math.floor(boundingBox.width)\n height = Math.floor(boundingBox.height)\n }\n\n const ignoredStyles = this.removeStyles(element, MaskElement.ignoreStyles)\n const maskCanvas = document.createCanvas(x + width, y + height)\n const maskCtx = maskCanvas.getContext('2d')\n\n document.screen.setDefaults(maskCtx)\n this.renderChildren(maskCtx)\n\n // convert mask to alpha with a fake node\n // TODO: refactor out apply from feColorMatrix\n new FeColorMatrixElement(\n document,\n ({\n nodeType: 1,\n childNodes: [],\n attributes: [\n {\n nodeName: 'type',\n value: 'luminanceToAlpha'\n },\n {\n nodeName: 'includeOpacity',\n value: 'true'\n }\n ]\n }) as unknown as HTMLElement\n ).apply(maskCtx, 0, 0, x + width, y + height)\n\n const tmpCanvas = document.createCanvas(x + width, y + height)\n const tmpCtx = tmpCanvas.getContext('2d')\n\n document.screen.setDefaults(tmpCtx)\n element.render(tmpCtx)\n\n tmpCtx.globalCompositeOperation = 'destination-in'\n tmpCtx.fillStyle = maskCtx.createPattern(maskCanvas as CanvasImageSource, 'no-repeat')\n tmpCtx.fillRect(0, 0, x + width, y + height)\n\n ctx.fillStyle = tmpCtx.createPattern(tmpCanvas as CanvasImageSource, 'no-repeat')\n ctx.fillRect(0, 0, x + width, y + height)\n\n // reassign mask\n this.restoreStyles(element, ignoredStyles)\n }\n\n override render(_: RenderingContext2D) {\n // NO RENDER\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Transform } from '../Transform'\nimport { Element } from './Element'\nimport { UseElement } from './UseElement'\n\nconst noop = () => {\n // NOOP\n}\n\nexport class ClipPathElement extends Element {\n override type = 'clipPath'\n\n apply(ctx: RenderingContext2D) {\n const { document } = this\n const contextProto = Reflect.getPrototypeOf(ctx) as RenderingContext2D | null\n const {\n beginPath,\n closePath\n } = ctx\n\n if (contextProto) {\n contextProto.beginPath = noop\n contextProto.closePath = noop\n }\n\n Reflect.apply(beginPath, ctx, [])\n\n this.children.forEach((child: Element | UseElement) => {\n if (!('path' in child)) {\n return\n }\n\n let transform = 'elementTransform' in child\n ? child.elementTransform()\n : null // handle <use />\n\n if (!transform) {\n transform = Transform.fromElement(document, child)\n }\n\n if (transform) {\n transform.apply(ctx)\n }\n\n child.path(ctx)\n\n if (contextProto) {\n contextProto.closePath = closePath\n }\n\n if (transform) {\n transform.unapply(ctx)\n }\n })\n\n Reflect.apply(closePath, ctx, [])\n ctx.clip()\n\n if (contextProto) {\n contextProto.beginPath = beginPath\n contextProto.closePath = closePath\n }\n }\n\n override render(_: RenderingContext2D) {\n // NO RENDER\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Element } from './Element'\nimport { PathElement } from './PathElement'\nimport { FeGaussianBlurElement } from './FeGaussianBlurElement'\n\nexport class FilterElement extends Element {\n static ignoreStyles = [\n 'filter',\n 'transform',\n 'clip-path'\n ]\n\n override type = 'filter'\n\n apply(ctx: RenderingContext2D, element: Element | PathElement) {\n // render as temp svg\n const {\n document,\n children\n } = this\n const boundingBox = 'getBoundingBox' in element\n ? element.getBoundingBox(ctx)\n : null\n\n if (!boundingBox) {\n return\n }\n\n let px = 0\n let py = 0\n\n children.forEach((child: FeGaussianBlurElement) => {\n const efd = child.extraFilterDistance || 0\n\n px = Math.max(px, efd)\n py = Math.max(py, efd)\n })\n\n const width = Math.floor(boundingBox.width)\n const height = Math.floor(boundingBox.height)\n const tmpCanvasWidth = width + 2 * px\n const tmpCanvasHeight = height + 2 * py\n\n if (tmpCanvasWidth < 1 || tmpCanvasHeight < 1) {\n return\n }\n\n const x = Math.floor(boundingBox.x)\n const y = Math.floor(boundingBox.y)\n const ignoredStyles = this.removeStyles(element, FilterElement.ignoreStyles)\n const tmpCanvas = document.createCanvas(tmpCanvasWidth, tmpCanvasHeight)\n const tmpCtx = tmpCanvas.getContext('2d')\n\n document.screen.setDefaults(tmpCtx)\n tmpCtx.translate(-x + px, -y + py)\n element.render(tmpCtx)\n\n // apply filters\n children.forEach((child: FeGaussianBlurElement) => {\n if (typeof child.apply === 'function') {\n child.apply(\n tmpCtx,\n 0,\n 0,\n tmpCanvasWidth,\n tmpCanvasHeight\n )\n }\n })\n\n // render on me\n ctx.drawImage(\n tmpCanvas,\n 0,\n 0,\n tmpCanvasWidth,\n tmpCanvasHeight,\n x - px,\n y - py,\n tmpCanvasWidth,\n tmpCanvasHeight\n )\n\n this.restoreStyles(element, ignoredStyles)\n }\n\n override render(_: RenderingContext2D) {\n // NO RENDER\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Document } from './Document'\nimport { Element } from './Element'\n\nexport class FeDropShadowElement extends Element {\n override type = 'feDropShadow'\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.addStylesFromStyleDefinition()\n }\n\n apply(\n _: RenderingContext2D,\n _x: number,\n _y: number,\n _width: number,\n _height: number\n ) {\n // TODO: implement\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Element } from './Element'\n\nexport class FeMorphologyElement extends Element {\n override type = 'feMorphology'\n\n apply(\n _: RenderingContext2D,\n _x: number,\n _y: number,\n _width: number,\n _height: number\n ) {\n // TODO: implement\n }\n}\n","import { RenderingContext2D } from '../types'\nimport { Element } from './Element'\n\nexport class FeCompositeElement extends Element {\n override type = 'feComposite'\n\n apply(\n _: RenderingContext2D,\n _x: number,\n _y: number,\n _width: number,\n _height: number\n ) {\n // TODO: implement\n }\n}\n","import { canvasRGBA } from 'stackblur-canvas'\nimport { RenderingContext2D } from '../types'\nimport { Document } from './Document'\nimport { Element } from './Element'\n\nexport class FeGaussianBlurElement extends Element {\n override type = 'feGaussianBlur'\n readonly extraFilterDistance: number\n protected readonly blurRadius: number\n\n constructor(\n document: Document,\n node: HTMLElement,\n captureTextNodes?: boolean\n ) {\n super(document, node, captureTextNodes)\n\n this.blurRadius = Math.floor(this.getAttribute('stdDeviation').getNumber())\n this.extraFilterDistance = this.blurRadius\n }\n\n apply(\n ctx: RenderingContext2D,\n x: number,\n y: number,\n width: number,\n height: number\n ) {\n const {\n document,\n blurRadius\n } = this\n const body = document.window\n ? document.window.document.body\n : null\n const canvas = ctx.canvas as HTMLCanvasElement\n\n // StackBlur requires canvas be on document\n canvas.id = document.getUniqueId()\n\n if (body) {\n canvas.style.display = 'none'\n body.appendChild(canvas)\n }\n\n canvasRGBA(canvas, x, y, width, height, blurRadius)\n\n if (body) {\n body.removeChild(canvas)\n }\n }\n}\n","import { Element } from './Element'\n\nexport class TitleElement extends Element {\n override type = 'title'\n}\n","import { Element } from './Element'\n\nexport class DescElement extends Element {\n override type = 'desc'\n}\n","import { Element } from './Element'\nimport { UnknownElement } from './UnknownElement'\nimport { RenderedElement } from './RenderedElement'\nimport { PathElement } from './PathElement'\nimport { SVGElement } from './SVGElement'\nimport { RectElement } from './RectElement'\nimport { CircleElement } from './CircleElement'\nimport { EllipseElement } from './EllipseElement'\nimport { LineElement } from './LineElement'\nimport { PolylineElement } from './PolylineElement'\nimport { PolygonElement } from './PolygonElement'\nimport { PatternElement } from './PatternElement'\nimport { MarkerElement } from './MarkerElement'\nimport { DefsElement } from './DefsElement'\nimport { GradientElement } from './GradientElement'\nimport { LinearGradientElement } from './LinearGradientElement'\nimport { RadialGradientElement } from './RadialGradientElement'\nimport { StopElement } from './StopElement'\nimport { AnimateElement } from './AnimateElement'\nimport { AnimateColorElement } from './AnimateColorElement'\nimport { AnimateTransformElement } from './AnimateTransformElement'\nimport { FontElement } from './FontElement'\nimport { FontFaceElement } from './FontFaceElement'\nimport { MissingGlyphElement } from './MissingGlyphElement'\nimport { GlyphElement } from './GlyphElement'\nimport { TextElement } from './TextElement'\nimport { TSpanElement } from './TSpanElement'\nimport { TRefElement } from './TRefElement'\nimport { AElement } from './AElement'\nimport { TextPathElement } from './TextPathElement'\nimport { ImageElement } from './ImageElement'\nimport { GElement } from './GElement'\nimport { SymbolElement } from './SymbolElement'\nimport { StyleElement } from './StyleElement'\nimport { UseElement } from './UseElement'\nimport { MaskElement } from './MaskElement'\nimport { ClipPathElement } from './ClipPathElement'\nimport { FilterElement } from './FilterElement'\nimport { FeDropShadowElement } from './FeDropShadowElement'\nimport { FeMorphologyElement } from './FeMorphologyElement'\nimport { FeCompositeElement } from './FeCompositeElement'\nimport { FeColorMatrixElement } from './FeColorMatrixElement'\nimport { FeGaussianBlurElement } from './FeGaussianBlurElement'\nimport { TitleElement } from './TitleElement'\nimport { DescElement } from './DescElement'\n\nexport const elements = {\n 'svg': SVGElement,\n 'rect': RectElement,\n 'circle': CircleElement,\n 'ellipse': EllipseElement,\n 'line': LineElement,\n 'polyline': PolylineElement,\n 'polygon': PolygonElement,\n 'path': PathElement,\n 'pattern': PatternElement,\n 'marker': MarkerElement,\n 'defs': DefsElement,\n 'linearGradient': LinearGradientElement,\n 'radialGradient': RadialGradientElement,\n 'stop': StopElement,\n 'animate': AnimateElement,\n 'animateColor': AnimateColorElement,\n 'animateTransform': AnimateTransformElement,\n 'font': FontElement,\n 'font-face': FontFaceElement,\n 'missing-glyph': MissingGlyphElement,\n 'glyph': GlyphElement,\n 'text': TextElement,\n 'tspan': TSpanElement,\n 'tref': TRefElement,\n 'a': AElement,\n 'textPath': TextPathElement,\n 'image': ImageElement,\n 'g': GElement,\n 'symbol': SymbolElement,\n 'style': StyleElement,\n 'use': UseElement,\n 'mask': MaskElement,\n 'clipPath': ClipPathElement,\n 'filter': FilterElement,\n 'feDropShadow': FeDropShadowElement,\n 'feMorphology': FeMorphologyElement,\n 'feComposite': FeCompositeElement,\n 'feColorMatrix': FeColorMatrixElement,\n 'feGaussianBlur': FeGaussianBlurElement,\n 'title': TitleElement,\n 'desc': DescElement\n}\n\ntype Elements = typeof elements\n\nexport type AnyElement = Elements[keyof Elements]\n\nexport {\n Element,\n UnknownElement,\n RenderedElement,\n PathElement,\n SVGElement,\n RectElement,\n CircleElement,\n EllipseElement,\n LineElement,\n PolylineElement,\n PolygonElement,\n PatternElement,\n MarkerElement,\n DefsElement,\n GradientElement,\n LinearGradientElement,\n RadialGradientElement,\n StopElement,\n AnimateElement,\n AnimateColorElement,\n AnimateTransformElement,\n FontElement,\n FontFaceElement,\n MissingGlyphElement,\n GlyphElement,\n TextElement,\n TSpanElement,\n TRefElement,\n AElement,\n TextPathElement,\n ImageElement,\n GElement,\n SymbolElement,\n StyleElement,\n UseElement,\n MaskElement,\n ClipPathElement,\n FilterElement,\n FeDropShadowElement,\n FeMorphologyElement,\n FeCompositeElement,\n FeColorMatrixElement,\n FeGaussianBlurElement,\n TitleElement,\n DescElement\n}\n","/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { Canvg } from '../Canvg'\nimport { IScreenViewBoxConfig, Screen } from '../Screen'\nimport { Property } from '../Property'\nimport { SVGFontLoader } from '../SVGFontLoader'\nimport { Element } from './Element'\nimport { UnknownElement } from './UnknownElement'\nimport { TextNode } from './TextNode'\nimport { ImageElement } from './ImageElement'\nimport { SVGElement } from './SVGElement'\nimport {\n AnyElement,\n elements as elementTypes\n} from './elements'\n\n/**\n * Function to create new canvas.\n */\nexport type CreateCanvas = (width: number, height: number) => HTMLCanvasElement | OffscreenCanvas & {\n getContext(contextId: '2d'): OffscreenCanvasRenderingContext2D\n}\n\n/**\n * Function to create new image.\n */\nexport type CreateImage = (src: string, anonymousCrossOrigin?: boolean) => Promise<CanvasImageSource>\n\nexport interface IDocumentOptions {\n /**\n * Default `rem` size.\n */\n rootEmSize?: number\n /**\n * Default `em` size.\n */\n emSize?: number\n /**\n * Function to create new canvas.\n */\n createCanvas?: CreateCanvas\n /**\n * Function to create new image.\n */\n createImage?: CreateImage\n /**\n * Load images anonymously.\n */\n anonymousCrossOrigin?: boolean\n}\n\nexport type IViewBoxConfig = Omit<IScreenViewBoxConfig, 'document'>\n\ntype DOMDocument = typeof window.document\n\nfunction createCanvas(width: number, height: number) {\n const canvas = document.createElement('canvas')\n\n canvas.width = width\n canvas.height = height\n\n return canvas\n}\n\nasync function createImage(src: string, anonymousCrossOrigin = false) {\n const image = document.createElement('img')\n\n if (anonymousCrossOrigin) {\n image.crossOrigin = 'Anonymous'\n }\n\n return new Promise<HTMLImageElement>((resolve, reject) => {\n image.onload = () => {\n resolve(image)\n }\n\n image.onerror = (_event, _source, _lineno, _colno, error) => {\n reject(error)\n }\n\n image.src = src\n })\n}\n\nconst DEFAULT_EM_SIZE = 12\n\nexport class Document {\n static readonly createCanvas = createCanvas\n static readonly createImage = createImage\n static readonly elementTypes: Record<string, AnyElement> = elementTypes\n\n rootEmSize: number\n documentElement?: SVGElement\n readonly screen: Screen\n readonly createCanvas: CreateCanvas\n readonly createImage: CreateImage\n readonly definitions: Record<string, Element> = {}\n readonly styles: Record<string, Record<string, Property>> = {}\n readonly stylesSpecificity: Record<string, string> = {}\n readonly images: ImageElement[] = []\n readonly fonts: SVGFontLoader[] = []\n private readonly emSizeStack: number[] = []\n private uniqueId = 0\n\n constructor(\n readonly canvg: Canvg,\n {\n rootEmSize = DEFAULT_EM_SIZE,\n emSize = DEFAULT_EM_SIZE,\n createCanvas = Document.createCanvas,\n createImage = Document.createImage,\n anonymousCrossOrigin\n }: IDocumentOptions = {}\n ) {\n this.screen = canvg.screen\n this.rootEmSize = rootEmSize\n this.emSize = emSize\n this.createCanvas = createCanvas\n this.createImage = this.bindCreateImage(createImage, anonymousCrossOrigin)\n\n this.screen.wait(() => this.isImagesLoaded())\n this.screen.wait(() => this.isFontsLoaded())\n }\n\n private bindCreateImage(createImage: CreateImage, anonymousCrossOrigin?: boolean) {\n if (typeof anonymousCrossOrigin === 'boolean') {\n return (source: string, forceAnonymousCrossOrigin?: boolean) => createImage(\n source,\n typeof forceAnonymousCrossOrigin === 'boolean'\n ? forceAnonymousCrossOrigin\n : anonymousCrossOrigin\n )\n }\n\n return createImage\n }\n\n get window() {\n return this.screen.window\n }\n\n get fetch() {\n return this.screen.fetch\n }\n\n get ctx() {\n return this.screen.ctx\n }\n\n get emSize() {\n const { emSizeStack } = this\n\n return emSizeStack[emSizeStack.length - 1] || DEFAULT_EM_SIZE\n }\n\n set emSize(value: number) {\n const { emSizeStack } = this\n\n emSizeStack.push(value)\n }\n\n popEmSize() {\n const { emSizeStack } = this\n\n emSizeStack.pop()\n }\n\n getUniqueId() {\n return `canvg${++this.uniqueId}`\n }\n\n isImagesLoaded() {\n return this.images.every(_ => _.loaded)\n }\n\n isFontsLoaded() {\n return this.fonts.every(_ => _.loaded)\n }\n\n createDocumentElement(document: DOMDocument) {\n const documentElement = this.createElement<SVGElement>(document.documentElement)\n\n documentElement.root = true\n documentElement.addStylesFromStyleDefinition()\n\n this.documentElement = documentElement\n\n return documentElement\n }\n\n createElement<T extends Element>(node: HTMLElement) {\n const elementType = node.nodeName.replace(/^[^:]+:/, '')\n const ElementType = Document.elementTypes[elementType]\n\n if (ElementType) {\n return new ElementType(this, node) as T\n }\n\n return new UnknownElement(this, node) as T\n }\n\n createTextNode(node: HTMLElement) {\n return new TextNode(this, node)\n }\n\n setViewBox(config: IViewBoxConfig) {\n this.screen.setViewBox({\n document: this,\n ...config\n })\n }\n}\n","import { RenderingContext2D } from './types'\nimport { IParserOptions, Parser } from './Parser'\nimport {\n IScreenOptions,\n IScreenStartOptions,\n Screen\n} from './Screen'\nimport {\n IDocumentOptions,\n Document,\n SVGElement\n} from './Document'\n\ntype DOMDocument = typeof window.document\n\nexport interface IOptions extends IParserOptions,\n IScreenOptions,\n IScreenStartOptions,\n IDocumentOptions {}\n\n/**\n * SVG renderer on canvas.\n */\nexport class Canvg {\n /**\n * Create Canvg instance from SVG source string or URL.\n * @param ctx - Rendering context.\n * @param svg - SVG source string or URL.\n * @param options - Rendering options.\n * @returns Canvg instance.\n */\n static async from(\n ctx: RenderingContext2D,\n svg: string,\n options: IOptions = {}\n ) {\n const parser = new Parser(options)\n const svgDocument = await parser.parse(svg)\n\n return new Canvg(ctx, svgDocument, options)\n }\n\n /**\n * Create Canvg instance from SVG source string.\n * @param ctx - Rendering context.\n * @param svg - SVG source string.\n * @param options - Rendering options.\n * @returns Canvg instance.\n */\n static fromString(\n ctx: RenderingContext2D,\n svg: string,\n options: IOptions = {}\n ) {\n const parser = new Parser(options)\n const svgDocument = parser.parseFromString(svg)\n\n return new Canvg(ctx, svgDocument, options)\n }\n\n /**\n * XML/HTML parser instance.\n */\n readonly parser: Parser\n /**\n * Screen instance.\n */\n readonly screen: Screen\n /**\n * Canvg Document.\n */\n readonly document: Document\n private readonly documentElement: SVGElement\n private readonly options: IOptions\n\n /**\n * Main constructor.\n * @param ctx - Rendering context.\n * @param svg - SVG Document.\n * @param options - Rendering options.\n */\n constructor(\n ctx: RenderingContext2D,\n svg: DOMDocument,\n options: IOptions = {}\n ) {\n this.parser = new Parser(options)\n this.screen = new Screen(ctx, options)\n this.options = options\n\n const document = new Document(this, options)\n const documentElement = document.createDocumentElement(svg)\n\n this.document = document\n this.documentElement = documentElement\n }\n\n /**\n * Create new Canvg instance with inherited options.\n * @param ctx - Rendering context.\n * @param svg - SVG source string or URL.\n * @param options - Rendering options.\n * @returns Canvg instance.\n */\n fork(\n ctx: RenderingContext2D,\n svg: string,\n options: IOptions = {}\n ) {\n return Canvg.from(ctx, svg, {\n ...this.options,\n ...options\n })\n }\n\n /**\n * Create new Canvg instance with inherited options.\n * @param ctx - Rendering context.\n * @param svg - SVG source string.\n * @param options - Rendering options.\n * @returns Canvg instance.\n */\n forkString(\n ctx: RenderingContext2D,\n svg: string,\n options: IOptions = {}\n ) {\n return Canvg.fromString(ctx, svg, {\n ...this.options,\n ...options\n })\n }\n\n /**\n * Document is ready promise.\n * @returns Ready promise.\n */\n ready() {\n return this.screen.ready()\n }\n\n /**\n * Document is ready value.\n * @returns Is ready or not.\n */\n isReady() {\n return this.screen.isReady()\n }\n\n /**\n * Render only first frame, ignoring animations and mouse.\n * @param options - Rendering options.\n */\n async render(options: IScreenStartOptions = {}) {\n this.start({\n enableRedraw: true,\n ignoreAnimation: true,\n ignoreMouse: true,\n ...options\n })\n\n await this.ready()\n\n this.stop()\n }\n\n /**\n * Start rendering.\n * @param options - Render options.\n */\n start(options: IScreenStartOptions = {}) {\n const {\n documentElement,\n screen,\n options: baseOptions\n } = this\n\n screen.start(documentElement, {\n enableRedraw: true,\n ...baseOptions,\n ...options\n })\n }\n\n /**\n * Stop rendering.\n */\n stop() {\n this.screen.stop()\n }\n\n /**\n * Resize SVG to fit in given size.\n * @param width\n * @param height\n * @param preserveAspectRatio\n */\n resize(\n width: number,\n height = width,\n preserveAspectRatio: boolean | string = false\n ) {\n this.documentElement.resize(width, height, preserveAspectRatio)\n }\n}\n"],"names":["offscreen","DOMParser","DOMParserFallback","preset","window","ignoreAnimation","ignoreMouse","createCanvas","width","height","OffscreenCanvas","createImage","url","response","fetch","blob","img","createImageBitmap","globalThis","Reflect","deleteProperty","node","canvas","loadImage","compressSpaces","str","replace","trimLeft","trimRight","toNumbers","matches","match","map","parseFloat","toMatrixValue","numbers","matrix","allUppercase","normalizeAttributeName","name","test","toLowerCase","parseExternalUrl","urlMatch","exec","normalizeColor","color","startsWith","rgbParts","normalizedColor","num","isFloat","String","Math","round","attributeRegex","idRegex","classRegex","pseudoElementRegex","pseudoClassWithBracketsRegex","pseudoClassRegex","elementRegex","findSelectorMatch","selector","regex","length","getSelectorSpecificity","specificity","currentSelector","delta","join","PSEUDO_ZERO","vectorMagnitude","v","sqrt","pow","vectorsRatio","u","vectorsAngle","acos","CB1","t","CB2","CB3","CB4","QB1","QB2","QB3","Property","empty","document","split","separator","getString","trim","value","hasValue","zeroIsValue","isString","regexp","result","isUrlDefinition","isPixels","asString","endsWith","setValue","getValue","def","getNumber","n","getColor","isNormalizedColor","getDpi","getRem","rootEmSize","getEm","emSize","getUnits","getPixels","axisOrIsFontSize","processPercent","axis","isFontSize","undefined","viewPort","screen","min","computeSize","max","getMilliseconds","getRadians","PI","getDefinition","definitions","getFillStyleDefinition","element","opacity","createGradient","ctx","createPattern","getHrefAttribute","patternTransform","getAttribute","getTextBaseline","key","textBaselineMapping","addOpacity","len","commas","i","RGBColor","ok","alpha","toRGBA","ViewPort","clear","viewPorts","setCurrent","push","removeCurrent","pop","getRoot","root","getDefault","getCurrent","current","d","DEFAULT_VIEWPORT_WIDTH","DEFAULT_VIEWPORT_HEIGHT","Point","parse","point","defaultValue","x","y","parseScale","scale","parsePath","path","points","pathPoints","angleTo","atan2","applyTransform","transform","xp","yp","Mouse","isWorking","working","start","onClick","onMouseMove","onclick","onmousemove","stop","hasEvents","events","runEvents","eventElements","style","cursor","forEach","run","parent","checkPath","isPointInPath","checkBoundingBox","boundingBox","isPointInBox","mapXY","offsetLeft","offsetTop","offsetParent","scrollX","scrollY","event","clientX","clientY","type","eventTarget","bind","defaultWindow","defaultFetch","Screen","wait","checker","waits","ready","readyPromise","Promise","resolve","isReady","isReadyLock","every","_","resolveReady","setDefaults","strokeStyle","lineCap","lineJoin","miterLimit","setViewBox","aspectRatio","desiredWidth","desiredHeight","minX","minY","refX","refY","clip","clipX","clipY","cleanAspectRatio","aspectRatioAlign","aspectRatioMeetOrSlice","align","meetOrSlice","scaleX","scaleY","scaleMin","scaleMax","finalDesiredWidth","finalDesiredHeight","refXProp","refYProp","hasRefs","translate","scaledClipX","scaledClipY","beginPath","moveTo","lineTo","closePath","isMeetMinY","isSliceMaxY","isMeetMinX","isSliceMaxX","enableRedraw","ignoreDimensions","ignoreClear","forceRedraw","scaleWidth","scaleHeight","offsetX","offsetY","mouse","frameDuration","FRAMERATE","render","now","Date","then","tick","shouldUpdate","intervalId","requestAnimationFrame","cancel","animations","reduce","animation","update","isFirstRender","widthStyle","getStyle","heightStyle","cWidth","clientWidth","cHeight","clientHeight","viewBox","xRatio","yRatio","isNaN","transformStyle","clearRect","Error","MAX_VIRTUAL_PIXELS","DefaultDOMParser","Parser","resource","parseFromString","load","xml","parser","checkDocument","err","parserError","getElementsByTagName","textContent","text","Translate","apply","unapply","applyToPoint","Rotate","cx","cy","originX","originY","angle","tx","ty","rotate","rad","cos","sin","transformOrigin","Scale","scaleSize","Matrix","a","b","c","e","f","g","h","det","Skew","skew","SkewX","tan","SkewY","parseTransforms","parseTransform","Transform","fromElement","transformOriginXProperty","transformOriginYProperty","transforms","data","TransformType","transformTypes","skewX","skewY","Element","createIfNotExists","attr","attributes","href","skipAncestors","styles","parentStyle","save","mask","applyEffects","filter","setContext","renderChildren","clearContext","restore","clipPathStyleProp","children","child","addChild","childNode","createElement","ignoreChildTypes","includes","matchesSelector","styleClasses","some","styleClass","addStylesFromStyleDefinition","stylesSpecificity","styleProp","existingSpecificity","removeStyles","ignoreStyles","toRestore","restoreStyles","isFirstChild","indexOf","captureTextNodes","animationFrozen","animationFrozenValue","nodeType","Array","from","attribute","nodeName","id","childNodes","textNode","createTextNode","getText","UnknownElement","wrapFontFamily","fontFamily","trimmed","prepareFontFamily","process","prepareFontStyle","fontStyle","targetFontStyle","prepareFontWeight","fontWeight","targetFontWeight","Font","font","inherit","fontVariant","fontSize","parts","set","part","variants","weights","toString","inheritFont","BoundingBox","x1","y1","x2","y2","addPoint","addX","addY","addBoundingBox","sumCubic","p0","p1","p2","p3","bezierCurveAdd","forX","b2ac","t1","t2","addBezierCurve","p0x","p0y","p1x","p1y","p2x","p2y","p3x","p3y","addQuadraticCurve","cp1x","cp1y","cp2x","cp2y","Number","NaN","RenderedElement","calculateOpacity","opacityStyle","fromMeasure","fillStyleProp","fillOpacityStyleProp","strokeStyleProp","strokeOpacityProp","fillStyle","strokeWidthStyleProp","newLineWidth","lineWidth","strokeLinecapStyleProp","strokeLinejoinStyleProp","strokeMiterlimitProp","strokeDasharrayStyleProp","strokeDashoffsetProp","gaps","setLineDash","webkitLineDash","mozDash","offset","lineDashOffset","webkitLineDashOffset","mozDashOffset","modifiedEmSizeStack","fontStyleProp","fontStyleStyleProp","fontVariantStyleProp","fontWeightStyleProp","fontSizeStyleProp","fontFamilyStyleProp","globalAlpha","popEmSize","TextElement","textBaseline","initializeCoordinates","leafTexts","textChunkStart","POSITIVE_INFINITY","maxX","NEGATIVE_INFINITY","getBoundingBox","getTElementBoundingBox","adjustChildCoordinatesRecursive","childBoundingBox","getChildBoundingBox","getFontSize","inheritFontSize","measureText","getGlyph","char","glyph","isArabic","prevChar","nextChar","arabicForm","arabicGlyphs","glyphs","missingGlyph","getTextFromNode","parentNode","index","lastIndex","renderTElementChildren","renderChild","renderText","customFont","unitsPerEm","fontFace","ctxFont","isRTL","reverse","dx","lw","horizAdvX","fillText","strokeText","applyAnchoring","firstElement","textAnchor","shift","adjustChildCoordinatesRecursiveCore","textParent","adjustChildCoordinates","xAttr","yAttr","dxAttr","dyAttr","Boolean","getInheritedAttribute","measureCache","measure","measureTargetText","targetText","parentAttr","TSpanElement","TextNode","PathParser","SVGPathData","reset","command","previousCommand","control","angles","isEnd","commands","next","getPoint","xProp","yProp","makeAbsolute","getAsControlPoint","getAsCurrentPoint","getReflectedControlPoint","CURVE_TO","SMOOTH_CURVE_TO","QUAD_TO","SMOOTH_QUAD_TO","ox","oy","relative","addMarker","priorTo","addMarkerAngle","getMarkerPoints","getMarkerAngles","j","PathElement","pathParser","MOVE_TO","pathM","LINE_TO","pathL","HORIZ_LINE_TO","pathH","VERT_LINE_TO","pathV","pathC","pathS","pathQ","pathT","ARC","pathA","CLOSE_PATH","pathZ","_ctx","getMarkers","markers","fillRuleStyleProp","fill","setTransform","stroke","markersLastIndex","markerStartStyleProp","markerMidStyleProp","markerEndStyleProp","marker","controlPoint","currentPoint","bezierCurveTo","quadraticCurveTo","rX","rY","xRot","lArcFlag","sweepFlag","xAxisRotation","currp","l","s","cpp","centp","a1","ad","dir","ah","halfWay","r","sx","sy","arc","SVGElement","getComputedStyle","getPropertyValue","fontSizeProp","refXAttr","refYAttr","viewBoxAttr","resize","preserveAspectRatio","widthAttr","heightAttr","styleAttr","originWidth","originHeight","preserveAspectRatioAttr","RectElement","rxAttr","ryAttr","rx","ry","KAPPA","CircleElement","EllipseElement","LineElement","getPoints","x0","y0","PolylineElement","PolygonElement","PatternElement","parentOpacityProp","patternSvg","patternCanvas","patternCtx","getContext","pattern","MarkerElement","orient","markerUnits","markerSvg","overflow","DefsElement","GElement","GradientElement","getGradientUnits","stopsContainer","inheritStopContainer","stops","gradient","getGradient","addParentOpacity","addColorStop","rootView","rect","group","attributesToInherit","attributeToInherit","colorProp","LinearGradientElement","isBoundingBoxUnits","createLinearGradient","RadialGradientElement","fx","fy","fr","createRadialGradient","StopElement","stopOpacity","stopColor","AnimateElement","getProperty","attributeType","attributeName","calcValue","initialUnits","progress","to","getProgress","newValue","prop","initialValue","duration","maxDuration","frozen","removed","updated","begin","typeAttr","values","p","lb","floor","ub","ceil","valuesAttr","AnimateColorElement","colorFrom","colorTo","AnimateTransformElement","transformFrom","transformTo","FontFaceElement","ascent","descent","GlyphElement","unicode","MissingGlyphElement","FontElement","fontFamilyStyle","arabicGlyph","TRefElement","firstChild","AElement","hasText","open","TextPathElement","dataArray","theta","dTheta","psi","fs","setTextData","textDecoration","glyphInfo","rotation","partialText","getLetterSpacingAt","idx","letterSpacingCache","findSegmentToFitChar","anchor","textFullWidth","fullPathWidth","spacesNumber","inputOffset","dy","charI","glyphWidth","splineStep","textHeight","getEquidistantPointOnPath","segment","dyX","dyY","measuresCache","has","get","chars","thisSpacing","parentSpacing","letterSpacing","textLen","dxSum","acc","cur","textWidth","getPathLength","startOffset","nextOffset","parsePathData","pathLength","pathCommands","startX","startY","nextCommandType","calcLength","commandType","getLineLength","getPointOnCubicBezier","getPointOnQuadraticBezier","end","inc","abs","getPointOnEllipticalArc","getPointOnLine","dist","fromX","fromY","m","rise","pt","ix","iy","pRise","pRun","getPointOnPath","distance","fullLen","cumulativePathLength","currentT","pct","p4x","p4y","cosPsi","sinPsi","buildEquidistantCache","inputStep","inputPrecision","precision","step","equidistantCache","targetDistance","Map","pathElement","dataUriRegex","ImageElement","image","console","error","loaded","loadSvg","atob","decodeURIComponent","svg","subDocument","canvg","forkString","documentElement","complete","drawImage","isSvg","images","SymbolElement","SVGFontLoader","svgDocument","fonts","fontNode","StyleElement","css","cssDefs","cssParts","cssClasses","cssProps","cssClass","props","cssProp","substr","srcs","src","UseElement","tempSvg","oldParent","elementTransform","cachedElement","imGet","_height","rgba","imSet","val","mi","m1","m2","m3","FeColorMatrixElement","_x","_y","includeOpacity","srcData","getImageData","nr","ng","nb","na","putImageData","MaskElement","ignoredStyles","maskCanvas","maskCtx","tmpCanvas","tmpCtx","globalCompositeOperation","fillRect","noop","ClipPathElement","contextProto","getPrototypeOf","FilterElement","px","py","efd","extraFilterDistance","tmpCanvasWidth","tmpCanvasHeight","FeDropShadowElement","_width","FeMorphologyElement","FeCompositeElement","FeGaussianBlurElement","blurRadius","body","getUniqueId","display","appendChild","canvasRGBA","removeChild","TitleElement","DescElement","elements","anonymousCrossOrigin","crossOrigin","reject","onload","onerror","_event","_source","_lineno","_colno","DEFAULT_EM_SIZE","Document","bindCreateImage","source","forceAnonymousCrossOrigin","emSizeStack","uniqueId","isImagesLoaded","isFontsLoaded","createDocumentElement","elementType","ElementType","elementTypes","config","Canvg","options","fromString","fork","baseOptions"],"mappings":";;;;;AASA;;;;;aAMgBA,SAAS,GAAiD;QAAhD,EAAEC,SAAS,EAAEC,iBAAiB,GAAW,oEAAG,EAAE;IACtE,MAAMC,MAAM,GAAG;QACbC,MAAM,EAAE,IAAI;QACZC,eAAe,EAAE,IAAI;QACrBC,WAAW,EAAE,IAAI;QACjBL,SAAS,EAAEC,iBAAiB;QAC5BK,YAAY,EAACC,KAAa,EAAEC,MAAc,EAAE;YAC1C,OAAO,IAAIC,eAAe,CAACF,KAAK,EAAEC,MAAM;SACzC;cACKE,WAAW,EAACC,GAAW,EAAE;YAC7B,MAAMC,QAAQ,GAAG,MAAMC,KAAK,CAACF,GAAG;YAChC,MAAMG,IAAI,GAAG,MAAMF,QAAQ,CAACE,IAAI;YAChC,MAAMC,GAAG,GAAG,MAAMC,iBAAiB,CAACF,IAAI;YAExC,OAAOC,GAAG;SACX;KACF;IAED,IAAI,OAAOE,UAAU,CAACjB,SAAS,KAAK,eAC/B,OAAOC,iBAAiB,KAAK,aAChC;QACAiB,OAAO,CAACC,cAAc,CAACjB,MAAM,EAAE;KAChC;IAED,OAAOA,MAAM;AACf;;ACTA;;;;;;;aAQgBkB,IAAI,CAAC,KAIX,EAAE;QAJS,EACnBpB,SAAS,GACTqB,MAAM,GACNR,KAAK,GACG,GAJW,KAIX;IACR,OAAO;QACLV,MAAM,EAAE,IAAI;QACZC,eAAe,EAAE,IAAI;Q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