flo-mat 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/helpers/jest.setup.ts +35 -0
- package/__tests__/specific-cases/specific-cases.spec.ts +1 -1
- package/browser/index.js +10665 -10243
- package/browser/index.min.js +1 -1
- package/node/cp-node/fs/get-implied-boundary-bezier-between.js.map +1 -1
- package/node/cp-node/stringification/cp-node-stringifyable.d.ts +29 -0
- package/node/cp-node/stringification/cp-node-stringifyable.js +7 -0
- package/node/cp-node/stringification/cp-node-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/from-stringifyable.d.ts +4 -0
- package/node/cp-node/stringification/from-stringifyable.js +43 -0
- package/node/cp-node/stringification/from-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/loop-from-stringifyable.d.ts +4 -0
- package/node/cp-node/stringification/loop-from-stringifyable.js +7 -0
- package/node/cp-node/stringification/loop-from-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/loop-stringifyable.d.ts +5 -0
- package/node/cp-node/stringification/loop-stringifyable.js +2 -0
- package/node/cp-node/stringification/loop-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/loop-to-stringifyable.d.ts +4 -0
- package/node/cp-node/stringification/loop-to-stringifyable.js +6 -0
- package/node/cp-node/stringification/loop-to-stringifyable.js.map +1 -0
- package/node/cp-node/stringification/to-stringifyable.d.ts +9 -0
- package/node/cp-node/stringification/to-stringifyable.js +46 -0
- package/node/cp-node/stringification/to-stringifyable.js.map +1 -0
- package/node/find-mat/find-mats.js +3 -1
- package/node/find-mat/find-mats.js.map +1 -1
- package/node/index.d.ts +5 -0
- package/node/index.js +5 -0
- package/node/index.js.map +1 -1
- package/node/mat/get-branches.js.map +1 -1
- package/node/mat/get-largest-3-prong.d.ts +3 -0
- package/node/mat/get-largest-3-prong.js +16 -0
- package/node/mat/get-largest-3-prong.js.map +1 -0
- package/node/mat/get-largest-vertex.d.ts +0 -1
- package/node/mat/get-largest-vertex.js +0 -1
- package/node/mat/get-largest-vertex.js.map +1 -1
- package/package.json +14 -14
- package/src/cp-node/fs/get-implied-boundary-bezier-between.ts +0 -1
- package/src/cp-node/stringification/from-stringifyable.ts +2 -2
- package/src/cp-node/stringification/to-stringifyable.ts +2 -2
- package/src/find-mat/find-mats.ts +3 -1
- package/src/index.ts +6 -1
- package/src/mat/get-branches.ts +1 -3
- package/src/mat/get-largest-3-prong.ts +3 -2
- package/src/mat/get-largest-vertex.ts +3 -2
- package/src/debug/functions/draw/draw-bezier-pieces.ts +0 -35
package/browser/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t=[],e){const r=[],o={beziers:t,curves:r,idx:e};if(0===t.length)return o;let i,c=0;for(let e=0;e<t.length;e++){if(n(t[e]))continue;const s={loop:o,ps:t[e],prev:i,next:void 0,idx:c};i&&(i.next=s),i=s,r.push(s),c++}const s=r[r.length-1];return r[0].prev=s,s.next=r[0],s.ps[s.ps.length-1]=r[0].ps[0],o}function n(t){return 2===t.length?t[0][0]===t[1][0]&&t[0][1]===t[1][1]:3===t.length?t[0][0]===t[1][0]&&t[0][1]===t[1][1]&&t[1][1]===t[2][1]&&t[1][1]===t[2][1]:t[0][0]===t[1][0]&&t[0][1]===t[1][1]&&t[1][1]===t[2][1]&&t[1][1]===t[2][1]&&t[2][1]===t[3][1]&&t[2][1]===t[3][1]}function e(t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];0===e&&n.push("M "+r[0][0].toString()+" "+r[0][1].toString()),4===r.length?n.push("C "+r[1][0].toString()+" "+r[1][1].toString()+" "+r[2][0].toString()+" "+r[2][1].toString()+" "+r[3][0].toString()+" "+r[3][1].toString()+" "):3===r.length?n.push("Q "+r[1][0].toString()+" "+r[1][1].toString()+" "+r[2][0].toString()+" "+r[2][1].toString()+" "):2===r.length&&n.push("L "+r[1][0].toString()+" "+r[1][1].toString()+" ")}return n.push(" z"),n.join("\n")}class r{initialPoint=void 0;p;vals=void 0;prev2ndCubicControlPoint=void 0;prev2ndQuadraticControlPoint=void 0;constructor(){this.p=[0,0]}}function o(t){const n=[t.p,t.initialPoint];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n}function i(t){t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0;const n=(e=t.p,t.vals[0],t.vals[1],t.vals[2],t.vals[3],t.vals[4],[[e,[t.vals[5],t.vals[6]]]]);var e;const r=n[n.length-1];return t.p=r[r.length-1],n}const c={c:function(t){const n=[t.p,[t.vals[0],t.vals[1]],[t.vals[2],t.vals[3]],[t.vals[4],t.vals[5]]];return t.prev2ndCubicControlPoint=n[2],t.prev2ndQuadraticControlPoint=void 0,n},h:function(t){const n=[t.p,[t.vals[0],t.p[1]]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n},l:function(t){const n=[t.p,t.vals];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n},q:function(t){const n=[t.vals[0],t.vals[1]],e=[t.vals[2],t.vals[3]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=n,[t.p,n,e]},s:function(t){const n=t.prev2ndCubicControlPoint?[t.p[0]-t.prev2ndCubicControlPoint[0]+t.p[0],t.p[1]-t.prev2ndCubicControlPoint[1]+t.p[1]]:t.p,e=[t.p,n,[t.vals[0],t.vals[1]],[t.vals[2],t.vals[3]]];return t.prev2ndCubicControlPoint=e[2],t.prev2ndQuadraticControlPoint=void 0,e},t:function(t){const n=t.prev2ndQuadraticControlPoint?[t.p[0]-t.prev2ndQuadraticControlPoint[0]+t.p[0],t.p[1]-t.prev2ndQuadraticControlPoint[1]+t.p[1]]:t.p,e=[t.vals[0],t.vals[1]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=n,[t.p,n,e]},v:function(t){const n=[t.p,[t.p[0],t.vals[0]]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n},z:o};function s(t){let n=0,e=0,r=1,o=0,i=1,c=1;const s=t._currentIndex;t._skipOptionalSpaces();let u=t._currentIndex;u<t._endIndex&&"+"===t._string[u]?(t._currentIndex+=1,u+=1):u<t._endIndex&&"-"===t._string[u]&&(t._currentIndex+=1,u+=1,i=-1);const f=t._string[u];if(u===t._endIndex||(f<"0"||f>"9")&&"."!==f)throw new Error(`The first character of a number must be one of [0-9+-.]. Found '${f}' at index ${u}.`);const l=t._currentIndex;for(;u<t._endIndex&&t._string[u]>="0"&&t._string[u]<="9";)t._currentIndex+=1,u+=1;if(u!==l){let n=u-1,r=1;for(;n>=l;)e+=r*(Number(t._string[n])-0),n-=1,r*=10}if(u<t._endIndex&&"."===t._string[u]){if(t._currentIndex+=1,u+=1,u>=t._endIndex||t._string[u]<"0"||t._string[u]>"9")throw new Error("There must be a least one digit following the .");for(;u<t._endIndex&&t._string[u]>="0"&&t._string[u]<="9";)r*=10,o+=Number(t._string.charAt(u))/r,t._currentIndex+=1,u+=1}if(u!==s&&u+1<t._endIndex&&("e"===t._string[u]||"E"===t._string[u])&&"x"!==t._string[u+1]&&"m"!==t._string[u+1]){if(t._currentIndex+=1,u+=1,"+"===t._string[u]?(t._currentIndex+=1,u+=1):"-"===t._string[u]&&(t._currentIndex+=1,u+=1,c=-1),u>=t._endIndex||t._string[u]<"0"||t._string[u]>"9")throw new Error("There must be an exponent.");for(;u<t._endIndex&&t._string[u]>="0"&&t._string[u]<="9";)n*=10,n+=Number(t._string[u]),t._currentIndex+=1,u+=1}let a=e+o;if(a*=i,n&&(a*=Math.pow(10,c*n)),s===u)throw new Error("Internal error: startIndex === source._currentIndex");return t._skipOptionalSpacesOrDelimiter(),a}const u={Z:"Z",M:"M",L:"L",C:"C",Q:"Q",A:"A",H:"H",V:"V",S:"S",T:"T",z:"Z",m:"m",l:"l",c:"c",q:"q",a:"a",h:"h",v:"v",s:"s",t:"t"};class f{_string;_currentIndex;_endIndex;_prevCommand;constructor(t){this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._prevCommand=void 0,this._skipOptionalSpaces()}parseSegment(){const t=this._string[this._currentIndex];let n,e=u[t];if(void 0===e){if(void 0===this._prevCommand)throw new Error("Implicit command not allowed for first commands.");if(!("+"===t||"-"===t||"."===t||t>="0"&&t<="9")||"Z"===this._prevCommand)throw new Error("Remaining coordinates not found for implicit command");e="M"===this._prevCommand?"L":"m"===this._prevCommand?"l":this._prevCommand}else this._currentIndex+=1;this._prevCommand=e;const r=e.toUpperCase();if("H"===r||"V"===r?n=[s(this)]:"M"===r||"L"===r||"T"===r?n=[s(this),s(this)]:"S"===r||"Q"===r?n=[s(this),s(this),s(this),s(this)]:"C"===r?n=[s(this),s(this),s(this),s(this),s(this),s(this)]:"A"===r?n=[s(this),s(this),s(this),this._parseArcFlag(),this._parseArcFlag(),s(this),s(this)]:"Z"===r&&(this._skipOptionalSpaces(),n=[]),void 0===n)throw new Error("Unknown command");return{type:e,values:n}}hasMoreData(){return this._currentIndex<this._endIndex}initialCommandIsMoveTo(){if(!this.hasMoreData())return!0;const t=u[this._string[this._currentIndex]];return"M"===t||"m"===t}_isCurrentSpace(){const t=this._string[this._currentIndex];return t<=" "&&(" "===t||"\n"===t||"\t"===t||"\r"===t||"\f"===t)}_skipOptionalSpaces(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex+=1;return this._currentIndex<this._endIndex}_skipOptionalSpacesOrDelimiter(){return!(this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&","!==this._string[this._currentIndex])&&(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&","===this._string[this._currentIndex]&&(this._currentIndex+=1,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)}_parseArcFlag(){if(this._currentIndex>=this._endIndex)throw new Error("Unable to parse arc flag");let t;const n=this._string[this._currentIndex];if(this._currentIndex+=1,"0"===n)t=0;else{if("1"!==n)throw new Error("Unable to parse arc flag - arc flag must be 0 or 1");t=1}return this._skipOptionalSpacesOrDelimiter(),t}}function l(t){return function(t){if(0===t.length)return[];if("m"!==t[0].type.toLowerCase())throw new Error("Invalid SVG - every new path must start with an M or m.");const n=new r,e=[];let s,u=[];for(let r=0;r<t.length;r++){const f=t[r],l=f.type.toLowerCase();if(n.vals=f.values,f.type===l)if("v"===l)n.vals[0]+=n.p[1];else if("a"===l)n.vals[5]+=n.p[0],n.vals[6]+=n.p[1];else for(let t=0;t<n.vals.length;t++)n.vals[t]+=n.p[t%2];if("m"!==l){if("a"===l)u.push(...i(n));else{const t=c[l];if(!t)throw new Error("Invalid SVG - command not recognized.");const e=t(n);n.p=e[e.length-1],u.push(e)}s=l}else u.length&&("z"!==s&&u.push(o(n)),e.push(u),u=[]),n.initialPoint=n.p=n.vals,s=l}return u.length>0&&("z"!==s&&u.push(o(n)),e.push(u)),e}(function(t){if(!t.length)return[];const n=new f(t),e=[];if(!n.initialCommandIsMoveTo())throw new Error("Path must start with m or M");for(;n.hasMoreData();)e.push(n.parseSegment());return e}(t))}function a(t){const n=t.length,e=Array.from(Array(n),()=>new Array(n).fill(0));for(let r=0;r<n;r++)for(let o=0;o<n;o++)e[r][o]=t[r][o];for(let t=0;t<n;t++)for(let r=0;r<n;r++)for(let o=0;o<n;o++)e[r][t]+e[t][o]<e[r][o]&&(e[r][o]=e[r][t]+e[t][o]);return e}function p(t){const n=t,e=[];do{e.push(t),t=t.next}while(t!==n);return e}function h(t){return p(t).filter(t=>t.isHoleClosing)}function d(t){const n=t.pointOnShape;return{idx:n.curve.idx,t:n.t,order:n.order,order2:n.order2}}function v(t){const n=t;let e=n,r=0;do{r++,e=e.nextOnCircle}while(e!==n);return r}function g(t,n=!1){const e=t,r=n?[]:[t];let o=t.nextOnCircle;for(;o!==e;)r.push(o),o=o.nextOnCircle;return r}function m(t){return t===t.next.prevOnCircle}function x(t){return g(t).filter(t=>!m(t)).length}function b(t){return g(t).every(m)}function w(t){if(!m(t))return!1;if(b(t))return!0;for(;t.prev===t.prevOnCircle;)t=t.prev;return g(t.prevOnCircle,!0).every(m)}function _(t){return 0===t.pointOnShape.circle.radius}function M(t){const n=t.pointOnShape,e=n.curve;return{...t,pos:n,p:n.p,t:n.t,isTerminating:m(t),isFullyTerminating:w(t),isSharp:_(t),prongCount:v(t),getRealProngCount:x(t),ordering:d(t),curve:e,loop:e.loop}}function I(t){let n=t;if(m(n))return[n];const e=[];do{e.push(n);const t=n.next.prevOnCircle;n=n=n===t?n.next.next:t}while(n!==t);return e}function S(t,n){const e=p(t),r=new Set;for(t of e)m(t)||r.has(t.next.prevOnCircle)||n(t),r.add(t)}function y(t){const n=[],e=t;let r=e;for(;r!==e.prevOnCircle;)m(r)||n.push(r.next),r=r.nextOnCircle;return n}function O(t,n){n(t);const e=g(t).filter(t=>!m(t)).map(t=>t.next);for(const t of e){const e=[t];for(;e.length;){const t=e.pop();n(t),e.push(...y(t))}}}const C=["prev","next","prevOnCircle","nextOnCircle","holeCloserTwin"];function N(t){const n=new Map,e=E(t);n.set(t,e);const r=[{cpNode:t,newCpNode:e}];for(;r.length;){const{cpNode:t,newCpNode:e}=r.pop();for(const o of C){const i=t[o];if(void 0===i)continue;let c=n.get(i);c||(c=E(i),n.set(i,c),r.push({cpNode:i,newCpNode:c})),e[o]=c}}return e}function E(t){return{...t,prev:void 0,next:void 0,prevOnCircle:void 0,nextOnCircle:void 0,holeCloserTwin:void 0}}function T(t){const n=t,e=t.next,r=n.pointOnShape,o=e.pointOnShape,i=r.curve,c=o.curve;if(i.loop!==c.loop)return[];const s=[];return c===i?s.push({ps:r.curve.ps,ts:[r.t,o.t]}):(s.push({ps:r.curve.ps,ts:[r.t,1]}),function(t,n,e,r){let o=n;do{o=o.next;const n=o===e?r:1;t.push({ps:o.ps,ts:[0,n]})}while(o!==e)}(s,r.curve,o.curve,o.t)),s}function P(t,n,e){if(4===t.length)return function(t,n,e){return 0===n?1===e?t:function(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=c-n*(c-u),h=u-n*(u-l),d=p-n*(p-h),v=s-n*(s-f),g=f-n*(f-a),m=v-n*(v-g);return[e,[p,v],[d,m],[d-n*(d-(h-n*(h-(l-n*(l-i[0]))))),m-n*(m-(g-n*(g-(a-n*(a-i[1])))))]]}(t,e):1===e?function(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=c-n*(c-u),h=u-n*(u-l),d=l-n*(l-i[0]),v=p-n*(p-h),g=h-n*(h-d),m=s-n*(s-f),x=f-n*(f-a),b=a-n*(a-i[1]),w=m-n*(m-x),_=x-n*(x-b);return[[v-n*(v-g),w-n*(w-_)],[g,_],[d,b],i]}(t,n):function(t,n,e){const r=t[0],o=t[1],i=t[2],c=t[3],s=r[0],u=r[1],f=o[0],l=o[1],a=i[0],p=i[1],h=n*n,d=n*h,v=e*e,g=e*v,m=n*e,x=s-f,b=a-f,w=x+b,_=n*x,M=e*x,I=c[0]-s-3*b,S=u-l,y=p-l,O=S+y,C=n*S,N=e*S,E=c[1]-u-3*y;return[[d*I+(3*n*(n*w-x)+s),d*E+(3*n*(n*O-S)+u)],[m*(n*I+2*w)+(h*w+s-(M+2*_)),m*(n*E+2*O)+(h*O+u-(N+2*C))],[m*(e*I+2*w)+(v*w+s-(2*M+_)),m*(e*E+2*O)+(v*O+u-(2*N+C))],[g*I+(3*e*(e*w-x)+s),g*E+(3*e*(e*O-S)+u)]]}(t,n,e)}(t,n,e);if(3===t.length)return function(t,n,e){return 0===n?1===e?t:function(t,n){const e=t[0],r=t[1],o=t[2],i=e[0],c=e[1],s=r[0],u=r[1],f=n*n,l=i-s,a=c-u;return[e,[-n*l+i,-n*a+c],[f*(l+(o[0]-s))-(2*n*l-i),f*(a+(o[1]-u))-(2*n*a-c)]]}(t,e):1===e?function(t,n){const e=t[0],r=t[1],o=t[2],i=e[0],c=e[1],s=r[0],u=r[1],f=n*n,l=i-s,a=o[0]-s,p=c-u,h=o[1]-u;return[[f*(l+a)-(2*n*l-i),f*(p+h)-(2*n*p-c)],[n*a+s,n*h+u],o]}(t,n):function(t,n,e){const r=t[0],o=t[1],i=t[2],c=r[0],s=r[1],u=o[0],f=o[1],l=n*n,a=e*e,p=n*e,h=c-u,d=h+(i[0]-u),v=s-f,g=v+(i[1]-f);return[[l*d-(2*n*h-c),l*g-(2*n*v-s)],[p*d-(h*(e+n)-c),p*g-(v*(e+n)-s)],[a*d-(2*e*h-c),a*g-(2*e*v-s)]]}(t,n,e)}(t,n,e);if(2===t.length)return function(t,n,e){return 0===n?1===e?t:function(t,n){const e=t[0],r=t[1],o=e[0],i=e[1];return[e,[n*(r[0]-o)+o,n*(r[1]-i)+i]]}(t,e):1===e?function(t,n){const e=t[0],r=t[1],o=e[0],i=e[1];return[[n*(r[0]-o)+o,n*(r[1]-i)+i],r]}(t,n):function(t,n,e){const r=t[0],o=t[1],i=r[0],c=r[1],s=o[0],u=o[1];return[[n*(s-i)+i,n*(u-c)+c],[e*(s-i)+i,e*(u-c)+c]]}(t,n,e)}(t,n,e);if(1===t.length)return t;throw new Error("The given bezier curve must be of order <= 3.")}function k(t){return T(t).map(t=>P(t.ps,t.ts[0],t.ts[1]))}function A(t,n){const{cpTrees:e}=n,r=t.prev,o=t.next;r.next=o,o.prev=r,e.get(t.pointOnShape.curve.loop).remove(t,!1)}function B(t,n){const e=v(t);if(2!==e)throw new Error(`Cannot delete \`CpNode\` on ${e}-prong`);g(t).forEach(t=>A(t,n))}function z(t){const n=[],e=t.next;let r=e;do{n.push(r),r=r.nextOnCircle}while(r.nextOnCircle!==e);return n}function F(t,n,e){if(void 0===t.size||void 0===e)return;const r=e[n];if(t.size>r&&void 0!==r)for(const[n]of t){t.delete(n);break}}const Y=[function(t,n){let e,r=!1;return function(){return r||(e=t(),r=!0),e}},function(t,n,e=!1){const r=new WeakMap,o=new Map;function i(t){return"object"!=typeof t&&"function"!=typeof t||null===t?o:r}const c=function(r){let c;const s=i(r);return s.has(r)?(e&&console.log("cache hit"),c=s.get(r)):(e&&console.log("cache miss"),c=t(r),s.set(r,c),F(o,0,n)),c};return c.mapS=o,c.weakMapS=r,c.clearCache=function(){o.clear()},c.addToCache=function(t,e){const r=i(e);r.set(e,t),F(r,1,n)},c},function(t,n){const e=new WeakMap,r=new Map;function o(t,o){const i=("object"==typeof o||"function"==typeof o)&&null!==o;let c="object"!=typeof t&&"function"!=typeof t||null===t?r:e,s=c.get(t);return void 0===s&&(s={weakMap:new WeakMap,map:new Map},c.set(t,s),F(c,0,n)),i?s.weakMap:s.map}function i(e,r){const i=o(e,r);let c;return i.has(r)?c=i.get(r):(c=t(e,r),i.set(r,c),F(i,1,n)),c}return i.mapS=r,i.weakMapS=e,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,r){const i=o(e,r);i.set(r,t),F(i,1,n)},i},function(t,n){const e=new WeakMap,r=new Map;function o(t,o,i){const c=("object"==typeof o||"function"==typeof o)&&null!==o,s=("object"==typeof i||"function"==typeof i)&&null!==i;let u="object"!=typeof t&&"function"!=typeof t||null===t?r:e,f=u.get(t);void 0===f&&(f={weakMap:new WeakMap,map:new Map},u.set(t,f),F(u,0,n));const l=c?f.weakMap:f.map;let a=l.get(o);return void 0===a&&(a={weakMap:new WeakMap,map:new Map},l.set(o,a),F(l,1,n)),s?a.weakMap:a.map}const i=function(e,r,i){const c=o(e,r,i);let s;return c.has(i)?s=c.get(i):(s=t(e,r,i),c.set(i,s),F(c,2,n)),s};return i.mapS=r,i.weakMapS=e,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,r,i){const c=o(e,r,i);c.set(i,t),F(c,2,n)},i},function(t,n,e=!1){const r=new WeakMap,o=new Map;function i(t,e,i,c){const s=("object"==typeof e||"function"==typeof e)&&null!==e,u=("object"==typeof i||"function"==typeof i)&&null!==i,f=("object"==typeof c||"function"==typeof c)&&null!==c;let l="object"!=typeof t&&"function"!=typeof t||null===t?o:r,a=l.get(t);void 0===a&&(a={weakMap:new WeakMap,map:new Map},l.set(t,a),F(l,0,n));const p=s?a.weakMap:a.map;let h=p.get(e);void 0===h&&(h={weakMap:new WeakMap,map:new Map},p.set(e,h),F(p,1,n));const d=u?h.weakMap:h.map;let v=d.get(i);return void 0===v&&(v={weakMap:new WeakMap,map:new Map},d.set(i,v),F(d,2,n)),f?v.weakMap:v.map}const c=function(r,o,c,s){const u=i(r,o,c,s);let f;return u.has(s)?(e&&console.log("cache hit"),f=u.get(s)):(e&&console.log("cache miss"),f=t(r,o,c,s),u.set(s,f),F(u,3,n)),f};return c.mapS=o,c.weakMapS=r,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,r,o,c){const s=i(e,r,o,c);s.set(c,t),F(s,3,n)},c},function(t,n){const e=new WeakMap,r=new Map;function o(t,o,i,c,s){const u=("object"==typeof o||"function"==typeof o)&&null!==o,f=("object"==typeof i||"function"==typeof i)&&null!==i,l=("object"==typeof c||"function"==typeof c)&&null!==c,a=("object"==typeof s||"function"==typeof s)&&null!==s;let p="object"!=typeof t&&"function"!=typeof t||null===t?r:e,h=p.get(t);void 0===h&&(h={weakMap:new WeakMap,map:new Map},p.set(t,h),F(p,0,n));const d=u?h.weakMap:h.map;let v=d.get(o);void 0===v&&(v={weakMap:new WeakMap,map:new Map},d.set(o,v),F(d,1,n));const g=f?v.weakMap:v.map;let m=g.get(i);void 0===m&&(m={weakMap:new WeakMap,map:new Map},g.set(i,m),F(g,2,n));const x=l?m.weakMap:m.map;let b=x.get(c);return void 0===b&&(b={weakMap:new WeakMap,map:new Map},x.set(c,b),F(x,3,n)),a?b.weakMap:b.map}const i=function(e,r,i,c,s){const u=o(e,r,i,c,s);let f;return u.has(s)?f=u.get(s):(f=t(e,r,i,c,s),u.set(s,f),F(u,4,n)),f};return i.mapS=r,i.weakMapS=e,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,r,i,c,s){const u=o(e,r,i,c,s);u.set(s,t),F(u,4,n)},i},function(t,n){const e=new WeakMap,r=new Map;function o(t,o,i,c,s,u){const f=("object"==typeof o||"function"==typeof o)&&null!==o,l=("object"==typeof i||"function"==typeof i)&&null!==i,a=("object"==typeof c||"function"==typeof c)&&null!==c,p=("object"==typeof s||"function"==typeof s)&&null!==s,h=("object"==typeof u||"function"==typeof u)&&null!==u;let d="object"!=typeof t&&"function"!=typeof t||null===t?r:e,v=d.get(t);void 0===v&&(v={weakMap:new WeakMap,map:new Map},d.set(t,v),F(d,0,n));const g=f?v.weakMap:v.map;let m=g.get(o);void 0===m&&(m={weakMap:new WeakMap,map:new Map},g.set(o,m),F(g,1,n));const x=l?m.weakMap:m.map;let b=x.get(i);void 0===b&&(b={weakMap:new WeakMap,map:new Map},x.set(i,b),F(x,2,n));const w=a?b.weakMap:b.map;let _=w.get(c);void 0===_&&(_={weakMap:new WeakMap,map:new Map},w.set(c,_),F(w,3,n));const M=p?_.weakMap:_.map;let I=M.get(s);return void 0===I&&(I={weakMap:new WeakMap,map:new Map},M.set(s,I),F(M,4,n)),h?I.weakMap:I.map}const i=function(e,r,i,c,s,u){const f=o(e,r,i,c,s,u);let l;return f.has(u)?l=f.get(u):(l=t(e,r,i,c,s,u),f.set(u,l),F(f,5,n)),l};return i.mapS=r,i.weakMapS=e,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,r,i,c,s,u){const f=o(e,r,i,c,s,u);f.set(u,t),F(f,5,n)},i},function(t,n){const e=new WeakMap,r=new Map;function o(t,o,i,c,s,u,f){const l=("object"==typeof o||"function"==typeof o)&&null!==o,a=("object"==typeof i||"function"==typeof i)&&null!==i,p=("object"==typeof c||"function"==typeof c)&&null!==c,h=("object"==typeof s||"function"==typeof s)&&null!==s,d=("object"==typeof u||"function"==typeof u)&&null!==u,v=("object"==typeof f||"function"==typeof f)&&null!==f;let g="object"!=typeof t&&"function"!=typeof t||null===t?r:e,m=g.get(t);void 0===m&&(m={weakMap:new WeakMap,map:new Map},g.set(t,m),F(g,0,n));const x=l?m.weakMap:m.map;let b=x.get(o);void 0===b&&(b={weakMap:new WeakMap,map:new Map},x.set(o,b),F(x,1,n));const w=a?b.weakMap:b.map;let _=w.get(i);void 0===_&&(_={weakMap:new WeakMap,map:new Map},w.set(i,_),F(w,2,n));const M=p?_.weakMap:_.map;let I=M.get(c);void 0===I&&(I={weakMap:new WeakMap,map:new Map},M.set(c,I),F(M,3,n));const S=h?I.weakMap:I.map;let y=S.get(s);void 0===y&&(y={weakMap:new WeakMap,map:new Map},S.set(s,y),F(S,4,n));const O=d?y.weakMap:y.map;let C=O.get(u);return void 0===C&&(C={weakMap:new WeakMap,map:new Map},O.set(u,C),F(O,5,n)),v?C.weakMap:C.map}const i=function(e,r,i,c,s,u,f){const l=o(e,r,i,c,s,u,f);let a;return l.has(f)?a=l.get(f):(a=t(e,r,i,c,s,u,f),l.set(f,a),F(l,6,n)),a};return i.mapS=r,i.weakMapS=e,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,r,i,c,s,u,f){const l=o(e,r,i,c,s,u,f);l.set(f,t),F(l,6,n)},i},function(t,n){const e=new WeakMap,r=new Map;function o(t,o,i,c,s,u,f,l){const a=("object"==typeof o||"function"==typeof o)&&null!==o,p=("object"==typeof i||"function"==typeof i)&&null!==i,h=("object"==typeof c||"function"==typeof c)&&null!==c,d=("object"==typeof s||"function"==typeof s)&&null!==s,v=("object"==typeof u||"function"==typeof u)&&null!==u,g=("object"==typeof f||"function"==typeof f)&&null!==f,m=("object"==typeof l||"function"==typeof l)&&null!==l;let x="object"!=typeof t&&"function"!=typeof t||null===t?r:e,b=x.get(t);void 0===b&&(b={weakMap:new WeakMap,map:new Map},x.set(t,b),F(x,0,n));const w=a?b.weakMap:b.map;let _=w.get(o);void 0===_&&(_={weakMap:new WeakMap,map:new Map},w.set(o,_),F(w,1,n));const M=p?_.weakMap:_.map;let I=M.get(i);void 0===I&&(I={weakMap:new WeakMap,map:new Map},M.set(i,I),F(M,2,n));const S=h?I.weakMap:I.map;let y=S.get(c);void 0===y&&(y={weakMap:new WeakMap,map:new Map},S.set(c,y),F(S,3,n));const O=d?y.weakMap:y.map;let C=O.get(s);void 0===C&&(C={weakMap:new WeakMap,map:new Map},O.set(s,C),F(O,4,n));const N=v?C.weakMap:C.map;let E=N.get(u);void 0===E&&(E={weakMap:new WeakMap,map:new Map},N.set(u,E),F(N,5,n));const T=g?E.weakMap:E.map;let P=T.get(f);return void 0===P&&(P={weakMap:new WeakMap,map:new Map},T.set(f,P),F(T,6,n)),m?P.weakMap:P.map}const i=function(e,r,i,c,s,u,f,l){const a=o(e,r,i,c,s,u,f,l);let p;return a.has(l)?p=a.get(l):(p=t(e,r,i,c,s,u,f,l),a.set(l,p),F(a,7,n)),p};return i.mapS=r,i.weakMapS=e,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,r,i,c,s,u,f,l){const a=o(e,r,i,c,s,u,f,l);a.set(l,t),F(a,7,n)},i}];function D(t,n,e=!1){const r=t.length;if(r>8)throw new Error("A maximum of 8 formal parameters are supported");return(0,Y[r])(t,n,e)}function L(t,n){const[[e,r],[o,i]]=t,[[c,s],[u,f]]=n,l=o-e,a=i-r,p=u-c,h=f-s,d=p*a-h*l;if(0===d)return;const v=((s-r)*l-(c-e)*a)/d;return[c+v*p,s+v*h]}function X(t,n){return[n[0]-t[0],n[1]-t[1]]}function q(t,n){return t[0]*n[0]+t[1]*n[1]}function W(t){return[-t[1],t[0]]}function j(t,n){return t[0]*n[1]-t[1]*n[0]}function H(t,n,e){return[t[0]+(n[0]-t[0])*e,t[1]+(n[1]-t[1])*e]}function V(t,n){function e(n){return[t[0]+n[0],t[1]+n[1]]}return void 0===n?e:e(n)}function Q(t){const n=1/Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]*n,t[1]*n]}function R(t,n,e){function r(e){return[e[0]*n-e[1]*t,e[0]*t+e[1]*n]}return void 0===e?r:r(e)}function G(t,n){let e=0;for(let r=0;r<t.length;r++)e=e*n+t[r];return e}function U(t){if(4===t.length)return function(t){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[3*(s-n+3*(r-i)),6*(i+n-2*r),3*(r-n)],[3*(u-e+3*(o-c)),6*(c+e-2*o),3*(o-e)]]}(t);if(3===t.length)return function(t){const[[n,e],[r,o],[i,c]]=t;return[[2*(i+n-2*r),2*(r-n)],[2*(c+e-2*o),2*(o-e)]]}(t);if(2===t.length)return function(t){const[[n,e],[r,o]]=t;return[[r-n],[o-e]]}(t);if(1===t.length)return[[0],[0]];throw new Error("The bezier curve must be of order <= 3.")}function $(t,n){const[e,r]=U(t);return[G(e,n),G(r,n)]}function Z(t,n){const e=t-n,r=t-e;return[t-(e+r)+(r-n),e]}function J(t,n){const e=t.length,r=n.length;let o=0,i=0;const c=[];for(;o<e&&i<r;)0!==t[o]?0!==n[i]?Math.abs(t[o])<=Math.abs(n[i])?(c.push(t[o]),o++):(c.push(n[i]),i++):i++:o++;for(;o<e;)c.push(t[o]),o++;for(;i<r;)c.push(n[i]),i++;if(0===c.length)return[0];const s=c.length;if(1===s)return c;const u=[],f=c[1],l=c[0];let a=f+l;const p=l-(a-f);0!==p&&u.push(p),i=0;for(let t=2;t<s;t++){const n=c[t],e=a+n,r=e-a,o=a-(e-r)+(n-r);0!==o&&u.push(o),a=e}return 0===a&&0!==u.length||u.push(a),u}const K=134217729;function tt(t,n){const e=t.length;let r;const o=t[0];let i=o*n;const c=K*o,s=c-(c-o),u=o-s,f=K*n,l=f-(f-n),a=n-l,p=[],h=u*a-(i-s*l-u*l-s*a);0!==h&&p.push(h);for(let o=1;o<e;o++){const e=t[o],c=e*n,s=K*e,u=s-(s-e),f=e-u,l=K*n,a=l-(l-n),h=n-a,d=f*h-(c-u*a-f*a-u*h),v=i+d,g=v-i,m=i-(v-g)+(d-g);0!==m&&p.push(m),r=v;const x=c+r,b=r-(x-c);0!==b&&p.push(b),i=x}return 0===i&&0!==p.length||p.push(i),p}function nt(t,n){const e=n.length;let r;const o=n[0];let i=o*t;const c=K*o,s=c-(c-o),u=o-s,f=K*t,l=f-(f-t),a=t-l,p=[],h=u*a-(i-s*l-u*l-s*a);0!==h&&p.push(h);for(let o=1;o<e;o++){const e=n[o],c=e*t,s=K*e,u=s-(s-e),f=e-u,l=K*t,a=l-(l-t),h=t-a,d=f*h-(c-u*a-f*a-u*h),v=i+d,g=v-i,m=i-(v-g)+(d-g);0!==m&&p.push(m),r=v;const x=c+r,b=r-(x-c);0!==b&&p.push(b),i=x}return 0===i&&0!==p.length||p.push(i),p}function et(t,n){let e=[0];for(let r=0;r<t.length;r++)e=J(e,tt(n,t[r]));return e}function rt(t){let n=t[0];for(let e=1;e<t.length;e++)n+=t[e];return n}function ot(t){const n=t.length,e=new Array(n);for(let r=0;r<n;r++)e[r]=-t[r];return e}function it(t,n){return J(t,ot(n))}function ct(t){return t[t.length-1]}const st=Z,ut=nt;function ft(t){if(4===t.length){const[[n,e],[r,o]]=t;return[ut(3,st(r,n)),ut(3,st(o,e))]}if(3===t.length){const[[n,e],[r,o]]=t;return[st(2*r,2*n),st(2*o,2*e)]}if(2===t.length){const[[n,e],[r,o]]=t;return[st(r,n),st(o,e)]}if(1===t.length)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3.")}function lt(t,n){const e=t+n,r=e-t;return[t-(e-r)+(n-r),e]}function at(t,n){const e=t.length;let r=n;const o=[];for(let n=0;n<e;n++){const e=t[n],i=r+e,c=i-r,s=r-(i-c)+(e-c);0!==s&&o.push(s),r=i}return 0===r&&0!==o.length||o.push(r),o}const pt=lt,ht=nt,dt=at;function vt(t){if(4===t.length){const[[n,e],[r,o],[i,c]]=t;return[ht(6,dt(pt(i,n),-2*r)),ht(6,dt(pt(c,e),-2*o))]}if(3===t.length){const[[n,e],[r,o],[i,c]]=t;return[dt(pt(2*i,2*n),-4*r),dt(pt(2*c,2*e),-4*o)]}if(t.length<=2)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3")}const gt=Z,mt=nt,xt=J;function bt(t){if(4===t.length){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[mt(6,xt(gt(s,n),mt(3,gt(r,i))))],[mt(6,xt(gt(u,e),mt(3,gt(o,c))))]]}if(t.length<=3)return[[[0]],[[0]]];throw new Error("The given bezier curve must be of order <= 3.")}const{sign:wt}=Math;function _t(t,n){const[e,r]=ft(t),[o,i]=vt(t),[c,s]=ft(n),[u,f]=vt(n),l=it(et(e,i),et(r,o)),a=it(et(c,f),et(s,u)),p=ct(l),h=ct(a);if(wt(p)!==wt(h))return p-h;const d=J(et(c,c),et(s,s)),v=J(et(e,e),et(r,r)),g=et(d,d),m=et(g,d),x=et(v,v),b=et(x,v);if(0!==p||0!==h){const t=et(l,l),n=et(a,a),e=ct(it(et(t,m),et(n,b)));if(0!==e)return p>0?e:-e}const[[w],[_]]=bt(t),[[M],[I]]=bt(n),S=it(et(e,_),et(r,w)),y=J(et(e,o),et(r,i)),O=it(et(c,I),et(s,M)),C=J(et(c,u),et(s,f)),N=it(et(v,S),tt(et(l,y),3)),E=it(et(d,O),tt(et(a,C),3)),T=ct(N),P=ct(E);if(T!==P)return T-P;if(0===T&&0===P)return 0;const k=et(N,N),A=et(g,m),B=et(E,E),z=et(x,b),F=ct(it(et(k,A),et(B,z)));return T>0?F:-F}function Mt(t,n){return t[0]===n[0]&&t[1]===n[1]}function It(t,n){const{ccw:e,tangentI:r,tangentO:o,dotTangents:i}=function(t,n){const e=t.length;let r=t[e-2],o=n[0],i=n[1];Mt(r,o)&&(r=t[e-3]),Mt(o,i)&&(i=n[2]);const c=function(t,n,e){const r=Z(t[0],e[0]),o=Z(n[1],e[1]),i=Z(t[1],e[1]),c=Z(n[0],e[0]);return rt(J(et(r,o),ot(et(i,c))))}(r,o,i),s=[Z(o[0],r[0]),Z(o[1],r[1])],u=[Z(i[0],o[0]),Z(i[1],o[1])],f=function(t,n){return rt(J(et(t[0],n[0]),et(t[1],n[1])))}(s,u);return 0!==c||f>0?{ccw:c,tangentI:s,tangentO:u,dotTangents:f}:{ccw:_t(t.slice().reverse(),n),tangentI:s,tangentO:u,dotTangents:f}}(t,n),c=e<0,s=e>0,u=[Q(r.map(t=>t[1])),Q(o.map(t=>t[1]))],f=j(u[0],u[1]);let l,a;return i>0?(l=f<-.0698,a=f>.0698):(l=c,a=s),{tangents:u,isSharp:c,isDull:s,isQuiteSharp:l,isQuiteDull:a}}const St=D(function(t){const{t:n,curve:e}=t;return It(1===n?e.ps:e.prev.ps,1===n?e.next.ps:e.ps)});function yt(t){return 0===t.t||1===t.t}function Ot(t){return!!yt(t)&&St(t).isSharp}function Ct(t){const n=t.pointOnShape.circle.center,e=t,r=t.nextOnCircle,o=e.pointOnShape,i=r.pointOnShape,c=o.p,s=i.p;let u;if(Ot(o)){let t,n;0===o.t?(t=o.curve,n=o.curve.prev):1===o.t&&(t=o.curve.next,n=o.curve);const e=Q($(t.ps,0)),r=[-(f=Q($(n.ps,1)))[0],-f[1]],i=q(e,r),c=Math.sqrt((1+i)/2);u=R(Math.sqrt((1-i)/2),c,r)}else u=c[0]===s[0]&&c[1]===s[1]?X(c,n):W(X(c,s));var f;return[n,V(Q(u),n)]}const{abs:Nt}=Math,Et=1e-4;function Tt(t,n){const e=t.pointOnShape.circle.center,r=Ct(t),o=n.pointOnShape.circle.center,i=Ct(n.prevOnCircle),c=L(r,i),s=X(e,o);let u;if(c){const t=X(e,c),n=X(o,c);u=q(t,s)<0||q(n,s)>0}else u=!0;if(!u)return[e,c,o];const f=W(s),l=X(r[0],r[1]),a=X(i[0],i[1]),p=Nt(j(s,l))/9,h=Nt(j(s,a))/9;if(p>.01||h>.01)return[e,o];if(p>Et||h>Et){const t=H(e,o,1/3),n=H(e,o,2/3),c=V(f,t),s=[n,V(f,n)];return[e,L(r,[t,c]),L(i,s),o]}return[e,o]}function Pt(t){return Tt(t,t.next)}function kt(t){const n=t;let e=n;for(;e.next===e.prevOnCircle;)if(e=e.next,e===n)return;return e}function At(t,n){return g(t).indexOf(n)>=0}function Bt(t){return 1===x(t)&&!t.isHoleClosing}function zt(t){return 2===x(t)}function Ft(t){if(b(t))return[];for(;m(t);)t=t.nextOnCircle;for(t=t.next;2===x(t);)t=t.next;t=t.prevOnCircle;const n=[];do{n.push(t),t=t.next}while(!w(t)&&2===x(t));return n}function Yt(t){return Ft(t).map(t=>Pt(t))}function Dt(t,n){const e=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(e*e+r*r)}function Lt(t,n){const[e,r]=t,[[o,i],[c,s]]=n;return Dt([o+e*(c-o),i+e*(s-i)],[o+r*(c-o),i+r*(s-i)])}function Xt(t,n,e=16){if(n[0]===n[1])return 0;const{weights:r,abscissas:o}=qt[e],[i,c]=n;let s=0;const u=(c-i)/2,f=(c+i)/2;for(let n=0;n<=e-1;n++)s+=r[n]*t(u*o[n]+f);return u*s}D(Pt);const qt={2:{weights:[1,1],abscissas:[-.5773502691896257,.5773502691896257]},4:{weights:[.6521451548625461,.6521451548625461,.3478548451374538,.3478548451374538],abscissas:[-.3399810435848563,.3399810435848563,-.8611363115940526,.8611363115940526]},8:{weights:[.362683783378362,.362683783378362,.3137066458778873,.3137066458778873,.2223810344533745,.2223810344533745,.1012285362903763,.1012285362903763],abscissas:[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363]},16:{weights:[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685,.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],abscissas:[-.9894009349916499,-.9445750230732326,-.8656312023878318,-.755404408355003,-.6178762444026438,-.45801677765722737,-.2816035507792589,-.09501250983763744,.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]},64:{weights:[.048690957009139724,.048690957009139724,.04857546744150343,.04857546744150343,.048344762234802954,.048344762234802954,.04799938859645831,.04799938859645831,.04754016571483031,.04754016571483031,.04696818281621002,.04696818281621002,.046284796581314416,.046284796581314416,.04549162792741814,.04549162792741814,.044590558163756566,.044590558163756566,.04358372452932345,.04358372452932345,.04247351512365359,.04247351512365359,.04126256324262353,.04126256324262353,.03995374113272034,.03995374113272034,.038550153178615626,.038550153178615626,.03705512854024005,.03705512854024005,.035472213256882386,.035472213256882386,.033805161837141606,.033805161837141606,.03205792835485155,.03205792835485155,.030234657072402478,.030234657072402478,.028339672614259483,.028339672614259483,.02637746971505466,.02637746971505466,.024352702568710874,.024352702568710874,.022270173808383253,.022270173808383253,.02013482315353021,.02013482315353021,.017951715775697343,.017951715775697343,.015726030476024718,.015726030476024718,.013463047896718643,.013463047896718643,.011168139460131128,.011168139460131128,.008846759826363947,.008846759826363947,.006504457968978363,.006504457968978363,.004147033260562468,.004147033260562468,.001783280721696433,.001783280721696433],abscissas:[-.024350292663424433,.024350292663424433,-.07299312178779904,.07299312178779904,-.12146281929612056,.12146281929612056,-.16964442042399283,.16964442042399283,-.21742364374000708,.21742364374000708,-.2646871622087674,.2646871622087674,-.31132287199021097,.31132287199021097,-.3572201583376681,.3572201583376681,-.4022701579639916,.4022701579639916,-.4463660172534641,.4463660172534641,-.48940314570705296,.48940314570705296,-.5312794640198946,.5312794640198946,-.571895646202634,.571895646202634,-.6111553551723933,.6111553551723933,-.6489654712546573,.6489654712546573,-.6852363130542333,.6852363130542333,-.7198818501716109,.7198818501716109,-.7528199072605319,.7528199072605319,-.7839723589433414,.7839723589433414,-.8132653151227975,.8132653151227975,-.8406292962525803,.8406292962525803,-.8659993981540928,.8659993981540928,-.8893154459951141,.8893154459951141,-.9105221370785028,.9105221370785028,-.9295691721319396,.9295691721319396,-.9464113748584028,.9464113748584028,-.9610087996520538,.9610087996520538,-.973326827789911,.973326827789911,-.983336253884626,.983336253884626,-.9910133714767443,.9910133714767443,-.9963401167719553,.9963401167719553,-.9993050417357722,.9993050417357722]}},{sqrt:Wt}=Math;function jt(t){const[n,e]=U(t);return function(t){const r=G(n,t),o=G(e,t);return Wt(r*r+o*o)}}const{abs:Ht}=Math,Vt=[[0,0],[0,0],[0,0]];function Qt(t,n,e){return 0===n?1===e?{ps:t,_ps:Vt}:function(t,n){const e=t[0],r=t[1],o=t[2],i=e[0],c=e[1],s=r[0],u=r[1],f=o[0],l=o[1],a=n*n,p=i-s,h=c-u,d=[[i,c],[-n*p+i,-n*h+c],[a*(p+(f-s))-(2*n*p-i),a*(h+(l-u))-(2*n*h-c)]],v=Ht(n),g=Ht(i),m=Ht(s),x=Ht(f),b=g+m,w=Ht(c),_=Ht(u),M=w+_;return{ps:d,_ps:[[0,0],[v*b+g,v*M+w],[a*(b+(x+m))+(2*v*b+g),a*(M+(Ht(l)+_))+(2*v*M+w)]]}}(t,e):1===e?function(t,n){const e=t[0],r=t[1],o=t[2],i=e[0],c=e[1],s=r[0],u=r[1],f=o[0],l=o[1],a=n*n,p=i-s,h=f-s,d=c-u,v=l-u,g=[[a*(p+h)-(2*n*p-i),a*(d+v)-(2*n*d-c)],[n*h+s,n*v+u],[f,l]],m=Ht(n),x=Ht(i),b=Ht(s),w=x+b,_=Ht(f)+b,M=Ht(c),I=Ht(u),S=M+I;return{ps:g,_ps:[[a*(w+_)+(2*m*w+x),a*(S+(Ht(l)+I))+(2*m*S+M)],[m*_+b,0],[0,0]]}}(t,n):function(t,n,e){const r=t[0],o=t[1],i=t[2],c=r[0],s=r[1],u=o[0],f=o[1],l=i[0],a=i[1],p=n*n,h=e*e,d=n*e,v=c-u,g=v+(l-u),m=s-f,x=m+(a-f),b=p*g-(2*n*v-c),w=d*g-(v*(e+n)-c),_=h*g-(2*e*v-c),M=p*x-(2*n*m-s),I=d*x-(m*(e+n)-s),S=h*x-(2*e*m-s),y=Ht(n),O=Ht(e),C=Ht(d),N=Ht(c),E=Ht(u),T=N+E,P=T+Ht(l)+E,k=Ht(s),A=Ht(f),B=k+A,z=B+Ht(a)+A;return{ps:[[b,M],[w,I],[_,S]],_ps:[[p*P+(2*y*T+N),p*z+(2*y*B+k)],[C*P+(T*(O+y)+N),C*x+(B*(O+y)+k)],[h*P+(2*O*T+N),h*z+(2*O*B+k)]]}}(t,n,e)}const Rt=134217729;function Gt(t,n){const e=t*n,r=Rt*t,o=r-(r-t),i=t-o,c=Rt*n,s=c-(c-n),u=n-s;return[i*u-(e-o*s-i*s-o*u),e]}function Ut(t,n){const e=t[0],r=t[1],o=n[0],i=n[1],c=r+i,s=c-r,u=e+o,f=u-e,l=r-(c-s)+(i-s)+u,a=c+l,p=e-(u-f)+(o-f)+(l-(a-c)),h=a+p;return[p-(h-a),h]}function $t(t,n){const e=t[0],r=t[1],o=n[0],i=n[1],c=r-i,s=c-r,u=e-o,f=u-e,l=r-(c-s)+(-i-s)+u,a=c+l,p=e-(u-f)+(-o-f)+(l-(a-c)),h=a+p;return[p-(h-a),h]}const{atan2:Zt}=Math,Jt=Gt;function Kt(t,n){const e=t[0],r=t[1],o=n[0],i=n[1],c=$t(Jt(i,e),Jt(o,r))[1],s=Ut(Jt(o,e),Jt(i,r))[1];return Zt(c,s)}const{abs:tn}=Math;function nn(t){const n=[];for(let e=0;e<t.length-1;e++){const r=[t[e+1][0]-t[e][0],t[e+1][1]-t[e][1]];0!==(0!==r[0]||r[1])&&n.push(r)}const e=n.length;let r=0;for(let t=0;t<e-1;t++)r+=tn(Kt(n[t],n[t+1]));return r}function en(t,n=.4,e=2**-16){const r=[0],o=[1];for(;;){const i=r[r.length-1],c=o[o.length-1];if(nn(P(t,i,c))<=n||c-i<=e){if(r.push(o.pop()),1===c)return r;continue}const s=(i+c)/2;o.push(s)}}const{sqrt:rn,log:on}=Math;function cn(t,n,e=.4,r=16){const o=t[0],i=t[1];if(o===i)return 0;const[[c,s],[u,f],[l,a]]=n;if(c===u&&u===l&&s===f&&f===a)return 0;const p=Qt(n,o,i).ps,h=en(p,e);let d=0;for(let t=0;t<h.length-1;t++){const n=h[t],e=h[t+1];d+=Xt(jt(p),[n,e],r)}return d}const{abs:sn}=Math,un=[[0,0],[0,0],[0,0],[0,0]];function fn(t,n,e){return 0===n?1===e?{ps:t,_ps:un}:function(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=i[0],h=i[1],d=c-n*(c-u),v=u-n*(u-l),g=d-n*(d-v),m=g-n*(g-(v-n*(v-(l-n*(l-p))))),x=s-n*(s-f),b=f-n*(f-a),w=x-n*(x-b),_=w-n*(w-(b-n*(b-(a-n*(a-h))))),M=sn(n),I=sn(c),S=sn(u),y=sn(l),O=sn(p),C=sn(s),N=sn(f),E=sn(a),T=I+M*(I+S),P=S+M*(S+y),k=T+M*(T+P),A=C+M*(C+N),B=N+M*(N+E),z=A+M*(A+B);return{ps:[[c,s],[d,x],[g,w],[m,_]],_ps:[[0,0],[T,A],[k,z],[k+M*(k+(P+M*(P+(y+M*(y+O))))),z+M*(z+(B+M*(B+(E+M*(E+sn(h))))))]]}}(t,e):1===e?function(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=i[0],h=i[1],d=c-n*(c-u),v=u-n*(u-l),g=l-n*(l-p),m=d-n*(d-v),x=v-n*(v-g),b=m-n*(m-x),w=s-n*(s-f),_=f-n*(f-a),M=a-n*(a-h),I=w-n*(w-_),S=_-n*(_-M),y=I-n*(I-S),O=sn(n),C=sn(c),N=sn(u),E=sn(l),T=sn(p),P=sn(s),k=sn(f),A=sn(a),B=C+O*(C+N),z=N+O*(N+E),F=E+O*(E+T),Y=B+O*(B+z),D=z+O*(z+F),L=P+O*(P+k),X=k+O*(k+A),q=A+O*(A+sn(h)),W=L+O*(L+X),j=X+O*(X+q);return{ps:[[b,y],[x,S],[g,M],[p,h]],_ps:[[Y+O*(Y+D),W+O*(W+j)],[D,j],[F,q],[0,0]]}}(t,n):function(t,n,e){const r=t[0],o=t[1],i=t[2],c=t[3],s=r[0],u=r[1],f=o[0],l=o[1],a=i[0],p=i[1],h=n*n,d=n*h,v=e*e,g=e*v,m=n*e,x=s-f,b=a-f,w=c[0]-s,_=x+b,M=n*x,I=e*x,S=w-3*b,y=u-l,O=p-l,C=c[1]-u,N=y+O,E=n*y,T=e*y,P=C-3*O,k=d*S+(3*n*(n*_-x)+s),A=m*(n*S+2*_)+(h*_+s-(I+2*M)),B=m*(e*S+2*_)+(v*_+s-(2*I+M)),z=g*S+(3*e*(e*_-x)+s),F=d*P+(3*n*(n*N-y)+u),Y=m*(n*P+2*N)+(h*N+u-(T+2*E)),D=m*(e*P+2*N)+(v*N+u-(2*T+E)),L=g*P+(3*e*(e*N-y)+u),X=sn(n),q=sn(e),W=sn(m),j=sn(d),H=sn(g),V=sn(s),Q=sn(f),R=V+Q,G=sn(a)+Q,U=R+G,$=X*R,Z=q*R,J=sn(w)+3*G,K=sn(u),tt=sn(l),nt=K+tt,et=sn(p)+tt,rt=nt+et,ot=X*nt,it=q*nt,ct=sn(C)+3*et;return{ps:[[k,F],[A,Y],[B,D],[z,L]],_ps:[[j*J+(3*X*(X*U+R)+V),j*ct+(3*X*(X*rt+nt)+K)],[W*(X*J+2*U)+(h*U+V+(Z+2*$)),W*(X*ct+2*rt)+(h*rt+K+(it+2*ot))],[W*(q*J+2*U)+(v*U+V+(2*Z+$)),W*(q*ct+2*rt)+(v*rt+K+(2*it+ot))],[H*J+(3*q*(q*U+R)+V),H*ct+(3*q*(q*rt+nt)+K)]]}}(t,n,e)}function ln(t,n,e=.4,r=16){const o=t[0],i=t[1];if(o===i)return 0;const[[c,s],[u,f],[l,a],[p,h]]=n;if(c===u&&u===l&&l===p&&s===f&&f===a&&a===h)return 0;const d=fn(n,o,i).ps,v=en(d,e);let g=0;for(let t=0;t<v.length-1;t++){const n=v[t],e=v[t+1];g+=Xt(jt(d),[n,e],r)}return g}function an(t,n=.4,e=16){if(4===t.length)return ln([0,1],t,n,e);if(3===t.length)return cn([0,1],t,n,e);if(2===t.length)return Lt([0,1],t);if(1===t.length)return 0;throw new Error("The given bezier curve must be of order <= 3.")}function pn(t,n,e=!0){const{cpNodes:r,hasHoleCloser:o}=function(t,n,e=!0){if(!e&&t===n)return{cpNodes:[],hasHoleCloser:!1};const r=t,o=[r];let i=t.next,c=r.isHoleClosing;for(;i!==n&&i!==r;)i.isHoleClosing&&(c=!0),o.push(i),i=i.next;return{cpNodes:o,hasHoleCloser:c}}(t,n,e);return{pss:r.flatMap(k),hasHoleCloser:o}}function hn(t){const n=t,e=t.nextOnCircle,r=Dt(n.pointOnShape.p,e.pointOnShape.p),{pss:o,hasHoleCloser:i}=pn(n,e),c=function(t){let n=0;for(let e of t)n+=e;return n}(o.map(t=>an(t)));return i?1/0:c/r}function dn(t,n){let e=t;const r=[];for(;e!==n;){const t=Tt(e,e.next);r.push(t),e=e.next}return r}function vn(t,n){const e=j(Q($(Pt(t),0)),Q($(Pt(n),0)));return Math.abs(Math.asin(e)*(180/Math.PI))}function gn(t){const n=[];return O(t,t=>{n.push(t)}),n}function mn(t,n){let e;return e=t.curve.idx-n.curve.idx,0!==e||(e=t.t-n.t,0!==e||(e=t.order-n.order,0!==e||(e=t.order2-n.order2))),e}function xn(t,n){return mn(t.pointOnShape,n.pointOnShape)}const bn={getChildren:z,getVertexForwardChildren:y,getAllOnLoop:p,getAllOnCircle:g,isOnSameCircle:At,isTerminating:m,isFullyTerminating:w,getFirstExit:kt,isSharp:_,isOneProng:Bt,getProngCount:v,getRealProngCount:x,cpNodeComparator:xn,enhanceCpNode:M,traverseCp:I,traverseEdges:S,traverseVertices:O,clone:N,getBoundaryBezierPartsToNext:T,getBoundaryBeziersToNext:k,removeVertex:B,getMatCurveToNext:Pt,isTwoProng:zt,getBranch:Ft,getBranchBeziers:Yt,getSalience:hn,getMatCurveBetween:Tt,getEdgeDirection:Ct,getBoundaryBeziersBetween:pn,getMatCurvesBetween:dn,getHoleClosers:h,getInitialDegAngleBetweenMatCurves:vn,getAllVertices:gn};function wn(t){return n=>g(n).some(t)}const _n=wn(function(t){return 2!==x(t)&&!t.isHoleClosing});function Mn(t){const n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=-t[e];return n}const{abs:In}=Math,{abs:Sn}=Math;function yn(t,n){if(t.length!==n.length)throw new Error("`p` and `p_` must be of equal length.");for(let e=0;e<t.length;e++){const r=Sn(n[e]);if(t[e]-r>=0)continue;let o=!1,i=!1;for(let r=0;r<e;r++){const e=Sn(n[r]),c=t[r]-e,s=t[r]+e;if(c>0){o=!0;break}s>0&&(i=!0)}if(!o&&i)return 1/0}return function(t){const n=t.length-1;if(n<1)return 0;t[0]<0&&(t=Mn(t));const e=[];for(let t=0;t<n;t++)e.push(1);let r=0;for(let o=0;o<=n;o++){if(t[o]>=0)continue;let n=1/0,i=!1;for(let r=0;r<o;r++){if(t[r]<=0)continue;const c=(-t[o]/(t[r]/2**e[r]))**(1/(o-r));e[r]++,n>c&&(n=c),i=!0}i&&r<n&&(r=n)}return r}(function(t,n){if(t.length!==n.length)throw new Error("`p` and `p_` must be of equal length.");const e=new Array(t.length);for(let r=0;r<t.length;r++){const o=In(n[r]),i=t[r]-o,c=t[r]+o;e[r]=i>0||c<0?i:0}return e}(t,n))}const On=(Cn=yn,(t,n)=>-Cn(function(t){const n=t.length-1;if(n<0)return[];const e=t.slice();for(let t=0;t<n+1;t++)t%2==(n-1)%2&&(e[t]=-e[t]);return e}(t),n));var Cn;const{min:Nn,max:En,abs:Tn}=Math,Pn=17976931348623157e292,kn=Number.EPSILON,An=kn/2,Bn=An*An,zn=Yn(1),Fn=function(){const t=3*Bn;return t/(1-t)}();function Yn(t){const n=t*An;return n/(1-n)}new Array(20).fill(0).map((t,n)=>Yn(n));const{abs:Dn}=Math;function Ln(t){const n=t.slice(),e=n.length;if(1===e)return n;let r=n[e-1],o=e;for(let t=e-2;t>=0;--t){const e=r,i=n[t];r=e+i;const c=i-(r-e);c&&(n[--o]=r,r=c)}let i=0;for(let t=o;t<e;++t){const e=n[t],o=r;r=e+o;const c=o-(r-e);c&&(n[i++]=c)}return n[i++]=r,n.length=i,n}const{abs:Xn}=Math,{abs:qn}=Math,Wn=134217729;function jn(t,n){const e=n[0],r=n[1],o=r*t,i=Wn*r,c=i-(i-r),s=r-c,u=Wn*t,f=u-(u-t),l=t-f,a=e*t,p=o+a,h=a-(p-o)+(s*l-(o-c*f-s*f-c*l)),d=p+h;return[h-(d-p),d]}function Hn(t,n){const e=n[0],r=n[1],o=r*t,i=Wn*r,c=i-(i-r),s=r-c,u=Wn*t,f=u-(u-t),l=t-f,a=s*l-(o-c*f-s*f-c*l)+e*t,p=o+a;return[a-(p-o),p]}const{abs:Vn}=Math;function Qn(t,n,e){const r=t.length-1;if(r<0)return[[],[]];const o=Vn(n),i=t.slice(),c=e.slice();for(let t=0;t<=r;t++)for(let e=1;e<=r-t;e++){const t=i[e-1],r=c[e-1],s=Hn(n,t),u=o*r+Vn(s[1]),f=i[e];i[e]=Ut(f,s),c[e]=c[e]+u+Vn(i[e][1])}return[i,c]}const Rn=2**27+1;function Gn(t,n){const e=t[1],r=n[1],o=e*r,i=Rn*e,c=i-(i-e),s=e-c,u=Rn*r,f=u-(u-r),l=r-f,a=s*l-(o-c*f-s*f-c*l)+(e*n[0]+t[0]*r),p=o+a;return[a-(p-o),p]}const{abs:Un}=Math;function $n(t,n){const e=t.length-1;if(e<0)return[];const r=t.slice();for(let t=0;t<=e;t++)for(let o=1;o<=e-t;o++)r[o]=Ln(J(r[o],tt(r[o-1],n)));return r}function Zn(t,n){const e=t.length-1;if(e<0)return[];const r=new Array(e+1);r[e]=t[e];let o=[1];for(let i=1;i<=e;i++)o=tt(o,n),r[e-i]=et(t[e-i],o);return r}const{abs:Jn,sign:Kn}=Math;const te=134217729;function ne(t,n){const e=t*n,r=te*t,o=r-(r-t),i=t-o,c=te*n,s=c-(c-n),u=n-s;return[i*u-(e-o*s-i*s-o*u),e]}const{abs:ee}=Math;function re(t,n){const e=ee(n);let r=t[0],o=.5*ee(r);for(let i=1;i<t.length;i++)r=r*n+t[i],o=o*e+ee(r);return o=An*(2*o-ee(r)),[r,o]}const oe=Math.abs,{abs:ie}=Math,ce=Yn(1),se=Yn(2);function ue(t,n,e=void 0,r=1){const o=t[0],[i,c]=re(o,n),s=se*function(t,n){const e=oe(n);let r=0;for(let n=0;n<t.length;n++)r=r*e+oe(t[n]);return r}(o,n),u=void 0!==e?G(e,ie(n)):0;if((c+s+u)*r<Math.abs(i))return i;const f=function(t,n){const e=[],r=[];let o,i=t[0];for(let c=1;c<t.length;c++){const[s,u]=ne(i,n);[o,i]=lt(u,t[c]),e.push(s),r.push(o)}return{r̂:i,pπ:e,pσ:r}}(o,n),{pπ:l,pσ:a}=f;let{r̂:p}=f;const[h,d]=re(l,n),[v,g]=re(a,n),[m,x]=re(t[1],n);let b=d+g+x+u;return p=h+v+m+p,b+=ce*p,b*r<Math.abs(p)?p:0}function fe(t,n){let e=[0];for(let r=0;r<t.length;r++)e=J(t[r],tt(e,n));return e}const{abs:le,min:ae,max:pe,log2:he,ceil:de}=Math;function ve(t,n,e,r,o,i,c,s){let u=e,f=r,l=u,a=o,p=f-u,h=p;for(;;){let d;le(a)<le(i)&&(u=f,f=l,l=u,o=i,i=a,a=o);const v=pe(le(u),le(f));d=v<=1?kn:kn*2**de(he(v));const g=.5*(l-f);if(le(g)<=d)return f<l?[f,l,f]:[l,f,f];if(le(p)<d||le(o)<=le(i))p=g,h=p;else{let t,n,e=i/o;if(u===l)t=2*g*e,n=1-e;else{n=o/a;const r=i/a;t=e*(2*g*n*(n-r)-(f-u)*(r-1)),n=(n-1)*(r-1)*(e-1)}0<t?n=-n:t=-t,e=p,p=h,2*t<3*g*n-le(d*n)&&t<le(.5*e*n)?h=t/n:(p=g,h=p)}if(u=f,o=i,d<le(h)?f+=h:0<g?f+=d:f-=d,0===(i=s?rt(fe(c(),f)):ue(t,f,n))){if(s)return[f,f,f];const o=pe(e,f-d),u=ae(r,f+d);if(ue(t,o,n)*ue(t,u,n)!==0)return[o,u,f];if(s=!0,0===(i=rt(fe(c(),f))))return[f,f,f]}(0<i&&0<a||i<=0&&a<=0)&&(l=u,a=o,p=f-u,h=p)}}const{abs:ge}=Math;function me(t,n,e){const r=ge(n);let o=t[0],i=e[0];for(let c=1;c<t.length;c++){const s=o*n;o=s+t[c],i=i*r+ge(s)+e[c]+ge(o)}return[o,i]}function xe(t){const n=t[0].length,e=[];for(let r=0;r<n;r++){const o=[];for(let e=0;e<t.length;e++)o.push(t[e][n-(r+1)]);e.push(o)}return e}const be=Ut,we=Hn,{abs:_e}=Math;function Me(t,n,e){const r=_e(n);let o=t[0],i=e[0];for(let c=1;c<t.length;c++){const s=we(n,o);o=be(s,t[c]),i=i*r+_e(s[1])+e[c]+_e(o[1])}return[o,i]}const{abs:Ie,min:Se,max:ye,log2:Oe,ceil:Ce}=Math,Ne=Fn/zn;function Ee(t,n,e,r,o,i,c){const s=t.length-1;let u=0,f=1;for(;;){f*=2;for(let l=1;l<f;l+=2){u++;const a=o+(i-o)*(f+2*l)/(4*f),[p,h]=me(t,a,n);if(Ie(p)>h*zn)return[a,p];if(u>s)return Te(e,r,o,i,c)}}}function Te(t,n,e,r,o){const i=t.length-1;let c=0,s=1;for(;;){s*=2;for(let u=1;u<s;u+=2){c++;const f=e+(r-e)*(s+2*u)/(4*s),[l,a]=Me(t,f,n);if(Ie(l[1])>a*Fn)return[f,l[1]];if(c>i)return Pe(o(),e,r)}}}function Pe(t,n,e){const r=t.length-1;let o=1;for(;;){o*=2;for(let i=1;i<o;i+=2){const c=n+(e-n)*(o+2*i)/(4*o),s=Ln(fe(t,c)),u=s[s.length-1];if(0!==u)return[c,u];if(0>r)throw new Error("Cannot resolve root even in Shewchuk expansion precision")}}}const{abs:ke,max:Ae,log2:Be,ceil:ze}=Math;function Fe(t,n=-1/0,e=1/0,r,o,i=!1){let c;"number"==typeof t[0]&&(t=t.map(t=>[0,t]));const s=()=>void 0===o?t:(void 0===c&&(c=o()),c);r=r||new Array(t.length).fill(0),({pDd:t,pDd_:r,pExact:c}=function(t,n,e,r){let o;if(0===t.length||Dn(t[0][1])>r*n[0])return{pDd:t,pDd_:n,pExact:o};o=o||e();for(let e=0;e<o.length;e++){const i=o[e],c=t[e];c[1]=i[i.length-1],c[0]=i[i.length-2]??0,n[e]=Dn(c[1])*(Fn/r)}let i=0;for(;i<t.length&&0===t[i][1];)i++;return t=t.slice(i),n=n.slice(i),o=o.slice(i),{pDd:t,pDd_:n,pExact:o}}(t,r,s,Fn));const u=t.map(t=>t[0]+t[1]);if((i||ke(n)>2**20||ke(e)>2**20)&&([n,e]=function(t,n,e,r,o){t=En(t,On(e,r.map(t=>t*o))),n=Nn(n,yn(e,r.map(t=>t*o)));const i=2**(-2*(e.length-1));for(Number.isFinite(t)||(t=-i*Pn),Number.isFinite(n)||(n=i*Pn);;){const r=Tn(G(e,t)),o=Tn(G(e,n));if(r>i*Pn)t/=2;else{if(!(o>i*Pn))break;n/=2}}return[t,n]}(n,e,u,r,Fn)),0!==t.length){if(1===t.length)return[];if(n===e){const t=2*kn*Ae(1,2**ze(Be(Ae(ke(n),ke(e)))));n-=t,e+=t}return function(t,n,e,r,o,i){const c=e.map((n,e)=>n*Ne+Ie(t[e])),s=r,u=o;let f,l,a,p,h=o-r;for(;[f,l]=me(t,r,c),!(Ie(f)>l*zn);)r-=h/2,h*=2;for(;[a,p]=me(t,o,c),!(Ie(a)>p*zn);)o+=h/2,h*=2;const d=[[r,o,f,a,0]],v=[],g=function(t,n,e,r,o){return function(i,c,s,u,f){let[l,a]=function(t,n,e){const r=t.length-1,o=Xn(n),i=t.slice(),c=e.slice();for(let t=0;t<=r;t++)for(let e=1;e<=r-t;e++){const t=n*i[e-1],r=o*c[e-1]+Xn(t);i[e]=i[e]+t,c[e]=c[e]+r+Xn(i[e])}return[i,c]}(t,i,n);!function(t,n,e){const r=t.length-1;if(r<0)return;let o=n,i=0;for(let c=1;c<=r;c++){const s=r-c,u=t[s],f=qn(u),l=e[s],a=u*o;t[s]=a,e[s]=l*o+f*i+qn(a);const p=o*n;i=i*n+p,o=p}}(l,c-i,a),l.reverse(),a.reverse(),function(t,n){const e=t.length-1;for(let r=0;r<=e;r++)for(let o=1;o<=e-r;o++){const e=t[o-1],r=n[o-1]+Xn(e);t[o]=t[o]+e,n[o]=n[o]+r+Xn(t[o])}}(l,a);let p=0,h=0,d=Kn(s);for(let t=1;t<l.length-1;t++){let n=Kn(l[t]);const e=l[t],r=a[t]*zn;Jn(e)<=r&&(h++,n=-d),n!==d&&(p++,d=n)}return Kn(u)!==d&&p++,1===h&&1===p?1:h>0?function(t,n,e,r,o,i,c,s){let[u,f]=Qn(t,e,n);(function(t,n,e){const r=t.length-1;if(r<0)return;let o=[0,n],i=0;for(let c=1;c<=r;c++){const s=r-c,u=t[s],f=Un(u[1]),l=e[s],a=Gn(o,u);t[s]=a,e[s]=l*o[1]+f*i+Un(a[1]);const p=Gn(o,[0,n]);i=i*n+p[1],o=p}})(u,r-e,f),u.reverse(),f.reverse(),[u,f]=Qn(u,1,f);let l=0,a=0,p=Kn(o);for(let t=0;t<u.length-1;t++){let n=Kn(u[t][1]);const e=f[t]*Fn,r=u[t];e>=Jn(r[1])&&(a++,n=-p),n!==p&&(l++,p=n)}return Kn(i)!==p&&l++,1===a&&1===l?1:0===a?l:c>1?function(t,n,e,r,o){let i=$n(t(),n);i=Zn(i,e-n),i.reverse(),i=$n(i,1);let c=0,s=Kn(r);for(let t=1;t<i.length-1;t++){const n=i[t];let e=Kn(n[n.length-1]);e!==s&&0!==e&&(c++,s=e)}return Kn(o)!==s&&c++,c}(s,e,r,o,i):-l}(e,r,i,c,s,u,f,o):p}}(t,c,n,e,i);let m,x;for(;d.length>0;){const r=d.pop(),[o,s,u,f,l]=r,a=g(o,s,u,f,l);if(0===a)continue;if(1===a){m=m||e.map(t=>t*Fn),x=x||xe(n);const[t,r,c]=ve(x,m,o,s,u,f,i,!1);v.push({t:c,tS:t,tE:r,multiplicity:1});continue}let p=a<0?l+1:0;if(s-o<=2*Ie(a)*kn*ye(1,2**Ce(Oe(ye(Ie(o),Ie(s)))))){if(0===p){v.push({t:(o+s)/2,tS:o,tE:s,multiplicity:Ie(a)});continue}p=1/0}const[h,b]=Ee(t,c,n,e,o,s,i);d.push([o,h,u,b,p]),d.push([h,s,b,f,p])}return v.reverse(),v.filter(t=>{const{tS:n,tE:e}=t;return!(e<s||n>u)})}(u,t,r,n,e,s)}}function Ye(t,n){if(0===n)return t[0];if(1===n)return t[t.length-1];if(4===t.length){const[[e,r],[o,i],[c,s],[u,f]]=t,l=e+(o-e)*n,a=o+(c-o)*n,p=l+(a-l)*n,h=r+(i-r)*n,d=i+(s-i)*n,v=h+(d-h)*n;return[p+(a+(c+(u-c)*n-a)*n-p)*n,v+(d+(s+(f-s)*n-d)*n-v)*n]}if(3===t.length){const[[e,r],[o,i],[c,s]]=t,u=e+(o-e)*n,f=r+(i-r)*n;return[u+(o+(c-o)*n-u)*n,f+(i+(s-i)*n-f)*n]}if(2===t.length){const[[e,r],[o,i]]=t;return[e+(o-e)*n,r+(i-r)*n]}if(1===t.length)return t[0];throw new Error("The given bezier curve must be of order <= 3.")}const{abs:De}=Math;function Le(t,n){if(0===n[0]&&0===n[1])return[0,0];if(0===n[0]&&1===n[1])return[0,0];const e=De(n[1]);if(4===t.length){const[[n,r],[o,i],[c,s],[u,f]]=t,l=De(n),a=De(r),p=De(o),h=De(i),d=De(c),v=De(s),g=l+(p+l)*e,m=p+(d+p)*e,x=g+(m+g)*e,b=a+(h+a)*e,w=h+(v+h)*e,_=b+(w+b)*e;return[x+(m+(d+(De(u)+d)*e+m)*e+x)*e,_+(w+(v+(De(f)+v)*e+w)*e+_)*e]}if(3===t.length){const[[n,r],[o,i],[c,s]]=t,u=De(n),f=De(r),l=De(o),a=De(i),p=u+(l+u)*e,h=f+(a+f)*e;return[p+(l+(De(c)+l)*e+p)*e,h+(a+(De(s)+a)*e+h)*e]}if(2===t.length){const[[n,r],[o,i]]=t,c=De(n),s=De(r);return[c+(De(o)+c)*e,s+(De(i)+s)*e]}if(1===t.length)return[0,0];throw new Error("The given bezier curve must be of order <= 3.")}const Xe=Number.EPSILON,qe=Number.EPSILON/2,We=qe*qe,je=Ve(1),He=function(){const t=3*We;return t/(1-t)}();function Ve(t){const n=t*qe;return n/(1-n)}const{abs:Qe}=Math,Re=[[0,0],[0,0]];const{min:Ge,max:Ue}=Math;function $e(t,n){return n[0]!==n[1]?4===t.length?function(t,n){const{ps:e,_ps:r}=fn(t,n[0],n[1]),o=e[0][0],i=e[1][0],c=e[2][0],s=e[3][0],u=9*qe*r[0][0],f=9*qe*r[1][0],l=9*qe*r[2][0],a=9*qe*r[3][0],p=e[0][1],h=e[1][1],d=e[2][1],v=e[3][1],g=9*qe*r[0][1],m=9*qe*r[1][1],x=9*qe*r[2][1],b=9*qe*r[3][1],w=Ge(o-u,i-f,c-l,s-a),_=Ue(o+u,i+f,c+l,s+a);return[[w,Ge(p-g,h-m,d-x,v-b)],[_,Ue(p+g,h+m,d+x,v+b)]]}(t,n):3===t.length?function(t,n){const{ps:e,_ps:r}=Qt(t,n[0],n[1]),o=e[0][0],i=e[1][0],c=e[2][0],s=5*qe*r[0][0],u=5*qe*r[1][0],f=5*qe*r[2][0],l=e[0][1],a=e[1][1],p=e[2][1],h=5*qe*r[0][1],d=5*qe*r[1][1],v=5*qe*r[2][1],g=Ge(o-s,i-u,c-f),m=Ue(o+s,i+u,c+f);return[[g,Ge(l-h,a-d,p-v)],[m,Ue(l+h,a+d,p+v)]]}(t,n):function(t,n){const{ps:e,_ps:r}=function(t,n,e){return 0===n?1===e?{ps:t,_ps:Re}:function(t,n){const e=t[0],r=t[1],o=e[0],i=e[1],c=r[0],s=r[1],u=[[o,i],[n*(c-o)+o,n*(s-i)+i]],f=Qe(n),l=Qe(o),a=Qe(c),p=Qe(i);return{ps:u,_ps:[[0,0],[f*(a+l)+l,f*(Qe(s)+p)+p]]}}(t,e):1===e?function(t,n){const e=t[0],r=t[1],o=e[0],i=e[1],c=r[0],s=r[1],u=[[n*(c-o)+o,n*(s-i)+i],[c,s]],f=Qe(n),l=Qe(o),a=Qe(c),p=Qe(i);return{ps:u,_ps:[[f*(a+l)+l,f*(Qe(s)+p)+p],[0,0]]}}(t,n):function(t,n,e){const r=t[0],o=t[1],i=r[0],c=r[1],s=o[0],u=o[1],f=[[n*(s-i)+i,n*(u-c)+c],[e*(s-i)+i,e*(u-c)+c]],l=Qe(n),a=Qe(e),p=Qe(i),h=Qe(s),d=Qe(c),v=Qe(u);return{ps:f,_ps:[[l*(h+p)+p,l*(v+d)+d],[a*(h+p)+p,a*(v+d)+d]]}}(t,n,e)}(t,n[0],n[1]),o=e[0][0],i=e[1][0],c=3*qe*r[0][0],s=3*qe*r[1][0],u=e[0][1],f=e[1][1],l=3*qe*r[0][1],a=3*qe*r[1][1],p=Ge(o-c,i-s),h=Ue(o+c,i+s);return[[p,Ge(u-l,f-a)],[h,Ue(u+l,f+a)]]}(t,n):function(t,n){const e=t[0],r=t[t.length-1];if(0===n)return[e,e];if(1===n)return[r,r];const o=Ye(t,n);let i;if(4===t.length)i=Le(t,[0,n]).map(t=>8*je*t);else if(3===t.length)i=Le(t,[0,n]).map(t=>5*je*t);else if(2===t.length)i=Le(t,[0,n]).map(t=>2*je*t);else if(1===t.length)return[o,o];return[[o[0]-i[0],o[1]-i[1]],[o[0]+i[0],o[1]+i[1]]]}(t,n[0])}function Ze(t){const n=t[0],e=t[1];return[(n[0]+e[0])/2,(n[1]+e[1])/2]}const Je=Z,Ke=Number.EPSILON;function tr(t,n){const e=t-n,r=t-e;return[t-(e+r)+(r-n),e]}function nr(t){return[2*t[0],2*t[1]]}function er(t){return[4*t[0],4*t[1]]}const rr=tr,or=Ut,ir=Hn,cr=Gn,sr=nr,ur=er,fr=$t;function lr(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=i[0],h=i[1],[d,v]=n,g=rr(c,d),m=rr(u,d),x=rr(l,d),b=rr(p,d),w=rr(s,v),_=rr(f,v),M=rr(a,v),I=rr(h,v),S=cr(g,g),y=ir(6,cr(g,m)),O=ir(6,cr(g,x)),C=sr(cr(g,b)),N=ir(9,cr(m,m)),E=ir(18,cr(m,x)),T=ir(6,cr(m,b)),P=ir(9,cr(x,x)),k=ir(6,cr(x,b)),A=cr(b,b),B=cr(w,w),z=ir(6,cr(w,_)),F=ir(6,cr(w,M)),Y=sr(cr(w,I)),D=ir(9,cr(_,_)),L=ir(18,cr(_,M)),X=ir(6,cr(_,I)),q=ir(9,cr(M,M)),W=ir(6,cr(M,I)),j=cr(I,I),H=or(T,P),V=or(C,E),Q=or(O,N),R=or(X,q),G=or(Y,L),U=or(F,D);return[ir(6,or(or(or(or(fr(A,k),fr(S,y)),H),fr(Q,V)),or(or(or(fr(j,W),fr(B,z)),R),fr(U,G)))),ir(5,or(fr(or(or(k,ir(5,y)),ir(3,V)),sr(or(or(H,sr(Q)),ir(3,S)))),fr(or(or(W,ir(5,z)),ir(3,G)),sr(or(or(R,sr(U)),ir(3,B)))))),ur(or(fr(fr(H,ir(3,fr(V,sr(Q)))),ir(5,fr(sr(y),ir(3,S)))),fr(fr(R,ir(3,fr(G,sr(U)))),ir(5,fr(sr(z),ir(3,B)))))),ir(3,or(fr(V,sr(fr(sr(Q),ir(5,fr(y,sr(S)))))),fr(G,sr(fr(sr(U),ir(5,fr(z,sr(B)))))))),sr(or(fr(Q,ir(5,fr(y,ir(3,S)))),fr(U,ir(5,fr(z,ir(3,B)))))),or(fr(y,ir(6,S)),fr(z,ir(6,B)))]}const ar=tr,pr=Ut,hr=Hn,dr=Gn,vr=nr,gr=$t,mr=er;function xr(t,n){const[[e,r],[o,i],[c,s]]=t,[u,f]=n,l=ar(e,u),a=ar(o,u),p=ar(c,u),h=ar(r,f),d=ar(i,f),v=ar(s,f),g=dr(l,l),m=dr(l,a),x=dr(l,p),b=dr(a,a),w=dr(a,p),_=dr(p,p),M=dr(h,h),I=dr(h,d),S=dr(h,v),y=dr(d,d),O=dr(d,v),C=dr(v,v),N=pr(S,vr(y)),E=pr(x,vr(b));return[pr(gr(pr(pr(C,M),vr(N)),mr(pr(O,I))),gr(pr(pr(_,g),vr(E)),mr(pr(w,m)))),hr(3,pr(pr(gr(O,N),gr(hr(3,I),M)),pr(gr(w,E),gr(hr(3,m),g)))),pr(gr(N,hr(3,gr(vr(I),M))),gr(E,hr(3,gr(vr(m),g)))),pr(gr(I,M),gr(m,g))]}function br(t){return[-2*t[0],-2*t[1]]}const wr=Gt,_r=Ut,Mr=br;function Ir(t,n){const[[e,r],[o,i]]=t,[c,s]=n,u=e-c,f=o-c,l=r-s,a=i-s,p=wr(u,u),h=wr(u,f),d=wr(f,f),v=wr(l,l),g=wr(l,a),m=wr(a,a),x=_r(h,g),b=_r(v,p);return[_r(_r(d,m),_r(b,Mr(x))),$t(x,b)]}function Sr(t){const n=[];for(let e=0;e<t.length;e++)n.push(2*t[e]);return n}function yr(t){const n=[];for(let e=0;e<t.length;e++)n.push(-2*t[e]);return n}const Or=Z,Cr=nt,Nr=Sr,Er=yr,Tr=Z,Pr=nt,kr=Sr;function Ar(t){const n=[];for(let e=0;e<t.length;e++)n.push(4*t[e]);return n}const Br=Z,zr=yr,{abs:Fr}=Math;function Yr(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=Fr(e[0]),s=Fr(e[1]),u=Fr(r[0]),f=Fr(r[1]),l=Fr(o[0]),a=Fr(o[1]),p=Fr(i[0]),h=Fr(i[1]),d=Fr(n[0]),v=Fr(n[1]),g=c+d,m=u+d,x=l+d,b=p+d,w=s+v,_=f+v,M=a+v,I=h+v,S=g*g,y=6*g*m,O=6*x*b,C=w*w,N=6*w*_,E=6*M*I,T=6*m*b+9*x*x,P=2*g*b+18*m*x,k=6*g*x+9*m*m,A=6*_*I+9*M*M,B=2*w*I+18*_*M,z=6*w*M+9*_*_;return[6*(b*b+O+(S+y)+T+(k+P)+(I*I+E+(C+N)+A+(z+B))),5*(O+5*y+3*P+2*(T+2*k+3*S)+(E+5*N+3*B+2*(A+2*z+3*C))),4*(T+3*(P+2*k)+5*(2*y+3*S)+(A+3*(B+2*z)+5*(2*N+3*C))),3*(P+2*(2*k+5*(y+2*S))+(B+2*(2*z+5*(N+2*C)))),2*(k+5*(y+3*S)+(z+5*(N+3*C))),y+6*S+(N+6*C)]}function Dr(t,n){const e=t[0],r=t[1],o=t[2],i=Fr(e[0]),c=Fr(e[1]),s=Fr(r[0]),u=Fr(r[1]),f=Fr(o[0]),l=Fr(o[1]),a=Fr(n[0]),p=Fr(n[1]),h=i+a,d=s+a,v=f+a,g=c+p,m=u+p,x=l+p,b=h*h,w=h*d,_=d*v,M=g*g,I=g*m,S=m*x,y=g*x+m*m*2,O=h*v+d*d*2;return[x*x+M+2*y+4*(S+I)+(v*v+b+2*O+4*(_+w)),3*(S+y+(3*I+M)+(_+O+(3*w+b))),y+3*(2*I+M)+(O+3*(2*w+b)),I+M+(w+b)]}function Lr(t,n){const e=t[0],r=t[1],o=Fr(e[0]),i=Fr(e[1]),c=Fr(r[0]),s=Fr(r[1]),u=Fr(n[0]),f=Fr(n[1]),l=o+u,a=c+u,p=i+f,h=s+f,d=l*a+p*h,v=p*p+l*l;return[a*a+h*h+2*d+v,d+v]}function Xr(t,n){const e=t.length-1;if(3===e)return{polyDd:lr(t,n),polyE:Yr(t,n).map(t=>20*t),getPolyExact:()=>function(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=i[0],h=i[1],[d,v]=n,g=Or(c,d),m=Or(u,d),x=Or(l,d),b=Or(p,d),w=Or(s,v),_=Or(f,v),M=Or(a,v),I=Or(h,v),S=et(g,g),y=Cr(6,et(g,m)),O=Cr(6,et(g,x)),C=Nr(et(g,b)),N=Cr(9,et(m,m)),E=Cr(18,et(m,x)),T=Cr(6,et(m,b)),P=Cr(9,et(x,x)),k=Cr(6,et(x,b)),A=et(b,b),B=et(w,w),z=Cr(6,et(w,_)),F=Cr(6,et(w,M)),Y=Nr(et(w,I)),D=Cr(9,et(_,_)),L=Cr(18,et(_,M)),X=Cr(6,et(_,I)),q=Cr(9,et(M,M)),W=Cr(6,et(M,I)),j=et(I,I),H=J(T,P),V=J(C,E),Q=J(O,N),R=J(X,q),G=J(Y,L),U=J(F,D),$=it(J(J(A,S),J(H,Q)),J(J(V,k),y)),Z=it(J(J(j,B),J(R,U)),J(J(G,W),z)),K=Cr(6,J($,Z)),tt=J(Er(J(J(H,Nr(Q)),Cr(3,S))),J(J(k,Cr(3,V)),Cr(5,y))),nt=J(Er(J(J(R,Nr(U)),Cr(3,B))),J(J(W,Cr(3,G)),Cr(5,z))),rt=Cr(5,J(tt,nt)),ot=J(J(H,Cr(3,it(Nr(Q),V))),Cr(5,it(Cr(3,S),Nr(y)))),ct=J(J(R,Cr(3,it(Nr(U),G))),Cr(5,it(Cr(3,B),Nr(z)))),st=Cr(4,J(ot,ct)),ut=it(V,Nr(it(Nr(Q),Cr(5,it(y,Nr(S)))))),ft=it(G,Nr(it(Nr(U),Cr(5,it(z,Nr(B)))))),lt=Cr(3,J(ut,ft)),at=it(Q,Cr(5,it(y,Cr(3,S)))),pt=it(U,Cr(5,it(z,Cr(3,B))));return[K,rt,st,lt,Nr(J(at,pt)),J(it(y,Cr(6,S)),it(z,Cr(6,B)))].map(Ln)}(t,n)};if(2===e)return{polyDd:xr(t,n),polyE:Dr(t,n).map(t=>16*t),getPolyExact:()=>function(t,n){const[[e,r],[o,i],[c,s]]=t,[u,f]=n,l=Tr(e,u),a=Tr(o,u),p=Tr(c,u),h=Tr(r,f),d=Tr(i,f),v=Tr(s,f),g=et(l,l),m=et(l,a),x=et(l,p),b=et(a,a),w=et(a,p),_=et(p,p),M=et(h,h),I=et(h,d),S=et(h,v),y=et(d,d),O=et(d,v),C=et(v,v),N=J(S,kr(y)),E=J(x,kr(b)),T=J(it(J(_,kr(E)),Ar(J(w,m))),g),P=J(it(J(C,kr(N)),Ar(J(O,I))),M),k=J(T,P),A=J(it(w,E),it(Pr(3,m),g)),B=J(it(O,N),it(Pr(3,I),M));return[k,Pr(3,J(A,B)),J(it(N,Pr(3,it(kr(I),M))),it(E,Pr(3,it(kr(m),g)))),J(it(I,M),it(m,g))].map(Ln)}(t,n)};if(1===e)return{polyDd:Ir(t,n),polyE:Lr(t,n).map(t=>12*t),getPolyExact:()=>function(t,n){const[[e,r],[o,i]]=t,[c,s]=n,u=Br(e,c),f=Br(o,c),l=Br(r,s),a=Br(i,s),p=et(u,u),h=et(u,f),d=et(f,f),v=et(l,l),g=et(l,a),m=et(a,a),x=J(h,g),b=J(v,p);return[J(J(d,m),J(zr(x),b)),it(x,b)].map(Ln)}(t,n)};if(0===e)return{polyDd:[[0,1]],polyE:[0],getPolyExact:()=>[[1]]};throw new Error("The given bezier curve must be of order 1, 2 or 3")}const{sqrt:qr}=Math;function Wr(t,n,e=0,r=1){const{polyDd:o,polyE:i,getPolyExact:c}=Xr(t,n),s=Fe(o,e,r,i,c)||[];s.push({t:e,tS:e,tE:e,multiplicity:1}),s.push({t:r,tS:r,tE:r,multiplicity:1});const u=s.map(e=>{const r=$e(t,[e.tS,e.tE]),o=function(t,n){const e=t[0],r=t[1],o=e[0],i=e[1],c=r[0],s=r[1],u=n[0],f=n[1];let l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(const[t,n]of[[o,i],[o,s],[c,i],[c,s]]){const e=Je(t,u),r=Je(n,f),o=rt(J(et(e,e),et(r,r))),i=o*(1-Ke),c=o*(1+Ke);i<=l&&(l=i),c>=a&&(a=c)}return[l,a]}(r,n);return{p:Ze(r),t:e.t,d:(qr(o[0])+qr(o[1]))/2,dSquaredI:o,box:r,ri:e}});let f=Number.POSITIVE_INFINITY;for(let t=0;t<u.length;t++){const n=u[t].dSquaredI[1];n<f&&(f=n)}const l=[];for(let t=0;t<u.length;t++){const n=u[t];n.dSquaredI[0]<=f&&l.push(n)}return l}function jr(t){return(t.tS+t.tE)/2}function Hr(t){const n=t.xs;if(4===n.length){let t=0,e=0;for(let r=0;r<n.length;r++)0===n[r].x.kind&&t++,4===n[r].x.kind&&e++;if(2===t&&2===e)return!0}return n.length<=2&&7!==n[0].x.kind}function Vr(t){const n=(t=Ln(t)).length;return 2===n?t:n<=1?[0,t[0]]:[t[n-2],t[n-1]]}const{abs:Qr,min:Rr,max:Gr,log2:Ur,ceil:$r}=Math;function Zr(t,n){const{tS:e,tE:r}=t,o=r-e;if(0===o)return[{tS:[0,e],tE:[0,e],multiplicity:t.multiplicity}];const i=2**$r(Ur(o)),c=function(t,n,e){return Zn($n(t,e),n)}(n,i,e),s=c.map(Vr),u=s.map(t=>t[1]*kn**2),f=Fe(s,0,1,u,()=>c),l=[];for(const t of f)l.push({tS:lt(e,t.tS*i),tE:lt(e,t.tE*i),multiplicity:t.multiplicity});return l}function Jr(t,n){return ct(it(t,n))}const{abs:Kr}=Math;function to(t,n){const e=t.inOuts;e.sort(function(t){return(n,e)=>{let r=n.side-e.side;if(0!==r)return r;const o=n.sideX,i=e.sideX;r=o.ri.tS-i.ri.tS;const c=8*Number.EPSILON;return Kr(r)>=c?r:(o.compensated||(o.compensated=1,o.riExp=Zr(o.ri,o.getPExact())[0]),i.compensated||(i.compensated=1,i.riExp=Zr(i.ri,i.getPExact())[0]),r=Jr(o.riExp.tS,i.riExp.tS),0!==r?r:(r=n.dir-e.dir,0!==r?t*r:1===n.dir?n.idx-e.idx:e.idx-n.idx))}}(n));let r=e[e.length-1];for(let t=0;t<e.length;t++){const n=e[t];n.prevAround=r,r.nextAround=n,r=n}}function no(t,n,e,r){const o=function(t,n){return(e,r,o)=>{t.has(e)||(e.orientation=r,e.parent=o,e.windingNum=o.windingNum+e.orientation,n.push(e))}}(r,e);to(t.container,n.orientation);let i,c,s=1,u=t,f=n.orientation;for(;u=1===n.orientation?u.nextAround:u.prevAround,u!==t;){const t=s;s-=u.dir,1===s&&(f*=-1),-1!==u.dir&&(i?1===t&&0===s?o(u,n.orientation,n.parent):0===t&&-1===s&&o(u,-n.orientation,n.parent):0===s?i=u:1===s&&o(u,n.orientation,n))}return Hr(t.container)||(c=[t.p,i.p]),{inOutToUse:i,additionalBezier:c}}function eo(t,n){const e=t._x_,r=n._x_,o=e.curve,i=e.x.ri.tS,c=r.curve,s=r.x.ri.tS;let u=o,f=i;Hr(t.container)||(f=jr(Wr(o.ps,t.p)[0].ri));const l=[];for(;;){if(u===c&&(f<s||f===s&&0!==l.length)){const t=u.ps,n=[f,s];return l.push({ps:t,ts:n}),l}{const t=u.ps,n=[f,1];l.push({ps:t,ts:n})}f=0,u=u.next}}function ro(t,n){const e=n._x_,r=t._x_,o=r.curve,i=r.x.ri.tS,c=e.curve,s=e.x.ri.tS;let u=o,f=i;Hr(t.container)||(f=jr(Wr(u.ps,t.p)[0].ri));const l=[];for(;;){const t=u.ps;if(u===c&&(f>s||f===s&&0!==l.length)){const n=[f,s];return l.push({ps:t,ts:n}),l}{const n=[f,0];l.push({ps:t,ts:n})}f=1,u=u.prev}}function oo(t,n,e,r){const o=function(t,n,e){return(r,o,i,c)=>{n.has(r)||1!==r.dir||(r.loopsIdxs=new Set(c),r.orientation=o*t.orientation,r.parent=i.parent,r.windingNum=i.windingNum+r.orientation,e.unshift(r))}}(n,r,e);to(t.container,1);let i=t.nextAround,c=t;const s=[],u=new Set(n.loopsIdxs);for(;c=c.nextAround,c!==t;)o(c,n.dir,n,u),s.push(c.idx),-1===c.dir?u?.add(c._x_?.curve.loop.idx):u.delete(c._x_?.curve.loop.idx);let f;return Hr(t.container)||(f=[t.p,i.p]),{inOutToUse:i,additionalBezier:f}}function io(t){const{ps:n,ts:e}=t;return P(n,e[0],e[1])}function co(t,n,e){const r=[],o=[];let i,c=n;const s=e?oo:no,u=[];do{t.add(c),u.push(c);const e=c.nextOrPrev;t.add(e);const f=1===c.dir?eo(c,e):ro(c,e);o.push(...f);const l=s(e,n,r,t);if(({inOutToUse:c,additionalBezier:i}=l),void 0!==i){const t=io(o[o.length-1]),n={ps:t,ts:[0,jr(Wr(t,i[0])[0].ri)]};o.pop(),o.push(n),o.push({ps:i,ts:[0,1]})}}while(c!==n);return"undefined"!=typeof _debug_&&_debug_.verbose&&function(t){const n=[],e=[];for(let r of t)e.push(1===r.dir?"color: blue;":"color: red"),n.push(`%c${r.idx}`)}(u),{bezierPieces:o,additionalOutsToCheck:r}}function so(t,n,e,r){const o=[t];for(;o.length;){const t=o.pop();if(n.add(t._x_.curve.loop),e.has(t))continue;t.children=new Set;const{bezierPieces:i,additionalOutsToCheck:c}=co(e,t,r);t.bezierPieces=i,t.parent.children=t.parent.children||new Set,t.parent.children.add(t);for(let t=0;t<c.length;t++)o.push(c[t])}}function uo(t){if(4===t.length)return fo(t);if(3===t.length)return lo(t);if(2===t.length)return function(t){const[[n,e],[r,o]]=t;return[[r-n,n],[o-e,e]]}(t);if(1===t.length)return function(t){const[[n,e]]=t;return[[n],[e]]}(t);throw new Error("The given bezier curve must be of order <= 3.")}function fo(t){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[s-n+3*(r-i),3*(i+n-2*r),3*(r-n),n],[u-e+3*(o-c),3*(c+e-2*o),3*(o-e),e]]}function lo(t){const[[n,e],[r,o],[i,c]]=t;return[[i+n-2*r,2*(r-n),n],[c+e-2*o,2*(o-e),e]]}function ao(t){const n=t[0],e=t[t.length-1];let r,o;if(n[1]<e[1]?(r={ts:[0,0],box:[n,n]},o={ts:[1,1],box:[e,e]}):(r={ts:[1,1],box:[e,e]},o={ts:[0,0],box:[n,n]}),2===t.length)return{minY:r,maxY:o};const[,i]=U(t),c=Fe(i,0,1)||[];for(let n=0;n<c.length;n++){const e=c[n],i=[e.tS,e.tE],s=$e(t,i);s[0][1]<r.box[0][1]&&(r={ts:i,box:s}),s[1][1]>o.box[0][1]&&(o={ts:i,box:s})}return{minY:r,maxY:o}}function po(t){const n=function(t){const n=t[0],e=t[t.length-1];let r,o;if(n[0]<e[0]?(r={ts:[0,0],box:[n,n]},o={ts:[1,1],box:[e,e]}):(r={ts:[1,1],box:[e,e]},o={ts:[0,0],box:[n,n]}),2===t.length)return{minX:r,maxX:o};const[i]=U(t),c=Fe(i,0,1)||[];for(let n=0;n<c.length;n++){const e=c[n],i=[e.tS,e.tE],s=$e(t,i);s[0][0]<r.box[0][0]&&(r={ts:i,box:s}),s[1][0]>o.box[0][0]&&(o={ts:i,box:s})}return{minX:r,maxX:o}}(t),e=ao(t);return[[n.minX.box[0][0],e.minY.box[0][1]],[n.maxX.box[1][0],e.maxY.box[1][1]]]}const ho=D(po);function vo(t){const n=U(t),e=Fe(n[0],0,1)?.map(t=>t.t)||[],r=Fe(n[1],0,1)?.map(t=>t.t)||[];e.push(0,1),r.push(0,1);let o,i,c,s,u=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let n=0;n<e.length;n++){const r=e[n],[c]=Ye(t,r);c<u&&(u=c,o=r),c>f&&(f=c,i=r)}for(let n=0;n<r.length;n++){const e=r[n],[,o]=Ye(t,e);o<l&&(l=o,c=e),o>a&&(a=o,s=e)}return{ts:[[o,c],[i,s]],box:[[u,l],[f,a]]}}const go=D(vo),{min:mo,max:xo}=Math;function bo(t){const n=t.map(go);return{minX:mo(...n.map(t=>t.box[0][0])),maxX:xo(...n.map(t=>t.box[1][0])),minY:mo(...n.map(t=>t.box[0][1])),maxY:xo(...n.map(t=>t.box[1][1]))}}const wo=new Function("try {return this===window;}catch(e){ return false;}")()?function(t){const n=window.atob(t),e=n.length,r=new Uint8Array(e);for(let t=0;t<e;t++)r[t]=n.charCodeAt(t);return r.buffer}:function(t){return function(t){const n=new ArrayBuffer(t.length),e=new Uint8Array(n);for(let n=0;n<t.length;++n)e[n]=t[n];return n}(Buffer.from(t,"base64"))},_o=wo("AGFzbQEAAAABBgFgAX8BfAMDAgAABQMBAAAHHwMGbWVtb3J5AgAHc3F1YXJlcwAACHNxdWFyZXM0AAEKjgECPwECfiAArULHuuXf9tjQm2p+IgEgASABfnxCIIoiAiACfiABQse65d/22NCbanx8QiCKIgIgAn4gAXxCIIi6C0wBAn4gAK1Cx7rl3/bY0JtqfiIBQse65d/22NCbanwiAiABIAIgASABIAF+fEIgiiIBIAF+fEIgiiIBIAF+fEIgiiIBIAF+fEIgiLoL"),Mo=new WebAssembly.Module(_o),Io=new WebAssembly.Instance(Mo),So=Io.exports.squares;Io.exports.squares4;const yo=1e-6;function Oo(t,n){let e;const r=[t];for(;r.length;)o(r.pop());return e;function o(o){if(o===t||function(t,n){let e=0;do{e++;const o=So(e)/4294967296,i=r(t,n,Ye(t[So(e+1e3)%t.length],o));if(void 0!==i)return i}while(e<100);return;function r(t,n,e){if(function(t,n){const e=bo(t),r=bo(n);return e.minX<r.minX||e.maxX>r.maxX||e.minY<r.minY||e.maxY>r.maxY}(t,n))return!1;const r=function(t,n){const[e,r]=n;let o=0;for(let i=0;i<t.length;i++){const c=t[i],[[s,u],[f,l]]=ho(c);let a=u>r||l<r||!1;if(a=a||s>e||!1,a)continue;const p=[];let h,d,v;const g=!0;h=t=>uo(t)[1],d=[0,-r],v=0;const m=c.map(V(d)),x=h(m),b=Fe(x,0-yo,1+yo)?.map(t=>t.t)||[];for(let t=0;t<b.length;t++){const e=b[t];if(Math.abs(e)<yo||Math.abs(e-1)<yo)return;const r=Ye(m,e);(g&&n[v]>=r[v]||!g&&n[v]<=r[v])&&p.push(e)}if(1===p.length||3===p.length)for(const t of p){const n=Q($(c,t));if(Math.abs(n[1])<yo)return}o+=p.length}return o}(n,e);return void 0!==r?r%2!=0:void 0}}(n.beziers,o.bezierPieces.map(io))){e=o;for(const t of o.children)r.push(t)}}}function Co(t,n){return No(t)-No(n)}function No(t){let n=Number.POSITIVE_INFINITY;for(const e of t){const t=go(e).box[0][1];t<n&&(n=t)}return n}const{abs:Eo,sign:To}=Math;function Po(t){let n=t.parent;for(;;){if(void 0===n)return!1;if(n.used)return!0;n=n.parent}}function ko(t,n,e){let[[r,o],[i,c]]=n,[[s,u],[f,l]]=e;o>c&&([o,c]=[c,o]),u>l&&([u,l]=[l,u]),r>i&&([r,i]=[i,r]),s>f&&([s,f]=[f,s]);const a=t||r===i&&s===f,p=t||o===c&&u===l;return(a?r<=f:r<f)&&(a?i>=s:i>s)&&(p?u<=c:u<c)&&(p?l>=o:l>o)}function Ao(t,n){return ko(!0,t.box,n.box)}function Bo(t,n){for(let e=0;e<n.length;e++){const r=n[e];zo(t,[r.a,r.b])}}function zo(t,n){const[e,r]=n;let o=t.get(e);o||(o=[],t.set(e,o));let i=t.get(r);i||(i=[],t.set(r,i)),o.push(r),i.push(e)}function Fo(t,n,e,r){e.add(n),r.push(n);const o=t.get(n);for(let n=0;n<o.length;n++){const i=o[n];e.has(i)||Fo(t,i,e,r)}}function Yo(t){const n=[],e=new Set;for(const r of t){const o=r[0];e.has(o)||(n.push([]),Fo(t,o,e,n[n.length-1]))}return n}function Do(t,n){const e=new Set;for(const t of n)for(const n of t)e.add(n);const r=[];for(let n=0;n<t.length;n++){const o=t[n];e.has(o)||r.push(o)}return r}function Lo(t){const n=[];for(const e of t){let t=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const c=[];for(const n of e){const[[e,s],[u,f]]=n.box;e<t&&(t=e),s<r&&(r=s),u>o&&(o=u),f>i&&(i=f),c.push(...n.xs)}const s={box:[[t,r],[o,i]],xs:c,inOuts:void 0};n.push(s)}return n}function Xo(t){return{tS:[0,t.tS],tE:[0,t.tE],multiplicity:t.multiplicity}}function qo(t,n){const e=t[0],r=t[1],o=r+n,i=o-r,c=e+(r-(o-i)+(n-i)),s=o+c;return[c-(s-o),s]}const Wo=tr,jo=Hn,Ho=Ut,Vo=qo,{abs:Qo}=Math;function Ro(t){const[[n,e],[r,o],[i,c],[s,u]]=t,f=Wo(s,n),l=Wo(r,i),a=3*(r-i),p=jo(3,l),h=Qo(a),d=Ho(f,p),v=h+Qo(s-n+a),g=Wo(i,2*r),m=Vo(g,n),x=Qo(i-2*r+n),b=jo(3,m),w=6*x,_=Wo(r,n),M=jo(3,_),I=Qo(3*(r-n)),S=Wo(u,e),y=Wo(o,c),O=3*(o-c),C=jo(3,y),N=Qo(O),E=Ho(S,C),T=N+Qo(u-e+O),P=Wo(c,2*o),k=Vo(P,e),A=Qo(c-2*o+e),B=jo(3,k),z=6*A,F=Wo(o,e);return{coeffs:[[d,b,M,[0,n]],[E,B,jo(3,F),[0,e]]],errorBound:[[v,w,I,0],[T,z,Qo(3*(o-e)),0]]}}function Go(t){const[[n,e],[r,o],[i,c]]=t,s=i-2*r,u=Wo(i,2*r),f=Vo(u,n),l=Qo(s+n),a=Wo(2*r,2*n),p=c-2*o,h=Wo(c,2*o),d=Vo(h,e),v=Qo(p+e);return{coeffs:[[f,a,[0,n]],[d,Wo(2*o,2*e),[0,e]]],errorBound:[[l,0,0],[v,0,0]]}}function Uo(t){const[[n,e],[r,o]]=t;return[[Wo(r,n),[0,n]],[Wo(o,e),[0,e]]]}const $o=$t,Zo=Hn,Jo=ot,{abs:Ko}=Math;function ti(t){const[[n,[,e]],[r,[,o]]]=Uo(t),i=Jo(r),c=n,s=Zo(o,n),u=Ko(s[1]),f=Zo(e,r),l=Ko(f[1]),a=$o(f,s);return{coeffs:{vₓ:i,vᵧ:c,v:a},errorBound:{v_:u+l+Ko(a[1])}}}const{abs:ni}=Math,ei=Ut,ri=Hn,oi=Gn;function ii(t){return[-t[0],-t[1]]}const ci=ii,si=nr,ui=Hn,fi=Gn,li=$t,{abs:ai}=Math;function pi(t){const{coeffs:[[n,e,[,r]],[o,i,[,c]]],errorBound:[[s],[u]]}=Go(t),f=n[1],l=e[1],a=o[1],p=i[1],h=ai(r),d=ai(l),v=ai(f),g=ai(c),m=ai(p),x=ai(a),b=fi(n,i),w=s*m+2*ai(f*p),_=fi(e,o),M=d*u+2*ai(l*a),I=ui(c,n),S=g*s+ai(c*f),y=ui(r,o),O=h*u+ai(r*a),C=ui(c,e),N=ai(c*l),E=ui(r,i),T=ai(r*p),P=fi(n,n),k=2*(s*v+ai(f*f)),A=fi(n,o),B=s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t),Lr=ar*Nn+pr*Nn+bi(Dr[1]),Xr=Ii(Fn,Ut),qr=Yn*$t+Qn*On+bi(Xr[1]),Wr=Si(Dr,Xr),jr=Lr+qr+bi(Wr[1]),Hr=Ii(jt,zr),Vr=Ht*Fr+In*Yr+bi(Hr[1]),Qr=yi(Hr,Wr);return{coeffs:{vₓₓₓ:Un,vₓₓᵧ:te,vₓᵧᵧ:ie,vᵧᵧᵧ:se,vₓₓ:Se,vₓᵧ:Re,vᵧᵧ:Be,vₓ:_r,vᵧ:Pr,v:Qr},errorBound:{vₓₓₓ_:$n,vₓₓᵧ_:ne,vₓᵧᵧ_:ce,vᵧᵧᵧ_:ue,vₓₓ_:ye,vₓᵧ_:Ge,vᵧᵧ_:ze,vₓ_:Mr,vᵧ_:kr,v_:Vr+jr+bi(Qr[1])}}}const Ci=Gt,Ni=nr,Ei=Hn,Ti=Gn,Pi=Ut,{abs:ki}=Math,Ai=Ut,Bi=Hn,zi=Gn,{abs:Fi}=Math,Yi=Gt,Di=nr,Li=Hn,Xi=Gn,qi=Ut,{abs:Wi}=Math,ji=Gt,Hi=nr,Vi=Hn,Qi=Gn,Ri=Ut,{abs:Gi}=Math,Ui=Ut,$i=Hn,Zi=Gn,{abs:Ji}=Math,Ki=Gt,tc=nr,nc=Hn,ec=Gn,rc=Ut,{abs:oc}=Math,ic=Gt,cc=nr,sc=Hn,uc=Gn,fc=Ut,{abs:lc}=Math,ac=Z,pc=lt,hc=nt,dc=at;function vc(t){if(4===t.length)return gc(t);if(3===t.length)return mc(t);if(2===t.length)return xc(t);if(1===t.length)return function(t){const[[n,e]]=t;return[[[n]],[[e]]]}(t);throw new Error("The given bezier curve must be of order <= cubic.")}function gc(t){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[J(ac(s,n),hc(3,ac(r,i))),hc(3,dc(pc(i,n),-2*r)),hc(3,ac(r,n)),[n]].map(Ln),[J(ac(u,e),hc(3,ac(o,c))),hc(3,dc(pc(c,e),-2*o)),hc(3,ac(o,e)),[e]].map(Ln)]}function mc(t){const[[n,e],[r,o],[i,c]]=t;return[[dc(pc(i,n),-2*r),ac(2*r,2*n),[n]],[dc(pc(c,e),-2*o),ac(2*o,2*e),[e]]]}function xc(t){const[[n,e],[r,o]]=t;return[[ac(r,n),[n]],[ac(o,e),[e]]]}const bc=nt,wc=ot;function _c(t){const[[n,[e]],[r,[o]]]=t;if(0!==ct(n)||0!==ct(r))return{vₓ:wc(r),vᵧ:n,v:Ln(it(bc(e,r),bc(o,n)))}}const Mc=nt,Ic=et,Sc=J;function yc(t,n){const e=xc(t),[[r,[o]],[i,[c]]]=xc(n),{vₓ:s,vᵧ:u,v:f}=_c(e),l=Ic(r,s),a=Ic(i,u),p=Sc(l,a),h=Mc(o,s),d=Mc(c,u),v=Sc(h,d);return[p,Sc(v,f)].map(Ln)}const Oc=nt,Cc=Sr,Nc=it,Ec=et,Tc=ot;function Pc(t){const[[n,e,[r]],[o,i,[c]]]=t;if(0===ct(n)&&0===ct(o))return _c([[e,[r]],[i,[c]]]);const s=Ec(n,i),u=Ec(e,o),f=Oc(c,n),l=Oc(r,o),a=Oc(c,e),p=Oc(r,i),h=Ec(n,n),d=Ec(n,o),v=Ec(o,o),g=Nc(s,u),m=Nc(f,l),x=Nc(a,p),b=Ln(Tc(v)),w=Ln(Cc(d)),_=Ln(Tc(h)),M=Ec(i,g),I=Cc(Ec(o,m)),S=Ln(Nc(M,I)),y=Cc(Ec(n,m)),O=Ec(e,g),C=Ln(Nc(y,O)),N=Ec(g,x),E=Ec(m,m);return{vₓₓ:b,vₓᵧ:w,vᵧᵧ:_,vₓ:S,vᵧ:C,v:Ln(Nc(N,E))}}const kc=ne,Ac=nt,Bc=et,zc=J,Fc=Sr;function Yc(t,n){const e=mc(t);if(0===ct(e[0][0])&&0===ct(e[1][0]))return yc([t[0],t[2]],n);const[[r,[o]],[i,[c]]]=xc(n),{vₓₓ:s,vₓᵧ:u,vᵧᵧ:f,vₓ:l,vᵧ:a,v:p}=Pc(e),h=kc(o,o),d=Ac(o,r),v=kc(o,c),g=Ac(o,i),m=Bc(r,r),x=Ac(c,r),b=Bc(r,i),w=kc(c,c),_=Ac(c,i),M=Bc(i,i),I=Bc(m,s),S=Bc(M,f),y=Bc(b,u),O=zc(I,S),C=zc(O,y),N=Bc(d,s),E=Bc(_,f),T=zc(g,x),P=Bc(T,u),k=Fc(zc(N,E)),A=zc(k,P),B=Bc(r,l),z=Bc(i,a),F=zc(B,z),Y=zc(A,F),D=Bc(h,s),L=Bc(v,u),X=Bc(w,f),q=zc(D,L),W=zc(q,X),j=Ac(o,l),H=Ac(c,a),V=zc(j,H),Q=zc(W,V);return[C,Y,zc(Q,p)].map(Ln)}const Dc=et,Lc=Z,Xc=tt,qc=lt;function Wc(t,n=!1){const[e,r,o,i]=t;if(!n){const[t,n]=e,[c,s]=r,[u,f]=o,[l,a]=i;return[e,[rt(it(Xc(qc(c/4,u/4),3),qc(t/4,l/4))),rt(it(Xc(qc(s/4,f/4),3),qc(n/4,a/4)))],i]}const c=function(t,n){const[[e,r],[o,i]]=t,[[c,s],[u,f]]=n,l=Lc(o,e),a=Lc(i,r),p=Lc(u,c),h=Lc(f,s),d=it(Dc(p,a),Dc(h,l));if(0===ct(d))return;const v=Lc(c,e),g=Lc(s,r),m=rt(it(Dc(g,l),Dc(v,a)))/rt(d);return[c+m*rt(p),s+m*rt(h)]}([e,r],[i,o]);if(void 0!==c)return[e,c,i]}const jc=nt,Hc=et,Vc=J,Qc=it,Rc=ot,Gc=Sr;function Uc(t){const[[n,e,r,[o]],[i,c,s,[u]]]=t;if(0===ct(n)&&0===ct(i))return Pc([[e,r,[o]],[c,s,[u]]]);const f=Hc(n,s),l=Hc(r,i),a=Hc(n,c),p=Hc(e,c),h=Hc(e,i),d=Hc(n,n),v=Hc(c,c),g=Hc(i,i),m=Hc(r,n),x=Hc(e,e),b=Hc(s,i),w=Hc(c,i),_=Hc(e,n),M=Hc(n,i),I=jc(u,n),S=jc(o,i),y=jc(u,e),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J;function is(t,n){const e=xc(t),[[r,o,[i]],[c,s,[u]]]=mc(n);if(0===ct(r)&&0===ct(c))return yc(t,[n[0],n[2]]);const{vₓ:f,vᵧ:l,v:a}=_c(e),p=rs(r,f),h=rs(c,l),d=os(p,h),v=rs(o,f),g=rs(s,l),m=os(v,g),x=es(i,f),b=es(u,l),w=os(x,b);return[d,m,os(w,a)].map(Ln)}const cs=ne,ss=nt,us=et,fs=J,ls=Sr;function as(t,n){const e=mc(t);if(0===ct(e[0][0])&&0===ct(e[1][0]))return is([t[0],t[2]],n);const[[r,o,[i]],[c,s,[u]]]=mc(n);if(0===ct(r)&&0===ct(c))return Yc(t,[n[0],n[2]]);const{vₓₓ:f,vₓᵧ:l,vᵧᵧ:a,vₓ:p,vᵧ:h,v:d}=Pc(e),v=cs(i,i),g=ss(i,o),m=ss(i,r),x=cs(i,u),b=ss(i,s),w=ss(i,c),_=us(o,o),M=us(o,r),I=ss(u,o),S=us(o,s),y=us(o,c),O=us(r,s),C=us(r,r),N=ss(u,r),E=us(r,c),T=cs(u,u),P=ss(u,s),k=ss(u,c),A=us(s,s),B=us(s,c),z=us(c,c),F=us(C,f),Y=us(E,l),D=us(z,a),L=fs(F,Y),X=fs(L,D),q=us(M,f),W=us(B,a),j=fs(y,O),H=us(j,l),V=ls(fs(q,W)),Q=fs(V,H),R=fs(ls(m),_),G=fs(ls(k),A),U=fs(w,S),$=fs(U,N),Z=us(R,f),J=us(G,a),K=us($,l),tt=us(r,p),nt=us(c,h),et=fs(Z,J),rt=fs(et,K),ot=fs(tt,nt),it=fs(rt,ot),st=us(g,f),ut=us(P,a),ft=fs(b,I),lt=us(ft,l),at=ls(fs(st,ut)),pt=us(o,p),ht=us(s,h),dt=fs(at,lt),vt=fs(pt,ht),gt=fs(dt,vt),mt=us(v,f),xt=us(x,l),bt=us(T,a),wt=ss(i,p),_t=ss(u,h),Mt=fs(mt,xt),It=fs(Mt,bt),St=fs(wt,_t),yt=fs(It,St);return[X,Q,it,gt,fs(yt,d)].map(Ln)}const ps=ne,hs=nt,ds=et,vs=J,gs=Sr;function ms(t,n){const e=gc(t);if(0===ct(e[0][0])&&0===ct(e[1][0]))return as(Wc(t),n);const[[r,o,[i]],[c,s,[u]]]=mc(n);if(0===ct(r)&&0===ct(c))return ns(t,[n[0],n[2]]);const{vₓₓₓ:f,vₓₓᵧ:l,vₓᵧᵧ:a,vᵧᵧᵧ:p,vₓₓ:h,vₓᵧ:d,vᵧᵧ:v,vₓ:g,vᵧ:m,v:x}=Uc(e),b=ps(i,i),w=hs(i,o),_=hs(i,r),M=ps(i,u),I=hs(i,s),S=hs(i,c),y=ds(o,o),O=ds(o,r),C=hs(u,o),N=ds(o,s),E=ds(o,c),T=ds(r,s),P=ds(r,r),k=hs(u,r),A=ds(r,c),B=ps(u,u),z=hs(u,s),F=hs(u,c),Y=ds(s,s),D=ds(s,c),L=ds(c,c),X=ds(r,f),q=ds(r,a),W=ds(c,l),j=ds(c,p),H=vs(X,W),V=vs(q,j),Q=ds(P,H),R=ds(L,V),G=vs(Q,R),U=vs(_,y),$=vs(F,Y),Z=vs(gs(_),y),J=vs(gs(F),Y),K=vs(gs(N),k),tt=vs(gs(N),S),nt=vs(gs(k),N),et=vs(hs(6,_),y),rt=vs(hs(6,F),Y),ot=vs(E,T),it=vs(S,k),st=vs(gs(C),I),ut=vs(gs(I),C),ft=vs(S,N),lt=vs(ft,k),at=hs(3,P),pt=hs(3,L),ht=ds(at,f),dt=ds(P,l),vt=gs(ds(A,l)),gt=gs(ds(A,a)),mt=ds(L,a),xt=ds(pt,p),bt=vs(ht,vt),wt=vs(dt,gt),_t=vs(bt,mt),Mt=vs(wt,xt),It=ds(o,_t),St=ds(s,Mt),yt=vs(It,St),Ot=ds(c,Z),Ct=ds(c,tt),Nt=ds(r,K),Et=ds(r,J),Tt=ds(hs(3,r),U),Pt=ds(hs(3,c),$),kt=vs(Ot,Nt),At=vs(Ct,Et),Bt=ds(Tt,f),zt=ds(Pt,p),Ft=ds(kt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h),me=vs(ve,v),xe=ds(b,ge),be=ds(B,me),we=ds(M,d),_e=hs(i,g),Me=hs(u,m),Ie=vs(xe,be),Se=vs(Ie,we),ye=vs(_e,Me),Oe=vs(Se,ye);return[G,yt,Qt,dn,Xn,fe,vs(Oe,x)].map(Ln)}const xs=nt,bs=et,ws=J;function _s(t,n){const e=xc(t),[[r,o,i,[c]],[s,u,f,[l]]]=gc(n);if(0===ct(r)&&0===ct(s))return is(t,Wc(n));const{vₓ:a,vᵧ:p,v:h}=_c(e),d=bs(r,a),v=bs(s,p),g=ws(d,v),m=bs(o,a),x=bs(u,p),b=ws(m,x),w=bs(i,a),_=bs(f,p),M=ws(w,_),I=xs(c,a),S=xs(l,p),y=ws(I,S);return[g,b,M,ws(y,h)].map(Ln)}const Ms=ne,Is=nt,Ss=et,ys=J,Os=Sr;function Cs(t,n){const e=mc(t);if(0===ct(e[0][0])&&0===ct(e[1][0]))return _s([t[0],t[2]],n);const[[r,o,i,[c]],[s,u,f,[l]]]=gc(n);if(0===ct(r)&&0===ct(s))return as(t,Wc(n));const{vₓₓ:a,vₓᵧ:p,vᵧᵧ:h,vₓ:d,vᵧ:v,v:g}=Pc(e),m=Ms(c,c),x=Is(c,i),b=Is(c,o),w=Is(c,r),_=Ms(c,l),M=Is(c,f),I=Is(c,u),S=Is(c,s),y=Ss(i,i),O=Ss(i,o),C=Ss(i,r),N=Is(l,i),E=Ss(i,f),T=Ss(i,u),P=Ss(i,s),k=Ss(o,f),A=Ss(o,o),B=Ss(o,r),z=Is(l,o),F=Ss(o,u),Y=Ss(o,s),D=Ss(r,r),L=Is(l,r),X=Ss(r,f),q=Ss(r,u),W=Ss(r,s),j=Ms(l,l),H=Is(l,f),V=Is(l,u),Q=Is(l,s),R=Ss(f,f),G=Ss(f,u),U=Ss(s,s),$=Ss(u,u),Z=Ss(u,s),J=Ss(f,s),K=Ss(D,a),tt=Ss(W,p),nt=Ss(U,h),et=ys(K,tt),rt=ys(et,nt),ot=Ss(B,a),it=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=S+C,P=ei(y,N),k=O+E+ni(T);return{coeffs:[M,ei(P,o)],errBound:[I,k+i+ni(T+d)]}},function(t,n){const{coeffs:{vₓ:e,vᵧ:r,v:o},errorBound:{v_:i}}=ti(t),{coeffs:[[c,s,[,u]],[f,l,[,a]]],errorBound:[[p],[h]]}=Go(n),d=e[1],v=r[1],g=o[1],m=Fi(d),x=Fi(v),b=s[1],w=c[1],_=l[1],M=f[1],I=w*d,S=zi(c,e),y=p*m+2*Fi(I),O=M*v,C=zi(f,r),N=h*x+2*Fi(O),E=I+O,T=Ai(S,C),P=y+N+Fi(E),k=b*d,A=zi(s,e),B=2*Fi(k),z=_*v,F=zi(l,r),Y=2*Fi(z),D=k+z,L=Ai(A,F),X=B+Y+Fi(D),q=Bi(u,e),W=u*d,j=Fi(W),H=Bi(a,r),V=a*v,Q=Fi(V),R=W+V,G=Ai(q,H),U=j+Q+Fi(R),$=R+g;return{coeffs:[T,L,Ai(G,o)],errBound:[P,X,U+i+Fi($)]}},function(t,n){const{coeffs:{vₓ:e,vᵧ:r,v:o},errorBound:{v_:i}}=ti(t),{coeffs:[[c,s,u,[,f]],[l,a,p,[,h]]],errorBound:[[d,v,g],[m,x,b]]}=Ro(n),w=Ji(e[1]),_=Ji(r[1]),M=Zi(c,e),I=d*w+2*Ji(M[1]),S=Zi(l,r),y=m*_+2*Ji(S[1]),O=Ui(M,S),C=I+y+Ji(O[1]),N=Zi(s,e),E=v*w+2*Ji(N[1]),T=Zi(a,r),P=x*_+2*Ji(T[1]),k=Ui(N,T),A=E+P+Ji(k[1]),B=Zi(u,e),z=g*w+2*Ji(B[1]),F=Zi(p,r),Y=b*_+2*Ji(F[1]),D=Ui(B,F),L=z+Y+Ji(D[1]),X=$i(f,e),q=Ji(X[1]),W=$i(h,r),j=Ji(W[1]),H=Ui(X,W),V=q+j+Ji(H[1]),Q=Ui(H,o);return{coeffs:[O,k,D,Q],errBound:[C,A,L,V+i+Ji(Q[1])]}}],[function(t,n){const{coeffs:{v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ti,m),ri=Ts(_,ni),oi=Ts(R,ei),ii=Ps(ri,oi),ci=Ts(y,g),si=Ps(ii,ci),ui=Es(c,x),fi=Es(l,b),li=Ps(ui,fi),ai=Ps(si,li);return[dt,Ct,Jt,zn,be,Ke,qr,So,Go,Ps(ai,w)].map(Ln)}]];function zs(t,n){const{coeffs:e,errBound:r}=As[t.length-2][n.length-2](t,n);return{coeffs:e,errBound:r,getPExact:()=>Bs[t.length-2][n.length-2](t,n)}}const Fs=134217729;function Ys(t,n){const e=t[0],r=t[1],o=n[0],i=n[1],c=r/i,s=i*c,u=Fs*i,f=u-(u-i),l=i-f,a=Fs*c,p=a-(a-c),h=c-p,d=o*c,v=s+d,g=d-(v-s)+(l*h-(s-f*p-l*p-f*h)),m=v+g,x=(r-m+(e-(g-(m-v))))/i,b=c+x;return[x-(b-c),b]}const Ds=Ys,Ls=Number.EPSILON/2,Xs=Ls*Ls,qs=$t,Ws=$t,js=Gn,Hs=Ut,Vs=$t,Qs=tr,Rs=qo;function Gs(t,n){if(0===n[0]&&0===n[1])return t[0].map(t=>[0,t]);if(0===n[0]&&1===n[1])return t[t.length-1].map(t=>[0,t]);if(4===t.length){const[[e,r],[o,i],[c,s],[u,f]]=t,l=Rs(js(Qs(o,e),n),e),a=Rs(js(Qs(c,o),n),o),p=Rs(js(Qs(u,c),n),c),h=Hs(l,js(Vs(a,l),n)),d=Hs(a,js(Vs(p,a),n)),v=Hs(h,js(Vs(d,h),n)),g=Rs(js(Qs(i,r),n),r),m=Rs(js(Qs(s,i),n),i),x=Rs(js(Qs(f,s),n),s),b=Hs(g,js(Vs(m,g),n)),w=Hs(m,js(Vs(x,m),n));return[v,Hs(b,js(Vs(w,b),n))]}if(3===t.length){const[[e,r],[o,i],[c,s]]=t,u=Hs([0,e],js(Qs(o,e),n)),f=Hs([0,o],js(Qs(c,o),n)),l=Hs(u,js(Vs(f,u),n)),a=Hs([0,r],js(Qs(i,r),n)),p=Hs([0,i],js(Qs(s,i),n));return[l,Hs(a,js(Vs(p,a),n))]}if(2===t.length){const[[e,r],[o,i]]=t;return[Rs(js(Qs(o,e),n),e),Rs(js(Qs(i,r),n),r)]}if(1===t.length){const[n,e]=t[0];return[[0,n],[0,e]]}throw new Error("The given bezier curve must be of order <= 3.")}const{abs:Us}=Math,$s=[0,1],Zs=$t,Js=qo,Ks=Ut,tu=Gn,nu=Hn,eu=nr,ru=function(t,n,e,r){const o=t[0],i=t[1],c=n[0],s=n[1],u=Ds(t,n),f=Math.abs(o+i),l=Math.abs(c+s),a=l-Ls*l-r;return a<=0?{est:u,err:Number.POSITIVE_INFINITY}:{est:u,err:(l*e+f*r)/a**2+9*Xs*Math.abs(f/l)}},ou=function(t,n){return qs(t,n)[1]>0?n:t},iu=function(t,n){return Ws(t,n)[1]>0?t:n};function cu(t,n){return n[0][0]!==n[1][0]||n[0][1]!==n[1][1]?4===t.length?function([[t,n],[e,r],[o,i],[c,s]],[u,f]){const l=Zs(f,u),a=3*We*Us(l[1]),p=Zs($s,u),h=3*We*Us(p[1]),d=ru(l,p,a,h);f=Js(d.est,d.err);const v=Zs($s,u),g=tu(u,u),m=tu(u,v),x=tu(v,v),b=tu(g,u),w=tu(g,v),_=tu(x,u),M=tu(x,v),I=Zs($s,f),S=tu(f,f),y=tu(f,I),O=tu(I,I),C=tu(S,f),N=tu(S,I),E=tu(O,f),T=tu(O,I),P=Us(u[1]),k=Us(v[1]),A=Us(g[1]),B=Us(m[1]),z=Us(x[1]),F=Us(b[1]),Y=Us(w[1]),D=Us(_[1]),L=Us(M[1]),X=Us(f[1]),q=Us(I[1]),W=Us(S[1]),j=Us(y[1]),H=Us(O[1]),V=Us(C[1]),Q=Us(N[1]),R=Us(E[1]),G=Us(T[1]);let U=Us(t),$=Us(n),Z=Us(e),J=Us(r),K=Us(o),tt=Us(i),nt=Us(c),et=Us(s);const rt=Ks(nu(c,u),nu(o,v)),ot=Ks(Ks(nu(c,g),nu(2*o,m)),nu(e,x)),it=Ks(Ks(nu(c,b),nu(t,M)),nu(3,Ks(nu(o,w),nu(e,_)))),ct=Ks(tu(ot,f),tu(it,I)),st=Ks(Ks(tu(rt,S),tu(it,O)),tu(eu(ot),y)),ut=Ks(Ks(nu(c,C),tu(it,T)),nu(3,Ks(tu(rt,N),tu(ot,E)))),ft=Us(it[1]),lt=nt*P+K*k,at=nt*A+2*K*B+Z*z;U=nt*F+U*L+3*(K*Y+Z*D),Z=at*X+ft*q,K=lt*W+ft*H+2*at*j,nt=nt*V+ft*G+3*(lt*Q+at*R),U*=11*We,Z*=15*We,K*=20*We,nt*=22*We;const pt=Ks(nu(s,u),nu(i,v)),ht=Ks(Ks(nu(s,g),nu(2*i,m)),nu(r,x)),dt=Ks(Ks(nu(s,b),nu(n,M)),nu(3,Ks(nu(i,w),nu(r,_)))),vt=Ks(tu(ht,f),tu(dt,I)),gt=Ks(Ks(tu(pt,S),tu(dt,O)),tu(eu(ht),y)),mt=Ks(Ks(nu(s,C),tu(dt,T)),nu(3,Ks(tu(pt,N),tu(ht,E)))),xt=Us(dt[1]),bt=et*P+tt*k,wt=et*A+2*tt*B+J*z;$=et*F+$*L+3*(tt*Y+J*D),J=wt*X+xt*q,tt=bt*W+xt*H+2*wt*j,et=et*V+xt*G+3*(bt*Q+wt*R),$*=11*We,J*=15*We,tt*=20*We,et*=22*We;const _t=ou(ou(Js(it,-U),Js(ct,-Z)),ou(Js(st,-K),Js(ut,-nt))),Mt=iu(iu(Js(it,+U),Js(ct,+Z)),iu(Js(st,+K),Js(ut,+nt)));return[[_t,ou(ou(Js(dt,-$),Js(vt,-J)),ou(Js(gt,-tt),Js(mt,-et)))],[Mt,iu(iu(Js(dt,+$),Js(vt,+J)),iu(Js(gt,+tt),Js(mt,+et)))]]}(t,n):3===t.length?function([[t,n],[e,r],[o,i]],[c,s]){const u=Zs(s,c),f=3*We*Us(u[1]),l=Zs($s,c),a=3*We*Us(l[1]),p=ru(u,l,f,a);s=Js(p.est,p.err);const h=Zs($s,c),d=tu(c,c),v=tu(c,h),g=tu(h,h),m=Zs($s,s),x=tu(s,s),b=tu(s,m),w=tu(m,m),_=Us(c[1]),M=Us(h[1]),I=Us(d[1]),S=Us(v[1]),y=Us(g[1]),O=Us(s[1]),C=Us(m[1]),N=Us(x[1]),E=Us(b[1]),T=Us(w[1]);let P=Us(t),k=Us(n),A=Us(e),B=Us(r),z=Us(o),F=Us(i);const Y=Ks(Ks(nu(o,d),nu(2*e,v)),nu(t,g)),D=Ks(nu(o,c),nu(e,h)),L=Y,X=Ks(tu(s,D),tu(m,Y)),q=Ks(Ks(nu(o,x),tu(eu(b),D)),tu(w,Y)),W=z*I+2*A*S+P*y,j=z*_+A*M;P=W,A=O*j+C*W,z=N*o+2*E*j+T*W,P*=7*We,A*=11*We,z*=14*We;const H=Ks(Ks(nu(i,d),nu(2*r,v)),nu(n,g)),V=Ks(nu(i,c),nu(r,h)),Q=H,R=Ks(tu(s,V),tu(m,H)),G=Ks(Ks(nu(i,x),tu(eu(b),V)),tu(w,H)),U=F*I+2*B*S+k*y,$=F*_+B*M;k=U,B=O*$+C*U,F=N*i+2*E*$+T*U,k*=7*We,B*=11*We,F*=14*We;const Z=ou(ou(Js(L,-P),Js(X,-A)),Js(q,-z)),J=iu(iu(Js(L,+P),Js(X,+A)),Js(q,+z));return[[Z,ou(ou(Js(Q,-k),Js(R,-B)),Js(G,-F))],[J,iu(iu(Js(Q,+k),Js(R,+B)),Js(G,+F))]]}(t,n):function([[t,n],[e,r]],[o,i]){const c=Zs(i,o),s=3*We*Us(c[1]),u=Zs($s,o),f=3*We*Us(u[1]),l=ru(c,u,s,f);i=Js(l.est,l.err);const a=Zs($s,o),p=Zs($s,i),h=Us(o[1]),d=Us(a[1]),v=Us(i[1]),g=Us(p[1]);let m=Us(t),x=Us(n),b=Us(e),w=Us(r);const _=Ks(nu(e,o),nu(t,a)),M=Ks(nu(e,i),tu(_,p));m=b*h+m*d,b=b*v+m*g,m*=3*qe,b*=7*qe;const I=Ks(nu(r,o),nu(n,a)),S=Ks(nu(r,i),tu(I,p));x=w*h+x*d,w=w*v+x*g,x*=3*qe,w*=7*qe;const y=ou(Js(_,-m),Js(M,-b)),O=iu(Js(_,+m),Js(M,+b));return[[y,ou(Js(I,-x),Js(S,-w))],[O,iu(Js(I,+x),Js(S,+w))]]}(t,n):function(t,n){const e=t[0],r=t[t.length-1];if(0===n[0]&&0===n[1]){const t=[0,e[0]],n=[0,e[1]];return[[t,n],[t,n]]}if(0===n[0]&&1===n[1]){const t=[0,r[0]],n=[0,r[1]];return[[t,n],[t,n]]}const o=Gs(t,n);let i;if(4===t.length)i=Le(t,n).map(t=>16*He*t);else if(3===t.length)i=Le(t,n).map(t=>10*He*t);else if(2===t.length)i=Le(t,n).map(t=>4*He*t);else if(1===t.length)return[o,o];return[[Js(o[0],-i[0]),Js(o[1],-i[1])],[Js(o[0],+i[0]),Js(o[1],+i[1])]]}(t,n[0])}function su(t){return(n,e)=>{let[[r,o],[i,c]]=n,[[s,u],[f,l]]=e;return(o[1]>c[1]||o[1]===c[1]&&o[0]>c[0])&&([o,c]=[c,o]),(u[1]>l[1]||u[1]===l[1]&&u[0]>l[0])&&([u,l]=[l,u]),(r[1]>i[1]||r[1]===i[1]&&r[0]>i[0])&&([r,i]=[i,r]),(s[1]>f[1]||s[1]===f[1]&&s[0]>f[0])&&([s,f]=[f,s]),t?(r[1]<f[1]||r[1]===f[1]&&r[0]<=f[0])&&(i[1]>s[1]||i[1]===s[1]&&i[0]>=s[0])&&(u[1]<c[1]||u[1]===c[1]&&u[0]<=c[0])&&(l[1]>o[1]||l[1]===o[1]&&l[0]>=o[0]):(r[1]<f[1]||r[1]===f[1]&&r[0]<f[0])&&(i[1]>s[1]||i[1]===s[1]&&i[0]>s[0])&&(u[1]<c[1]||u[1]===c[1]&&u[0]<c[0])&&(l[1]>o[1]||l[1]===o[1]&&l[0]>o[0])}}function uu(t){return[((n=t.x.box)[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2];var n}function fu(t,n){const e=zs(t,n);if(void 0===e)return;const{coeffs:r,errBound:o,getPExact:i}=e,c=Fe(r,0,1,o,i)||[];return 0!==c.length?{ris:c.map(Xo),getPExact:i}:void 0}function lu(t){const n=rt(t.tS);return{t:n,tS:n,tE:rt(t.tE),multiplicity:t.multiplicity}}function au(t,n){const e=fu(t,n);if(void 0===e)return[];const{getPExact:r}=e;let o,{ris:i}=e;const c=()=>(o=o||r(),o),s=fu(n,t);if(void 0===s)return[];let{ris:u}=s;const{getPExact:f}=s;let l;const a=()=>(l=l||f(),l);let p;p=1;let h,d=0;t:for(;d<p;){h=u.map(n=>cu(t,[n.tS,n.tE]));for(let t=0;t<u.length;t++){const n=h[t];for(let e=t+1;e<u.length;e++){const t=h[e];if(su(!0)(n,t)){const t=[];for(const n of u)t.push(...Zr({t:n.tS[1],tS:n.tS[1],tE:n.tE[1],multiplicity:n.multiplicity},a()));u=t,d++;continue t}}}break t}p=1;let v,g=0;t:for(;g<p;){v=i.map(t=>cu(n,[t.tS,t.tE]));for(let t=0;t<i.length;t++){const n=v[t];for(let e=t+1;e<i.length;e++){const t=v[e];if(su(!0)(n,t)){const t=[];for(const n of i)t.push(...Zr({t:n.tS[1],tS:n.tS[1],tE:n.tE[1],multiplicity:n.multiplicity},c()));i=t,g++;continue t}}}break t}const m=[];for(let t=0;t<u.length;t++){const n=h[t];for(let e=0;e<i.length;e++){const o=v[e];if(su(!0)(n,o)){const c={compensated:d,ri:lu(u[t]),riExp:d?u[t]:void 0,getPExact:d?void 0:f,kind:1,box:pu(n)},s={compensated:g,ri:lu(i[e]),riExp:g?i[e]:void 0,getPExact:g?void 0:r,kind:1,box:pu(o)};m.push({psX:c,sideX:s})}}}return m}function pu(t){return t.map(t=>t.map(rt))}function hu(t,n){return function(t,n){const e=t.xs,r=[],o=new Map;for(const t of e){const n=t.curve,e=o.get(n);e?e.push(t):o.set(n,[t])}const i=function(t){const[[n,e],[r,o]]=t.box,i=[[[r,e],[n,e]],[[n,e],[n,o]],[[n,o],[r,o]],[[r,o],[r,e]]];return(n,e,r)=>{const o=n.ps,c=e.slice();for(let t=0;t<i.length;t++){const n=au(o,i[t]);for(const{psX:e,sideX:r}of n)c.push({x:e,side:t,sideX:r,curve:void 0})}c.sort((t,n)=>t.x.ri.tS-n.x.ri.tS);const s=[],u=[];let f,l;for(const n of c)void 0!==n.side?(!0===l&&(u.push({idx:++r,dir:1,p:uu(n),_x_:f,container:t,side:n.side,sideX:n.sideX,loopsIdxs:new Set,children:new Set,windingNum:0,orientation:0}),f.out=u[u.length-1]),l=!1):(!1===l&&(s.push({idx:++r,dir:-1,p:uu(f),_x_:n,container:t,side:f.side,sideX:f.sideX,loopsIdxs:new Set,children:new Set,windingNum:0,orientation:0}),n.in_=s[s.length-1]),l=!0),f=n;return{ins:s,outs:u,ioIdx:r}}}(t);for(const t of o){const[e,o]=t;let c,s;({ins:c,outs:s,ioIdx:n}=i(e,o,n)),r.push(...c),r.push(...s)}return{inOuts:r,ioIdx:n}}(t,n)}function du(t,n,e,r){const o=[];for(const r of t)o.push({type:-1,item:r,x:n(r)}),o.push({type:1,item:r,x:e(r)});o.sort(vu);const i=new Set,c=[];for(const t of o){const{item:n,type:e}=t;if(-1===e){for(const t of i){const e=r(n,t);e&&c.push({a:n,b:t,u:e})}i.add(n)}else 1===e&&i.delete(n)}return c}function vu(t,n){const e=t.x-n.x;return 0!==e?e:t.type}function gu(t,n,e){const r=(t[0]-e[0])*(n[1]-e[1]),o=(t[1]-e[1])*(n[0]-e[0]),i=r-o;let c;if(r>0){if(o<=0)return i;c=r+o}else{if(!(r<0))return i;if(o>=0)return i;c=-r-o}return Math.abs(i)>=3330669073875472e-31*c?i:function(t,n,e,r){const o=t[0]-e[0],i=n[0]-e[0],c=t[1]-e[1],s=n[1]-e[1],u=it(ne(o,s),ne(c,i));let f=rt(u);if(Math.abs(f)>=2220446049250315e-31*r)return f;const l=Z(t[0],e[0])[0],a=Z(n[0],e[0])[0],p=Z(t[1],e[1])[0],h=Z(n[1],e[1])[0];if(0===l&&0===p&&0===a&&0===h)return f;const d=1109335647967049e-46*r+3330669073875471e-31*Math.abs(f);if(f+=o*h+s*l-(c*a+i*p),Math.abs(f)>=d)return f;const v=J(u,it(ne(l,s),ne(p,i))),g=J(v,it(ne(o,h),ne(c,a)));let m=J(g,it(ne(l,h),ne(p,a)));return m=Ln(m),m[m.length-1]}(t,n,e,c)}function mu(t,n){const e=n[0]-t[0],r=n[1]-t[1];return e*e+r*r}function xu(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];return r*(e[0]-n[0])+o*(e[1]-n[1])}const bu=function(t,n){if(0===t.length)return;const e=t.slice(),r=function(t){let n,e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;r<t.length;r++){const o=t[r][1];(o<e[1]||o===e[1]&&t[r][0]<e[0])&&(n=r,e=t[r])}return n}(e),[o]=e.splice(r,1);e.sort((t,n)=>{let e=-gu(o,t,n);return 0!==e?e:(e=t[1]-n[1],0!==e?e:t[0]-n[0])}),e.unshift(o);const i=function(t){const n=[t[0]],e=t.length;for(let r=1;r<t.length;r++){const o=t[(r+e-1)%e],i=t[r];o[0]===i[0]&&o[1]===i[1]||n.push(i)}return n}(e),c=[];for(const t of i){for(;c.length>=2&&gu(c[c.length-2],c[c.length-1],t)<0;)c.pop();c.push(t)}if(n||c.length<3)return c;const s=[];{const t=c.length;for(let n=0;n<t;n++){const e=(n+1)%t,r=c[(n+t-1)%t],o=c[n],i=c[e];(0!==gu(r,o,i)||xu(r,o,i)<0)&&s.push(o)}}return s},wu=Ut,_u=et,Mu=J,Iu=Gn,{abs:Su}=Math;const{abs:yu}=Math;const{abs:Ou}=Math,Cu=Gn,Nu=Ut,Eu=et,Tu=J,{abs:Pu}=Math;function ku(t,n){const[e,r]=n,o=e.length,i=r.length,c=e[o-1],s=r[i-1],u=1===o&&1===i;{const{vₓₓ:n,vₓᵧ:e,vᵧᵧ:r,vₓ:o,vᵧ:i,v:f}=function(t){const[[n,e,r],[o,i,c]]=l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(W[1]),H=Nu(W,F),V=j+Y+Pu(H[1]),Q=Nu(D,X),R=L+q+Pu(Q[1]),G=Nu(H,Q),U=V+R+Pu(G[1]),$=Nu(G,l),Z=U+g+Pu($[1]);if(He*Z<Pu(rt($)))return!1}{const n=function(t){return Pc(mc(t))}(t);if(void 0===n)return u&&c===t[0][0]&&s===t[0][1];n.hasOwnProperty("vₓₓ")||(n.vₓₓ=[0],n.vₓᵧ=[0],n.vᵧᵧ=[0]);const{vₓₓ:o,vₓᵧ:i,vᵧᵧ:f,vₓ:l,vᵧ:a,v:p}=n;return 0===ct(Tu(Tu(Tu(Eu(o,Eu(e,e)),Eu(i,Eu(e,r))),Eu(f,Eu(r,r))),Tu(Tu(Eu(e,l),Eu(r,a)),p)))}}const{abs:Au}=Math,Bu=Gn,zu=Ut,Fu=et,Yu=J,{abs:Du}=Math;function Lu(t,n){const[e,r]=n,o=e.length,i=r.length,c=e[o-1],s=r[i-1],u=1===o&&1===i;{const{vₓₓₓ:n,vₓₓᵧ:e,vₓᵧᵧ:r,vᵧᵧᵧ:o,vₓₓ:i,vₓᵧ:f,vᵧᵧ:l,vₓ:a,vᵧ:p,v:h}=function(t){const[[n,e,r,o],[i,c,s,u]]=fo(t),f=n*s,l=r*i,a=n*c,p=e*i,h=n*n,d=i*i,v=n*u-o*i,g=f-l,m=a-p,x=e*u-o*c,b=e*s-r*c,w=r*u-o*s,_=2*g,M=v*v,I=v*b,S=_*x,y=m*x,O=-3*v-b,C=-3*M-2*I+(S+m*w),N=2*(v*g-y),E=v*m-g*g+m*b;return{vₓₓₓ:-i*d,vₓₓᵧ:3*n*d,vₓᵧᵧ:-3*i*h,vᵧᵧᵧ:n*h,vₓₓ:O*d+m*(s*i-c*c)+_*c*i,vₓᵧ:2*(m*(e*c-(l+f)/2)-(O*n*i+g*(p+a))),vᵧᵧ:O*h+m*(r*n-e*e)+_*e*n,vₓ:i*C+(c*N+s*E),vᵧ:-n*C-(e*N+r*E),v:v*(S-M-I)+(E*w-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kt+Ft+Du(Yt[1]);if(He*Dt<Du(rt(Yt)))return!1}{const n=function(t){return Uc(gc(t))}(t);if(void 0===n)return u&&c===t[0][0]&&s===t[0][1];n.hasOwnProperty("vₓₓₓ")||(n.vₓₓₓ=[0],n.vₓₓᵧ=[0],n.vₓᵧᵧ=[0],n.vᵧᵧᵧ=[0]),n.hasOwnProperty("vₓₓ")||(n.vₓₓ=[0],n.vₓᵧ=[0],n.vᵧᵧ=[0]);const{vₓₓₓ:o,vₓₓᵧ:i,vₓᵧᵧ:f,vᵧᵧᵧ:l,vₓₓ:a,vₓᵧ:p,vᵧᵧ:h,vₓ:d,vᵧ:v,v:g}=n,m=Fu(e,e),x=Fu(e,m),b=Fu(r,r),w=Fu(r,b),_=Fu(r,m),M=Fu(e,b),I=Fu(e,r),S=Fu(o,x),y=Fu(i,_),O=Fu(f,M),C=Fu(l,w),N=Fu(a,m),E=Fu(p,I),T=Fu(h,b),P=Fu(e,d),k=Fu(r,v),A=Yu(S,y),B=Yu(O,C),z=Yu(A,B),F=Yu(N,E),Y=Yu(F,T),D=Yu(z,Y),L=Yu(P,k),X=Yu(L,g);return 0===ct(Yu(D,X))}}function Xu(t,n){const{coeffs:e,errBound:r,getPExact:o}=zs(t,n);return Fe(e,0,1,r,o)}const{min:qu,max:Wu}=Math;function ju(t,n){let[[e,r],[o,i]]=t,[[c,s],[u,f]]=n;if(e>o&&([e,o]=[o,e]),c>u&&([c,u]=[u,c]),r>i&&([r,i]=[i,r]),s>f&&([s,f]=[f,s]),e<=u&&o>=c&&s<=i&&f>=r)return[[Wu(e,c),Wu(r,s)],[qu(o,u),qu(i,f)]]}function Hu(t,n,e){if(void 0===e)return;if(0===e.length)return[];const r=Xu(n,t);if(void 0===r)return;if(0===r.length)return[];const o=r.map(n=>$e(t,[n.tS,n.tE])),i=e.map(t=>$e(n,[t.tS,t.tE])),c=[];for(let t=0;t<r.length;t++){const n=o[t];for(let o=0;o<e.length;o++){const s=ju(n,i[o]);if(void 0!==s){const n={ri:r[t],box:s,kind:1},i={ri:e[o],box:s,kind:1};c.push([n,i])}}}return c}function Vu(t,n,e){for(const r of[t,n]){const o=r.length;for(let i=1;i<o+1;i++){const c=r[i-1],s=r[i%o],u=[s[1]-c[1],c[0]-s[0]];let f=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let n=0;n<t.length;n++){const e=u[0]*t[n][0]+u[1]*t[n][1];e<f&&(f=e),e>l&&(l=e)}let a=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY;for(let t=0;t<n.length;t++){const e=u[0]*n[t][0]+u[1]*n[t][1];e<a&&(a=e),e>p&&(p=e)}if(e&&(l<a||p<f))return!1;if(!e&&(l<=a||p<=f))return!1}}return!0}const Qu=ne,Ru=J,{abs:Gu}=Math;function Uu(t){const[[n,e],[r,o],[i,c],[s,u]]=t,f=s+3*r,l=n+3*i,a=f-l,p=Gu(3*r)+Gu(f)+(Gu(3*i)+Gu(l))+Gu(a);if(Gu(a)-qe*p>0)return!1;const h=u+3*o,d=e+3*c,v=h-d,g=Gu(3*o)+Gu(h)+(Gu(3*c)+Gu(d))+Gu(v);return!(Gu(v)-qe*g>0)&&0===ct(it(Ru([s],Qu(3,r)),Ru([n],Qu(3,i))))&&0===ct(it(Ru([u],Qu(3,o)),Ru([e],Qu(3,c))))}const $u=lt,{abs:Zu}=Math;function Ju(t){const[[n,e],[r,o],[i,c]]=t,s=n+i,u=s-2*r,f=Zu(s)+Zu(u);if(Zu(u)-f>0)return!1;const l=e+c,a=l-2*o,p=Zu(l)+Zu(a);return!(Zu(a)-p>0)&&0===ct(it($u(n,i),[2*r]))&&0===ct(it($u(e,c),[2*o]))}function Ku(t){const n=t[0][0],e=t[0][1];for(let r=1;r<t.length;r++)if(n!==t[r][0]||e!==t[r][1])return!1;return!0}function tf(t){return 4===t.length&&Uu(t)&&(t=Wc(t)),3===t.length&&Ju(t)&&(t=[t[0],t[2]]),2===t.length&&Ku(t)&&(t=[t[0]]),t}const nf=Number.EPSILON,ef=nf/2;function rf(t,n){return n<0?t<1?t:1-ef:0===n?1:t>1?t:1+nf}function of(t){const n=function(t){const n=new ArrayBuffer(8);return new DataView(n).setFloat64(0,t,!1),Array.from(new Uint8Array(n))}(t),e=n[0],r=n[1],o=e>>7,i=((127&e)<<4)+((240&r)>>4),c=0===i?0:16,s=0===i?i-1022:i-1023,u=n.slice(1);return u[0]=(15&r)+c,{sign:o,exponent:s,significand:u}}function cf(t){return of(t).significand}function sf(t){return Math.log2(t&-t)}function uf(t){if(0===t||!Number.isFinite(t))return NaN;const n=cf(t),e=n.length;for(let t=e-1;t>=0;t--){if(0===n[t])continue;const r=sf(n[t]);if(Number.isFinite(r))return 8*(e-t-1)+r}return NaN}function ff(t){return t>=128?7:t>=64?6:t>=32?5:t>=16?4:t>=8?3:t>=4?2:t>=2?1:t>=1?0:NaN}function lf(t){if(0===t||!Number.isFinite(t))return NaN;const n=cf(t),e=n.length;for(let t=0;t<e;t++){const r=ff(n[t]);if(Number.isFinite(r))return 8*(e-t-1)+r}return NaN}function af(t){return of(t).exponent}function pf(t){if(0===t||!Number.isFinite(t))return NaN;const n=af(t);return lf(t)-52+n}function hf(t,n){const e=(2**(53-n)+1)*t;return e-(e-t)}function df(t,n){if(0===ct(t=Ln(t)))return[0];const e=pf(t[t.length-1]);let r=e,o=t.length-1;for(;o>0;){const i=pf(t[o-1]);if(e-i>n)break;r=i,o--}const i=Math.min(n-(e-r),53);let c=t[o];c=hf(c,i);const s=t.slice(o);return s[0]=c,s}function vf(t){return 0===t?0:lf(t)-uf(t)+1}function gf(t){const n=Ln(t);if(0===ct(n))return 0;const e=n[n.length-1],r=n[0];return af(e)-af(r)+(53-uf(r))}function mf(t){return rt(function(t,n,e){let r=n,o=t,i=!1,c=0;e||(c=gf(o)-gf(r)+1,e=c/53+1,i=!0);let s=[1/rt(r)],u=1;for(;;){if(o=et(o,s),u>e)return i?(o=df(o,c),o):o.slice(o.length-e,o.length);r=et(r,s),s=it([2],r),u*=2}}(t[0],t[1],2))}function xf(t){return ct(t[0])*ct(t[1])}function bf(t){return(n,e)=>{const r=vc(n),o=vc(e),i=vc(n.slice().reverse()),c=vc(e.slice().reverse()),s=t(r,o),u=t(i,o),f=t(r,c),l=t(i,c),a=-xf(u),p=-xf(l),h=mf(s),d=mf(f);return[rf(h,a),rf(d,p)]}}const wf=bf(function(t,n){const e=0===ct(t[0][0])?1:0;return function(t,n){const[e,r]=t,[,o]=n;return[it(o,r),e]}(t[e],n[e])});function _f(t,n){return Jr(et(t[0],n[1]),et(t[1],n[0]))*ct(t[1])*ct(n[1])}function Mf(t){let n=-1024;for(let e=0;e<t.length;e++){const r=t[e];for(let t=0;t<r.length;t++){const e=r[t];if(0===e)continue;const o=-af(e)+vf(e)-1;o>n&&(n=o)}}return 0===n?t.map(t=>t.map(t=>BigInt(t))):n>0?t.map(t=>t.map(t=>{if(0===t)return 0n;const e=-af(t)+vf(t)-1;return BigInt(t*2**e)*2n**BigInt(n-e)})):t.map(t=>t.map(t=>BigInt(t*2**n)))}function If(t,n){if(n=n<0n?-n:n,0n===(t=t<0n?-t:t))return n;if(0n===n)return t;for(;0n!==n;){const e=n;n=t%n,t=e}return t}const Sf=BigInt(2**53);function yf(t){if(0n===t)return[0];const n=[];let e=0,r=t;for(;0n!==r;){r=t/Sf;const o=t%Sf;n.push(Number(o)*2**(53*e)),t=r,e++}return Ln(n)}const{round:Of,sqrt:Cf}=Math;function Nf(t){if(t<=1n){if(t<0n)throw new Error("square root of negative numbers are not allowed");return t}let n=BigInt(Of(Cf(Number(t))));for(;;){const e=n+t/n>>1n;if(e===n)return n;n=e}}function Ef(t){return t<0n?-t:t}function Tf(t){let n=0n;for(let e=0;e<t.length;e++)n+=t[e];return n}function Pf(t,n){const[e,r]=kf(t[0],n[0]),[o,i]=kf(t[1],n[1]);if(0===_f(e,o)||0===_f(e,i))return e;if(0===_f(r,o)||0===_f(r,i))return r;throw new Error("An unexpected error occured.")}function kf(t,n){const[e,r]=t,[o,i]=n,[c,s]=function(t){const[n,e]=Mf(t).map(Tf),r=If(n,e);return[yf(Nf(Ef(n/r))),yf(Nf(Ef(e/r)))]}([o,e]);return[[it(et(i,s),et(r,c)),et(c,Sr(e))],[it(et(i,ot(s)),et(r,c)),et(c,Sr(e))]].sort(_f)}function Af(t,n){const e=vc(t),r=0===ct(e[0][0])?0:0===ct(e[1][0])?1:-1;if(-1!==r){const e=t[0][r],o=t[2][r],i=n[0][r],c=n[2][r];return wf([[e,e],[o,o]],[[i,i],[c,c]])}return bf(Pf)(t,n)}const{round:Bf,cbrt:zf}=Math;function Ff(t){const n=(e=t)>0n?1n:e<0n?-1n:0n;var e;if((t=Ef(t))<=1n)return n*t;let r=BigInt(Bf(zf(Number(t))));for(;;){const e=(2n*r+t/(r*r))/3n;if(e===r)return n*r;r=e}}function Yf(t){return et(t,t)}const Df=bf(function(t,n){const e=0===ct(t[0][0])?1:0;return function(t,n){const[e,r]=t,[o,i]=n,c=function(t){const[n,e]=Mf(t).map(Tf),r=If(n,e);return[yf(Ff(n/r)),yf(Ff(e/r))]}([o,e]),s=Yf(c[0]);return[it(et(i,Yf(c[1])),et(r,s)),et(nt(3,e),s)]}(t[e],n[e])}),{EPSILON:Lf}=Number,Xf=Lf/2+Lf**2/2;function qf(t){return t>0?t-t*Xf:t+t*Xf}const{EPSILON:Wf}=Number,jf=Wf/2+Wf**2/2;function Hf(t){return t>0?t+t*jf:t-t*jf}function Vf(t){if(0===t||1===t)return[t,t];const n=qf(qf(t)),e=function(t){return Hf(Hf(t))}(t);return[n,e]}function Qf(t,n,e,r){const o=t.ps,i=n.ps,c=[];let s=Xu(o,i);if(void 0===s){const r=2**(e-47),s=function(t,n,e=!1){e||(t=tf(t),n=tf(n));const r=[,,wf,Af,Df],[o,i]=r[t.length](t,n),[c,s]=r[t.length](n,t),u=[{tA:o,tB:0,bez:"B",start:!0},{tA:i,tB:1,bez:"B",start:!1},{tA:0,tB:c,bez:"A",start:!0},{tA:1,tB:s,bez:"A",start:!1}].sort((t,n)=>t.tA-n.tA);if(u[1].tA===u[2].tA){const n=u[1],e=n.tA,r=n.tB,o=$e(t,[e,e]);return[{p:o[0],kind:4,box:o,t1:e,ri1:{t:e,tS:e,tE:e,multiplicity:1},t2:r,ri2:{t:r,tS:r,tE:r,multiplicity:1}}]}if(u[0].bez===u[1].bez)return[];const f=u[1],l=u[2],[a,p]=Vf(f.tA),[h,d]=Vf(f.tB),[v,g]=Vf(l.tA),[m,x]=Vf(l.tB),b=$e(t,[a,p]),w=$e(n,[h,d]),_=$e(t,[v,g]),M=$e(n,[m,x]),I=ju(b,w),S=ju(_,M),y={t:a,tS:a,tE:p,multiplicity:1},O={t:h,tS:h,tE:d,multiplicity:1},C={t:v,tS:v,tE:g,multiplicity:1},N={t:m,tS:m,tE:x,multiplicity:1};return[{p:Ze(I),kind:5,box:I,t1:y.t,ri1:y,t2:O.t,ri2:O},{p:Ze(S),kind:5,box:S,t1:C.t,ri1:C,t2:N.t,ri2:N}]}(o,i);for(const e of s){const i=Ye(o,e.ri1.tS),s=[[i[0]-r,i[1]-r],[i[0]+r,i[1]+r]],u={x:{ri:e.ri1,kind:5,box:s},curve:t},f={x:{ri:e.ri2,kind:5,box:s},curve:n};c.push([u,f])}return c}if(r&&(s=s.filter(t=>t.tS>0)),0===s.length)return[];const u=Hu(o,i,s);if(void 0===u||0===u.length)return[];for(const e of u){const r={x:e[0],curve:t},o={x:e[1],curve:n};c.push([r,o])}return c}const Rf=Ve(1);function Gf(t,n,e){const r=n.ps;if(0===t)return r[0],{x:{ri:{t,tS:t,tE:t,multiplicity:1},box:[r[0],r[0]],kind:e},curve:n};if(1===t){const o=r[r.length-1];return{x:{ri:{t,tS:t,tE:t,multiplicity:1},box:[o,o],kind:e},curve:n}}const{p:o,pE:i}=function(t,n){const e=Ye(t,n),r=Le(t,[0,n]);if(4===t.length)return{p:e,pE:r.map(t=>9*Rf*t)};if(3===t.length)return{p:e,pE:r.map(t=>6*Rf*t)};if(2===t.length)return{p:e,pE:r.map(t=>3*Rf*t)};if(1===t.length)return{p:t[0],pE:[0,0]};throw new Error("The given bezier curve must be of order <= 3.")}(r,t);return{x:{ri:{t,tS:t,tE:t,multiplicity:1},box:[[o[0]-i[0],o[1]-i[1]],[o[0]+i[0],o[1]+i[1]]],kind:e},curve:n}}function Uf(t,n){if(n.next===t){if(t.next===n)return;[t,n]=[n,t]}const e=t.ps,r=n.ps;if(function(t,n){if(4===t.length)return Lu(t,n);if(3===t.length)return ku(t,n);if(2===t.length)return function(t,n){const[e,r]=n,o=e.length,i=r.length,c=e[o-1],s=r[i-1],u=1===o&&1===i;{const{coeffs:{vₓ:n,vᵧ:o,v:i},errorBound:{v_:u}}=ti(t),f=Vr(e),l=Vr(r),a=Su(c),p=Su(s),h=Su(n[1]),d=Su(o[1]),v=a/3,g=p/3,m=n[1]*c,x=Iu(f,n),b=h*v+2*Su(m),w=o[1]*s,_=Iu(l,o),M=d*g+2*Su(w),I=wu(x,_),S=b+M+Su(I[1]),y=wu(I,i),O=S+u+Su(y[1]);if(He*O<Su(rt(y)))return!1}{const n=function(t){return _c(xc(t))}(t);if(void 0===n)return u&&c===t[0][0]&&s===t[0][1];const{vₓ:o,vᵧ:i,v:f}=n,l=_u(e,o),a=_u(r,i);return 0===ct(Mu(Mu(l,a),f))}}(t,n);if(1===t.length){const e=Ln(n[0]),r=Ln(n[1]);return 1===e.length&&1===r.length&&e[0]===t[0][0]&&r[0]===t[0][1]}throw new Error("The given bezier curve must be of order <= 3")}(e,r[r.length-1].map(t=>[t]))){const i=Hu(e,r,[(o=1,{t:o,tS:o,tE:o,multiplicity:1})]);if(void 0===i||0===i.length)return;return[[{x:i[0][0],curve:t},Gf(1,n,1)]]}var o}function $f(t){return t[t.length-1]<0?ot(t):t}function Zf(t,n){const e=t+n,r=e-t;return[t-(e-r)+(n-r),e]}Number.EPSILON;const Jf=Number.EPSILON/2;function Kf(t,n,e,r){const o=t/n,i=Math.abs(t),c=Math.abs(n),s=c-r;return s<=0?{est:o,err:Number.POSITIVE_INFINITY}:{est:o,err:(c*e+i*r)/s**2+Jf*Math.abs(i/c)}}function tl(t){const n=t[0],e=t[1];if(0===e)return[0,0];const r=Math.sqrt(e),o=r*r,i=134217729*r,c=i-(i-r),s=r-c,u=.5*(e-o-(s*s-(o-c*c-c*s*2))+n)/r;return[u-(r+u-r),r+u]}const{abs:nl}=Math;const{abs:el}=Math;function rl(t){const{coeffs:[[n,e,r],[o,i,c]],errorBound:[[s,u],[f,l]]}=function(t){const[[n,e],[r,o],[i,c],[s,u]]=t,f=s-n,l=r-i,a=f+3*l,p=i+n,h=p-2*r,d=r-n,v=u-e,g=o-c,m=v+3*g,x=c+e,b=x-2*o,w=o-e;return{coeffs:[[a,3*h,3*d,n],[m,3*b,3*w,e]],errorBound:[[nl(f)+6*nl(l)+nl(a),6*(nl(p)+nl(h)),6*nl(d),0],[nl(v)+6*nl(g)+nl(m),6*(nl(x)+nl(b)),6*nl(w),0]]}}(t),a=el(n),p=el(e),h=el(r),d=el(o),v=el(i),g=el(c),m=e*o,x=n*i,b=n*c,w=r*o,_=e*c,M=r*i,I=u*d+p*f+el(m),S=s*v+a*l+el(x),y=s*g+el(b),O=h*f+el(w),C=u*g+el(_),N=h*l+el(M),E=m-x,T=el(E),P=I+S+T,k=w-b,A=el(k),B=O+y+A,z=_-M,F=el(z),Y=C+N+F,D=E*E,L=E*k,X=z*E,q=k*k,W=X+q;return{coeffs:[D,L,W],errBound:[2*P*T+el(D),P*A+T*B+el(L),Y*T+F*P+el(X)+(2*A*B+el(q))+el(W)].map(t=>je*t)}}const ol=et,il=J;function cl(t){const[[n,e,r],[o,i,c]]=gc(t),s=ol(e,o),u=ol(n,i),f=ol(n,c),l=ol(r,o),a=ol(e,c),p=ol(r,i),h=it(s,u),d=it(l,f),v=it(a,p),g=ol(h,h),m=ol(h,d),x=ol(h,v),b=ol(d,d);return[g,m,il(x,b)]}const sl=it,ul=et,fl=nt,ll=tr,al=Zf,pl=ii,hl=Ut,dl=nr,vl=Ys,gl=J,ml=at,xl=2*Xe,{abs:bl}=Math;function wl(t,n=!0){if(t.length<4)return[];const{coeffs:[e,r,o],errBound:[i,c,s]}=rl(t);if(bl(e)<=i){const[[n,e],[r,o],[i,c],[s,u]]=t,f=gl(ll(s,n),fl(3,ll(r,i))),l=ml(al(i,n),-2*r),a=gl(ll(u,e),fl(3,ll(o,c))),p=ml(al(c,e),-2*o);if(0===Jr(ul(l,a),ul(f,p)))return[]}const u=r*r,f=4*e*o,l=u-f,a=2*c*bl(r)+je*u+(4*(i*bl(o)+bl(e)*s)+je*bl(f))+je*bl(l);if(l<-a)return[];if(l>a){const{est:t,err:u}=function(t,n){if(t-n<=0){const e=t>0?Math.sqrt(t):0;return{est:e,err:Math.max(Math.sqrt(t+n)-e,e)}}const e=Math.sqrt(t),r=Math.sqrt(t-n),o=Math.sqrt(t+n);return{est:e,err:Math.max(Math.abs(r-e),Math.abs(o-e))}}(l,a);let f;f=r>=0?-r-t:-r+t;const p=c+u+je*bl(f),{est:h,err:d}=Kf(f,2*e,p,2*i),{est:v,err:g}=Kf(2*o,f,2*s,p);if(n){if(h+d<0||h-d>1||v+g<0||v-g>1)return[]}else if((h+d<0||h-d>1)&&(v+g<0||v-g>1))return[]}let[p,h,d]=cl(t);const v=sl(ul(h,h),fl(4,ul(p,d))),g=ct(v);if(g<0)return[];if(g>0){const t=tl(Vr(v));let e;p=Vr(p),h=Vr(h),d=Vr(d),e=ct(h)>=0?pl(hl(h,t)):hl(pl(h),t);let r=rt(vl(e,dl(p))),o=rt(vl(dl(d),e));if(n){if(r<-xl||r>1+xl||o<-xl||o>1+xl)return[]}else if((r<-xl||r>1+xl)&&(o<-xl||o>1+xl))return[];return[r,o]=r<o?[r,o]:[o,r],r>=0-xl&&r<=1+xl?o>=0-xl&&o<=1+xl?[r,o]:[r]:o>=0-xl&&o<=1+xl?[o]:[]}const m=yr(p);if(ct(h)*ct(m)<0)return[];if(Jr($f(h),$f(m))>0)return[];const x=Vr(h),b=Vr(m),w=vl(x,b),_=w[1]+w[0];return[_,_]}const _l=Number.EPSILON;function Ml(t){if(4===t.length){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[6*(s-n+3*(r-i)),6*(i+n-2*r)],[6*(u-e+3*(o-c)),6*(c+e-2*o)]]}if(3===t.length){const[[n,e],[r,o],[i,c]]=t;return[[2*(i-2*r+n)],[2*(c-2*o+e)]]}if(t.length<=2)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3.")}function Il(t){if(4===t.length)return 0===gu(t[0],t[1],t[2])&&0===gu(t[1],t[2],t[3])&&0===gu(t[0],t[2],t[3]);if(3===t.length)return 0===gu(t[0],t[1],t[2]);if(t.length<=2)return!0;throw new Error("The given bezier curve must be of order <= 3.")}function Sl(t){if(Il(t))return{minima:[],maxima:[],inflections:[]};if(4===t.length&&Uu(t)&&(t=Wc(t)),3===t.length){const n=function(t){const[[n,e],[r,o],[i,c]]=t,s=i-r,u=s-(r-n),f=c-o,l=f-(o-e);return[u*u+l*l,-(n*(u-r)-r*(s-r)+e*(l-o)-o*(f-o))]}(t);return{minima:[],maxima:Fe(n,0,1)?.map(t=>t.t)||[],inflections:[]}}const n=function(t){const[[n,e,r],[o,i,c]]=U(t),[[s,u],[f,l]]=Ml(t),[[a],[p]]=function(t){if(4===t.length){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[6*(s-n+3*(r-i))],[6*(u-e+3*(o-c))]]}if(t.length<=3)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3.")}(t),h=a*i,d=p*e,v=u*c,g=u*i,m=f*f,x=s*c,b=l*r,w=l*e,_=f*r,M=r*e,I=r*n,S=r*o,y=e*e,O=e*n,C=e*i,N=n*c,E=n*o,T=n*n,P=c*i,k=c*o,A=i*i,B=i*o,z=o*o,F=a*c-p*r,Y=u*r+l*c,D=v-b,L=r*r+c*c,X=C+N,q=k+A,W=I+y,j=e*o+n*i,H=T-z,V=O-B,Q=M-P,R=r*i+e*c,G=k+q,$=I+W,Z=S+X,J=C+X,K=$-G,tt=X+N,nt=S+C+N,et=2*w+_;return{inflectionPoly:[s*o-f*n,u*o+s*i-l*n-f*e,g+x-w-_,v-b],otherExtremaPoly:[T*(h-3*d)+z*(3*h-d)+2*(E*(a*e-p*i+3*(l*f-u*s))+3*s*f*V)+3*(j*(m-s*s)+H*(u*f+l*s)),a*(o*($+3*q)+n*J)-p*(r*(3*T+z)+e*(3*O+2*B)+n*G)+3*(u*(l*H-u*E+2*(f*V-s*j))+s*(2*l*V+f*(2*(I-k)+(y-A))-s*nt)+l*(l*E+2*f*j)+m*Z),a*(2*r*j+e*tt+i*(4*k+G))-p*(2*r*(3*O+B)+e*(y+2*k)+i*tt)+3*(u*(2*(l*V-s*nt)+f*K-u*j)+s*(2*f*Q-s*R)+l*(l*j+2*f*Z+s*K)+m*R),a*(r*(S+2*X)+c*(y+3*q))-p*(r*(3*W+G)+c*J)+3*(u*(l*K-u*Z+2*(f*Q-s*R))+s*(r*(et-s*c)-c*(2*l*i+f*c))+l*(l*X+r*(2*f*i+l*o))+f*c*et),L*(h-d)+2*(M+P)*F-3*(Y*(g+x-w-_)+(u*e+s*r+l*i+f*c)*D),F*L-3*Y*D]}}(t),e=n.inflectionPoly,r=n.otherExtremaPoly,o=Fe(r,0,1)?.map(t=>t.t)||[],i=function(t){const n=t.length-1;if(n<=0)return[];const e=new Array(n);for(let r=0;r<n;r++)e[r]=(n-r)*t[r];return e}(r),c=[],s=[];for(let t=0;t<o.length;t++){const n=o[t],r=G(i,n);G(e,n)*r>=0?c.push(n):s.push(n)}return{minima:c,maxima:s,inflections:Fe(e,0,1)?.map(t=>t.t)||[]}}const{sqrt:yl}=Math;function Ol(t,n){const[e,r]=function(t,n){const[e,r]=U(t),[o,i]=Ml(t),c=G(e,n),s=G(r,n),u=G(o,n);return[c*G(i,n)-s*u,yl((c*c+s*s)**3)]}(t,n);return e/r}const{abs:Cl}=Math,Nl=D(function(t){const{curves:n}=t;let e=ao(n[0].ps).minY,r=n[0];for(let t=1;t<n.length;t++){const o=ao(n[t].ps).minY,i=o.box[0][1],c=e.box[0][1];(i<c||i===c&&o.ts[0]>e.ts[0])&&(e=o,r=n[t])}return{curve:r,y:e}});function El(t){const{curve:n,y:e}=Nl(t),r=e.ts;return r[0]<=0?[Gf(0,n,0),Gf(1,n.prev,0)]:r[1]>=1?[Gf(1,n,0),Gf(0,n.next,0)]:[{x:{ri:{t:r[0],tS:r[0],tE:r[1],multiplicity:1},kind:0,box:e.box},curve:n},{x:{ri:{t:r[0],tS:r[0],tE:r[1],multiplicity:1},kind:0,box:e.box},curve:n}]}function Tl(t,n,e){const r=e-(n-Math.floor(Math.log2(Math.abs(t))))+1;return r<=0?0:e>=53?t:hf(t,r)}function Pl(t,n,e){const r=function(t,n){const e=[];for(const n of t)for(const t of n.curves)e.push(t);const r=du(e,t=>ho(t.ps)[0][0],t=>ho(t.ps)[1][0],function(t){return(n,e)=>{const r=n.ps,o=e.ps;if(2===r.length&&2===o.length)return function(t,n,e){let r=t.ps,o=n.ps;const i=ho(r),c=ho(o);if(t.next!==n&&n.next!==t){if(ko(!0,i,c)){const r=Qf(t,n,e,!1);return r.length?r:void 0}return}if(n.next===t&&([t,n]=[n,t],[r,o]=[o,r]),0!==gu(r[0],r[1],o[1]))return;if(!ko(!1,i,c))return;let s;return s=mu(r[0],r[1])>mu(o[0],o[1])?[jr(Wr(r,o[1])[0].ri),1]:[0,jr(Wr(o,r[0])[0].ri)],[[Gf(1,t,5),Gf(0,n,5)],[Gf(s[0],t,5),Gf(s[1],n,5)]]}(n,e,t);if(n.next===e||e.next===n)return ko(!1,ho(r),ho(o))&&Vu(bu(r,!1),bu(o,!1),!1)?e.next===n?Qf(e,n,t,!0):Qf(n,e,t,!0):Uf(n,e);let i=ko(!0,ho(r),ho(o));return i?(i=Vu(bu(r,!1),bu(o,!1),!0),i?Qf(n,e,t,!1):void 0):void 0}}(n)),o=[];for(const t of r)for(const n of t.u)o.push(n);return o}(t,e),o=function(t){const n=[];for(const e of t)for(const t of e.curves){const e=t.ps,r=wl(e);if(0===r.length)continue;const o=r[0]===r[1]?3:2,i=r[0]-_l,c=r[0]+_l,s=r[1]-_l,u=r[1]+_l,f=$e(e,[i,c]),l=$e(e,[s,u]);n.push([{x:{ri:{t:i,tS:i,tE:c,multiplicity:1},box:f,kind:o},curve:t},{x:{ri:{t:s,tS:s,tE:u,multiplicity:1},box:l,kind:o},curve:t}])}return n}(t),i=function(t){const n=[];for(const e of t)for(const t of e.curves)n.push([Gf(1,t,4),Gf(0,t.next,4)]);return n}(t),{extremes:c,xs:s}=function(t){const n=new Map,e=[];for(const r of t){const t=El(r);e.push(t),n.set(r,t)}return{extremes:n,xs:e}}(t),u=function(t,n){const e=[];for(const r of n)for(const n of r.curves){const r=n.ps,o=Sl(r),{minima:i,maxima:c}=o,s=[0,1,...i,...c];for(let o of s)Cl(Ol(r,o))>1e7*2**-t&&e.push([Gf(o,n,7),Gf(o,n,7)])}return e}(e,t);let f=[...r,...o,...i,...s,...u];if("undefined"!=typeof _debug_){const{intersection:t}=_debug_.elems;for(const n of[r,o,i,s,u])for(const e of n)t.push(...e)}let l=f.map(t=>({xs:t,box:[[t[0].x.box[0][0]-n,t[0].x.box[0][1]-n],[t[0].x.box[1][0]+n,t[0].x.box[1][1]+n]],inOuts:void 0}));for(;;){const t=du(l,kl,Al,Ao);if(!t.length)break;const n=new Map;Bo(n,t);const e=Yo(n),r=Do(l,e);l=[...Lo(e),...r]}l=function(t){return t.filter(t=>{const n=t.xs;if(2===t.xs.length){const t=n[0];if(1===t.x.kind&&t.x.ri.multiplicity%2==0)return!1}for(const n of t.xs)if(4!==n.x.kind)return!0;return!1})}(l),l=function(t,n,e){const r=Math.log2(e)-3;return t.map(t=>{const e=t.box.map(t=>t.map(t=>Tl(t,n,n-r)));return{...t,box:e}})}(l,e,n),"undefined"!=typeof _debug_&&_debug_.elems.container.push(...l);let a=0;for(const t of l){for(const n of t.xs)n.container=t;let n;({inOuts:n,ioIdx:a}=hu(t,a)),t.inOuts=n}f=f.filter(t=>void 0!==t[0].container),function(t){const n=new Map;for(const e of t)for(const t of e){const e=t.curve.loop,r=n.get(e)||[];r.length||n.set(e,r),r.push(t)}for(const t of n){const n=t[1];if(!n||!n.length)continue;n.sort((t,n)=>{let e=t.curve.idx-n.curve.idx;return 0!==e?e:(e=t.x.ri.tS-n.x.ri.tS,0!==e?e:void 0!==t.in_?-1:1)});const e=n.length;for(let t=0;t<e;t++)n[t].next=n[(t+1)%e],n[t].prev=n[(t-1+e)%e]}}(f);for(const t of l)for(const n of t.inOuts){if(-1===n.dir)continue;const t=n;let e=t._x_;for(;e=e.next,void 0===e.in_;);t.nextOrPrev=e.in_,t.idx=t.nextOrPrev.idx}for(const t of l)for(const n of t.inOuts){if(1===n.dir)continue;const t=n;let e=t._x_;for(;e=e.prev,void 0===e.out;);t.nextOrPrev=e.out,t.idx=t.nextOrPrev.idx}return{extremes:c,containers:l}}function kl(t){return t.box[0][0]}function Al(t){return t.box[1][0]}function Bl(t,n,e){to(t,1);const r=t.inOuts,o=r[0],i=r[r.length-1],c=1===o.dir?o:i,s=i.dir,u=0===n.idx?new Set:1===n.orientation?n.loopsIdxs:new Set;return o.orientation=s,o.parent=n,o.windingNum=n.windingNum+s,o.loopsIdxs=new Set(u),o.children=new Set,1===s&&o.loopsIdxs?.add(e.idx),i.orientation=s,i.parent=n,i.windingNum=n.windingNum+s,i.loopsIdxs=new Set(u),i.children=new Set,1===s&&i.loopsIdxs?.add(e.idx),c}function zl(t){if(!Il(t))return!1;const n=t.map(t=>t[0]),e=t.map(t=>t[1]);return!(Fl(n)&&Fl(e))}function Fl(t){return function(t){for(let n=1;n<t.length;n++)if(t[n-1]>t[n])return!1;return!0}(t)||function(t){for(let n=1;n<t.length;n++)if(t[n-1]<t[n])return!1;return!0}(t)}function Yl(t,n){const e=n/Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[e*t[0],e*t[1]]}function Dl(t){for(let n=0;n<t.length-1;n++)for(let e=n+1;e<t.length;e++)if(t[n][0]===t[e][0]&&t[n][1]===t[e][1])return!1;return!0}const{abs:Ll}=Math;function Xl(t,n,e){if(void 0!==t&&!Ku(t)){if(2===t.length)return t;if(3===t.length){if(Dl(t))return Il(t)?[t[0],t[2]]:t;if(Wl(t[0],t[2]))return;return[t[0],t[2]]}if(Dl(t)){const r=ql(t);if(void 0===r)return;return function(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e][0]!==n[e][0]||t[e][1]!==n[e][1])return!1;return!0}(r,t)?t:Xl(r,n,e)}if(Wl(t[0],t[3])){if(Il(t))return;return t}if(Il(t))return[t[0],t[3]];if(Wl(t[0],t[1])&&Wl(t[1],t[2])||Wl(t[1],t[2])&&Wl(t[2],t[3])||Wl(t[0],t[1])&&Wl(t[2],t[3]))return Xl([t[0],t[t.length-1]],n,e);if(Wl(t[0],t[2])||Wl(t[1],t[3])||Wl(t[1],t[2]))return t;if(Wl(t[0],t[1])){if(mu(t[1],t[2])<4*n)return[t[0],t[2],t[2],t[3]];{const r=Yl(X(t[1],t[2]),2*n),o=V(t[1],r);return ql([t[0],e(o),t[2],t[3]])}}if(Wl(t[2],t[3])){if(mu(t[2],t[1])<4*n)return[t[0],t[1],t[1],t[3]];{const r=Yl(X(t[2],t[1]),2*n),o=V(t[2],r);return ql([t[0],t[1],e(o),t[3]])}}}}function ql(t){return Il(t)?[t[0],t[3]]:Uu(t)?Wc(t):t}function Wl(t,n){return t[0]===n[0]&&t[1]===n[1]}function jl(t){return t}function Hl(t,n,e,r=!1,o=!0){const i=function(t,n,e=!0){const r=2**t*2**-n,o=e?function(t,n){return e=>{const r=Tl(e[0],t,n),o=Tl(e[1],t,n);return r===e[0]&&o===e[1]?e:[r,o]}}(t,n):jl;return t=>{const n=[];for(let e=0;e<t.length;e++){let i=t[e].slice();const c=n[n.length-1],s=c?c[c.length-1]:o(t[0][0]);i[0]=s,i=i.map(t=>o(t)),zl(i)&&(i=[i[0],i[i.length-1]]),i=Xl(i,r,o),void 0!==i&&n.push(i)}const e=n.length;if(!e)return[];const i=n[e-1];return i[i.length-1]=n[0][0],n}}(e,n,o);let c=t.slice();return c=r?function(t,n,e,r=.02){const o=[];for(const i of t){const t=[];for(const o of i){const i=o.map(t=>t.map(t=>{let o,i=0,c=0,s=0;for(;!(++c>10);){i=(t+Math.random())*(1+(Math.random()-.7)*r),i=Tl(i,e,n);const c=vf(i);c>s&&(s=c,o=i)}return o}));t.push(i)}o.push(t)}return o}(c,n,e,1):c,c=c.map(i),c=c.filter(t=>t.length>0),"undefined"!=typeof _debug_&&(_debug_.timing.normalize=performance.now()-_debug_.timing.timingStart),c}const Vl=D(t=>{let n=0;for(const e of t)for(const t of e)for(const e of t)for(const t of e){const e=Math.abs(t);e>n&&(n=e)}return n});function Ql(t){let n=0;for(let e=0;e<=t.length-1&&0===t[e];e++)n++;return 0!==n&&(t=t.slice(n)),t}const{max:Rl}=Math;function Gl(t,n){const e=t.length-1,r=n.length-1;if(e<0||r<0)return[];const o=e+r,i=new Array(o+1).fill(0);for(let c=0;c<e+1;c++)for(let s=0;s<r+1;s++)i[o-(c+s)]+=t[e-c]*n[r-s];return Ql(i)}function Ul(t,n){const e=t.length-1,r=new Array(e+2);for(let n=0;n<e+1;n++)r[n]=t[n]/(e+1-n);return r[e+1]=n,r}const{min:$l,max:Zl}=Math;function Jl(t,n){const e=t.length-1,r=n.length-1,o=Zl(e,r),i=new Array(o+1),c=$l(e,r);for(let s=0;s<=c;s++)i[o-s]=t[e-s]+n[r-s];for(let n=c+1;n<=e;n++)i[o-n]=t[e-n];for(let t=c+1;t<=r;t++)i[o-t]=n[r-t];return Ql(i)}function Kl(t){let n=0;for(const e of t){const[t,r]=uo(e),[o,i]=U(e);n+=G(Ul(Jl(Gl(t,i),Mn(Gl(r,o))),0),1)}return n/2}function ta(t){let n=0;for(let e=0;e<t.length-1;e++)n+=Dt(t[e],t[e+1]);return n}const{sqrt:na}=Math;function ea(t){const[n,e]=t[0],[r,o]=t[t.length-1];let i,c;const s=ta(t);if(256*mu(t[0],t[t.length-1])<s*s){const[r,o]=Ye(t,.5),s=na((r-n)*(r-n)+(o-e)*(o-e));i=(o-e)/s,c=(r-n)/s}else{const t=na((r-n)*(r-n)+(o-e)*(o-e));i=(o-e)/t,c=(r-n)/t}const u=function(t,n,e){const r=V(t[0].map(t=>-t));return po(t.map(t=>R(-n,e,r(t))))}(t,i,c),[[f,l],[a,p]]=u,h=[u[0],[a,l],u[1],[f,p]],d=R(i,c);return h.map(n=>V(t[0],d(n)))}function ra(t){return{ps:t,ts:[0,1]}}const oa=tt,ia=it,ca=lt,sa=ct,ua=it,fa=et,la=nt,aa=tr,pa=Zf,ha=J,da=at,{abs:va}=Math,ga={order:0,realOrder:0,collinear:!0,nodeType:"n/a"},ma={order:1,realOrder:1,collinear:!0,nodeType:"n/a"},xa={order:1,realOrder:0,collinear:!0,nodeType:"n/a"},ba={order:2,realOrder:2,collinear:!1,nodeType:"n/a"},wa={order:2,realOrder:2,collinear:!0,nodeType:"n/a"},_a={order:2,realOrder:1,collinear:!0,nodeType:"n/a"},Ma={order:2,realOrder:0,collinear:!0,nodeType:"n/a"},Ia={order:3,realOrder:3,collinear:!1,nodeType:"crunode"},Sa={order:3,realOrder:3,collinear:!1,nodeType:"acnode"},ya={order:3,realOrder:3,collinear:!1,nodeType:"cusp"},Oa={order:3,realOrder:3,collinear:!1,nodeType:"explicit"},Ca={order:3,realOrder:3,collinear:!0,nodeType:"n/a"},Na={order:3,realOrder:2,collinear:!1,nodeType:"n/a"},Ea={order:3,realOrder:2,collinear:!0,nodeType:"n/a"},Ta={order:3,realOrder:1,collinear:!0,nodeType:"n/a"},Pa={order:3,realOrder:0,collinear:!0,nodeType:"n/a"};const{abs:ka,PI:Aa}=Math;function Ba(t,n=[0,1]){if(t.length<=2)return 0;const[e,r]=n;if(e===r)return 0;if(3===t.length){const n=Qt(t,e,r).ps,[[o,i],[c,s],[u,f]]=n;return Kt([c-o,s-i],[u-c,f-s])}if(4===t.length){const n=fn(t,e,r).ps,o=function(t){if(4===t.length)return Uu(t)?function(t){if(!Il(t))return!1;const[n,e,r,o]=t,[i,c]=n,[s,u]=e,[f,l]=r,[a,p]=o,h=ia(oa(ca(s/4,f/4),3),ca(i/4,a/4)),d=ia(oa(ca(u/4,l/4),3),ca(c/4,p/4));return 0===sa(ia(ca(i/2,a/2),h))&&0===sa(ia(ca(c/2,p/2),d))}(t)?Ku(t)?Pa:Ta:Il(t)?Ea:Na:Il(t)?Ca:function(t){const{coeffs:[n,e,r],errBound:[o,i,c]}=rl(t);if(va(n)<=o){const[[n,e],[r,o],[i,c],[s,u]]=t,f=ha(aa(s,n),la(3,aa(r,i))),l=da(pa(i,n),-2*r),a=ha(aa(u,e),la(3,aa(o,c))),p=da(pa(c,e),-2*o);if(0===Jr(fa(l,a),fa(f,p)))return Oa}const s=e*e,u=4*n*r,f=s-u,l=2*i*va(e)+je*s+(4*(o*va(r)+va(n)*c)+je*va(u))+je*va(f);if(f<-l)return Sa;if(f>l)return Ia;const[a,p,h]=cl(t),d=ct(ua(fa(p,p),la(4,fa(a,h))));return d<0?Sa:d>0?Ia:ya}(t);if(3===t.length)return Il(t)?Ju(t)?Ku(t)?Ma:_a:wa:ba;if(2===t.length)return Ku(t)?xa:ma;if(1===t.length)return ga;throw new Error("The given bezier curve must be of order <= 3")}(n),[[i,c],[s,u],[f,l],[a,p]]=n,h=[s-i,u-c],d=[f-s,l-u],v=[a-f,p-l];if(0===d[0]&&0===d[1]||o.realOrder<=2)return Kt(h,v);const g=Kt(h,d)+Kt(d,v);return"acnode"===o.nodeType||"cusp"===o.nodeType?g<=-Aa?g+2*Aa:g>=+Aa?g-2*Aa:g:g}throw new Error("The given bezier curve must be of order <= 3.")}const{round:za,PI:Fa}=Math;const{abs:Ya,max:Da,ceil:La,log2:Xa}=Math;function qa(n,e,r={}){"undefined"!=typeof _debug_&&(_debug_.timing.timingStart=performance.now()),e=e||Vl(n);const o=La(Xa(e)),{inclMicroCorners:i=!0,minLoopArea:c=(2**o*2**-12)**2,forceOrientationNegative:s=!1,booleanOp:u="OR",containerSizeMultiplier:f=16}=r,l=2**o*2**-46*f;(function(t){if("undefined"!=typeof _debug_)for(const n of t){_debug_.elems.loopPre.push(...t),_debug_.elems.loopsPre.push(t);for(const t of n){const n=ho(t),e=ea(t),r=bu(t,!1);_debug_.elems.bezier_.push(t),_debug_.elems.looseBoundingBox_.push(n),_debug_.elems.tightBoundingBox_.push(e),_debug_.elems.boundingHull_.push(r)}}})(n=Hl(n,46,o,!1,!0)),n.sort(Co);const a=n.map((n,e)=>t(n,e)),{extremes:p,containers:h}=Pl(a,l,o),d={dir:void 0,idx:0,parent:void 0,children:new Set,windingNum:0,p:void 0,_x_:void 0,container:void 0,loopsIdxs:new Set,orientation:-1},v=new Set,g=new Set;for(const t of a){if(v.has(t))continue;v.add(t);const n=Oo(d,t),e=p.get(t)[0].container;if(0===e.inOuts.length)continue;const r=Bl(e,n,t),o=2===e.inOuts.length&&2===e.xs.length;if(o&&e.inOuts[0].nextOrPrev===e.inOuts[1])r.bezierPieces=t.beziers.map(ra),r.parent.children=r.parent.children||new Set,r.parent.children.add(r);else if(so(r,v,g,!1),o&&void 0!==r.bezierPieces){const{bezierPieces:t}=r,n=t[t.length-1],e=t[0];if(n.ps===e.ps){const r={ps:n.ps,ts:[n.ts[0],e.ts[1]]};t.shift(),t.pop(),t.unshift(r)}}}const m=function(t){const n=[],e=[t];for(;e.length;){const t=e.pop();0===t.windingNum&&n.push(...t.children),e.push(...t.children),0===t.windingNum&&(t.children=new Set)}return n}(d),x=function(t){return n=>{const e="OR"===t||"XOR"===t?[n]:[];n.used="OR"===t||"XOR"===t;const r=Array.from(n.children);for(;r.length;){const n=r.pop();if("OR"===t&&0===n.windingNum&&e.push(n),"AND"===t){const t=Po(n);(0===n.windingNum&&t||Eo(n.windingNum)>=2&&!t)&&(e.push(n),n.used=!0)}if("XOR"===t){const t=Po(n);(0===n.windingNum&&t||Eo(n.windingNum)>=2&&t)&&(e.push(n),n.used=!0)}for(const t of n.children)r.push(t)}return e}}(u),b=m.map(x).filter(t=>0!==t.length).map(n=>{const e=n[0].orientation;return n.map((n,r)=>function(n,e,r,o){const i=n.bezierPieces?.map(io);if(void 0===i)return t([],r);const{orientation:c}=n,s=o?-1:e;return t((0===r?s:-s)*c>0?i:i.map(t=>t.toReversed()).toReversed(),r)}(n,e,r,s))}),w=[];for(let t=0;t<b.length;t++){const n=b[t].filter(t=>Ya(Kl(t.beziers))>c);n.length&&(n.sort((t,n)=>Co(t.beziers,n.beziers)),w.push(n))}"undefined"!=typeof _debug_&&(_debug_.timing.simplifyPaths=performance.now()-_debug_.timing.timingStart-_debug_.timing.normalize);const _=i?w:w.map(n=>n.map(n=>{const{beziers:e}=n,r=function(t,n){!function(t){za(function(t){const n=t.length;let e=0;for(let r=0;r<n;r++){const o=t[(r-1+n)%n],i=t[r];e+=Ba(i,[0,1])+Kt($(o,1),$(i,0))}return e}(t)/(2*Fa))}(t);const e=t.map(t=>t.map(t=>[t[0],t[1]])).filter(t=>ta(t)>n),r=e.length;for(let t=0;t<r;t++){const n=e[t],o=e[(t+1)%r],i=n[n.length-1],c=o[0];c[0]===i[0]&&c[1]===i[1]||(i[0]=c[0],i[1]=c[1])}return e}(e,Da(...h.map(t=>Ya(t.box[0][0]-t.box[1][0])),...h.map(t=>Ya(t.box[0][1]-t.box[1][1]))));return t(r,n.idx)}));return function(t){if("undefined"!=typeof _debug_)for(const n of t)_debug_.elems.loop.push(...n),_debug_.elems.loops.push(n)}(_),_}const{max:Wa,abs:ja}=Math;function Ha(t,n){const e=t[0],r=t[1],o=t[2],i=t[3],c=e[0],s=e[1],u=r[0],f=r[1],l=o[0],a=o[1],p=i[0],h=i[1],d=n[0],v=n[1],g=c-d,m=u-d,x=l-d,b=p-d,w=s-v,_=f-v,M=a-v,I=h-v,S=g*g,y=6*g*m,O=6*x*b,C=w*w,N=6*w*_,E=6*M*I,T=6*m*b+9*x*x,P=2*g*b+18*m*x,k=6*g*x+9*m*m,A=6*_*I+9*M*M,B=2*w*I+18*_*M,z=6*w*M+9*_*_;return[6*(b*b-O+(S-y)+T+(k-P)+(I*I-E+(C-N)+A+(z-B))),5*(O+5*y+3*P-2*(T+2*k+3*S)+(E+5*N+3*B-2*(A+2*z+3*C))),4*(T-3*(P-2*k)-5*(2*y-3*S)+(A-3*(B-2*z)-5*(2*N-3*C))),3*(P-2*(2*k-5*(y-2*S))+(B-2*(2*z-5*(N-2*C)))),2*(k-5*(y-3*S)+(z-5*(N-3*C))),y-6*S+(N-6*C)]}function Va(t,n){const e=t[0],r=t[1],o=t[2],i=e[0],c=e[1],s=r[0],u=r[1],f=o[0],l=o[1],a=n[0],p=n[1],h=i-a,d=s-a,v=f-a,g=c-p,m=u-p,x=l-p,b=h*h,w=h*d,_=d*v,M=g*g,I=g*m,S=m*x,y=g*x+m*m*2,O=h*v+d*d*2;return[x*x+M+2*y-4*(S+I)+(v*v+b+2*O-4*(_+w)),3*(S-y+(3*I-M)+(_-O+(3*w-b))),y-3*(2*I-M)+(O-3*(2*w-b)),I-M+(w-b)]}function Qa(t,n){const[[e,r],[o,i]]=t,[c,s]=n,u=e-c,f=o-c,l=r-s,a=i-s,p=u*f+l*a,h=l*l+u*u;return[f*f+a*a+(h-2*p),p-h]}const{sqrt:Ra}=Math;function Ga(t,n,e=!0){let r;if(4===t.length)r=Ha(t,n);else if(3===t.length)r=Va(t,n);else{if(2!==t.length){if(1===t.length)return{p:t[0],t:0,d:Dt(t[0],n)};throw new Error("The given bezier curve must be of order <= 3.")}r=Qa(t,n)}const o=Fe(r,0,1)?.map(t=>t.t)||[];e&&(o.push(0),o.push(1));let i,c=Number.POSITIVE_INFINITY;for(const e of o){const r=Ye(t,e),o=mu(r,n);o<c&&(c=o,i={p:r,t:e,d:Ra(o)})}return i}const{sqrt:Ua}=Math,{abs:$a}=Math;function Za(t){let n=Number.NEGATIVE_INFINITY;for(let e=0;e<t.length;e++){const r=t[e],o=$a(r[0]),i=$a(r[1]);o>n&&(n=o),i>n&&(n=i)}return n}const{max:Ja}=Math;function Ka(t){return Ja(t.hL+t.hEL,t.hR+t.hER)}function tp(t,n){const e=Ka(t)-Ka(n);return 0!==e?e:t.tS-n.tS}class np{compare;heap=[];constructor(t){this.compare=t}insert(t){const n=this.heap;n.push(t);let e=n.length-1;for(;;){const r=(e-1-(e+1)%2)/2;if(-1===r)return;const o=n[r];if(this.compare(t,o)<0)break;n[r]=t,n[e]=o,e=r}}popMax(){const t=this.heap,n=t[0];return t[0]=t[t.length-1],t.length--,this.swimDown(),n}swimDown(){const t=this.heap,n=t.length;let e=0;for(;;){const r=2*e+1;if(r>=n)break;const o=2*e+2,i=o>=n||this.compare(t[r],t[o])>0?r:o,c=t[i],s=t[e];if(this.compare(s,c)>0)break;t[i]=s,t[e]=c,e=i}}swapMinOrMax(t){this.heap[0]=t,this.swimDown()}static getParentIdx(t){return(t-1-(t+1)%2)/2}static getLeftChild(t){return 2*t+1}static getRightChild(t){return 2*t+2}}const{max:ep}=Math;function rp(t,n,e,r=50){if(1===t.length)return Ga(n,t[0]).d;if(1===n.length)return function(t,n){let e;if(4===t.length)e=Ha(t,n);else if(3===t.length)e=Va(t,n);else{if(2!==t.length){if(1===t.length)return{p:t[0],t:0,d:Dt(t[0],n)};throw new Error("The given bezier curve must be of order <= 3.")}e=Qa(t,n)}const r=Fe(e,0,1)?.map(t=>t.t)||[];r.push(0),r.push(1);let o,i=Number.NEGATIVE_INFINITY;for(const e of r){const r=Ye(t,e),c=mu(r,n);c>i&&(i=c,o={p:r,t:e,d:Ua(c)})}return o}(t,n[0]).d;if(2===t.length&&2===n.length){const e=Ga(n,t[0]).d,r=Ga(n,t[t.length-1]).d;return e>r?e:r}const o=ep(Za(t),Za(n));e=e||o/1e6;const[i,c]=op(t,0,1),s={tS:0,tE:1,hL:Ga(n,t[0]).d,hR:Ga(n,t[t.length-1]).d,hEL:i,hER:c},u=new np(tp);u.insert(s);let f=0,l=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(;;){const o=u.heap[0],{tS:i,tE:c,hL:s,hR:p}=o,h=(i+c)/2,[d,v]=op(t,i,h),[g,m]=op(t,h,c),x=Ye(t,h),b=Dt(x,Ga(n,x).p),w=ep(s,b,p);if(w>a&&(a=w),l=Ka(o),l-a<e)return a;if(f++>r)return a;const _={tS:i,tE:h,hL:s,hR:b,hEL:d,hER:v},M={tS:h,tE:c,hL:b,hR:p,hEL:g,hER:m};u.swapMinOrMax(_),u.insert(M)}}function op(t,n,e){const r=(e+n)/2,o=P(t,n,r),i=P(t,r,e);return[ta(o),ta(i)]}function ip(t,n=!1){const e=t;let r=e;const o=[];do{n&&r===e||m(r)||o.push(r),r=r.nextOnCircle}while(r!==e);return o}function cp(t){const n=[],e=[t],r=new Set;for(;e.length>0;){const t=Ft(e.pop());if(0===t.length)continue;n.push(t);const o=t[0],i=t[t.length-1].next.prevOnCircle;r.add(o),r.add(i);const c=ip(o,!0),s=ip(i,!0),u=c.filter(t=>!r.has(t)),f=s.filter(t=>!r.has(t));for(const t of u)r.add(t);for(const t of f)r.add(t);e.push(...u,...f)}return n}class sp{datum;color=0;parent;left;right;constructor(t){this.datum=t}}class up{compare;root;constructor(t){this.compare=t,this.root=void 0}isEmpty(){return void 0===this.root}find(t){let n=this.root;for(;n;){const e=this.compare(t,n.datum);if(0===e)return n;n=e<0?n.left:n.right}}insert(t){if(void 0===this.root)return this.root=new sp(t),void(this.root.color=1);let n,e=this.root;for(;e;){n=e;const r=this.compare(t,e.datum);if(0===r)return void(e.datum=t);e=r<0?e.left:e.right}const r=new sp(t);r.parent=n,this.compare(t,n.datum)<0?n.left=r:n.right=r,this.fixInsert(r)}remove(t,n=!1,e){const r=this.find(t);if(void 0===r)return;const o=r.datum;return this.removeNode(r),o}findBounds(t){let n=this.root;const e=[void 0,void 0];for(;n;)this.compare(t,n.datum)>=0?(e[0]=n,n=n.right):(e[1]=n,n=n.left);return e}getMinNode(t){let n=void 0===t?this.root:t;for(;n&&n.left;)n=n.left;return n}getMaxNode(t){let n=void 0===t?this.root:t;for(;n&&n.right;)n=n.right;return n}removeNode(t){let n,e,r=t,o=r.color;void 0===t.left?(n=t.right,e=t.parent,this.transplant(t,t.right)):void 0===t.right?(n=t.left,e=t.parent,this.transplant(t,t.left)):(r=this.getMinNode(t.right),o=r.color,n=r.right,r.parent===t?(e=r,n&&(n.parent=r)):(e=r.parent,this.transplant(r,r.right),r.right=t.right,r.right.parent=r),this.transplant(t,r),r.left=t.left,r.left.parent=r,r.color=t.color),1===o&&this.fixDelete(n,e)}fixInsert(t){let n=t;for(;n.parent&&0===n.parent.color;){const t=n.parent,e=t.parent;if(t===e.left){const r=e.right;0===this.colorOf(r)?(t.color=1,r.color=1,e.color=0,n=e):(n===t.right&&(n=t,this.rotateLeft(n)),n.parent.color=1,e.color=0,this.rotateRight(e))}else{const r=e.left;0===this.colorOf(r)?(t.color=1,r.color=1,e.color=0,n=e):(n===t.left&&(n=t,this.rotateRight(n)),n.parent.color=1,e.color=0,this.rotateLeft(e))}}this.root.color=1}fixDelete(t,n){let e=t,r=n;for(;e!==this.root&&1===this.colorOf(e)&&void 0!==r;)if(e===r?.left){let t=r.right;0===this.colorOf(t)&&(t.color=1,r.color=0,this.rotateLeft(r),t=r.right),1===this.colorOf(t?.left)&&1===this.colorOf(t?.right)?(t&&(t.color=0),e=r,r=e?.parent):(1===this.colorOf(t?.right)&&(t?.left&&(t.left.color=1),t&&(t.color=0,this.rotateRight(t)),t=r.right),t&&(t.color=r.color),r.color=1,t?.right&&(t.right.color=1),this.rotateLeft(r),e=this.root,r=void 0)}else{let t=r?.left;0===this.colorOf(t)&&(t.color=1,r.color=0,this.rotateRight(r),t=r.left),1===this.colorOf(t?.left)&&1===this.colorOf(t?.right)?(t&&(t.color=0),e=r,r=r?.parent):(1===this.colorOf(t?.left)&&(t?.right&&(t.right.color=1),t&&(t.color=0,this.rotateLeft(t)),t=r?.left),t&&(t.color=r.color),r.color=1,t?.left&&(t.left.color=1),this.rotateRight(r),e=this.root,r=void 0)}e&&(e.color=1)}transplant(t,n){void 0===t.parent?this.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n&&(n.parent=t.parent)}rotateLeft(t){const n=t.right;t.right=n.left,n.left&&(n.left.parent=t),n.parent=t.parent,void 0===t.parent?this.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left=t,t.parent=n}rotateRight(t){const n=t.left;t.left=n.right,n.right&&(n.right.parent=t),n.parent=t.parent,void 0===t.parent?this.root=n:t===t.parent.right?t.parent.right=n:t.parent.left=n,n.right=t,t.parent=n}colorOf(t){return t?t.color:1}}function fp(t){const n=new Map;return p(t).forEach(function(t){const e=t.pointOnShape.curve.loop;let r=n.get(e);r||(r=new up(xn),n.set(e,r)),r.insert(t)}),n}const{max:lp}=Math;function ap(t,n=.125,e=50){let r=N(t.cpNode);for(;!m(r);)r=r.next;const o=cp(r),i=new Set;for(let t=0;t<o.length;t++){const r=o[t];let c=0;for(;c<r.length;){const t=c;for(;(c++,c!==r.length)&&!(pp(t,c,r,e)>n);)i.add(r[c])}}r=function(t,n){const e=n;do{if(t(n))return n;n=n.next}while(n!==e)}(m,r);for(const n of i)wn(t=>2!==v(t)&&!t.isHoleClosing)(n)||B(n,t.meta);return{cpNode:r,meta:{...t.meta,cpTrees:fp(r)}}}function pp(t,n,e,r){const o=[],i=Tt(e[t],e[n].next);for(;t<n+1;t++)o.push(rp(Pt(e[t]),i,r));return lp(...o)}function hp(t){const n=[],e=p(t);for(const t of e)w(t)&&!t.isHoleClosing&&n.push(t);return n}const dp=function(t,n,e){const r=t.get(n);return void 0!==r&&r.has(e)},vp=function(t,n,e){let r=t.get(n);void 0===r&&(r=new Set,t.set(n,r)),r.add(e)};function gp(t){let n=t,e=t.prevOnCircle;for(;m(e);)e=e.prevOnCircle;const r=[];do{m(n)||r.push(n),n=n.nextOnCircle}while(n!==e);return r}function mp(t,n){const e=new Map,r=new Map;return S(t,function(t){const o=r.get(t)||n*t.pointOnShape.circle.radius,i=t.next,c=function(t,n,e=.4,r=16){if(4===n.length)return ln(t,n,e,r);if(3===n.length)return cn(t,n,e,r);if(2===n.length)return Lt(t,n);if(1===n.length)return 0;throw new Error("The given bezier curve must be of order <= 3.")}([0,1],Pt(t)),s=i.pointOnShape.circle.radius;if(o-c>n*s)for(const t of g(i))if(r.set(t,o-c),!i.isHoleClosing){const{center:t}=i.pointOnShape.circle;vp(e,t[0],t[1])}}),e}function xp(t,n){let e=0;"undefined"!=typeof _debug_&&(e=performance.now());const r=function(t){const n=p(t);return n.reduce(function(t,n){return t.pointOnShape.circle.radius>=n.pointOnShape.circle.radius?t:n},n[0])}(N(t.cpNode));!function(t,n){const e=hp(n);for(;e.length;){const r=e.pop(),{center:o}=r.pointOnShape.circle;if(!dp(t,o[0],o[1])||r.isIntersection)continue;let i=r.prevOnCircle,c=!1;for(;!c;){i=i.next;const{center:e}=i.pointOnShape.circle;if(dp(t,e[0],e[1]))if(At(i,n))c=!0;else{if(1===gp(i).length)continue;c=!0}else{for(;m(i.prevOnCircle);)i=i.prevOnCircle;c=!0}}if(c){const t=i.prevOnCircle;t.next=i,i.prev=t,t.nextOnCircle=i,i.prevOnCircle=t}}}(mp(r,n),r);const o={cpNode:r,meta:{...t.meta,cpTrees:fp(r)}};return function(t){"undefined"!=typeof _debug_&&(_debug_.timing.sats=performance.now()-t)}(e),o}const bp={maxCurviness:.05,maxLength:40,applySat:!0,satScale:2,simplify:!0,simplifyTolerance:2**-4,minBezLength:2**-6,angleIncrement:15},wp={maxCurviness:{range:[.01,3],scaleByMaxCoordinate:!1},maxLength:{range:[1,1024],scaleByMaxCoordinate:!0},angleIncrement:{range:[.1,360],scaleByMaxCoordinate:!1},satScale:{range:[1,1/0],scaleByMaxCoordinate:!1},simplifyTolerance:{range:[2**-20,2**20],scaleByMaxCoordinate:!0},minBezLength:{range:[2**-20,2],scaleByMaxCoordinate:!0}};function _p(t){return[t[1],-t[0]]}function Mp(t,n){if(!yt(n))return 0;const e=St(n);return e.isDull?-q(_p(e.tangents[0]),Q(X(n.p,t))):0}function Ip(t){return t[0]*t[0]+t[1]*t[1]}function Sp(t,n,e){return t[0]*(n[1]*e[2]-n[2]*e[1])-t[1]*(n[0]*e[2]-n[2]*e[0])+t[2]*(n[0]*e[1]-n[1]*e[0])}function yp(t){const n=t[0],e=t[1],r=t[2],o=Ip,i=.5*Sp([o(n),n[1],1],[o(e),e[1],1],[o(r),r[1],1]),c=.5*Sp([n[0],o(n),1],[e[0],o(e),1],[r[0],o(r),1]),s=Sp([n[0],n[1],1],[e[0],e[1],1],[r[0],r[1],1]);return[i/s,c/s]}function Op(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}const Cp=tr,Np=Gn,Ep=Ut,Tp=Number.EPSILON;function Pp(t,n){const[e,r]=t,[o,i]=n,c=tr(e,o),s=tr(r,i);return Ut(Gn(c,c),Gn(s,s))[1]}const kp=Number.EPSILON;function Ap(t,n,e){const[r,o]=e,{ps:i}=t,c=[];if(r!==o){const{polyDd:e,polyE:s,getPolyExact:u}=Xr(i,n),f=Fe(e,r,o,s,u)||[];c.push(...f.map(e=>{const{tS:r,tE:o,t:c}=e,s=c<0?0:c>1?1:c,u=function(t,n){const e=t[0],r=t[1],o=e[0],i=e[1],c=r[0],s=r[1],u=n[0],f=n[1];let l=1/0,a=-1/0;for(const[t,n]of[[o,i],[o,s],[c,i],[c,s]]){const e=Cp(t,u),r=Cp(n,f),o=Ep(Np(e,e),Np(r,r))[1],i=o*(1-Tp),c=o*(1+Tp);i<=l&&(l=i),c>=a&&(a=c)}return[l,a]}($e(i,[r,o]),n),f=0===s?1:s;return{curve:0===s?t.prev:t,t:f,dSquaredI:u}}))}const s=e.slice();return r===o&&s.push(r),c.push(...s.map(e=>{const r=Pp(Gs(i,[0,e]).map(t=>t[0]+t[1]),n),o=[r*(1-kp),r*(1+kp)],c=0===e?1:e;return{curve:0===e?t.prev:t,t:c,dSquaredI:o}})),c}const{min:Bp}=Math,zp=1+2**-20;function Fp(t,n){const e=t[0],r=t[1],o=e[0],i=e[1],c=r[0],s=r[1],u=n[0],f=n[1];return u<o?f<i?mu(t[0],n):f>s?mu([o,s],n):(o-u)**2:u>c?f<i?mu([c,i],n):f>s?mu(t[1],n):(u-c)**2:f<i?(i-f)**2:f>s?(f-s)**2:0}const Yp=D(po);function Dp(t,n){const e=[0,1,2,3].map(e=>function(t,n){const e=mu,r=n[0],o=n[1],i=e(r,o);if(0==i)return e(t,r);let c=((t[0]-r[0])*(o[0]-r[0])+(t[1]-r[1])*(o[1]-r[1]))/i;return c=Math.max(0,Math.min(1,c)),e(t,[r[0]+c*(o[0]-r[0]),r[1]+c*(o[1]-r[1])])}(n,[t[e],t[(e+1)%4]])),r=mu(t[0],t[1]),o=mu(t[0],t[3]);return e[0]<=o&&e[2]<=o&&e[1]<=r&&e[3]<=r?0:Math.min(...e)}const Lp=D(ea);function Xp(t,n){return Gs(t,[0,n])}function qp(t,n){t=function(t,n){const e=function(t,n){let e=1/0;for(let r=0;r<t.length;r++){const o=t[r],{curve:{ps:i},ts:c}=o,s=Ye(i,c[0]),u=Ye(i,c[1]);e=Bp(e,mu(n,s),mu(n,u))}return zp*e}(t,n);return t=function(t,n,e){const r=[];for(let o=0;o<t.length;o++){const i=t[o],{ps:c}=i.curve;Fp(Yp(c),n)<=e&&r.push(i)}return r}(t,n,e),t=function(t,n,e){const r=[];for(let o=0;o<t.length;o++){const i=t[o],c=i.curve.ps;Dp(Lp(c),n)<=e&&r.push(i)}return r}(t,n,e),t}(t,n);const e=[];for(let r=0;r<t.length;r++){const o=t[r],i=Ap(o.curve,n,o.ts);e.push(...i)}let r=1/0;for(let t=0;t<e.length;t++){const n=e[t].dSquaredI[1];n<r&&(r=n)}const o=[];for(let t=0;t<e.length;t++){const n=e[t];n.dSquaredI[0]<=r&&o.push(n)}return o.map(t=>{const{curve:n,t:e}=t,{ps:r}=n,o=Xp(r,e);return{curve:n,t:e,isSource:!1,p:o.map(t=>t[0]+t[1]),pDd:o}})}function Wp(t,n){return n.map(n=>qp(n,t)[0])}function jp(t,n){return[n*t[0],n*t[1]]}function Hp(t,n,e){const r=Op(e);let o,i,c,s,u=1,f=0;do{i=V(jp(e,u),n),c=t.map(t=>qp(t,n)[0]),s=Op(X(i,yp(c.map(t=>t.p)))),o=s<r,u/=2,f++}while(!o&&f<3);return{newX:i,newV:s,newPoss:c}}const{min:Vp,abs:Qp,asin:Rp}=Math;function Gp(t,n,e,r,o){const i=2**(o-32),c=[t[0],t[n],t[t.length-1]],s=[r[0],r[n],r[t.length-1]],u=[[c[0],c[1],c[2]],[c[1],c[2],c[0]],[c[2],c[0],c[1]]][e],f=[[s[0],s[1],s[2]],[s[1],s[2],s[0]],[s[2],s[0],s[1]]][e];if(_(u[0][0]))return;let l,a=0,p=function(t,n){const e=t[0][0].pointOnShape.circle.center,r=qp(n[1],e)[0];return yp([t[0][0].pointOnShape.p,r.p,t[2][1].pointOnShape.p])}(u,f),h=1/0;for(;h>i&&a<10;){if(a++,l=Wp(p,f),!Number.isFinite(p[0])||!Number.isFinite(p[1]))return;const t=yp(l.map(t=>t.p)),n=X(p,t);if(!Number.isFinite(n[0])||!Number.isFinite(n[1]))return;const e=Hp(f,p,n);p=e.newX,l=e.newPoss;const r=Op(n);h=Qp(r-e.newV)}const d=(Dt(p,l[0].p)+Dt(p,l[1].p)+Dt(p,l[2].p))/3,v={center:p,radius:d};let g=0;for(let t=0;t<3;t++){const n=l[t],e=Q(X(n.p,p)),r=W(e);if(yt(n)&&St(n).isDull){const t=It(n.curve.ps,n.curve.next.ps).tangents.map(W),r=Rp(j(t[0],e)),o=Rp(j(e,t[1]));let i=0;r>0&&(i+=r),o>0&&(i+=o),g+=i}else{const t=Q($(n.curve.ps,n.t));g+=Qp(Rp(j(r,t)))}}const m=[];for(let t=0;t<r.length;t++){const n=qp(r[t],p)[0];m.push(Dt(n.p,p))}const x=Vp(...m);return{threeProngInfo:{poss:l,circle:v,δ3s:u},error:1*Qp(d-x)+1*g}}function Up(t){let n=t[0];const e=t[1],r=[];let o=!0;do{const t=n.pointOnShape,e=n.next.pointOnShape,i=t.curve,c=e.curve;if(o)if(o=!1,c===i&&mn(e,t)>0)r.push({curve:i,ts:[t.t,e.t]}),n=n.next;else{if(i.loop===c.loop){const n={curve:i,ts:[t.t,1]};r.push(n),$p(r,i,c,e.t)}n=n.next}else o=!0,n=n.prevOnCircle}while(n!==e);return r}function $p(t,n,e,r){let o=n;do{o=o.next;const n=o===e?r:1;t.push({curve:o,ts:[0,n]})}while(o!==e)}function Zp(t,n,e,r){const o={...n,order:e,order2:r},i=t.findBounds({pointOnShape:o});if(void 0!==i[0]||void 0!==i[1])return void 0===i[0]||void 0===i[1]?t.getMaxNode()?.datum:i[0].datum}function Jp(t,n,e,r,o,i,c){if(void 0!==i&&!function(t,n,e){const r=mn(n,e.pointOnShape);if(r<0)return!0;if(0===r)return!1;const o=t.getMinNode();if(void 0===o)return!0;const i=o.datum;return mn(t.getMaxNode().datum.pointOnShape,n)<0&&i===e}(r,o,i.next)&&!t)return;const s={pointOnShape:o,isHoleClosing:n,isIntersection:e,id:c.id,next:void 0,prev:void 0,nextOnCircle:void 0,prevOnCircle:void 0};c.id++;const u=void 0===i?s:i,f=void 0===i?s:u.next;return f.prev=s,u.next=s,s.prev=u,s.next=f,r.insert(s),s}function Kp(t,n,e,r,o,i,c){const{cpTrees:s}=o;let u=!1;const f=i.map((i,f)=>{const l=r[f],a=s.get(i.curve.loop),p={...i,circle:e,order:l,order2:0},h=void 0===c?Zp(a,i,l,0):c[f],d=Jp(t,n,!1,a,p,h,o.lastInsertId);return void 0===d&&(u=!0),d});return u||function(t,n){n=n.slice().sort(function(t){const n=t.center;return function(t,e){let r=t.pointOnShape.p,o=e.pointOnShape.p;r=[r[0]-n[0],r[1]-n[1]],o=[o[0]-n[0],o[1]-n[1]];const i=Math.atan2(r[1],r[0]);return Math.atan2(o[1],o[0])-i}}(t));const e=n.length;for(let t=0;t<e;t++){const r=n[t];r.nextOnCircle=n[(t+1)%e],r.prevOnCircle=n[(t-1+e)%e]}}(e,f),{anyFailed:u,cpNodes:f}}const th=Math.cos(Math.PI/180*1);function nh(t,n,e,r,o,i){const{cpTrees:c,maxCoordPowerOf2:s}=t,u=2**(s-40),f=2**(s-46),l=Zp(c.get(n.curve.loop),n,r,o);if(!l)return;const a=[l,l.next],{p,t:h}=n;for(const t of a){const n=t.pointOnShape.p,r=Dt(p,n);if(!(r>u)&&(q(Q(X(n,t.pointOnShape.circle.center)),Q(X(p,e.center)))>th||r<f&&0!==h&&1!==h))return t}}function eh(t,n){const e=[];for(const t of n)e.push([t,t.next]);const r=function(t,n){const e=t.map(Up);let r,o=1/0;for(let i=1;i<t.length-1;i++)for(let c=0;c<3;c++){const s=Gp(t,i,c,e,n);if(void 0===s)continue;const{error:u,threeProngInfo:f}=s;u<o&&(o=u,r=f)}return r}(e,t.maxCoordPowerOf2),{circle:o,poss:i,δ3s:c}=r,s=[];for(let t=0;t<3;t++)s.push(Mp(o.center,i[t]));const u=[];for(let n=0;n<i.length;n++){const e=nh(t,i[n],o,s[n],0);void 0!==e&&v(e)<=2&&!e.isHoleClosing&&u.push(e)}return{closeBysFor3Prong:u,cpNodes:0===u.length?Kp(!0,!1,o,s,t,i,c.map(t=>t[0])).cpNodes:[]}}let rh,oh=0;function ih(t,n){if(Ot(n.pointOnShape))return{closeBysFor3Prong:void 0,addedCpNodes:[]};const e=[];for(;;){if(void 0===n)continue;const r=I(n);if(r.length<=2)break;const{closeBysFor3Prong:o,cpNodes:i}=eh(t,r);if(e.push(i),o.length>0)return{closeBysFor3Prong:o,addedCpNodes:e};if("undefined"!=typeof _debug_&&++oh===_debug_.directives.stopAfterThreeProngsNum)return}return{closeBysFor3Prong:void 0,addedCpNodes:e}}function ch(t){for(const n of t)return n}function sh(t,n,e,r){const o=n[0];g(o).forEach(t=>{e.delete(t),r.delete(t)}),B(o,t)}function uh(t,n,e){const r=new Map;for(let o=0;o<n.length;o++){const i=new up(xn);r.set(t[o],i);const c=n[o];let s,u;for(const t of c){const n={center:t.p,radius:0},{curve:r}=t,o={...t,curve:r,t:1,circle:n,order:-1,order2:0},c={...t,curve:r.next,t:0,circle:n,order:1,order2:0};s=Jp(!0,!1,!1,i,o,u,e),u=Jp(!0,!1,!1,i,c,s,e),s.prevOnCircle=u,u.prevOnCircle=s,s.nextOnCircle=u,u.nextOnCircle=s}}return r}function fh(t){const n=[],e=[],r=[],o=[],i=[];for(const c of t)for(const t of c.curves){const c=t.ps,s=bu(c,!0);r.push(s);const u=Yp(c);n.push(u);const f=ea(c);e.push(f);const l=It(t.ps,t.next.ps);l.isQuiteSharp?o.push(t):l.isQuiteDull&&i.push(t)}return{looseBoundingBoxes:n,tightBoundingBoxes:e,boundingHulls:r,sharpCorners:o,dullCorners:i}}function lh(t){return n=>{const e=[];for(let r=0;r<n.curves.length;r++){const o=n.curves[r];if(!(ta(o.ps)<t)&&It(o.ps,o.next.ps).isQuiteSharp){const{ps:t}=o,n=t[t.length-1],r=[[0,n[0]],[0,n[1]]];e.push({curve:o,t:1,isSource:!0,p:n,pDd:r})}}return e}}function ah(t,n){let e=[0,0];for(let r=0;r<t.length;r++)e=Ut(t[r],Hn(n,e));return e}const ph=tr,hh=Hn,dh=Ut,vh=qo,gh=Zf;function mh(t){if(4===t.length)return function(t){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[dh(ph(s,n),hh(3,ph(r,i))),hh(3,vh(gh(i,n),-2*r)),hh(3,ph(r,n)),[0,n]],[dh(ph(u,e),hh(3,ph(o,c))),hh(3,vh(gh(c,e),-2*o)),hh(3,ph(o,e)),[0,e]]]}(t);if(3===t.length)return function(t){const[[n,e],[r,o],[i,c]]=t;return[[vh(gh(i,n),-2*r),ph(2*r,2*n),[0,n]],[vh(gh(c,e),-2*o),ph(2*o,2*e),[0,e]]]}(t);if(2===t.length)return function(t){const[[n,e],[r,o]]=t;return[[ph(r,n),[0,n]],[ph(o,e),[0,e]]]}(t);if(1===t.length)return function(t){const[[n,e]]=t;return[[[0,n]],[[0,e]]]}(t);throw new Error("The given bezier curve must be of order <= cubic.")}function xh(t,n){const e=t[0],r=t[1],o=r-n,i=o-r,c=e-e,s=r-(o-i)+(-n-i)+e,u=o+s,f=e-(e-c)-c+(s-(u-o)),l=u+f;return[f-(l-u),l]}const bh=Hn,wh=Ut,_h=Gn,Mh=ii,Ih=br,Sh=nr,yh=xh,Oh=tr,Ch=Ut,Nh=Gn,Eh=ii,Th=br,Ph=nr,kh=xh,Ah=Hn,Bh=Ut,zh=Gn,Fh=ii,Yh=br,Dh=nr,Lh=xh,Xh=Ut,qh=Gn,Wh=nr,jh=xh;function Hh(t,n,e){const[r,o]=t,[i,c]=n,[s,u]=e,f=jh(r,s),l=jh(o,u);return{a0:Xh(qh(Wh(i),f),qh(Wh(c),l)),b0:Xh(qh(f,f),qh(l,l))}}const Vh=[,,function(t,n,e){const[r,o]=t,[i,c]=n,[[s,u],[f,l]]=e,a=Oh(f,s),p=Oh(l,u),h=kh(r,s),d=kh(o,u),v=Ch(Nh(i,a),Nh(c,p)),g=Eh(Ch(Nh(a,a),Nh(p,p))),m=Ch(Nh(a,h),Nh(p,d)),x=Th(v),b=Ch(Nh(Ph(i),h),Nh(Ph(c),d)),w=Eh(g),_=Th(m),M=Ch(Nh(h,h),Nh(d,d));return{A:[x,b],B:[w,_,M],C:[v],D:[g,m],H:[Nh(w,v),Nh(b,g),Ch(Nh(b,m),Eh(Nh(M,v)))]}},function(t,n,e){const[r,o]=t,[i,c]=n,[[s,u]]=e,[[f,l],[a,p]]=mh(e),h=yh(r,s),d=yh(o,u),v=Sh(wh(_h(i,f),_h(c,a))),g=wh(_h(i,l),_h(c,p)),m=wh(_h(i,h),_h(c,d)),x=wh(_h(f,f),_h(a,a)),b=wh(_h(l,f),_h(p,a)),w=wh(_h(l,l),_h(p,p)),_=wh(_h(h,f),_h(d,a)),M=wh(_h(l,h),_h(p,d)),I=wh(_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h(ed(ed(et)),td(Zh(t,nt)))))))))]}}(p,e,l):function(t,n,e){if(1===e.length){const{a0:r,b0:o}=Hh(t,n,e[0]);return{A:[r],B:[o],C:[],D:[],H:[]}}return Vh[e.length](t,n,e)}(d,e,l);x=Fe(o,u,f)||[];for(let o=0;o<x.length;o++){const i=x[o],{tS:c,tE:l,t:a}=i;if(i.multiplicity>1)continue;if(l<u||c>f)continue;if(c<0)continue;const p=l>1?1:a,d=ah(n,p),v=ah(r,p),g=d[0]+d[1],_=v[0]+v[1],M=od(g);if(id(M)<2**-40)continue;const I=-_/g;if(I<=0)continue;const S=[cd(I,e[0]),cd(I,e[1])],y=[S[0][1],S[1][1]],O=rd(Ip(y));if(O<=2**(t-40))continue;const C=[h[0]+y[0],h[1]+y[1]];i.tS<=u&&i.tE>=u&&(b=!0),i.tS<=f&&i.tE>=f&&(w=!0);const N=0===p?1:p,E={curve:0===p?s.prev:s,s:N,d:O,x:C};m.push(E)}}const _=l[l.length-1];let M=0===p&&s===a.prev||1===p&&s===a;const I=[];if(0===u);else if(1===u)M||b||I.push({P:_,t:1});else if(!b){const t=Ye(l,u);I.push({P:t,t:u})}if(u!==f)if(0===f);else if(1===f)M||w||(I.push({P:_,t:1}),M=!0);else if(!w){const t=Ye(l,f);I.push({P:t,t:f})}for(let t=0;t<I.length;t++){const{P:n,t:r}=I[t],{a0:o,b0:i}=Hh(d,e,n);if(od(o[1])<=2**-40||od(i[1])<=2**-40)continue;const c=-i[1]/o[1];if(c<2**-40)continue;const u=[cd(c,e[0]),cd(c,e[1])],f=[u[0][1],u[1][1]],l=rd(Ip(f)),a=[h[0]+f[0],h[1]+f[1]],p=0===r?1:r,v={curve:0===r?s.prev:s,s:p,d:l,x:a};m.push(v)}return m}function ud(t,n,e){const[r,o]=t,[i,c]=n,[s,u]=e,f=r-s,l=o-u;return{a0:2*(i*f+c*l),b0:f*f+l*l}}const{abs:fd}=Math,ld=1+2**-20,ad=1+2**-20,pd=D(ea),hd=Gt,dd=Ut,vd=$t,gd=jn,{acos:md}=Math,xd=Zf,bd=tr,wd=Hn,_d=Ut,Md=qo;function Id(t){if(4===t.length)return function(t){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[wd(3,_d(bd(s,n),wd(3,bd(r,i)))),wd(6,Md(xd(i,n),-2*r)),wd(3,bd(r,n))],[wd(3,_d(bd(u,e),wd(3,bd(o,c)))),wd(6,Md(xd(c,e),-2*o)),wd(3,bd(o,e))]]}(t);if(3===t.length)return function(t){const[[n,e],[r,o],[i,c]]=t;return[[Md(xd(2*i,2*n),-4*r),bd(2*r,2*n)],[Md(xd(2*c,2*e),-4*o),bd(2*o,2*e)]]}(t);if(2===t.length)return function(t){const[[n,e],[r,o]]=t;return[[bd(r,n)],[bd(o,e)]]}(t);if(1===t.length)return[[[0,0]],[[0,0]]];throw new Error("The given bezier curve must be of order <= 3.")}const Sd=tr,yd=Ut,Od=Hn,Cd=qo;function Nd(t){if(4===t.length){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[Od(6,yd(Sd(s,n),Od(3,Sd(r,i)))),Od(6,Cd(Sd(i,2*r),n))],[Od(6,yd(Sd(u,e),Od(3,Sd(o,c)))),Od(6,Cd(Sd(c,2*o),e))]]}if(3===t.length){const[[n,e],[r,o],[i,c]]=t;return[[Cd(Sd(2*i,4*r),2*n)],[Cd(Sd(2*c,4*o),2*e)]]}if(t.length<=2)return[[[0,0]],[[0,0]]];throw new Error("The given bezier curve must be of order <= 3.")}const Ed=Gn,Td=Ut,Pd=$t;const{sqrt:kd}=Math;function Ad(t,n,e){const{curve:r,p:o,t:i}=n,{ps:c}=r,s=1/t,u=function(t,n){const[e,r]=function(t,n){const[e,r]=Id(t),[o,i]=Nd(t),c=ah(e,n),s=ah(r,n),u=ah(o,n),f=ah(i,n),l=Pd(Ed(c,f),Ed(s,u)),a=Td(Ed(c,c),Ed(s,s));return[l,tl(Ed(a,Ed(a,a)))]}(t,n);return Ys(e,r)}(c,i),f=-(u[0]+u[1]),l=f<s?s:f,[a,p]=e,h=kd(a*a+p*p)*l;return[[o[0]+a/h,o[1]+p/h],1/l]}const{sqrt:Bd}=Math,{abs:zd,sin:Fd,cos:Yd,max:Dd,sqrt:Ld}=Math;function Xd(t){const{loops:n,maxCoordPowerOf2:e,squaredDiagonalLength:r}=t,o=(2**(e-21))**2,i=2**(e-46),c=Ld(r),s=2**(e-32);return function(r,u,f,l){const{curve:{loop:a,ps:p},t:h,p:d}=l,v=function(t,n){const[e,r]=Id(t),o=ah(r,n);return[[-o[0],-o[1]],ah(e,n)]}(p,h),g=[-v[0][1],-v[1][1]],m=r?[0,-c]:0!==f?R(Fd(f),Yd(f))(g):g,x=r||0!==f?[[0,m[0]],[0,m[1]]]:[[-v[0][0],-v[0][1]],[-v[1][0],-v[1][1]]];let[b,w]=function(t,n,e,r,o){let i,c;const{p:s}=r;if(n)return[[s[0],s[1]-e],e];if(0===t)return Ad(e,r,o);const{p:u}=r,[f,l]=o,a=e/Bd(f*f+l*l),p=[f*a,l*a];return i=[u[0]+p[0],u[1]+p[1]],c=e,[i,c]}(f,r,c,l,m);const _=function(t,n,e,r,o,i,c){const{cpTrees:s}=o;if(n)return r.filter(t=>t!==e).flatMap(t=>t.curves.map(t=>({curve:t,ts:[0,1]})));const u=yt(i)&&St(i).isDull?1===i.t&&0===t?-1:0===i.t?1:Mp(c,i):0,f=Zp(s.get(e),i,u,0);return f&&f!==f.next.next?Up([f,f]):e.curves.map(t=>({curve:t,ts:[0,1]}))}(f,r,a,n,t,l,b),M=function(t,n,e,r,o){let i=n**2,c=[r[0]+o[0],r[1]+o[1]];for(let t=0;t<e.length;t++){const n=e[t],{ps:s}=n.curve,u=s[0],f=s[s.length-1];for(const t of[u,f]){if(mu(c,t)>i)continue;const{a0:n,b0:e}=ud(r,o,t);if(fd(n)<=2**-40||fd(e)<=2**-40)continue;const s=-e/n;if(s<2**-40)continue;const u=[s*o[0],s*o[1]],f=Ip(u);f<i&&(i=f,c=[r[0]+u[0],r[1]+u[1]])}}return ld*i}(0,w,_,d,m),I=Ld(M),S=Ld(m[0]**2+m[1]**2);b=[d[0]+m[0]/S*I,d[1]+m[1]/S*I],function(t,n,e){if(t.length<=2)return t;let r=0;for(let o=0;o<t.length;o++){const i=t[o],{ps:c}=i.curve;Fp(Yp(c),n)<=ad*e&&Dp(pd(c),n)<=ad*e&&(t[r]=i,r++)}t.length=r}(_,b,M);const y=function(t,n,e,r,o,i,c){const s=[];for(let n=0;n<c.length;n++){const u=sd(t,0,e,r,o,i,c[n]);s.push(...u)}let u=1/0;for(let t=0;t<s.length;t++){const n=s[t].d*(1+2**-46);n<u&&(u=n)}const f=[];for(let t=0;t<s.length;t++){const n=s[t];n.d*(1-2**-46)<=u&&f.push(n)}return f}(e,0,x,l,u,f,_);if(1!==y.length){if(0===y.length)return void(r&&console.log(l));if(!r&&!function(t,n){const{curve:e,s:r,x:o}=t[0],i=2**(n-40);for(let n=1;n<t.length;n++){const{x:e}=t[n];if(zd(o[0]-e[0])>i||zd(o[0]-e[0])>i)return!1}return!0}(y,e))return}const{x:O,d:C,curve:N,s:E}=y[0];if(u&&w<(1-s)*C)return void function(t,n,e,r){if(yt(r)&&St(r).isDull)return;const o={radius:n,center:e};nh(t,r,o,Mp(o.center,r),0)||Kp(!1,!1,o,[-.5,.5],t,[r,r])}(t,w,b,l);const T=Xp(N.ps,E),P={curve:N,t:E,isSource:!1,p:T.map(t=>t[0]+t[1]),pDd:T},k={center:O,radius:C},A=Pp(l.p,P.p),B=Pp(O,P.p);if(!r){if(0===A)return;if(A<=Dd(function(t,n,e){if(n+e>=t)return 1/0;const r=tr(t,n),o=gd(n,r),i=t-n,c=n*i,s=(c-n*e-e*e/2)/(c+i*e),u=Ys(vd(vd(o,hd(n,e)),hd(e,e/2)),dd(o,gd(e,r)))[1];return md(s),n*md(u)}(w,Ld(B),4*i),o))return}return{circle:k,z:P}}}function qd(t,n,e,r,o){e=0===e.t?{...e,curve:e.curve.prev,t:1}:e;const i=Mp(n.center,e),c=Mp(n.center,r),s={...r,circle:n,order:c,order2:0},u={...e,circle:n,order:i,order2:0};if(nh(t,e,n,i,0))return;if(nh(t,r,n,c,0))return;const{anyFailed:f,cpNodes:l}=Kp(o,o,n,[i,c],t,[u,s]);if(!f)return o&&function(t,n){const{cpTrees:e}=t,[r,o]=n,i=o.pointOnShape,c=Jp(!0,!0,!1,e.get(i.curve.loop),{...i,order2:1},o,t.lastInsertId);c.holeCloserTwin=o,o.holeCloserTwin=c;const s=r.pointOnShape,u=Jp(!0,!0,!1,e.get(s.curve.loop),{...r.pointOnShape,order2:-1},r.prev,t.lastInsertId);u.holeCloserTwin=r,r.holeCloserTwin=u,u.prevOnCircle=c,u.nextOnCircle=c,c.prevOnCircle=u,c.nextOnCircle=u,o.next=r,r.prev=o,u.next=c,c.prev=u}(t,l),l[0];l.forEach(n=>{void 0!==n&&A(n,t)})}const{PI:Wd,atan2:jd}=Math;function Hd(t,n,e,r){let o;const i=Xd(t),c=n*Wd/180;for(let n=0;n<e.length;n++){const s=e[n],u=Vd(c,s);for(const e of u){const c=i(!1,r,e,s);if(c){const{circle:n,z:e}=c,r=qd(t,n,s,e,!1);o=o||r}if("undefined"!=typeof _debug_&&n+1===_debug_.directives.stopAfterTwoProngsNum)return}}return o}function Vd(t,n){const e=[0];if(1===n.t){const{curve:r}=n,o=It(r.ps,r.next.ps);if(o.isQuiteDull){const n=_p(o.tangents[0]),r=_p(o.tangents[1]),i=(jd(n[1],n[0])+2*Wd)%(2*Wd),c=((jd(r[1],r[0])+2*Wd)%(2*Wd)-i+2*Wd)%(2*Wd);let s=t;for(;s<=c-t/2;)e.push(s),s+=t}}return e}function Qd(t,n,e,r){let o;for(let i=0;i<e.length;i++){const c=Hd(t,n,e[i],r);o=void 0===o?c:o}return o}function Rd(t,n=.4,e=10,r=2**-16){const o=[0],i=[1];for(;;){const c=o[o.length-1],s=i[i.length-1],u=P(t,c,s),f=ta(u),l=nn(u);if(f<=e&&l<=n||s-c<=r){if(o.push(i.pop()),1===s)return o;continue}const a=(c+s)/2;i.push(a)}}function Gd(t){if(t.length<4)return[];const[[n,e],[r,o],[i,c],[s,u]]=t,f=r-n,l=o-e,a=i-r-f,p=c-o-l,h=s-i-f-2*a,d=u-c-l-2*p,v=a*d-p*h,g=f*d-l*h,m=f*p-l*a;return Fe([v,g,m],0,1)?.map(t=>t.t)||[]}function Ud(t,n,e){return function(r){const o=[],i=r.curves;for(let r=0;r<i.length;r++){const c=i[r],s=c.ps;if(ta(s)<t)continue;let u=Rd(s,n,e);u=2===u.length?[.5]:u,u.push(...Gd(s)),u=u.filter(t=>0!==t&&1!==t);const f=u.map(t=>{const n=Xp(c.ps,t),e=n.map(t=>t[0]+t[1]);return{curve:c,t,isSource:!0,p:e,pDd:n}});o.push(...f)}return o}}const $d=tr,Zd=Ut,Jd=Hn,Kd=nr,tv=er,nv=Hn,ev=Gn,rv=Ut,ov=$t;const iv=tr,cv=Hn,sv=Gn,uv=Ut,fv=$t;function lv(t){if(Il(t))return{minima:[],maxima:[],inflections:[]};if(4===t.length&&Uu(t)&&(t=Wc(t)),3===t.length){const n=function(t){const[[n,e],[r,o],[i,c]]=t,s=iv(r,n),u=iv(i,r),f=fv(u,s),l=iv(o,e),a=iv(c,o),p=fv(a,l),h=uv(fv(cv(n,fv(f,[0,r])),cv(r,fv(u,[0,r]))),fv(cv(e,fv(p,[0,o])),cv(o,fv(a,[0,o]))));return[uv(sv(f,f),sv(p,p)),ii(h)]}(t);return{minima:[],maxima:Fe(n,0,1)?.map(t=>t.t)||[],inflections:[]}}const n=function(t){const[[n,e,r],[o,i,c]]=Id(t),[[s,u],[f,l]]=Nd(t),[[a],[p]]=function(t){if(4===t.length){const[[n,e],[r,o],[i,c],[s,u]]=t;return[[Jd(6,Zd($d(s,n),Jd(3,$d(r,i))))],[Jd(6,Zd($d(u,e),Jd(3,$d(o,c))))]]}if(t.length<=3)return[[[0,0]],[[0,0]]];throw new Error("The given bezier curve must be of order <= 3.")}(t),h=ev(a,i),d=ev(p,e),v=ev(u,c),g=ev(u,i),m=ev(f,f),x=ev(s,c),b=ev(l,r),w=ev(l,e),_=ev(f,r),M=ev(r,e),I=ev(r,n),S=ev(r,o),y=ev(e,e),O=ev(e,n),C=ev(e,i),N=ev(n,c),E=ev(n,o),T=ev(n,n),P=ev(c,i),k=ev(c,o),A=ev(i,i),B=ev(i,o),z=ev(o,o),F=ov(ev(a,c),ev(p,r)),Y=ov(h,d),D=rv(ev(u,r),ev(l,c)),L=rv(rv(ev(u,e),ev(s,r)),rv(ev(l,i),ev(f,c))),X=ov(v,b),q=ov(rv(g,x),rv(w,_)),W=rv(ev(r,r),ev(c,c)),j=rv(M,P),H=rv(C,N),V=rv(k,A),Q=rv(I,y),R=rv(ev(e,o),ev(n,i)),G=ov(T,z),U=ov(O,B),$=rv(S,C),Z=ov(M,P),J=rv(ev(r,i),ev(e,c)),K=rv(k,V),tt=rv(I,Q),nt=rv(S,H),et=rv(C,H),rt=ov(tt,K),ot=rv(H,N),it=rv($,N),ct=rv(nr(w),_),st=ev(T,ov(h,nv(3,d))),ut=ev(z,ov(nv(3,h),d)),ft=nr(rv(ev(E,rv(ov(ev(a,e),ev(p,i)),nv(3,ov(ev(l,f),ev(u,s))))),nv(3,ev(ev(s,f),U)))),lt=nv(3,rv(ev(R,ov(m,ev(s,s))),ev(G,rv(ev(u,f),ev(l,s))))),at=rv(rv(st,ut),rv(ft,lt)),pt=ev(a,rv(ev(o,rv(tt,nv(3,V))),ev(n,et))),ht=ev(p,rv(rv(ev(r,rv(nv(3,T),z)),ev(e,rv(nv(3,O),Kd(B)))),ev(n,K))),dt=nv(3,rv(rv(ev(u,rv(ov(ev(l,G),ev(u,E)),Kd(ov(ev(f,U),ev(s,R))))),ev(s,ov(rv(Kd(ev(l,U)),ev(f,rv(Kd(ov(I,k)),ov(y,A)))),ev(s,it)))),rv(ev(l,rv(ev(l,E),Kd(ev(f,R)))),ev(m,nt)))),vt=rv(ov(pt,ht),dt),gt=ev(a,rv(rv(Kd(ev(r,R)),ev(e,ot)),ev(i,rv(tv(k),K)))),mt=ev(p,rv(rv(Kd(ev(r,rv(nv(3,O),B))),ev(e,rv(y,Kd(k)))),ev(i,ot))),xt=nv(3,rv(rv(ev(u,ov(rv(Kd(ov(ev(l,U),ev(s,it))),ev(f,rt)),ev(u,R))),ev(s,ov(Kd(ev(f,Z)),ev(s,J)))),rv(ev(l,rv(rv(ev(l,R),Kd(ev(f,nt))),ev(s,rt))),ev(m,J)))),bt=rv(ov(gt,mt),xt),wt=ev(a,rv(ev(r,rv(S,Kd(H))),ev(c,rv(y,nv(3,V))))),_t=ev(p,rv(ev(r,rv(nv(3,Q),K)),ev(c,et))),Mt=nv(3,rv(rv(ev(u,rv(ov(ev(l,rt),ev(u,nt)),Kd(ov(ev(f,Z),ev(s,J))))),ev(s,ov(ev(r,ov(ct,ev(s,c))),ev(c,rv(Kd(ev(l,i)),ev(f,c)))))),rv(ev(l,rv(ev(l,H),ev(r,rv(Kd(ev(f,i)),ev(l,o))))),ev(f,ev(c,ct))))),It=rv(ov(wt,_t),Mt),St=ov(rv(ev(W,Y),Kd(ev(j,F))),nv(3,rv(ev(D,q),ev(L,X)))),yt=ov(ev(F,W),nv(3,ev(D,X)));return{inflectionPoly:[ov(ev(s,o),ev(f,n)),ov(rv(ev(u,o),ev(s,i)),rv(ev(l,n),ev(f,e))),ov(rv(g,x),rv(w,_)),ov(v,b)],otherExtremaPoly:[at,vt,bt,It,St,yt]}}(t),e=n.inflectionPoly,r=n.otherExtremaPoly,o=Fe(r,0,1)?.map(t=>t.t)||[],i=function(t){const n=t.length-1;if(n<=0)return[];const e=new Array(n);for(let r=0;r<n;r++)e[r]=Hn(n-r,t[r]);return e}(r),c=[],s=[];for(let t=0;t<o.length;t++){const n=o[t],r=fe(i,n);ct(et(fe(e,n),r))>=0?c.push(n):s.push(n)}return{minima:c,maxima:s,inflections:Fe(e,0,1)?.map(t=>t.t)||[]}}function av(t){const{curve:n,t:e}=t,{ps:r}=n,o=Xp(r,e),i=o.map(t=>t[0]+t[1]);return{curve:n,t:t.t,isSource:!0,p:i,pDd:o}}function pv(t,n,e,r,o){(o&&(r>t.val||r===t.val&&e>t.t)||!o&&(r<t.val||r===t.val&&e>t.t))&&(t.curve=n,t.t=e,t.val=r)}const hv=D(function(t){const n=[{curve:void 0,t:void 0,val:1/0},{curve:void 0,t:void 0,val:1/0}],e=[{curve:void 0,t:void 0,val:-1/0},{curve:void 0,t:void 0,val:-1/0}];return t.curves.forEach(function(t){const r=vo(t.ps);for(let o=0;o<2;o++)pv(n[o],t,r.ts[0][o],r.box[0][o],!1),pv(e[o],t,r.ts[1][o],r.box[1][o],!0)}),{minX:av(n[0]),minY:av(n[1]),maxX:av(e[0]),maxY:av(e[1])}});function dv(t){return hv(t).minY}function vv(t){const{loops:n}=t,e=n.map(dv);let r;const o=Xd(t);for(let n=1;n<e.length;n++){const i=e[n],c=o(!0,!1,0,i);if(!c)throw new Error("Unable to find hole-closing 2-prong");const{circle:s,z:u}=c,f=qd(t,s,i,u,!0);r=void 0===r?f:r}return r}const gv=D(function(t){let n,e,r,o,i=1/0,c=-1/0,s=1/0,u=-1/0;for(const f of t){const t=hv(f);t.minX.p[0]<i&&(n=t.minX,i=t.minX.p[0]),t.maxX.p[0]>c&&(e=t.maxX,c=t.maxX.p[0]),t.minY.p[1]<s&&(r=t.minY,s=t.minY.p[1]),t.maxY.p[1]>u&&(o=t.maxY,u=t.maxY.p[1])}return{minX:n,minY:r,maxX:e,maxY:o}});function mv(t,n,e){"undefined"!=typeof _debug_&&(rh=performance.now());const{minBezLength:r,maxCurviness:o,maxLength:i,angleIncrement:c}=e,s=lh(r),u=function(t){return n=>{const e=[];for(let r=0;r<n.curves.length;r++){const o=n.curves[r];if(ta(o.ps)<t)continue;const{next:i,ps:c}=o;if(It(c,i.ps).isQuiteDull){const t=c[c.length-1],n=[[0,t[0]],[0,t[1]]];e.push({curve:o,t:1,isSource:!0,p:t,pDd:n}),e.push({curve:i,t:0,isSource:!0,p:t,pDd:n})}}return e}}(r),f=Ud(r,o,i),l=function(t){return function(n){const e=[];for(let r=0;r<n.curves.length;r++){const o=n.curves[r];if(ta(o.ps)<t)continue;const{ps:i}=o;e.push(...lv(i).maxima.map(t=>{const n=Xp(i,t),e=n.map(t=>t[0]+t[1]);return{curve:o,t,isSource:!0,p:e,pDd:n}}))}return e}}(r),a=gv(t),h=(a.maxX.p[0]-a.minX.p[0])**2+(a.maxY.p[1]-a.minY.p[1])**2,d=t.map(s),v={id:0},g={maxCoordPowerOf2:n,squaredDiagonalLength:h,loops:t,cpTrees:uh(t,d,v),lastInsertId:v,...fh(t)};let m;if(m=vv(g),"undefined"!=typeof _debug_&&_debug_.directives.stopAfterHoleClosers)return{cpNode:m,meta:g};if(function(){if("undefined"==typeof _debug_)return;const t=performance.now();_debug_.timing.holeClosers+=t-rh,rh=t}(),m=Qd(g,c,t.map(u),!1)||m,m=Qd(g,c,t.map(l),!0)||m,m=Qd(g,c,t.map(f),!1)||m,function(){if("undefined"==typeof _debug_)return;const t=performance.now();_debug_.timing.oneAnd2Prongs+=t-rh,rh=t}(),"undefined"!=typeof _debug_&&_debug_.directives.stopAfterTwoProngs)return{cpNode:m,meta:g};if(m=function(t,n){if(void 0===n)return;const e=new Set;let r=!0;for(;r;){r=!1;const o=new Set(p(n));for(const n of o){const{closeBysFor3Prong:i,addedCpNodes:c}=ih(t,n);c.length>0&&(r=!0),void 0===i?e.add(n):(r=!0,sh(t,i,o,e)),c.forEach(t=>t.forEach(t=>e.add(t)))}n=ch(e)}return n}(g,m),void 0===m)return;if("undefined"!=typeof _debug_&&_debug_.directives.stopAfterThreeProngs)return{cpNode:m,meta:g};const x={cpNode:m,meta:g};return"undefined"!=typeof _debug_&&(_debug_.timing.threeProngs+=performance.now()-rh),x}const{ceil:xv,log2:bv}=Math;function wv(t,n){const{maxCoordinate:e}=function(t){let n=0,e=1/0,r=-1/0,o=1/0,i=-1/0;for(const c of t)for(const t of c)for(const c of t){const t=c[0],s=c[1],u=Wa(ja(t),ja(s));u>n&&(n=u),t<e&&(e=t),t>r&&(r=t),s<o&&(o=s),s>i&&(i=s)}return{maxCoordinate:n,width:r-e,height:i-o}}(t),r=xv(bv(e)),o=function(t,n){const e={...n};for(const n in wp){const r=n;let o=e[r];const i=wp[r],{range:c,scaleByMaxCoordinate:s}=i;o<c[0]&&(o=c[0]),o>c[1]&&(o=c[1]),s&&(o*=2**(t-10)),e[r]=o}return e}(r,{...bp,...n||{}}),{applySat:i,simplify:c,satScale:s,simplifyTolerance:u}=o,f=qa(t,void 0,{forceOrientationNegative:!0}),l=[];for(const t of f){let n=mv(t,r,o);void 0!==n&&(i&&(n=xp(n,s)),c&&(n=ap(n,u,50)),l.push(n))}return l}function _v(t){const n=function(t){let n=t;const e=hp(t);for(;e.length;){const r=e.pop();if(r.isHoleClosing||r.isIntersection)continue;let o=r.next;for(;;){o=o.next;let e=!1;const r=o.prevOnCircle;if(v(o)>2){const n=o.nextOnCircle;At(o,t)?e=!0:o.next===n?o=n:n.next!==r&&(e=!0)}else if(m(o)&&!o.isIntersection)return void(n=o);if(e){r.next=o,o.prev=r,n=o;break}}}return n}(N(t.cpNode));if(n)return{cpNode:n,meta:{...t.meta,cpTrees:fp(n)}}}function Mv(t){if(!t)return void(window._debug_=void 0);let n=window._debug_;n={...n,elems:{...n?.elems},timing:{...n?.timing,holeClosers:0,oneAnd2Prongs:0,threeProngs:0,sats:0,simplifyMat:0},fs:{...n?.fs},directives:{...n?.directives,stopAfterHoleClosers:!1,stopAfterHoleClosersNum:void 0,stopAfterTwoProngs:!1,stopAfterTwoProngsNum:void 0,stopAfterThreeProngs:!1,stopAfterThreeProngsNum:void 0}},window._debug_=n}function Iv(t,n,e,r){const o=[];for(const r of t)o.push({type:0,item:r,x:n(r)}),o.push({type:1,item:r,x:e(r)});o.sort(Sv);const i=new Set,c=[];for(const t of o){const{item:n}=t;if(0===t.type){for(const t of i.values())r(n,t)&&c.push([n,t]);i.add(n)}else 1===t.type&&i.delete(t.item)}return c}function Sv(t,n){const e=t.x-n.x;return 0!==e?e:0===t.type?-1:1}const yv=1e-4;function Ov(t,n){const e=t.pointOnShape,r=n.pointOnShape;let{curve:o,p:i,t:c}=e,{curve:s,p:u,t:f}=r;if(i[0]===u[0]&&i[1]===u[1])return[i];1===c&&(c=0,o=o.next),0===f&&(f=1,s=s.prev);const{ps:l}=o,{ps:a}=s,p=[i,V(i)(Q($(l,c)))],h=[u,V(u)(Q($(a,f)))],d=L(p,h),v=X(i,u);let g;if(d){const t=X(i,d),n=X(u,d);g=q(t,v)<0||q(n,v)>0}else g=!0;if(!g)return[i,d,u];const m=X(p[0],p[1]),x=X(h[0],h[1]),b=Math.abs(j(v,m))/9,w=Math.abs(j(v,x))/9;return b>.01||w>.01||b>yv||w>yv?void 0:[i,u]}const Cv=D(function(t){return an(Pt(t))});function Nv(t,n){const e=function(t){const n=new Map;for(let e of t)for(let r of t){const t=e.pointOnShape.circle.center,o=r.pointOnShape.circle.center,i=e.pointOnShape.p,c=r.pointOnShape.p;r!==e&&t[0]===o[0]&&t[1]===o[1]&&i[0]===c[0]&&i[1]===c[1]&&n.set(e,r)}return n}(n),r=t.length,o=[];for(let n=0;n<r;n++){const i=t[n],c=[];for(let o=0;o<r;o++){const r=t[o];if(n===o){c.push(0);continue}let s=1/0;for(const t of g(i)){let n=Cv(t),o=t.next;for(;!At(o,r);)if(o.isHoleClosing)o=Ev(e,o);else{if(_n(o)){n=1/0;break}n+=Cv(o),o=o.next}n<s&&(s=n)}c.push(s)}o.push(c)}return o}function Ev(t,n){return t.get(n).next}function Tv(t){let{cpNode:n}=t,e=n;do{if(w(n)||n.next!==n.nextOnCircle){n=n.next;continue}const t=n.next,r=t.next,o=n.next.nextOnCircle;n.next=r,n.nextOnCircle=o,r.prev=n,o.prevOnCircle=n,e===t&&(e=n),n=n.next}while(n!==e);return t.cpNode=n,t}function Pv(t,n){return t.pointOnShape.curve.loop===n.pointOnShape.curve.loop}function kv(t){const n=[],e=[t],r=new Set(e);for(t.isHoleClosing&&r.add(t.prevOnCircle.holeCloserTwin),r.add(t);e.length>0;){const t=[],o=e.pop(),i=o.pointOnShape.curve.loop;let c=o;do{if(i===c.pointOnShape.curve.loop){t.push(c),c=c.next;continue}const n=c.holeCloserTwin;r.has(n)||(r.add(n),r.add(n.prevOnCircle.holeCloserTwin),e.push(n)),c=c.prev.holeCloserTwin}while(c!==o);n.push(t)}return n}function Av(t){let{cpNode:n}=t;for(;!w(n);)n=n.next;return Pv(n,n.next)||(n=n.holeCloserTwin),kv(n)}const{max:Bv,abs:zv,round:Fv,log2:Yv}=Math;function Dv(t,n=void 0){const e=function(t,n){return function(e){const r=e.next,o=e.pointOnShape,i=r.pointOnShape,{curve:c,circle:s,p:u}=o,{curve:f,p:l}=i;if(u[0]===l[0]&&u[1]===l[1])return;if(c.loop!==f.loop)return;const a=Dt(s.center,u);if(x(e),void 0!==n){const e=2**(t-n);if(zv(s.radius-a)>e)throw new Error(`Medial circle radius must be about the same (2**${Fv(Yv(e))}) as distance from medial circle center to point on shape, found: medial radius ${s.radius}, distance: ${a}`)}return function(t){const n=t.next,e=t.pointOnShape,r=n.pointOnShape,{p:o}=e,{p:i}=r,c=o,s=jv(t,Lv),u=i,f=jv(n,Xv),l=L(s,f),a=X(c,u);let p;if(l){const t=X(c,l),n=X(u,l);p=q(t,a)<0||q(n,a)>0}else p=!0;if(!p)return[c,l,u];const h=W(a),d=X(s[0],s[1]),v=X(f[0],f[1]),g=zv(j(a,d))/9,m=zv(j(a,v))/9;if(g>qv||m>qv)return[c,u];if(g>Wv||m>Wv){const t=H(c,u,1/3),n=H(c,u,2/3),e=V(h,t),r=[n,V(h,n)];return[c,L(s,[t,e]),L(f,r),u]}return[c,u]}(e)}}(Bv(...t.map(t=>t.meta.maxCoordPowerOf2)),n),r=function(t,n,e){if(!Number.isInteger(3))throw new Error("depth must be an integer >= 1");return function t(n,r){const o=r;if(1===n){const t=[];for(let n=0;n<o.length;n++){const r=e(o[n]);void 0===r||t.push(r)}return t}const i=[];for(let e=0;e<o.length;e++)i.push(t(n-1,o[e]));return i}(3,n)}(0,t.map(Tv).map(Av),e);return r}const Lv=0,Xv=1,qv=.01,Wv=1e-4;function jv(t,n){let{pointOnShape:e}=t,{curve:r,t:o,p:i}=e,{ps:c}=r;return n===Lv&&1===o&&(o=0,r=r.next,c=r.ps),n===Xv&&0===o&&(o=1,r=r.prev,c=r.ps),[i,V(i,$(c,o))]}function Hv(t,n){return{center:t.center,radius:n*t.radius}}export{bn as CpNodeFs,e as beziersToSvgPathStr,N as clone,xn as cpNodeComparator,uh as createInitialCpTree,Mv as enableDebugForMat,M as enhanceCpNode,Xd as find2Prong,vv as findAndAddHoleClosing2Prongs,wv as findMats,a as floydWarshall,g as getAllOnCircle,p as getAllOnLoop,kv as getAllOnLoop_ByLoop,gn as getAllVertices,T as getBoundaryBezierPartsToNext,pn as getBoundaryBeziersBetween,k as getBoundaryBeziersToNext,Up as getBoundaryPieceBeziers,Ft as getBranch,Yt as getBranchBeziers,cp as getBranches,z as getChildren,qp as getCloseBoundaryPointsCertified,Fp as getClosestSquareDistanceToRect,Ct as getEdgeDirection,kt as getFirstExit,Ud as getFor2ProngsOnLoop,Nv as getGraph,h as getHoleClosers,Ov as getImpliedBoundaryBezierBetween,vn as getInitialDegAngleBetweenMatCurves,Tt as getMatCurveBetween,Pt as getMatCurveToNext,dn as getMatCurvesBetween,Ad as getOsculatingCircle,fh as getPartialMeta,l as getPathsFromStr,Ap as getPotentialClosestPointsOnCurveCertified,v as getProngCount,x as getRealProngCount,hn as getSalience,mp as getSatCulls,gv as getShapeBounds,lh as getSharpCornersOnLoop,y as getVertexForwardChildren,w as isFullyTerminating,At as isOnSameCircle,Pv as isOnSameLoop,Bt as isOneProng,_ as isSharp,m as isTerminating,b as isTrivial,zt as isTwoProng,_n as isVertexSpecial,t as loopFromBeziers,Dv as reconstructFromMats,B as removeVertex,Hv as scaleCircle,ap as simplifyMat,Iv as sweepLine,xp as toScaleAxis,I as traverseCp,S as traverseEdges,O as traverseVertices,_v as trimMat};
|
|
1
|
+
function t(t=[],e){const o=[],r={beziers:t,curves:o,idx:e};if(0===t.length)return r;let c,i=0;for(let e=0;e<t.length;e++){if(n(t[e]))continue;const s={loop:r,ps:t[e],prev:c,next:void 0,idx:i};c&&(c.next=s),c=s,o.push(s),i++}const s=o[o.length-1];return o[0].prev=s,s.next=o[0],s.ps[s.ps.length-1]=o[0].ps[0],r}function n(t){if(t.length<=1)return!0;const n=t[0],e=t[1],o=n[0]===e[0]&&n[1]===e[1];if(2===t.length)return o;const r=t[2],c=e[0]===r[0]&&e[1]===r[1];if(3===t.length)return o&&c;const i=t[3],s=r[0]===i[0]&&r[1]===i[1];return o&&c&&s}function e(t){const n=[];for(let e=0;e<t.length;e++){const o=t[e];0===e&&n.push("M "+o[0][0].toString()+" "+o[0][1].toString()),4===o.length?n.push("C "+o[1][0].toString()+" "+o[1][1].toString()+" "+o[2][0].toString()+" "+o[2][1].toString()+" "+o[3][0].toString()+" "+o[3][1].toString()+" "):3===o.length?n.push("Q "+o[1][0].toString()+" "+o[1][1].toString()+" "+o[2][0].toString()+" "+o[2][1].toString()+" "):2===o.length&&n.push("L "+o[1][0].toString()+" "+o[1][1].toString()+" ")}return n.push(" z"),n.join("\n")}function o(t){const n=[t.p,t.initialPoint];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n}function r(t,n,e){function o(e){return[e[0]*n-e[1]*t,e[0]*t+e[1]*n]}return void 0===e?o:o(e)}const{min:c,max:i}=Math;function s(t,n,e){return c(e,i(n,t))}const{abs:u,sqrt:f,asin:l,sin:a,cos:p,tan:h,PI:d}=Math;function v(t,n,e,o,c,i,g,m,x,w){const b=d*g/180;let _,M,S,C,y=[];if(w)_=w[0],M=w[1],S=w[2],C=w[3];else{const h=r(a(-b),p(-b));[t,n]=h([t,n]),[e,o]=h([e,o]);const v=(t-e)/2,g=(n-o)/2;let w=v*v/(c*c)+g*g/(i*i);w>1&&(w=f(w),c*=w,i*=w);const y=c*c,O=i*i,E=(m===x?-1:1)*f(u((y*O-y*g*g-O*v*v)/(y*g*g+O*v*v)));S=E*c*g/i+(t+e)/2,C=E*-i*v/c+(n+o)/2,_=l(s((n-C)/i,-1,1)),M=l(s((o-C)/i,-1,1)),t<S&&(_=d-_),e<S&&(M=d-M),_<0&&(_=2*d+_),M<0&&(M=2*d+M),x&&_>M&&(_-=2*d),!x&&M>_&&(M-=2*d)}let O=M-_;if(u(O)>120*d/180){const t=M,n=e,r=o;M=_+(x&&M>_?1:-1)*d*120/180,y=v(e=S+c*p(M),o=C+i*a(M),n,r,c,i,g,0,x,[M,t,S,C])}O=M-_;const E=p(_),I=a(_),N=p(M),k=a(M),P=h(O/4),B=4/3*c*P,T=4/3*i*P,A=[t,n],z=[t+B*I,n-T*E],D=[e+B*k,o-T*N],L=[e,o];if(z[0]=2*A[0]-z[0],z[1]=2*A[1]-z[1],w)return[z,D,L,...y];const q=[z,D,L,...y].flat(),W=[];let j=[];const F=r(a(b),p(b));return q.forEach(function(t,n){if(n%2){const t=F([q[n-1],q[n]]);j.push(t[1])}else{const t=F([q[n],q[n+1]]);j.push(t[0])}6===j.length&&(W.push(j),j=[])}),W}function g(t){t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0;const n=t.p,e=[t.vals[5],t.vals[6]],o=Math.abs(t.vals[0]),r=Math.abs(t.vals[1]);if(n[0]===e[0]&&n[1]===e[1])return[];if(0===o||0===r)return t.p=e,[[n,e]];const c=v(n[0],n[1],e[0],e[1],o,r,t.vals[2],t.vals[3],t.vals[4]),i=[];let s=n;for(const t of c){const n=[s,[t[0],t[1]],[t[2],t[3]],[t[4],t[5]]];i.push(n),s=n[3]}const u=i[i.length-1];return t.p=u[u.length-1],i}const m={c:function(t){const n=[t.p,[t.vals[0],t.vals[1]],[t.vals[2],t.vals[3]],[t.vals[4],t.vals[5]]];return t.prev2ndCubicControlPoint=n[2],t.prev2ndQuadraticControlPoint=void 0,n},h:function(t){const n=[t.p,[t.vals[0],t.p[1]]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n},l:function(t){const n=[t.p,t.vals];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n},q:function(t){const n=[t.vals[0],t.vals[1]],e=[t.vals[2],t.vals[3]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=n,[t.p,n,e]},s:function(t){const n=t.prev2ndCubicControlPoint?[t.p[0]-t.prev2ndCubicControlPoint[0]+t.p[0],t.p[1]-t.prev2ndCubicControlPoint[1]+t.p[1]]:t.p,e=[t.p,n,[t.vals[0],t.vals[1]],[t.vals[2],t.vals[3]]];return t.prev2ndCubicControlPoint=e[2],t.prev2ndQuadraticControlPoint=void 0,e},t:function(t){const n=t.prev2ndQuadraticControlPoint?[t.p[0]-t.prev2ndQuadraticControlPoint[0]+t.p[0],t.p[1]-t.prev2ndQuadraticControlPoint[1]+t.p[1]]:t.p,e=[t.vals[0],t.vals[1]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=n,[t.p,n,e]},v:function(t){const n=[t.p,[t.p[0],t.vals[0]]];return t.prev2ndCubicControlPoint=void 0,t.prev2ndQuadraticControlPoint=void 0,n},z:o},x=new Set("MLCQAHVSTZmlcqahvstz");function w(t){if(x.has(t))return"z"===t?"Z":t}const b=/[ \t\n\r\f]/;function _(t){return b.test(t._string[t._currentIndex])}function M(t){for(;t._currentIndex<t._endIndex&&_(t);)t._currentIndex++;return t._currentIndex<t._endIndex}function S(t){return!(t._currentIndex<t._endIndex&&!_(t)&&","!==t._string[t._currentIndex])&&(M(t)&&t._currentIndex<t._endIndex&&","===t._string[t._currentIndex]&&(t._currentIndex++,M(t)),t._currentIndex<t._endIndex)}function C(t){let n=0,e=0,o=1,r=0,c=1,i=1;const s=t._currentIndex;M(t);let u=t._currentIndex;u<t._endIndex&&"+"===t._string[u]?(t._currentIndex++,u++):u<t._endIndex&&"-"===t._string[u]&&(t._currentIndex++,u++,c=-1);const f=t._string[u];if(u===t._endIndex||(f<"0"||f>"9")&&"."!==f)throw new Error(`The first character of a number must be one of [0-9+-.]. Found '${f}' at index ${u}.`);const l=t._currentIndex;for(;u<t._endIndex&&t._string[u]>="0"&&t._string[u]<="9";)t._currentIndex++,u++;if(u!==l){let n=u-1,o=1;for(;n>=l;)e+=o*(Number(t._string[n])-0),n-=1,o*=10}if(u<t._endIndex&&"."===t._string[u]){if(t._currentIndex++,u++,u>=t._endIndex||t._string[u]<"0"||t._string[u]>"9")throw new Error("There must be a least one digit following the .");for(;u<t._endIndex&&t._string[u]>="0"&&t._string[u]<="9";)o*=10,r+=Number(t._string[u])/o,t._currentIndex++,u++}if(u!==s&&u+1<t._endIndex&&("e"===t._string[u]||"E"===t._string[u])&&"x"!==t._string[u+1]&&"m"!==t._string[u+1]){if(t._currentIndex++,u++,"+"===t._string[u]?(t._currentIndex++,u++):"-"===t._string[u]&&(t._currentIndex++,u++,i=-1),u>=t._endIndex||t._string[u]<"0"||t._string[u]>"9")throw new Error("There must be an exponent.");for(;u<t._endIndex&&t._string[u]>="0"&&t._string[u]<="9";)n*=10,n+=Number(t._string[u]),t._currentIndex++,u++}let a=e+r;return a*=c,n&&(a*=10**(i*n)),S(t),a}function y(t){if(t._currentIndex>=t._endIndex)throw new Error("Unable to parse arc flag");let n;const e=t._string[t._currentIndex];if(t._currentIndex++,"0"===e)n=0;else{if("1"!==e)throw new Error("Unable to parse arc flag - arc flag must be 0 or 1");n=1}return S(t),n}function O(t){const n=t._string[t._currentIndex];let e=w(n);if(void 0===e){if(!("+"===n||"-"===n||"."===n||n>="0"&&n<="9")||"Z"===t._prevCommand)throw new Error("Remaining coordinates not found for implicit command");e="M"===t._prevCommand?"L":"m"===t._prevCommand?"l":t._prevCommand}else t._currentIndex++;t._prevCommand=e;const o=e.toUpperCase();let r;return"H"===o||"V"===o?r=[C(t)]:"M"===o||"L"===o||"T"===o?r=[C(t),C(t)]:"S"===o||"Q"===o?r=[C(t),C(t),C(t),C(t)]:"C"===o?r=[C(t),C(t),C(t),C(t),C(t),C(t)]:"A"===o?r=[C(t),C(t),C(t),y(t),y(t),C(t),C(t)]:(M(t),r=[]),{command:e,values:r}}function E(t){return t._currentIndex<t._endIndex}function I(t){return function(t){if(0===t.length)return[];if("m"!==t[0].command.toLowerCase())throw new Error("Invalid SVG - every new path must start with an M or m.");const n={p:[0,0],initialPoint:void 0,prev2ndCubicControlPoint:void 0,prev2ndQuadraticControlPoint:void 0,vals:void 0},e=[];let r,c=[];for(let i=0;i<t.length;i++){const s=t[i],u=s.command.toLowerCase();if(n.vals=s.values,s.command===u)if("v"===u)n.vals[0]+=n.p[1];else if("a"===u)n.vals[5]+=n.p[0],n.vals[6]+=n.p[1];else for(let t=0;t<n.vals.length;t++)n.vals[t]+=n.p[t%2];if("m"!==u){if("a"===u)c.push(...g(n));else{const t=m[u];if(!t)throw new Error("Invalid SVG - command not recognized.");const e=t(n);n.p=e[e.length-1],c.push(e)}r=u}else c.length&&("z"!==r&&c.push(o(n)),e.push(c),c=[]),n.initialPoint=n.p=n.vals,r=u}return c.length>0&&("z"!==r&&c.push(o(n)),e.push(c)),e}(function(t){if(!t.length)return[];const n={_string:t,_currentIndex:0,_endIndex:t.length,_prevCommand:void 0};if(M(n),!function(t){if(!E(t))return!0;const n=w(t._string[t._currentIndex]);return"M"===n||"m"===n}(n))throw new Error("Path must start with m or M");const e=[];for(;E(n);)e.push(O(n));return e}(t))}function N(t){const n=t.length,e=Array.from(Array(n),()=>new Array(n).fill(0));for(let o=0;o<n;o++)for(let r=0;r<n;r++)e[o][r]=t[o][r];for(let t=0;t<n;t++)for(let o=0;o<n;o++)for(let r=0;r<n;r++)e[o][t]+e[t][r]<e[o][r]&&(e[o][r]=e[o][t]+e[t][r]);return e}function k(t){const n=t,e=[];do{e.push(t),t=t.next}while(t!==n);return e}function P(t){return k(t).filter(t=>t.isHoleClosing)}function B(t){const n=t.pointOnShape;return{idx:n.curve.idx,t:n.t,order:n.order,order2:n.order2}}function T(t){const n=t;let e=n,o=0;do{o++,e=e.nextOnCircle}while(e!==n);return o}function A(t,n=!1){const e=t,o=n?[]:[t];let r=t.nextOnCircle;for(;r!==e;)o.push(r),r=r.nextOnCircle;return o}function z(t){return t===t.next.prevOnCircle}function D(t){return A(t).filter(t=>!z(t)).length}function L(t){return A(t).every(z)}function q(t){if(!z(t))return!1;if(L(t))return!0;for(;t.prev===t.prevOnCircle;)t=t.prev;return A(t.prevOnCircle,!0).every(z)}function W(t){return 0===t.pointOnShape.circle.radius}function j(t){const n=t.pointOnShape,e=n.curve;return{...t,pos:n,p:n.p,t:n.t,isTerminating:z(t),isFullyTerminating:q(t),isSharp:W(t),prongCount:T(t),getRealProngCount:D(t),ordering:B(t),curve:e,loop:e.loop}}function F(t){let n=t;if(z(n))return[n];const e=[];do{e.push(n);const t=n.next.prevOnCircle;n=n=n===t?n.next.next:t}while(n!==t);return e}function H(t,n){const e=k(t),o=new Set;for(t of e)z(t)||o.has(t.next.prevOnCircle)||n(t),o.add(t)}function Y(t){const n=[],e=t;let o=e;for(;o!==e.prevOnCircle;)z(o)||n.push(o.next),o=o.nextOnCircle;return n}function R(t,n){n(t);const e=A(t).filter(t=>!z(t)).map(t=>t.next);for(const t of e){const e=[t];for(;e.length;){const t=e.pop();n(t),e.push(...Y(t))}}}const X=["prev","next","prevOnCircle","nextOnCircle","holeCloserTwin"];function Q(t){const n=new Map,e=V(t);n.set(t,e);const o=[{cpNode:t,newCpNode:e}];for(;o.length;){const{cpNode:t,newCpNode:e}=o.pop();for(const r of X){const c=t[r];if(void 0===c)continue;let i=n.get(c);i||(i=V(c),n.set(c,i),o.push({cpNode:c,newCpNode:i})),e[r]=i}}return e}function V(t){return{...t,prev:void 0,next:void 0,prevOnCircle:void 0,nextOnCircle:void 0,holeCloserTwin:void 0}}function $(t){const n=t,e=t.next,o=n.pointOnShape,r=e.pointOnShape,c=o.curve,i=r.curve;if(c.loop!==i.loop)return[];const s=[];return i===c?s.push({ps:o.curve.ps,ts:[o.t,r.t]}):(s.push({ps:o.curve.ps,ts:[o.t,1]}),function(t,n,e,o){let r=n;do{r=r.next;const n=r===e?o:1;t.push({ps:r.ps,ts:[0,n]})}while(r!==e)}(s,o.curve,r.curve,r.t)),s}function U(t,n,e){if(4===t.length)return function(t,n,e){return 0===n?1===e?t:function(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=i-n*(i-u),h=u-n*(u-l),d=p-n*(p-h),v=s-n*(s-f),g=f-n*(f-a),m=v-n*(v-g);return[e,[p,v],[d,m],[d-n*(d-(h-n*(h-(l-n*(l-c[0]))))),m-n*(m-(g-n*(g-(a-n*(a-c[1])))))]]}(t,e):1===e?function(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=i-n*(i-u),h=u-n*(u-l),d=l-n*(l-c[0]),v=p-n*(p-h),g=h-n*(h-d),m=s-n*(s-f),x=f-n*(f-a),w=a-n*(a-c[1]),b=m-n*(m-x),_=x-n*(x-w);return[[v-n*(v-g),b-n*(b-_)],[g,_],[d,w],c]}(t,n):function(t,n,e){const o=t[0],r=t[1],c=t[2],i=t[3],s=o[0],u=o[1],f=r[0],l=r[1],a=c[0],p=c[1],h=n*n,d=n*h,v=e*e,g=e*v,m=n*e,x=s-f,w=a-f,b=x+w,_=n*x,M=e*x,S=i[0]-s-3*w,C=u-l,y=p-l,O=C+y,E=n*C,I=e*C,N=i[1]-u-3*y;return[[d*S+(3*n*(n*b-x)+s),d*N+(3*n*(n*O-C)+u)],[m*(n*S+2*b)+(h*b+s-(M+2*_)),m*(n*N+2*O)+(h*O+u-(I+2*E))],[m*(e*S+2*b)+(v*b+s-(2*M+_)),m*(e*N+2*O)+(v*O+u-(2*I+E))],[g*S+(3*e*(e*b-x)+s),g*N+(3*e*(e*O-C)+u)]]}(t,n,e)}(t,n,e);if(3===t.length)return function(t,n,e){return 0===n?1===e?t:function(t,n){const e=t[0],o=t[1],r=t[2],c=e[0],i=e[1],s=o[0],u=o[1],f=n*n,l=c-s,a=i-u;return[e,[-n*l+c,-n*a+i],[f*(l+(r[0]-s))-(2*n*l-c),f*(a+(r[1]-u))-(2*n*a-i)]]}(t,e):1===e?function(t,n){const e=t[0],o=t[1],r=t[2],c=e[0],i=e[1],s=o[0],u=o[1],f=n*n,l=c-s,a=r[0]-s,p=i-u,h=r[1]-u;return[[f*(l+a)-(2*n*l-c),f*(p+h)-(2*n*p-i)],[n*a+s,n*h+u],r]}(t,n):function(t,n,e){const o=t[0],r=t[1],c=t[2],i=o[0],s=o[1],u=r[0],f=r[1],l=n*n,a=e*e,p=n*e,h=i-u,d=h+(c[0]-u),v=s-f,g=v+(c[1]-f);return[[l*d-(2*n*h-i),l*g-(2*n*v-s)],[p*d-(h*(e+n)-i),p*g-(v*(e+n)-s)],[a*d-(2*e*h-i),a*g-(2*e*v-s)]]}(t,n,e)}(t,n,e);if(2===t.length)return function(t,n,e){return 0===n?1===e?t:function(t,n){const e=t[0],o=t[1],r=e[0],c=e[1];return[e,[n*(o[0]-r)+r,n*(o[1]-c)+c]]}(t,e):1===e?function(t,n){const e=t[0],o=t[1],r=e[0],c=e[1];return[[n*(o[0]-r)+r,n*(o[1]-c)+c],o]}(t,n):function(t,n,e){const o=t[0],r=t[1],c=o[0],i=o[1],s=r[0],u=r[1];return[[n*(s-c)+c,n*(u-i)+i],[e*(s-c)+c,e*(u-i)+i]]}(t,n,e)}(t,n,e);if(1===t.length)return t;throw new Error("The given bezier curve must be of order <= 3.")}function Z(t){return $(t).map(t=>U(t.ps,t.ts[0],t.ts[1]))}function G(t,n){const{cpTrees:e}=n,o=t.prev,r=t.next;o.next=r,r.prev=o,e.get(t.pointOnShape.curve.loop).remove(t,!1)}function J(t,n){const e=T(t);if(2!==e)throw new Error(`Cannot delete \`CpNode\` on ${e}-prong`);A(t).forEach(t=>G(t,n))}function K(t){const n=[],e=t.next;let o=e;do{n.push(o),o=o.nextOnCircle}while(o.nextOnCircle!==e);return n}function tt(t,n,e){if(void 0===t.size||void 0===e)return;const o=e[n];if(t.size>o&&void 0!==o)for(const[n]of t){t.delete(n);break}}const nt=[function(t,n){let e,o=!1;return function(){return o||(e=t(),o=!0),e}},function(t,n,e=!1){const o=new WeakMap,r=new Map;function c(t){return"object"!=typeof t&&"function"!=typeof t||null===t?r:o}const i=function(o){let i;const s=c(o);return s.has(o)?(e&&console.log("cache hit"),i=s.get(o)):(e&&console.log("cache miss"),i=t(o),s.set(o,i),tt(r,0,n)),i};return i.mapS=r,i.weakMapS=o,i.clearCache=function(){r.clear()},i.addToCache=function(t,e){const o=c(e);o.set(e,t),tt(o,1,n)},i},function(t,n){const e=new WeakMap,o=new Map;function r(t,r){const c=("object"==typeof r||"function"==typeof r)&&null!==r;let i="object"!=typeof t&&"function"!=typeof t||null===t?o:e,s=i.get(t);return void 0===s&&(s={weakMap:new WeakMap,map:new Map},i.set(t,s),tt(i,0,n)),c?s.weakMap:s.map}function c(e,o){const c=r(e,o);let i;return c.has(o)?i=c.get(o):(i=t(e,o),c.set(o,i),tt(c,1,n)),i}return c.mapS=o,c.weakMapS=e,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,o){const c=r(e,o);c.set(o,t),tt(c,1,n)},c},function(t,n){const e=new WeakMap,o=new Map;function r(t,r,c){const i=("object"==typeof r||"function"==typeof r)&&null!==r,s=("object"==typeof c||"function"==typeof c)&&null!==c;let u="object"!=typeof t&&"function"!=typeof t||null===t?o:e,f=u.get(t);void 0===f&&(f={weakMap:new WeakMap,map:new Map},u.set(t,f),tt(u,0,n));const l=i?f.weakMap:f.map;let a=l.get(r);return void 0===a&&(a={weakMap:new WeakMap,map:new Map},l.set(r,a),tt(l,1,n)),s?a.weakMap:a.map}const c=function(e,o,c){const i=r(e,o,c);let s;return i.has(c)?s=i.get(c):(s=t(e,o,c),i.set(c,s),tt(i,2,n)),s};return c.mapS=o,c.weakMapS=e,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,o,c){const i=r(e,o,c);i.set(c,t),tt(i,2,n)},c},function(t,n,e=!1){const o=new WeakMap,r=new Map;function c(t,e,c,i){const s=("object"==typeof e||"function"==typeof e)&&null!==e,u=("object"==typeof c||"function"==typeof c)&&null!==c,f=("object"==typeof i||"function"==typeof i)&&null!==i;let l="object"!=typeof t&&"function"!=typeof t||null===t?r:o,a=l.get(t);void 0===a&&(a={weakMap:new WeakMap,map:new Map},l.set(t,a),tt(l,0,n));const p=s?a.weakMap:a.map;let h=p.get(e);void 0===h&&(h={weakMap:new WeakMap,map:new Map},p.set(e,h),tt(p,1,n));const d=u?h.weakMap:h.map;let v=d.get(c);return void 0===v&&(v={weakMap:new WeakMap,map:new Map},d.set(c,v),tt(d,2,n)),f?v.weakMap:v.map}const i=function(o,r,i,s){const u=c(o,r,i,s);let f;return u.has(s)?(e&&console.log("cache hit"),f=u.get(s)):(e&&console.log("cache miss"),f=t(o,r,i,s),u.set(s,f),tt(u,3,n)),f};return i.mapS=r,i.weakMapS=o,i.clearCache=function(){r.clear()},i.addToCache=function(t,e,o,r,i){const s=c(e,o,r,i);s.set(i,t),tt(s,3,n)},i},function(t,n){const e=new WeakMap,o=new Map;function r(t,r,c,i,s){const u=("object"==typeof r||"function"==typeof r)&&null!==r,f=("object"==typeof c||"function"==typeof c)&&null!==c,l=("object"==typeof i||"function"==typeof i)&&null!==i,a=("object"==typeof s||"function"==typeof s)&&null!==s;let p="object"!=typeof t&&"function"!=typeof t||null===t?o:e,h=p.get(t);void 0===h&&(h={weakMap:new WeakMap,map:new Map},p.set(t,h),tt(p,0,n));const d=u?h.weakMap:h.map;let v=d.get(r);void 0===v&&(v={weakMap:new WeakMap,map:new Map},d.set(r,v),tt(d,1,n));const g=f?v.weakMap:v.map;let m=g.get(c);void 0===m&&(m={weakMap:new WeakMap,map:new Map},g.set(c,m),tt(g,2,n));const x=l?m.weakMap:m.map;let w=x.get(i);return void 0===w&&(w={weakMap:new WeakMap,map:new Map},x.set(i,w),tt(x,3,n)),a?w.weakMap:w.map}const c=function(e,o,c,i,s){const u=r(e,o,c,i,s);let f;return u.has(s)?f=u.get(s):(f=t(e,o,c,i,s),u.set(s,f),tt(u,4,n)),f};return c.mapS=o,c.weakMapS=e,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,o,c,i,s){const u=r(e,o,c,i,s);u.set(s,t),tt(u,4,n)},c},function(t,n){const e=new WeakMap,o=new Map;function r(t,r,c,i,s,u){const f=("object"==typeof r||"function"==typeof r)&&null!==r,l=("object"==typeof c||"function"==typeof c)&&null!==c,a=("object"==typeof i||"function"==typeof i)&&null!==i,p=("object"==typeof s||"function"==typeof s)&&null!==s,h=("object"==typeof u||"function"==typeof u)&&null!==u;let d="object"!=typeof t&&"function"!=typeof t||null===t?o:e,v=d.get(t);void 0===v&&(v={weakMap:new WeakMap,map:new Map},d.set(t,v),tt(d,0,n));const g=f?v.weakMap:v.map;let m=g.get(r);void 0===m&&(m={weakMap:new WeakMap,map:new Map},g.set(r,m),tt(g,1,n));const x=l?m.weakMap:m.map;let w=x.get(c);void 0===w&&(w={weakMap:new WeakMap,map:new Map},x.set(c,w),tt(x,2,n));const b=a?w.weakMap:w.map;let _=b.get(i);void 0===_&&(_={weakMap:new WeakMap,map:new Map},b.set(i,_),tt(b,3,n));const M=p?_.weakMap:_.map;let S=M.get(s);return void 0===S&&(S={weakMap:new WeakMap,map:new Map},M.set(s,S),tt(M,4,n)),h?S.weakMap:S.map}const c=function(e,o,c,i,s,u){const f=r(e,o,c,i,s,u);let l;return f.has(u)?l=f.get(u):(l=t(e,o,c,i,s,u),f.set(u,l),tt(f,5,n)),l};return c.mapS=o,c.weakMapS=e,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,o,c,i,s,u){const f=r(e,o,c,i,s,u);f.set(u,t),tt(f,5,n)},c},function(t,n){const e=new WeakMap,o=new Map;function r(t,r,c,i,s,u,f){const l=("object"==typeof r||"function"==typeof r)&&null!==r,a=("object"==typeof c||"function"==typeof c)&&null!==c,p=("object"==typeof i||"function"==typeof i)&&null!==i,h=("object"==typeof s||"function"==typeof s)&&null!==s,d=("object"==typeof u||"function"==typeof u)&&null!==u,v=("object"==typeof f||"function"==typeof f)&&null!==f;let g="object"!=typeof t&&"function"!=typeof t||null===t?o:e,m=g.get(t);void 0===m&&(m={weakMap:new WeakMap,map:new Map},g.set(t,m),tt(g,0,n));const x=l?m.weakMap:m.map;let w=x.get(r);void 0===w&&(w={weakMap:new WeakMap,map:new Map},x.set(r,w),tt(x,1,n));const b=a?w.weakMap:w.map;let _=b.get(c);void 0===_&&(_={weakMap:new WeakMap,map:new Map},b.set(c,_),tt(b,2,n));const M=p?_.weakMap:_.map;let S=M.get(i);void 0===S&&(S={weakMap:new WeakMap,map:new Map},M.set(i,S),tt(M,3,n));const C=h?S.weakMap:S.map;let y=C.get(s);void 0===y&&(y={weakMap:new WeakMap,map:new Map},C.set(s,y),tt(C,4,n));const O=d?y.weakMap:y.map;let E=O.get(u);return void 0===E&&(E={weakMap:new WeakMap,map:new Map},O.set(u,E),tt(O,5,n)),v?E.weakMap:E.map}const c=function(e,o,c,i,s,u,f){const l=r(e,o,c,i,s,u,f);let a;return l.has(f)?a=l.get(f):(a=t(e,o,c,i,s,u,f),l.set(f,a),tt(l,6,n)),a};return c.mapS=o,c.weakMapS=e,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,o,c,i,s,u,f){const l=r(e,o,c,i,s,u,f);l.set(f,t),tt(l,6,n)},c},function(t,n){const e=new WeakMap,o=new Map;function r(t,r,c,i,s,u,f,l){const a=("object"==typeof r||"function"==typeof r)&&null!==r,p=("object"==typeof c||"function"==typeof c)&&null!==c,h=("object"==typeof i||"function"==typeof i)&&null!==i,d=("object"==typeof s||"function"==typeof s)&&null!==s,v=("object"==typeof u||"function"==typeof u)&&null!==u,g=("object"==typeof f||"function"==typeof f)&&null!==f,m=("object"==typeof l||"function"==typeof l)&&null!==l;let x="object"!=typeof t&&"function"!=typeof t||null===t?o:e,w=x.get(t);void 0===w&&(w={weakMap:new WeakMap,map:new Map},x.set(t,w),tt(x,0,n));const b=a?w.weakMap:w.map;let _=b.get(r);void 0===_&&(_={weakMap:new WeakMap,map:new Map},b.set(r,_),tt(b,1,n));const M=p?_.weakMap:_.map;let S=M.get(c);void 0===S&&(S={weakMap:new WeakMap,map:new Map},M.set(c,S),tt(M,2,n));const C=h?S.weakMap:S.map;let y=C.get(i);void 0===y&&(y={weakMap:new WeakMap,map:new Map},C.set(i,y),tt(C,3,n));const O=d?y.weakMap:y.map;let E=O.get(s);void 0===E&&(E={weakMap:new WeakMap,map:new Map},O.set(s,E),tt(O,4,n));const I=v?E.weakMap:E.map;let N=I.get(u);void 0===N&&(N={weakMap:new WeakMap,map:new Map},I.set(u,N),tt(I,5,n));const k=g?N.weakMap:N.map;let P=k.get(f);return void 0===P&&(P={weakMap:new WeakMap,map:new Map},k.set(f,P),tt(k,6,n)),m?P.weakMap:P.map}const c=function(e,o,c,i,s,u,f,l){const a=r(e,o,c,i,s,u,f,l);let p;return a.has(l)?p=a.get(l):(p=t(e,o,c,i,s,u,f,l),a.set(l,p),tt(a,7,n)),p};return c.mapS=o,c.weakMapS=e,c.clearCache=function(){o.clear()},c.addToCache=function(t,e,o,c,i,s,u,f,l){const a=r(e,o,c,i,s,u,f,l);a.set(l,t),tt(a,7,n)},c}];function et(t,n,e=!1){const o=t.length;if(o>8)throw new Error("A maximum of 8 formal parameters are supported");return(0,nt[o])(t,n,e)}function ot(t,n){const[[e,o],[r,c]]=t,[[i,s],[u,f]]=n,l=r-e,a=c-o,p=u-i,h=f-s,d=p*a-h*l;if(0===d)return;const v=((s-o)*l-(i-e)*a)/d;return[i+v*p,s+v*h]}function rt(t,n){return[n[0]-t[0],n[1]-t[1]]}function ct(t,n){return t[0]*n[0]+t[1]*n[1]}function it(t){return[-t[1],t[0]]}function st(t,n){return t[0]*n[1]-t[1]*n[0]}function ut(t,n,e){return[t[0]+(n[0]-t[0])*e,t[1]+(n[1]-t[1])*e]}function ft(t,n){function e(n){return[t[0]+n[0],t[1]+n[1]]}return void 0===n?e:e(n)}function lt(t){const n=1/Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]*n,t[1]*n]}function at(t,n){let e=0;for(let o=0;o<t.length;o++)e=e*n+t[o];return e}function pt(t){if(4===t.length)return function(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[3*(s-n+3*(o-c)),6*(c+n-2*o),3*(o-n)],[3*(u-e+3*(r-i)),6*(i+e-2*r),3*(r-e)]]}(t);if(3===t.length)return function(t){const[[n,e],[o,r],[c,i]]=t;return[[2*(c+n-2*o),2*(o-n)],[2*(i+e-2*r),2*(r-e)]]}(t);if(2===t.length)return function(t){const[[n,e],[o,r]]=t;return[[o-n],[r-e]]}(t);if(1===t.length)return[[0],[0]];throw new Error("The bezier curve must be of order <= 3.")}function ht(t,n){const[e,o]=pt(t);return[at(e,n),at(o,n)]}function dt(t,n){const e=t-n,o=t-e;return[t-(e+o)+(o-n),e]}function vt(t,n){const e=t.length,o=n.length;let r=0,c=0;const i=[];for(;r<e&&c<o;)0!==t[r]?0!==n[c]?Math.abs(t[r])<=Math.abs(n[c])?(i.push(t[r]),r++):(i.push(n[c]),c++):c++:r++;for(;r<e;)i.push(t[r]),r++;for(;c<o;)i.push(n[c]),c++;if(0===i.length)return[0];const s=i.length;if(1===s)return i;const u=[],f=i[1],l=i[0];let a=f+l;const p=l-(a-f);0!==p&&u.push(p),c=0;for(let t=2;t<s;t++){const n=i[t],e=a+n,o=e-a,r=a-(e-o)+(n-o);0!==r&&u.push(r),a=e}return 0===a&&0!==u.length||u.push(a),u}const gt=134217729;function mt(t,n){const e=t.length;let o;const r=t[0];let c=r*n;const i=gt*r,s=i-(i-r),u=r-s,f=gt*n,l=f-(f-n),a=n-l,p=[],h=u*a-(c-s*l-u*l-s*a);0!==h&&p.push(h);for(let r=1;r<e;r++){const e=t[r],i=e*n,s=gt*e,u=s-(s-e),f=e-u,l=gt*n,a=l-(l-n),h=n-a,d=f*h-(i-u*a-f*a-u*h),v=c+d,g=v-c,m=c-(v-g)+(d-g);0!==m&&p.push(m),o=v;const x=i+o,w=o-(x-i);0!==w&&p.push(w),c=x}return 0===c&&0!==p.length||p.push(c),p}function xt(t,n){const e=n.length;let o;const r=n[0];let c=r*t;const i=gt*r,s=i-(i-r),u=r-s,f=gt*t,l=f-(f-t),a=t-l,p=[],h=u*a-(c-s*l-u*l-s*a);0!==h&&p.push(h);for(let r=1;r<e;r++){const e=n[r],i=e*t,s=gt*e,u=s-(s-e),f=e-u,l=gt*t,a=l-(l-t),h=t-a,d=f*h-(i-u*a-f*a-u*h),v=c+d,g=v-c,m=c-(v-g)+(d-g);0!==m&&p.push(m),o=v;const x=i+o,w=o-(x-i);0!==w&&p.push(w),c=x}return 0===c&&0!==p.length||p.push(c),p}function wt(t,n){let e=[0];for(let o=0;o<t.length;o++)e=vt(e,mt(n,t[o]));return e}function bt(t){let n=t[0];for(let e=1;e<t.length;e++)n+=t[e];return n}function _t(t){const n=t.length,e=new Array(n);for(let o=0;o<n;o++)e[o]=-t[o];return e}function Mt(t,n){return vt(t,_t(n))}function St(t){return t[t.length-1]}const Ct=dt,yt=xt;function Ot(t){if(4===t.length){const[[n,e],[o,r]]=t;return[yt(3,Ct(o,n)),yt(3,Ct(r,e))]}if(3===t.length){const[[n,e],[o,r]]=t;return[Ct(2*o,2*n),Ct(2*r,2*e)]}if(2===t.length){const[[n,e],[o,r]]=t;return[Ct(o,n),Ct(r,e)]}if(1===t.length)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3.")}function Et(t,n){const e=t+n,o=e-t;return[t-(e-o)+(n-o),e]}function It(t,n){const e=t.length;let o=n;const r=[];for(let n=0;n<e;n++){const e=t[n],c=o+e,i=c-o,s=o-(c-i)+(e-i);0!==s&&r.push(s),o=c}return 0===o&&0!==r.length||r.push(o),r}const Nt=Et,kt=xt,Pt=It;function Bt(t){if(4===t.length){const[[n,e],[o,r],[c,i]]=t;return[kt(6,Pt(Nt(c,n),-2*o)),kt(6,Pt(Nt(i,e),-2*r))]}if(3===t.length){const[[n,e],[o,r],[c,i]]=t;return[Pt(Nt(2*c,2*n),-4*o),Pt(Nt(2*i,2*e),-4*r)]}if(t.length<=2)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3")}const Tt=dt,At=xt,zt=vt;function Dt(t){if(4===t.length){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[At(6,zt(Tt(s,n),At(3,Tt(o,c))))],[At(6,zt(Tt(u,e),At(3,Tt(r,i))))]]}if(t.length<=3)return[[[0]],[[0]]];throw new Error("The given bezier curve must be of order <= 3.")}const{sign:Lt}=Math;function qt(t,n){const[e,o]=Ot(t),[r,c]=Bt(t),[i,s]=Ot(n),[u,f]=Bt(n),l=Mt(wt(e,c),wt(o,r)),a=Mt(wt(i,f),wt(s,u)),p=St(l),h=St(a);if(Lt(p)!==Lt(h))return p-h;const d=vt(wt(i,i),wt(s,s)),v=vt(wt(e,e),wt(o,o)),g=wt(d,d),m=wt(g,d),x=wt(v,v),w=wt(x,v);if(0!==p||0!==h){const t=wt(l,l),n=wt(a,a),e=St(Mt(wt(t,m),wt(n,w)));if(0!==e)return p>0?e:-e}const[[b],[_]]=Dt(t),[[M],[S]]=Dt(n),C=Mt(wt(e,_),wt(o,b)),y=vt(wt(e,r),wt(o,c)),O=Mt(wt(i,S),wt(s,M)),E=vt(wt(i,u),wt(s,f)),I=Mt(wt(v,C),mt(wt(l,y),3)),N=Mt(wt(d,O),mt(wt(a,E),3)),k=St(I),P=St(N);if(k!==P)return k-P;if(0===k&&0===P)return 0;const B=wt(I,I),T=wt(g,m),A=wt(N,N),z=wt(x,w),D=St(Mt(wt(B,T),wt(A,z)));return k>0?D:-D}function Wt(t,n){return t[0]===n[0]&&t[1]===n[1]}function jt(t,n){const{ccw:e,tangentI:o,tangentO:r,dotTangents:c}=function(t,n){const e=t.length;let o=t[e-2],r=n[0],c=n[1];Wt(o,r)&&(o=t[e-3]),Wt(r,c)&&(c=n[2]);const i=function(t,n,e){const o=dt(t[0],e[0]),r=dt(n[1],e[1]),c=dt(t[1],e[1]),i=dt(n[0],e[0]);return bt(vt(wt(o,r),_t(wt(c,i))))}(o,r,c),s=[dt(r[0],o[0]),dt(r[1],o[1])],u=[dt(c[0],r[0]),dt(c[1],r[1])],f=function(t,n){return bt(vt(wt(t[0],n[0]),wt(t[1],n[1])))}(s,u);return 0!==i||f>0?{ccw:i,tangentI:s,tangentO:u,dotTangents:f}:{ccw:qt(t.slice().reverse(),n),tangentI:s,tangentO:u,dotTangents:f}}(t,n),i=e<0,s=e>0,u=[lt(o.map(t=>t[1])),lt(r.map(t=>t[1]))],f=st(u[0],u[1]);let l,a;return c>0?(l=f<-.0698,a=f>.0698):(l=i,a=s),{tangents:u,isSharp:i,isDull:s,isQuiteSharp:l,isQuiteDull:a}}const Ft=et(function(t){const{t:n,curve:e}=t;return jt(1===n?e.ps:e.prev.ps,1===n?e.next.ps:e.ps)});function Ht(t){return 0===t.t||1===t.t}function Yt(t){return!!Ht(t)&&Ft(t).isSharp}function Rt(t){const n=t.pointOnShape.circle.center,e=t,o=t.nextOnCircle,c=e.pointOnShape,i=o.pointOnShape,s=c.p,u=i.p;let f;if(Yt(c)){let t,n;0===c.t?(t=c.curve,n=c.curve.prev):1===c.t&&(t=c.curve.next,n=c.curve);const e=lt(ht(t.ps,0)),o=[-(l=lt(ht(n.ps,1)))[0],-l[1]],i=ct(e,o),s=Math.sqrt((1+i)/2);f=r(Math.sqrt((1-i)/2),s,o)}else f=s[0]===u[0]&&s[1]===u[1]?rt(s,n):it(rt(s,u));var l;return[n,ft(lt(f),n)]}const{abs:Xt}=Math,Qt=1e-4;function Vt(t,n){const e=t.pointOnShape.circle.center,o=Rt(t),r=n.pointOnShape.circle.center,c=Rt(n.prevOnCircle),i=ot(o,c),s=rt(e,r);let u;if(i){const t=rt(e,i),n=rt(r,i);u=ct(t,s)<0||ct(n,s)>0}else u=!0;if(!u)return[e,i,r];const f=it(s),l=rt(o[0],o[1]),a=rt(c[0],c[1]),p=Xt(st(s,l))/9,h=Xt(st(s,a))/9;if(p>.01||h>.01)return[e,r];if(p>Qt||h>Qt){const t=ut(e,r,1/3),n=ut(e,r,2/3),i=ft(f,t),s=[n,ft(f,n)];return[e,ot(o,[t,i]),ot(c,s),r]}return[e,r]}function $t(t){return Vt(t,t.next)}function Ut(t){const n=t;let e=n;for(;e.next===e.prevOnCircle;)if(e=e.next,e===n)return;return e}function Zt(t,n){return A(t).indexOf(n)>=0}function Gt(t){return 1===D(t)&&!t.isHoleClosing}function Jt(t){return 2===D(t)}function Kt(t){if(L(t))return[];for(;z(t);)t=t.nextOnCircle;for(t=t.next;2===D(t);)t=t.next;t=t.prevOnCircle;const n=[];do{n.push(t),t=t.next}while(!q(t)&&2===D(t));return n}function tn(t){return Kt(t).map(t=>$t(t))}function nn(t,n){const e=n[0]-t[0],o=n[1]-t[1];return Math.sqrt(e*e+o*o)}function en(t,n){const[e,o]=t,[[r,c],[i,s]]=n;return nn([r+e*(i-r),c+e*(s-c)],[r+o*(i-r),c+o*(s-c)])}function on(t,n,e=16){if(n[0]===n[1])return 0;const{weights:o,abscissas:r}=rn[e],[c,i]=n;let s=0;const u=(i-c)/2,f=(i+c)/2;for(let n=0;n<=e-1;n++)s+=o[n]*t(u*r[n]+f);return u*s}et($t);const rn={2:{weights:[1,1],abscissas:[-.5773502691896257,.5773502691896257]},4:{weights:[.6521451548625461,.6521451548625461,.3478548451374538,.3478548451374538],abscissas:[-.3399810435848563,.3399810435848563,-.8611363115940526,.8611363115940526]},8:{weights:[.362683783378362,.362683783378362,.3137066458778873,.3137066458778873,.2223810344533745,.2223810344533745,.1012285362903763,.1012285362903763],abscissas:[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363]},16:{weights:[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685,.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],abscissas:[-.9894009349916499,-.9445750230732326,-.8656312023878318,-.755404408355003,-.6178762444026438,-.45801677765722737,-.2816035507792589,-.09501250983763744,.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]},64:{weights:[.048690957009139724,.048690957009139724,.04857546744150343,.04857546744150343,.048344762234802954,.048344762234802954,.04799938859645831,.04799938859645831,.04754016571483031,.04754016571483031,.04696818281621002,.04696818281621002,.046284796581314416,.046284796581314416,.04549162792741814,.04549162792741814,.044590558163756566,.044590558163756566,.04358372452932345,.04358372452932345,.04247351512365359,.04247351512365359,.04126256324262353,.04126256324262353,.03995374113272034,.03995374113272034,.038550153178615626,.038550153178615626,.03705512854024005,.03705512854024005,.035472213256882386,.035472213256882386,.033805161837141606,.033805161837141606,.03205792835485155,.03205792835485155,.030234657072402478,.030234657072402478,.028339672614259483,.028339672614259483,.02637746971505466,.02637746971505466,.024352702568710874,.024352702568710874,.022270173808383253,.022270173808383253,.02013482315353021,.02013482315353021,.017951715775697343,.017951715775697343,.015726030476024718,.015726030476024718,.013463047896718643,.013463047896718643,.011168139460131128,.011168139460131128,.008846759826363947,.008846759826363947,.006504457968978363,.006504457968978363,.004147033260562468,.004147033260562468,.001783280721696433,.001783280721696433],abscissas:[-.024350292663424433,.024350292663424433,-.07299312178779904,.07299312178779904,-.12146281929612056,.12146281929612056,-.16964442042399283,.16964442042399283,-.21742364374000708,.21742364374000708,-.2646871622087674,.2646871622087674,-.31132287199021097,.31132287199021097,-.3572201583376681,.3572201583376681,-.4022701579639916,.4022701579639916,-.4463660172534641,.4463660172534641,-.48940314570705296,.48940314570705296,-.5312794640198946,.5312794640198946,-.571895646202634,.571895646202634,-.6111553551723933,.6111553551723933,-.6489654712546573,.6489654712546573,-.6852363130542333,.6852363130542333,-.7198818501716109,.7198818501716109,-.7528199072605319,.7528199072605319,-.7839723589433414,.7839723589433414,-.8132653151227975,.8132653151227975,-.8406292962525803,.8406292962525803,-.8659993981540928,.8659993981540928,-.8893154459951141,.8893154459951141,-.9105221370785028,.9105221370785028,-.9295691721319396,.9295691721319396,-.9464113748584028,.9464113748584028,-.9610087996520538,.9610087996520538,-.973326827789911,.973326827789911,-.983336253884626,.983336253884626,-.9910133714767443,.9910133714767443,-.9963401167719553,.9963401167719553,-.9993050417357722,.9993050417357722]}},{sqrt:cn}=Math;function sn(t){const[n,e]=pt(t);return function(t){const o=at(n,t),r=at(e,t);return cn(o*o+r*r)}}const{abs:un}=Math,fn=[[0,0],[0,0],[0,0]];function ln(t,n,e){return 0===n?1===e?{ps:t,_ps:fn}:function(t,n){const e=t[0],o=t[1],r=t[2],c=e[0],i=e[1],s=o[0],u=o[1],f=r[0],l=r[1],a=n*n,p=c-s,h=i-u,d=[[c,i],[-n*p+c,-n*h+i],[a*(p+(f-s))-(2*n*p-c),a*(h+(l-u))-(2*n*h-i)]],v=un(n),g=un(c),m=un(s),x=un(f),w=g+m,b=un(i),_=un(u),M=b+_;return{ps:d,_ps:[[0,0],[v*w+g,v*M+b],[a*(w+(x+m))+(2*v*w+g),a*(M+(un(l)+_))+(2*v*M+b)]]}}(t,e):1===e?function(t,n){const e=t[0],o=t[1],r=t[2],c=e[0],i=e[1],s=o[0],u=o[1],f=r[0],l=r[1],a=n*n,p=c-s,h=f-s,d=i-u,v=l-u,g=[[a*(p+h)-(2*n*p-c),a*(d+v)-(2*n*d-i)],[n*h+s,n*v+u],[f,l]],m=un(n),x=un(c),w=un(s),b=x+w,_=un(f)+w,M=un(i),S=un(u),C=M+S;return{ps:g,_ps:[[a*(b+_)+(2*m*b+x),a*(C+(un(l)+S))+(2*m*C+M)],[m*_+w,0],[0,0]]}}(t,n):function(t,n,e){const o=t[0],r=t[1],c=t[2],i=o[0],s=o[1],u=r[0],f=r[1],l=c[0],a=c[1],p=n*n,h=e*e,d=n*e,v=i-u,g=v+(l-u),m=s-f,x=m+(a-f),w=p*g-(2*n*v-i),b=d*g-(v*(e+n)-i),_=h*g-(2*e*v-i),M=p*x-(2*n*m-s),S=d*x-(m*(e+n)-s),C=h*x-(2*e*m-s),y=un(n),O=un(e),E=un(d),I=un(i),N=un(u),k=I+N,P=k+un(l)+N,B=un(s),T=un(f),A=B+T,z=A+un(a)+T;return{ps:[[w,M],[b,S],[_,C]],_ps:[[p*P+(2*y*k+I),p*z+(2*y*A+B)],[E*P+(k*(O+y)+I),E*x+(A*(O+y)+B)],[h*P+(2*O*k+I),h*z+(2*O*A+B)]]}}(t,n,e)}const an=134217729;function pn(t,n){const e=t*n,o=an*t,r=o-(o-t),c=t-r,i=an*n,s=i-(i-n),u=n-s;return[c*u-(e-r*s-c*s-r*u),e]}function hn(t,n){const e=t[0],o=t[1],r=n[0],c=n[1],i=o+c,s=i-o,u=e+r,f=u-e,l=o-(i-s)+(c-s)+u,a=i+l,p=e-(u-f)+(r-f)+(l-(a-i)),h=a+p;return[p-(h-a),h]}function dn(t,n){const e=t[0],o=t[1],r=n[0],c=n[1],i=o-c,s=i-o,u=e-r,f=u-e,l=o-(i-s)+(-c-s)+u,a=i+l,p=e-(u-f)+(-r-f)+(l-(a-i)),h=a+p;return[p-(h-a),h]}const{atan2:vn}=Math,gn=pn;function mn(t,n){const e=t[0],o=t[1],r=n[0],c=n[1],i=dn(gn(c,e),gn(r,o))[1],s=hn(gn(r,e),gn(c,o))[1];return vn(i,s)}const{abs:xn}=Math;function wn(t){const n=[];for(let e=0;e<t.length-1;e++){const o=[t[e+1][0]-t[e][0],t[e+1][1]-t[e][1]];0!==(0!==o[0]||o[1])&&n.push(o)}const e=n.length;let o=0;for(let t=0;t<e-1;t++)o+=xn(mn(n[t],n[t+1]));return o}function bn(t,n=.4,e=2**-16){const o=[0],r=[1];for(;;){const c=o[o.length-1],i=r[r.length-1];if(wn(U(t,c,i))<=n||i-c<=e){if(o.push(r.pop()),1===i)return o;continue}const s=(c+i)/2;r.push(s)}}const{sqrt:_n,log:Mn}=Math;function Sn(t,n,e=.4,o=16){const r=t[0],c=t[1];if(r===c)return 0;const[[i,s],[u,f],[l,a]]=n;if(i===u&&u===l&&s===f&&f===a)return 0;const p=ln(n,r,c).ps,h=bn(p,e);let d=0;for(let t=0;t<h.length-1;t++){const n=h[t],e=h[t+1];d+=on(sn(p),[n,e],o)}return d}const{abs:Cn}=Math,yn=[[0,0],[0,0],[0,0],[0,0]];function On(t,n,e){return 0===n?1===e?{ps:t,_ps:yn}:function(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=c[0],h=c[1],d=i-n*(i-u),v=u-n*(u-l),g=d-n*(d-v),m=g-n*(g-(v-n*(v-(l-n*(l-p))))),x=s-n*(s-f),w=f-n*(f-a),b=x-n*(x-w),_=b-n*(b-(w-n*(w-(a-n*(a-h))))),M=Cn(n),S=Cn(i),C=Cn(u),y=Cn(l),O=Cn(p),E=Cn(s),I=Cn(f),N=Cn(a),k=S+M*(S+C),P=C+M*(C+y),B=k+M*(k+P),T=E+M*(E+I),A=I+M*(I+N),z=T+M*(T+A);return{ps:[[i,s],[d,x],[g,b],[m,_]],_ps:[[0,0],[k,T],[B,z],[B+M*(B+(P+M*(P+(y+M*(y+O))))),z+M*(z+(A+M*(A+(N+M*(N+Cn(h))))))]]}}(t,e):1===e?function(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=c[0],h=c[1],d=i-n*(i-u),v=u-n*(u-l),g=l-n*(l-p),m=d-n*(d-v),x=v-n*(v-g),w=m-n*(m-x),b=s-n*(s-f),_=f-n*(f-a),M=a-n*(a-h),S=b-n*(b-_),C=_-n*(_-M),y=S-n*(S-C),O=Cn(n),E=Cn(i),I=Cn(u),N=Cn(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3*F*(F*ot+nt)+K)]]}}(t,n,e)}function En(t,n,e=.4,o=16){const r=t[0],c=t[1];if(r===c)return 0;const[[i,s],[u,f],[l,a],[p,h]]=n;if(i===u&&u===l&&l===p&&s===f&&f===a&&a===h)return 0;const d=On(n,r,c).ps,v=bn(d,e);let g=0;for(let t=0;t<v.length-1;t++){const n=v[t],e=v[t+1];g+=on(sn(d),[n,e],o)}return g}function In(t,n=.4,e=16){if(4===t.length)return En([0,1],t,n,e);if(3===t.length)return Sn([0,1],t,n,e);if(2===t.length)return en([0,1],t);if(1===t.length)return 0;throw new Error("The given bezier curve must be of order <= 3.")}function Nn(t,n,e=!0){const{cpNodes:o,hasHoleCloser:r}=function(t,n,e=!0){if(!e&&t===n)return{cpNodes:[],hasHoleCloser:!1};const o=t,r=[o];let c=t.next,i=o.isHoleClosing;for(;c!==n&&c!==o;)c.isHoleClosing&&(i=!0),r.push(c),c=c.next;return{cpNodes:r,hasHoleCloser:i}}(t,n,e);return{pss:o.flatMap(Z),hasHoleCloser:r}}function kn(t){const n=t,e=t.nextOnCircle,o=nn(n.pointOnShape.p,e.pointOnShape.p),{pss:r,hasHoleCloser:c}=Nn(n,e),i=function(t){let n=0;for(let e of t)n+=e;return n}(r.map(t=>In(t)));return c?1/0:i/o}function Pn(t,n){let e=t;const o=[];for(;e!==n;){const t=Vt(e,e.next);o.push(t),e=e.next}return o}function Bn(t,n){const e=st(lt(ht($t(t),0)),lt(ht($t(n),0)));return Math.abs(Math.asin(e)*(180/Math.PI))}function Tn(t){const n=[];return R(t,t=>{n.push(t)}),n}function An(t,n){let e;return e=t.curve.idx-n.curve.idx,0!==e||(e=t.t-n.t,0!==e||(e=t.order-n.order,0!==e||(e=t.order2-n.order2))),e}function zn(t,n){return An(t.pointOnShape,n.pointOnShape)}const Dn={getChildren:K,getVertexForwardChildren:Y,getAllOnLoop:k,getAllOnCircle:A,isOnSameCircle:Zt,isTerminating:z,isFullyTerminating:q,getFirstExit:Ut,isSharp:W,isOneProng:Gt,getProngCount:T,getRealProngCount:D,cpNodeComparator:zn,enhanceCpNode:j,traverseCp:F,traverseEdges:H,traverseVertices:R,clone:Q,getBoundaryBezierPartsToNext:$,getBoundaryBeziersToNext:Z,removeVertex:J,getMatCurveToNext:$t,isTwoProng:Jt,getBranch:Kt,getBranchBeziers:tn,getSalience:kn,getMatCurveBetween:Vt,getEdgeDirection:Rt,getBoundaryBeziersBetween:Nn,getMatCurvesBetween:Pn,getHoleClosers:P,getInitialDegAngleBetweenMatCurves:Bn,getAllVertices:Tn};function Ln(t){return n=>A(n).some(t)}const qn=Ln(function(t){return 2!==D(t)&&!t.isHoleClosing});const{abs:Wn}=Math,{abs:jn}=Math;function Fn(t,n){if(t.length!==n.length)throw new Error("`p` and `p_` must be of equal length.");for(let e=0;e<t.length;e++){const o=jn(n[e]);if(t[e]-o>=0)continue;let r=!1,c=!1;for(let o=0;o<e;o++){const e=jn(n[o]),i=t[o]-e,s=t[o]+e;if(i>0){r=!0;break}s>0&&(c=!0)}if(!r&&c)return 1/0}return function(t){const n=t.length-1;if(n<1)return 0;t[0]<0&&(t=function(t){const n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=-t[e];return n}(t));const e=[];for(let t=0;t<n;t++)e.push(1);let o=0;for(let r=0;r<=n;r++){if(t[r]>=0)continue;let n=1/0,c=!1;for(let o=0;o<r;o++){if(t[o]<=0)continue;const i=(-t[r]/(t[o]/2**e[o]))**(1/(r-o));e[o]++,n>i&&(n=i),c=!0}c&&o<n&&(o=n)}return o}(function(t,n){if(t.length!==n.length)throw new Error("`p` and `p_` must be of equal length.");const e=new Array(t.length);for(let o=0;o<t.length;o++){const r=Wn(n[o]),c=t[o]-r,i=t[o]+r;e[o]=c>0||i<0?c:0}return e}(t,n))}const Hn=(Yn=Fn,(t,n)=>-Yn(function(t){const n=t.length-1;if(n<0)return[];const e=t.slice();for(let t=0;t<n+1;t++)t%2==(n-1)%2&&(e[t]=-e[t]);return e}(t),n));var Yn;const{min:Rn,max:Xn,abs:Qn}=Math,Vn=17976931348623157e292,$n=Number.EPSILON,Un=$n/2,Zn=Un*Un,Gn=Kn(1),Jn=function(){const t=3*Zn;return t/(1-t)}();function Kn(t){const n=t*Un;return n/(1-n)}new Array(20).fill(0).map((t,n)=>Kn(n));const{abs:te}=Math;function ne(t){const n=t.slice(),e=n.length;if(1===e)return n;let o=n[e-1],r=e;for(let t=e-2;t>=0;--t){const e=o,c=n[t];o=e+c;const i=c-(o-e);i&&(n[--r]=o,o=i)}let c=0;for(let t=r;t<e;++t){const e=n[t],r=o;o=e+r;const i=r-(o-e);i&&(n[c++]=i)}return n[c++]=o,n.length=c,n}const{abs:ee}=Math,{abs:oe}=Math,re=134217729;function ce(t,n){const e=n[0],o=n[1],r=o*t,c=re*o,i=c-(c-o),s=o-i,u=re*t,f=u-(u-t),l=t-f,a=e*t,p=r+a,h=a-(p-r)+(s*l-(r-i*f-s*f-i*l)),d=p+h;return[h-(d-p),d]}function ie(t,n){const e=n[0],o=n[1],r=o*t,c=re*o,i=c-(c-o),s=o-i,u=re*t,f=u-(u-t),l=t-f,a=s*l-(r-i*f-s*f-i*l)+e*t,p=r+a;return[a-(p-r),p]}const{abs:se}=Math;function ue(t,n,e){const o=t.length-1;if(o<0)return[[],[]];const r=se(n),c=t.slice(),i=e.slice();for(let t=0;t<=o;t++)for(let e=1;e<=o-t;e++){const t=c[e-1],o=i[e-1],s=ie(n,t),u=r*o+se(s[1]),f=c[e];c[e]=hn(f,s),i[e]=i[e]+u+se(c[e][1])}return[c,i]}const fe=2**27+1;function le(t,n){const e=t[1],o=n[1],r=e*o,c=fe*e,i=c-(c-e),s=e-i,u=fe*o,f=u-(u-o),l=o-f,a=s*l-(r-i*f-s*f-i*l)+(e*n[0]+t[0]*o),p=r+a;return[a-(p-r),p]}const{abs:ae}=Math;function pe(t,n){const e=t.length-1;if(e<0)return[];const o=t.slice();for(let t=0;t<=e;t++)for(let r=1;r<=e-t;r++)o[r]=ne(vt(o[r],mt(o[r-1],n)));return o}function he(t,n){const e=t.length-1;if(e<0)return[];const o=new Array(e+1);o[e]=t[e];let r=[1];for(let c=1;c<=e;c++)r=mt(r,n),o[e-c]=wt(t[e-c],r);return o}const{abs:de,sign:ve}=Math;const ge=134217729;function me(t,n){const e=t*n,o=ge*t,r=o-(o-t),c=t-r,i=ge*n,s=i-(i-n),u=n-s;return[c*u-(e-r*s-c*s-r*u),e]}const{abs:xe}=Math;function we(t,n){const e=xe(n);let o=t[0],r=.5*xe(o);for(let c=1;c<t.length;c++)o=o*n+t[c],r=r*e+xe(o);return r=Un*(2*r-xe(o)),[o,r]}const be=Math.abs,{abs:_e}=Math,Me=Kn(1),Se=Kn(2);function Ce(t,n,e=void 0,o=1){const r=t[0],[c,i]=we(r,n),s=Se*function(t,n){const e=be(n);let o=0;for(let n=0;n<t.length;n++)o=o*e+be(t[n]);return o}(r,n),u=void 0!==e?at(e,_e(n)):0;if((i+s+u)*o<Math.abs(c))return c;const f=function(t,n){const e=[],o=[];let r,c=t[0];for(let i=1;i<t.length;i++){const[s,u]=me(c,n);[r,c]=Et(u,t[i]),e.push(s),o.push(r)}return{r̂:c,pπ:e,pσ:o}}(r,n),{pπ:l,pσ:a}=f;let{r̂:p}=f;const[h,d]=we(l,n),[v,g]=we(a,n),[m,x]=we(t[1],n);let w=d+g+x+u;return p=h+v+m+p,w+=Me*p,w*o<Math.abs(p)?p:0}function ye(t,n){let e=[0];for(let o=0;o<t.length;o++)e=vt(t[o],mt(e,n));return e}const{abs:Oe,min:Ee,max:Ie,log2:Ne,ceil:ke}=Math;function Pe(t,n,e,o,r,c,i,s){let u=e,f=o,l=u,a=r,p=f-u,h=p;for(;;){let d;Oe(a)<Oe(c)&&(u=f,f=l,l=u,r=c,c=a,a=r);const v=Ie(Oe(u),Oe(f));d=v<=1?$n:$n*2**ke(Ne(v));const g=.5*(l-f);if(Oe(g)<=d)return f<l?[f,l,f]:[l,f,f];if(Oe(p)<d||Oe(r)<=Oe(c))p=g,h=p;else{let t,n,e=c/r;if(u===l)t=2*g*e,n=1-e;else{n=r/a;const o=c/a;t=e*(2*g*n*(n-o)-(f-u)*(o-1)),n=(n-1)*(o-1)*(e-1)}0<t?n=-n:t=-t,e=p,p=h,2*t<3*g*n-Oe(d*n)&&t<Oe(.5*e*n)?h=t/n:(p=g,h=p)}if(u=f,r=c,d<Oe(h)?f+=h:0<g?f+=d:f-=d,0===(c=s?bt(ye(i(),f)):Ce(t,f,n))){if(s)return[f,f,f];const r=Ie(e,f-d),u=Ee(o,f+d);if(Ce(t,r,n)*Ce(t,u,n)!==0)return[r,u,f];if(s=!0,0===(c=bt(ye(i(),f))))return[f,f,f]}(0<c&&0<a||c<=0&&a<=0)&&(l=u,a=r,p=f-u,h=p)}}const{abs:Be}=Math;function Te(t,n,e){const o=Be(n);let r=t[0],c=e[0];for(let i=1;i<t.length;i++){const s=r*n;r=s+t[i],c=c*o+Be(s)+e[i]+Be(r)}return[r,c]}function Ae(t){const n=t[0].length,e=[];for(let o=0;o<n;o++){const r=[];for(let e=0;e<t.length;e++)r.push(t[e][n-(o+1)]);e.push(r)}return e}const ze=hn,De=ie,{abs:Le}=Math;function qe(t,n,e){const o=Le(n);let r=t[0],c=e[0];for(let i=1;i<t.length;i++){const s=De(n,r);r=ze(s,t[i]),c=c*o+Le(s[1])+e[i]+Le(r[1])}return[r,c]}const{abs:We,min:je,max:Fe,log2:He,ceil:Ye}=Math,Re=Jn/Gn;function Xe(t,n,e,o,r,c,i){const s=t.length-1;let u=0,f=1;for(;;){f*=2;for(let l=1;l<f;l+=2){u++;const a=r+(c-r)*(f+2*l)/(4*f),[p,h]=Te(t,a,n);if(We(p)>h*Gn)return[a,p];if(u>s)return Qe(e,o,r,c,i)}}}function Qe(t,n,e,o,r){const c=t.length-1;let i=0,s=1;for(;;){s*=2;for(let u=1;u<s;u+=2){i++;const f=e+(o-e)*(s+2*u)/(4*s),[l,a]=qe(t,f,n);if(We(l[1])>a*Jn)return[f,l[1]];if(i>c)return Ve(r(),e,o)}}}function Ve(t,n,e){const o=t.length-1;let r=1;for(;;){r*=2;for(let c=1;c<r;c+=2){const i=n+(e-n)*(r+2*c)/(4*r),s=ne(ye(t,i)),u=s[s.length-1];if(0!==u)return[i,u];if(0>o)throw new Error("Cannot resolve root even in Shewchuk expansion precision")}}}const{abs:$e,max:Ue,log2:Ze,ceil:Ge}=Math;function Je(t,n=-1/0,e=1/0,o,r,c=!1){let i;"number"==typeof t[0]&&(t=t.map(t=>[0,t]));const s=()=>void 0===r?t:(void 0===i&&(i=r()),i);o=o||new Array(t.length).fill(0),({pDd:t,pDd_:o,pExact:i}=function(t,n,e,o){let r;if(0===t.length||te(t[0][1])>o*n[0])return{pDd:t,pDd_:n,pExact:r};r=r||e();for(let e=0;e<r.length;e++){const c=r[e],i=t[e];i[1]=c[c.length-1],i[0]=c[c.length-2]??0,n[e]=te(i[1])*(Jn/o)}let c=0;for(;c<t.length&&0===t[c][1];)c++;return t=t.slice(c),n=n.slice(c),r=r.slice(c),{pDd:t,pDd_:n,pExact:r}}(t,o,s,Jn));const u=t.map(t=>t[0]+t[1]);if((c||$e(n)>2**20||$e(e)>2**20)&&([n,e]=function(t,n,e,o,r){t=Xn(t,Hn(e,o.map(t=>t*r))),n=Rn(n,Fn(e,o.map(t=>t*r)));const c=2**(-2*(e.length-1));for(Number.isFinite(t)||(t=-c*Vn),Number.isFinite(n)||(n=c*Vn);;){const o=Qn(at(e,t)),r=Qn(at(e,n));if(o>c*Vn)t/=2;else{if(!(r>c*Vn))break;n/=2}}return[t,n]}(n,e,u,o,Jn)),0!==t.length){if(1===t.length)return[];if(n===e){const t=2*$n*Ue(1,2**Ge(Ze(Ue($e(n),$e(e)))));n-=t,e+=t}return function(t,n,e,o,r,c){const i=e.map((n,e)=>n*Re+We(t[e])),s=o,u=r;let f,l,a,p,h=r-o;for(;[f,l]=Te(t,o,i),!(We(f)>l*Gn);)o-=h/2,h*=2;for(;[a,p]=Te(t,r,i),!(We(a)>p*Gn);)r+=h/2,h*=2;const d=[[o,r,f,a,0]],v=[],g=function(t,n,e,o,r){return function(c,i,s,u,f){let[l,a]=function(t,n,e){const o=t.length-1,r=ee(n),c=t.slice(),i=e.slice();for(let t=0;t<=o;t++)for(let e=1;e<=o-t;e++){const t=n*c[e-1],o=r*i[e-1]+ee(t);c[e]=c[e]+t,i[e]=i[e]+o+ee(c[e])}return[c,i]}(t,c,n);!function(t,n,e){const o=t.length-1;if(o<0)return;let r=n,c=0;for(let i=1;i<=o;i++){const s=o-i,u=t[s],f=oe(u),l=e[s],a=u*r;t[s]=a,e[s]=l*r+f*c+oe(a);const p=r*n;c=c*n+p,r=p}}(l,i-c,a),l.reverse(),a.reverse(),function(t,n){const e=t.length-1;for(let o=0;o<=e;o++)for(let r=1;r<=e-o;r++){const e=t[r-1],o=n[r-1]+ee(e);t[r]=t[r]+e,n[r]=n[r]+o+ee(t[r])}}(l,a);let p=0,h=0,d=ve(s);for(let t=1;t<l.length-1;t++){let n=ve(l[t]);const e=l[t],o=a[t]*Gn;de(e)<=o&&(h++,n=-d),n!==d&&(p++,d=n)}return ve(u)!==d&&p++,1===h&&1===p?1:h>0?function(t,n,e,o,r,c,i,s){let[u,f]=ue(t,e,n);(function(t,n,e){const o=t.length-1;if(o<0)return;let r=[0,n],c=0;for(let i=1;i<=o;i++){const s=o-i,u=t[s],f=ae(u[1]),l=e[s],a=le(r,u);t[s]=a,e[s]=l*r[1]+f*c+ae(a[1]);const p=le(r,[0,n]);c=c*n+p[1],r=p}})(u,o-e,f),u.reverse(),f.reverse(),[u,f]=ue(u,1,f);let l=0,a=0,p=ve(r);for(let t=0;t<u.length-1;t++){let n=ve(u[t][1]);const e=f[t]*Jn,o=u[t];e>=de(o[1])&&(a++,n=-p),n!==p&&(l++,p=n)}return ve(c)!==p&&l++,1===a&&1===l?1:0===a?l:i>1?function(t,n,e,o,r){let c=pe(t(),n);c=he(c,e-n),c.reverse(),c=pe(c,1);let i=0,s=ve(o);for(let t=1;t<c.length-1;t++){const n=c[t];let e=ve(n[n.length-1]);e!==s&&0!==e&&(i++,s=e)}return ve(r)!==s&&i++,i}(s,e,o,r,c):-l}(e,o,c,i,s,u,f,r):p}}(t,i,n,e,c);let m,x;for(;d.length>0;){const o=d.pop(),[r,s,u,f,l]=o,a=g(r,s,u,f,l);if(0===a)continue;if(1===a){m=m||e.map(t=>t*Jn),x=x||Ae(n);const[t,o,i]=Pe(x,m,r,s,u,f,c,!1);v.push({t:i,tS:t,tE:o,multiplicity:1});continue}let p=a<0?l+1:0;if(s-r<=2*We(a)*$n*Fe(1,2**Ye(He(Fe(We(r),We(s)))))){if(0===p){v.push({t:(r+s)/2,tS:r,tE:s,multiplicity:We(a)});continue}p=1/0}const[h,w]=Xe(t,i,n,e,r,s,c);d.push([r,h,u,w,p]),d.push([h,s,w,f,p])}return v.reverse(),v.filter(t=>{const{tS:n,tE:e}=t;return!(e<s||n>u)})}(u,t,o,n,e,s)}}function Ke(t,n){if(0===n)return t[0];if(1===n)return t[t.length-1];if(4===t.length){const[[e,o],[r,c],[i,s],[u,f]]=t,l=e+(r-e)*n,a=r+(i-r)*n,p=l+(a-l)*n,h=o+(c-o)*n,d=c+(s-c)*n,v=h+(d-h)*n;return[p+(a+(i+(u-i)*n-a)*n-p)*n,v+(d+(s+(f-s)*n-d)*n-v)*n]}if(3===t.length){const[[e,o],[r,c],[i,s]]=t,u=e+(r-e)*n,f=o+(c-o)*n;return[u+(r+(i-r)*n-u)*n,f+(c+(s-c)*n-f)*n]}if(2===t.length){const[[e,o],[r,c]]=t;return[e+(r-e)*n,o+(c-o)*n]}if(1===t.length)return t[0];throw new Error("The given bezier curve must be of order <= 3.")}function to(t){const n=pt(t),e=Je(n[0],0,1)?.map(t=>t.t)||[],o=Je(n[1],0,1)?.map(t=>t.t)||[];e.push(0,1),o.push(0,1);let r,c,i,s,u=1/0,f=-1/0,l=1/0,a=-1/0;for(let n=0;n<e.length;n++){const o=e[n],[i]=Ke(t,o);i<u&&(u=i,r=o),i>f&&(f=i,c=o)}for(let n=0;n<o.length;n++){const e=o[n],[,r]=Ke(t,e);r<l&&(l=r,i=e),r>a&&(a=r,s=e)}return{ts:[[r,i],[c,s]],box:[[u,l],[f,a]]}}const no=et(to);function eo(t,n){return oo(t)-oo(n)}function oo(t){let n=1/0;for(const e of t){const t=no(e).box[0][1];t<n&&(n=t)}return n}function ro(t){const n=[],e=[t];for(;e.length;){const t=e.pop();if(0===t.windingNum)for(const e of t.children)0!==e.windingNum&&n.push(e);e.push(...t.children)}return n}const{abs:co}=Math;function io(t,n){return"AND"===t?co(n)>=2:"XOR"===t?co(n)%2==1:0!==n}function so(t){return n=>{const e=[],o=[[n,0]];for(;o.length;){const[n,r]=o.pop(),c=n.parent.windingNum,i=io(t,n.windingNum)!==io(t,c);i&&e.push({out:n,depth:r,windingNum:n.windingNum,parentWinding:c});const s=i?r+1:r;for(const t of n.children)0===n.windingNum&&0!==t.windingNum||o.push([t,s])}return e}}function uo(t,n){let e=t.x.curve.idx-n.x.curve.idx;return 0!==e||(e=t.x.ri.tS-n.x.ri.tS),e}const{floor:fo,ceil:lo}=Math;function ao(t,n,e,o){const r=[];for(const o of t)r.push({type:-1,item:o,x:n(o)}),r.push({type:1,item:o,x:e(o)});r.sort(po);const c=new Set,i=[];for(const t of r){const{item:n,type:e}=t;if(-1===e){for(const t of c){const e=o(n,t);e&&i.push({a:n,b:t,u:e})}c.add(n)}else 1===e&&c.delete(n)}return i}function po(t,n){const e=t.x-n.x;return 0!==e?e:t.type}function ho(t,n,e){let[[o,r],[c,i]]=n,[[s,u],[f,l]]=e;r>i&&([r,i]=[i,r]),u>l&&([u,l]=[l,u]),o>c&&([o,c]=[c,o]),s>f&&([s,f]=[f,s]);const a=t||o===c&&s===f,p=t||r===i&&u===l;return(a?o<=f:o<f)&&(a?c>=s:c>s)&&(p?u<=i:u<i)&&(p?l>=r:l>r)}function vo(t,n){let[[e,o],[r,c]]=t;e>r&&([e,r]=[r,e]),o>c&&([o,c]=[c,o]);const i=(r-e)*n,s=(c-o)*n;return[[e-i,o-s],[r+i,c+s]]}function go(t,n){return ho(!0,vo(t.box,.5),vo(n.box,.5))}function mo(t,n){const[e,o]=n;t.getOrInsert(e,[]).push(o),t.getOrInsert(o,[]).push(e)}function xo(t,n,e,o){e.add(n),o.push(n);const r=t.get(n);for(let n=0;n<r.length;n++){const c=r[n];e.has(c)||xo(t,c,e,o)}}function wo(t){const n=[],e=new Set;for(const o of t){const r=o[0];e.has(r)||(n.push([]),xo(t,r,e,n[n.length-1]))}return n}const{min:bo,max:_o}=Math;function Mo(t){let n=1/0,e=1/0,o=-1/0,r=-1/0;const c=[];for(const i of t){const[[t,s],[u,f]]=i.box;n=bo(n,t),e=bo(e,s),o=_o(o,u),r=_o(r,f),c.push(...i.xs)}return{xs:c,box:[[n,e],[o,r]]}}function So(t){const n=[];function e(...e){if("undefined"==typeof _debug_)return t.apply(this,e);const o=performance.now(),r=t.apply(this,e),c=performance.now();return n.push(c-o),r}return e.getStats=()=>{const e=function(t){let n=0;for(let e of t)n+=e;return n}(n);return{name:t.name,totalMs:e,count:n.length}},e.resetStats=()=>{n.length=0},e}const Co=So(function(t){for(;;){const n=ao(t,t=>vo(t.box,.5)[0][0],t=>vo(t.box,.5)[1][0],go);if(!n.length)break;const e=new Map(t.map(t=>[t,[]]));for(let t=0;t<n.length;t++){const o=n[t];mo(e,[o.a,o.b])}t=wo(e).map(Mo)}return t});function yo(t,n){const e=t[0],o=t[1],r=n[0],c=n[1],i=o-c,s=i-o,u=e-r,f=u-e,l=o-(i-s)+(-c-s)+u,a=i+l;return a+(e-(u-f)+(-r-f)+(l-(a-i)))}function Oo(t,n){const e=t-n,o=t-e;return[t-(e+o)+(o-n),e]}function Eo(t,n){const e=t[0],o=t[1],r=o+n,c=r-o,i=e+(o-(r-c)+(n-c)),s=r+i;return[i-(s-r),s]}const Io=le,No=hn,ko=dn,Po=Oo,Bo=Eo;function To(t,n){if(0===n[0]&&0===n[1])return t[0].map(t=>[0,t]);if(0===n[0]&&1===n[1])return t[t.length-1].map(t=>[0,t]);if(4===t.length){const[[e,o],[r,c],[i,s],[u,f]]=t,l=Bo(Io(Po(r,e),n),e),a=Bo(Io(Po(i,r),n),r),p=Bo(Io(Po(u,i),n),i),h=No(l,Io(ko(a,l),n)),d=No(a,Io(ko(p,a),n)),v=No(h,Io(ko(d,h),n)),g=Bo(Io(Po(c,o),n),o),m=Bo(Io(Po(s,c),n),c),x=Bo(Io(Po(f,s),n),s),w=No(g,Io(ko(m,g),n)),b=No(m,Io(ko(x,m),n));return[v,No(w,Io(ko(b,w),n))]}if(3===t.length){const[[e,o],[r,c],[i,s]]=t,u=No([0,e],Io(Po(r,e),n)),f=No([0,r],Io(Po(i,r),n)),l=No(u,Io(ko(f,u),n)),a=No([0,o],Io(Po(c,o),n)),p=No([0,c],Io(Po(s,c),n));return[l,No(a,Io(ko(p,a),n))]}if(2===t.length){const[[e,o],[r,c]]=t;return[Bo(Io(Po(r,e),n),e),Bo(Io(Po(c,o),n),o)]}if(1===t.length){const[n,e]=t[0];return[[0,n],[0,e]]}throw new Error("The given bezier curve must be of order <= 3.")}function Ao(t,n){return To(t,[0,n]).map(t=>t[0]+t[1])}const{min:zo,max:Do}=Math;function Lo(t,n,e,o){let r;for(const{curve:c,ts:i}of function*(t,n){const e=n?t.next:t.prev,o=t.x.curve,r=t.x.ri.tS,c=e.x.curve,i=e.x.ri.tS,s=n?1:0,u=n?0:1;let f=o,l=r,a=!1;for(;;){if(f===c&&(l===i?a:n?l<i:l>i))return void(yield{ts:[l,i],curve:f});yield{ts:[l,s],curve:f},a=!0,l=u,f=n?f.next:f.prev}}(n,o)){const{ps:n}=c;void 0===r&&(r=Ao(n,i[0]));const o=Ao(n,i[1]),[s,u]=r,[f,l]=o;let a=[];for(let t=0;t<e.length;t++){const n=e[t],[[o,r]]=n;(t%2==0&&zo(u,l)<=r&&r<=Do(u,l)||t%2==1&&zo(s,f)<=o&&o<=Do(s,f))&&a.push(t)}if(a.length>0)return t.oSideIdxs=a,a;r=o}}function qo(t,n){const e=t[0],o=t[1],r=o-n,c=r-o,i=e-e,s=o-(r-c)+(-n-c)+e,u=r+s,f=e-(e-i)-i+(s-(u-r)),l=u+f;return[f-(l-u),l]}const Wo=134217729;function jo(t,n){const e=t[0],o=t[1],r=o/n,c=r*n,i=Wo*r,s=i-(i-r),u=r-s,f=Wo*n,l=f-(f-n),a=n-l,p=(o-c-(u*a-(c-s*l-u*l-s*a))+e)/n,h=r+p;return[p-(h-r),h]}const Fo=dn;function Ho(t,n){return Fo(t,n)[1]>0?n:t}const Yo=dn;function Ro(t,n){return Yo(t,n)[1]>0?t:n}function Xo(t){return[-t[0],-t[1]]}const Qo=Oo,Vo=ie,$o=hn,Uo=Eo,{abs:Zo}=Math;function Go(t){const[[n,e],[o,r],[c,i],[s,u]]=t,f=Qo(s,n),l=Qo(o,c),a=3*(o-c),p=Vo(3,l),h=Zo(a),d=$o(f,p),v=h+Zo(s-n+a),g=Qo(c,2*o),m=Uo(g,n),x=Zo(c-2*o+n),w=Vo(3,m),b=6*x,_=Qo(o,n),M=Vo(3,_),S=Zo(3*(o-n)),C=Qo(u,e),y=Qo(r,i),O=3*(r-i),E=Vo(3,y),I=Zo(O),N=$o(C,E),k=I+Zo(u-e+O),P=Qo(i,2*r),B=Uo(P,e),T=Zo(i-2*r+e),A=Vo(3,B),z=6*T,D=Qo(r,e);return{coeffs:[[d,w,M,[0,n]],[N,A,Vo(3,D),[0,e]]],errorBound:[[v,b,S,0],[k,z,Zo(3*(r-e)),0]]}}function Jo(t){const[[n,e],[o,r],[c,i]]=t,s=c-2*o,u=Qo(c,2*o),f=Uo(u,n),l=Zo(s+n),a=Qo(2*o,2*n),p=i-2*r,h=Qo(i,2*r),d=Uo(h,e),v=Zo(p+e);return{coeffs:[[f,a,[0,n]],[d,Qo(2*r,2*e),[0,e]]],errorBound:[[l,0,0],[v,0,0]]}}function Ko(t){const[[n,e],[o,r]]=t;return[[Qo(o,n),[0,n]],[Qo(r,e),[0,e]]]}const tr=dn,nr=ie,er=Xo,{abs:or}=Math;function rr(t){const[[n,[,e]],[o,[,r]]]=Ko(t),c=er(o),i=n,s=nr(r,n),u=or(s[1]),f=nr(e,o),l=or(f[1]),a=tr(f,s);return{coeffs:{vₓ:c,vᵧ:i,v:a},errorBound:{v_:u+l+or(a[1])}}}const{abs:cr}=Math,ir=hn,sr=ie,ur=le;function fr(t){return[2*t[0],2*t[1]]}const lr=Xo,ar=fr,pr=ie,hr=le,dr=dn,{abs:vr}=Math;function gr(t){const{coeffs:[[n,e,[,o]],[r,c,[,i]]],errorBound:[[s],[u]]}=Jo(t),f=n[1],l=e[1],a=r[1],p=c[1],h=vr(o),d=vr(l),v=vr(f),g=vr(i),m=vr(p),x=vr(a),w=hr(n,c),b=s*m+2*vr(f*p),_=hr(e,r),M=d*u+2*vr(l*a),S=pr(i,n),C=g*s+vr(i*f),y=pr(o,r),O=h*u+vr(o*a),E=pr(i,e),I=vr(i*l),N=pr(o,c),k=vr(o*p),P=hr(n,n),B=2*(s*v+vr(f*f)),T=hr(n,r),A=s*x+v*u+2*vr(f*a),z=hr(r,r),D=2*(u*x+vr(a*a)),L=f*p-l*a,q=f*i-o*a,W=l*i-o*p,j=dr(w,_),F=vr(L),H=b+M+F,Y=dr(S,y),R=vr(q),X=C+O+R,Q=dr(E,N),V=vr(W),$=I+k+V,U=lr(z),Z=D,G=ar(T),J=2*A,K=lr(P),tt=B,nt=p*L,et=hr(c,j),ot=m*H+2*vr(nt),rt=2*q*a,ct=ar(hr(r,Y)),it=2*(u*R+x*X+2*vr(rt)),st=nt-rt,ut=dr(et,ct),ft=ot+it+vr(st),lt=2*f*q,at=ar(hr(n,Y)),pt=2*(s*R+v*X+2*vr(lt)),ht=l*L,dt=hr(e,j),vt=d*H+2*vr(ht),gt=lt-ht,mt=dr(at,dt),xt=pt+vt+vr(gt),wt=L*W,bt=hr(j,Q),_t=H*V+F*$+2*vr(wt),Mt=q*q,St=hr(Y,Y),Ct=2*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ᵧᵧᵧ_:ue,vₓₓ_:ye,vₓᵧ_:$e,vᵧᵧ_:ze,vₓ_:So,vᵧ_:To,v_:Qo+Ro+Cr(Vo[1])}}}const Tr=pn,Ar=fr,zr=ie,Dr=le,Lr=hn,{abs:qr}=Math,Wr=hn,jr=ie,Fr=le,{abs:Hr}=Math,Yr=pn,Rr=fr,Xr=ie,Qr=le,Vr=hn,{abs:$r}=Math,Ur=pn,Zr=fr,Gr=ie,Jr=le,Kr=hn,{abs:tc}=Math,nc=hn,ec=ie,oc=le,{abs:rc}=Math,cc=pn,ic=fr,sc=ie,uc=le,fc=hn,{abs:lc}=Math,ac=pn,pc=fr,hc=ie,dc=le,vc=hn,{abs:gc}=Math,mc=dt,xc=Et,wc=xt,bc=It;function _c(t){if(4===t.length)return Mc(t);if(3===t.length)return Sc(t);if(2===t.length)return Cc(t);if(1===t.length)return function(t){const[[n,e]]=t;return[[[n]],[[e]]]}(t);throw new Error("The given bezier curve must be of order <= cubic.")}function Mc(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[vt(mc(s,n),wc(3,mc(o,c))),wc(3,bc(xc(c,n),-2*o)),wc(3,mc(o,n)),[n]].map(ne),[vt(mc(u,e),wc(3,mc(r,i))),wc(3,bc(xc(i,e),-2*r)),wc(3,mc(r,e)),[e]].map(ne)]}function Sc(t){const[[n,e],[o,r],[c,i]]=t;return[[bc(xc(c,n),-2*o),mc(2*o,2*n),[n]],[bc(xc(i,e),-2*r),mc(2*r,2*e),[e]]]}function Cc(t){const[[n,e],[o,r]]=t;return[[mc(o,n),[n]],[mc(r,e),[e]]]}const yc=xt,Oc=_t;function Ec(t){const[[n,[e]],[o,[r]]]=t;if(0!==St(n)||0!==St(o))return{vₓ:Oc(o),vᵧ:n,v:ne(Mt(yc(e,o),yc(r,n)))}}const Ic=xt,Nc=wt,kc=vt;function Pc(t,n){const e=Cc(t),[[o,[r]],[c,[i]]]=Cc(n),{vₓ:s,vᵧ:u,v:f}=Ec(e),l=Nc(o,s),a=Nc(c,u),p=kc(l,a),h=Ic(r,s),d=Ic(i,u),v=kc(h,d);return[p,kc(v,f)].map(ne)}function Bc(t){const n=[];for(let e=0;e<t.length;e++)n.push(2*t[e]);return n}const Tc=xt,Ac=Bc,zc=Mt,Dc=wt,Lc=_t;function qc(t){const[[n,e,[o]],[r,c,[i]]]=t;if(0===St(n)&&0===St(r))return Ec([[e,[o]],[c,[i]]]);const s=Dc(n,c),u=Dc(e,r),f=Tc(i,n),l=Tc(o,r),a=Tc(i,e),p=Tc(o,c),h=Dc(n,n),d=Dc(n,r),v=Dc(r,r),g=zc(s,u),m=zc(f,l),x=zc(a,p),w=ne(Lc(v)),b=ne(Ac(d)),_=ne(Lc(h)),M=Dc(c,g),S=Ac(Dc(r,m)),C=ne(zc(M,S)),y=Ac(Dc(n,m)),O=Dc(e,g),E=ne(zc(y,O)),I=Dc(g,x),N=Dc(m,m);return{vₓₓ:w,vₓᵧ:b,vᵧᵧ:_,vₓ:C,vᵧ:E,v:ne(zc(I,N))}}const Wc=me,jc=xt,Fc=wt,Hc=vt,Yc=Bc;function Rc(t,n){const e=Sc(t);if(0===St(e[0][0])&&0===St(e[1][0]))return Pc([t[0],t[2]],n);const[[o,[r]],[c,[i]]]=Cc(n),{vₓₓ:s,vₓᵧ:u,vᵧᵧ:f,vₓ:l,vᵧ:a,v:p}=qc(e),h=Wc(r,r),d=jc(r,o),v=Wc(r,i),g=jc(r,c),m=Fc(o,o),x=jc(i,o),w=Fc(o,c),b=Wc(i,i),_=jc(i,c),M=Fc(c,c),S=Fc(m,s),C=Fc(M,f),y=Fc(w,u),O=Hc(S,C),E=Hc(O,y),I=Fc(d,s),N=Fc(_,f),k=Hc(g,x),P=Fc(k,u),B=Yc(Hc(I,N)),T=Hc(B,P),A=Fc(o,l),z=Fc(c,a),D=Hc(A,z),L=Hc(T,D),q=Fc(h,s),W=Fc(v,u),j=Fc(b,f),F=Hc(q,W),H=Hc(F,j),Y=jc(r,l),R=jc(i,a),X=Hc(Y,R),Q=Hc(H,X);return[E,L,Hc(Q,p)].map(ne)}const Xc=wt,Qc=dt,Vc=mt,$c=Et;function Uc(t,n=!1){const[e,o,r,c]=t;if(!n){const[t,n]=e,[i,s]=o,[u,f]=r,[l,a]=c;return[e,[bt(Mt(Vc($c(i/4,u/4),3),$c(t/4,l/4))),bt(Mt(Vc($c(s/4,f/4),3),$c(n/4,a/4)))],c]}const i=function(t,n){const[[e,o],[r,c]]=t,[[i,s],[u,f]]=n,l=Qc(r,e),a=Qc(c,o),p=Qc(u,i),h=Qc(f,s),d=Mt(Xc(p,a),Xc(h,l));if(0===St(d))return;const v=Qc(i,e),g=Qc(s,o),m=bt(Mt(Xc(g,l),Xc(v,a)))/bt(d);return[i+m*bt(p),s+m*bt(h)]}([e,o],[c,r]);if(void 0!==i)return[e,i,c]}const Zc=xt,Gc=wt,Jc=vt,Kc=Mt,ti=_t,ni=Bc;function ei(t){const[[n,e,o,[r]],[c,i,s,[u]]]=t;if(0===St(n)&&0===St(c))return qc([[e,o,[r]],[i,s,[u]]]);const f=Gc(n,s),l=Gc(o,c),a=Gc(n,i),p=Gc(e,i),h=Gc(e,c),d=Gc(n,n),v=Gc(i,i),g=Gc(c,c),m=Gc(o,n),x=Gc(e,e),w=Gc(s,c),b=Gc(i,c),_=Gc(e,n),M=Gc(n,c),S=Zc(u,n),C=Zc(r,c),y=Zc(u,e),O=Zc(r,i),E=Gc(e,s),I=Gc(o,i),N=Zc(u,o),k=Zc(r,s),P=Kc(S,C),B=Kc(f,l),T=Kc(a,h),A=Kc(y,O),z=Kc(E,I),D=Kc(N,k),L=Kc(w,v),q=Kc(m,x),W=Jc(h,a),j=Jc(l,f),F=ni(B),H=Gc(P,P),Y=Gc(P,B),R=Gc(P,T),X=Gc(P,z),Q=Gc(B,B),V=Gc(F,A),$=Gc(T,A),U=Gc(T,z),Z=Gc(T,D),G=ne(Gc(ti(c),g)),J=ne(Gc(Zc(3,n),g)),K=ne(Gc(Zc(-3,c),d)),tt=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ci(oi(3,r),s),N=ri(r,u),k=ri(i,u),P=ri(r,f),B=ri(i,f),T=ri(i,l),A=ci(oi(3,i),l),z=ci(o,s),D=ci(o,f),L=ci(c,u),q=ci(c,l),W=ii(z,L),j=ii(D,q),F=ci(_,W),H=ci(O,j),Y=ii(F,H),R=ii(I,k),X=si(ii(N,B)),Q=ii(P,A),V=ii(R,a),$=ii(X,p),U=ii(Q,h),Z=ci(_,V),G=ci(S,$),J=ci(O,U),K=ii(Z,G),tt=ii(K,J),nt=si(ii(k,a)),et=si(ii(P,h)),ot=ii(I,nt),rt=ii(A,et),ct=ii(N,p),it=ii(B,p),st=ci(x,ot),ut=ci(y,rt),ft=ci(b,ct),lt=ci(M,it),at=ci(o,d),pt=ci(c,v),ht=ii(st,ut),dt=ii(ft,lt),vt=ii(ht,dt),gt=ii(at,pt),mt=ii(vt,gt),xt=ii(E,k),wt=ii(T,P),bt=ii(xt,a),_t=ii(wt,h),Mt=ci(m,bt),Ct=ci(C,_t),yt=ci(w,p),Ot=ii(Mt,Ct),Et=ii(Ot,yt),It=ri(r,d),Nt=ri(i,v),kt=ii(It,Nt),Pt=ii(Et,kt);return[Y,tt,mt,ii(Pt,g)].map(ne)}const fi=xt,li=wt,ai=vt;function pi(t,n){const e=Cc(t),[[o,r,[c]],[i,s,[u]]]=Sc(n);if(0===St(o)&&0===St(i))return Pc(t,[n[0],n[2]]);const{vₓ:f,vᵧ:l,v:a}=Ec(e),p=li(o,f),h=li(i,l),d=ai(p,h),v=li(r,f),g=li(s,l),m=ai(v,g),x=fi(c,f),w=fi(u,l),b=ai(x,w);return[d,m,ai(b,a)].map(ne)}const hi=me,di=xt,vi=wt,gi=vt,mi=Bc;function xi(t,n){const e=Sc(t);if(0===St(e[0][0])&&0===St(e[1][0]))return pi([t[0],t[2]],n);const[[o,r,[c]],[i,s,[u]]]=Sc(n);if(0===St(o)&&0===St(i))return Rc(t,[n[0],n[2]]);const{vₓₓ:f,vₓᵧ:l,vᵧᵧ:a,vₓ:p,vᵧ:h,v:d}=qc(e),v=hi(c,c),g=di(c,r),m=di(c,o),x=hi(c,u),w=di(c,s),b=di(c,i),_=vi(r,r),M=vi(r,o),S=di(u,r),C=vi(r,s),y=vi(r,i),O=vi(o,s),E=vi(o,o),I=di(u,o),N=vi(o,i),k=hi(u,u),P=di(u,s),B=di(u,i),T=vi(s,s),A=vi(s,i),z=vi(i,i),D=vi(E,f),L=vi(N,l),q=vi(z,a),W=gi(D,L),j=gi(W,q),F=vi(M,f),H=vi(A,a),Y=gi(y,O),R=vi(Y,l),X=mi(gi(F,H)),Q=gi(X,R),V=gi(mi(m),_),$=gi(mi(B),T),U=gi(b,C),Z=gi(U,I),G=vi(V,f),J=vi($,a),K=vi(Z,l),tt=vi(o,p),nt=vi(i,h),et=gi(G,J),ot=gi(et,K),rt=gi(tt,nt),ct=gi(ot,rt),it=vi(g,f),st=vi(P,a),ut=gi(w,S),ft=vi(ut,l),lt=mi(gi(it,st)),at=vi(r,p),pt=vi(s,h),ht=gi(lt,ft),dt=gi(at,pt),vt=gi(ht,dt),gt=vi(v,f),mt=vi(x,l),xt=vi(k,a),wt=di(c,p),bt=di(u,h),_t=gi(gt,mt),Mt=gi(_t,xt),Ct=gi(wt,bt),yt=gi(Mt,Ct);return[j,Q,ct,vt,gi(yt,d)].map(ne)}const wi=me,bi=xt,_i=wt,Mi=vt,Si=Bc;function Ci(t,n){const e=Mc(t);if(0===St(e[0][0])&&0===St(e[1][0]))return xi(Uc(t),n);const[[o,r,[c]],[i,s,[u]]]=Sc(n);if(0===St(o)&&0===St(i))return ui(t,[n[0],n[2]]);const{vₓₓₓ:f,vₓₓᵧ:l,vₓᵧᵧ:a,vᵧᵧᵧ:p,vₓₓ:h,vₓᵧ:d,vᵧᵧ:v,vₓ:g,vᵧ:m,v:x}=ei(e),w=wi(c,c),b=bi(c,r),_=bi(c,o),M=wi(c,u),S=bi(c,s),C=bi(c,i),y=_i(r,r),O=_i(r,o),E=bi(u,r),I=_i(r,s),N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C=Fr(i,e),y=p*m+2*Hr(S),O=M*v,E=Fr(f,o),I=h*x+2*Hr(O),N=S+O,k=Wr(C,E),P=y+I+Hr(N),B=w*d,T=Fr(s,e),A=2*Hr(B),z=_*v,D=Fr(l,o),L=2*Hr(z),q=B+z,W=Wr(T,D),j=A+L+Hr(q),F=jr(u,e),H=u*d,Y=Hr(H),R=jr(a,o),X=a*v,Q=Hr(X),V=H+X,$=Wr(F,R),U=Y+Q+Hr(V),Z=V+g;return{coeffs:[k,W,Wr($,r)],errBound:[P,j,U+c+Hr(Z)]}},function(t,n){const{coeffs:{vₓ:e,vᵧ:o,v:r},errorBound:{v_:c}}=rr(t),{coeffs:[[i,s,u,[,f]],[l,a,p,[,h]]],errorBound:[[d,v,g],[m,x,w]]}=Go(n),b=rc(e[1]),_=rc(o[1]),M=oc(i,e),S=d*b+2*rc(M[1]),C=oc(l,o),y=m*_+2*rc(C[1]),O=nc(M,C),E=S+y+rc(O[1]),I=oc(s,e),N=v*b+2*rc(I[1]),k=oc(a,o),P=x*_+2*rc(k[1]),B=nc(I,k),T=N+P+rc(B[1]),A=oc(u,e),z=g*b+2*rc(A[1]),D=oc(p,o),L=w*_+2*rc(D[1]),q=nc(A,D),W=z+L+rc(q[1]),j=ec(f,e),F=rc(j[1]),H=ec(h,o),Y=rc(H[1]),R=nc(j,H),X=F+Y+rc(R[1]),Q=nc(R,r);return{coeffs:[O,B,q,Q],errBound:[E,T,W,X+c+rc(Q[1])]}}],[function(t,n){const{coeffs:{vₓₓ:e,vₓᵧ:o,vᵧᵧ:r,vₓ:c,vᵧ:i,v:s},errorBound:{vₓₓ_:u,vₓᵧ_:f,vᵧᵧ_:l,vₓ_:a,vᵧ_:p,v_:h}}=gr(t),[[d,[,v]],[g,[,m]]]=Ko(n),x=e[1],w=o[1],b=r[1],_=c[1],M=i[1],S=s[1],C=Mr(x),y=Mr(w),O=Mr(b),E=d[1],I=g[1],N=Mr(v),k=Mr(E),P=Mr(m),B=Mr(I),T=v*v,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wr=Li(f,w),jr=qi(qr,Wr),Fr=Li(Or,Ir),Hr=Li(Er,Nr),Yr=qi(Fr,Hr),Rr=Di(3,qi(Pr,Tr)),Xr=qi(Ar,Wi(Lr)),Qr=qi(Yr,Rr),Vr=qi(Xr,jr),$r=qi(Qr,Vr),Ur=Di(i,a),Zr=Di(l,p),Gr=qi(Ur,Zr),Jr=Di(i,h),Kr=Di(l,d),tc=qi(Jr,Kr),nc=qi(Gr,v),ec=qi(tc,m),oc=Li(_,nc),rc=Li(V,ec),cc=qi(oc,rc),ic=Li(y,g),sc=qi(cc,ic),uc=Di(i,x),fc=Di(l,w),lc=qi(uc,fc),ac=qi(sc,lc);return[ht,Et,Jt,zn,we,Ke,Ho,Cr,$r,qi(ac,b)].map(ne)}]];function Hi(t,n){const{coeffs:e,errBound:o}=ji[t.length-2][n.length-2](t,n);return{coeffs:e,errBound:o,getPExact:()=>Fi[t.length-2][n.length-2](t,n)}}const{abs:Yi}=Math;function Ri(t,n){if(0===n[0]&&0===n[1])return[0,0];if(0===n[0]&&1===n[1])return[0,0];const e=Yi(n[1]);if(4===t.length){const[[n,o],[r,c],[i,s],[u,f]]=t,l=Yi(n),a=Yi(o),p=Yi(r),h=Yi(c),d=Yi(i),v=Yi(s),g=l+(p+l)*e,m=p+(d+p)*e,x=g+(m+g)*e,w=a+(h+a)*e,b=h+(v+h)*e,_=w+(b+w)*e;return[x+(m+(d+(Yi(u)+d)*e+m)*e+x)*e,_+(b+(v+(Yi(f)+v)*e+b)*e+_)*e]}if(3===t.length){const[[n,o],[r,c],[i,s]]=t,u=Yi(n),f=Yi(o),l=Yi(r),a=Yi(c),p=u+(l+u)*e,h=f+(a+f)*e;return[p+(l+(Yi(i)+l)*e+p)*e,h+(a+(Yi(s)+a)*e+h)*e]}if(2===t.length){const[[n,o],[r,c]]=t,i=Yi(n),s=Yi(o);return[i+(Yi(r)+i)*e,s+(Yi(c)+s)*e]}if(1===t.length)return[0,0];throw new Error("The given bezier curve must be of order <= 3.")}const Xi=Number.EPSILON,Qi=Number.EPSILON/2,Vi=Qi*Qi,$i=function(){const t=1*Qi;return t/(1-t)}(),Ui=function(){const t=3*Vi;return t/(1-t)}(),{abs:Zi}=Math,Gi=[[0,0],[0,0]];const{min:Ji,max:Ki}=Math;function ts(t,n){return n[0]!==n[1]?4===t.length?function(t,n){const{ps:e,_ps:o}=On(t,n[0],n[1]),r=e[0][0],c=e[1][0],i=e[2][0],s=e[3][0],u=9*Qi*o[0][0],f=9*Qi*o[1][0],l=9*Qi*o[2][0],a=9*Qi*o[3][0],p=e[0][1],h=e[1][1],d=e[2][1],v=e[3][1],g=9*Qi*o[0][1],m=9*Qi*o[1][1],x=9*Qi*o[2][1],w=9*Qi*o[3][1],b=Ji(r-u,c-f,i-l,s-a),_=Ki(r+u,c+f,i+l,s+a);return[[b,Ji(p-g,h-m,d-x,v-w)],[_,Ki(p+g,h+m,d+x,v+w)]]}(t,n):3===t.length?function(t,n){const{ps:e,_ps:o}=ln(t,n[0],n[1]),r=e[0][0],c=e[1][0],i=e[2][0],s=5*Qi*o[0][0],u=5*Qi*o[1][0],f=5*Qi*o[2][0],l=e[0][1],a=e[1][1],p=e[2][1],h=5*Qi*o[0][1],d=5*Qi*o[1][1],v=5*Qi*o[2][1],g=Ji(r-s,c-u,i-f),m=Ki(r+s,c+u,i+f);return[[g,Ji(l-h,a-d,p-v)],[m,Ki(l+h,a+d,p+v)]]}(t,n):function(t,n){const{ps:e,_ps:o}=function(t,n,e){return 0===n?1===e?{ps:t,_ps:Gi}:function(t,n){const e=t[0],o=t[1],r=e[0],c=e[1],i=o[0],s=o[1],u=[[r,c],[n*(i-r)+r,n*(s-c)+c]],f=Zi(n),l=Zi(r),a=Zi(i),p=Zi(c);return{ps:u,_ps:[[0,0],[f*(a+l)+l,f*(Zi(s)+p)+p]]}}(t,e):1===e?function(t,n){const e=t[0],o=t[1],r=e[0],c=e[1],i=o[0],s=o[1],u=[[n*(i-r)+r,n*(s-c)+c],[i,s]],f=Zi(n),l=Zi(r),a=Zi(i),p=Zi(c);return{ps:u,_ps:[[f*(a+l)+l,f*(Zi(s)+p)+p],[0,0]]}}(t,n):function(t,n,e){const o=t[0],r=t[1],c=o[0],i=o[1],s=r[0],u=r[1],f=[[n*(s-c)+c,n*(u-i)+i],[e*(s-c)+c,e*(u-i)+i]],l=Zi(n),a=Zi(e),p=Zi(c),h=Zi(s),d=Zi(i),v=Zi(u);return{ps:f,_ps:[[l*(h+p)+p,l*(v+d)+d],[a*(h+p)+p,a*(v+d)+d]]}}(t,n,e)}(t,n[0],n[1]),r=e[0][0],c=e[1][0],i=3*Qi*o[0][0],s=3*Qi*o[1][0],u=e[0][1],f=e[1][1],l=3*Qi*o[0][1],a=3*Qi*o[1][1],p=Ji(r-i,c-s),h=Ki(r+i,c+s);return[[p,Ji(u-l,f-a)],[h,Ki(u+l,f+a)]]}(t,n):function(t,n){const e=t[0],o=t[t.length-1];if(0===n)return[e,e];if(1===n)return[o,o];const r=Ke(t,n);let c;if(4===t.length)c=Ri(t,[0,n]).map(t=>8*$i*t);else if(3===t.length)c=Ri(t,[0,n]).map(t=>5*$i*t);else if(2===t.length)c=Ri(t,[0,n]).map(t=>2*$i*t);else if(1===t.length)return[r,r];return[[r[0]-c[0],r[1]-c[1]],[r[0]+c[0],r[1]+c[1]]]}(t,n[0])}const ns=134217729;function es(t,n){const e=t[0],o=t[1],r=n[0],c=n[1],i=o/c,s=c*i,u=ns*c,f=u-(u-c),l=c-f,a=ns*i,p=a-(a-i),h=i-p,d=r*i,v=s+d,g=d-(v-s)+(l*h-(s-f*p-l*p-f*h)),m=v+g,x=(o-m+(e-(g-(m-v))))/c,w=i+x;return[x-(w-i),w]}const os=es,rs=Number.EPSILON/2,cs=rs*rs,{abs:is}=Math,ss=[0,1],us=dn,fs=Eo,ls=hn,as=le,ps=ie,hs=fr,ds=function(t,n,e,o){const r=t[0],c=t[1],i=n[0],s=n[1],u=os(t,n),f=Math.abs(r+c),l=Math.abs(i+s),a=l-rs*l-o;return a<=0?{est:u,err:Number.POSITIVE_INFINITY}:{est:u,err:(l*e+f*o)/a**2+9*cs*Math.abs(f/l)}},vs=Ho,gs=Ro;const ms=qo,xs=Eo,{min:ws,max:bs}=Math;function _s(t,n,e,o){const{ps:r}=t,c=Hi(n,r);if(void 0===c)return;const{coeffs:i,errBound:s,getPExact:u}=c,f=et(u),l=Je(i,e[0],e[1],s,f);if(void 0===l||0===l.length)return;const a=l[0],p=function(t,n,e){const o=ts(t,[e.tS,e.tE]),r=n[0],c=n[n.length-1],i=c[0]-r[0],s=c[1]-r[1],[[u,f],[l,a]]=o,p=0===s,h=p?r[0]:r[1],d=p?i:s,v=((p?u:f)-h)/d,g=((p?l:a)-h)/d;let m=ws(v,g)*(1-$n),x=bs(v,g)*(1+$n);return{multiplicity:1,t:(m+x)/2,tS:m,tE:x}}(r,n,a);return{xPs:{compensated:void 0,ri:a,getPExact:f,kind:1,p:void 0,curve:t},riSide:p,sideIdx:o,ps:r}}const Ms=et(function(t,n,e,o){const r=t.x.curve,c=t.x.ri.tS,i=e?t.next:t.prev,s=e?1:0,u=r===i.x.curve&&(e?c<i.x.ri.tS:c>i.x.ri.tS)?i.x.ri.tS:s;let f;for(let t=0;t<o.length;t++){const e=o[t],i=_s(r,n[e],c<u?[c,u]:[u,c],e);void 0!==i&&(f=i)}return f});function Ss(t){const n=(t=ne(t)).length;return 2===n?t:n<=1?[0,t[0]]:[t[n-2],t[n-1]]}const{abs:Cs,min:ys,max:Os,log2:Es,ceil:Is}=Math;function Ns(t,n){const{tS:e,tE:o}=t,r=o-e;if(0===r)return[{tS:[0,e],tE:[0,e],multiplicity:t.multiplicity}];const c=2**Is(Es(r)),i=function(t,n,e){return he(pe(t,e),n)}(n,c,e),s=i.map(Ss),u=s.map(t=>t[1]*$n**2),f=Je(s,0,1,u,()=>i),l=[];for(const t of f)l.push({tS:Et(e,t.tS*c),tE:Et(e,t.tE*c),multiplicity:t.multiplicity});return l}function ks(t,n){let e;const{_x_:o,dir:r,idx:c,swapped:i}=t,{_x_:s,dir:u,idx:f,swapped:l}=n,a=Ts(o.container.bigBox),p=1===r!=!!i,h=1===u!=!!l,d=t.oSideIdxs??Lo(t,o,a,p),v=n.oSideIdxs??Lo(n,s,a,h);if(1===d.length&&1===v.length&&(t.oSideIdx=t.oSideIdx??d[0],n.oSideIdx=n.oSideIdx??v[0],e=d[0]-v[0],0!==e))return e;const g=t.oFSC??Ms(o,a,p,d),m=n.oFSC??Ms(s,a,h,v),{sideIdx:x,riSide:w}=g,{sideIdx:b,riSide:_}=m;if(e=x-b,0!==e)return t.oSideIdx=x,n.oSideIdx=b,e;if(e=function(t,n){return t.tS<=n.tE&&n.tS<=t.tE}(w,_)?0:w.tS<_.tS?-1:1,0!==e)return e;const M=t.oFSCE??Bs(g,a),S=n.oFSCE??Bs(m,a);return e=function(t,n){return yo(t.tS,n.tE)<=0&&yo(n.tS,t.tE)<=0}(M,S)?0:yo(M.tS,S.tS),0!==e?e:(e=r-u,0!==e?e:1===r?c-f:f-c)}const Ps=et(Ns),Bs=et(function(t,n){const{xPs:e,ps:o,sideIdx:r}=t,{ri:c,getPExact:i}=e,s=Ps(c,i())[0];return function(t,n,e){const o=function(t,n){return n[0][0]!==n[1][0]||n[0][1]!==n[1][1]?4===t.length?function([[t,n],[e,o],[r,c],[i,s]],[u,f]){const l=us(f,u),a=3*Vi*is(l[1]),p=us(ss,u),h=3*Vi*is(p[1]),d=ds(l,p,a,h);f=fs(d.est,d.err);const v=us(ss,u),g=as(u,u),m=as(u,v),x=as(v,v),w=as(g,u),b=as(g,v),_=as(x,u),M=as(x,v),S=us(ss,f),C=as(f,f),y=as(f,S),O=as(S,S),E=as(C,f),I=as(C,S),N=as(O,f),k=as(O,S),P=is(u[1]),B=is(v[1]),T=is(g[1]),A=is(m[1]),z=is(x[1]),D=is(w[1]),L=is(b[1]),q=is(_[1]),W=is(M[1]),j=is(f[1]),F=is(S[1]),H=is(C[1]),Y=is(y[1]),R=is(O[1]),X=is(E[1]),Q=is(I[1]),V=is(N[1]),$=is(k[1]);let U=is(t),Z=is(n),G=is(e),J=is(o),K=is(r),tt=is(c),nt=is(i),et=is(s);const ot=ls(ps(i,u),ps(r,v)),rt=ls(ls(ps(i,g),ps(2*r,m)),ps(e,x)),ct=ls(ls(ps(i,w),ps(t,M)),ps(3,ls(ps(r,b),ps(e,_)))),it=ls(as(rt,f),as(ct,S)),st=ls(ls(as(ot,C),as(ct,O)),as(hs(rt),y)),ut=ls(ls(ps(i,E),as(ct,k)),ps(3,ls(as(ot,I),as(rt,N)))),ft=is(ct[1]),lt=nt*P+K*B,at=nt*T+2*K*A+G*z;U=nt*D+U*W+3*(K*L+G*q),G=at*j+ft*F,K=lt*H+ft*R+2*at*Y,nt=nt*X+ft*$+3*(lt*Q+at*V),U*=11*Vi,G*=15*Vi,K*=20*Vi,nt*=22*Vi;const pt=ls(ps(s,u),ps(c,v)),ht=ls(ls(ps(s,g),ps(2*c,m)),ps(o,x)),dt=ls(ls(ps(s,w),ps(n,M)),ps(3,ls(ps(c,b),ps(o,_)))),vt=ls(as(ht,f),as(dt,S)),gt=ls(ls(as(pt,C),as(dt,O)),as(hs(ht),y)),mt=ls(ls(ps(s,E),as(dt,k)),ps(3,ls(as(pt,I),as(ht,N)))),xt=is(dt[1]),wt=et*P+tt*B,bt=et*T+2*tt*A+J*z;Z=et*D+Z*W+3*(tt*L+J*q),J=bt*j+xt*F,tt=wt*H+xt*R+2*bt*Y,et=et*X+xt*$+3*(wt*Q+bt*V),Z*=11*Vi,J*=15*Vi,tt*=20*Vi,et*=22*Vi;const _t=vs(vs(fs(ct,-U),fs(it,-G)),vs(fs(st,-K),fs(ut,-nt))),Mt=gs(gs(fs(ct,+U),fs(it,+G)),gs(fs(st,+K),fs(ut,+nt)));return[[_t,vs(vs(fs(dt,-Z),fs(vt,-J)),vs(fs(gt,-tt),fs(mt,-et)))],[Mt,gs(gs(fs(dt,+Z),fs(vt,+J)),gs(fs(gt,+tt),fs(mt,+et)))]]}(t,n):3===t.length?function([[t,n],[e,o],[r,c]],[i,s]){const u=us(s,i),f=3*Vi*is(u[1]),l=us(ss,i),a=3*Vi*is(l[1]),p=ds(u,l,f,a);s=fs(p.est,p.err);const h=us(ss,i),d=as(i,i),v=as(i,h),g=as(h,h),m=us(ss,s),x=as(s,s),w=as(s,m),b=as(m,m),_=is(i[1]),M=is(h[1]),S=is(d[1]),C=is(v[1]),y=is(g[1]),O=is(s[1]),E=is(m[1]),I=is(x[1]),N=is(w[1]),k=is(b[1]);let P=is(t),B=is(n),T=is(e),A=is(o),z=is(r),D=is(c);const L=ls(ls(ps(r,d),ps(2*e,v)),ps(t,g)),q=ls(ps(r,i),ps(e,h)),W=L,j=ls(as(s,q),as(m,L)),F=ls(ls(ps(r,x),as(hs(w),q)),as(b,L)),H=z*S+2*T*C+P*y,Y=z*_+T*M;P=H,T=O*Y+E*H,z=I*r+2*N*Y+k*H,P*=7*Vi,T*=11*Vi,z*=14*Vi;const R=ls(ls(ps(c,d),ps(2*o,v)),ps(n,g)),X=ls(ps(c,i),ps(o,h)),Q=R,V=ls(as(s,X),as(m,R)),$=ls(ls(ps(c,x),as(hs(w),X)),as(b,R)),U=D*S+2*A*C+B*y,Z=D*_+A*M;B=U,A=O*Z+E*U,D=I*c+2*N*Z+k*U,B*=7*Vi,A*=11*Vi,D*=14*Vi;const G=vs(vs(fs(W,-P),fs(j,-T)),fs(F,-z)),J=gs(gs(fs(W,+P),fs(j,+T)),fs(F,+z));return[[G,vs(vs(fs(Q,-B),fs(V,-A)),fs($,-D))],[J,gs(gs(fs(Q,+B),fs(V,+A)),fs($,+D))]]}(t,n):function([[t,n],[e,o]],[r,c]){const i=us(c,r),s=3*Vi*is(i[1]),u=us(ss,r),f=3*Vi*is(u[1]),l=ds(i,u,s,f);c=fs(l.est,l.err);const a=us(ss,r),p=us(ss,c),h=is(r[1]),d=is(a[1]),v=is(c[1]),g=is(p[1]);let m=is(t),x=is(n),w=is(e),b=is(o);const _=ls(ps(e,r),ps(t,a)),M=ls(ps(e,c),as(_,p));m=w*h+m*d,w=w*v+m*g,m*=3*Qi,w*=7*Qi;const S=ls(ps(o,r),ps(n,a)),C=ls(ps(o,c),as(S,p));x=b*h+x*d,b=b*v+x*g,x*=3*Qi,b*=7*Qi;const y=vs(fs(_,-m),fs(M,-w)),O=gs(fs(_,+m),fs(M,+w));return[[y,vs(fs(S,-x),fs(C,-b))],[O,gs(fs(S,+x),fs(C,+b))]]}(t,n):function(t,n){const e=t[0],o=t[t.length-1];if(0===n[0]&&0===n[1]){const t=[0,e[0]],n=[0,e[1]];return[[t,n],[t,n]]}if(0===n[0]&&1===n[1]){const t=[0,o[0]],n=[0,o[1]];return[[t,n],[t,n]]}const r=To(t,n);let c;if(4===t.length)c=Ri(t,n).map(t=>16*Ui*t);else if(3===t.length)c=Ri(t,n).map(t=>10*Ui*t);else if(2===t.length)c=Ri(t,n).map(t=>4*Ui*t);else if(1===t.length)return[r,r];return[[fs(r[0],-c[0]),fs(r[1],-c[1])],[fs(r[0],+c[0]),fs(r[1],+c[1])]]}(t,n[0])}(t,[e.tS,e.tE]),r=n[0],c=n[n.length-1],i=c[0]-r[0],s=c[1]-r[1],[[u,f],[l,a]]=o,p=0===s,h=p?r[0]:r[1],d=p?i:s,v=p?l:a,g=jo(ms(p?u:f,h),d),m=jo(ms(v,h),d);return{tS:ms(Ho(g,m),6*Zn),tE:xs(Ro(g,m),6*Zn),multiplicity:1}}(o,n[r],s)}),Ts=et(function(t){const[[n,e],[o,r]]=t;return[[[o,e],[n,e]],[[n,e],[n,r]],[[n,r],[o,r]],[[o,r],[o,e]]]});function As(t){for(let n of t)if(0===n.x.kind)return!0;return!1}const zs=So(function(t){const{inOuts:n,xs:e}=t;(n.length>2||As(t.xs))&&n.sort(ks);let o=n[n.length-1];for(let t=0;t<n.length;t++){const e=n[t];e.prevAround=o,o.nextAround=e,o=e}}),{abs:Ds,min:Ls}=Math;function qs(t,n,e){let o=2**(t+1);const[r,c]=e;let i=-o,s=-o,u=+o,f=+o;for(const[[t,e],[o,l]]of n){let n=0,a=0;r<t?(n=1,a=t):r>o&&(n=-1,a=o);let p=0,h=0;c<e?(p=1,h=e):c>l&&(p=-1,h=l);let d=!1,v=!1;if(0!==n&&0===p)d=!0;else if(0!==p&&0===n)v=!0;else if(0!==n&&0!==p){const t=Ds(a-r),n=Ds(h-c);d=t>=n,v=n>=t}d&&(n>0?a<u&&(u=a):a>i&&(i=a)),v&&(p>0?h<f&&(f=h):h>s&&(s=h))}const l=.5;return[[r+(i-r)*l,c+(s-c)*l],[r+(u-r)*l,c+(f-c)*l]]}const Ws=So(function(t,n){for(const e of t){const[[t,o],[r,c]]=e.box,i=[(t+r)/2,(o+c)/2],s=qs(n,[...e.xs.map(t=>t.next.container.box),...e.xs.map(t=>t.prev.container.box)],i);e.bigBox=s}return t});function js(t,n,e=t=>void 0!==t){const o=[];for(let r=0;r<t.length;r++){const c=t[r],i=[];for(let t=0;t<c.length;t++)e(n(c[t]))&&i.push(n(c[t]));o.push(i)}return o}function Fs(t){let n=t[t.length-1];for(let e=0;e<t.length;e++){const o=t[e];o.prevAround=n,n.nextAround=o,n=o}}const Hs=So(function(t,n,e){const o=js(t,t=>({x:t}));let r=function(t,n){const e=2**n;return t.map(t=>{const{p:n}=t[0].x;return{xs:t,box:[[n[0]-e,n[1]-e],[n[0]+e,n[1]+e]]}})}(o,e);r=Co(r),r=function(t,n){const e=2**(n-1),o=t=>fo(t/e)*e,r=t=>lo(t/e)*e;return t.map(t=>{const{xs:n,box:e}=t,[c,i]=e;return{xs:n,box:[c.map(o),i.map(r)]}})}(r,e),function(t){for(const n of t)for(const t of n.xs)t.container=n}(r),function(t){const n=[];for(const e of t)for(const t of e){const{idx:e}=t.x.curve.loop;(n[e]??=[]).push(t)}for(const t of n){if(void 0===t||0===t.length)continue;t.sort(uo);const n=t.length;for(let e=0;e<n;e++){const o=t[e],{container:r}=o;let c=(e+1)%n;for(;c!==e&&t[c].container===r;)c=(c+1)%n;let i=(e-1+n)%n;for(;i!==e&&t[i].container===r;)i=(i-1+n)%n;let s=o;s.next=t[c],s.prev=t[i],t[(e-1+n)%n].container!==r&&(s.in_={dir:-1,_x_:o,loop:o.x.curve.loop.beziers}),t[(e+1)%n].container!==r&&(s.out={dir:1,_x_:o,loop:o.x.curve.loop.beziers})}}}(o);for(const t of r){const n=[];for(const e of t.xs)e.in_&&n.push(e.in_),e.out&&n.push(e.out);t.inOuts=n;for(const e of n)e.container=t}const c=Ws(r,n);return function(t){let n=0;for(const e of t)for(const t of e.inOuts)t.idx=++n}(c),function(t){for(const n of t)for(const t of n.inOuts)if(1===t.dir){const n=t;let{_x_:e}=n;e=e.next,n.twin=e.in_,n.idx=n.twin.idx}else{const n=t;let{_x_:e}=n;e=e.prev,n.twin=e.out,n.idx=n.twin.idx}}(c),c.forEach(zs),c.forEach(t=>Fs(t.inOuts)),r});function Ys(t,n,e){const o=(t[0]-e[0])*(n[1]-e[1]),r=(t[1]-e[1])*(n[0]-e[0]),c=o-r;let i;if(o>0){if(r<=0)return c;i=o+r}else{if(!(o<0))return c;if(r>=0)return c;i=-o-r}return Math.abs(c)>=3330669073875472e-31*i?c:function(t,n,e,o){const r=t[0]-e[0],c=n[0]-e[0],i=t[1]-e[1],s=n[1]-e[1],u=Mt(me(r,s),me(i,c));let f=bt(u);if(Math.abs(f)>=2220446049250315e-31*o)return f;const l=dt(t[0],e[0])[0],a=dt(n[0],e[0])[0],p=dt(t[1],e[1])[0],h=dt(n[1],e[1])[0];if(0===l&&0===p&&0===a&&0===h)return f;const d=1109335647967049e-46*o+3330669073875471e-31*Math.abs(f);if(f+=r*h+s*l-(i*a+c*p),Math.abs(f)>=d)return f;const v=vt(u,Mt(me(l,s),me(p,c))),g=vt(v,Mt(me(r,h),me(i,a)));let m=vt(g,Mt(me(l,h),me(p,a)));return m=ne(m),m[m.length-1]}(t,n,e,i)}function Rs(t){if(4===t.length)return 0===Ys(t[0],t[1],t[2])&&0===Ys(t[1],t[2],t[3])&&0===Ys(t[0],t[2],t[3]);if(3===t.length)return 0===Ys(t[0],t[1],t[2]);if(t.length<=2)return!0;throw new Error("The given bezier curve must be of order <= 3.")}function Xs(t){if(!Rs(t))return!1;const n=t.map(t=>t[0]),e=t.map(t=>t[1]);return!(Qs(n)&&Qs(e))}function Qs(t){return function(t){for(let n=1;n<t.length;n++)if(t[n-1]>t[n])return!1;return!0}(t)||function(t){for(let n=1;n<t.length;n++)if(t[n-1]<t[n])return!1;return!0}(t)}function Vs(t,n){const e=(2**(53-n)+1)*t;return e-(e-t)}const{floor:$s,log2:Us,abs:Zs}=Math;function Gs(t,n){const e=n[0]-t[0],o=n[1]-t[1];return e*e+o*o}function Js(t,n){const e=n/Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[e*t[0],e*t[1]]}function Ks(t){const n=t[0][0],e=t[0][1];for(let o=1;o<t.length;o++)if(n!==t[o][0]||e!==t[o][1])return!1;return!0}const tu=me,nu=vt,{abs:eu}=Math;function ou(t){const[[n,e],[o,r],[c,i],[s,u]]=t,f=s+3*o,l=n+3*c,a=f-l,p=eu(3*o)+eu(f)+(eu(3*c)+eu(l))+eu(a);if(eu(a)-Qi*p>0)return!1;const h=u+3*r,d=e+3*i,v=h-d,g=eu(3*r)+eu(h)+(eu(3*i)+eu(d))+eu(v);return!(eu(v)-Qi*g>0)&&0===St(Mt(nu([s],tu(3,o)),nu([n],tu(3,c))))&&0===St(Mt(nu([u],tu(3,r)),nu([e],tu(3,i))))}function ru(t){for(let n=0;n<t.length-1;n++)for(let e=n+1;e<t.length;e++)if(t[n][0]===t[e][0]&&t[n][1]===t[e][1])return!1;return!0}const{abs:cu}=Math;function iu(t,n,e){if(void 0!==t&&!Ks(t)){if(2===t.length)return t;if(3===t.length){if(ru(t))return Rs(t)?[t[0],t[2]]:t;if(uu(t[0],t[2]))return;return[t[0],t[2]]}if(ru(t)){const o=su(t);if(void 0===o)return;return function(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e][0]!==n[e][0]||t[e][1]!==n[e][1])return!1;return!0}(o,t)?t:iu(o,n,e)}if(uu(t[0],t[3])){if(Rs(t))return;return t}if(Rs(t))return[t[0],t[3]];if(uu(t[0],t[1])&&uu(t[1],t[2])||uu(t[1],t[2])&&uu(t[2],t[3])||uu(t[0],t[1])&&uu(t[2],t[3]))return iu([t[0],t[t.length-1]],n,e);if(uu(t[0],t[2])||uu(t[1],t[3])||uu(t[1],t[2]))return t;if(uu(t[0],t[1])){if(Gs(t[1],t[2])<4*n)return[t[0],t[2],t[2],t[3]];{const o=Js(rt(t[1],t[2]),2*n),r=ft(t[1],o);return su([t[0],e(r),t[2],t[3]])}}if(uu(t[2],t[3])){if(Gs(t[2],t[1])<4*n)return[t[0],t[1],t[1],t[3]];{const o=Js(rt(t[2],t[1]),2*n),r=ft(t[2],o);return su([t[0],t[1],e(r),t[3]])}}}}function su(t){return Rs(t)?[t[0],t[3]]:ou(t)?Uc(t):t}function uu(t,n){return t[0]===n[0]&&t[1]===n[1]}function fu(t){return t}function lu(t){const n=function(t){const n=t[0],e=t[t.length-1];let o,r;if(n[0]<e[0]?(o={ts:[0,0],box:[n,n]},r={ts:[1,1],box:[e,e]}):(o={ts:[1,1],box:[e,e]},r={ts:[0,0],box:[n,n]}),2===t.length)return{minX:o,maxX:r};const[c]=pt(t),i=Je(c,0,1)||[];for(let n=0;n<i.length;n++){const e=i[n],c=[e.tS,e.tE],s=ts(t,c);s[0][0]<o.box[0][0]&&(o={ts:c,box:s}),s[1][0]>r.box[0][0]&&(r={ts:c,box:s})}return{minX:o,maxX:r}}(t),e=function(t){const n=t[0],e=t[t.length-1];let o,r;if(n[1]<e[1]?(o={ts:[0,0],box:[n,n]},r={ts:[1,1],box:[e,e]}):(o={ts:[1,1],box:[e,e]},r={ts:[0,0],box:[n,n]}),2===t.length)return{minY:o,maxY:r};const[,c]=pt(t),i=Je(c,0,1)||[];for(let n=0;n<i.length;n++){const e=i[n],c=[e.tS,e.tE],s=ts(t,c);s[0][1]<o.box[0][1]&&(o={ts:c,box:s}),s[1][1]>r.box[0][1]&&(r={ts:c,box:s})}return{minY:o,maxY:r}}(t);return[[n.minX.box[0][0],e.minY.box[0][1]],[n.maxX.box[1][0],e.maxY.box[1][1]]]}function au(t){let n=0;for(let e=0;e<t.length-1;e++)n+=nn(t[e],t[e+1]);return n}const{sqrt:pu}=Math;function hu(t){const[n,e]=t[0],[o,c]=t[t.length-1];let i,s;const u=au(t);if(256*Gs(t[0],t[t.length-1])<u*u){const[o,r]=Ke(t,.5),c=pu((o-n)*(o-n)+(r-e)*(r-e));i=(r-e)/c,s=(o-n)/c}else{const t=pu((o-n)*(o-n)+(c-e)*(c-e));i=(c-e)/t,s=(o-n)/t}const f=function(t,n,e){const o=ft(t[0].map(t=>-t));return lu(t.map(t=>r(-n,e,o(t))))}(t,i,s),[[l,a],[p,h]]=f,d=[f[0],[p,a],f[1],[l,h]],v=r(i,s);return d.map(n=>ft(t[0],v(n)))}function du(t,n,e){const o=n[0]-t[0],r=n[1]-t[1];return o*(e[0]-n[0])+r*(e[1]-n[1])}const vu=function(t,n){if(0===t.length)return;const e=t.slice(),o=function(t){let n,e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let o=0;o<t.length;o++){const r=t[o][1];(r<e[1]||r===e[1]&&t[o][0]<e[0])&&(n=o,e=t[o])}return n}(e),[r]=e.splice(o,1);e.sort((t,n)=>{let e=-Ys(r,t,n);return 0!==e?e:(e=t[1]-n[1],0!==e?e:t[0]-n[0])}),e.unshift(r);const c=function(t){const n=[t[0]],e=t.length;for(let o=1;o<t.length;o++){const r=t[(o+e-1)%e],c=t[o];r[0]===c[0]&&r[1]===c[1]||n.push(c)}return n}(e),i=[];for(const t of c){for(;i.length>=2&&Ys(i[i.length-2],i[i.length-1],t)<0;)i.pop();i.push(t)}if(n||i.length<3)return i;const s=[];{const t=i.length;for(let n=0;n<t;n++){const e=(n+1)%t,o=i[(n+t-1)%t],r=i[n],c=i[e];(0!==Ys(o,r,c)||du(o,r,c)<0)&&s.push(r)}}return s},gu=et(lu),mu=So(function(t,n){const e=t.slice().map(function(t,n,e=!0){const o=2**(t-n),r=e?function(t,n){const e=function(t,n){return function(e){const o=$s(Us(Zs(e))),r=n-t+o+1;return r<=0?0:n>=53?e:Vs(e,r)}}(t,n);return function(t){const n=e(t[0]),o=e(t[1]);return n===t[0]&&o===t[1]?t:[n,o]}}(t,n):fu;return t=>{const n=[];for(let e=0;e<t.length;e++){let c=t[e].slice();const i=n[n.length-1],s=i?i[i.length-1]:r(t[0][0]);c[0]=s,c=c.map(t=>r(t)),Xs(c)&&(c=[c[0],c[c.length-1]]),c=iu(c,o,r),void 0!==c&&n.push(c)}const e=n.length;if(!e)return[];const c=n[e-1];return c[c.length-1]=n[0][0],n}}(n,46)).filter(t=>t.length>0);return"undefined"!=typeof _debug_&&(_debug_.timing.normalize=performance.now()-_debug_.timing.timingStart),function(t){if("undefined"!=typeof _debug_)for(const n of t){_debug_.elems.loopPre.push(...t),_debug_.elems.loopsPre.push(t);for(const t of n){const n=gu(t),e=hu(t),o=vu(t,!1);_debug_.elems.bezier_.push(t),_debug_.elems.looseBoundingBox_.push(n),_debug_.elems.tightBoundingBox_.push(e),_debug_.elems.boundingHull_.push(o)}}}(e),e}),{max:xu,abs:wu}=Math;function bu(t,n){return t[1]>n[1]||!(t[1]<n[1])&&t[0]>=n[0]}function _u(t){const{ps:n,ts:e}=t;return U(n,e[0],e[1])}const{min:Mu,max:Su}=Math,Cu=et(function(t){const n=t.map(no);return{minX:Mu(...n.map(t=>t.box[0][0])),maxX:Su(...n.map(t=>t.box[1][0])),minY:Mu(...n.map(t=>t.box[0][1])),maxY:Su(...n.map(t=>t.box[1][1]))}});function yu(t,n){let e=0,o=t.length;for(;e<o;){const r=e+o>>>1;t[r]<n?e=r+1:o=r}return e}const Ou=et(function(t){const n=new Set,e=new Array(t.length);for(let o=0;o<t.length;o++){const{ps:r}=t[o],[[,c],[,i]]=gu(r);e[o]=[c,i],n.add(c),n.add(i)}const o=Array.from(n).sort((t,n)=>t-n),r=0===o.length?0:2*o.length-1,c=new Array(r);for(let t=0;t<r;t++)c[t]=[];for(let n=0;n<t.length;n++){const[r,i]=e[n],s=2*yu(o,r),u=2*yu(o,i);for(let e=s;e<=u;e++){const o=t[n];c[e].push(o)}}return{ys:o,slabs:c}}),{sign:Eu}=Math;function Iu(t,n){const e=0===n?t:t.toReversed(),o=[e[0]?.[1],e[1]?.[1],e[2]?.[1],e[3]?.[1]];let r,c;return r=o[1],c=Eu(r),0!==c?c:(r=o[2],void 0===r?0:(c=Eu(r),0!==c?c:(r=o[3],void 0===r?0:Eu(r))))}function Nu(t,n,e){return 0===e?0===n?function(t){return 4===t.length?function(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[u-e+3*(r-i),3*(i+e-2*r),3*(r-e),e]}(t):3===t.length?function(t){const[[n,e],[o,r],[c,i]]=t;return[i+e-2*r,2*(r-e),e]}(t):function(t){const[[n,e],[o,r]]=t;return[r-e,e]}(t)}(t):1===n?function(t){const n=t[1][1];if(2===t.length)return[n];const e=t[2][1];return 3===t.length?[e-2*n,2*n]:[t[3][1]+3*(n-e),3*(e-2*n),3*n]}(t):2===n?function(t){if(2===t.length)return[];const n=t[2][1];return 3===t.length?[n]:[t[3][1]-3*n,3*n]}(t):function(t){return t.length<=3?[]:[t[3][1]]}(t):0===n?1===e?function(t){const n=t[0][1];if(2===t.length)return[-n];const e=t[1][1];return 3===t.length?[-2*e+n,-n]:[3*(e-t[2][1])-n,-3*e+2*n,-n]}(t):2===e?function(t){if(2===t.length)return[];const n=t[0][1];return 3===t.length?[n]:[3*t[1][1]-n,n]}(t):function(t){return t.length<=3?[]:[-t[0][1]]}(t):1===n&&1===e?function(t){if(2===t.length)return[];const n=t[1][1];return 3===t.length?[-2*n]:[3*(n-t[2][1]),-3*n]}(t):2===n&&1===e?function(t){return t.length<=3?[]:[-3*t[2][1]]}(t):1===n&&2===e?function(t){return t.length<=3?[]:[3*t[1][1]]}(t):[]}const ku=So(function(t,n,e){if(function(t,n){const e=Cu(t),o=Cu(n);return e.minX<o.minX||e.maxX>o.maxX||e.minY<o.minY||e.maxY>o.maxY}(n,Tu(e)))return!1;for(const o of function*(){yield 0;for(let t=1;t<=30;t++){const n=2**t;for(let t=1;t<n;t+=2)yield t/n}}())for(const r of n){const n=Pu(t,Ao(r,o),e);if(void 0!==n)return n}throw new Error("_isLoopInLoop: no non-degenerate ray-start point found")});function Pu(t,n,e){const o=Bu(t,e,n);if(void 0!==o)return o%2!=0}const Bu=So(function(t,n,e){const[o,r]=e,c=function(t,n){if(t.length<10){const e=[];for(let o=0;o<t.length;o++){const r=t[o],{ps:c}=r,[[,i],[,s]]=gu(c);i<=n&&s>=n&&e.push(r)}return e}const e=Ou(t),{ys:o,slabs:r}=e;if(0===o.length||n<o[0]||n>o[o.length-1])return[];const c=yu(o,n);return r[o[c]===n?2*c:2*c-1]}(n,r);let i=0;for(let n=0;n<c.length;n++){const u=c[n],{ps:f,ts:l}=u;if(gu(f)[0][0]>o)continue;const a=f.map(ft([0,-r])),p=a.length;let h=0;for(;h<p-1&&0===a[h][1];)h++;let d=0;for(;d<p-1&&0===a[p-1-d][1];)d++;const v=Nu(a,h,d),g=Math.min(l[0],l[1]),m=Math.max(l[0],l[1]);if(h>0&&g<=0){const t=Iu(a,0)>0,n=e[0]>=a[0][0];t&&n&&i++}if(d>0&&m>=1){const t=Iu(a,1)>0,n=e[0]>=a[a.length-1][0];t&&n&&i++}const x=Je(v,s(g-2*$n,0,1),s(m+2*$n,0,1));if(void 0!==x&&0!==x.length)for(const n of x){const{t:o,multiplicity:r}=n;if(0!==g&&Math.abs(o-g)<=4*$n||1!==m&&Math.abs(o-m)<=4*$n)return;const c=Ao(a,o)[0],s=24*2**t*(4*$n),u=c-s,f=c+s,l=e[0]>u,p=l===e[0]>f;if(p)p&&l&&(i+=r%2);else{const t=Ns(n,v.map(t=>[t]));for(let n=0;n<t.length;n++){const{tS:o,tE:r,multiplicity:c}=t[n],s=To(a,Sr(hn(o,r)))[0];bu([0,e[0]],s)&&(i+=c%2)}}}}return i}),Tu=et(function(t){return t.map(_u)});function Au(t){const n=t._x_,e=t.twin._x_,o=n.x.curve,r=n.x.ri.t,c=e.x.curve,i=e.x.ri.t;let s=o,u=r;const f=[];for(;;){if(s===c&&(u<i||u===i&&0!==f.length)){const t=s.ps,n=[u,i];return f.push({ps:t,ts:n}),f}{const t=s.ps,n=[u,1];f.push({ps:t,ts:n})}u=0,s=s.next}}const zu=et(function(t){const n=[];for(const e of t.path)if(e.swapped){const t=Au(e.twin);for(let e=t.length-1;e>=0;e--){const{ps:o,ts:r}=t[e];n.push({ps:o,ts:[r[1],r[0]]})}}else n.push(...Au(e));return n});function Du(t,n,e){let o=n;const r=Array.from(n.children);for(;r.length;)c(r.pop());return o;function c(n){const c=zu(n);if(ku(t,e,c)){o=n;for(const t of n.children)r.push(t)}}}const Lu=So(function(t,n,e){const o=[],r=[];let c=e;const i=function(t,n,e){const o=function(t,n){return function(e,o,r){if(t.has(e))return;const c=e;void 0===c.orientation&&(c.orientation=o,c.parent=r,c.windingNum=r.windingNum+c.orientation,n.push(c))}}(e,n);return function(n){let e,r=n.twin,c=1,i=r;for(;i=1===t.orientation?i.nextAround:i.prevAround,i!==r;){if(c-=i.dir,-1===i.dir)continue;const n=i;e?0===c?o(n,t.orientation,t.parent):-1===c&&o(n,-t.orientation,t.parent):0===c?e=n:1===c&&o(n,t.orientation,t)}return e}}(e,o,t);do{t.add(c),n.add(c.container),r.push(c),c=i(c)}while(c!==e);return e.path=r,o});function qu(t,n,e){const o=[t];for(;o.length;){const t=o.pop();if(n.has(t))continue;t.children=new Set;const r=Lu(n,e,t);t.parent.children=t.parent.children||new Set,t.parent.children.add(t),o.push(...r)}}const Wu=So(function(t,n){const e={dir:void 0,idx:0,parent:void 0,children:new Set,windingNum:0,_x_:void 0,orientation:0,twin:void 0,path:void 0,nextAround:void 0,prevAround:void 0,loop:void 0,container:void 0},o=new Set,r=new Set;for(let c=0;c<n.length;c++){const i=n[c];if(r.has(i)||0===i.inOuts.length)continue;const{inOuts:s}=i,u=s[0],f=s[s.length-1],l=1===u.dir?u:f,a=Du(t,e,l.loop);l.parent=a,l.orientation=f.dir,l.windingNum=a.windingNum+f.dir,l.children=new Set,qu(l,o,r)}return e});function ju(t){return{t,tS:t,tE:t,multiplicity:1}}function Fu(t){return(t.tS+t.tE)/2}const Hu=hn,Yu=wt,Ru=vt,Xu=le,{abs:Qu}=Math;const{abs:Vu}=Math;const{abs:$u}=Math,Uu=le,Zu=hn,Gu=wt,Ju=vt,{abs:Ku}=Math;function tf(t,n){const[e,o]=n,r=e.length,c=o.length,i=e[r-1],s=o[c-1],u=1===r&&1===c;{const{vₓₓ:n,vₓᵧ:e,vᵧᵧ:o,vₓ:r,vᵧ:c,v:f}=function(t){const[[n,e,o],[r,c,i]]=function(t){const[[n,e],[o,r],[c,i]]=t;return[[c+n-2*o,2*(o-n),n],[i+e-2*r,2*(r-e),e]]}(t),s=n*c-e*r,u=n*i-o*r;return{vₓₓ:-r*r,vₓᵧ:2*n*r,vᵧᵧ:-n*n,vₓ:c*s-2*r*u,vᵧ:2*n*u-e*s,v:s*(e*i-o*c)-u*u}}(t),{vₓₓ_:l,vₓᵧ_:a,vᵧᵧ_:p,vₓ_:h,vᵧ_:d,v_:v}=function(t){const[n,e]=t[0],[[o,r],[c,i]]=function(t){const[[n,e],[o,r],[c,i]]=t,s=Vu(n),u=Vu(o),f=Vu(c),l=Vu(e),a=Vu(r);return[[f+s+2*u,2*(u+s),0],[Vu(i)+l+2*a,2*(a+l),0]]}(t),s=$u(n),u=$u(e),f=o*i+r*c,l=o*u+s*c;return{vₓₓ_:c*c,vₓᵧ_:2*o*c,vᵧᵧ_:o*o,vₓ_:i*f+2*c*l,vᵧ_:2*o*l+r*f,v_:f*(r*u+s*i)+l*l}}(t),g=u?0:1,m=Ku(i),x=Ku(s);if((g+12)*$i*(l*(m*m)+a*(m*x)+p*(x*x)+(h*m+d*x)+v)<Ku(n*i*i+e*i*s+o*s*s+(r*i+c*s)+f))return!1}{const{coeffs:{vₓₓ:n,vₓᵧ:r,vᵧᵧ:c,vₓ:u,vᵧ:f,v:l},errorBound:{vₓₓ_:a,vₓᵧ_:p,vᵧᵧ_:h,vₓ_:d,vᵧ_:v,v_:g}}=gr(t),m=Ss(e),x=Ss(o),w=Ku(i),b=Ku(s),_=w/3,M=b/3,S=Uu(m,m),C=S[1],y=2*(w*_+C),O=Uu(x,x),E=O[1],I=2*(b*M+E),N=Uu(m,x),k=Ku(N[1]),P=w*M+_*b+2*k,B=Uu(n,S),T=Ku(n[1])*y+a*C+2*Ku(B[1]),A=Uu(r,N),z=Ku(r[1])*P+p*k+2*Ku(A[1]),D=Uu(c,O),L=Ku(c[1])*I+h*E+2*Ku(D[1]),q=Uu(m,u),W=Ku(u[1])*_+d*w+2*Ku(q[1]),j=Uu(x,f),F=Ku(f[1])*M+v*b+2*Ku(j[1]),H=Zu(B,A),Y=T+z+Ku(H[1]),R=Zu(H,D),X=Y+L+Ku(R[1]),Q=Zu(q,j),V=W+F+Ku(Q[1]),$=Zu(R,Q),U=X+V+Ku($[1]),Z=Zu($,l),G=U+g+Ku(Z[1]);if(Ui*G<Ku(bt(Z)))return!1}{const n=function(t){return qc(Sc(t))}(t);if(void 0===n)return u&&i===t[0][0]&&s===t[0][1];n.hasOwnProperty("vₓₓ")||(n.vₓₓ=[0],n.vₓᵧ=[0],n.vᵧᵧ=[0]);const{vₓₓ:r,vₓᵧ:c,vᵧᵧ:f,vₓ:l,vᵧ:a,v:p}=n;return 0===St(Ju(Ju(Ju(Gu(r,Gu(e,e)),Gu(c,Gu(e,o))),Gu(f,Gu(o,o))),Ju(Ju(Gu(e,l),Gu(o,a)),p)))}}const{abs:nf}=Math,ef=le,of=hn,rf=wt,cf=vt,{abs:sf}=Math;function uf(t,n){const[e,o]=n,r=e.length,c=o.length,i=e[r-1],s=o[c-1],u=1===r&&1===c;{const{vₓₓₓ:n,vₓₓᵧ:e,vₓᵧᵧ:o,vᵧᵧᵧ:r,vₓₓ:c,vₓᵧ:f,vᵧᵧ:l,vₓ:a,vᵧ:p,v:h}=function(t){const[[n,e,o,r],[c,i,s,u]]=function(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[s-n+3*(o-c),3*(c+n-2*o),3*(o-n),n],[u-e+3*(r-i),3*(i+e-2*r),3*(r-e),e]]}(t),f=n*s,l=o*c,a=n*i,p=e*c,h=n*n,d=c*c,v=n*u-r*c,g=f-l,m=a-p,x=e*u-r*i,w=e*s-o*i,b=o*u-r*s,_=2*g,M=v*v,S=v*w,C=_*x,y=m*x,O=-3*v-w,E=-3*M-2*S+(C+m*b),I=2*(v*g-y),N=v*m-g*g+m*w;return{vₓₓₓ:-c*d,vₓₓᵧ:3*n*d,vₓᵧᵧ:-3*c*h,vᵧᵧᵧ:n*h,vₓₓ:O*d+m*(s*c-i*i)+_*i*c,vₓᵧ:2*(m*(e*i-(l+f)/2)-(O*n*c+g*(p+a))),vᵧᵧ:O*h+m*(o*n-e*e)+_*e*n,vₓ:c*E+(i*I+s*N),vᵧ:-n*E-(e*I+o*N),v:v*(C-M-S)+(N*b-y*x)}}(t),{vₓₓₓ_:d,vₓₓᵧ_:v,vₓᵧᵧ_:g,vᵧᵧᵧ_:m,vₓₓ_:x,vₓᵧ_:w,vᵧᵧ_:b,vₓ_:_,vᵧ_:M,v_:S}=function(t){const[n,e]=t[0],[[o,r,c],[i,s,u]]=function(t){const[[n,e],[o,r],[c,i],[s,u]]=t,f=Vu(n),l=Vu(o),a=Vu(c),p=Vu(s),h=Vu(e),d=Vu(r),v=Vu(i);return[[p+f+3*(l+a),3*(a+f+2*l),3*(l+f),0],[Vu(u)+h+3*(d+v),3*(v+h+2*d),3*(d+h),0]]}(t),f=nf(n),l=nf(e),a=o*u,p=c*i,h=o*s,d=r*i,v=o*o,g=i*i,m=o*l+f*i,x=a+p,w=h+d,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z[1]),J=P*Y+T*H+2*G,K=ef(N,k),tt=sf(K[1]),nt=P*A+T*B+2*tt,et=ef(n,q),ot=y*j+v*W+2*sf(et[1]),rt=ef(r,V),ct=O*U+g*$+2*sf(rt[1]),it=ef(c,Z),st=E*J+m*G+2*sf(it[1]),ut=ef(u,R),ft=I*Q+x*X+2*sf(ut[1]),lt=ef(f,z),at=sf(f[1])*L+w*D+2*sf(lt[1]),pt=ef(l,K),ht=sf(l[1])*nt+b*tt+2*sf(pt[1]),dt=ef(a,F),vt=sf(a[1])*Y+_*H+2*sf(dt[1]),gt=ef(N,p),mt=sf(p[1])*T+M*P+2*sf(gt[1]),xt=ef(k,h),wt=sf(h[1])*A+S*B+2*sf(xt[1]),_t=of(et,rt),Mt=ot+ct+sf(_t[1]),St=of(it,ut),Ct=st+ft+sf(St[1]),yt=of(_t,St),Ot=Mt+Ct+sf(yt[1]),Et=of(lt,pt),It=at+ht+sf(Et[1]),Nt=of(Et,dt),kt=It+vt+sf(Nt[1]),Pt=of(yt,Nt),Bt=Ot+kt+sf(Pt[1]),Tt=of(gt,xt),At=mt+wt+sf(Tt[1]),zt=of(Tt,d),Dt=At+C+sf(zt[1]),Lt=of(Pt,zt),qt=Bt+Dt+sf(Lt[1]);if(Ui*qt<sf(bt(Lt)))return!1}{const n=function(t){return ei(Mc(t))}(t);if(void 0===n)return u&&i===t[0][0]&&s===t[0][1];n.hasOwnProperty("vₓₓₓ")||(n.vₓₓₓ=[0],n.vₓₓᵧ=[0],n.vₓᵧᵧ=[0],n.vᵧᵧᵧ=[0]),n.hasOwnProperty("vₓₓ")||(n.vₓₓ=[0],n.vₓᵧ=[0],n.vᵧᵧ=[0]);const{vₓₓₓ:r,vₓₓᵧ:c,vₓᵧᵧ:f,vᵧᵧᵧ:l,vₓₓ:a,vₓᵧ:p,vᵧᵧ:h,vₓ:d,vᵧ:v,v:g}=n,m=rf(e,e),x=rf(e,m),w=rf(o,o),b=rf(o,w),_=rf(o,m),M=rf(e,w),S=rf(e,o),C=rf(r,x),y=rf(c,_),O=rf(f,M),E=rf(l,b),I=rf(a,m),N=rf(p,S),k=rf(h,w),P=rf(e,d),B=rf(o,v),T=cf(C,y),A=cf(O,E),z=cf(T,A),D=cf(I,N),L=cf(D,k),q=cf(z,L),W=cf(P,B),j=cf(W,g);return 0===St(cf(q,j))}}function ff(t,n){if(4===t.length)return uf(t,n);if(3===t.length)return tf(t,n);if(2===t.length)return function(t,n){const[e,o]=n,r=e.length,c=o.length,i=e[r-1],s=o[c-1],u=1===r&&1===c;{const{coeffs:{vₓ:n,vᵧ:r,v:c},errorBound:{v_:u}}=rr(t),f=Ss(e),l=Ss(o),a=Qu(i),p=Qu(s),h=Qu(n[1]),d=Qu(r[1]),v=a/3,g=p/3,m=n[1]*i,x=Xu(f,n),w=h*v+2*Qu(m),b=r[1]*s,_=Xu(l,r),M=d*g+2*Qu(b),S=Hu(x,_),C=w+M+Qu(S[1]),y=Hu(S,c),O=C+u+Qu(y[1]);if(Ui*O<Qu(bt(y)))return!1}{const n=function(t){return Ec(Cc(t))}(t);if(void 0===n)return u&&i===t[0][0]&&s===t[0][1];const{vₓ:r,vᵧ:c,v:f}=n,l=Yu(e,r),a=Yu(o,c);return 0===St(Ru(Ru(l,a),f))}}(t,n);if(1===t.length){const e=ne(n[0]),o=ne(n[1]);return 1===e.length&&1===o.length&&e[0]===t[0][0]&&o[0]===t[0][1]}throw new Error("The given bezier curve must be of order <= 3")}function lf(t){const n=t[0],e=t[1];return[(n[0]+e[0])/2,(n[1]+e[1])/2]}const af=dt,pf=Number.EPSILON;function hf(t){return[4*t[0],4*t[1]]}const df=Oo,vf=hn,gf=ie,mf=le,xf=fr,wf=hf,bf=dn;function _f(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=c[0],h=c[1],[d,v]=n,g=df(i,d),m=df(u,d),x=df(l,d),w=df(p,d),b=df(s,v),_=df(f,v),M=df(a,v),S=df(h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,d),O=yf(d,v),E=yf(v,v),I=Sf(C,Of(y)),N=Sf(x,Of(w));return[Sf(Ef(Sf(Sf(E,M),Of(I)),If(Sf(O,S))),Ef(Sf(Sf(_,g),Of(N)),If(Sf(b,m)))),Cf(3,Sf(Sf(Ef(O,I),Ef(Cf(3,S),M)),Sf(Ef(b,N),Ef(Cf(3,m),g)))),Sf(Ef(I,Cf(3,Ef(Of(S),M))),Ef(N,Cf(3,Ef(Of(m),g)))),Sf(Ef(S,M),Ef(m,g))]}function kf(t){return[-2*t[0],-2*t[1]]}const Pf=pn,Bf=hn,Tf=kf;function Af(t,n){const[[e,o],[r,c]]=t,[i,s]=n,u=e-i,f=r-i,l=o-s,a=c-s,p=Pf(u,u),h=Pf(u,f),d=Pf(f,f),v=Pf(l,l),g=Pf(l,a),m=Pf(a,a),x=Bf(h,g),w=Bf(v,p);return[Bf(Bf(d,m),Bf(w,Tf(x))),dn(x,w)]}function zf(t){const n=[];for(let e=0;e<t.length;e++)n.push(-2*t[e]);return n}const Df=dt,Lf=xt,qf=Bc,Wf=zf,jf=dt,Ff=xt,Hf=Bc;function Yf(t){const n=[];for(let e=0;e<t.length;e++)n.push(4*t[e]);return n}const Rf=dt,Xf=zf,{abs:Qf}=Math;function Vf(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=Qf(e[0]),s=Qf(e[1]),u=Qf(o[0]),f=Qf(o[1]),l=Qf(r[0]),a=Qf(r[1]),p=Qf(c[0]),h=Qf(c[1]),d=Qf(n[0]),v=Qf(n[1]),g=i+d,m=u+d,x=l+d,w=p+d,b=s+v,_=f+v,M=a+v,S=h+v,C=g*g,y=6*g*m,O=6*x*w,E=b*b,I=6*b*_,N=6*M*S,k=6*m*w+9*x*x,P=2*g*w+18*m*x,B=6*g*x+9*m*m,T=6*_*S+9*M*M,A=2*b*S+18*_*M,z=6*b*M+9*_*_;return[6*(w*w+O+(C+y)+k+(B+P)+(S*S+N+(E+I)+T+(z+A))),5*(O+5*y+3*P+2*(k+2*B+3*C)+(N+5*I+3*A+2*(T+2*z+3*E))),4*(k+3*(P+2*B)+5*(2*y+3*C)+(T+3*(A+2*z)+5*(2*I+3*E))),3*(P+2*(2*B+5*(y+2*C))+(A+2*(2*z+5*(I+2*E)))),2*(B+5*(y+3*C)+(z+5*(I+3*E))),y+6*C+(I+6*E)]}function $f(t,n){const e=t[0],o=t[1],r=t[2],c=Qf(e[0]),i=Qf(e[1]),s=Qf(o[0]),u=Qf(o[1]),f=Qf(r[0]),l=Qf(r[1]),a=Qf(n[0]),p=Qf(n[1]),h=c+a,d=s+a,v=f+a,g=i+p,m=u+p,x=l+p,w=h*h,b=h*d,_=d*v,M=g*g,S=g*m,C=m*x,y=g*x+m*m*2,O=h*v+d*d*2;return[x*x+M+2*y+4*(C+S)+(v*v+w+2*O+4*(_+b)),3*(C+y+(3*S+M)+(_+O+(3*b+w))),y+3*(2*S+M)+(O+3*(2*b+w)),S+M+(b+w)]}function Uf(t,n){const e=t[0],o=t[1],r=Qf(e[0]),c=Qf(e[1]),i=Qf(o[0]),s=Qf(o[1]),u=Qf(n[0]),f=Qf(n[1]),l=r+u,a=i+u,p=c+f,h=s+f,d=l*a+p*h,v=p*p+l*l;return[a*a+h*h+2*d+v,d+v]}function Zf(t,n){const e=t.length-1;if(3===e)return{polyDd:_f(t,n),polyE:Vf(t,n).map(t=>20*t),getPolyExact:()=>function(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=c[0],h=c[1],[d,v]=n,g=Df(i,d),m=Df(u,d),x=Df(l,d),w=Df(p,d),b=Df(s,v),_=Df(f,v),M=Df(a,v),S=Df(h,v),C=wt(g,g),y=Lf(6,wt(g,m)),O=Lf(6,wt(g,x)),E=qf(wt(g,w)),I=Lf(9,wt(m,m)),N=Lf(18,wt(m,x)),k=Lf(6,wt(m,w)),P=Lf(9,wt(x,x)),B=Lf(6,wt(x,w)),T=wt(w,w),A=wt(b,b),z=Lf(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,Hf(y)),N=vt(x,Hf(w)),k=vt(Mt(vt(_,Hf(N)),Yf(vt(b,m))),g),P=vt(Mt(vt(E,Hf(I)),Yf(vt(O,S))),M),B=vt(k,P),T=vt(Mt(b,N),Mt(Ff(3,m),g)),A=vt(Mt(O,I),Mt(Ff(3,S),M));return[B,Ff(3,vt(T,A)),vt(Mt(I,Ff(3,Mt(Hf(S),M))),Mt(N,Ff(3,Mt(Hf(m),g)))),vt(Mt(S,M),Mt(m,g))].map(ne)}(t,n)};if(1===e)return{polyDd:Af(t,n),polyE:Uf(t,n).map(t=>12*t),getPolyExact:()=>function(t,n){const[[e,o],[r,c]]=t,[i,s]=n,u=Rf(e,i),f=Rf(r,i),l=Rf(o,s),a=Rf(c,s),p=wt(u,u),h=wt(u,f),d=wt(f,f),v=wt(l,l),g=wt(l,a),m=wt(a,a),x=vt(h,g),w=vt(v,p);return[vt(vt(d,m),vt(Xf(x),w)),Mt(x,w)].map(ne)}(t,n)};if(0===e)return{polyDd:[[0,1]],polyE:[0],getPolyExact:()=>[[1]]};throw new Error("The given bezier curve must be of order 1, 2 or 3")}const{sqrt:Gf}=Math;function Jf(t,n,e=0,o=1){const{polyDd:r,polyE:c,getPolyExact:i}=Zf(t,n),s=Je(r,e,o,c,i)||[];s.push({t:e,tS:e,tE:e,multiplicity:1}),s.push({t:o,tS:o,tE:o,multiplicity:1});const u=s.map(e=>{const o=ts(t,[e.tS,e.tE]),r=function(t,n){const e=t[0],o=t[1],r=e[0],c=e[1],i=o[0],s=o[1],u=n[0],f=n[1];let l=1/0,a=-1/0;for(const[t,n]of[[r,c],[r,s],[i,c],[i,s]]){const e=af(t,u),o=af(n,f),r=bt(vt(wt(e,e),wt(o,o))),c=r*(1-pf),i=r*(1+pf);c<=l&&(l=c),i>=a&&(a=i)}return[l,a]}(o,n);return{p:lf(o),t:e.t,d:(Gf(r[0])+Gf(r[1]))/2,dSquaredI:r,box:o,ri:e}});let f=1/0;for(let t=0;t<u.length;t++){const n=u[t].dSquaredI[1];n<f&&(f=n)}const l=[];for(let t=0;t<u.length;t++){const n=u[t];n.dSquaredI[0]<=f&&l.push(n)}return l}function Kf(t,n){const{coeffs:e,errBound:o,getPExact:r}=Hi(t,n);return Je(e,0,1,o,r)}const{min:tl,max:nl}=Math;function el(t,n){let[[e,o],[r,c]]=t,[[i,s],[u,f]]=n;if(e>r&&([e,r]=[r,e]),i>u&&([i,u]=[u,i]),o>c&&([o,c]=[c,o]),s>f&&([s,f]=[f,s]),e<=u&&r>=i&&s<=c&&f>=o)return[[nl(e,i),nl(o,s)],[tl(r,u),tl(c,f)]]}function ol(t,n,e){const{ps:o}=t,{ps:r}=n;if(void 0===e)return;if(0===e.length)return[];const c=Kf(r,o);if(void 0===c)return;if(0===c.length)return[];const i=c.map(t=>ts(o,[t.tS,t.tE])),s=e.map(t=>ts(r,[t.tS,t.tE])),u=[];for(let r=0;r<c.length;r++){const f=i[r];for(let i=0;i<e.length;i++){if(void 0===el(f,s[i]))continue;const l=Ao(o,c[r].t),a={ri:c[r],p:l,kind:1,curve:t},p={ri:e[i],p:l,kind:1,curve:n};u.push([a,p])}}return u}function rl(t,n,e){for(const o of[t,n]){const r=o.length;for(let c=1;c<r+1;c++){const i=o[c-1],s=o[c%r],u=[s[1]-i[1],i[0]-s[0]];let f=1/0,l=-1/0;for(let n=0;n<t.length;n++){const e=u[0]*t[n][0]+u[1]*t[n][1];e<f&&(f=e),e>l&&(l=e)}let a=1/0,p=-1/0;for(let t=0;t<n.length;t++){const e=u[0]*n[t][0]+u[1]*n[t][1];e<a&&(a=e),e>p&&(p=e)}if(e&&(l<a||p<f))return!1;if(!e&&(l<=a||p<=f))return!1}}return!0}const cl=Et,{abs:il}=Math;function sl(t){return 4===t.length&&ou(t)&&(t=Uc(t)),3===t.length&&function(t){const[[n,e],[o,r],[c,i]]=t,s=n+c,u=s-2*o,f=il(s)+il(u);if(il(u)-f>0)return!1;const l=e+i,a=l-2*r,p=il(l)+il(a);return!(il(a)-p>0)&&0===St(Mt(cl(n,c),[2*o]))&&0===St(Mt(cl(e,i),[2*r]))}(t)&&(t=[t[0],t[2]]),2===t.length&&Ks(t)&&(t=[t[0]]),t}const ul=Number.EPSILON,fl=ul/2;function ll(t,n){return n<0?t<1?t:1-fl:0===n?1:t>1?t:1+ul}function al(t){const n=function(t){const n=new ArrayBuffer(8);return new DataView(n).setFloat64(0,t,!1),Array.from(new Uint8Array(n))}(t),e=n[0],o=n[1],r=e>>7,c=((127&e)<<4)+((240&o)>>4),i=0===c?0:16,s=0===c?c-1022:c-1023,u=n.slice(1);return u[0]=(15&o)+i,{sign:r,exponent:s,significand:u}}function pl(t){return al(t).significand}function hl(t){return Math.log2(t&-t)}function dl(t){if(0===t||!Number.isFinite(t))return NaN;const n=pl(t),e=n.length;for(let t=e-1;t>=0;t--){if(0===n[t])continue;const o=hl(n[t]);if(Number.isFinite(o))return 8*(e-t-1)+o}return NaN}function vl(t){return t>=128?7:t>=64?6:t>=32?5:t>=16?4:t>=8?3:t>=4?2:t>=2?1:t>=1?0:NaN}function gl(t){if(0===t||!Number.isFinite(t))return NaN;const n=pl(t),e=n.length;for(let t=0;t<e;t++){const o=vl(n[t]);if(Number.isFinite(o))return 8*(e-t-1)+o}return NaN}function ml(t){return al(t).exponent}function xl(t){if(0===t||!Number.isFinite(t))return NaN;const n=ml(t);return gl(t)-52+n}function wl(t,n){if(0===St(t=ne(t)))return[0];const e=xl(t[t.length-1]);let o=e,r=t.length-1;for(;r>0;){const c=xl(t[r-1]);if(e-c>n)break;o=c,r--}const c=Math.min(n-(e-o),53);let i=t[r];i=Vs(i,c);const s=t.slice(r);return s[0]=i,s}function bl(t){return 0===t?0:gl(t)-dl(t)+1}function _l(t){const n=ne(t);if(0===St(n))return 0;const e=n[n.length-1],o=n[0];return ml(e)-ml(o)+(53-dl(o))}function Ml(t){return bt(function(t,n,e){let o=n,r=t,c=!1,i=0;e||(i=_l(r)-_l(o)+1,e=i/53+1,c=!0);let s=[1/bt(o)],u=1;for(;;){if(r=wt(r,s),u>e)return c?(r=wl(r,i),r):r.slice(r.length-e,r.length);o=wt(o,s),s=Mt([2],o),u*=2}}(t[0],t[1],2))}function Sl(t){return St(t[0])*St(t[1])}function Cl(t){return(n,e)=>{const o=_c(n),r=_c(e),c=_c(n.slice().reverse()),i=_c(e.slice().reverse()),s=t(o,r),u=t(c,r),f=t(o,i),l=t(c,i),a=-Sl(u),p=-Sl(l),h=Ml(s),d=Ml(f);return[ll(h,a),ll(d,p)]}}const yl=Cl(function(t,n){const e=0===St(t[0][0])?1:0;return function(t,n){const[e,o]=t,[,r]=n;return[Mt(r,o),e]}(t[e],n[e])});function Ol(t,n){return St(Mt(t,n))}function El(t,n){return Ol(wt(t[0],n[1]),wt(t[1],n[0]))*St(t[1])*St(n[1])}function Il(t){let n=-1024;for(let e=0;e<t.length;e++){const o=t[e];for(let t=0;t<o.length;t++){const e=o[t];if(0===e)continue;const r=-ml(e)+bl(e)-1;r>n&&(n=r)}}return 0===n?t.map(t=>t.map(t=>BigInt(t))):n>0?t.map(t=>t.map(t=>{if(0===t)return 0n;const e=-ml(t)+bl(t)-1;return BigInt(t*2**e)*2n**BigInt(n-e)})):t.map(t=>t.map(t=>BigInt(t*2**n)))}function Nl(t,n){if(n=n<0n?-n:n,0n===(t=t<0n?-t:t))return n;if(0n===n)return t;for(;0n!==n;){const e=n;n=t%n,t=e}return t}const kl=BigInt(2**53);function Pl(t){if(0n===t)return[0];const n=[];let e=0,o=t;for(;0n!==o;){o=t/kl;const r=t%kl;n.push(Number(r)*2**(53*e)),t=o,e++}return ne(n)}const{round:Bl,sqrt:Tl}=Math;function Al(t){if(t<=1n){if(t<0n)throw new Error("square root of negative numbers are not allowed");return t}let n=BigInt(Bl(Tl(Number(t))));for(;;){const e=n+t/n>>1n;if(e===n)return n;n=e}}function zl(t){return t<0n?-t:t}function Dl(t){let n=0n;for(let e=0;e<t.length;e++)n+=t[e];return n}function Ll(t,n){const[e,o]=ql(t[0],n[0]),[r,c]=ql(t[1],n[1]);if(0===El(e,r)||0===El(e,c))return e;if(0===El(o,r)||0===El(o,c))return o;throw new Error("An unexpected error occured.")}function ql(t,n){const[e,o]=t,[r,c]=n,[i,s]=function(t){const[n,e]=Il(t).map(Dl),o=Nl(n,e);return[Pl(Al(zl(n/o))),Pl(Al(zl(e/o)))]}([r,e]);return[[Mt(wt(c,s),wt(o,i)),wt(i,Bc(e))],[Mt(wt(c,_t(s)),wt(o,i)),wt(i,Bc(e))]].sort(El)}function Wl(t,n){const e=_c(t),o=0===St(e[0][0])?0:0===St(e[1][0])?1:-1;if(-1!==o){const e=t[0][o],r=t[2][o],c=n[0][o],i=n[2][o];return yl([[e,e],[r,r]],[[c,c],[i,i]])}return Cl(Ll)(t,n)}const{round:jl,cbrt:Fl}=Math;function Hl(t){const n=(e=t)>0n?1n:e<0n?-1n:0n;var e;if((t=zl(t))<=1n)return n*t;let o=BigInt(jl(Fl(Number(t))));for(;;){const e=(2n*o+t/(o*o))/3n;if(e===o)return n*o;o=e}}function Yl(t){return wt(t,t)}const Rl=Cl(function(t,n){const e=0===St(t[0][0])?1:0;return function(t,n){const[e,o]=t,[r,c]=n,i=function(t){const[n,e]=Il(t).map(Dl),o=Nl(n,e);return[Pl(Hl(n/o)),Pl(Hl(e/o))]}([r,e]),s=Yl(i[0]);return[Mt(wt(c,Yl(i[1])),wt(o,s)),wt(xt(3,e),s)]}(t[e],n[e])}),{EPSILON:Xl}=Number,Ql=Xl/2+Xl**2/2;function Vl(t){return t>0?t-t*Ql:t+t*Ql}const{EPSILON:$l}=Number,Ul=$l/2+$l**2/2;function Zl(t){return t>0?t+t*Ul:t-t*Ul}function Gl(t){if(0===t||1===t)return[t,t];const n=Vl(Vl(t)),e=function(t){return Zl(Zl(t))}(t);return[n,e]}const Jl=So(function(t,n,e){const o=t.ps,r=n.ps,c=[];let i=Kf(o,r);if(void 0===i){const e=function(t,n,e=!1){e||(t=sl(t),n=sl(n));const o=[,,yl,Wl,Rl],[r,c]=o[t.length](t,n),[i,s]=o[t.length](n,t),u=[{tA:r,tB:0,bez:"B",start:!0},{tA:c,tB:1,bez:"B",start:!1},{tA:0,tB:i,bez:"A",start:!0},{tA:1,tB:s,bez:"A",start:!1}].sort((t,n)=>t.tA-n.tA);if(u[1].tA===u[2].tA){const n=u[1],e=n.tA,o=n.tB,r=ts(t,[e,e]);return[{p:r[0],kind:4,box:r,t1:e,ri1:{t:e,tS:e,tE:e,multiplicity:1},t2:o,ri2:{t:o,tS:o,tE:o,multiplicity:1}}]}if(u[0].bez===u[1].bez)return[];const f=u[1],l=u[2],[a,p]=Gl(f.tA),[h,d]=Gl(f.tB),[v,g]=Gl(l.tA),[m,x]=Gl(l.tB),w=ts(t,[a,p]),b=ts(n,[h,d]),_=ts(t,[v,g]),M=ts(n,[m,x]),S=el(w,b),C=el(_,M),y={t:a,tS:a,tE:p,multiplicity:1},O={t:h,tS:h,tE:d,multiplicity:1},E={t:v,tS:v,tE:g,multiplicity:1},I={t:m,tS:m,tE:x,multiplicity:1};return[{p:lf(S),kind:5,box:S,t1:y.t,ri1:y,t2:O.t,ri2:O},{p:lf(C),kind:5,box:C,t1:E.t,ri1:E,t2:I.t,ri2:I}]}(o,r);for(const r of e){const e=Ao(o,r.ri1.t),i={ri:r.ri1,kind:5,p:e,curve:t},s={ri:r.ri2,kind:5,p:e,curve:n};c.push([i,s])}return c}return e&&(i=i.filter(t=>t.tS>0)),0===i.length?[]:ol(t,n,i)||[]});function Kl(t,n,e){const{ps:o}=n;return{ri:ju(t),p:Ao(o,t),kind:e,curve:n}}function ta(t,n){const e=t.ps,o=n.ps;if(2===e.length&&2===o.length)return function(t,n){let e=t.ps,o=n.ps;const r=gu(e),c=gu(o);if(t.next!==n&&n.next!==t){if(ho(!0,r,c)){const e=Jl(t,n,!1);return e.length?e:void 0}return}n.next===t&&([t,n]=[n,t],[e,o]=[o,e]);if(0!==Ys(e[0],e[1],o[1]))return;if(!ho(!1,r,c))return;let i;return i=Gs(e[0],e[1])>Gs(o[0],o[1])?[Fu(Jf(e,o[1])[0].ri),1]:[0,Fu(Jf(o,e[0])[0].ri)],[[Kl(1,t,5),Kl(0,n,5)],[Kl(i[0],t,5),Kl(i[1],n,5)]]}(t,n);if(t.next===n||n.next===t)return ho(!1,gu(e),gu(o))&&rl(vu(e,!1),vu(o,!1),!1)?n.next===t?Jl(n,t,!0):Jl(t,n,!0):na(t,n);let r=ho(!0,gu(e),gu(o));return r?(r=rl(vu(e,!1),vu(o,!1),!0),r?Jl(t,n,!1):void 0):void 0}function na(t,n){if(n.next===t){if(t.next===n)return;[t,n]=[n,t]}const e=t.ps,o=n.ps;if(ff(e,o[o.length-1].map(t=>[t]))){const e=ol(t,n,[ju(1)]);if(void 0===e||0===e.length)return;return[[e[0][0],Kl(1,n,1)]]}}function ea(t){return t[t.length-1]<0?_t(t):t}function oa(t,n){const e=t+n,o=e-t;return[t-(e-o)+(n-o),e]}Number.EPSILON;const ra=Number.EPSILON/2;function ca(t,n,e,o){const r=t/n,c=Math.abs(t),i=Math.abs(n),s=i-o;return s<=0?{est:r,err:Number.POSITIVE_INFINITY}:{est:r,err:(i*e+c*o)/s**2+ra*Math.abs(c/i)}}function ia(t){const n=t[0],e=t[1];if(0===e)return[0,0];const o=Math.sqrt(e),r=o*o,c=134217729*o,i=c-(c-o),s=o-i,u=.5*(e-r-(s*s-(r-i*i-i*s*2))+n)/o;return[u-(o+u-o),o+u]}const{abs:sa}=Math;const{abs:ua}=Math,fa=wt,la=vt,aa=Mt,pa=wt,ha=xt,da=Oo,va=oa,ga=Xo,ma=hn,xa=fr,wa=es,ba=vt,_a=It,Ma=2*Xi,{abs:Sa}=Math;function Ca(t,n=!0){if(t.length<4)return[];const{coeffs:[e,o,r],errBound:[c,i,s]}=function(t){const{coeffs:[[n,e,o],[r,c,i]],errorBound:[[s,u],[f,l]]}=function(t){const[[n,e],[o,r],[c,i],[s,u]]=t,f=s-n,l=o-c,a=f+3*l,p=c+n,h=p-2*o,d=o-n,v=u-e,g=r-i,m=v+3*g,x=i+e,w=x-2*r,b=r-e;return{coeffs:[[a,3*h,3*d,n],[m,3*w,3*b,e]],errorBound:[[sa(f)+6*sa(l)+sa(a),6*(sa(p)+sa(h)),6*sa(d),0],[sa(v)+6*sa(g)+sa(m),6*(sa(x)+sa(w)),6*sa(b),0]]}}(t),a=ua(n),p=ua(e),h=ua(o),d=ua(r),v=ua(c),g=ua(i),m=e*r,x=n*c,w=n*i,b=o*r,_=e*i,M=o*c,S=u*d+p*f+ua(m),C=s*v+a*l+ua(x),y=s*g+ua(w),O=h*f+ua(b),E=u*g+ua(_),I=h*l+ua(M),N=m-x,k=ua(N),P=S+C+k,B=b-w,T=ua(B),A=O+y+T,z=_-M,D=ua(z),L=E+I+D,q=N*N,W=N*B,j=z*N,F=B*B,H=j+F;return{coeffs:[q,W,H],errBound:[2*P*k+ua(q),P*T+k*A+ua(W),L*k+D*P+ua(j)+(2*T*A+ua(F))+ua(H)].map(t=>$i*t)}}(t);if(Sa(e)<=c){const[[n,e],[o,r],[c,i],[s,u]]=t,f=ba(da(s,n),ha(3,da(o,c))),l=_a(va(c,n),-2*o),a=ba(da(u,e),ha(3,da(r,i))),p=_a(va(i,e),-2*r);if(0===Ol(pa(l,a),pa(f,p)))return[]}const u=o*o,f=4*e*r,l=u-f,a=2*i*Sa(o)+$i*u+(4*(c*Sa(r)+Sa(e)*s)+$i*Sa(f))+$i*Sa(l);if(l<-a)return[];if(l>a){const{est:t,err:u}=function(t,n){if(t-n<=0){const e=t>0?Math.sqrt(t):0;return{est:e,err:Math.max(Math.sqrt(t+n)-e,e)}}const e=Math.sqrt(t),o=Math.sqrt(t-n),r=Math.sqrt(t+n);return{est:e,err:Math.max(Math.abs(o-e),Math.abs(r-e))}}(l,a);let f;f=o>=0?-o-t:-o+t;const p=i+u+$i*Sa(f),{est:h,err:d}=ca(f,2*e,p,2*c),{est:v,err:g}=ca(2*r,f,2*s,p);if(n){if(h+d<0||h-d>1||v+g<0||v-g>1)return[]}else if((h+d<0||h-d>1)&&(v+g<0||v-g>1))return[]}let[p,h,d]=function(t){const[[n,e,o],[r,c,i]]=Mc(t),s=fa(e,r),u=fa(n,c),f=fa(n,i),l=fa(o,r),a=fa(e,i),p=fa(o,c),h=Mt(s,u),d=Mt(l,f),v=Mt(a,p),g=fa(h,h),m=fa(h,d),x=fa(h,v),w=fa(d,d);return[g,m,la(x,w)]}(t);const v=aa(pa(h,h),ha(4,pa(p,d))),g=St(v);if(g<0)return[];if(g>0){const t=ia(Ss(v));let e;p=Ss(p),h=Ss(h),d=Ss(d),e=St(h)>=0?ga(ma(h,t)):ma(ga(h),t);let o=bt(wa(e,xa(p))),r=bt(wa(xa(d),e));if(n){if(o<-Ma||o>1+Ma||r<-Ma||r>1+Ma)return[]}else if((o<-Ma||o>1+Ma)&&(r<-Ma||r>1+Ma))return[];return[o,r]=o<r?[o,r]:[r,o],o>=0-Ma&&o<=1+Ma?r>=0-Ma&&r<=1+Ma?[o,r]:[o]:r>=0-Ma&&r<=1+Ma?[r]:[]}const m=zf(p);if(St(h)*St(m)<0)return[];if(Ol(ea(h),ea(m))>0)return[];const x=Ss(h),w=Ss(m),b=wa(x,w),_=b[1]+b[0];return[_,_]}function ya(t){if(4===t.length){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[6*(s-n+3*(o-c)),6*(c+n-2*o)],[6*(u-e+3*(r-i)),6*(i+e-2*r)]]}if(3===t.length){const[[n,e],[o,r],[c,i]]=t;return[[2*(c-2*o+n)],[2*(i-2*r+e)]]}if(t.length<=2)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3.")}function Oa(t){if(Rs(t))return{minima:[],maxima:[],inflections:[]};if(4===t.length&&ou(t)&&(t=Uc(t)),3===t.length){const n=function(t){const[[n,e],[o,r],[c,i]]=t,s=c-o,u=s-(o-n),f=i-r,l=f-(r-e);return[u*u+l*l,-(n*(u-o)-o*(s-o)+e*(l-r)-r*(f-r))]}(t);return{minima:[],maxima:Je(n,0,1)?.map(t=>t.t)||[],inflections:[]}}const n=function(t){const[[n,e,o],[r,c,i]]=pt(t),[[s,u],[f,l]]=ya(t),[[a],[p]]=function(t){if(4===t.length){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[6*(s-n+3*(o-c))],[6*(u-e+3*(r-i))]]}if(t.length<=3)return[[0],[0]];throw new Error("The given bezier curve must be of order <= 3.")}(t),h=a*c,d=p*e,v=u*i,g=u*c,m=f*f,x=s*i,w=l*o,b=l*e,_=f*o,M=o*e,S=o*n,C=o*r,y=e*e,O=e*n,E=e*c,I=n*i,N=n*r,k=n*n,P=i*c,B=i*r,T=c*c,A=c*r,z=r*r,D=a*i-p*o,L=u*o+l*i,q=v-w,W=o*o+i*i,j=E+I,F=B+T,H=S+y,Y=e*r+n*c,R=k-z,X=O-A,Q=M-P,V=o*c+e*i,$=B+F,U=S+H,Z=C+j,G=E+j,J=U-$,K=j+I,tt=C+E+I,nt=2*b+_;return{inflectionPoly:[s*r-f*n,u*r+s*c-l*n-f*e,g+x-b-_,v-w],otherExtremaPoly:[k*(h-3*d)+z*(3*h-d)+2*(N*(a*e-p*c+3*(l*f-u*s))+3*s*f*X)+3*(Y*(m-s*s)+R*(u*f+l*s)),a*(r*(U+3*F)+n*G)-p*(o*(3*k+z)+e*(3*O+2*A)+n*$)+3*(u*(l*R-u*N+2*(f*X-s*Y))+s*(2*l*X+f*(2*(S-B)+(y-T))-s*tt)+l*(l*N+2*f*Y)+m*Z),a*(2*o*Y+e*K+c*(4*B+$))-p*(2*o*(3*O+A)+e*(y+2*B)+c*K)+3*(u*(2*(l*X-s*tt)+f*J-u*Y)+s*(2*f*Q-s*V)+l*(l*Y+2*f*Z+s*J)+m*V),a*(o*(C+2*j)+i*(y+3*F))-p*(o*(3*H+$)+i*G)+3*(u*(l*J-u*Z+2*(f*Q-s*V))+s*(o*(nt-s*i)-i*(2*l*c+f*i))+l*(l*j+o*(2*f*c+l*r))+f*i*nt),W*(h-d)+2*(M+P)*D-3*(L*(g+x-b-_)+(u*e+s*o+l*c+f*i)*q),D*W-3*L*q]}}(t),e=n.inflectionPoly,o=n.otherExtremaPoly,r=Je(o,0,1)?.map(t=>t.t)||[],c=function(t){const n=t.length-1;if(n<=0)return[];const e=new Array(n);for(let o=0;o<n;o++)e[o]=(n-o)*t[o];return e}(o),i=[],s=[];for(let t=0;t<r.length;t++){const n=r[t],o=at(c,n);at(e,n)*o>=0?i.push(n):s.push(n)}return{minima:i,maxima:s,inflections:Je(e,0,1)?.map(t=>t.t)||[]}}const{sqrt:Ea}=Math;function Ia(t,n){const[e,o]=function(t,n){const[e,o]=pt(t),[r,c]=ya(t),i=at(e,n),s=at(o,n),u=at(r,n);return[i*at(c,n)-s*u,Ea((i*i+s*s)**3)]}(t,n);return e/o}const{abs:Na}=Math;function ka(t){return 4===t.length?function(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[s-n+3*(o-c),2*(c+n-2*o),o-n],[u-e+3*(r-i),2*(i+e-2*r),r-e]]}(t):3===t.length?function(t){const[[n,e],[o,r],[c,i]]=t;return[[c+n-2*o,o-n],[i+e-2*r,r-e]]}(t):function(t){const[[n,e],[o,r]]=t;return[[o-n],[r-e]]}(t)}function Pa(t){if(2===t.length)return[];const[n,e]=ka(t);return[...Je(n,0,1)||[],...Je(e,0,1)||[]]}const Ba=So(function(t){const n=[];for(const e of t)for(const t of e.curves)n.push(t);const e=ao(n,t=>gu(t.ps)[0][0],t=>gu(t.ps)[1][0],ta),o=[];for(const t of e)for(const n of t.u)o.push(n);return o}),Ta=So(function(t){const n=[];for(const e of t)for(const t of e.curves){const e=t.ps,o=Ca(e);if(0===o.length)continue;const r=o[0]===o[1]?3:2,c=o[0],i=o[1],s=c-4*$n,u=c+4*$n,f=i-4*$n,l=i+4*$n,a=Ao(e,c),p={ri:{t:s,tS:s,tE:u,multiplicity:1},p:a,kind:r,curve:t},h={ri:{t:f,tS:f,tE:l,multiplicity:1},p:a,kind:r,curve:t};n.push([p,h])}return n}),Aa=So(function(t){const n=[];for(const e of t)for(const t of e.curves)n.push([Kl(1,t,4),Kl(0,t.next,4)]);return n}),za=So(function(t,n){const e=[],o=1e7*2**-t;for(const t of n)for(const n of t.curves){const{ps:t}=n,r=Oa(t),{minima:c,maxima:i}=r,s=[0,1,...c,...i];for(let r of s)if(Na(Ia(t,r))>o){const t=Kl(r,n,7),o=Kl(r,n,7);e.push([t,o])}}return e}),Da=So(function(t){const n=[];for(let e of t)for(let t of e.curves){const{ps:e}=t,o=Pa(e).map(n=>{const{t:o}=n,r=Ao(e,o);return[{p:r,ri:n,kind:8,curve:t},{p:r,ri:n,kind:8,curve:t}]});n.push(...o)}return n}),La=So(function(t,n,e){let o=[t.map((t,e)=>[n[e],{...n[e]}]),Ba(t),Ta(t),Aa(t),za(e,t),Da(t)].flat(1);return"undefined"!=typeof _debug_&&_debug_.elems.intersection.push(...o.flat()),o});function qa(t){const{ps:n}=t,e=n[0],o=n[n.length-1];let r=e[1]<o[1]?{ri:ju(0),p:e,kind:0,curve:t}:{ri:ju(1),p:o,kind:0,curve:t};if(2===n.length){if(e[1]===o[1]){const n=[(e[0]+o[0])/2,(e[1]+o[1])/2];return{ri:ju(.5),p:n,kind:0,curve:t}}return r}const[,c]=ka(n),i=Je(c,0,1)||[];for(let e=0;e<i.length;e++){const o=i[e],c=Ao(n,o.t);c[1]<r.p[1]&&(r={ri:o,p:c,kind:0,curve:t})}return r}function Wa(t){let n=1/0,e=-1/0,o=1/0,r=-1/0;for(const c of t){const t=c[0],i=c[1];t<n&&(n=t),t>e&&(e=t),i<o&&(o=i),i>r&&(r=i)}return[[n,o],[e,r]]}function ja(t){const{curves:n}=t;let e,o=n[0],r=1/0;for(const t of n){const{ps:n}=t;if(Wa(n)[0][1]>r)continue;const c=qa(t),i=c.p[1];(void 0===e||i<r||i===r&&c.ri.t>e.ri.t)&&(e=c,o=t,r=i)}return e}const Fa=et(function(t){let n=0;for(const e of t)switch(e.length){case 2:n+=Ha(e,0,1);break;case 3:n+=(2*Ha(e,0,1)+Ha(e,0,2)+2*Ha(e,1,2))/3;break;case 4:n+=(6*Ha(e,0,1)+3*Ha(e,0,2)+Ha(e,0,3)+3*Ha(e,1,2)+3*Ha(e,1,3)+6*Ha(e,2,3))/10}return n/2});function Ha(t,n,e){return t[n][0]*t[e][1]-t[e][0]*t[n][1]}const{abs:Ya}=Math;function Ra(t){return t.map(t=>t.toReversed()).toReversed()}const{sign:Xa}=Math;function Qa(t,n){return t.ps===n.ps&&t.ts[1]===n.ts[0]&&(t.ts[1]-t.ts[0])*(n.ts[1]-n.ts[0])>0}function Va(t,n){return{ps:t.ps,ts:[t.ts[0],n.ts[1]]}}function $a(t,n){const{idx:e}=n;let o=t[e];return void 0===o&&(o={bigBox:n.bigBox,box:n.box,inOuts:[],xs:n.xs},t[e]=o),o}function Ua(t,n,e){return{idx:t.idx,_x_:t._x_,dir:n,swapped:e,oSideIdxs:t.oSideIdxs,oFSC:t.oFSC,oFSCE:t.oFSCE,oSideIdx:t.oSideIdx,container:void 0,orientation:void 0,windingNum:void 0,children:void 0,nextAround:void 0,parent:void 0,path:void 0,prevAround:void 0,twin:void 0,loop:void 0}}const{sign:Za}=Math;function Ga(t){const{ps:n,ts:e}=t;return{ps:n,ts:[e[1],e[0]]}}function Ja(t){return t.map(t=>{const n=t[0].out.orientation;return t.map(({out:t,depth:e})=>function(t,n,e){const{orientation:o}=t,r=(e%2==0?1:-1)*n,c=zu(t);return r*o>0?c:c.map(Ga).toReversed()}(t,n,e))})}const{ceil:Ka,log2:tp}=Math;function np(n,e={}){"undefined"!=typeof _debug_&&(_debug_.timing.timingStart=performance.now());const o=Ka(tp(function(t){let n=-1/0;for(const e of t)for(const t of e)for(const e of t)for(const t of e)n=xu(n,wu(t));return n}(n))),{minLoopArea:r=(2**(o-16))**2,forceOrientationNegative:c=!1,booleanOp:i="OR"}=e,s=o-46+("undefined"==typeof _debug_?4:30),u=(n=mu(n,o).sort(eo)).map(t),f=u.map(ja);"undefined"!=typeof _debug_&&f.forEach(t=>_debug_.elems.minY.push(t));const l=La(u,f,o),a=Hs(l,o,s);"undefined"!=typeof _debug_&&_debug_.elems.container.push(...a);const p=a.filter(t=>As(t.xs)),h=ro(Wu(o,p)).map(so(i)).filter(t=>0!==t.length);return function(n,e,o){const r=n.map(t=>t.map(t=>function(t){const n=t.length;return 0===n?t:t.map((e,o)=>{const r=t[(o+1)%n][0],c=e.length-1;return e.map((t,n)=>n===c?[...r]:t)})}(function(t){if(t.length<2)return t;const n=[];for(const e of t){const t=n[n.length-1];void 0!==t&&Qa(t,e)?n[n.length-1]=Va(t,e):n.push(e)}for(;n.length>=2&&Qa(n[n.length-1],n[0]);)n[0]=Va(n.pop(),n[0]);return n}(t).map(_u)))),c=e?r.map(t=>{return-1!==(n=t[0],Xa(Fa(n)))?t.map(Ra):t;var n}):r,i=So(function(t){return function(n){const e=[];for(let o=0;o<n.length;o++){const r=n[o].filter(n=>Ya(Fa(n))>t);r.length&&e.push(r)}return e}}(o)),s=i(c).map(t=>t.toSorted(eo));let u=0;const f=js(s,n=>t(n,u++));return function(t){if("undefined"!=typeof _debug_){for(const n of t)_debug_.elems.loop.push(...n),_debug_.elems.loops.push(n);"undefined"!=typeof _debug_&&(_debug_.timing.simplifyPaths=performance.now()-_debug_.timing.timingStart-_debug_.timing.normalize)}}(f),f}(function(t,n,e,o){const{containers_:r,minYContainers:c}=function(t,n,e){t.forEach((t,n)=>t.idx=n);const o=[],r=[];for(let t=0;t<n.length;t++){const c=n[t],i=Za(c[0].windingNum-c[0].parentWinding);for(let n=0;n<c.length;n++){const s=c[n],{out:u,depth:f,windingNum:l,parentWinding:a}=s,p=Za(l-a)!==(f%2==0?1:-1)*i,h=p?u.path.toReversed():u.path,d=new Set;for(const r of h){const{twin:c}=r,i=r.dir*(p?-1:1),s=Ua(r,i,p),u=Ua(c,-i,p);s.twin=u,u.twin=s;const f=$a(o,r._x_.container);f.inOuts.push(s);const l=$a(o,c._x_.container);l.inOuts.push(u),s.container=f,u.container=l;const a=Tu(e[t][n]);s.loop=a,u.loop=a,d.add(f)}r.push(d)}}const c=new Set;for(let t=0;t<r.length;t++){const n=r[t];let e,o=1/0;for(const t of n)t.box[0][1]<o&&(e=t,o=t.box[0][1]);c.add(e)}o.forEach(t=>{(t.inOuts.length>2||c.has(t))&&t.inOuts.sort(ks)}),o.forEach(t=>Fs(t.inOuts));const i=Array.from(c);return i.sort((t,n)=>t.box[0][1]-n.box[0][1]),{containers_:o,minYContainers:i}}(e,n,o);return"undefined"!=typeof _debug_&&(_debug_.elems.container.length=0,_debug_.elems.container.push(...r.filter(t=>void 0!==t))),Ja(ro(Wu(t,c)).map(so("OR")).filter(t=>0!==t.length))}(o,h,a,Ja(h)),c,r)}const{max:ep,abs:op}=Math;function rp(t,n){const e=t[0],o=t[1],r=t[2],c=t[3],i=e[0],s=e[1],u=o[0],f=o[1],l=r[0],a=r[1],p=c[0],h=c[1],d=n[0],v=n[1],g=i-d,m=u-d,x=l-d,w=p-d,b=s-v,_=f-v,M=a-v,S=h-v,C=g*g,y=6*g*m,O=6*x*w,E=b*b,I=6*b*_,N=6*M*S,k=6*m*w+9*x*x,P=2*g*w+18*m*x,B=6*g*x+9*m*m,T=6*_*S+9*M*M,A=2*b*S+18*_*M,z=6*b*M+9*_*_;return[6*(w*w-O+(C-y)+k+(B-P)+(S*S-N+(E-I)+T+(z-A))),5*(O+5*y+3*P-2*(k+2*B+3*C)+(N+5*I+3*A-2*(T+2*z+3*E))),4*(k-3*(P-2*B)-5*(2*y-3*C)+(T-3*(A-2*z)-5*(2*I-3*E))),3*(P-2*(2*B-5*(y-2*C))+(A-2*(2*z-5*(I-2*E)))),2*(B-5*(y-3*C)+(z-5*(I-3*E))),y-6*C+(I-6*E)]}function cp(t,n){const e=t[0],o=t[1],r=t[2],c=e[0],i=e[1],s=o[0],u=o[1],f=r[0],l=r[1],a=n[0],p=n[1],h=c-a,d=s-a,v=f-a,g=i-p,m=u-p,x=l-p,w=h*h,b=h*d,_=d*v,M=g*g,S=g*m,C=m*x,y=g*x+m*m*2,O=h*v+d*d*2;return[x*x+M+2*y-4*(C+S)+(v*v+w+2*O-4*(_+b)),3*(C-y+(3*S-M)+(_-O+(3*b-w))),y-3*(2*S-M)+(O-3*(2*b-w)),S-M+(b-w)]}function ip(t,n){const[[e,o],[r,c]]=t,[i,s]=n,u=e-i,f=r-i,l=o-s,a=c-s,p=u*f+l*a,h=l*l+u*u;return[f*f+a*a+(h-2*p),p-h]}const{sqrt:sp}=Math;function up(t,n,e=!0){let o;if(4===t.length)o=rp(t,n);else if(3===t.length)o=cp(t,n);else{if(2!==t.length){if(1===t.length)return{p:t[0],t:0,d:nn(t[0],n)};throw new Error("The given bezier curve must be of order <= 3.")}o=ip(t,n)}const r=Je(o,0,1)?.map(t=>t.t)||[];e&&(r.push(0),r.push(1));let c,i=1/0;for(const e of r){const o=Ke(t,e),r=Gs(o,n);r<i&&(i=r,c={p:o,t:e,d:sp(r)})}return c}const{sqrt:fp}=Math,{abs:lp}=Math;function ap(t){let n=-1/0;for(let e=0;e<t.length;e++){const o=t[e],r=lp(o[0]),c=lp(o[1]);r>n&&(n=r),c>n&&(n=c)}return n}const{max:pp}=Math;function hp(t){return pp(t.hL+t.hEL,t.hR+t.hER)}function dp(t,n){const e=hp(t)-hp(n);return 0!==e?e:t.tS-n.tS}class vp{compare;heap=[];constructor(t){this.compare=t}insert(t){const n=this.heap;n.push(t);let e=n.length-1;for(;;){const o=(e-1-(e+1)%2)/2;if(-1===o)return;const r=n[o];if(this.compare(t,r)<0)break;n[o]=t,n[e]=r,e=o}}popMax(){const t=this.heap,n=t[0];return t[0]=t[t.length-1],t.length--,this.swimDown(),n}swimDown(){const t=this.heap,n=t.length;let e=0;for(;;){const o=2*e+1;if(o>=n)break;const r=2*e+2,c=r>=n||this.compare(t[o],t[r])>0?o:r,i=t[c],s=t[e];if(this.compare(s,i)>0)break;t[c]=s,t[e]=i,e=c}}swapMinOrMax(t){this.heap[0]=t,this.swimDown()}static getParentIdx(t){return(t-1-(t+1)%2)/2}static getLeftChild(t){return 2*t+1}static getRightChild(t){return 2*t+2}}const{max:gp}=Math;function mp(t,n,e,o=50){if(1===t.length)return up(n,t[0]).d;if(1===n.length)return function(t,n){let e;if(4===t.length)e=rp(t,n);else if(3===t.length)e=cp(t,n);else{if(2!==t.length){if(1===t.length)return{p:t[0],t:0,d:nn(t[0],n)};throw new Error("The given bezier curve must be of order <= 3.")}e=ip(t,n)}const o=Je(e,0,1)?.map(t=>t.t)||[];o.push(0),o.push(1);let r,c=-1/0;for(const e of o){const o=Ke(t,e),i=Gs(o,n);i>c&&(c=i,r={p:o,t:e,d:fp(i)})}return r}(t,n[0]).d;if(2===t.length&&2===n.length){const e=up(n,t[0]).d,o=up(n,t[t.length-1]).d;return e>o?e:o}const r=gp(ap(t),ap(n));e=e||r/1e6;const[c,i]=xp(t,0,1),s={tS:0,tE:1,hL:up(n,t[0]).d,hR:up(n,t[t.length-1]).d,hEL:c,hER:i},u=new vp(dp);u.insert(s);let f=0,l=1/0,a=-1/0;for(;;){const r=u.heap[0],{tS:c,tE:i,hL:s,hR:p}=r,h=(c+i)/2,[d,v]=xp(t,c,h),[g,m]=xp(t,h,i),x=Ke(t,h),w=nn(x,up(n,x).p),b=gp(s,w,p);if(b>a&&(a=b),l=hp(r),l-a<e)return a;if(f++>o)return a;const _={tS:c,tE:h,hL:s,hR:w,hEL:d,hER:v},M={tS:h,tE:i,hL:w,hR:p,hEL:g,hER:m};u.swapMinOrMax(_),u.insert(M)}}function xp(t,n,e){const o=(e+n)/2,r=U(t,n,o),c=U(t,o,e);return[au(r),au(c)]}function wp(t,n=!1){const e=t;let o=e;const r=[];do{n&&o===e||z(o)||r.push(o),o=o.nextOnCircle}while(o!==e);return r}function bp(t){const n=[],e=[t],o=new Set;for(;e.length>0;){const t=Kt(e.pop());if(0===t.length)continue;n.push(t);const r=t[0],c=t[t.length-1].next.prevOnCircle;o.add(r),o.add(c);const i=wp(r,!0),s=wp(c,!0),u=i.filter(t=>!o.has(t)),f=s.filter(t=>!o.has(t));for(const t of u)o.add(t);for(const t of f)o.add(t);e.push(...u,...f)}return n}class _p{datum;color=0;parent;left;right;constructor(t){this.datum=t}}class Mp{compare;root;constructor(t){this.compare=t,this.root=void 0}isEmpty(){return void 0===this.root}find(t){let n=this.root;for(;n;){const e=this.compare(t,n.datum);if(0===e)return n;n=e<0?n.left:n.right}}insert(t){if(void 0===this.root)return this.root=new _p(t),void(this.root.color=1);let n,e=this.root;for(;e;){n=e;const o=this.compare(t,e.datum);if(0===o)return void(e.datum=t);e=o<0?e.left:e.right}const o=new _p(t);o.parent=n,this.compare(t,n.datum)<0?n.left=o:n.right=o,this.fixInsert(o)}remove(t,n=!1,e){const o=this.find(t);if(void 0===o)return;const r=o.datum;return this.removeNode(o),r}findBounds(t){let n=this.root;const e=[void 0,void 0];for(;n;)this.compare(t,n.datum)>=0?(e[0]=n,n=n.right):(e[1]=n,n=n.left);return e}getMinNode(t){let n=void 0===t?this.root:t;for(;n&&n.left;)n=n.left;return n}getMaxNode(t){let n=void 0===t?this.root:t;for(;n&&n.right;)n=n.right;return n}removeNode(t){let n,e,o=t,r=o.color;void 0===t.left?(n=t.right,e=t.parent,this.transplant(t,t.right)):void 0===t.right?(n=t.left,e=t.parent,this.transplant(t,t.left)):(o=this.getMinNode(t.right),r=o.color,n=o.right,o.parent===t?(e=o,n&&(n.parent=o)):(e=o.parent,this.transplant(o,o.right),o.right=t.right,o.right.parent=o),this.transplant(t,o),o.left=t.left,o.left.parent=o,o.color=t.color),1===r&&this.fixDelete(n,e)}fixInsert(t){let n=t;for(;n.parent&&0===n.parent.color;){const t=n.parent,e=t.parent;if(t===e.left){const o=e.right;0===this.colorOf(o)?(t.color=1,o.color=1,e.color=0,n=e):(n===t.right&&(n=t,this.rotateLeft(n)),n.parent.color=1,e.color=0,this.rotateRight(e))}else{const o=e.left;0===this.colorOf(o)?(t.color=1,o.color=1,e.color=0,n=e):(n===t.left&&(n=t,this.rotateRight(n)),n.parent.color=1,e.color=0,this.rotateLeft(e))}}this.root.color=1}fixDelete(t,n){let e=t,o=n;for(;e!==this.root&&1===this.colorOf(e)&&void 0!==o;)if(e===o?.left){let t=o.right;0===this.colorOf(t)&&(t.color=1,o.color=0,this.rotateLeft(o),t=o.right),1===this.colorOf(t?.left)&&1===this.colorOf(t?.right)?(t&&(t.color=0),e=o,o=e?.parent):(1===this.colorOf(t?.right)&&(t?.left&&(t.left.color=1),t&&(t.color=0,this.rotateRight(t)),t=o.right),t&&(t.color=o.color),o.color=1,t?.right&&(t.right.color=1),this.rotateLeft(o),e=this.root,o=void 0)}else{let t=o?.left;0===this.colorOf(t)&&(t.color=1,o.color=0,this.rotateRight(o),t=o.left),1===this.colorOf(t?.left)&&1===this.colorOf(t?.right)?(t&&(t.color=0),e=o,o=o?.parent):(1===this.colorOf(t?.left)&&(t?.right&&(t.right.color=1),t&&(t.color=0,this.rotateLeft(t)),t=o?.left),t&&(t.color=o.color),o.color=1,t?.left&&(t.left.color=1),this.rotateRight(o),e=this.root,o=void 0)}e&&(e.color=1)}transplant(t,n){void 0===t.parent?this.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n&&(n.parent=t.parent)}rotateLeft(t){const n=t.right;t.right=n.left,n.left&&(n.left.parent=t),n.parent=t.parent,void 0===t.parent?this.root=n:t===t.parent.left?t.parent.left=n:t.parent.right=n,n.left=t,t.parent=n}rotateRight(t){const n=t.left;t.left=n.right,n.right&&(n.right.parent=t),n.parent=t.parent,void 0===t.parent?this.root=n:t===t.parent.right?t.parent.right=n:t.parent.left=n,n.right=t,t.parent=n}colorOf(t){return t?t.color:1}}function Sp(t){const n=new Map;return k(t).forEach(function(t){const e=t.pointOnShape.curve.loop;let o=n.get(e);o||(o=new Mp(zn),n.set(e,o)),o.insert(t)}),n}const{max:Cp}=Math;function yp(t,n=.125,e=50){let o=Q(t.cpNode);for(;!z(o);)o=o.next;const r=bp(o),c=new Set;for(let t=0;t<r.length;t++){const o=r[t];let i=0;for(;i<o.length;){const t=i;for(;(i++,i!==o.length)&&!(Op(t,i,o,e)>n);)c.add(o[i])}}o=function(t,n){const e=n;do{if(t(n))return n;n=n.next}while(n!==e)}(z,o);for(const n of c)Ln(t=>2!==T(t)&&!t.isHoleClosing)(n)||J(n,t.meta);return{cpNode:o,meta:{...t.meta,cpTrees:Sp(o)}}}function Op(t,n,e,o){const r=[],c=Vt(e[t],e[n].next);for(;t<n+1;t++)r.push(mp($t(e[t]),c,o));return Cp(...r)}function Ep(t){const n=k(t);return n.reduce(function(t,n){return t.pointOnShape.circle.radius>=n.pointOnShape.circle.radius?t:n},n[0])}function Ip(t){const n=[],e=k(t);for(const t of e)q(t)&&!t.isHoleClosing&&n.push(t);return n}const Np=function(t,n,e){const o=t.get(n);return void 0!==o&&o.has(e)},kp=function(t,n,e){let o=t.get(n);void 0===o&&(o=new Set,t.set(n,o)),o.add(e)};function Pp(t){let n=t,e=t.prevOnCircle;for(;z(e);)e=e.prevOnCircle;const o=[];do{z(n)||o.push(n),n=n.nextOnCircle}while(n!==e);return o}function Bp(t,n){const e=new Map,o=new Map;return H(t,function(t){const r=o.get(t)||n*t.pointOnShape.circle.radius,c=t.next,i=function(t,n,e=.4,o=16){if(4===n.length)return En(t,n,e,o);if(3===n.length)return Sn(t,n,e,o);if(2===n.length)return en(t,n);if(1===n.length)return 0;throw new Error("The given bezier curve must be of order <= 3.")}([0,1],$t(t)),s=c.pointOnShape.circle.radius;if(r-i>n*s)for(const t of A(c))if(o.set(t,r-i),!c.isHoleClosing){const{center:t}=c.pointOnShape.circle;kp(e,t[0],t[1])}}),e}function Tp(t,n){let e=0;"undefined"!=typeof _debug_&&(e=performance.now());const o=Ep(Q(t.cpNode));!function(t,n){const e=Ip(n);for(;e.length;){const o=e.pop(),{center:r}=o.pointOnShape.circle;if(!Np(t,r[0],r[1])||o.isIntersection)continue;let c=o.prevOnCircle,i=!1;for(;!i;){c=c.next;const{center:e}=c.pointOnShape.circle;if(Np(t,e[0],e[1]))if(Zt(c,n))i=!0;else{if(1===Pp(c).length)continue;i=!0}else{for(;z(c.prevOnCircle);)c=c.prevOnCircle;i=!0}}if(i){const t=c.prevOnCircle;t.next=c,c.prev=t,t.nextOnCircle=c,c.prevOnCircle=t}}}(Bp(o,n),o);const r={cpNode:o,meta:{...t.meta,cpTrees:Sp(o)}};return function(t){"undefined"!=typeof _debug_&&(_debug_.timing.sats=performance.now()-t)}(e),r}const Ap={maxCurviness:.05,maxLength:40,applySat:!0,satScale:2,simplify:!0,simplifyTolerance:2**-4,minBezLength:2**-6,angleIncrement:15},zp={maxCurviness:{range:[.01,3],scaleByMaxCoordinate:!1},maxLength:{range:[1,1024],scaleByMaxCoordinate:!0},angleIncrement:{range:[.1,360],scaleByMaxCoordinate:!1},satScale:{range:[1,1/0],scaleByMaxCoordinate:!1},simplifyTolerance:{range:[2**-20,2**20],scaleByMaxCoordinate:!0},minBezLength:{range:[2**-20,2],scaleByMaxCoordinate:!0}};function Dp(t){return[t[1],-t[0]]}function Lp(t,n){if(!Ht(n))return 0;const e=Ft(n);return e.isDull?-ct(Dp(e.tangents[0]),lt(rt(n.p,t))):0}function qp(t){return t[0]*t[0]+t[1]*t[1]}function Wp(t,n,e){return t[0]*(n[1]*e[2]-n[2]*e[1])-t[1]*(n[0]*e[2]-n[2]*e[0])+t[2]*(n[0]*e[1]-n[1]*e[0])}function jp(t){const n=t[0],e=t[1],o=t[2],r=qp,c=.5*Wp([r(n),n[1],1],[r(e),e[1],1],[r(o),o[1],1]),i=.5*Wp([n[0],r(n),1],[e[0],r(e),1],[o[0],r(o),1]),s=Wp([n[0],n[1],1],[e[0],e[1],1],[o[0],o[1],1]);return[c/s,i/s]}function Fp(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}const Hp=Oo,Yp=le,Rp=hn,Xp=Number.EPSILON;function Qp(t,n){const[e,o]=t,[r,c]=n,i=Oo(e,r),s=Oo(o,c);return hn(le(i,i),le(s,s))[1]}const Vp=Number.EPSILON;function $p(t,n,e){const[o,r]=e,{ps:c}=t,i=[];if(o!==r){const{polyDd:e,polyE:s,getPolyExact:u}=Zf(c,n),f=Je(e,o,r,s,u)||[];i.push(...f.map(e=>{const{tS:o,tE:r,t:i}=e,s=i<0?0:i>1?1:i,u=function(t,n){const e=t[0],o=t[1],r=e[0],c=e[1],i=o[0],s=o[1],u=n[0],f=n[1];let l=1/0,a=-1/0;for(const[t,n]of[[r,c],[r,s],[i,c],[i,s]]){const e=Hp(t,u),o=Hp(n,f),r=Rp(Yp(e,e),Yp(o,o))[1],c=r*(1-Xp),i=r*(1+Xp);c<=l&&(l=c),i>=a&&(a=i)}return[l,a]}(ts(c,[o,r]),n),f=0===s?1:s;return{curve:0===s?t.prev:t,t:f,dSquaredI:u}}))}const s=e.slice();return o===r&&s.push(o),i.push(...s.map(e=>{const o=Qp(To(c,[0,e]).map(t=>t[0]+t[1]),n),r=[o*(1-Vp),o*(1+Vp)],i=0===e?1:e;return{curve:0===e?t.prev:t,t:i,dSquaredI:r}})),i}const{min:Up}=Math,Zp=1+2**-20;function Gp(t,n){const e=t[0],o=t[1],r=e[0],c=e[1],i=o[0],s=o[1],u=n[0],f=n[1];return u<r?f<c?Gs(t[0],n):f>s?Gs([r,s],n):(r-u)**2:u>i?f<c?Gs([i,c],n):f>s?Gs(t[1],n):(u-i)**2:f<c?(c-f)**2:f>s?(f-s)**2:0}const Jp=et(lu);function Kp(t,n){const e=[0,1,2,3].map(e=>function(t,n){const e=Gs,o=n[0],r=n[1],c=e(o,r);if(0==c)return e(t,o);let i=((t[0]-o[0])*(r[0]-o[0])+(t[1]-o[1])*(r[1]-o[1]))/c;return i=Math.max(0,Math.min(1,i)),e(t,[o[0]+i*(r[0]-o[0]),o[1]+i*(r[1]-o[1])])}(n,[t[e],t[(e+1)%4]])),o=Gs(t[0],t[1]),r=Gs(t[0],t[3]);return e[0]<=r&&e[2]<=r&&e[1]<=o&&e[3]<=o?0:Math.min(...e)}const th=et(hu);function nh(t,n){return To(t,[0,n])}function eh(t,n){t=function(t,n){const e=function(t,n){let e=1/0;for(let o=0;o<t.length;o++){const r=t[o],{curve:{ps:c},ts:i}=r,s=Ke(c,i[0]),u=Ke(c,i[1]);e=Up(e,Gs(n,s),Gs(n,u))}return Zp*e}(t,n);return t=function(t,n,e){const o=[];for(let r=0;r<t.length;r++){const c=t[r],{ps:i}=c.curve;Gp(Jp(i),n)<=e&&o.push(c)}return o}(t,n,e),t=function(t,n,e){const o=[];for(let r=0;r<t.length;r++){const c=t[r],i=c.curve.ps;Kp(th(i),n)<=e&&o.push(c)}return o}(t,n,e),t}(t,n);const e=[];for(let o=0;o<t.length;o++){const r=t[o],c=$p(r.curve,n,r.ts);e.push(...c)}let o=1/0;for(let t=0;t<e.length;t++){const n=e[t].dSquaredI[1];n<o&&(o=n)}const r=[];for(let t=0;t<e.length;t++){const n=e[t];n.dSquaredI[0]<=o&&r.push(n)}return r.map(t=>{const{curve:n,t:e}=t,{ps:o}=n,r=nh(o,e);return{curve:n,t:e,isSource:!1,p:r.map(t=>t[0]+t[1]),pDd:r}})}function oh(t,n){return n.map(n=>eh(n,t)[0])}function rh(t,n){return[n*t[0],n*t[1]]}function ch(t,n,e){const o=Fp(e);let r,c,i,s,u=1,f=0;do{c=ft(rh(e,u),n),i=t.map(t=>eh(t,n)[0]),s=Fp(rt(c,jp(i.map(t=>t.p)))),r=s<o,u/=2,f++}while(!r&&f<3);return{newX:c,newV:s,newPoss:i}}const{min:ih,abs:sh,asin:uh}=Math;function fh(t,n,e,o,r){const c=2**(r-32),i=[t[0],t[n],t[t.length-1]],s=[o[0],o[n],o[t.length-1]],u=[[i[0],i[1],i[2]],[i[1],i[2],i[0]],[i[2],i[0],i[1]]][e],f=[[s[0],s[1],s[2]],[s[1],s[2],s[0]],[s[2],s[0],s[1]]][e];if(W(u[0][0]))return;let l,a=0,p=function(t,n){const e=t[0][0].pointOnShape.circle.center,o=eh(n[1],e)[0];return jp([t[0][0].pointOnShape.p,o.p,t[2][1].pointOnShape.p])}(u,f),h=1/0;for(;h>c&&a<10;){if(a++,l=oh(p,f),!Number.isFinite(p[0])||!Number.isFinite(p[1]))return;const t=jp(l.map(t=>t.p)),n=rt(p,t);if(!Number.isFinite(n[0])||!Number.isFinite(n[1]))return;const e=ch(f,p,n);p=e.newX,l=e.newPoss;const o=Fp(n);h=sh(o-e.newV)}const d=(nn(p,l[0].p)+nn(p,l[1].p)+nn(p,l[2].p))/3,v={center:p,radius:d};let g=0;for(let t=0;t<3;t++){const n=l[t],e=lt(rt(n.p,p)),o=it(e);if(Ht(n)&&Ft(n).isDull){const t=jt(n.curve.ps,n.curve.next.ps).tangents.map(it),o=uh(st(t[0],e)),r=uh(st(e,t[1]));let c=0;o>0&&(c+=o),r>0&&(c+=r),g+=c}else{const t=lt(ht(n.curve.ps,n.t));g+=sh(uh(st(o,t)))}}const m=[];for(let t=0;t<o.length;t++){const n=eh(o[t],p)[0];m.push(nn(n.p,p))}const x=ih(...m);return{threeProngInfo:{poss:l,circle:v,δ3s:u},error:1*sh(d-x)+1*g}}function lh(t){let n=t[0];const e=t[1],o=[];let r=!0;do{const t=n.pointOnShape,e=n.next.pointOnShape,c=t.curve,i=e.curve;if(r)if(r=!1,i===c&&An(e,t)>0)o.push({curve:c,ts:[t.t,e.t]}),n=n.next;else{if(c.loop===i.loop){const n={curve:c,ts:[t.t,1]};o.push(n),ah(o,c,i,e.t)}n=n.next}else r=!0,n=n.prevOnCircle}while(n!==e);return o}function ah(t,n,e,o){let r=n;do{r=r.next;const n=r===e?o:1;t.push({curve:r,ts:[0,n]})}while(r!==e)}function ph(t,n,e,o){const r={...n,order:e,order2:o},c=t.findBounds({pointOnShape:r});if(void 0!==c[0]||void 0!==c[1])return void 0===c[0]||void 0===c[1]?t.getMaxNode()?.datum:c[0].datum}function hh(t,n,e,o,r,c,i){if(void 0!==c&&!function(t,n,e){const o=An(n,e.pointOnShape);if(o<0)return!0;if(0===o)return!1;const r=t.getMinNode();if(void 0===r)return!0;const c=r.datum;return An(t.getMaxNode().datum.pointOnShape,n)<0&&c===e}(o,r,c.next)&&!t)return;const s={pointOnShape:r,isHoleClosing:n,isIntersection:e,id:i.id,next:void 0,prev:void 0,nextOnCircle:void 0,prevOnCircle:void 0};i.id++;const u=void 0===c?s:c,f=void 0===c?s:u.next;return f.prev=s,u.next=s,s.prev=u,s.next=f,o.insert(s),s}function dh(t,n,e,o,r,c,i){const{cpTrees:s}=r;let u=!1;const f=c.map((c,f)=>{const l=o[f],a=s.get(c.curve.loop),p={...c,circle:e,order:l,order2:0},h=void 0===i?ph(a,c,l,0):i[f],d=hh(t,n,!1,a,p,h,r.lastInsertId);return void 0===d&&(u=!0),d});return u||function(t,n){n=n.slice().sort(function(t){const n=t.center;return function(t,e){let o=t.pointOnShape.p,r=e.pointOnShape.p;o=[o[0]-n[0],o[1]-n[1]],r=[r[0]-n[0],r[1]-n[1]];const c=Math.atan2(o[1],o[0]);return Math.atan2(r[1],r[0])-c}}(t));const e=n.length;for(let t=0;t<e;t++){const o=n[t];o.nextOnCircle=n[(t+1)%e],o.prevOnCircle=n[(t-1+e)%e]}}(e,f),{anyFailed:u,cpNodes:f}}const vh=Math.cos(Math.PI/180*1);function gh(t,n,e,o,r,c){const{cpTrees:i,maxCoordPowerOf2:s}=t,u=2**(s-40),f=2**(s-46),l=ph(i.get(n.curve.loop),n,o,r);if(!l)return;const a=[l,l.next],{p,t:h}=n;for(const t of a){const n=t.pointOnShape.p,o=nn(p,n);if(!(o>u)&&(ct(lt(rt(n,t.pointOnShape.circle.center)),lt(rt(p,e.center)))>vh||o<f&&0!==h&&1!==h))return t}}function mh(t,n){const e=[];for(const t of n)e.push([t,t.next]);const o=function(t,n){const e=t.map(lh);let o,r=1/0;for(let c=1;c<t.length-1;c++)for(let i=0;i<3;i++){const s=fh(t,c,i,e,n);if(void 0===s)continue;const{error:u,threeProngInfo:f}=s;u<r&&(r=u,o=f)}return o}(e,t.maxCoordPowerOf2),{circle:r,poss:c,δ3s:i}=o,s=[];for(let t=0;t<3;t++)s.push(Lp(r.center,c[t]));const u=[];for(let n=0;n<c.length;n++){const e=gh(t,c[n],r,s[n],0);void 0!==e&&T(e)<=2&&!e.isHoleClosing&&u.push(e)}return{closeBysFor3Prong:u,cpNodes:0===u.length?dh(!0,!1,r,s,t,c,i.map(t=>t[0])).cpNodes:[]}}let xh,wh=0;function bh(t,n){if(Yt(n.pointOnShape))return{closeBysFor3Prong:void 0,addedCpNodes:[]};const e=[];for(;;){if(void 0===n)continue;const o=F(n);if(o.length<=2)break;const{closeBysFor3Prong:r,cpNodes:c}=mh(t,o);if(e.push(c),r.length>0)return{closeBysFor3Prong:r,addedCpNodes:e};if("undefined"!=typeof _debug_&&++wh===_debug_.directives.stopAfterThreeProngsNum)return}return{closeBysFor3Prong:void 0,addedCpNodes:e}}function _h(t){for(const n of t)return n}function Mh(t,n,e,o){const r=n[0];A(r).forEach(t=>{e.delete(t),o.delete(t)}),J(r,t)}function Sh(t,n,e){const o=new Map;for(let r=0;r<n.length;r++){const c=new Mp(zn);o.set(t[r],c);const i=n[r];let s,u;for(const t of i){const n={center:t.p,radius:0},{curve:o}=t,r={...t,curve:o,t:1,circle:n,order:-1,order2:0},i={...t,curve:o.next,t:0,circle:n,order:1,order2:0};s=hh(!0,!1,!1,c,r,u,e),u=hh(!0,!1,!1,c,i,s,e),s.prevOnCircle=u,u.prevOnCircle=s,s.nextOnCircle=u,u.nextOnCircle=s}}return o}function Ch(t){const n=[],e=[],o=[],r=[],c=[];for(const i of t)for(const t of i.curves){const i=t.ps,s=vu(i,!0);o.push(s);const u=Jp(i);n.push(u);const f=hu(i);e.push(f);const l=jt(t.ps,t.next.ps);l.isQuiteSharp?r.push(t):l.isQuiteDull&&c.push(t)}return{looseBoundingBoxes:n,tightBoundingBoxes:e,boundingHulls:o,sharpCorners:r,dullCorners:c}}function yh(t){return n=>{const e=[];for(let o=0;o<n.curves.length;o++){const r=n.curves[o];if(!(au(r.ps)<t)&&jt(r.ps,r.next.ps).isQuiteSharp){const{ps:t}=r,n=t[t.length-1],o=[[0,n[0]],[0,n[1]]];e.push({curve:r,t:1,isSource:!0,p:n,pDd:o})}}return e}}function Oh(t,n){let e=[0,0];for(let o=0;o<t.length;o++)e=hn(t[o],ie(n,e));return e}const Eh=Oo,Ih=ie,Nh=hn,kh=Eo,Ph=oa;function Bh(t){if(4===t.length)return function(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[Nh(Eh(s,n),Ih(3,Eh(o,c))),Ih(3,kh(Ph(c,n),-2*o)),Ih(3,Eh(o,n)),[0,n]],[Nh(Eh(u,e),Ih(3,Eh(r,i))),Ih(3,kh(Ph(i,e),-2*r)),Ih(3,Eh(r,e)),[0,e]]]}(t);if(3===t.length)return function(t){const[[n,e],[o,r],[c,i]]=t;return[[kh(Ph(c,n),-2*o),Eh(2*o,2*n),[0,n]],[kh(Ph(i,e),-2*r),Eh(2*r,2*e),[0,e]]]}(t);if(2===t.length)return function(t){const[[n,e],[o,r]]=t;return[[Eh(o,n),[0,n]],[Eh(r,e),[0,e]]]}(t);if(1===t.length)return function(t){const[[n,e]]=t;return[[[0,n]],[[0,e]]]}(t);throw new Error("The given bezier curve must be of order <= cubic.")}const Th=ie,Ah=hn,zh=le,Dh=Xo,Lh=kf,qh=fr,Wh=qo,jh=Oo,Fh=hn,Hh=le,Yh=Xo,Rh=kf,Xh=fr,Qh=qo,Vh=ie,$h=hn,Uh=le,Zh=Xo,Gh=kf,Jh=fr,Kh=qo,td=hn,nd=le,ed=fr,od=qo;function rd(t,n,e){const[o,r]=t,[c,i]=n,[s,u]=e,f=od(o,s),l=od(r,u);return{a0:td(nd(ed(c),f),nd(ed(i),l)),b0:td(nd(f,f),nd(l,l))}}const cd=[,,function(t,n,e){const[o,r]=t,[c,i]=n,[[s,u],[f,l]]=e,a=jh(f,s),p=jh(l,u),h=Qh(o,s),d=Qh(r,u),v=Fh(Hh(c,a),Hh(i,p)),g=Yh(Fh(Hh(a,a),Hh(p,p))),m=Fh(Hh(a,h),Hh(p,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c),i),a=sd(ud(o,o),ud(c,c)),p=sd(ud(o,r),ud(c,i)),h=sd(ud(o,f),ud(c,l)),d=ld(sd(ud(s,o),ud(u,c)));return{A:[fd(d)],B:[a,ld(h),sd(ud(f,f),ud(l,l))],H:[ud(a,d),ud(d,sd(id(t,a),p))]}}(p,e,l):function(t,n,e){const[o,r]=n,[[c,i,s],[u,f,l]]=Bh(e),a=pd(hd(o,c),hd(r,u)),p=pd(hd(o,i),hd(r,f)),h=pd(hd(o,s),hd(r,l)),d=pd(hd(c,c),hd(u,u)),v=pd(hd(c,i),hd(u,f)),g=pd(hd(c,s),hd(u,l)),m=pd(hd(i,i),hd(f,f)),x=pd(hd(i,s),hd(f,l)),w=pd(hd(s,s),hd(l,l)),b=ad(t,pd(ad(t,pd(ad(t,a),p)),h)),_=ad(t,pd(ad(t,pd(ad(t,d),v)),g)),M=ad(t,pd(ad(t,pd(ad(t,v),m)),x)),S=ad(3,a),C=gd(p),y=pd(C,ad(t,S)),O=ad(-3,d),E=ad(-5,v),I=pd(ad(-4,g),vd(m)),N=pd(ad(-3,x),ad(3,_)),k=pd(dd(w),gd(M)),P=O,B=pd(E,ad(t,P)),T=pd(I,ad(t,B)),A=pd(N,ad(t,T)),z=pd(k,ad(t,A)),D=vd(a),L=vd(p),q=d,W=gd(v),j=pd(gd(g),m),F=pd(gd(x),vd(_)),H=pd(w,vd(M)),Y=D,R=pd(L,gd(ad(t,Y))),X=q,Q=pd(W,gd(ad(t,X))),V=pd(j,ad(t,pd(gd(Q),dd(ad(t,X))))),$=pd(F,ad(t,pd(gd(V),dd(ad(t,Q))))),U=pd(H,ad(t,pd(gd($),dd(ad(t,V))))),Z=ad(3,hd(a,d)),G=gd(gd(pd(hd(a,v),hd(p,d)))),J=pd(pd(hd(a,j),ad(6,hd(p,v))),ad(5,hd(h,d))),K=pd(pd(gd(hd(p,j)),ad(8,hd(h,v))),dd(ad(6,hd(b,d)))),tt=pd(pd(dd(hd(a,H)),hd(p,F)),pd(ad(3,hd(h,j)),dd(ad(10,hd(b,v))))),nt=Z,et=pd(G,gd(gd(ad(t,nt)))),ot=pd(J,ad(t,pd(gd(gd(et)),dd(ad(6,ad(t,nt)))))),rt=pd(K,ad(t,pd(gd(gd(ot)),ad(t,pd(ad(-6,et),gd(gd(ad(t,nt))))))));return{A:[Y,R],B:[X,Q,V,$,U],C:[S,y],D:[P,B,T,A,z],H:[nt,et,ot,rt,pd(tt,ad(t,pd(gd(gd(rt)),ad(t,pd(ad(-6,ot),ad(t,pd(gd(gd(et)),dd(ad(t,nt)))))))))]}}(p,e,l):function(t,n,e){if(1===e.length){const{a0:o,b0:r}=rd(t,n,e[0]);return{A:[o],B:[r],C:[],D:[],H:[]}}return cd[e.length](t,n,e)}(d,e,l);x=Je(r,u,f)||[];for(let r=0;r<x.length;r++){const c=x[r],{tS:i,tE:l,t:a}=c;if(c.multiplicity>1)continue;if(l<u||i>f)continue;if(i<0)continue;const p=l>1?1:a,d=Oh(n,p),v=Oh(o,p),g=d[0]+d[1],_=v[0]+v[1],M=xd(g);if(wd(M)<2**-40)continue;const S=-_/g;if(S<=0)continue;const C=[bd(S,e[0]),bd(S,e[1])],y=[C[0][1],C[1][1]],O=md(qp(y));if(O<=2**(t-40))continue;const E=[h[0]+y[0],h[1]+y[1]];c.tS<=u&&c.tE>=u&&(w=!0),c.tS<=f&&c.tE>=f&&(b=!0);const I=0===p?1:p,N={curve:0===p?s.prev:s,s:I,d:O,x:E};m.push(N)}}const _=l[l.length-1];let M=0===p&&s===a.prev||1===p&&s===a;const S=[];if(0===u);else if(1===u)M||w||S.push({P:_,t:1});else if(!w){const t=Ke(l,u);S.push({P:t,t:u})}if(u!==f)if(0===f);else if(1===f)M||b||(S.push({P:_,t:1}),M=!0);else if(!b){const t=Ke(l,f);S.push({P:t,t:f})}for(let t=0;t<S.length;t++){const{P:n,t:o}=S[t],{a0:r,b0:c}=rd(d,e,n);if(xd(r[1])<=2**-40||xd(c[1])<=2**-40)continue;const i=-c[1]/r[1];if(i<2**-40)continue;const u=[bd(i,e[0]),bd(i,e[1])],f=[u[0][1],u[1][1]],l=md(qp(f)),a=[h[0]+f[0],h[1]+f[1]],p=0===o?1:o,v={curve:0===o?s.prev:s,s:p,d:l,x:a};m.push(v)}return m}function Md(t,n,e){const[o,r]=t,[c,i]=n,[s,u]=e,f=o-s,l=r-u;return{a0:2*(c*f+i*l),b0:f*f+l*l}}const{abs:Sd}=Math,Cd=1+2**-20,yd=1+2**-20,Od=et(hu),Ed=pn,Id=hn,Nd=dn,kd=ce,{acos:Pd}=Math,Bd=oa,Td=Oo,Ad=ie,zd=hn,Dd=Eo;function Ld(t){if(4===t.length)return function(t){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[Ad(3,zd(Td(s,n),Ad(3,Td(o,c)))),Ad(6,Dd(Bd(c,n),-2*o)),Ad(3,Td(o,n))],[Ad(3,zd(Td(u,e),Ad(3,Td(r,i)))),Ad(6,Dd(Bd(i,e),-2*r)),Ad(3,Td(r,e))]]}(t);if(3===t.length)return function(t){const[[n,e],[o,r],[c,i]]=t;return[[Dd(Bd(2*c,2*n),-4*o),Td(2*o,2*n)],[Dd(Bd(2*i,2*e),-4*r),Td(2*r,2*e)]]}(t);if(2===t.length)return function(t){const[[n,e],[o,r]]=t;return[[Td(o,n)],[Td(r,e)]]}(t);if(1===t.length)return[[[0,0]],[[0,0]]];throw new Error("The given bezier curve must be of order <= 3.")}const qd=Oo,Wd=hn,jd=ie,Fd=Eo;function Hd(t){if(4===t.length){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[jd(6,Wd(qd(s,n),jd(3,qd(o,c)))),jd(6,Fd(qd(c,2*o),n))],[jd(6,Wd(qd(u,e),jd(3,qd(r,i)))),jd(6,Fd(qd(i,2*r),e))]]}if(3===t.length){const[[n,e],[o,r],[c,i]]=t;return[[Fd(qd(2*c,4*o),2*n)],[Fd(qd(2*i,4*r),2*e)]]}if(t.length<=2)return[[[0,0]],[[0,0]]];throw new Error("The given bezier curve must be of order <= 3.")}const Yd=le,Rd=hn,Xd=dn;const{sqrt:Qd}=Math;function Vd(t,n,e){const{curve:o,p:r,t:c}=n,{ps:i}=o,s=1/t,u=function(t,n){const[e,o]=function(t,n){const[e,o]=Ld(t),[r,c]=Hd(t),i=Oh(e,n),s=Oh(o,n),u=Oh(r,n),f=Oh(c,n),l=Xd(Yd(i,f),Yd(s,u)),a=Rd(Yd(i,i),Yd(s,s));return[l,ia(Yd(a,Yd(a,a)))]}(t,n);return es(e,o)}(i,c),f=-(u[0]+u[1]),l=f<s?s:f,[a,p]=e,h=Qd(a*a+p*p)*l;return[[r[0]+a/h,r[1]+p/h],1/l]}const{sqrt:$d}=Math,{abs:Ud,sin:Zd,cos:Gd,max:Jd,sqrt:Kd}=Math;function tv(t){const{loops:n,maxCoordPowerOf2:e,squaredDiagonalLength:o}=t,c=(2**(e-21))**2,i=2**(e-46),s=Kd(o),u=2**(e-32);return function(o,f,l,a){const{curve:{loop:p,ps:h},t:d,p:v}=a,g=function(t,n){const[e,o]=Ld(t),r=Oh(o,n);return[[-r[0],-r[1]],Oh(e,n)]}(h,d),m=[-g[0][1],-g[1][1]],x=o?[0,-s]:0!==l?r(Zd(l),Gd(l))(m):m,w=o||0!==l?[[0,x[0]],[0,x[1]]]:[[-g[0][0],-g[0][1]],[-g[1][0],-g[1][1]]];let[b,_]=function(t,n,e,o,r){let c,i;const{p:s}=o;if(n)return[[s[0],s[1]-e],e];if(0===t)return Vd(e,o,r);const{p:u}=o,[f,l]=r,a=e/$d(f*f+l*l),p=[f*a,l*a];return c=[u[0]+p[0],u[1]+p[1]],i=e,[c,i]}(l,o,s,a,x);const M=function(t,n,e,o,r,c,i){const{cpTrees:s}=r;if(n)return o.filter(t=>t!==e).flatMap(t=>t.curves.map(t=>({curve:t,ts:[0,1]})));const u=Ht(c)&&Ft(c).isDull?1===c.t&&0===t?-1:0===c.t?1:Lp(i,c):0,f=ph(s.get(e),c,u,0);return f&&f!==f.next.next?lh([f,f]):e.curves.map(t=>({curve:t,ts:[0,1]}))}(l,o,p,n,t,a,b),S=function(t,n,e,o,r){let c=n**2,i=[o[0]+r[0],o[1]+r[1]];for(let t=0;t<e.length;t++){const n=e[t],{ps:s}=n.curve,u=s[0],f=s[s.length-1];for(const t of[u,f]){if(Gs(i,t)>c)continue;const{a0:n,b0:e}=Md(o,r,t);if(Sd(n)<=2**-40||Sd(e)<=2**-40)continue;const s=-e/n;if(s<2**-40)continue;const u=[s*r[0],s*r[1]],f=qp(u);f<c&&(c=f,i=[o[0]+u[0],o[1]+u[1]])}}return Cd*c}(0,_,M,v,x),C=Kd(S),y=Kd(x[0]**2+x[1]**2);b=[v[0]+x[0]/y*C,v[1]+x[1]/y*C],function(t,n,e){if(t.length<=2)return t;let o=0;for(let r=0;r<t.length;r++){const c=t[r],{ps:i}=c.curve;Gp(Jp(i),n)<=yd*e&&Kp(Od(i),n)<=yd*e&&(t[o]=c,o++)}t.length=o}(M,b,S);const O=function(t,n,e,o,r,c,i){const s=[];for(let n=0;n<i.length;n++){const u=_d(t,0,e,o,r,c,i[n]);s.push(...u)}let u=1/0;for(let t=0;t<s.length;t++){const n=s[t].d*(1+2**-46);n<u&&(u=n)}const f=[];for(let t=0;t<s.length;t++){const n=s[t];n.d*(1-2**-46)<=u&&f.push(n)}return f}(e,0,w,a,f,l,M);if(1!==O.length){if(0===O.length)return void(o&&console.log(a));if(!o&&!function(t,n){const{curve:e,s:o,x:r}=t[0],c=2**(n-40);for(let n=1;n<t.length;n++){const{x:e}=t[n];if(Ud(r[0]-e[0])>c||Ud(r[0]-e[0])>c)return!1}return!0}(O,e))return}const{x:E,d:I,curve:N,s:k}=O[0];if(f&&_<(1-u)*I)return void function(t,n,e,o){if(Ht(o)&&Ft(o).isDull)return;const r={radius:n,center:e};gh(t,o,r,Lp(r.center,o),0)||dh(!1,!1,r,[-.5,.5],t,[o,o])}(t,_,b,a);const P=nh(N.ps,k),B={curve:N,t:k,isSource:!1,p:P.map(t=>t[0]+t[1]),pDd:P},T={center:E,radius:I},A=Qp(a.p,B.p),z=Qp(E,B.p);if(!o){if(0===A)return;if(A<=Jd(function(t,n,e){if(n+e>=t)return 1/0;const o=Oo(t,n),r=kd(n,o),c=t-n,i=n*c,s=(i-n*e-e*e/2)/(i+c*e),u=es(Nd(Nd(r,Ed(n,e)),Ed(e,e/2)),Id(r,kd(e,o)))[1];return Pd(s),n*Pd(u)}(_,Kd(z),4*i),c))return}return{circle:T,z:B}}}function nv(t,n,e,o,r){e=0===e.t?{...e,curve:e.curve.prev,t:1}:e;const c=Lp(n.center,e),i=Lp(n.center,o),s={...o,circle:n,order:i,order2:0},u={...e,circle:n,order:c,order2:0};if(gh(t,e,n,c,0))return;if(gh(t,o,n,i,0))return;const{anyFailed:f,cpNodes:l}=dh(r,r,n,[c,i],t,[u,s]);if(!f)return r&&function(t,n){const{cpTrees:e}=t,[o,r]=n,c=r.pointOnShape,i=hh(!0,!0,!1,e.get(c.curve.loop),{...c,order2:1},r,t.lastInsertId);i.holeCloserTwin=r,r.holeCloserTwin=i;const s=o.pointOnShape,u=hh(!0,!0,!1,e.get(s.curve.loop),{...o.pointOnShape,order2:-1},o.prev,t.lastInsertId);u.holeCloserTwin=o,o.holeCloserTwin=u,u.prevOnCircle=i,u.nextOnCircle=i,i.prevOnCircle=u,i.nextOnCircle=u,r.next=o,o.prev=r,u.next=i,i.prev=u}(t,l),l[0];l.forEach(n=>{void 0!==n&&G(n,t)})}const{PI:ev,atan2:ov}=Math;function rv(t,n,e,o){let r;const c=tv(t),i=n*ev/180;for(let n=0;n<e.length;n++){const s=e[n],u=cv(i,s);for(const e of u){const i=c(!1,o,e,s);if(i){const{circle:n,z:e}=i,o=nv(t,n,s,e,!1);r=r||o}if("undefined"!=typeof _debug_&&n+1===_debug_.directives.stopAfterTwoProngsNum)return}}return r}function cv(t,n){const e=[0];if(1===n.t){const{curve:o}=n,r=jt(o.ps,o.next.ps);if(r.isQuiteDull){const n=Dp(r.tangents[0]),o=Dp(r.tangents[1]),c=(ov(n[1],n[0])+2*ev)%(2*ev),i=((ov(o[1],o[0])+2*ev)%(2*ev)-c+2*ev)%(2*ev);let s=t;for(;s<=i-t/2;)e.push(s),s+=t}}return e}function iv(t,n,e,o){let r;for(let c=0;c<e.length;c++){const i=rv(t,n,e[c],o);r=void 0===r?i:r}return r}function sv(t,n=.4,e=10,o=2**-16){const r=[0],c=[1];for(;;){const i=r[r.length-1],s=c[c.length-1],u=U(t,i,s),f=au(u),l=wn(u);if(f<=e&&l<=n||s-i<=o){if(r.push(c.pop()),1===s)return r;continue}const a=(i+s)/2;c.push(a)}}function uv(t){if(t.length<4)return[];const[[n,e],[o,r],[c,i],[s,u]]=t,f=o-n,l=r-e,a=c-o-f,p=i-r-l,h=s-c-f-2*a,d=u-i-l-2*p,v=a*d-p*h,g=f*d-l*h,m=f*p-l*a;return Je([v,g,m],0,1)?.map(t=>t.t)||[]}function fv(t,n,e){return function(o){const r=[],c=o.curves;for(let o=0;o<c.length;o++){const i=c[o],s=i.ps;if(au(s)<t)continue;let u=sv(s,n,e);u=2===u.length?[.5]:u,u.push(...uv(s)),u=u.filter(t=>0!==t&&1!==t);const f=u.map(t=>{const n=nh(i.ps,t),e=n.map(t=>t[0]+t[1]);return{curve:i,t,isSource:!0,p:e,pDd:n}});r.push(...f)}return r}}const lv=Oo,av=hn,pv=ie,hv=fr,dv=hf,vv=ie,gv=le,mv=hn,xv=dn;const wv=Oo,bv=ie,_v=le,Mv=hn,Sv=dn;function Cv(t){if(Rs(t))return{minima:[],maxima:[],inflections:[]};if(4===t.length&&ou(t)&&(t=Uc(t)),3===t.length){const n=function(t){const[[n,e],[o,r],[c,i]]=t,s=wv(o,n),u=wv(c,o),f=Sv(u,s),l=wv(r,e),a=wv(i,r),p=Sv(a,l),h=Mv(Sv(bv(n,Sv(f,[0,o])),bv(o,Sv(u,[0,o]))),Sv(bv(e,Sv(p,[0,r])),bv(r,Sv(a,[0,r]))));return[Mv(_v(f,f),_v(p,p)),Xo(h)]}(t);return{minima:[],maxima:Je(n,0,1)?.map(t=>t.t)||[],inflections:[]}}const n=function(t){const[[n,e,o],[r,c,i]]=Ld(t),[[s,u],[f,l]]=Hd(t),[[a],[p]]=function(t){if(4===t.length){const[[n,e],[o,r],[c,i],[s,u]]=t;return[[pv(6,av(lv(s,n),pv(3,lv(o,c))))],[pv(6,av(lv(u,e),pv(3,lv(r,i))))]]}if(t.length<=3)return[[[0,0]],[[0,0]]];throw new Error("The given bezier curve must be of order <= 3.")}(t),h=gv(a,c),d=gv(p,e),v=gv(u,i),g=gv(u,c),m=gv(f,f),x=gv(s,i),w=gv(l,o),b=gv(l,e),_=gv(f,o),M=gv(o,e),S=gv(o,n),C=gv(o,r),y=gv(e,e),O=gv(e,n),E=gv(e,c),I=gv(n,i),N=gv(n,r),k=gv(n,n),P=gv(i,c),B=gv(i,r),T=gv(c,c),A=gv(c,r),z=gv(r,r),D=xv(gv(a,i),gv(p,o)),L=xv(h,d),q=mv(gv(u,o),gv(l,i)),W=mv(mv(gv(u,e),gv(s,o)),mv(gv(l,c),gv(f,i))),j=xv(v,w),F=xv(mv(g,x),mv(b,_)),H=mv(gv(o,o),gv(i,i)),Y=mv(M,P),R=mv(E,I),X=mv(B,T),Q=mv(S,y),V=mv(gv(e,r),gv(n,c)),$=xv(k,z),U=xv(O,A),Z=mv(C,E),G=xv(M,P),J=mv(gv(o,c),gv(e,i)),K=mv(B,X),tt=mv(S,Q),nt=mv(C,R),et=mv(E,R),ot=xv(tt,K),rt=mv(R,I),ct=mv(Z,I),it=mv(fr(b),_),st=gv(k,xv(h,vv(3,d))),ut=gv(z,xv(vv(3,h),d)),ft=fr(mv(gv(N,mv(xv(gv(a,e),gv(p,c)),vv(3,xv(gv(l,f),gv(u,s))))),vv(3,gv(gv(s,f),U)))),lt=vv(3,mv(gv(V,xv(m,gv(s,s))),gv($,mv(gv(u,f),gv(l,s))))),at=mv(mv(st,ut),mv(ft,lt)),pt=gv(a,mv(gv(r,mv(tt,vv(3,X))),gv(n,et))),ht=gv(p,mv(mv(gv(o,mv(vv(3,k),z)),gv(e,mv(vv(3,O),hv(A)))),gv(n,K))),dt=vv(3,mv(mv(gv(u,mv(xv(gv(l,$),gv(u,N)),hv(xv(gv(f,U),gv(s,V))))),gv(s,xv(mv(hv(gv(l,U)),gv(f,mv(hv(xv(S,B)),xv(y,T)))),gv(s,ct)))),mv(gv(l,mv(gv(l,N),hv(gv(f,V)))),gv(m,nt)))),vt=mv(xv(pt,ht),dt),gt=gv(a,mv(mv(hv(gv(o,V)),gv(e,rt)),gv(c,mv(dv(B),K)))),mt=gv(p,mv(mv(hv(gv(o,mv(vv(3,O),A))),gv(e,mv(y,hv(B)))),gv(c,rt))),xt=vv(3,mv(mv(gv(u,xv(mv(hv(xv(gv(l,U),gv(s,ct))),gv(f,ot)),gv(u,V))),gv(s,xv(hv(gv(f,G)),gv(s,J)))),mv(gv(l,mv(mv(gv(l,V),hv(gv(f,nt))),gv(s,ot))),gv(m,J)))),wt=mv(xv(gt,mt),xt),bt=gv(a,mv(gv(o,mv(C,hv(R))),gv(i,mv(y,vv(3,X))))),_t=gv(p,mv(gv(o,mv(vv(3,Q),K)),gv(i,et))),Mt=vv(3,mv(mv(gv(u,mv(xv(gv(l,ot),gv(u,nt)),hv(xv(gv(f,G),gv(s,J))))),gv(s,xv(gv(o,xv(it,gv(s,i))),gv(i,mv(hv(gv(l,c)),gv(f,i)))))),mv(gv(l,mv(gv(l,R),gv(o,mv(hv(gv(f,c)),gv(l,r))))),gv(f,gv(i,it))))),St=mv(xv(bt,_t),Mt),Ct=xv(mv(gv(H,L),hv(gv(Y,D))),vv(3,mv(gv(q,F),gv(W,j)))),yt=xv(gv(D,H),vv(3,gv(q,j)));return{inflectionPoly:[xv(gv(s,r),gv(f,n)),xv(mv(gv(u,r),gv(s,c)),mv(gv(l,n),gv(f,e))),xv(mv(g,x),mv(b,_)),xv(v,w)],otherExtremaPoly:[at,vt,wt,St,Ct,yt]}}(t),e=n.inflectionPoly,o=n.otherExtremaPoly,r=Je(o,0,1)?.map(t=>t.t)||[],c=function(t){const n=t.length-1;if(n<=0)return[];const e=new Array(n);for(let o=0;o<n;o++)e[o]=ie(n-o,t[o]);return e}(o),i=[],s=[];for(let t=0;t<r.length;t++){const n=r[t],o=ye(c,n);St(wt(ye(e,n),o))>=0?i.push(n):s.push(n)}return{minima:i,maxima:s,inflections:Je(e,0,1)?.map(t=>t.t)||[]}}function yv(t){const{curve:n,t:e}=t,{ps:o}=n,r=nh(o,e),c=r.map(t=>t[0]+t[1]);return{curve:n,t:t.t,isSource:!0,p:c,pDd:r}}function Ov(t,n,e,o,r){(r&&(o>t.val||o===t.val&&e>t.t)||!r&&(o<t.val||o===t.val&&e>t.t))&&(t.curve=n,t.t=e,t.val=o)}const Ev=et(function(t){const n=[{curve:void 0,t:void 0,val:1/0},{curve:void 0,t:void 0,val:1/0}],e=[{curve:void 0,t:void 0,val:-1/0},{curve:void 0,t:void 0,val:-1/0}];return t.curves.forEach(function(t){const o=to(t.ps);for(let r=0;r<2;r++)Ov(n[r],t,o.ts[0][r],o.box[0][r],!1),Ov(e[r],t,o.ts[1][r],o.box[1][r],!0)}),{minX:yv(n[0]),minY:yv(n[1]),maxX:yv(e[0]),maxY:yv(e[1])}});function Iv(t){return Ev(t).minY}function Nv(t){const{loops:n}=t,e=n.map(Iv);let o;const r=tv(t);for(let n=1;n<e.length;n++){const c=e[n],i=r(!0,!1,0,c);if(!i)throw new Error("Unable to find hole-closing 2-prong");const{circle:s,z:u}=i,f=nv(t,s,c,u,!0);o=void 0===o?f:o}return o}const kv=et(function(t){let n,e,o,r,c=1/0,i=-1/0,s=1/0,u=-1/0;for(const f of t){const t=Ev(f);t.minX.p[0]<c&&(n=t.minX,c=t.minX.p[0]),t.maxX.p[0]>i&&(e=t.maxX,i=t.maxX.p[0]),t.minY.p[1]<s&&(o=t.minY,s=t.minY.p[1]),t.maxY.p[1]>u&&(r=t.maxY,u=t.maxY.p[1])}return{minX:n,minY:o,maxX:e,maxY:r}});function Pv(t,n,e){"undefined"!=typeof _debug_&&(xh=performance.now());const{minBezLength:o,maxCurviness:r,maxLength:c,angleIncrement:i}=e,s=yh(o),u=function(t){return n=>{const e=[];for(let o=0;o<n.curves.length;o++){const r=n.curves[o];if(au(r.ps)<t)continue;const{next:c,ps:i}=r;if(jt(i,c.ps).isQuiteDull){const t=i[i.length-1],n=[[0,t[0]],[0,t[1]]];e.push({curve:r,t:1,isSource:!0,p:t,pDd:n}),e.push({curve:c,t:0,isSource:!0,p:t,pDd:n})}}return e}}(o),f=fv(o,r,c),l=function(t){return function(n){const e=[];for(let o=0;o<n.curves.length;o++){const r=n.curves[o];if(au(r.ps)<t)continue;const{ps:c}=r;e.push(...Cv(c).maxima.map(t=>{const n=nh(c,t),e=n.map(t=>t[0]+t[1]);return{curve:r,t,isSource:!0,p:e,pDd:n}}))}return e}}(o),a=kv(t),p=(a.maxX.p[0]-a.minX.p[0])**2+(a.maxY.p[1]-a.minY.p[1])**2,h=t.map(s),d={id:0},v={maxCoordPowerOf2:n,squaredDiagonalLength:p,loops:t,cpTrees:Sh(t,h,d),lastInsertId:d,...Ch(t)};let g;if(g=Nv(v),"undefined"!=typeof _debug_&&_debug_.directives.stopAfterHoleClosers)return{cpNode:g,meta:v};if(function(){if("undefined"==typeof _debug_)return;const t=performance.now();_debug_.timing.holeClosers+=t-xh,xh=t}(),g=iv(v,i,t.map(u),!1)||g,g=iv(v,i,t.map(l),!0)||g,g=iv(v,i,t.map(f),!1)||g,function(){if("undefined"==typeof _debug_)return;const t=performance.now();_debug_.timing.oneAnd2Prongs+=t-xh,xh=t}(),"undefined"!=typeof _debug_&&_debug_.directives.stopAfterTwoProngs)return{cpNode:g,meta:v};if(g=function(t,n){if(void 0===n)return;const e=new Set;let o=!0;for(;o;){o=!1;const r=new Set(k(n));for(const n of r){const{closeBysFor3Prong:c,addedCpNodes:i}=bh(t,n);i.length>0&&(o=!0),void 0===c?e.add(n):(o=!0,Mh(t,c,r,e)),i.forEach(t=>t.forEach(t=>e.add(t)))}n=_h(e)}return n}(v,g),void 0===g)return;if("undefined"!=typeof _debug_&&_debug_.directives.stopAfterThreeProngs)return{cpNode:g,meta:v};const m={cpNode:g,meta:v};return"undefined"!=typeof _debug_&&(_debug_.timing.threeProngs+=performance.now()-xh),m}const{ceil:Bv,log2:Tv}=Math;function Av(t,n){const{maxCoordinate:e}=function(t){let n=0,e=1/0,o=-1/0,r=1/0,c=-1/0;for(const i of t)for(const t of i)for(const i of t){const t=i[0],s=i[1],u=ep(op(t),op(s));u>n&&(n=u),t<e&&(e=t),t>o&&(o=t),s<r&&(r=s),s>c&&(c=s)}return{maxCoordinate:n,width:o-e,height:c-r}}(t),o=Bv(Tv(e)),r=function(t,n){const e={...n};for(const n in zp){const o=n;let r=e[o];const c=zp[o],{range:i,scaleByMaxCoordinate:s}=c;r<i[0]&&(r=i[0]),r>i[1]&&(r=i[1]),s&&(r*=2**(t-10)),e[o]=r}return e}(o,{...Ap,...n||{}}),{applySat:c,simplify:i,satScale:s,simplifyTolerance:u}=r,f=np(t,{forceOrientationNegative:!0}),l=[];for(const t of f){let n=Pv(t,o,r);void 0!==n&&(c&&(n=Tp(n,s)),i&&(n=yp(n,u,50)),l.push(n))}return l}function zv(t){const n=function(t){let n=t;const e=Ip(t);for(;e.length;){const o=e.pop();if(o.isHoleClosing||o.isIntersection)continue;let r=o.next;for(;;){r=r.next;let e=!1;const o=r.prevOnCircle;if(T(r)>2){const n=r.nextOnCircle;Zt(r,t)?e=!0:r.next===n?r=n:n.next!==o&&(e=!0)}else if(z(r)&&!r.isIntersection)return void(n=r);if(e){o.next=r,r.prev=o,n=r;break}}}return n}(Q(t.cpNode));if(n)return{cpNode:n,meta:{...t.meta,cpTrees:Sp(n)}}}function Dv(t){const n=k(t).filter(t=>D(t)>=3);if(0!==n.length)return n.reduce(function(t,n){return t.pointOnShape.circle.radius>=n.pointOnShape.circle.radius?t:n},n[0])}function Lv(t){if(!t)return void(window._debug_=void 0);let n=window._debug_;n={...n,elems:{...n?.elems},timing:{...n?.timing,holeClosers:0,oneAnd2Prongs:0,threeProngs:0,sats:0,simplifyMat:0},fs:{...n?.fs},directives:{...n?.directives,stopAfterHoleClosers:!1,stopAfterHoleClosersNum:void 0,stopAfterTwoProngs:!1,stopAfterTwoProngsNum:void 0,stopAfterThreeProngs:!1,stopAfterThreeProngsNum:void 0}},window._debug_=n}function qv(t,n,e,o){const r=[];for(const o of t)r.push({type:0,item:o,x:n(o)}),r.push({type:1,item:o,x:e(o)});r.sort(Wv);const c=new Set,i=[];for(const t of r){const{item:n}=t;if(0===t.type){for(const t of c.values())o(n,t)&&i.push([n,t]);c.add(n)}else 1===t.type&&c.delete(t.item)}return i}function Wv(t,n){const e=t.x-n.x;return 0!==e?e:0===t.type?-1:1}const jv=1e-4;function Fv(t,n){const e=t.pointOnShape,o=n.pointOnShape;let{curve:r,p:c,t:i}=e,{curve:s,p:u,t:f}=o;if(c[0]===u[0]&&c[1]===u[1])return[c];1===i&&(i=0,r=r.next),0===f&&(f=1,s=s.prev);const{ps:l}=r,{ps:a}=s,p=[c,ft(c)(lt(ht(l,i)))],h=[u,ft(u)(lt(ht(a,f)))],d=ot(p,h),v=rt(c,u);let g;if(d){const t=rt(c,d),n=rt(u,d);g=ct(t,v)<0||ct(n,v)>0}else g=!0;if(!g)return[c,d,u];const m=rt(p[0],p[1]),x=rt(h[0],h[1]),w=Math.abs(st(v,m))/9,b=Math.abs(st(v,x))/9;return w>.01||b>.01||w>jv||b>jv?void 0:[c,u]}const Hv=et(function(t){return In($t(t))});function Yv(t,n){const e=function(t){const n=new Map;for(let e of t)for(let o of t){const t=e.pointOnShape.circle.center,r=o.pointOnShape.circle.center,c=e.pointOnShape.p,i=o.pointOnShape.p;o!==e&&t[0]===r[0]&&t[1]===r[1]&&c[0]===i[0]&&c[1]===i[1]&&n.set(e,o)}return n}(n),o=t.length,r=[];for(let n=0;n<o;n++){const c=t[n],i=[];for(let r=0;r<o;r++){const o=t[r];if(n===r){i.push(0);continue}let s=1/0;for(const t of A(c)){let n=Hv(t),r=t.next;for(;!Zt(r,o);)if(r.isHoleClosing)r=Rv(e,r);else{if(qn(r)){n=1/0;break}n+=Hv(r),r=r.next}n<s&&(s=n)}i.push(s)}r.push(i)}return r}function Rv(t,n){return t.get(n).next}function Xv(t){let{cpNode:n}=t,e=n;do{if(q(n)||n.next!==n.nextOnCircle){n=n.next;continue}const t=n.next,o=t.next,r=n.next.nextOnCircle;n.next=o,n.nextOnCircle=r,o.prev=n,r.prevOnCircle=n,e===t&&(e=n),n=n.next}while(n!==e);return t.cpNode=n,t}function Qv(t,n){return t.pointOnShape.curve.loop===n.pointOnShape.curve.loop}function Vv(t){const n=[],e=[t],o=new Set(e);for(t.isHoleClosing&&o.add(t.prevOnCircle.holeCloserTwin),o.add(t);e.length>0;){const t=[],r=e.pop(),c=r.pointOnShape.curve.loop;let i=r;do{if(c===i.pointOnShape.curve.loop){t.push(i),i=i.next;continue}const n=i.holeCloserTwin;o.has(n)||(o.add(n),o.add(n.prevOnCircle.holeCloserTwin),e.push(n)),i=i.prev.holeCloserTwin}while(i!==r);n.push(t)}return n}function $v(t){let{cpNode:n}=t;for(;!q(n);)n=n.next;return Qv(n,n.next)||(n=n.holeCloserTwin),Vv(n)}const{max:Uv,abs:Zv,round:Gv,log2:Jv}=Math;function Kv(t,n=void 0){const e=function(t,n){return function(e){const o=e.next,r=e.pointOnShape,c=o.pointOnShape,{curve:i,circle:s,p:u}=r,{curve:f,p:l}=c;if(u[0]===l[0]&&u[1]===l[1])return;if(i.loop!==f.loop)return;const a=nn(s.center,u);if(D(e),void 0!==n){const e=2**(t-n);if(Zv(s.radius-a)>e)throw new Error(`Medial circle radius must be about the same (2**${Gv(Jv(e))}) as distance from medial circle center to point on shape, found: medial radius ${s.radius}, distance: ${a}`)}return function(t){const n=t.next,e=t.pointOnShape,o=n.pointOnShape,{p:r}=e,{p:c}=o,i=r,s=rg(t,tg),u=c,f=rg(n,ng),l=ot(s,f),a=rt(i,u);let p;if(l){const t=rt(i,l),n=rt(u,l);p=ct(t,a)<0||ct(n,a)>0}else p=!0;if(!p)return[i,l,u];const h=it(a),d=rt(s[0],s[1]),v=rt(f[0],f[1]),g=Zv(st(a,d))/9,m=Zv(st(a,v))/9;if(g>eg||m>eg)return[i,u];if(g>og||m>og){const t=ut(i,u,1/3),n=ut(i,u,2/3),e=ft(h,t),o=[n,ft(h,n)];return[i,ot(s,[t,e]),ot(f,o),u]}return[i,u]}(e)}}(Uv(...t.map(t=>t.meta.maxCoordPowerOf2)),n),o=function(t,n,e){if(!Number.isInteger(3))throw new Error("depth must be an integer >= 1");return function t(n,o){const r=o;if(1===n){const t=[];for(let n=0;n<r.length;n++){const o=e(r[n]);void 0===o||t.push(o)}return t}const c=[];for(let e=0;e<r.length;e++)c.push(t(n-1,r[e]));return c}(3,n)}(0,t.map(Xv).map($v),e);return o}const tg=0,ng=1,eg=.01,og=1e-4;function rg(t,n){let{pointOnShape:e}=t,{curve:o,t:r,p:c}=e,{ps:i}=o;return n===tg&&1===r&&(r=0,o=o.next,i=o.ps),n===ng&&0===r&&(r=1,o=o.prev,i=o.ps),[c,ft(c,ht(i,r))]}function cg(t){const{idx:n,beziers:e}=t;return{idx:n,beziers:e}}function ig(t){const n=[],e=new Set,o=t;do{const{id:o,isHoleClosing:r,isIntersection:c,pointOnShape:i,prev:s,next:u,nextOnCircle:f,prevOnCircle:l,holeCloserTwin:a}=t,{curve:p,p:h,pDd:d,t:v,isSource:g,circle:m,order:x,order2:w}=i,{idx:b,loop:_,ps:M,prev:S,next:C}=p;e.has(_)||e.add(_);const y={curveIdx:b,loopIdx:_.idx,p:h,t:v,isSource:g,circle:m,order:x,order2:w,pDd:d};n.push({id:o,isHoleClosing:r,isIntersection:c,pointOnShape:y,prev:s.id,next:u.id,prevOnCircle:l.id,nextOnCircle:f.id,holeCloserTwin:a?.id}),t=t.next}while(t!==o);const r=Array.from(e).sort((t,n)=>t.idx-n.idx);return{cpNodes:n,loops:r.map(cg)}}const sg=["prev","next","prevOnCircle","nextOnCircle","holeCloserTwin"];function ug(n){const{idx:e,beziers:o}=n;return t(o,e)}function fg(t){const{cpNodes:n,loops:e}=t,o=e.map(ug),r=n.map(t=>{const{id:n,pointOnShape:e,isHoleClosing:r,isIntersection:c}=t,{circle:i,order:s,order2:u}=e,{curveIdx:f,loopIdx:l,p:a,pDd:p,t:h,isSource:d}=e,v={circle:i,curve:o[l].curves[f],p:a,pDd:p,t:h,isSource:d,order:s,order2:u};return{...t,id:n,isHoleClosing:r,isIntersection:c,pointOnShape:v}}),c=new Map(r.map(t=>[t.id,t]));for(const t of r)for(const n of sg){const e=t[n];void 0!==e&&(t[n]=c.get(e))}return r[0]}function lg(t,n){return{center:t.center,radius:n*t.radius}}export{Dn as CpNodeFs,e as beziersToSvgPathStr,Q as clone,zn as cpNodeComparator,Sh as createInitialCpTree,Lv as enableDebugForMat,j as enhanceCpNode,tv as find2Prong,Nv as findAndAddHoleClosing2Prongs,Av as findMats,N as floydWarshall,fg as fromStringifyable,A as getAllOnCircle,k as getAllOnLoop,Vv as getAllOnLoop_ByLoop,Tn as getAllVertices,$ as getBoundaryBezierPartsToNext,Nn as getBoundaryBeziersBetween,Z as getBoundaryBeziersToNext,lh as getBoundaryPieceBeziers,Kt as getBranch,tn as getBranchBeziers,bp as getBranches,K as getChildren,eh as getCloseBoundaryPointsCertified,Gp as getClosestSquareDistanceToRect,Rt as getEdgeDirection,Ut as getFirstExit,fv as getFor2ProngsOnLoop,Yv as getGraph,P as getHoleClosers,Fv as getImpliedBoundaryBezierBetween,Bn as getInitialDegAngleBetweenMatCurves,Dv as getLargest3Prong,Ep as getLargestVertex,Vt as getMatCurveBetween,$t as getMatCurveToNext,Pn as getMatCurvesBetween,wp as getNonTerminatingOnCircle,Vd as getOsculatingCircle,Ch as getPartialMeta,I as getPathsFromStr,$p as getPotentialClosestPointsOnCurveCertified,T as getProngCount,D as getRealProngCount,kn as getSalience,Bp as getSatCulls,kv as getShapeBounds,yh as getSharpCornersOnLoop,Y as getVertexForwardChildren,q as isFullyTerminating,Zt as isOnSameCircle,Qv as isOnSameLoop,Gt as isOneProng,W as isSharp,z as isTerminating,L as isTrivial,Jt as isTwoProng,qn as isVertexSpecial,t as loopFromBeziers,Kv as reconstructFromMats,J as removeVertex,lg as scaleCircle,yp as simplifyMat,qv as sweepLine,Tp as toScaleAxis,ig as toStringifyable,F as traverseCp,H as traverseEdges,R as traverseVertices,zv as trimMat};
|