aptechka 0.13.0 → 0.13.1
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/lib/{Animation-seVC6-fS.cjs → Animation-De9aUv3b.cjs} +1 -1
- package/lib/{Animation-DF5jPON_.js → Animation-NAGXiFv5.js} +1 -1
- package/lib/{Composed-ChlKoJEp.cjs → Composed-C_4slJQ6.cjs} +1 -1
- package/lib/{Composed-CoX1ImVk.js → Composed-CfWa-69I.js} +1 -1
- package/lib/{Damped-C7WAqKPh.cjs → Damped-DYJ6Z0xo.cjs} +1 -1
- package/lib/{Damped-BDO-F13V.js → Damped-DbJKrUIf.js} +1 -1
- package/lib/Derived-BIBU-y7Z.cjs +1 -0
- package/lib/Derived-Vo_RsJfi.js +23 -0
- package/lib/{SourceManager-B8-EMNnd.js → SourceManager-B6wZpXUZ.js} +1 -1
- package/lib/{SourceManager-TzU9Rw08.cjs → SourceManager-CfHcGLUa.cjs} +1 -1
- package/lib/Store-C46i0nvr.js +137 -0
- package/lib/Store-npaZHvX4.cjs +1 -0
- package/lib/{Tweened-DSXD0I0k.cjs → Tweened-BkkD9s4n.cjs} +1 -1
- package/lib/{Tweened-CHhmfvzo.js → Tweened-DOSHLCZa.js} +1 -1
- package/lib/{Viewport-DTlImj28.js → Viewport-B55BvLsV.js} +1 -1
- package/lib/{Viewport-BmLTk_6k.cjs → Viewport-Cv4TRGiv.cjs} +1 -1
- package/lib/animation/index.cjs +1 -1
- package/lib/animation/index.js +3 -3
- package/lib/attribute/index.cjs +1 -1
- package/lib/attribute/index.js +1 -1
- package/lib/canvas/index.cjs +1 -1
- package/lib/canvas/index.js +3 -3
- package/lib/checkbox/index.cjs +1 -1
- package/lib/checkbox/index.js +3 -3
- package/lib/class-linked-status/index.cjs +1 -1
- package/lib/class-linked-status/index.js +1 -1
- package/lib/controls/index.cjs +1 -1
- package/lib/controls/index.js +2 -2
- package/lib/{createStylesheet-DO5t5q-m.js → createStylesheet-COAZH1Mw.js} +1 -1
- package/lib/{createStylesheet-CaDI99iu.cjs → createStylesheet-Csfmh-MH.cjs} +1 -1
- package/lib/css-property/index.cjs +1 -1
- package/lib/css-property/index.js +1 -1
- package/lib/dev/index.cjs +1 -1
- package/lib/dev/index.js +1 -1
- package/lib/device/index.cjs +1 -1
- package/lib/device/index.js +1 -1
- package/lib/element-constructor/index.cjs +1 -1
- package/lib/element-constructor/index.js +2 -2
- package/lib/en3/helpers/index.cjs +1 -1
- package/lib/en3/helpers/index.js +2 -2
- package/lib/en3/misc/index.cjs +1 -1
- package/lib/en3/misc/index.js +2 -2
- package/lib/image/index.cjs +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{index-BpsQqM-8.cjs → index-BuAuBz2_.cjs} +1 -1
- package/lib/{index-BhbT9PrL.js → index-CenF0JbH.js} +3 -3
- package/lib/ladder/index.cjs +1 -1
- package/lib/ladder/index.js +1 -1
- package/lib/media/index.cjs +1 -1
- package/lib/media/index.js +1 -1
- package/lib/modal/index.cjs +1 -1
- package/lib/modal/index.js +3 -3
- package/lib/pointer/index.cjs +1 -1
- package/lib/pointer/index.js +2 -2
- package/lib/popover/index.cjs +1 -1
- package/lib/popover/index.js +2 -2
- package/lib/scroll/index.cjs +1 -1
- package/lib/scroll/index.js +7 -7
- package/lib/select/index.cjs +1 -1
- package/lib/select/index.js +1 -1
- package/lib/sequence/index.cjs +1 -1
- package/lib/sequence/index.js +1 -1
- package/lib/source/index.cjs +1 -1
- package/lib/source/index.js +2 -2
- package/lib/store/index.cjs +1 -1
- package/lib/store/index.js +38 -112
- package/lib/{tags-v-OSVkiQ.cjs → tags-6_ETuR75.cjs} +1 -1
- package/lib/{tags-4AoxVUe3.js → tags-BL3kQp9o.js} +1 -1
- package/lib/theme/index.cjs +1 -1
- package/lib/theme/index.js +2 -2
- package/lib/tweaker/index.cjs +2 -2
- package/lib/tweaker/index.js +50 -53
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +1 -1
- package/package.json +1 -9
- package/lib/Derived-B-2UXnVE.cjs +0 -1
- package/lib/Derived-CDGpSMKu.js +0 -56
- package/lib/Store-BnA-dJsE.cjs +0 -1
- package/lib/Store-DGtldlBH.js +0 -147
- package/lib/svg-path-data/index.cjs +0 -3
- package/lib/svg-path-data/index.js +0 -490
package/lib/Store-DGtldlBH.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
var A = (i) => {
|
|
2
|
-
throw TypeError(i);
|
|
3
|
-
};
|
|
4
|
-
var N = (i, t, e) => t.has(i) || A("Cannot " + e);
|
|
5
|
-
var r = (i, t, e) => (N(i, t, "read from private field"), e ? e.call(i) : t.get(i)), s = (i, t, e) => t.has(i) ? A("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), a = (i, t, e, c) => (N(i, t, "write to private field"), c ? c.call(i, e) : t.set(i, e), e), k = (i, t, e) => (N(i, t, "access private method"), e);
|
|
6
|
-
import { i as j } from "./browser-0zX67oeU.js";
|
|
7
|
-
var f, d, S;
|
|
8
|
-
class z {
|
|
9
|
-
constructor() {
|
|
10
|
-
s(this, f, null);
|
|
11
|
-
s(this, d, "");
|
|
12
|
-
s(this, S, "");
|
|
13
|
-
j && (a(this, d, document.documentElement.getAttribute("data-project") || "unnamed"), a(this, S, r(this, d) ? r(this, d) + "-store-registry" : "store-registry"));
|
|
14
|
-
}
|
|
15
|
-
get projectName() {
|
|
16
|
-
return r(this, d);
|
|
17
|
-
}
|
|
18
|
-
get localStoreRegistryName() {
|
|
19
|
-
return r(this, S);
|
|
20
|
-
}
|
|
21
|
-
get loadedState() {
|
|
22
|
-
return r(this, f);
|
|
23
|
-
}
|
|
24
|
-
saveState() {
|
|
25
|
-
const t = this.getState(), e = JSON.stringify(t);
|
|
26
|
-
localStorage.setItem(r(this, S), e);
|
|
27
|
-
}
|
|
28
|
-
loadState(t = localStorage.getItem(
|
|
29
|
-
r(this, S)
|
|
30
|
-
)) {
|
|
31
|
-
t && (typeof t == "string" ? a(this, f, JSON.parse(t)) : a(this, f, t), l.current.forEach((e) => {
|
|
32
|
-
e.passport && this.updateStore(e);
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
resetState() {
|
|
36
|
-
l.current.forEach((t) => {
|
|
37
|
-
t.passport && t.reset();
|
|
38
|
-
}), this.saveState();
|
|
39
|
-
}
|
|
40
|
-
updateStore(t) {
|
|
41
|
-
var c, v;
|
|
42
|
-
if (!Array.isArray((c = r(this, f)) == null ? void 0 : c.stores))
|
|
43
|
-
return t;
|
|
44
|
-
const e = t.passport;
|
|
45
|
-
if (e) {
|
|
46
|
-
const p = (v = r(this, f)) == null ? void 0 : v.stores.find(
|
|
47
|
-
(R) => R.name === e.name
|
|
48
|
-
);
|
|
49
|
-
p && (t.current = p.value);
|
|
50
|
-
}
|
|
51
|
-
return t;
|
|
52
|
-
}
|
|
53
|
-
getState() {
|
|
54
|
-
const t = {
|
|
55
|
-
stores: []
|
|
56
|
-
};
|
|
57
|
-
return l.current.forEach((e) => {
|
|
58
|
-
e.passport && (t.stores.find((c) => c.name === e.passport.name) || t.stores.push({
|
|
59
|
-
value: e.current,
|
|
60
|
-
name: e.passport.name
|
|
61
|
-
}));
|
|
62
|
-
}), t;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
f = new WeakMap(), d = new WeakMap(), S = new WeakMap();
|
|
66
|
-
const M = new z();
|
|
67
|
-
var g, h, m, n, o, u, y, b, w, E;
|
|
68
|
-
class q {
|
|
69
|
-
constructor(t, e) {
|
|
70
|
-
s(this, w);
|
|
71
|
-
s(this, g);
|
|
72
|
-
s(this, h);
|
|
73
|
-
s(this, m);
|
|
74
|
-
s(this, n, /* @__PURE__ */ new Set());
|
|
75
|
-
s(this, o);
|
|
76
|
-
s(this, u);
|
|
77
|
-
s(this, y);
|
|
78
|
-
s(this, b);
|
|
79
|
-
a(this, g, e == null ? void 0 : e.passport), a(this, h, {
|
|
80
|
-
initial: t,
|
|
81
|
-
previous: void 0,
|
|
82
|
-
current: t
|
|
83
|
-
}), a(this, m, (e == null ? void 0 : e.equalityCheck) || ((c, v) => c === v)), e != null && e.validate && this.addMiddleware(e.validate), a(this, y, (e == null ? void 0 : e.notifyAndClose) || !1), a(this, b, (e == null ? void 0 : e.invisible) || !1), a(this, o, (e == null ? void 0 : e.skipSubscribeNotification) || !1), r(this, g) && M.updateStore(this);
|
|
84
|
-
}
|
|
85
|
-
get passport() {
|
|
86
|
-
return r(this, g);
|
|
87
|
-
}
|
|
88
|
-
get initial() {
|
|
89
|
-
return r(this, h).initial;
|
|
90
|
-
}
|
|
91
|
-
get previous() {
|
|
92
|
-
return r(this, h).previous;
|
|
93
|
-
}
|
|
94
|
-
get current() {
|
|
95
|
-
return r(this, h).current;
|
|
96
|
-
}
|
|
97
|
-
set current(t) {
|
|
98
|
-
if (!r(this, m).call(this, r(this, h).current, t)) {
|
|
99
|
-
if (r(this, h).previous = r(this, h).current, r(this, u))
|
|
100
|
-
for (const e of r(this, u))
|
|
101
|
-
t = e(t);
|
|
102
|
-
r(this, h).current = t, k(this, w, E).call(this), r(this, y) && this.close();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
get subscribers() {
|
|
106
|
-
return r(this, n);
|
|
107
|
-
}
|
|
108
|
-
addMiddleware(t) {
|
|
109
|
-
r(this, u) || a(this, u, /* @__PURE__ */ new Set()), r(this, u).add(t);
|
|
110
|
-
}
|
|
111
|
-
removeMiddleware(t) {
|
|
112
|
-
var e, c;
|
|
113
|
-
(e = r(this, u)) == null || e.delete(t), (c = r(this, u)) != null && c.size || a(this, u, void 0);
|
|
114
|
-
}
|
|
115
|
-
subscribe(t) {
|
|
116
|
-
return !r(this, b) && !r(this, n).size && I(this), r(this, n).add(t), r(this, o) || t(r(this, h)), () => {
|
|
117
|
-
this.unsubscribe(t);
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
unsubscribe(t) {
|
|
121
|
-
r(this, n).delete(t), r(this, n).size || C(this);
|
|
122
|
-
}
|
|
123
|
-
reset() {
|
|
124
|
-
this.current = Array.isArray(this.initial) ? [...this.initial] : this.initial;
|
|
125
|
-
}
|
|
126
|
-
close() {
|
|
127
|
-
r(this, n).clear(), C(this);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
g = new WeakMap(), h = new WeakMap(), m = new WeakMap(), n = new WeakMap(), o = new WeakMap(), u = new WeakMap(), y = new WeakMap(), b = new WeakMap(), w = new WeakSet(), E = function() {
|
|
131
|
-
for (const t of r(this, n))
|
|
132
|
-
t(r(this, h));
|
|
133
|
-
};
|
|
134
|
-
const l = new q([], {
|
|
135
|
-
invisible: !0
|
|
136
|
-
});
|
|
137
|
-
function I(i) {
|
|
138
|
-
l.current.includes(i) || (l.current = [...l.current, i]);
|
|
139
|
-
}
|
|
140
|
-
function C(i) {
|
|
141
|
-
l.current.includes(i) && (l.current = l.current.filter((t) => t !== i));
|
|
142
|
-
}
|
|
143
|
-
export {
|
|
144
|
-
q as S,
|
|
145
|
-
l as a,
|
|
146
|
-
M as s
|
|
147
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});// @license
|
|
2
|
-
(!SVGPathElement.prototype.getPathData||!SVGPathElement.prototype.setPathData)&&function(){var V={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"},M=function(n){this._string=n,this._currentIndex=0,this._endIndex=this._string.length,this._prevCommand=null,this._skipOptionalSpaces()},D=window.navigator.userAgent.indexOf("MSIE ")!==-1;M.prototype={parseSegment:function(){var n=this._string[this._currentIndex],t=V[n]?V[n]:null;if(t===null){if(this._prevCommand===null||((n==="+"||n==="-"||n==="."||n>="0"&&n<="9")&&this._prevCommand!=="Z"?this._prevCommand==="M"?t="L":this._prevCommand==="m"?t="l":t=this._prevCommand:t=null,t===null))return null}else this._currentIndex+=1;this._prevCommand=t;var e=null,s=t.toUpperCase();return s==="H"||s==="V"?e=[this._parseNumber()]:s==="M"||s==="L"||s==="T"?e=[this._parseNumber(),this._parseNumber()]:s==="S"||s==="Q"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:s==="C"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:s==="A"?e=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseArcFlag(),this._parseArcFlag(),this._parseNumber(),this._parseNumber()]:s==="Z"&&(this._skipOptionalSpaces(),e=[]),e===null||e.indexOf(null)>=0?null:{type:t,values:e}},hasMoreData:function(){return this._currentIndex<this._endIndex},peekSegmentType:function(){var n=this._string[this._currentIndex];return V[n]?V[n]:null},initialCommandIsMoveTo:function(){if(!this.hasMoreData())return!0;var n=this.peekSegmentType();return n==="M"||n==="m"},_isCurrentSpace:function(){var n=this._string[this._currentIndex];return n<=" "&&(n===" "||n===`
|
|
3
|
-
`||n===" "||n==="\r"||n==="\f")},_skipOptionalSpaces:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex+=1;return this._currentIndex<this._endIndex},_skipOptionalSpacesOrDelimiter:function(){return this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&this._string[this._currentIndex]!==","?!1:(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&this._string[this._currentIndex]===","&&(this._currentIndex+=1,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)},_parseNumber:function(){var n=0,t=0,e=1,s=0,l=1,u=1,a=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&this._string[this._currentIndex]==="+"?this._currentIndex+=1:this._currentIndex<this._endIndex&&this._string[this._currentIndex]==="-"&&(this._currentIndex+=1,l=-1),this._currentIndex===this._endIndex||(this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")&&this._string[this._currentIndex]!==".")return null;for(var p=this._currentIndex;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>="0"&&this._string[this._currentIndex]<="9";)this._currentIndex+=1;if(this._currentIndex!==p)for(var i=this._currentIndex-1,r=1;i>=p;)t+=r*(this._string[i]-"0"),i-=1,r*=10;if(this._currentIndex<this._endIndex&&this._string[this._currentIndex]==="."){if(this._currentIndex+=1,this._currentIndex>=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>="0"&&this._string[this._currentIndex]<="9";)e*=10,s+=(this._string.charAt(this._currentIndex)-"0")/e,this._currentIndex+=1}if(this._currentIndex!==a&&this._currentIndex+1<this._endIndex&&(this._string[this._currentIndex]==="e"||this._string[this._currentIndex]==="E")&&this._string[this._currentIndex+1]!=="x"&&this._string[this._currentIndex+1]!=="m"){if(this._currentIndex+=1,this._string[this._currentIndex]==="+"?this._currentIndex+=1:this._string[this._currentIndex]==="-"&&(this._currentIndex+=1,u=-1),this._currentIndex>=this._endIndex||this._string[this._currentIndex]<"0"||this._string[this._currentIndex]>"9")return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>="0"&&this._string[this._currentIndex]<="9";)n*=10,n+=this._string[this._currentIndex]-"0",this._currentIndex+=1}var v=t+s;return v*=l,n&&(v*=Math.pow(10,u*n)),a===this._currentIndex?null:(this._skipOptionalSpacesOrDelimiter(),v)},_parseArcFlag:function(){if(this._currentIndex>=this._endIndex)return null;var n=null,t=this._string[this._currentIndex];if(this._currentIndex+=1,t==="0")n=0;else if(t==="1")n=1;else return null;return this._skipOptionalSpacesOrDelimiter(),n}};var A=function(n){if(!n||n.length===0)return[];var t=new M(n),e=[];if(t.initialCommandIsMoveTo())for(;t.hasMoreData();){var s=t.parseSegment();if(s===null)break;e.push(s)}return e},P=SVGPathElement.prototype.setAttribute,S=SVGPathElement.prototype.setAttributeNS,_=SVGPathElement.prototype.removeAttribute,x=SVGPathElement.prototype.removeAttributeNS,y=window.Symbol?Symbol():"__cachedPathData",m=window.Symbol?Symbol():"__cachedNormalizedPathData",O=function(n,t,e,s,l,u,a,p,i,r){var v=function(X){return Math.PI*X/180},h=function(X,tt,Y){var pt=X*Math.cos(Y)-tt*Math.sin(Y),ct=X*Math.sin(Y)+tt*Math.cos(Y);return{x:pt,y:ct}},f=v(a),c=[],d,o,I,b;if(r)d=r[0],o=r[1],I=r[2],b=r[3];else{var T=h(n,t,-f);n=T.x,t=T.y;var L=h(e,s,-f);e=L.x,s=L.y;var w=(n-e)/2,C=(t-s)/2,G=w*w/(l*l)+C*C/(u*u);G>1&&(G=Math.sqrt(G),l=G*l,u=G*u);var k;p===i?k=-1:k=1;var z=l*l,H=u*u,at=z*H-z*C*C-H*w*w,rt=z*C*C+H*w*w,q=k*Math.sqrt(Math.abs(at/rt));I=q*l*C/u+(n+e)/2,b=q*-u*w/l+(t+s)/2,d=Math.asin(parseFloat(((t-b)/u).toFixed(9))),o=Math.asin(parseFloat(((s-b)/u).toFixed(9))),n<I&&(d=Math.PI-d),e<I&&(o=Math.PI-o),d<0&&(d=Math.PI*2+d),o<0&&(o=Math.PI*2+o),i&&d>o&&(d=d-Math.PI*2),!i&&o>d&&(o=o-Math.PI*2)}var B=o-d;if(Math.abs(B)>Math.PI*120/180){var st=o,nt=e,it=s;i&&o>d?o=d+Math.PI*120/180*1:o=d+Math.PI*120/180*-1,e=I+l*Math.cos(o),s=b+u*Math.sin(o),c=O(e,s,nt,it,l,u,a,0,i,[o,st,I,b])}B=o-d;var ut=Math.cos(d),lt=Math.sin(d),vt=Math.cos(o),ht=Math.sin(o),F=Math.tan(B/4),j=4/3*l*F,J=4/3*u*F,K=[n,t],Z=[n+j*lt,t-J*ut],W=[e+j*ht,s-J*vt],U=[e,s];if(Z[0]=2*K[0]-Z[0],Z[1]=2*K[1]-Z[1],r)return[Z,W,U].concat(c);c=[Z,W,U].concat(c);for(var R=[],N=0;N<c.length;N+=3){var l=h(c[N][0],c[N][1],f),u=h(c[N+1][0],c[N+1][1],f),g=h(c[N+2][0],c[N+2][1],f);R.push([l.x,l.y,u.x,u.y,g.x,g.y])}return R},E=function(n){return n.map(function(t){return{type:t.type,values:Array.prototype.slice.call(t.values)}})},$=function(n){var t=[],e=null,s=null,l=null,u=null;return n.forEach(function(a){var p=a.type;if(p==="M"){var i=a.values[0],r=a.values[1];t.push({type:"M",values:[i,r]}),l=i,u=r,e=i,s=r}else if(p==="m"){var i=e+a.values[0],r=s+a.values[1];t.push({type:"M",values:[i,r]}),l=i,u=r,e=i,s=r}else if(p==="L"){var i=a.values[0],r=a.values[1];t.push({type:"L",values:[i,r]}),e=i,s=r}else if(p==="l"){var i=e+a.values[0],r=s+a.values[1];t.push({type:"L",values:[i,r]}),e=i,s=r}else if(p==="C"){var v=a.values[0],h=a.values[1],f=a.values[2],c=a.values[3],i=a.values[4],r=a.values[5];t.push({type:"C",values:[v,h,f,c,i,r]}),e=i,s=r}else if(p==="c"){var v=e+a.values[0],h=s+a.values[1],f=e+a.values[2],c=s+a.values[3],i=e+a.values[4],r=s+a.values[5];t.push({type:"C",values:[v,h,f,c,i,r]}),e=i,s=r}else if(p==="Q"){var v=a.values[0],h=a.values[1],i=a.values[2],r=a.values[3];t.push({type:"Q",values:[v,h,i,r]}),e=i,s=r}else if(p==="q"){var v=e+a.values[0],h=s+a.values[1],i=e+a.values[2],r=s+a.values[3];t.push({type:"Q",values:[v,h,i,r]}),e=i,s=r}else if(p==="A"){var i=a.values[5],r=a.values[6];t.push({type:"A",values:[a.values[0],a.values[1],a.values[2],a.values[3],a.values[4],i,r]}),e=i,s=r}else if(p==="a"){var i=e+a.values[5],r=s+a.values[6];t.push({type:"A",values:[a.values[0],a.values[1],a.values[2],a.values[3],a.values[4],i,r]}),e=i,s=r}else if(p==="H"){var i=a.values[0];t.push({type:"H",values:[i]}),e=i}else if(p==="h"){var i=e+a.values[0];t.push({type:"H",values:[i]}),e=i}else if(p==="V"){var r=a.values[0];t.push({type:"V",values:[r]}),s=r}else if(p==="v"){var r=s+a.values[0];t.push({type:"V",values:[r]}),s=r}else if(p==="S"){var f=a.values[0],c=a.values[1],i=a.values[2],r=a.values[3];t.push({type:"S",values:[f,c,i,r]}),e=i,s=r}else if(p==="s"){var f=e+a.values[0],c=s+a.values[1],i=e+a.values[2],r=s+a.values[3];t.push({type:"S",values:[f,c,i,r]}),e=i,s=r}else if(p==="T"){var i=a.values[0],r=a.values[1];t.push({type:"T",values:[i,r]}),e=i,s=r}else if(p==="t"){var i=e+a.values[0],r=s+a.values[1];t.push({type:"T",values:[i,r]}),e=i,s=r}else(p==="Z"||p==="z")&&(t.push({type:"Z",values:[]}),e=l,s=u)}),t},Q=function(n){var t=[],e=null,s=null,l=null,u=null,a=null,p=null,i=null;return n.forEach(function(r){if(r.type==="M"){var v=r.values[0],h=r.values[1];t.push({type:"M",values:[v,h]}),p=v,i=h,u=v,a=h}else if(r.type==="C"){var f=r.values[0],c=r.values[1],d=r.values[2],o=r.values[3],v=r.values[4],h=r.values[5];t.push({type:"C",values:[f,c,d,o,v,h]}),s=d,l=o,u=v,a=h}else if(r.type==="L"){var v=r.values[0],h=r.values[1];t.push({type:"L",values:[v,h]}),u=v,a=h}else if(r.type==="H"){var v=r.values[0];t.push({type:"L",values:[v,a]}),u=v}else if(r.type==="V"){var h=r.values[0];t.push({type:"L",values:[u,h]}),a=h}else if(r.type==="S"){var d=r.values[0],o=r.values[1],v=r.values[2],h=r.values[3],I,b;e==="C"||e==="S"?(I=u+(u-s),b=a+(a-l)):(I=u,b=a),t.push({type:"C",values:[I,b,d,o,v,h]}),s=d,l=o,u=v,a=h}else if(r.type==="T"){var v=r.values[0],h=r.values[1],f,c;e==="Q"||e==="T"?(f=u+(u-s),c=a+(a-l)):(f=u,c=a);var I=u+2*(f-u)/3,b=a+2*(c-a)/3,T=v+2*(f-v)/3,L=h+2*(c-h)/3;t.push({type:"C",values:[I,b,T,L,v,h]}),s=f,l=c,u=v,a=h}else if(r.type==="Q"){var f=r.values[0],c=r.values[1],v=r.values[2],h=r.values[3],I=u+2*(f-u)/3,b=a+2*(c-a)/3,T=v+2*(f-v)/3,L=h+2*(c-h)/3;t.push({type:"C",values:[I,b,T,L,v,h]}),s=f,l=c,u=v,a=h}else if(r.type==="A"){var w=Math.abs(r.values[0]),C=Math.abs(r.values[1]),G=r.values[2],k=r.values[3],z=r.values[4],v=r.values[5],h=r.values[6];if(w===0||C===0)t.push({type:"C",values:[u,a,v,h,v,h]}),u=v,a=h;else if(u!==v||a!==h){var H=O(u,a,v,h,w,C,G,k,z);H.forEach(function(q){t.push({type:"C",values:q})}),u=v,a=h}}else r.type==="Z"&&(t.push(r),u=p,a=i);e=r.type}),t};SVGPathElement.prototype.setAttribute=function(n,t){n==="d"&&(this[y]=null,this[m]=null),P.call(this,n,t)},SVGPathElement.prototype.setAttributeNS=function(n,t,e){if(t==="d"){var s="http://www.w3.org/2000/svg";if(n)for(var l of this.ownerSVGElement.attributes)l.name===`xmlns:${n}`&&(s=l.value);s==="http://www.w3.org/2000/svg"&&(this[y]=null,this[m]=null)}S.call(this,n,t,e)},SVGPathElement.prototype.removeAttribute=function(n,t){n==="d"&&(this[y]=null,this[m]=null),_.call(this,n)},SVGPathElement.prototype.removeAttributeNS=function(n,t){if(t==="d"){var e="http://www.w3.org/2000/svg";if(n)for(var s of this.ownerSVGElement.attributes)s.name===`xmlns:${n}`&&(e=s.value);e==="http://www.w3.org/2000/svg"&&(this[y]=null,this[m]=null)}x.call(this,n,t)},SVGPathElement.prototype.getPathData=function(n){if(n&&n.normalize){if(this[m])return E(this[m]);var t;this[y]?t=E(this[y]):(t=A(this.getAttribute("d")||""),this[y]=E(t));var e=Q($(t));return this[m]=E(e),e}else{if(this[y])return E(this[y]);var t=A(this.getAttribute("d")||"");return this[y]=E(t),t}},SVGPathElement.prototype.setPathData=function(n){if(n.length===0)D?this.setAttribute("d",""):this.removeAttribute("d");else{for(var t="",e=0,s=n.length;e<s;e+=1){var l=n[e];e>0&&(t+=" "),t+=l.type,l.values&&l.values.length>0&&(t+=" "+l.values.join(" "))}this.setAttribute("d",t)}},SVGRectElement.prototype.getPathData=function(n){var t=this.x.baseVal.value,e=this.y.baseVal.value,s=this.width.baseVal.value,l=this.height.baseVal.value,u=this.hasAttribute("rx")?this.rx.baseVal.value:this.ry.baseVal.value,a=this.hasAttribute("ry")?this.ry.baseVal.value:this.rx.baseVal.value;u>s/2&&(u=s/2),a>l/2&&(a=l/2);var p=[{type:"M",values:[t+u,e]},{type:"H",values:[t+s-u]},{type:"A",values:[u,a,0,0,1,t+s,e+a]},{type:"V",values:[e+l-a]},{type:"A",values:[u,a,0,0,1,t+s-u,e+l]},{type:"H",values:[t+u]},{type:"A",values:[u,a,0,0,1,t,e+l-a]},{type:"V",values:[e+a]},{type:"A",values:[u,a,0,0,1,t+u,e]},{type:"Z",values:[]}];return p=p.filter(function(i){return!(i.type==="A"&&(i.values[0]===0||i.values[1]===0))}),n&&n.normalize===!0&&(p=Q(p)),p},SVGCircleElement.prototype.getPathData=function(n){var t=this.cx.baseVal.value,e=this.cy.baseVal.value,s=this.r.baseVal.value,l=[{type:"M",values:[t+s,e]},{type:"A",values:[s,s,0,0,1,t,e+s]},{type:"A",values:[s,s,0,0,1,t-s,e]},{type:"A",values:[s,s,0,0,1,t,e-s]},{type:"A",values:[s,s,0,0,1,t+s,e]},{type:"Z",values:[]}];return n&&n.normalize===!0&&(l=Q(l)),l},SVGEllipseElement.prototype.getPathData=function(n){var t=this.cx.baseVal.value,e=this.cy.baseVal.value,s=this.rx.baseVal.value,l=this.ry.baseVal.value,u=[{type:"M",values:[t+s,e]},{type:"A",values:[s,l,0,0,1,t,e+l]},{type:"A",values:[s,l,0,0,1,t-s,e]},{type:"A",values:[s,l,0,0,1,t,e-l]},{type:"A",values:[s,l,0,0,1,t+s,e]},{type:"Z",values:[]}];return n&&n.normalize===!0&&(u=Q(u)),u},SVGLineElement.prototype.getPathData=function(){return[{type:"M",values:[this.x1.baseVal.value,this.y1.baseVal.value]},{type:"L",values:[this.x2.baseVal.value,this.y2.baseVal.value]}]},SVGPolylineElement.prototype.getPathData=function(){for(var n=[],t=0;t<this.points.numberOfItems;t+=1){var e=this.points.getItem(t);n.push({type:t===0?"M":"L",values:[e.x,e.y]})}return n},SVGPolygonElement.prototype.getPathData=function(){for(var n=[],t=0;t<this.points.numberOfItems;t+=1){var e=this.points.getItem(t);n.push({type:t===0?"M":"L",values:[e.x,e.y]})}return n.push({type:"Z",values:[]}),n}}();function et(V,{pathSelector:M="path"}={}){const D=document.createElement(null);D.innerHTML=V;const A=D.firstElementChild,S=A.querySelector(M).getPathData(),_=A.getAttribute("viewBox").split(" ").map(m=>m.trim()),x={x:parseInt(_[0]),y:parseInt(_[1]),width:parseInt(_[2]),height:parseInt(_[3])},y=Math.min(x.width,x.height);return S.forEach(m=>{m.values=m.values.map(O=>O/y)}),S}function ot(V,M,D,A,P){const S=[];for(let _=0;_<=1;_+=1/P){const x=Math.pow(1-_,3)*V.x+3*Math.pow(1-_,2)*_*M.x+3*(1-_)*Math.pow(_,2)*D.x+Math.pow(_,3)*A.x,y=Math.pow(1-_,3)*V.y+3*Math.pow(1-_,2)*_*M.y+3*(1-_)*Math.pow(_,2)*D.y+Math.pow(_,3)*A.y;S.push({x,y})}return S}function ft(V,M){const D=(M==null?void 0:M.segments)||20,A=et(V,M);let P=[];for(let S=0;S<A.length-1;S++){const{type:_,values:x}=A[S];if(_==="M"&&S===0)P.push({x:x[0],y:x[1]});else if(_==="C"){const y=P[P.length-1],m={x:x[0],y:x[1]},O={x:x[2],y:x[3]},E={x:x[4],y:x[5]},$=ot(y,m,O,E,D);P=[...P,...$]}}return P}exports.getPathData=et;exports.getPoints=ft;
|
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
// @license
|
|
2
|
-
(!SVGPathElement.prototype.getPathData || !SVGPathElement.prototype.setPathData) && function() {
|
|
3
|
-
var V = {
|
|
4
|
-
Z: "Z",
|
|
5
|
-
M: "M",
|
|
6
|
-
L: "L",
|
|
7
|
-
C: "C",
|
|
8
|
-
Q: "Q",
|
|
9
|
-
A: "A",
|
|
10
|
-
H: "H",
|
|
11
|
-
V: "V",
|
|
12
|
-
S: "S",
|
|
13
|
-
T: "T",
|
|
14
|
-
z: "Z",
|
|
15
|
-
m: "m",
|
|
16
|
-
l: "l",
|
|
17
|
-
c: "c",
|
|
18
|
-
q: "q",
|
|
19
|
-
a: "a",
|
|
20
|
-
h: "h",
|
|
21
|
-
v: "v",
|
|
22
|
-
s: "s",
|
|
23
|
-
t: "t"
|
|
24
|
-
}, M = function(n) {
|
|
25
|
-
this._string = n, this._currentIndex = 0, this._endIndex = this._string.length, this._prevCommand = null, this._skipOptionalSpaces();
|
|
26
|
-
}, E = window.navigator.userAgent.indexOf("MSIE ") !== -1;
|
|
27
|
-
M.prototype = {
|
|
28
|
-
parseSegment: function() {
|
|
29
|
-
var n = this._string[this._currentIndex], t = V[n] ? V[n] : null;
|
|
30
|
-
if (t === null) {
|
|
31
|
-
if (this._prevCommand === null || ((n === "+" || n === "-" || n === "." || n >= "0" && n <= "9") && this._prevCommand !== "Z" ? this._prevCommand === "M" ? t = "L" : this._prevCommand === "m" ? t = "l" : t = this._prevCommand : t = null, t === null))
|
|
32
|
-
return null;
|
|
33
|
-
} else
|
|
34
|
-
this._currentIndex += 1;
|
|
35
|
-
this._prevCommand = t;
|
|
36
|
-
var e = null, s = t.toUpperCase();
|
|
37
|
-
return s === "H" || s === "V" ? e = [this._parseNumber()] : s === "M" || s === "L" || s === "T" ? e = [this._parseNumber(), this._parseNumber()] : s === "S" || s === "Q" ? e = [
|
|
38
|
-
this._parseNumber(),
|
|
39
|
-
this._parseNumber(),
|
|
40
|
-
this._parseNumber(),
|
|
41
|
-
this._parseNumber()
|
|
42
|
-
] : s === "C" ? e = [
|
|
43
|
-
this._parseNumber(),
|
|
44
|
-
this._parseNumber(),
|
|
45
|
-
this._parseNumber(),
|
|
46
|
-
this._parseNumber(),
|
|
47
|
-
this._parseNumber(),
|
|
48
|
-
this._parseNumber()
|
|
49
|
-
] : s === "A" ? e = [
|
|
50
|
-
this._parseNumber(),
|
|
51
|
-
this._parseNumber(),
|
|
52
|
-
this._parseNumber(),
|
|
53
|
-
this._parseArcFlag(),
|
|
54
|
-
this._parseArcFlag(),
|
|
55
|
-
this._parseNumber(),
|
|
56
|
-
this._parseNumber()
|
|
57
|
-
] : s === "Z" && (this._skipOptionalSpaces(), e = []), e === null || e.indexOf(null) >= 0 ? null : { type: t, values: e };
|
|
58
|
-
},
|
|
59
|
-
hasMoreData: function() {
|
|
60
|
-
return this._currentIndex < this._endIndex;
|
|
61
|
-
},
|
|
62
|
-
peekSegmentType: function() {
|
|
63
|
-
var n = this._string[this._currentIndex];
|
|
64
|
-
return V[n] ? V[n] : null;
|
|
65
|
-
},
|
|
66
|
-
initialCommandIsMoveTo: function() {
|
|
67
|
-
if (!this.hasMoreData())
|
|
68
|
-
return !0;
|
|
69
|
-
var n = this.peekSegmentType();
|
|
70
|
-
return n === "M" || n === "m";
|
|
71
|
-
},
|
|
72
|
-
_isCurrentSpace: function() {
|
|
73
|
-
var n = this._string[this._currentIndex];
|
|
74
|
-
return n <= " " && (n === " " || n === `
|
|
75
|
-
` || n === " " || n === "\r" || n === "\f");
|
|
76
|
-
},
|
|
77
|
-
_skipOptionalSpaces: function() {
|
|
78
|
-
for (; this._currentIndex < this._endIndex && this._isCurrentSpace(); )
|
|
79
|
-
this._currentIndex += 1;
|
|
80
|
-
return this._currentIndex < this._endIndex;
|
|
81
|
-
},
|
|
82
|
-
_skipOptionalSpacesOrDelimiter: function() {
|
|
83
|
-
return this._currentIndex < this._endIndex && !this._isCurrentSpace() && this._string[this._currentIndex] !== "," ? !1 : (this._skipOptionalSpaces() && this._currentIndex < this._endIndex && this._string[this._currentIndex] === "," && (this._currentIndex += 1, this._skipOptionalSpaces()), this._currentIndex < this._endIndex);
|
|
84
|
-
},
|
|
85
|
-
// Parse a number from an SVG path. This very closely follows genericParseNumber(...) from
|
|
86
|
-
// Source/core/svg/SVGParserUtilities.cpp.
|
|
87
|
-
// Spec: http://www.w3.org/TR/SVG11/single-page.html#paths-PathDataBNF
|
|
88
|
-
_parseNumber: function() {
|
|
89
|
-
var n = 0, t = 0, e = 1, s = 0, l = 1, u = 1, a = this._currentIndex;
|
|
90
|
-
if (this._skipOptionalSpaces(), this._currentIndex < this._endIndex && this._string[this._currentIndex] === "+" ? this._currentIndex += 1 : this._currentIndex < this._endIndex && this._string[this._currentIndex] === "-" && (this._currentIndex += 1, l = -1), this._currentIndex === this._endIndex || (this._string[this._currentIndex] < "0" || this._string[this._currentIndex] > "9") && this._string[this._currentIndex] !== ".")
|
|
91
|
-
return null;
|
|
92
|
-
for (var p = this._currentIndex; this._currentIndex < this._endIndex && this._string[this._currentIndex] >= "0" && this._string[this._currentIndex] <= "9"; )
|
|
93
|
-
this._currentIndex += 1;
|
|
94
|
-
if (this._currentIndex !== p)
|
|
95
|
-
for (var i = this._currentIndex - 1, r = 1; i >= p; )
|
|
96
|
-
t += r * (this._string[i] - "0"), i -= 1, r *= 10;
|
|
97
|
-
if (this._currentIndex < this._endIndex && this._string[this._currentIndex] === ".") {
|
|
98
|
-
if (this._currentIndex += 1, this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || this._string[this._currentIndex] > "9")
|
|
99
|
-
return null;
|
|
100
|
-
for (; this._currentIndex < this._endIndex && this._string[this._currentIndex] >= "0" && this._string[this._currentIndex] <= "9"; )
|
|
101
|
-
e *= 10, s += (this._string.charAt(this._currentIndex) - "0") / e, this._currentIndex += 1;
|
|
102
|
-
}
|
|
103
|
-
if (this._currentIndex !== a && this._currentIndex + 1 < this._endIndex && (this._string[this._currentIndex] === "e" || this._string[this._currentIndex] === "E") && this._string[this._currentIndex + 1] !== "x" && this._string[this._currentIndex + 1] !== "m") {
|
|
104
|
-
if (this._currentIndex += 1, this._string[this._currentIndex] === "+" ? this._currentIndex += 1 : this._string[this._currentIndex] === "-" && (this._currentIndex += 1, u = -1), this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || this._string[this._currentIndex] > "9")
|
|
105
|
-
return null;
|
|
106
|
-
for (; this._currentIndex < this._endIndex && this._string[this._currentIndex] >= "0" && this._string[this._currentIndex] <= "9"; )
|
|
107
|
-
n *= 10, n += this._string[this._currentIndex] - "0", this._currentIndex += 1;
|
|
108
|
-
}
|
|
109
|
-
var v = t + s;
|
|
110
|
-
return v *= l, n && (v *= Math.pow(10, u * n)), a === this._currentIndex ? null : (this._skipOptionalSpacesOrDelimiter(), v);
|
|
111
|
-
},
|
|
112
|
-
_parseArcFlag: function() {
|
|
113
|
-
if (this._currentIndex >= this._endIndex)
|
|
114
|
-
return null;
|
|
115
|
-
var n = null, t = this._string[this._currentIndex];
|
|
116
|
-
if (this._currentIndex += 1, t === "0")
|
|
117
|
-
n = 0;
|
|
118
|
-
else if (t === "1")
|
|
119
|
-
n = 1;
|
|
120
|
-
else
|
|
121
|
-
return null;
|
|
122
|
-
return this._skipOptionalSpacesOrDelimiter(), n;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var A = function(n) {
|
|
126
|
-
if (!n || n.length === 0) return [];
|
|
127
|
-
var t = new M(n), e = [];
|
|
128
|
-
if (t.initialCommandIsMoveTo())
|
|
129
|
-
for (; t.hasMoreData(); ) {
|
|
130
|
-
var s = t.parseSegment();
|
|
131
|
-
if (s === null)
|
|
132
|
-
break;
|
|
133
|
-
e.push(s);
|
|
134
|
-
}
|
|
135
|
-
return e;
|
|
136
|
-
}, P = SVGPathElement.prototype.setAttribute, S = SVGPathElement.prototype.setAttributeNS, _ = SVGPathElement.prototype.removeAttribute, x = SVGPathElement.prototype.removeAttributeNS, y = window.Symbol ? Symbol() : "__cachedPathData", m = window.Symbol ? Symbol() : "__cachedNormalizedPathData", L = function(n, t, e, s, l, u, a, p, i, r) {
|
|
137
|
-
var v = function(X) {
|
|
138
|
-
return Math.PI * X / 180;
|
|
139
|
-
}, h = function(X, tt, Y) {
|
|
140
|
-
var ht = X * Math.cos(Y) - tt * Math.sin(Y), pt = X * Math.sin(Y) + tt * Math.cos(Y);
|
|
141
|
-
return { x: ht, y: pt };
|
|
142
|
-
}, f = v(a), c = [], d, o, I, b;
|
|
143
|
-
if (r)
|
|
144
|
-
d = r[0], o = r[1], I = r[2], b = r[3];
|
|
145
|
-
else {
|
|
146
|
-
var O = h(n, t, -f);
|
|
147
|
-
n = O.x, t = O.y;
|
|
148
|
-
var T = h(e, s, -f);
|
|
149
|
-
e = T.x, s = T.y;
|
|
150
|
-
var w = (n - e) / 2, C = (t - s) / 2, G = w * w / (l * l) + C * C / (u * u);
|
|
151
|
-
G > 1 && (G = Math.sqrt(G), l = G * l, u = G * u);
|
|
152
|
-
var k;
|
|
153
|
-
p === i ? k = -1 : k = 1;
|
|
154
|
-
var z = l * l, H = u * u, et = z * H - z * C * C - H * w * w, at = z * C * C + H * w * w, q = k * Math.sqrt(Math.abs(et / at));
|
|
155
|
-
I = q * l * C / u + (n + e) / 2, b = q * -u * w / l + (t + s) / 2, d = Math.asin(parseFloat(((t - b) / u).toFixed(9))), o = Math.asin(parseFloat(((s - b) / u).toFixed(9))), n < I && (d = Math.PI - d), e < I && (o = Math.PI - o), d < 0 && (d = Math.PI * 2 + d), o < 0 && (o = Math.PI * 2 + o), i && d > o && (d = d - Math.PI * 2), !i && o > d && (o = o - Math.PI * 2);
|
|
156
|
-
}
|
|
157
|
-
var B = o - d;
|
|
158
|
-
if (Math.abs(B) > Math.PI * 120 / 180) {
|
|
159
|
-
var rt = o, st = e, nt = s;
|
|
160
|
-
i && o > d ? o = d + Math.PI * 120 / 180 * 1 : o = d + Math.PI * 120 / 180 * -1, e = I + l * Math.cos(o), s = b + u * Math.sin(o), c = L(
|
|
161
|
-
e,
|
|
162
|
-
s,
|
|
163
|
-
st,
|
|
164
|
-
nt,
|
|
165
|
-
l,
|
|
166
|
-
u,
|
|
167
|
-
a,
|
|
168
|
-
0,
|
|
169
|
-
i,
|
|
170
|
-
[o, rt, I, b]
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
B = o - d;
|
|
174
|
-
var it = Math.cos(d), ut = Math.sin(d), lt = Math.cos(o), vt = Math.sin(o), F = Math.tan(B / 4), j = 4 / 3 * l * F, J = 4 / 3 * u * F, K = [n, t], Z = [n + j * ut, t - J * it], W = [e + j * vt, s - J * lt], U = [e, s];
|
|
175
|
-
if (Z[0] = 2 * K[0] - Z[0], Z[1] = 2 * K[1] - Z[1], r)
|
|
176
|
-
return [Z, W, U].concat(c);
|
|
177
|
-
c = [Z, W, U].concat(c);
|
|
178
|
-
for (var R = [], N = 0; N < c.length; N += 3) {
|
|
179
|
-
var l = h(c[N][0], c[N][1], f), u = h(c[N + 1][0], c[N + 1][1], f), g = h(c[N + 2][0], c[N + 2][1], f);
|
|
180
|
-
R.push([l.x, l.y, u.x, u.y, g.x, g.y]);
|
|
181
|
-
}
|
|
182
|
-
return R;
|
|
183
|
-
}, D = function(n) {
|
|
184
|
-
return n.map(function(t) {
|
|
185
|
-
return {
|
|
186
|
-
type: t.type,
|
|
187
|
-
values: Array.prototype.slice.call(t.values)
|
|
188
|
-
};
|
|
189
|
-
});
|
|
190
|
-
}, $ = function(n) {
|
|
191
|
-
var t = [], e = null, s = null, l = null, u = null;
|
|
192
|
-
return n.forEach(function(a) {
|
|
193
|
-
var p = a.type;
|
|
194
|
-
if (p === "M") {
|
|
195
|
-
var i = a.values[0], r = a.values[1];
|
|
196
|
-
t.push({ type: "M", values: [i, r] }), l = i, u = r, e = i, s = r;
|
|
197
|
-
} else if (p === "m") {
|
|
198
|
-
var i = e + a.values[0], r = s + a.values[1];
|
|
199
|
-
t.push({ type: "M", values: [i, r] }), l = i, u = r, e = i, s = r;
|
|
200
|
-
} else if (p === "L") {
|
|
201
|
-
var i = a.values[0], r = a.values[1];
|
|
202
|
-
t.push({ type: "L", values: [i, r] }), e = i, s = r;
|
|
203
|
-
} else if (p === "l") {
|
|
204
|
-
var i = e + a.values[0], r = s + a.values[1];
|
|
205
|
-
t.push({ type: "L", values: [i, r] }), e = i, s = r;
|
|
206
|
-
} else if (p === "C") {
|
|
207
|
-
var v = a.values[0], h = a.values[1], f = a.values[2], c = a.values[3], i = a.values[4], r = a.values[5];
|
|
208
|
-
t.push({
|
|
209
|
-
type: "C",
|
|
210
|
-
values: [v, h, f, c, i, r]
|
|
211
|
-
}), e = i, s = r;
|
|
212
|
-
} else if (p === "c") {
|
|
213
|
-
var v = e + a.values[0], h = s + a.values[1], f = e + a.values[2], c = s + a.values[3], i = e + a.values[4], r = s + a.values[5];
|
|
214
|
-
t.push({
|
|
215
|
-
type: "C",
|
|
216
|
-
values: [v, h, f, c, i, r]
|
|
217
|
-
}), e = i, s = r;
|
|
218
|
-
} else if (p === "Q") {
|
|
219
|
-
var v = a.values[0], h = a.values[1], i = a.values[2], r = a.values[3];
|
|
220
|
-
t.push({ type: "Q", values: [v, h, i, r] }), e = i, s = r;
|
|
221
|
-
} else if (p === "q") {
|
|
222
|
-
var v = e + a.values[0], h = s + a.values[1], i = e + a.values[2], r = s + a.values[3];
|
|
223
|
-
t.push({ type: "Q", values: [v, h, i, r] }), e = i, s = r;
|
|
224
|
-
} else if (p === "A") {
|
|
225
|
-
var i = a.values[5], r = a.values[6];
|
|
226
|
-
t.push({
|
|
227
|
-
type: "A",
|
|
228
|
-
values: [
|
|
229
|
-
a.values[0],
|
|
230
|
-
a.values[1],
|
|
231
|
-
a.values[2],
|
|
232
|
-
a.values[3],
|
|
233
|
-
a.values[4],
|
|
234
|
-
i,
|
|
235
|
-
r
|
|
236
|
-
]
|
|
237
|
-
}), e = i, s = r;
|
|
238
|
-
} else if (p === "a") {
|
|
239
|
-
var i = e + a.values[5], r = s + a.values[6];
|
|
240
|
-
t.push({
|
|
241
|
-
type: "A",
|
|
242
|
-
values: [
|
|
243
|
-
a.values[0],
|
|
244
|
-
a.values[1],
|
|
245
|
-
a.values[2],
|
|
246
|
-
a.values[3],
|
|
247
|
-
a.values[4],
|
|
248
|
-
i,
|
|
249
|
-
r
|
|
250
|
-
]
|
|
251
|
-
}), e = i, s = r;
|
|
252
|
-
} else if (p === "H") {
|
|
253
|
-
var i = a.values[0];
|
|
254
|
-
t.push({ type: "H", values: [i] }), e = i;
|
|
255
|
-
} else if (p === "h") {
|
|
256
|
-
var i = e + a.values[0];
|
|
257
|
-
t.push({ type: "H", values: [i] }), e = i;
|
|
258
|
-
} else if (p === "V") {
|
|
259
|
-
var r = a.values[0];
|
|
260
|
-
t.push({ type: "V", values: [r] }), s = r;
|
|
261
|
-
} else if (p === "v") {
|
|
262
|
-
var r = s + a.values[0];
|
|
263
|
-
t.push({ type: "V", values: [r] }), s = r;
|
|
264
|
-
} else if (p === "S") {
|
|
265
|
-
var f = a.values[0], c = a.values[1], i = a.values[2], r = a.values[3];
|
|
266
|
-
t.push({ type: "S", values: [f, c, i, r] }), e = i, s = r;
|
|
267
|
-
} else if (p === "s") {
|
|
268
|
-
var f = e + a.values[0], c = s + a.values[1], i = e + a.values[2], r = s + a.values[3];
|
|
269
|
-
t.push({ type: "S", values: [f, c, i, r] }), e = i, s = r;
|
|
270
|
-
} else if (p === "T") {
|
|
271
|
-
var i = a.values[0], r = a.values[1];
|
|
272
|
-
t.push({ type: "T", values: [i, r] }), e = i, s = r;
|
|
273
|
-
} else if (p === "t") {
|
|
274
|
-
var i = e + a.values[0], r = s + a.values[1];
|
|
275
|
-
t.push({ type: "T", values: [i, r] }), e = i, s = r;
|
|
276
|
-
} else (p === "Z" || p === "z") && (t.push({ type: "Z", values: [] }), e = l, s = u);
|
|
277
|
-
}), t;
|
|
278
|
-
}, Q = function(n) {
|
|
279
|
-
var t = [], e = null, s = null, l = null, u = null, a = null, p = null, i = null;
|
|
280
|
-
return n.forEach(function(r) {
|
|
281
|
-
if (r.type === "M") {
|
|
282
|
-
var v = r.values[0], h = r.values[1];
|
|
283
|
-
t.push({ type: "M", values: [v, h] }), p = v, i = h, u = v, a = h;
|
|
284
|
-
} else if (r.type === "C") {
|
|
285
|
-
var f = r.values[0], c = r.values[1], d = r.values[2], o = r.values[3], v = r.values[4], h = r.values[5];
|
|
286
|
-
t.push({ type: "C", values: [f, c, d, o, v, h] }), s = d, l = o, u = v, a = h;
|
|
287
|
-
} else if (r.type === "L") {
|
|
288
|
-
var v = r.values[0], h = r.values[1];
|
|
289
|
-
t.push({ type: "L", values: [v, h] }), u = v, a = h;
|
|
290
|
-
} else if (r.type === "H") {
|
|
291
|
-
var v = r.values[0];
|
|
292
|
-
t.push({ type: "L", values: [v, a] }), u = v;
|
|
293
|
-
} else if (r.type === "V") {
|
|
294
|
-
var h = r.values[0];
|
|
295
|
-
t.push({ type: "L", values: [u, h] }), a = h;
|
|
296
|
-
} else if (r.type === "S") {
|
|
297
|
-
var d = r.values[0], o = r.values[1], v = r.values[2], h = r.values[3], I, b;
|
|
298
|
-
e === "C" || e === "S" ? (I = u + (u - s), b = a + (a - l)) : (I = u, b = a), t.push({ type: "C", values: [I, b, d, o, v, h] }), s = d, l = o, u = v, a = h;
|
|
299
|
-
} else if (r.type === "T") {
|
|
300
|
-
var v = r.values[0], h = r.values[1], f, c;
|
|
301
|
-
e === "Q" || e === "T" ? (f = u + (u - s), c = a + (a - l)) : (f = u, c = a);
|
|
302
|
-
var I = u + 2 * (f - u) / 3, b = a + 2 * (c - a) / 3, O = v + 2 * (f - v) / 3, T = h + 2 * (c - h) / 3;
|
|
303
|
-
t.push({
|
|
304
|
-
type: "C",
|
|
305
|
-
values: [I, b, O, T, v, h]
|
|
306
|
-
}), s = f, l = c, u = v, a = h;
|
|
307
|
-
} else if (r.type === "Q") {
|
|
308
|
-
var f = r.values[0], c = r.values[1], v = r.values[2], h = r.values[3], I = u + 2 * (f - u) / 3, b = a + 2 * (c - a) / 3, O = v + 2 * (f - v) / 3, T = h + 2 * (c - h) / 3;
|
|
309
|
-
t.push({
|
|
310
|
-
type: "C",
|
|
311
|
-
values: [I, b, O, T, v, h]
|
|
312
|
-
}), s = f, l = c, u = v, a = h;
|
|
313
|
-
} else if (r.type === "A") {
|
|
314
|
-
var w = Math.abs(r.values[0]), C = Math.abs(r.values[1]), G = r.values[2], k = r.values[3], z = r.values[4], v = r.values[5], h = r.values[6];
|
|
315
|
-
if (w === 0 || C === 0)
|
|
316
|
-
t.push({
|
|
317
|
-
type: "C",
|
|
318
|
-
values: [u, a, v, h, v, h]
|
|
319
|
-
}), u = v, a = h;
|
|
320
|
-
else if (u !== v || a !== h) {
|
|
321
|
-
var H = L(
|
|
322
|
-
u,
|
|
323
|
-
a,
|
|
324
|
-
v,
|
|
325
|
-
h,
|
|
326
|
-
w,
|
|
327
|
-
C,
|
|
328
|
-
G,
|
|
329
|
-
k,
|
|
330
|
-
z
|
|
331
|
-
);
|
|
332
|
-
H.forEach(function(q) {
|
|
333
|
-
t.push({ type: "C", values: q });
|
|
334
|
-
}), u = v, a = h;
|
|
335
|
-
}
|
|
336
|
-
} else r.type === "Z" && (t.push(r), u = p, a = i);
|
|
337
|
-
e = r.type;
|
|
338
|
-
}), t;
|
|
339
|
-
};
|
|
340
|
-
SVGPathElement.prototype.setAttribute = function(n, t) {
|
|
341
|
-
n === "d" && (this[y] = null, this[m] = null), P.call(this, n, t);
|
|
342
|
-
}, SVGPathElement.prototype.setAttributeNS = function(n, t, e) {
|
|
343
|
-
if (t === "d") {
|
|
344
|
-
var s = "http://www.w3.org/2000/svg";
|
|
345
|
-
if (n)
|
|
346
|
-
for (var l of this.ownerSVGElement.attributes)
|
|
347
|
-
l.name === `xmlns:${n}` && (s = l.value);
|
|
348
|
-
s === "http://www.w3.org/2000/svg" && (this[y] = null, this[m] = null);
|
|
349
|
-
}
|
|
350
|
-
S.call(this, n, t, e);
|
|
351
|
-
}, SVGPathElement.prototype.removeAttribute = function(n, t) {
|
|
352
|
-
n === "d" && (this[y] = null, this[m] = null), _.call(this, n);
|
|
353
|
-
}, SVGPathElement.prototype.removeAttributeNS = function(n, t) {
|
|
354
|
-
if (t === "d") {
|
|
355
|
-
var e = "http://www.w3.org/2000/svg";
|
|
356
|
-
if (n)
|
|
357
|
-
for (var s of this.ownerSVGElement.attributes)
|
|
358
|
-
s.name === `xmlns:${n}` && (e = s.value);
|
|
359
|
-
e === "http://www.w3.org/2000/svg" && (this[y] = null, this[m] = null);
|
|
360
|
-
}
|
|
361
|
-
x.call(this, n, t);
|
|
362
|
-
}, SVGPathElement.prototype.getPathData = function(n) {
|
|
363
|
-
if (n && n.normalize) {
|
|
364
|
-
if (this[m])
|
|
365
|
-
return D(this[m]);
|
|
366
|
-
var t;
|
|
367
|
-
this[y] ? t = D(this[y]) : (t = A(this.getAttribute("d") || ""), this[y] = D(t));
|
|
368
|
-
var e = Q($(t));
|
|
369
|
-
return this[m] = D(e), e;
|
|
370
|
-
} else {
|
|
371
|
-
if (this[y])
|
|
372
|
-
return D(this[y]);
|
|
373
|
-
var t = A(this.getAttribute("d") || "");
|
|
374
|
-
return this[y] = D(t), t;
|
|
375
|
-
}
|
|
376
|
-
}, SVGPathElement.prototype.setPathData = function(n) {
|
|
377
|
-
if (n.length === 0)
|
|
378
|
-
E ? this.setAttribute("d", "") : this.removeAttribute("d");
|
|
379
|
-
else {
|
|
380
|
-
for (var t = "", e = 0, s = n.length; e < s; e += 1) {
|
|
381
|
-
var l = n[e];
|
|
382
|
-
e > 0 && (t += " "), t += l.type, l.values && l.values.length > 0 && (t += " " + l.values.join(" "));
|
|
383
|
-
}
|
|
384
|
-
this.setAttribute("d", t);
|
|
385
|
-
}
|
|
386
|
-
}, SVGRectElement.prototype.getPathData = function(n) {
|
|
387
|
-
var t = this.x.baseVal.value, e = this.y.baseVal.value, s = this.width.baseVal.value, l = this.height.baseVal.value, u = this.hasAttribute("rx") ? this.rx.baseVal.value : this.ry.baseVal.value, a = this.hasAttribute("ry") ? this.ry.baseVal.value : this.rx.baseVal.value;
|
|
388
|
-
u > s / 2 && (u = s / 2), a > l / 2 && (a = l / 2);
|
|
389
|
-
var p = [
|
|
390
|
-
{ type: "M", values: [t + u, e] },
|
|
391
|
-
{ type: "H", values: [t + s - u] },
|
|
392
|
-
{ type: "A", values: [u, a, 0, 0, 1, t + s, e + a] },
|
|
393
|
-
{ type: "V", values: [e + l - a] },
|
|
394
|
-
{ type: "A", values: [u, a, 0, 0, 1, t + s - u, e + l] },
|
|
395
|
-
{ type: "H", values: [t + u] },
|
|
396
|
-
{ type: "A", values: [u, a, 0, 0, 1, t, e + l - a] },
|
|
397
|
-
{ type: "V", values: [e + a] },
|
|
398
|
-
{ type: "A", values: [u, a, 0, 0, 1, t + u, e] },
|
|
399
|
-
{ type: "Z", values: [] }
|
|
400
|
-
];
|
|
401
|
-
return p = p.filter(function(i) {
|
|
402
|
-
return !(i.type === "A" && (i.values[0] === 0 || i.values[1] === 0));
|
|
403
|
-
}), n && n.normalize === !0 && (p = Q(p)), p;
|
|
404
|
-
}, SVGCircleElement.prototype.getPathData = function(n) {
|
|
405
|
-
var t = this.cx.baseVal.value, e = this.cy.baseVal.value, s = this.r.baseVal.value, l = [
|
|
406
|
-
{ type: "M", values: [t + s, e] },
|
|
407
|
-
{ type: "A", values: [s, s, 0, 0, 1, t, e + s] },
|
|
408
|
-
{ type: "A", values: [s, s, 0, 0, 1, t - s, e] },
|
|
409
|
-
{ type: "A", values: [s, s, 0, 0, 1, t, e - s] },
|
|
410
|
-
{ type: "A", values: [s, s, 0, 0, 1, t + s, e] },
|
|
411
|
-
{ type: "Z", values: [] }
|
|
412
|
-
];
|
|
413
|
-
return n && n.normalize === !0 && (l = Q(l)), l;
|
|
414
|
-
}, SVGEllipseElement.prototype.getPathData = function(n) {
|
|
415
|
-
var t = this.cx.baseVal.value, e = this.cy.baseVal.value, s = this.rx.baseVal.value, l = this.ry.baseVal.value, u = [
|
|
416
|
-
{ type: "M", values: [t + s, e] },
|
|
417
|
-
{ type: "A", values: [s, l, 0, 0, 1, t, e + l] },
|
|
418
|
-
{ type: "A", values: [s, l, 0, 0, 1, t - s, e] },
|
|
419
|
-
{ type: "A", values: [s, l, 0, 0, 1, t, e - l] },
|
|
420
|
-
{ type: "A", values: [s, l, 0, 0, 1, t + s, e] },
|
|
421
|
-
{ type: "Z", values: [] }
|
|
422
|
-
];
|
|
423
|
-
return n && n.normalize === !0 && (u = Q(u)), u;
|
|
424
|
-
}, SVGLineElement.prototype.getPathData = function() {
|
|
425
|
-
return [
|
|
426
|
-
{ type: "M", values: [this.x1.baseVal.value, this.y1.baseVal.value] },
|
|
427
|
-
{ type: "L", values: [this.x2.baseVal.value, this.y2.baseVal.value] }
|
|
428
|
-
];
|
|
429
|
-
}, SVGPolylineElement.prototype.getPathData = function() {
|
|
430
|
-
for (var n = [], t = 0; t < this.points.numberOfItems; t += 1) {
|
|
431
|
-
var e = this.points.getItem(t);
|
|
432
|
-
n.push({
|
|
433
|
-
type: t === 0 ? "M" : "L",
|
|
434
|
-
values: [e.x, e.y]
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
return n;
|
|
438
|
-
}, SVGPolygonElement.prototype.getPathData = function() {
|
|
439
|
-
for (var n = [], t = 0; t < this.points.numberOfItems; t += 1) {
|
|
440
|
-
var e = this.points.getItem(t);
|
|
441
|
-
n.push({
|
|
442
|
-
type: t === 0 ? "M" : "L",
|
|
443
|
-
values: [e.x, e.y]
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
return n.push({
|
|
447
|
-
type: "Z",
|
|
448
|
-
values: []
|
|
449
|
-
}), n;
|
|
450
|
-
};
|
|
451
|
-
}();
|
|
452
|
-
function ct(V, { pathSelector: M = "path" } = {}) {
|
|
453
|
-
const E = document.createElement(null);
|
|
454
|
-
E.innerHTML = V;
|
|
455
|
-
const A = E.firstElementChild, S = A.querySelector(M).getPathData(), _ = A.getAttribute("viewBox").split(" ").map((m) => m.trim()), x = {
|
|
456
|
-
x: parseInt(_[0]),
|
|
457
|
-
y: parseInt(_[1]),
|
|
458
|
-
width: parseInt(_[2]),
|
|
459
|
-
height: parseInt(_[3])
|
|
460
|
-
}, y = Math.min(x.width, x.height);
|
|
461
|
-
return S.forEach((m) => {
|
|
462
|
-
m.values = m.values.map((L) => L / y);
|
|
463
|
-
}), S;
|
|
464
|
-
}
|
|
465
|
-
function ot(V, M, E, A, P) {
|
|
466
|
-
const S = [];
|
|
467
|
-
for (let _ = 0; _ <= 1; _ += 1 / P) {
|
|
468
|
-
const x = Math.pow(1 - _, 3) * V.x + 3 * Math.pow(1 - _, 2) * _ * M.x + 3 * (1 - _) * Math.pow(_, 2) * E.x + Math.pow(_, 3) * A.x, y = Math.pow(1 - _, 3) * V.y + 3 * Math.pow(1 - _, 2) * _ * M.y + 3 * (1 - _) * Math.pow(_, 2) * E.y + Math.pow(_, 3) * A.y;
|
|
469
|
-
S.push({ x, y });
|
|
470
|
-
}
|
|
471
|
-
return S;
|
|
472
|
-
}
|
|
473
|
-
function ft(V, M) {
|
|
474
|
-
const E = (M == null ? void 0 : M.segments) || 20, A = ct(V, M);
|
|
475
|
-
let P = [];
|
|
476
|
-
for (let S = 0; S < A.length - 1; S++) {
|
|
477
|
-
const { type: _, values: x } = A[S];
|
|
478
|
-
if (_ === "M" && S === 0)
|
|
479
|
-
P.push({ x: x[0], y: x[1] });
|
|
480
|
-
else if (_ === "C") {
|
|
481
|
-
const y = P[P.length - 1], m = { x: x[0], y: x[1] }, L = { x: x[2], y: x[3] }, D = { x: x[4], y: x[5] }, $ = ot(y, m, L, D, E);
|
|
482
|
-
P = [...P, ...$];
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return P;
|
|
486
|
-
}
|
|
487
|
-
export {
|
|
488
|
-
ct as getPathData,
|
|
489
|
-
ft as getPoints
|
|
490
|
-
};
|