thorvg/examples/resources/svg/421553147-22eaf24a-a9a7-4a35-abac-df5a54ac5b19.svg
Mira Grudzinska be32e97d96 svg: fix incorrect assignment of <stop> elements
If the svg contained an unsupported element with <stop> elements,
they were incorrectly assigned to the last loaded gradient. Now fixed.

@Issue: https://github.com/thorvg/thorvg/issues/3321
2025-03-12 15:02:25 +09:00

258 lines
35 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="126.8161"
height="137.65189"
viewBox="0 0 126.8161 137.65189"
version="1.1"
id="svg1"
inkscape:version="1.4 (86a8ad7, 2024-10-11)"
xml:space="preserve"
sodipodi:docname="timer_icon.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
id="namedview1"
pagecolor="#8d8d8d"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="true"
inkscape:deskcolor="#727272"
inkscape:document-units="px"
labelstyle="default"
borderlayer="true"
inkscape:zoom="1.7024333"
inkscape:cx="-5.2865507"
inkscape:cy="44.054589"
inkscape:window-width="1440"
inkscape:window-height="830"
inkscape:window-x="-6"
inkscape:window-y="-6"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
showguides="true" /><defs
id="defs1"><linearGradient
id="linearGradient6"
inkscape:collect="always"><stop
style="stop-color:#fdf152;stop-opacity:1;"
offset="0"
id="stop6" /><stop
style="stop-color:#fd9420;stop-opacity:1;"
offset="1"
id="stop7" /></linearGradient><inkscape:path-effect
effect="fillet_chamfer"
id="path-effect3"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1"
radius="8"
unit="px"
method="arc"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" /><linearGradient
id="linearGradient83-1"><stop
style="stop-color:#6a6a6a;stop-opacity:1;"
offset="0"
id="stop83" /><stop
style="stop-color:#317da3;stop-opacity:1;"
offset="1"
id="stop84" /></linearGradient><linearGradient
id="linearGradient83"><stop
style="stop-color:#ffffff;stop-opacity:1"
offset="0"
id="stop85" /><stop
style="stop-color:#96dbff;stop-opacity:1"
offset="1"
id="stop86" /></linearGradient><inkscape:path-effect
effect="fillet_chamfer"
id="path-effect3-5"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1"
radius="8"
unit="px"
method="arc"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" /><inkscape:path-effect
effect="fillet_chamfer"
id="path-effect3-1"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1"
radius="8"
unit="px"
method="arc"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" /><linearGradient
inkscape:collect="always"
xlink:href="#linearGradient6"
id="linearGradient7"
x1="1006.4142"
y1="523.4613"
x2="1006.4142"
y2="639.33325"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.98069171,0,0,1.0013776,19.301967,-0.80920922)" /><inkscape:path-effect
effect="fillet_chamfer"
id="path-effect3-8"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1"
radius="8"
unit="px"
method="arc"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" /><inkscape:path-effect
effect="fillet_chamfer"
id="path-effect3-54"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1 @ F,0,0,1,0,8,0,1"
radius="8"
unit="px"
method="arc"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" /><meshgradient
inkscape:collect="always"
id="meshgradient12"
gradientUnits="userSpaceOnUse"
x="1060.6368"
y="553.70605"><meshrow
id="meshrow8576"><meshpatch
id="meshpatch8576"><stop
path="c 50.1904,12.2976 22.0206,59.2282 27.073,64.2034"
style="stop-color:#ef4108;stop-opacity:0"
id="stop8576" /><stop
path="l -32.4863,-28.4764"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8577" /><stop
path="l 0.000653612,-0.000491692"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8578" /><stop
path="l 5.41265,-35.7265"
style="stop-color:#ef4108;stop-opacity:0"
id="stop8579" /></meshpatch><meshpatch
id="meshpatch8579"><stop
path="c 5.05222,4.97556 1.96332,3.57669 3.46419,10.6657"
id="stop8580" /><stop
path="l -35.9502,-39.1426"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8581" /><stop
path="l -0.0003,0.0005"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8582" /></meshpatch><meshpatch
id="meshpatch8582"><stop
path="c 1.50173,7.08896 2.57076,-6.74406 0.000432932,-4.62921e-06"
id="stop8583" /><stop
path="l -35.9513,-39.1419"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8584" /><stop
path="l 0.000667068,-0.000695371"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8585" /></meshpatch><meshpatch
id="meshpatch8585"><stop
path="c -2.57035,6.74409 -10.8704,-13.2173 -16.6212,-9.15638"
id="stop8586" /><stop
path="l -19.3301,-29.9855"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8587" /><stop
path="l 0,-2e-05"
style="stop-color:#ef4108;stop-opacity:1"
id="stop8588" /></meshpatch></meshrow></meshgradient></defs><g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-994.79251,-518.56816)"><path
id="path1"
style="font-variation-settings:normal;vector-effect:none;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:21.632;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;paint-order:stroke markers fill;stop-color:#000000"
d="m 1059.8259,532.30911 c -1.9532,-0.36263 -3.794,0.85037 -4.127,2.72011 l -0.2689,1.50977 c -0.3329,1.86972 0.9724,3.66439 2.9255,4.02703 l 3.1386,0.58273 -0.8275,4.6469 -0.034,0.19203 c -8.2436,-1.08594 -16.6221,-0.01 -24.3455,3.12704 l -0.085,-0.17455 -3.1099,-6.33261 2.6373,-1.35023 c 2.6622,-1.36232 3.7967,-4.50691 2.5459,-7.05544 l -1.0083,-2.05683 c -0.7035,-1.43355 -2.0088,-2.36476 -3.4892,-2.66129 -1.1514,-0.23066 -2.41,-0.0769 -3.5747,0.51908 l -12.4353,6.36493 c -2.6621,1.36233 -3.797,4.50931 -2.5462,7.05785 l 1.0082,2.05681 c 1.2508,2.54853 4.3998,3.50172 7.0621,2.13939 l 2.6368,-1.34783 3.1076,6.33215 0.09,0.18549 c -11.9423,7.40797 -20.2131,19.67592 -22.7274,33.71105 -4.8345,27.14888 12.8003,53.15921 39.3883,58.09569 26.588,4.93649 52.061,-13.07021 56.8955,-40.21909 2.4959,-14.04363 -1.0085,-28.50676 -9.6305,-39.74114 l 0.1287,-0.12242 5.0915,-4.80986 2.0011,2.20894 c 2.0222,2.23201 5.2983,2.47181 7.3476,0.53599 l 1.6551,-1.56233 c 2.0493,-1.93585 2.0702,-5.29217 0.048,-7.5242 l -9.4453,-10.42491 c -0.8847,-0.9765 -2.0097,-1.57279 -3.167,-1.77077 -1.4879,-0.25454 -3.0306,0.14782 -4.1834,1.23674 l -1.6523,1.56036 c -2.0493,1.93583 -2.0721,5.28937 -0.05,7.52135 l 2.003,2.21176 -5.0917,4.80987 -0.1314,0.12437 c -6.1332,-5.74824 -13.6013,-9.80357 -21.6977,-11.7823 l 0.014,-0.0791 0.8275,-4.6469 3.138,0.58261 c 1.9531,0.36264 3.7912,-0.84841 4.1242,-2.71814 l 0.2688,-1.50977 c 0.3329,-1.86974 -0.9695,-3.66635 -2.9227,-4.02899 z"
sodipodi:nodetypes="sssscccccccccscccccccccscccccccccscccccccccsssss" /><path
id="path6"
style="font-variation-settings:normal;vector-effect:none;fill:#9d144a;fill-opacity:1;stroke:none;stroke-width:21.632;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;paint-order:stroke markers fill;stop-color:#000000"
d="m 1059.8259,532.30911 c -1.9532,-0.36263 -3.794,0.85037 -4.127,2.72011 l -0.2689,1.50977 c -0.3329,1.86972 0.9724,3.66439 2.9255,4.02703 l 3.1386,0.58273 -0.8275,4.6469 -0.034,0.19203 c -8.2436,-1.08594 -16.6221,-0.01 -24.3455,3.12704 l -0.085,-0.17455 -3.1099,-6.33261 2.6373,-1.35023 c 2.6622,-1.36232 3.7967,-4.50691 2.5459,-7.05544 l -1.0083,-2.05683 c -0.7035,-1.43355 -2.0088,-2.36476 -3.4892,-2.66129 -1.1514,-0.23066 -2.41,-0.0769 -3.5747,0.51908 l -12.4353,6.36493 c -2.6621,1.36233 -3.797,4.50931 -2.5462,7.05785 l 1.0082,2.05681 c 1.2508,2.54853 4.3998,3.50172 7.0621,2.13939 l 2.6368,-1.34783 3.1076,6.33215 0.09,0.18549 c -11.9423,7.40797 -20.2131,19.67592 -22.7274,33.71105 -4.8345,27.14888 12.8003,53.15921 39.3883,58.09569 26.588,4.93649 52.061,-13.07021 56.8955,-40.21909 2.4959,-14.04363 -1.0085,-28.50676 -9.6305,-39.74114 l 0.1287,-0.12242 5.0915,-4.80986 2.0011,2.20894 c 2.0222,2.23201 5.2983,2.47181 7.3476,0.53599 l 1.6551,-1.56233 c 2.0493,-1.93585 2.0702,-5.29217 0.048,-7.5242 l -9.4453,-10.42491 c -0.8847,-0.9765 -2.0097,-1.57279 -3.167,-1.77077 -1.4879,-0.25454 -3.0306,0.14782 -4.1834,1.23674 l -1.6523,1.56036 c -2.0493,1.93583 -2.0721,5.28937 -0.05,7.52135 l 2.003,2.21176 -5.0917,4.80987 -0.1314,0.12437 c -6.1332,-5.74824 -13.6013,-9.80357 -21.6977,-11.7823 l 0.014,-0.0791 0.8275,-4.6469 3.138,0.58261 c 1.9531,0.36264 3.7912,-0.84841 4.1242,-2.71814 l 0.2688,-1.50977 c 0.3329,-1.86974 -0.9695,-3.66635 -2.9227,-4.02899 z"
sodipodi:nodetypes="sssscccccccccscccccccccscccccccccscccccccccsssss" /><path
id="path2"
style="font-variation-settings:normal;vector-effect:none;fill:url(#linearGradient7);fill-opacity:1;stroke:none;stroke-width:21.632;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;paint-order:stroke markers fill;stop-color:#000000"
d="m 1060.5092,526.30084 c -1.9531,-0.36263 -3.794,0.85037 -4.1269,2.72011 l -0.2689,1.50977 c -0.333,1.86972 0.9723,3.66439 2.9255,4.02703 l 3.1386,0.58273 -0.8275,4.64691 -0.034,0.19202 c -8.2436,-1.08593 -16.6221,-0.01 -24.3454,3.12704 l -0.085,-0.17455 -3.1098,-6.33261 2.6372,-1.35023 c 2.6622,-1.36231 3.7967,-4.50691 2.5459,-7.05543 l -1.0082,-2.05683 c -0.7036,-1.43356 -2.0089,-2.36477 -3.4892,-2.66129 -1.1515,-0.23066 -2.4101,-0.0769 -3.5747,0.51907 l -12.4353,6.36494 c -2.6622,1.36232 -3.7971,4.5093 -2.5463,7.05785 l 1.0083,2.05681 c 1.2507,2.54852 4.3997,3.50171 7.062,2.13939 l 2.6368,-1.34784 3.1076,6.33216 0.09,0.18548 c -11.9423,7.40797 -20.2132,19.67592 -22.7275,33.71106 -4.8345,27.14888 12.8003,53.1592 39.3883,58.09568 26.588,4.93649 52.061,-13.07021 56.8955,-40.21909 2.4959,-14.04363 -1.0085,-28.50676 -9.6305,-39.74113 l 0.1287,-0.12243 5.0916,-4.80986 2.0011,2.20894 c 2.0222,2.23201 5.2983,2.47181 7.3475,0.53599 l 1.6551,-1.56233 c 2.0494,-1.93584 2.0703,-5.29217 0.048,-7.52419 l -9.4454,-10.42491 c -0.8846,-0.97651 -2.0097,-1.5728 -3.1669,-1.77078 -1.4879,-0.25454 -3.0306,0.14782 -4.1834,1.23674 l -1.6523,1.56037 c -2.0494,1.93582 -2.0721,5.28937 -0.05,7.52135 l 2.0029,2.21176 -5.0916,4.80987 -0.1314,0.12437 c -6.1333,-5.74824 -13.6013,-9.80358 -21.6977,-11.7823 l 0.014,-0.0791 0.8275,-4.6469 3.138,0.58261 c 1.9532,0.36264 3.7913,-0.84842 4.1242,-2.71814 l 0.2688,-1.50978 c 0.333,-1.86973 -0.9695,-3.66634 -2.9226,-4.02898 z"
sodipodi:nodetypes="sssscccccccccscccccccccscccccccccscccccccccsssss" /><path
id="circle2"
style="vector-effect:none;fill:#ffffff;stroke-width:21.632;stroke-linecap:round;stroke-linejoin:bevel;paint-order:stroke markers fill;stop-color:#000000"
d="m 1097.3477,597.25403 a 42.814879,43.717981 0 0 1 -49.7836,35.19172 42.814879,43.717981 0 0 1 -34.4648,-50.83374 42.814879,43.717981 0 0 1 49.7837,-35.19169 42.814879,43.717981 0 0 1 34.4647,50.83371 z" /><path
id="path3"
style="font-variation-settings:normal;opacity:0.35;vector-effect:none;fill:#000000;fill-opacity:1;stroke:none;stroke-width:18.2058;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;paint-order:stroke markers fill"
inkscape:transform-center-y="-26.670247"
d="m 1061.7896,552.56467 a 4.1181037,4.2049676 0 0 0 -4.7894,3.38564 4.1181037,4.2049676 0 0 0 3.3161,4.88807 4.1181037,4.2049676 0 0 0 4.7867,-3.38366 4.1181037,4.2049676 0 0 0 -3.3134,-4.89005 z m -24.666,5.33639 a 4.1181037,4.2049676 0 0 0 -2.7877,0.72222 4.1181037,4.2049676 0 0 0 -1.0421,5.85185 4.1181037,4.2049676 0 0 0 5.7287,1.0636 4.1181037,4.2049676 0 0 0 1.042,-5.85184 4.1181037,4.2049676 0 0 0 -2.9409,-1.78583 z m 45.3329,8.41675 a 4.1181037,4.2049676 0 0 0 -2.7901,0.72179 4.1181037,4.2049676 0 0 0 -1.042,5.85184 4.1181037,4.2049676 0 0 0 5.7309,1.06404 4.1181037,4.2049676 0 0 0 1.0421,-5.85184 4.1181037,4.2049676 0 0 0 -2.9409,-1.78583 z m -58.5519,13.02751 a 4.1181037,4.2049676 0 0 0 -4.7867,3.38367 4.1181037,4.2049676 0 0 0 3.3134,4.89005 4.1181037,4.2049676 0 0 0 4.7894,-3.38564 4.1181037,4.2049676 0 0 0 -3.3161,-4.88808 z m 64.1102,11.90304 a 4.1181037,4.2049676 0 0 0 -4.7891,3.38324 4.1181037,4.2049676 0 0 0 3.3157,4.89048 4.1181037,4.2049676 0 0 0 4.7895,-3.38564 4.1181037,4.2049676 0 0 0 -3.3161,-4.88808 z m -59.1336,12.93936 a 4.1181037,4.2049676 0 0 0 -2.7882,0.72463 4.1181037,4.2049676 0 0 0 -1.0416,5.84945 4.1181037,4.2049676 0 0 0 5.7286,1.0636 4.1181037,4.2049676 0 0 0 1.0416,-5.84945 4.1181037,4.2049676 0 0 0 -2.9404,-1.78823 z m 45.3328,8.41676 a 4.1181037,4.2049676 0 0 0 -2.7905,0.72419 4.1181037,4.2049676 0 0 0 -1.0416,5.84945 4.1181037,4.2049676 0 0 0 5.731,1.06403 4.1181037,4.2049676 0 0 0 1.0416,-5.84945 4.1181037,4.2049676 0 0 0 -2.9405,-1.78822 z m -24.0815,5.42257 a 4.1181037,4.2049676 0 0 0 -4.7895,3.38563 4.1181037,4.2049676 0 0 0 3.3161,4.88808 4.1181037,4.2049676 0 0 0 4.7868,-3.38368 4.1181037,4.2049676 0 0 0 -3.3134,-4.89003 z"
inkscape:transform-center-x="1.6674842e-05" /><path
style="font-variation-settings:normal;vector-effect:none;fill:#008000;fill-opacity:1;stroke:none;stroke-width:27.2286;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;paint-order:stroke markers fill"
id="path4"
sodipodi:type="arc"
sodipodi:cx="1145.1116"
sodipodi:cy="359.5564"
sodipodi:rx="3.1907064e-13"
sodipodi:ry="7.0904593e-14"
sodipodi:start="4.712389"
sodipodi:end="3.6651914"
sodipodi:arc-type="slice"
transform="rotate(10.305514)" /><path
style="font-variation-settings:normal;vector-effect:none;fill:url(#meshgradient12);fill-opacity:1;stroke:none;stroke-width:20.6251;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;paint-order:stroke markers fill;stop-color:#000000"
id="circle2-1"
sodipodi:type="arc"
sodipodi:cx="1055.2242"
sodipodi:cy="589.4325"
sodipodi:rx="34.5602"
sodipodi:ry="36.172829"
sodipodi:start="4.8696485"
sodipodi:end="0.97726073"
sodipodi:arc-type="slice"
d="m 1060.6368,553.70603 a 34.5602,36.172829 0 0 1 28.3286,27.89823 34.5602,36.172829 0 0 1 -14.4118,37.81437 l -19.3294,-29.98613 z" /><path
id="path7"
style="vector-effect:none;fill:#6b0628;fill-opacity:1;stroke-width:22.5736;stroke-linecap:round;stroke-linejoin:bevel;paint-order:stroke markers fill"
d="m 1046.9602,592.40313 c -2.09,-2.88439 0.4334,-8.65751 3.3178,-10.74756 2.8845,-2.09014 5.0375,0.29432 7.1275,3.17872 2.09,2.88432 20.3683,33.02991 17.4841,35.11997 -2.8845,2.09014 -25.8392,-24.66681 -27.9294,-27.55113 z"
sodipodi:nodetypes="sssss"
inkscape:transform-center-x="12.661821"
inkscape:transform-center-y="-15.728145" /><path
id="path29"
style="vector-effect:none;fill:#a21b48;stroke-width:22.5736;stroke-linecap:round;stroke-linejoin:bevel;paint-order:stroke markers fill"
d="m 1048.6473,590.37118 c -1.9308,-2.99327 -1.0697,-6.98508 1.9236,-8.91596 2.9934,-1.93096 6.9852,-1.06976 8.916,1.92352 1.9309,2.99321 18.5509,34.08387 15.5578,36.01477 -2.9934,1.93096 -24.4663,-26.02911 -26.3974,-29.02233 z"
sodipodi:nodetypes="sssss"
inkscape:transform-center-x="-7.4428873"
inkscape:transform-center-y="13.082694" /></g><script
id="mesh_polyfill"
type="text/javascript">
!function(){const t=&quot;http://www.w3.org/2000/svg&quot;,e=&quot;http://www.w3.org/1999/xlink&quot;,s=&quot;http://www.w3.org/1999/xhtml&quot;,r=2;if(document.createElementNS(t,&quot;meshgradient&quot;).x)return;const n=(t,e,s,r)=&gt;{let n=new x(.5*(e.x+s.x),.5*(e.y+s.y)),o=new x(.5*(t.x+e.x),.5*(t.y+e.y)),i=new x(.5*(s.x+r.x),.5*(s.y+r.y)),a=new x(.5*(n.x+o.x),.5*(n.y+o.y)),h=new x(.5*(n.x+i.x),.5*(n.y+i.y)),l=new x(.5*(a.x+h.x),.5*(a.y+h.y));return[[t,o,a,l],[l,h,i,r]]},o=t=&gt;{let e=t[0].distSquared(t[1]),s=t[2].distSquared(t[3]),r=.25*t[0].distSquared(t[2]),n=.25*t[1].distSquared(t[3]),o=e&gt;s?e:s,i=r&gt;n?r:n;return 18*(o&gt;i?o:i)},i=(t,e)=&gt;Math.sqrt(t.distSquared(e)),a=(t,e)=&gt;t.scale(2/3).add(e.scale(1/3)),h=t=&gt;{let e,s,r,n,o,i,a,h=new g;return t.match(/(\w+\(\s*[^)]+\))+/g).forEach(t=&gt;{let l=t.match(/[\w.-]+/g),d=l.shift();switch(d){case&quot;translate&quot;:2===l.length?e=new g(1,0,0,1,l[0],l[1]):(console.error(&quot;mesh.js: translate does not have 2 arguments!&quot;),e=new g(1,0,0,1,0,0)),h=h.append(e);break;case&quot;scale&quot;:1===l.length?s=new g(l[0],0,0,l[0],0,0):2===l.length?s=new g(l[0],0,0,l[1],0,0):(console.error(&quot;mesh.js: scale does not have 1 or 2 arguments!&quot;),s=new g(1,0,0,1,0,0)),h=h.append(s);break;case&quot;rotate&quot;:if(3===l.length&amp;&amp;(e=new g(1,0,0,1,l[1],l[2]),h=h.append(e)),l[0]){r=l[0]*Math.PI/180;let t=Math.cos(r),e=Math.sin(r);Math.abs(t)&lt;1e-16&amp;&amp;(t=0),Math.abs(e)&lt;1e-16&amp;&amp;(e=0),a=new g(t,e,-e,t,0,0),h=h.append(a)}else console.error(&quot;math.js: No argument to rotate transform!&quot;);3===l.length&amp;&amp;(e=new g(1,0,0,1,-l[1],-l[2]),h=h.append(e));break;case&quot;skewX&quot;:l[0]?(r=l[0]*Math.PI/180,n=Math.tan(r),o=new g(1,0,n,1,0,0),h=h.append(o)):console.error(&quot;math.js: No argument to skewX transform!&quot;);break;case&quot;skewY&quot;:l[0]?(r=l[0]*Math.PI/180,n=Math.tan(r),i=new g(1,n,0,1,0,0),h=h.append(i)):console.error(&quot;math.js: No argument to skewY transform!&quot;);break;case&quot;matrix&quot;:6===l.length?h=h.append(new g(...l)):console.error(&quot;math.js: Incorrect number of arguments for matrix!&quot;);break;default:console.error(&quot;mesh.js: Unhandled transform type: &quot;+d)}}),h},l=t=&gt;{let e=[],s=t.split(/[ ,]+/);for(let t=0,r=s.length-1;t&lt;r;t+=2)e.push(new x(parseFloat(s[t]),parseFloat(s[t+1])));return e},d=(t,e)=&gt;{for(let s in e)t.setAttribute(s,e[s])},c=(t,e,s,r,n)=&gt;{let o,i,a=[0,0,0,0];for(let h=0;h&lt;3;++h)e[h]&lt;t[h]&amp;&amp;e[h]&lt;s[h]||t[h]&lt;e[h]&amp;&amp;s[h]&lt;e[h]?a[h]=0:(a[h]=.5*((e[h]-t[h])/r+(s[h]-e[h])/n),o=Math.abs(3*(e[h]-t[h])/r),i=Math.abs(3*(s[h]-e[h])/n),a[h]&gt;o?a[h]=o:a[h]&gt;i&amp;&amp;(a[h]=i));return a},u=[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0],[-3,3,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0],[2,-2,0,0,1,1,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0],[0,0,0,0,0,0,0,0,-3,3,0,0,-2,-1,0,0],[0,0,0,0,0,0,0,0,2,-2,0,0,1,1,0,0],[-3,0,3,0,0,0,0,0,-2,0,-1,0,0,0,0,0],[0,0,0,0,-3,0,3,0,0,0,0,0,-2,0,-1,0],[9,-9,-9,9,6,3,-6,-3,6,-6,3,-3,4,2,2,1],[-6,6,6,-6,-3,-3,3,3,-4,4,-2,2,-2,-2,-1,-1],[2,0,-2,0,0,0,0,0,1,0,1,0,0,0,0,0],[0,0,0,0,2,0,-2,0,0,0,0,0,1,0,1,0],[-6,6,6,-6,-4,-2,4,2,-3,3,-3,3,-2,-1,-2,-1],[4,-4,-4,4,2,2,-2,-2,2,-2,2,-2,1,1,1,1]],f=t=&gt;{let e=[];for(let s=0;s&lt;16;++s){e[s]=0;for(let r=0;r&lt;16;++r)e[s]+=u[s][r]*t[r]}return e},p=(t,e,s)=&gt;{const r=e*e,n=s*s,o=e*e*e,i=s*s*s;return t[0]+t[1]*e+t[2]*r+t[3]*o+t[4]*s+t[5]*s*e+t[6]*s*r+t[7]*s*o+t[8]*n+t[9]*n*e+t[10]*n*r+t[11]*n*o+t[12]*i+t[13]*i*e+t[14]*i*r+t[15]*i*o},y=t=&gt;{let e=[],s=[],r=[];for(let s=0;s&lt;4;++s)e[s]=[],e[s][0]=n(t[0][s],t[1][s],t[2][s],t[3][s]),e[s][1]=[],e[s][1].push(...n(...e[s][0][0])),e[s][1].push(...n(...e[s][0][1])),e[s][2]=[],e[s][2].push(...n(...e[s][1][0])),e[s][2].push(...n(...e[s][1][1])),e[s][2].push(...n(...e[s][1][2])),e[s][2].push(...n(...e[s][1][3]));for(let t=0;t&lt;8;++t){s[t]=[];for(let r=0;r&lt;4;++r)s[t][r]=[],s[t][r][0]=n(e[0][2][t][r],e[1][2][t][r],e[2][2][t][r],e[3][2][t][r]),s[t][r][1]=[],s[t][r][1].push(...n(...s[t][r][0][0])),s[t][r][1].push(...n(...s[t][r][0][1])),s[t][r][2]=[],s[t][r][2].push(...n(...s[t][r][1][0])),s[t][r][2].push(...n(...s[t][r][1][1])),s[t][r][2].push(...n(...s[t][r][1][2])),s[t][r][2].push(...n(...s[t][r][1][3]))}for(let t=0;t&lt;8;++t){r[t]=[];for(let e=0;e&lt;8;++e)r[t][e]=[],r[t][e][0]=s[t][0][2][e],r[t][e][1]=s[t][1][2][e],r[t][e][2]=s[t][2][2][e],r[t][e][3]=s[t][3][2][e]}return r};class x{constructor(t,e){this.x=t||0,this.y=e||0}toString(){return`(x=${this.x}, y=${this.y})`}clone(){return new x(this.x,this.y)}add(t){return new x(this.x+t.x,this.y+t.y)}scale(t){return void 0===t.x?new x(this.x*t,this.y*t):new x(this.x*t.x,this.y*t.y)}distSquared(t){let e=this.x-t.x,s=this.y-t.y;return e*e+s*s}transform(t){let e=this.x*t.a+this.y*t.c+t.e,s=this.x*t.b+this.y*t.d+t.f;return new x(e,s)}}class g{constructor(t,e,s,r,n,o){void 0===t?(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0):(this.a=t,this.b=e,this.c=s,this.d=r,this.e=n,this.f=o)}toString(){return`affine: ${this.a} ${this.c} ${this.e} \n ${this.b} ${this.d} ${this.f}`}append(t){t instanceof g||console.error(&quot;mesh.js: argument to Affine.append is not affine!&quot;);let e=this.a*t.a+this.c*t.b,s=this.b*t.a+this.d*t.b,r=this.a*t.c+this.c*t.d,n=this.b*t.c+this.d*t.d,o=this.a*t.e+this.c*t.f+this.e,i=this.b*t.e+this.d*t.f+this.f;return new g(e,s,r,n,o,i)}}class w{constructor(t,e){this.nodes=t,this.colors=e}paintCurve(t,e){if(o(this.nodes)&gt;r){const s=n(...this.nodes);let r=[[],[]],o=[[],[]];for(let t=0;t&lt;4;++t)r[0][t]=this.colors[0][t],r[1][t]=(this.colors[0][t]+this.colors[1][t])/2,o[0][t]=r[1][t],o[1][t]=this.colors[1][t];let i=new w(s[0],r),a=new w(s[1],o);i.paintCurve(t,e),a.paintCurve(t,e)}else{let s=Math.round(this.nodes[0].x);if(s&gt;=0&amp;&amp;s&lt;e){let r=4*(~~this.nodes[0].y*e+s);t[r]=Math.round(this.colors[0][0]),t[r+1]=Math.round(this.colors[0][1]),t[r+2]=Math.round(this.colors[0][2]),t[r+3]=Math.round(this.colors[0][3])}}}}class m{constructor(t,e){this.nodes=t,this.colors=e}split(){let t=[[],[],[],[]],e=[[],[],[],[]],s=[[[],[]],[[],[]]],r=[[[],[]],[[],[]]];for(let s=0;s&lt;4;++s){const r=n(this.nodes[0][s],this.nodes[1][s],this.nodes[2][s],this.nodes[3][s]);t[0][s]=r[0][0],t[1][s]=r[0][1],t[2][s]=r[0][2],t[3][s]=r[0][3],e[0][s]=r[1][0],e[1][s]=r[1][1],e[2][s]=r[1][2],e[3][s]=r[1][3]}for(let t=0;t&lt;4;++t)s[0][0][t]=this.colors[0][0][t],s[0][1][t]=this.colors[0][1][t],s[1][0][t]=(this.colors[0][0][t]+this.colors[1][0][t])/2,s[1][1][t]=(this.colors[0][1][t]+this.colors[1][1][t])/2,r[0][0][t]=s[1][0][t],r[0][1][t]=s[1][1][t],r[1][0][t]=this.colors[1][0][t],r[1][1][t]=this.colors[1][1][t];return[new m(t,s),new m(e,r)]}paint(t,e){let s,n=!1;for(let t=0;t&lt;4;++t)if((s=o([this.nodes[0][t],this.nodes[1][t],this.nodes[2][t],this.nodes[3][t]]))&gt;r){n=!0;break}if(n){let s=this.split();s[0].paint(t,e),s[1].paint(t,e)}else{new w([...this.nodes[0]],[...this.colors[0]]).paintCurve(t,e)}}}class b{constructor(t){this.readMesh(t),this.type=t.getAttribute(&quot;type&quot;)||&quot;bilinear&quot;}readMesh(t){let e=[[]],s=[[]],r=Number(t.getAttribute(&quot;x&quot;)),n=Number(t.getAttribute(&quot;y&quot;));e[0][0]=new x(r,n);let o=t.children;for(let t=0,r=o.length;t&lt;r;++t){e[3*t+1]=[],e[3*t+2]=[],e[3*t+3]=[],s[t+1]=[];let r=o[t].children;for(let n=0,o=r.length;n&lt;o;++n){let o=r[n].children;for(let r=0,i=o.length;r&lt;i;++r){let i=r;0!==t&amp;&amp;++i;let h,d=o[r].getAttribute(&quot;path&quot;),c=&quot;l&quot;;null!=d&amp;&amp;(c=(h=d.match(/\s*([lLcC])\s*(.*)/))[1]);let u=l(h[2]);switch(c){case&quot;l&quot;:0===i?(e[3*t][3*n+3]=u[0].add(e[3*t][3*n]),e[3*t][3*n+1]=a(e[3*t][3*n],e[3*t][3*n+3]),e[3*t][3*n+2]=a(e[3*t][3*n+3],e[3*t][3*n])):1===i?(e[3*t+3][3*n+3]=u[0].add(e[3*t][3*n+3]),e[3*t+1][3*n+3]=a(e[3*t][3*n+3],e[3*t+3][3*n+3]),e[3*t+2][3*n+3]=a(e[3*t+3][3*n+3],e[3*t][3*n+3])):2===i?(0===n&amp;&amp;(e[3*t+3][3*n+0]=u[0].add(e[3*t+3][3*n+3])),e[3*t+3][3*n+1]=a(e[3*t+3][3*n],e[3*t+3][3*n+3]),e[3*t+3][3*n+2]=a(e[3*t+3][3*n+3],e[3*t+3][3*n])):(e[3*t+1][3*n]=a(e[3*t][3*n],e[3*t+3][3*n]),e[3*t+2][3*n]=a(e[3*t+3][3*n],e[3*t][3*n]));break;case&quot;L&quot;:0===i?(e[3*t][3*n+3]=u[0],e[3*t][3*n+1]=a(e[3*t][3*n],e[3*t][3*n+3]),e[3*t][3*n+2]=a(e[3*t][3*n+3],e[3*t][3*n])):1===i?(e[3*t+3][3*n+3]=u[0],e[3*t+1][3*n+3]=a(e[3*t][3*n+3],e[3*t+3][3*n+3]),e[3*t+2][3*n+3]=a(e[3*t+3][3*n+3],e[3*t][3*n+3])):2===i?(0===n&amp;&amp;(e[3*t+3][3*n+0]=u[0]),e[3*t+3][3*n+1]=a(e[3*t+3][3*n],e[3*t+3][3*n+3]),e[3*t+3][3*n+2]=a(e[3*t+3][3*n+3],e[3*t+3][3*n])):(e[3*t+1][3*n]=a(e[3*t][3*n],e[3*t+3][3*n]),e[3*t+2][3*n]=a(e[3*t+3][3*n],e[3*t][3*n]));break;case&quot;c&quot;:0===i?(e[3*t][3*n+1]=u[0].add(e[3*t][3*n]),e[3*t][3*n+2]=u[1].add(e[3*t][3*n]),e[3*t][3*n+3]=u[2].add(e[3*t][3*n])):1===i?(e[3*t+1][3*n+3]=u[0].add(e[3*t][3*n+3]),e[3*t+2][3*n+3]=u[1].add(e[3*t][3*n+3]),e[3*t+3][3*n+3]=u[2].add(e[3*t][3*n+3])):2===i?(e[3*t+3][3*n+2]=u[0].add(e[3*t+3][3*n+3]),e[3*t+3][3*n+1]=u[1].add(e[3*t+3][3*n+3]),0===n&amp;&amp;(e[3*t+3][3*n+0]=u[2].add(e[3*t+3][3*n+3]))):(e[3*t+2][3*n]=u[0].add(e[3*t+3][3*n]),e[3*t+1][3*n]=u[1].add(e[3*t+3][3*n]));break;case&quot;C&quot;:0===i?(e[3*t][3*n+1]=u[0],e[3*t][3*n+2]=u[1],e[3*t][3*n+3]=u[2]):1===i?(e[3*t+1][3*n+3]=u[0],e[3*t+2][3*n+3]=u[1],e[3*t+3][3*n+3]=u[2]):2===i?(e[3*t+3][3*n+2]=u[0],e[3*t+3][3*n+1]=u[1],0===n&amp;&amp;(e[3*t+3][3*n+0]=u[2])):(e[3*t+2][3*n]=u[0],e[3*t+1][3*n]=u[1]);break;default:console.error(&quot;mesh.js: &quot;+c+&quot; invalid path type.&quot;)}if(0===t&amp;&amp;0===n||r&gt;0){let e=window.getComputedStyle(o[r]).stopColor.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),a=window.getComputedStyle(o[r]).stopOpacity,h=255;a&amp;&amp;(h=Math.floor(255*a)),e&amp;&amp;(0===i?(s[t][n]=[],s[t][n][0]=Math.floor(e[1]),s[t][n][1]=Math.floor(e[2]),s[t][n][2]=Math.floor(e[3]),s[t][n][3]=h):1===i?(s[t][n+1]=[],s[t][n+1][0]=Math.floor(e[1]),s[t][n+1][1]=Math.floor(e[2]),s[t][n+1][2]=Math.floor(e[3]),s[t][n+1][3]=h):2===i?(s[t+1][n+1]=[],s[t+1][n+1][0]=Math.floor(e[1]),s[t+1][n+1][1]=Math.floor(e[2]),s[t+1][n+1][2]=Math.floor(e[3]),s[t+1][n+1][3]=h):3===i&amp;&amp;(s[t+1][n]=[],s[t+1][n][0]=Math.floor(e[1]),s[t+1][n][1]=Math.floor(e[2]),s[t+1][n][2]=Math.floor(e[3]),s[t+1][n][3]=h))}}e[3*t+1][3*n+1]=new x,e[3*t+1][3*n+2]=new x,e[3*t+2][3*n+1]=new x,e[3*t+2][3*n+2]=new x,e[3*t+1][3*n+1].x=(-4*e[3*t][3*n].x+6*(e[3*t][3*n+1].x+e[3*t+1][3*n].x)+-2*(e[3*t][3*n+3].x+e[3*t+3][3*n].x)+3*(e[3*t+3][3*n+1].x+e[3*t+1][3*n+3].x)+-1*e[3*t+3][3*n+3].x)/9,e[3*t+1][3*n+2].x=(-4*e[3*t][3*n+3].x+6*(e[3*t][3*n+2].x+e[3*t+1][3*n+3].x)+-2*(e[3*t][3*n].x+e[3*t+3][3*n+3].x)+3*(e[3*t+3][3*n+2].x+e[3*t+1][3*n].x)+-1*e[3*t+3][3*n].x)/9,e[3*t+2][3*n+1].x=(-4*e[3*t+3][3*n].x+6*(e[3*t+3][3*n+1].x+e[3*t+2][3*n].x)+-2*(e[3*t+3][3*n+3].x+e[3*t][3*n].x)+3*(e[3*t][3*n+1].x+e[3*t+2][3*n+3].x)+-1*e[3*t][3*n+3].x)/9,e[3*t+2][3*n+2].x=(-4*e[3*t+3][3*n+3].x+6*(e[3*t+3][3*n+2].x+e[3*t+2][3*n+3].x)+-2*(e[3*t+3][3*n].x+e[3*t][3*n+3].x)+3*(e[3*t][3*n+2].x+e[3*t+2][3*n].x)+-1*e[3*t][3*n].x)/9,e[3*t+1][3*n+1].y=(-4*e[3*t][3*n].y+6*(e[3*t][3*n+1].y+e[3*t+1][3*n].y)+-2*(e[3*t][3*n+3].y+e[3*t+3][3*n].y)+3*(e[3*t+3][3*n+1].y+e[3*t+1][3*n+3].y)+-1*e[3*t+3][3*n+3].y)/9,e[3*t+1][3*n+2].y=(-4*e[3*t][3*n+3].y+6*(e[3*t][3*n+2].y+e[3*t+1][3*n+3].y)+-2*(e[3*t][3*n].y+e[3*t+3][3*n+3].y)+3*(e[3*t+3][3*n+2].y+e[3*t+1][3*n].y)+-1*e[3*t+3][3*n].y)/9,e[3*t+2][3*n+1].y=(-4*e[3*t+3][3*n].y+6*(e[3*t+3][3*n+1].y+e[3*t+2][3*n].y)+-2*(e[3*t+3][3*n+3].y+e[3*t][3*n].y)+3*(e[3*t][3*n+1].y+e[3*t+2][3*n+3].y)+-1*e[3*t][3*n+3].y)/9,e[3*t+2][3*n+2].y=(-4*e[3*t+3][3*n+3].y+6*(e[3*t+3][3*n+2].y+e[3*t+2][3*n+3].y)+-2*(e[3*t+3][3*n].y+e[3*t][3*n+3].y)+3*(e[3*t][3*n+2].y+e[3*t+2][3*n].y)+-1*e[3*t][3*n].y)/9}}this.nodes=e,this.colors=s}paintMesh(t,e){let s=(this.nodes.length-1)/3,r=(this.nodes[0].length-1)/3;if(&quot;bilinear&quot;===this.type||s&lt;2||r&lt;2){let n;for(let o=0;o&lt;s;++o)for(let s=0;s&lt;r;++s){let r=[];for(let t=3*o,e=3*o+4;t&lt;e;++t)r.push(this.nodes[t].slice(3*s,3*s+4));let i=[];i.push(this.colors[o].slice(s,s+2)),i.push(this.colors[o+1].slice(s,s+2)),(n=new m(r,i)).paint(t,e)}}else{let n,o,a,h,l,d,u;const x=s,g=r;s++,r++;let w=new Array(s);for(let t=0;t&lt;s;++t){w[t]=new Array(r);for(let e=0;e&lt;r;++e)w[t][e]=[],w[t][e][0]=this.nodes[3*t][3*e],w[t][e][1]=this.colors[t][e]}for(let t=0;t&lt;s;++t)for(let e=0;e&lt;r;++e)0!==t&amp;&amp;t!==x&amp;&amp;(n=i(w[t-1][e][0],w[t][e][0]),o=i(w[t+1][e][0],w[t][e][0]),w[t][e][2]=c(w[t-1][e][1],w[t][e][1],w[t+1][e][1],n,o)),0!==e&amp;&amp;e!==g&amp;&amp;(n=i(w[t][e-1][0],w[t][e][0]),o=i(w[t][e+1][0],w[t][e][0]),w[t][e][3]=c(w[t][e-1][1],w[t][e][1],w[t][e+1][1],n,o));for(let t=0;t&lt;r;++t){w[0][t][2]=[],w[x][t][2]=[];for(let e=0;e&lt;4;++e)n=i(w[1][t][0],w[0][t][0]),o=i(w[x][t][0],w[x-1][t][0]),w[0][t][2][e]=n&gt;0?2*(w[1][t][1][e]-w[0][t][1][e])/n-w[1][t][2][e]:0,w[x][t][2][e]=o&gt;0?2*(w[x][t][1][e]-w[x-1][t][1][e])/o-w[x-1][t][2][e]:0}for(let t=0;t&lt;s;++t){w[t][0][3]=[],w[t][g][3]=[];for(let e=0;e&lt;4;++e)n=i(w[t][1][0],w[t][0][0]),o=i(w[t][g][0],w[t][g-1][0]),w[t][0][3][e]=n&gt;0?2*(w[t][1][1][e]-w[t][0][1][e])/n-w[t][1][3][e]:0,w[t][g][3][e]=o&gt;0?2*(w[t][g][1][e]-w[t][g-1][1][e])/o-w[t][g-1][3][e]:0}for(let s=0;s&lt;x;++s)for(let r=0;r&lt;g;++r){let n=i(w[s][r][0],w[s+1][r][0]),o=i(w[s][r+1][0],w[s+1][r+1][0]),c=i(w[s][r][0],w[s][r+1][0]),x=i(w[s+1][r][0],w[s+1][r+1][0]),g=[[],[],[],[]];for(let t=0;t&lt;4;++t){(d=[])[0]=w[s][r][1][t],d[1]=w[s+1][r][1][t],d[2]=w[s][r+1][1][t],d[3]=w[s+1][r+1][1][t],d[4]=w[s][r][2][t]*n,d[5]=w[s+1][r][2][t]*n,d[6]=w[s][r+1][2][t]*o,d[7]=w[s+1][r+1][2][t]*o,d[8]=w[s][r][3][t]*c,d[9]=w[s+1][r][3][t]*x,d[10]=w[s][r+1][3][t]*c,d[11]=w[s+1][r+1][3][t]*x,d[12]=0,d[13]=0,d[14]=0,d[15]=0,u=f(d);for(let e=0;e&lt;9;++e){g[t][e]=[];for(let s=0;s&lt;9;++s)g[t][e][s]=p(u,e/8,s/8),g[t][e][s]&gt;255?g[t][e][s]=255:g[t][e][s]&lt;0&amp;&amp;(g[t][e][s]=0)}}h=[];for(let t=3*s,e=3*s+4;t&lt;e;++t)h.push(this.nodes[t].slice(3*r,3*r+4));l=y(h);for(let s=0;s&lt;8;++s)for(let r=0;r&lt;8;++r)(a=new m(l[s][r],[[[g[0][s][r],g[1][s][r],g[2][s][r],g[3][s][r]],[g[0][s][r+1],g[1][s][r+1],g[2][s][r+1],g[3][s][r+1]]],[[g[0][s+1][r],g[1][s+1][r],g[2][s+1][r],g[3][s+1][r]],[g[0][s+1][r+1],g[1][s+1][r+1],g[2][s+1][r+1],g[3][s+1][r+1]]]])).paint(t,e)}}}transform(t){if(t instanceof x)for(let e=0,s=this.nodes.length;e&lt;s;++e)for(let s=0,r=this.nodes[0].length;s&lt;r;++s)this.nodes[e][s]=this.nodes[e][s].add(t);else if(t instanceof g)for(let e=0,s=this.nodes.length;e&lt;s;++e)for(let s=0,r=this.nodes[0].length;s&lt;r;++s)this.nodes[e][s]=this.nodes[e][s].transform(t)}scale(t){for(let e=0,s=this.nodes.length;e&lt;s;++e)for(let s=0,r=this.nodes[0].length;s&lt;r;++s)this.nodes[e][s]=this.nodes[e][s].scale(t)}}document.querySelectorAll(&quot;rect,circle,ellipse,path,text&quot;).forEach((r,n)=&gt;{let o=r.getAttribute(&quot;id&quot;);o||(o=&quot;patchjs_shape&quot;+n,r.setAttribute(&quot;id&quot;,o));const i=r.style.fill.match(/^url\(\s*&quot;?\s*#([^\s&quot;]+)&quot;?\s*\)/),a=r.style.stroke.match(/^url\(\s*&quot;?\s*#([^\s&quot;]+)&quot;?\s*\)/);if(i&amp;&amp;i[1]){const a=document.getElementById(i[1]);if(a&amp;&amp;&quot;meshgradient&quot;===a.nodeName){const i=r.getBBox();let l=document.createElementNS(s,&quot;canvas&quot;);d(l,{width:i.width,height:i.height});const c=l.getContext(&quot;2d&quot;);let u=c.createImageData(i.width,i.height);const f=new b(a);&quot;objectBoundingBox&quot;===a.getAttribute(&quot;gradientUnits&quot;)&amp;&amp;f.scale(new x(i.width,i.height));const p=a.getAttribute(&quot;gradientTransform&quot;);null!=p&amp;&amp;f.transform(h(p)),&quot;userSpaceOnUse&quot;===a.getAttribute(&quot;gradientUnits&quot;)&amp;&amp;f.transform(new x(-i.x,-i.y)),f.paintMesh(u.data,l.width),c.putImageData(u,0,0);const y=document.createElementNS(t,&quot;image&quot;);d(y,{width:i.width,height:i.height,x:i.x,y:i.y});let g=l.toDataURL();y.setAttributeNS(e,&quot;xlink:href&quot;,g),r.parentNode.insertBefore(y,r),r.style.fill=&quot;none&quot;;const w=document.createElementNS(t,&quot;use&quot;);w.setAttributeNS(e,&quot;xlink:href&quot;,&quot;#&quot;+o);const m=&quot;patchjs_clip&quot;+n,M=document.createElementNS(t,&quot;clipPath&quot;);M.setAttribute(&quot;id&quot;,m),M.appendChild(w),r.parentElement.insertBefore(M,r),y.setAttribute(&quot;clip-path&quot;,&quot;url(#&quot;+m+&quot;)&quot;),u=null,l=null,g=null}}if(a&amp;&amp;a[1]){const o=document.getElementById(a[1]);if(o&amp;&amp;&quot;meshgradient&quot;===o.nodeName){const i=parseFloat(r.style.strokeWidth.slice(0,-2))*(parseFloat(r.style.strokeMiterlimit)||parseFloat(r.getAttribute(&quot;stroke-miterlimit&quot;))||1),a=r.getBBox(),l=Math.trunc(a.width+i),c=Math.trunc(a.height+i),u=Math.trunc(a.x-i/2),f=Math.trunc(a.y-i/2);let p=document.createElementNS(s,&quot;canvas&quot;);d(p,{width:l,height:c});const y=p.getContext(&quot;2d&quot;);let g=y.createImageData(l,c);const w=new b(o);&quot;objectBoundingBox&quot;===o.getAttribute(&quot;gradientUnits&quot;)&amp;&amp;w.scale(new x(l,c));const m=o.getAttribute(&quot;gradientTransform&quot;);null!=m&amp;&amp;w.transform(h(m)),&quot;userSpaceOnUse&quot;===o.getAttribute(&quot;gradientUnits&quot;)&amp;&amp;w.transform(new x(-u,-f)),w.paintMesh(g.data,p.width),y.putImageData(g,0,0);const M=document.createElementNS(t,&quot;image&quot;);d(M,{width:l,height:c,x:0,y:0});let S=p.toDataURL();M.setAttributeNS(e,&quot;xlink:href&quot;,S);const k=&quot;pattern_clip&quot;+n,A=document.createElementNS(t,&quot;pattern&quot;);d(A,{id:k,patternUnits:&quot;userSpaceOnUse&quot;,width:l,height:c,x:u,y:f}),A.appendChild(M),o.parentNode.appendChild(A),r.style.stroke=&quot;url(#&quot;+k+&quot;)&quot;,g=null,p=null,S=null}}})}();
</script></svg>