@visactor/vrender 1.0.25 → 1.0.26-alpha.0

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/dist/index.js CHANGED
@@ -21679,41 +21679,42 @@
21679
21679
 
21680
21680
  function t(t, e, s) {
21681
21681
  if (t && t.length) {
21682
- const [n, o] = e,
21683
- a = Math.PI / 180 * s,
21684
- h = Math.cos(a),
21685
- r = Math.sin(a);
21686
- for (const e of t) {
21687
- const [t, s] = e;
21688
- e[0] = (t - n) * h - (s - o) * r + n, e[1] = (t - n) * r + (s - o) * h + o;
21689
- }
21682
+ const [n, a] = e,
21683
+ o = Math.PI / 180 * s,
21684
+ h = Math.cos(o),
21685
+ r = Math.sin(o);
21686
+ t.forEach(t => {
21687
+ const [e, s] = t;
21688
+ t[0] = (e - n) * h - (s - a) * r + n, t[1] = (e - n) * r + (s - a) * h + a;
21689
+ });
21690
21690
  }
21691
21691
  }
21692
- function e(t, e) {
21693
- return t[0] === e[0] && t[1] === e[1];
21692
+ function e(t) {
21693
+ const e = t[0],
21694
+ s = t[1];
21695
+ return Math.sqrt(Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2));
21694
21696
  }
21695
- function s(s, n, o) {
21696
- let a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
21697
- const h = o,
21698
- r = Math.max(n, .1),
21699
- i = s[0] && s[0][0] && "number" == typeof s[0][0] ? [s] : s,
21700
- c = [0, 0];
21701
- if (h) for (const e of i) t(e, c, h);
21702
- const l = function (t, s, n) {
21703
- const o = [];
21704
- for (const s of t) {
21705
- const t = [...s];
21706
- e(t[0], t[t.length - 1]) || t.push([t[0][0], t[0][1]]), t.length > 2 && o.push(t);
21697
+ function s(e, s) {
21698
+ const n = s.hachureAngle + 90;
21699
+ let a = s.hachureGap;
21700
+ a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, .1);
21701
+ const o = [0, 0];
21702
+ if (n) for (const s of e) t(s, o, n);
21703
+ const h = function (t, e) {
21704
+ const s = [];
21705
+ for (const e of t) {
21706
+ const t = [...e];
21707
+ t[0].join(",") !== t[t.length - 1].join(",") && t.push([t[0][0], t[0][1]]), t.length > 2 && s.push(t);
21707
21708
  }
21709
+ const n = [];
21710
+ e = Math.max(e, .1);
21708
21711
  const a = [];
21709
- s = Math.max(s, .1);
21710
- const h = [];
21711
- for (const t of o) for (let e = 0; e < t.length - 1; e++) {
21712
+ for (const t of s) for (let e = 0; e < t.length - 1; e++) {
21712
21713
  const s = t[e],
21713
21714
  n = t[e + 1];
21714
21715
  if (s[1] !== n[1]) {
21715
21716
  const t = Math.min(s[1], n[1]);
21716
- h.push({
21717
+ a.push({
21717
21718
  ymin: t,
21718
21719
  ymax: Math.max(s[1], n[1]),
21719
21720
  x: t === s[1] ? s[0] : n[0],
@@ -21721,52 +21722,43 @@
21721
21722
  });
21722
21723
  }
21723
21724
  }
21724
- if (h.sort((t, e) => t.ymin < e.ymin ? -1 : t.ymin > e.ymin ? 1 : t.x < e.x ? -1 : t.x > e.x ? 1 : t.ymax === e.ymax ? 0 : (t.ymax - e.ymax) / Math.abs(t.ymax - e.ymax)), !h.length) return a;
21725
- let r = [],
21726
- i = h[0].ymin,
21727
- c = 0;
21728
- for (; r.length || h.length;) {
21729
- if (h.length) {
21725
+ if (a.sort((t, e) => t.ymin < e.ymin ? -1 : t.ymin > e.ymin ? 1 : t.x < e.x ? -1 : t.x > e.x ? 1 : t.ymax === e.ymax ? 0 : (t.ymax - e.ymax) / Math.abs(t.ymax - e.ymax)), !a.length) return n;
21726
+ let o = [],
21727
+ h = a[0].ymin;
21728
+ for (; o.length || a.length;) {
21729
+ if (a.length) {
21730
21730
  let t = -1;
21731
- for (let e = 0; e < h.length && !(h[e].ymin > i); e++) t = e;
21732
- h.splice(0, t + 1).forEach(t => {
21733
- r.push({
21734
- s: i,
21731
+ for (let e = 0; e < a.length && !(a[e].ymin > h); e++) t = e;
21732
+ a.splice(0, t + 1).forEach(t => {
21733
+ o.push({
21734
+ s: h,
21735
21735
  edge: t
21736
21736
  });
21737
21737
  });
21738
21738
  }
21739
- if (r = r.filter(t => !(t.edge.ymax <= i)), r.sort((t, e) => t.edge.x === e.edge.x ? 0 : (t.edge.x - e.edge.x) / Math.abs(t.edge.x - e.edge.x)), (1 !== n || c % s == 0) && r.length > 1) for (let t = 0; t < r.length; t += 2) {
21739
+ if (o = o.filter(t => !(t.edge.ymax <= h)), o.sort((t, e) => t.edge.x === e.edge.x ? 0 : (t.edge.x - e.edge.x) / Math.abs(t.edge.x - e.edge.x)), o.length > 1) for (let t = 0; t < o.length; t += 2) {
21740
21740
  const e = t + 1;
21741
- if (e >= r.length) break;
21742
- const s = r[t].edge,
21743
- n = r[e].edge;
21744
- a.push([[Math.round(s.x), i], [Math.round(n.x), i]]);
21741
+ if (e >= o.length) break;
21742
+ const s = o[t].edge,
21743
+ a = o[e].edge;
21744
+ n.push([[Math.round(s.x), h], [Math.round(a.x), h]]);
21745
21745
  }
21746
- i += n, r.forEach(t => {
21747
- t.edge.x = t.edge.x + n * t.edge.islope;
21748
- }), c++;
21746
+ h += e, o.forEach(t => {
21747
+ t.edge.x = t.edge.x + e * t.edge.islope;
21748
+ });
21749
21749
  }
21750
- return a;
21751
- }(i, r, a);
21752
- if (h) {
21753
- for (const e of i) t(e, c, -h);
21750
+ return n;
21751
+ }(e, a);
21752
+ if (n) {
21753
+ for (const s of e) t(s, o, -n);
21754
21754
  !function (e, s, n) {
21755
- const o = [];
21756
- e.forEach(t => o.push(...t)), t(o, s, n);
21757
- }(l, c, -h);
21755
+ const a = [];
21756
+ e.forEach(t => a.push(...t)), t(a, s, n);
21757
+ }(h, o, -n);
21758
21758
  }
21759
- return l;
21759
+ return h;
21760
21760
  }
21761
- function n(t, e) {
21762
- var n;
21763
- const o = e.hachureAngle + 90;
21764
- let a = e.hachureGap;
21765
- a < 0 && (a = 4 * e.strokeWidth), a = Math.round(Math.max(a, .1));
21766
- let h = 1;
21767
- return e.roughness >= 1 && ((null === (n = e.randomizer) || void 0 === n ? void 0 : n.next()) || Math.random()) > .7 && (h = a), s(t, a, o, h || 1);
21768
- }
21769
- class o {
21761
+ class n {
21770
21762
  constructor(t) {
21771
21763
  this.helper = t;
21772
21764
  }
@@ -21774,10 +21766,10 @@
21774
21766
  return this._fillPolygons(t, e);
21775
21767
  }
21776
21768
  _fillPolygons(t, e) {
21777
- const s = n(t, e);
21769
+ const n = s(t, e);
21778
21770
  return {
21779
21771
  type: "fillSketch",
21780
- ops: this.renderLines(s, e)
21772
+ ops: this.renderLines(n, e)
21781
21773
  };
21782
21774
  }
21783
21775
  renderLines(t, e) {
@@ -21786,148 +21778,143 @@
21786
21778
  return s;
21787
21779
  }
21788
21780
  }
21789
- function a(t) {
21790
- const e = t[0],
21791
- s = t[1];
21792
- return Math.sqrt(Math.pow(e[0] - s[0], 2) + Math.pow(e[1] - s[1], 2));
21793
- }
21794
- class h extends o {
21795
- fillPolygons(t, e) {
21796
- let s = e.hachureGap;
21797
- s < 0 && (s = 4 * e.strokeWidth), s = Math.max(s, .1);
21798
- const o = n(t, Object.assign({}, e, {
21799
- hachureGap: s
21781
+ class a extends n {
21782
+ fillPolygons(t, n) {
21783
+ let a = n.hachureGap;
21784
+ a < 0 && (a = 4 * n.strokeWidth), a = Math.max(a, .1);
21785
+ const o = s(t, Object.assign({}, n, {
21786
+ hachureGap: a
21800
21787
  })),
21801
- h = Math.PI / 180 * e.hachureAngle,
21788
+ h = Math.PI / 180 * n.hachureAngle,
21802
21789
  r = [],
21803
- i = .5 * s * Math.cos(h),
21804
- c = .5 * s * Math.sin(h);
21805
- for (const [t, e] of o) a([t, e]) && r.push([[t[0] - i, t[1] + c], [...e]], [[t[0] + i, t[1] - c], [...e]]);
21790
+ i = .5 * a * Math.cos(h),
21791
+ c = .5 * a * Math.sin(h);
21792
+ for (const [t, s] of o) e([t, s]) && r.push([[t[0] - i, t[1] + c], [...s]], [[t[0] + i, t[1] - c], [...s]]);
21806
21793
  return {
21807
21794
  type: "fillSketch",
21808
- ops: this.renderLines(r, e)
21795
+ ops: this.renderLines(r, n)
21809
21796
  };
21810
21797
  }
21811
21798
  }
21812
- class r extends o {
21799
+ class o extends n {
21813
21800
  fillPolygons(t, e) {
21814
21801
  const s = this._fillPolygons(t, e),
21815
21802
  n = Object.assign({}, e, {
21816
21803
  hachureAngle: e.hachureAngle + 90
21817
21804
  }),
21818
- o = this._fillPolygons(t, n);
21819
- return s.ops = s.ops.concat(o.ops), s;
21805
+ a = this._fillPolygons(t, n);
21806
+ return s.ops = s.ops.concat(a.ops), s;
21820
21807
  }
21821
21808
  }
21822
- class i {
21809
+ class h {
21823
21810
  constructor(t) {
21824
21811
  this.helper = t;
21825
21812
  }
21826
21813
  fillPolygons(t, e) {
21827
- const s = n(t, e = Object.assign({}, e, {
21814
+ const n = s(t, e = Object.assign({}, e, {
21828
21815
  hachureAngle: 0
21829
21816
  }));
21830
- return this.dotsOnLines(s, e);
21817
+ return this.dotsOnLines(n, e);
21831
21818
  }
21832
- dotsOnLines(t, e) {
21833
- const s = [];
21834
- let n = e.hachureGap;
21835
- n < 0 && (n = 4 * e.strokeWidth), n = Math.max(n, .1);
21836
- let o = e.fillWeight;
21837
- o < 0 && (o = e.strokeWidth / 2);
21838
- const h = n / 4;
21819
+ dotsOnLines(t, s) {
21820
+ const n = [];
21821
+ let a = s.hachureGap;
21822
+ a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, .1);
21823
+ let o = s.fillWeight;
21824
+ o < 0 && (o = s.strokeWidth / 2);
21825
+ const h = a / 4;
21839
21826
  for (const r of t) {
21840
- const t = a(r),
21841
- i = t / n,
21827
+ const t = e(r),
21828
+ i = t / a,
21842
21829
  c = Math.ceil(i) - 1,
21843
- l = t - c * n,
21844
- u = (r[0][0] + r[1][0]) / 2 - n / 4,
21830
+ l = t - c * a,
21831
+ u = (r[0][0] + r[1][0]) / 2 - a / 4,
21845
21832
  p = Math.min(r[0][1], r[1][1]);
21846
21833
  for (let t = 0; t < c; t++) {
21847
- const a = p + l + t * n,
21834
+ const e = p + l + t * a,
21848
21835
  r = u - h + 2 * Math.random() * h,
21849
- i = a - h + 2 * Math.random() * h,
21850
- c = this.helper.ellipse(r, i, o, o, e);
21851
- s.push(...c.ops);
21836
+ i = e - h + 2 * Math.random() * h,
21837
+ c = this.helper.ellipse(r, i, o, o, s);
21838
+ n.push(...c.ops);
21852
21839
  }
21853
21840
  }
21854
21841
  return {
21855
21842
  type: "fillSketch",
21856
- ops: s
21843
+ ops: n
21857
21844
  };
21858
21845
  }
21859
21846
  }
21860
- class c {
21847
+ class r {
21861
21848
  constructor(t) {
21862
21849
  this.helper = t;
21863
21850
  }
21864
21851
  fillPolygons(t, e) {
21865
- const s = n(t, e);
21852
+ const n = s(t, e);
21866
21853
  return {
21867
21854
  type: "fillSketch",
21868
- ops: this.dashedLine(s, e)
21855
+ ops: this.dashedLine(n, e)
21869
21856
  };
21870
21857
  }
21871
- dashedLine(t, e) {
21872
- const s = e.dashOffset < 0 ? e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap : e.dashOffset,
21873
- n = e.dashGap < 0 ? e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap : e.dashGap,
21858
+ dashedLine(t, s) {
21859
+ const n = s.dashOffset < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashOffset,
21860
+ a = s.dashGap < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashGap,
21874
21861
  o = [];
21875
21862
  return t.forEach(t => {
21876
- const h = a(t),
21877
- r = Math.floor(h / (s + n)),
21878
- i = (h + n - r * (s + n)) / 2;
21863
+ const h = e(t),
21864
+ r = Math.floor(h / (n + a)),
21865
+ i = (h + a - r * (n + a)) / 2;
21879
21866
  let c = t[0],
21880
21867
  l = t[1];
21881
21868
  c[0] > l[0] && (c = t[1], l = t[0]);
21882
21869
  const u = Math.atan((l[1] - c[1]) / (l[0] - c[0]));
21883
21870
  for (let t = 0; t < r; t++) {
21884
- const a = t * (s + n),
21885
- h = a + s,
21886
- r = [c[0] + a * Math.cos(u) + i * Math.cos(u), c[1] + a * Math.sin(u) + i * Math.sin(u)],
21871
+ const e = t * (n + a),
21872
+ h = e + n,
21873
+ r = [c[0] + e * Math.cos(u) + i * Math.cos(u), c[1] + e * Math.sin(u) + i * Math.sin(u)],
21887
21874
  l = [c[0] + h * Math.cos(u) + i * Math.cos(u), c[1] + h * Math.sin(u) + i * Math.sin(u)];
21888
- o.push(...this.helper.doubleLineOps(r[0], r[1], l[0], l[1], e));
21875
+ o.push(...this.helper.doubleLineOps(r[0], r[1], l[0], l[1], s));
21889
21876
  }
21890
21877
  }), o;
21891
21878
  }
21892
21879
  }
21893
- class l {
21880
+ class i {
21894
21881
  constructor(t) {
21895
21882
  this.helper = t;
21896
21883
  }
21897
21884
  fillPolygons(t, e) {
21898
- const s = e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap,
21899
- o = e.zigzagOffset < 0 ? s : e.zigzagOffset,
21900
- a = n(t, e = Object.assign({}, e, {
21901
- hachureGap: s + o
21885
+ const n = e.hachureGap < 0 ? 4 * e.strokeWidth : e.hachureGap,
21886
+ a = e.zigzagOffset < 0 ? n : e.zigzagOffset,
21887
+ o = s(t, e = Object.assign({}, e, {
21888
+ hachureGap: n + a
21902
21889
  }));
21903
21890
  return {
21904
21891
  type: "fillSketch",
21905
- ops: this.zigzagLines(a, o, e)
21892
+ ops: this.zigzagLines(o, a, e)
21906
21893
  };
21907
21894
  }
21908
- zigzagLines(t, e, s) {
21909
- const n = [];
21895
+ zigzagLines(t, s, n) {
21896
+ const a = [];
21910
21897
  return t.forEach(t => {
21911
- const o = a(t),
21912
- h = Math.round(o / (2 * e));
21898
+ const o = e(t),
21899
+ h = Math.round(o / (2 * s));
21913
21900
  let r = t[0],
21914
21901
  i = t[1];
21915
21902
  r[0] > i[0] && (r = t[1], i = t[0]);
21916
21903
  const c = Math.atan((i[1] - r[1]) / (i[0] - r[0]));
21917
21904
  for (let t = 0; t < h; t++) {
21918
- const o = 2 * t * e,
21919
- a = 2 * (t + 1) * e,
21920
- h = Math.sqrt(2 * Math.pow(e, 2)),
21921
- i = [r[0] + o * Math.cos(c), r[1] + o * Math.sin(c)],
21922
- l = [r[0] + a * Math.cos(c), r[1] + a * Math.sin(c)],
21905
+ const e = 2 * t * s,
21906
+ o = 2 * (t + 1) * s,
21907
+ h = Math.sqrt(2 * Math.pow(s, 2)),
21908
+ i = [r[0] + e * Math.cos(c), r[1] + e * Math.sin(c)],
21909
+ l = [r[0] + o * Math.cos(c), r[1] + o * Math.sin(c)],
21923
21910
  u = [i[0] + h * Math.cos(c + Math.PI / 4), i[1] + h * Math.sin(c + Math.PI / 4)];
21924
- n.push(...this.helper.doubleLineOps(i[0], i[1], u[0], u[1], s), ...this.helper.doubleLineOps(u[0], u[1], l[0], l[1], s));
21911
+ a.push(...this.helper.doubleLineOps(i[0], i[1], u[0], u[1], n), ...this.helper.doubleLineOps(u[0], u[1], l[0], l[1], n));
21925
21912
  }
21926
- }), n;
21913
+ }), a;
21927
21914
  }
21928
21915
  }
21929
- const u = {};
21930
- class p {
21916
+ const c = {};
21917
+ class l {
21931
21918
  constructor(t) {
21932
21919
  this.seed = t;
21933
21920
  }
@@ -21935,116 +21922,113 @@
21935
21922
  return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
21936
21923
  }
21937
21924
  }
21938
- const f = 0,
21939
- d = 1,
21940
- g = 2,
21941
- M = {
21942
- A: 7,
21943
- a: 7,
21944
- C: 6,
21945
- c: 6,
21946
- H: 1,
21947
- h: 1,
21948
- L: 2,
21949
- l: 2,
21950
- M: 2,
21951
- m: 2,
21952
- Q: 4,
21953
- q: 4,
21954
- S: 4,
21955
- s: 4,
21956
- T: 2,
21957
- t: 2,
21958
- V: 1,
21959
- v: 1,
21960
- Z: 0,
21961
- z: 0
21962
- };
21963
- function k(t, e) {
21925
+ const u = {
21926
+ A: 7,
21927
+ a: 7,
21928
+ C: 6,
21929
+ c: 6,
21930
+ H: 1,
21931
+ h: 1,
21932
+ L: 2,
21933
+ l: 2,
21934
+ M: 2,
21935
+ m: 2,
21936
+ Q: 4,
21937
+ q: 4,
21938
+ S: 4,
21939
+ s: 4,
21940
+ T: 2,
21941
+ t: 2,
21942
+ V: 1,
21943
+ v: 1,
21944
+ Z: 0,
21945
+ z: 0
21946
+ };
21947
+ function p(t, e) {
21964
21948
  return t.type === e;
21965
21949
  }
21966
- function b(t) {
21950
+ function f(t) {
21967
21951
  const e = [],
21968
21952
  s = function (t) {
21969
21953
  const e = new Array();
21970
21954
  for (; "" !== t;) if (t.match(/^([ \t\r\n,]+)/)) t = t.substr(RegExp.$1.length);else if (t.match(/^([aAcChHlLmMqQsStTvVzZ])/)) e[e.length] = {
21971
- type: f,
21955
+ type: 0,
21972
21956
  text: RegExp.$1
21973
21957
  }, t = t.substr(RegExp.$1.length);else {
21974
21958
  if (!t.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
21975
21959
  e[e.length] = {
21976
- type: d,
21960
+ type: 1,
21977
21961
  text: `${parseFloat(RegExp.$1)}`
21978
21962
  }, t = t.substr(RegExp.$1.length);
21979
21963
  }
21980
21964
  return e[e.length] = {
21981
- type: g,
21965
+ type: 2,
21982
21966
  text: ""
21983
21967
  }, e;
21984
21968
  }(t);
21985
21969
  let n = "BOD",
21986
- o = 0,
21987
- a = s[o];
21988
- for (; !k(a, g);) {
21970
+ a = 0,
21971
+ o = s[a];
21972
+ for (; !p(o, 2);) {
21989
21973
  let h = 0;
21990
21974
  const r = [];
21991
21975
  if ("BOD" === n) {
21992
- if ("M" !== a.text && "m" !== a.text) return b("M0,0" + t);
21993
- o++, h = M[a.text], n = a.text;
21994
- } else k(a, d) ? h = M[n] : (o++, h = M[a.text], n = a.text);
21995
- if (!(o + h < s.length)) throw new Error("Path data ended short");
21996
- for (let t = o; t < o + h; t++) {
21976
+ if ("M" !== o.text && "m" !== o.text) return f("M0,0" + t);
21977
+ a++, h = u[o.text], n = o.text;
21978
+ } else p(o, 1) ? h = u[n] : (a++, h = u[o.text], n = o.text);
21979
+ if (!(a + h < s.length)) throw new Error("Path data ended short");
21980
+ for (let t = a; t < a + h; t++) {
21997
21981
  const e = s[t];
21998
- if (!k(e, d)) throw new Error("Param not a number: " + n + "," + e.text);
21982
+ if (!p(e, 1)) throw new Error("Param not a number: " + n + "," + e.text);
21999
21983
  r[r.length] = +e.text;
22000
21984
  }
22001
- if ("number" != typeof M[n]) throw new Error("Bad segment: " + n);
21985
+ if ("number" != typeof u[n]) throw new Error("Bad segment: " + n);
22002
21986
  {
22003
21987
  const t = {
22004
21988
  key: n,
22005
21989
  data: r
22006
21990
  };
22007
- e.push(t), o += h, a = s[o], "M" === n && (n = "L"), "m" === n && (n = "l");
21991
+ e.push(t), a += h, o = s[a], "M" === n && (n = "L"), "m" === n && (n = "l");
22008
21992
  }
22009
21993
  }
22010
21994
  return e;
22011
21995
  }
22012
- function y(t) {
21996
+ function d(t) {
22013
21997
  let e = 0,
22014
21998
  s = 0,
22015
21999
  n = 0,
22016
- o = 0;
22017
- const a = [];
22000
+ a = 0;
22001
+ const o = [];
22018
22002
  for (const {
22019
22003
  key: h,
22020
22004
  data: r
22021
22005
  } of t) switch (h) {
22022
22006
  case "M":
22023
- a.push({
22007
+ o.push({
22024
22008
  key: "M",
22025
22009
  data: [...r]
22026
- }), [e, s] = r, [n, o] = r;
22010
+ }), [e, s] = r, [n, a] = r;
22027
22011
  break;
22028
22012
  case "m":
22029
- e += r[0], s += r[1], a.push({
22013
+ e += r[0], s += r[1], o.push({
22030
22014
  key: "M",
22031
22015
  data: [e, s]
22032
- }), n = e, o = s;
22016
+ }), n = e, a = s;
22033
22017
  break;
22034
22018
  case "L":
22035
- a.push({
22019
+ o.push({
22036
22020
  key: "L",
22037
22021
  data: [...r]
22038
22022
  }), [e, s] = r;
22039
22023
  break;
22040
22024
  case "l":
22041
- e += r[0], s += r[1], a.push({
22025
+ e += r[0], s += r[1], o.push({
22042
22026
  key: "L",
22043
22027
  data: [e, s]
22044
22028
  });
22045
22029
  break;
22046
22030
  case "C":
22047
- a.push({
22031
+ o.push({
22048
22032
  key: "C",
22049
22033
  data: [...r]
22050
22034
  }), e = r[4], s = r[5];
@@ -22052,14 +22036,14 @@
22052
22036
  case "c":
22053
22037
  {
22054
22038
  const t = r.map((t, n) => n % 2 ? t + s : t + e);
22055
- a.push({
22039
+ o.push({
22056
22040
  key: "C",
22057
22041
  data: t
22058
22042
  }), e = t[4], s = t[5];
22059
22043
  break;
22060
22044
  }
22061
22045
  case "Q":
22062
- a.push({
22046
+ o.push({
22063
22047
  key: "Q",
22064
22048
  data: [...r]
22065
22049
  }), e = r[2], s = r[3];
@@ -22067,50 +22051,50 @@
22067
22051
  case "q":
22068
22052
  {
22069
22053
  const t = r.map((t, n) => n % 2 ? t + s : t + e);
22070
- a.push({
22054
+ o.push({
22071
22055
  key: "Q",
22072
22056
  data: t
22073
22057
  }), e = t[2], s = t[3];
22074
22058
  break;
22075
22059
  }
22076
22060
  case "A":
22077
- a.push({
22061
+ o.push({
22078
22062
  key: "A",
22079
22063
  data: [...r]
22080
22064
  }), e = r[5], s = r[6];
22081
22065
  break;
22082
22066
  case "a":
22083
- e += r[5], s += r[6], a.push({
22067
+ e += r[5], s += r[6], o.push({
22084
22068
  key: "A",
22085
22069
  data: [r[0], r[1], r[2], r[3], r[4], e, s]
22086
22070
  });
22087
22071
  break;
22088
22072
  case "H":
22089
- a.push({
22073
+ o.push({
22090
22074
  key: "H",
22091
22075
  data: [...r]
22092
22076
  }), e = r[0];
22093
22077
  break;
22094
22078
  case "h":
22095
- e += r[0], a.push({
22079
+ e += r[0], o.push({
22096
22080
  key: "H",
22097
22081
  data: [e]
22098
22082
  });
22099
22083
  break;
22100
22084
  case "V":
22101
- a.push({
22085
+ o.push({
22102
22086
  key: "V",
22103
22087
  data: [...r]
22104
22088
  }), s = r[0];
22105
22089
  break;
22106
22090
  case "v":
22107
- s += r[0], a.push({
22091
+ s += r[0], o.push({
22108
22092
  key: "V",
22109
22093
  data: [s]
22110
22094
  });
22111
22095
  break;
22112
22096
  case "S":
22113
- a.push({
22097
+ o.push({
22114
22098
  key: "S",
22115
22099
  data: [...r]
22116
22100
  }), e = r[2], s = r[3];
@@ -22118,39 +22102,39 @@
22118
22102
  case "s":
22119
22103
  {
22120
22104
  const t = r.map((t, n) => n % 2 ? t + s : t + e);
22121
- a.push({
22105
+ o.push({
22122
22106
  key: "S",
22123
22107
  data: t
22124
22108
  }), e = t[2], s = t[3];
22125
22109
  break;
22126
22110
  }
22127
22111
  case "T":
22128
- a.push({
22112
+ o.push({
22129
22113
  key: "T",
22130
22114
  data: [...r]
22131
22115
  }), e = r[0], s = r[1];
22132
22116
  break;
22133
22117
  case "t":
22134
- e += r[0], s += r[1], a.push({
22118
+ e += r[0], s += r[1], o.push({
22135
22119
  key: "T",
22136
22120
  data: [e, s]
22137
22121
  });
22138
22122
  break;
22139
22123
  case "Z":
22140
22124
  case "z":
22141
- a.push({
22125
+ o.push({
22142
22126
  key: "Z",
22143
22127
  data: []
22144
- }), e = n, s = o;
22128
+ }), e = n, s = a;
22145
22129
  }
22146
- return a;
22130
+ return o;
22147
22131
  }
22148
- function m$2(t) {
22132
+ function g(t) {
22149
22133
  const e = [];
22150
22134
  let s = "",
22151
22135
  n = 0,
22152
- o = 0,
22153
22136
  a = 0,
22137
+ o = 0,
22154
22138
  h = 0,
22155
22139
  r = 0,
22156
22140
  i = 0;
@@ -22163,90 +22147,90 @@
22163
22147
  e.push({
22164
22148
  key: "M",
22165
22149
  data: [...l]
22166
- }), [n, o] = l, [a, h] = l;
22150
+ }), [n, a] = l, [o, h] = l;
22167
22151
  break;
22168
22152
  case "C":
22169
22153
  e.push({
22170
22154
  key: "C",
22171
22155
  data: [...l]
22172
- }), n = l[4], o = l[5], r = l[2], i = l[3];
22156
+ }), n = l[4], a = l[5], r = l[2], i = l[3];
22173
22157
  break;
22174
22158
  case "L":
22175
22159
  e.push({
22176
22160
  key: "L",
22177
22161
  data: [...l]
22178
- }), [n, o] = l;
22162
+ }), [n, a] = l;
22179
22163
  break;
22180
22164
  case "H":
22181
22165
  n = l[0], e.push({
22182
22166
  key: "L",
22183
- data: [n, o]
22167
+ data: [n, a]
22184
22168
  });
22185
22169
  break;
22186
22170
  case "V":
22187
- o = l[0], e.push({
22171
+ a = l[0], e.push({
22188
22172
  key: "L",
22189
- data: [n, o]
22173
+ data: [n, a]
22190
22174
  });
22191
22175
  break;
22192
22176
  case "S":
22193
22177
  {
22194
22178
  let t = 0,
22195
- a = 0;
22196
- "C" === s || "S" === s ? (t = n + (n - r), a = o + (o - i)) : (t = n, a = o), e.push({
22179
+ o = 0;
22180
+ "C" === s || "S" === s ? (t = n + (n - r), o = a + (a - i)) : (t = n, o = a), e.push({
22197
22181
  key: "C",
22198
- data: [t, a, ...l]
22199
- }), r = l[0], i = l[1], n = l[2], o = l[3];
22182
+ data: [t, o, ...l]
22183
+ }), r = l[0], i = l[1], n = l[2], a = l[3];
22200
22184
  break;
22201
22185
  }
22202
22186
  case "T":
22203
22187
  {
22204
- const [t, a] = l;
22188
+ const [t, o] = l;
22205
22189
  let h = 0,
22206
22190
  c = 0;
22207
- "Q" === s || "T" === s ? (h = n + (n - r), c = o + (o - i)) : (h = n, c = o);
22191
+ "Q" === s || "T" === s ? (h = n + (n - r), c = a + (a - i)) : (h = n, c = a);
22208
22192
  const u = n + 2 * (h - n) / 3,
22209
- p = o + 2 * (c - o) / 3,
22193
+ p = a + 2 * (c - a) / 3,
22210
22194
  f = t + 2 * (h - t) / 3,
22211
- d = a + 2 * (c - a) / 3;
22195
+ d = o + 2 * (c - o) / 3;
22212
22196
  e.push({
22213
22197
  key: "C",
22214
- data: [u, p, f, d, t, a]
22215
- }), r = h, i = c, n = t, o = a;
22198
+ data: [u, p, f, d, t, o]
22199
+ }), r = h, i = c, n = t, a = o;
22216
22200
  break;
22217
22201
  }
22218
22202
  case "Q":
22219
22203
  {
22220
- const [t, s, a, h] = l,
22204
+ const [t, s, o, h] = l,
22221
22205
  c = n + 2 * (t - n) / 3,
22222
- u = o + 2 * (s - o) / 3,
22223
- p = a + 2 * (t - a) / 3,
22206
+ u = a + 2 * (s - a) / 3,
22207
+ p = o + 2 * (t - o) / 3,
22224
22208
  f = h + 2 * (s - h) / 3;
22225
22209
  e.push({
22226
22210
  key: "C",
22227
- data: [c, u, p, f, a, h]
22228
- }), r = t, i = s, n = a, o = h;
22211
+ data: [c, u, p, f, o, h]
22212
+ }), r = t, i = s, n = o, a = h;
22229
22213
  break;
22230
22214
  }
22231
22215
  case "A":
22232
22216
  {
22233
22217
  const t = Math.abs(l[0]),
22234
22218
  s = Math.abs(l[1]),
22235
- a = l[2],
22219
+ o = l[2],
22236
22220
  h = l[3],
22237
22221
  r = l[4],
22238
22222
  i = l[5],
22239
22223
  c = l[6];
22240
22224
  if (0 === t || 0 === s) e.push({
22241
22225
  key: "C",
22242
- data: [n, o, i, c, i, c]
22243
- }), n = i, o = c;else if (n !== i || o !== c) {
22244
- x(n, o, i, c, t, s, a, h, r).forEach(function (t) {
22226
+ data: [n, a, i, c, i, c]
22227
+ }), n = i, a = c;else if (n !== i || a !== c) {
22228
+ k(n, a, i, c, t, s, o, h, r).forEach(function (t) {
22245
22229
  e.push({
22246
22230
  key: "C",
22247
22231
  data: t
22248
22232
  });
22249
- }), n = i, o = c;
22233
+ }), n = i, a = c;
22250
22234
  }
22251
22235
  break;
22252
22236
  }
@@ -22254,180 +22238,171 @@
22254
22238
  e.push({
22255
22239
  key: "Z",
22256
22240
  data: []
22257
- }), n = a, o = h;
22241
+ }), n = o, a = h;
22258
22242
  }
22259
22243
  s = c;
22260
22244
  }
22261
22245
  return e;
22262
22246
  }
22263
- function w(t, e, s) {
22247
+ function M(t, e, s) {
22264
22248
  return [t * Math.cos(s) - e * Math.sin(s), t * Math.sin(s) + e * Math.cos(s)];
22265
22249
  }
22266
- function x(t, e, s, n, o, a, h, r, i, c) {
22250
+ function k(t, e, s, n, a, o, h, r, i, c) {
22267
22251
  const l = (u = h, Math.PI * u / 180);
22268
22252
  var u;
22269
22253
  let p = [],
22270
22254
  f = 0,
22271
22255
  d = 0,
22272
22256
  g = 0,
22273
- M = 0;
22274
- if (c) [f, d, g, M] = c;else {
22275
- [t, e] = w(t, e, -l), [s, n] = w(s, n, -l);
22257
+ b = 0;
22258
+ if (c) [f, d, g, b] = c;else {
22259
+ [t, e] = M(t, e, -l), [s, n] = M(s, n, -l);
22276
22260
  const h = (t - s) / 2,
22277
22261
  c = (e - n) / 2;
22278
- let u = h * h / (o * o) + c * c / (a * a);
22279
- u > 1 && (u = Math.sqrt(u), o *= u, a *= u);
22280
- const p = o * o,
22281
- k = a * a,
22282
- b = p * k - p * c * c - k * h * h,
22283
- y = p * c * c + k * h * h,
22284
- m = (r === i ? -1 : 1) * Math.sqrt(Math.abs(b / y));
22285
- g = m * o * c / a + (t + s) / 2, M = m * -a * h / o + (e + n) / 2, f = Math.asin(parseFloat(((e - M) / a).toFixed(9))), d = Math.asin(parseFloat(((n - M) / a).toFixed(9))), t < g && (f = Math.PI - f), s < g && (d = Math.PI - d), f < 0 && (f = 2 * Math.PI + f), d < 0 && (d = 2 * Math.PI + d), i && f > d && (f -= 2 * Math.PI), !i && d > f && (d -= 2 * Math.PI);
22286
- }
22287
- let k = d - f;
22288
- if (Math.abs(k) > 120 * Math.PI / 180) {
22262
+ let u = h * h / (a * a) + c * c / (o * o);
22263
+ u > 1 && (u = Math.sqrt(u), a *= u, o *= u);
22264
+ const p = a * a,
22265
+ k = o * o,
22266
+ y = p * k - p * c * c - k * h * h,
22267
+ m = p * c * c + k * h * h,
22268
+ w = (r === i ? -1 : 1) * Math.sqrt(Math.abs(y / m));
22269
+ g = w * a * c / o + (t + s) / 2, b = w * -o * h / a + (e + n) / 2, f = Math.asin(parseFloat(((e - b) / o).toFixed(9))), d = Math.asin(parseFloat(((n - b) / o).toFixed(9))), t < g && (f = Math.PI - f), s < g && (d = Math.PI - d), f < 0 && (f = 2 * Math.PI + f), d < 0 && (d = 2 * Math.PI + d), i && f > d && (f -= 2 * Math.PI), !i && d > f && (d -= 2 * Math.PI);
22270
+ }
22271
+ let y = d - f;
22272
+ if (Math.abs(y) > 120 * Math.PI / 180) {
22289
22273
  const t = d,
22290
22274
  e = s,
22291
22275
  r = n;
22292
- d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p = x(s = g + o * Math.cos(d), n = M + a * Math.sin(d), e, r, o, a, h, 0, i, [d, t, g, M]);
22276
+ d = i && d > f ? f + 120 * Math.PI / 180 * 1 : f + 120 * Math.PI / 180 * -1, p = k(s = g + a * Math.cos(d), n = b + o * Math.sin(d), e, r, a, o, h, 0, i, [d, t, g, b]);
22293
22277
  }
22294
- k = d - f;
22295
- const b = Math.cos(f),
22296
- y = Math.sin(f),
22297
- m = Math.cos(d),
22278
+ y = d - f;
22279
+ const m = Math.cos(f),
22280
+ w = Math.sin(f),
22281
+ x = Math.cos(d),
22298
22282
  P = Math.sin(d),
22299
- v = Math.tan(k / 4),
22300
- S = 4 / 3 * o * v,
22283
+ v = Math.tan(y / 4),
22301
22284
  O = 4 / 3 * a * v,
22285
+ S = 4 / 3 * o * v,
22302
22286
  L = [t, e],
22303
- T = [t + S * y, e - O * b],
22304
- D = [s + S * P, n - O * m],
22287
+ T = [t + O * w, e - S * m],
22288
+ D = [s + O * P, n - S * x],
22305
22289
  A = [s, n];
22306
22290
  if (T[0] = 2 * L[0] - T[0], T[1] = 2 * L[1] - T[1], c) return [T, D, A].concat(p);
22307
22291
  {
22308
22292
  p = [T, D, A].concat(p);
22309
22293
  const t = [];
22310
22294
  for (let e = 0; e < p.length; e += 3) {
22311
- const s = w(p[e][0], p[e][1], l),
22312
- n = w(p[e + 1][0], p[e + 1][1], l),
22313
- o = w(p[e + 2][0], p[e + 2][1], l);
22314
- t.push([s[0], s[1], n[0], n[1], o[0], o[1]]);
22295
+ const s = M(p[e][0], p[e][1], l),
22296
+ n = M(p[e + 1][0], p[e + 1][1], l),
22297
+ a = M(p[e + 2][0], p[e + 2][1], l);
22298
+ t.push([s[0], s[1], n[0], n[1], a[0], a[1]]);
22315
22299
  }
22316
22300
  return t;
22317
22301
  }
22318
22302
  }
22319
- const P = {
22303
+ const b = {
22320
22304
  randOffset: function (t, e) {
22321
- return G(t, e);
22305
+ return A(t, e);
22322
22306
  },
22323
22307
  randOffsetWithRange: function (t, e, s) {
22324
- return E(t, e, s);
22308
+ return D(t, e, s);
22325
22309
  },
22326
- ellipse: function (t, e, s, n, o) {
22327
- const a = T(s, n, o);
22328
- return D(t, e, o, a).opset;
22310
+ ellipse: function (t, e, s, n, a) {
22311
+ const o = P(s, n, a);
22312
+ return v(t, e, a, o).opset;
22329
22313
  },
22330
- doubleLineOps: function (t, e, s, n, o) {
22331
- return $(t, e, s, n, o, !0);
22314
+ doubleLineOps: function (t, e, s, n, a) {
22315
+ return I(t, e, s, n, a, !0);
22332
22316
  }
22333
22317
  };
22334
- function v(t, e, s, n, o) {
22318
+ function y(t, e, s, n, a) {
22335
22319
  return {
22336
22320
  type: "path",
22337
- ops: $(t, e, s, n, o)
22321
+ ops: I(t, e, s, n, a)
22338
22322
  };
22339
22323
  }
22340
- function S(t, e, s) {
22324
+ function m$2(t, e, s) {
22341
22325
  const n = (t || []).length;
22342
22326
  if (n > 2) {
22343
- const o = [];
22344
- for (let e = 0; e < n - 1; e++) o.push(...$(t[e][0], t[e][1], t[e + 1][0], t[e + 1][1], s));
22345
- return e && o.push(...$(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], s)), {
22327
+ const a = [];
22328
+ for (let e = 0; e < n - 1; e++) a.push(...I(t[e][0], t[e][1], t[e + 1][0], t[e + 1][1], s));
22329
+ return e && a.push(...I(t[n - 1][0], t[n - 1][1], t[0][0], t[0][1], s)), {
22346
22330
  type: "path",
22347
- ops: o
22331
+ ops: a
22348
22332
  };
22349
22333
  }
22350
- return 2 === n ? v(t[0][0], t[0][1], t[1][0], t[1][1], s) : {
22334
+ return 2 === n ? y(t[0][0], t[0][1], t[1][0], t[1][1], s) : {
22351
22335
  type: "path",
22352
22336
  ops: []
22353
22337
  };
22354
22338
  }
22355
- function O(t, e, s, n, o) {
22339
+ function w(t, e, s, n, a) {
22356
22340
  return function (t, e) {
22357
- return S(t, !0, e);
22358
- }([[t, e], [t + s, e], [t + s, e + n], [t, e + n]], o);
22359
- }
22360
- function L(t, e) {
22361
- if (t.length) {
22362
- const s = "number" == typeof t[0][0] ? [t] : t,
22363
- n = j(s[0], 1 * (1 + .2 * e.roughness), e),
22364
- o = e.disableMultiStroke ? [] : j(s[0], 1.5 * (1 + .22 * e.roughness), z(e));
22365
- for (let t = 1; t < s.length; t++) {
22366
- const a = s[t];
22367
- if (a.length) {
22368
- const t = j(a, 1 * (1 + .2 * e.roughness), e),
22369
- s = e.disableMultiStroke ? [] : j(a, 1.5 * (1 + .22 * e.roughness), z(e));
22370
- for (const e of t) "move" !== e.op && n.push(e);
22371
- for (const t of s) "move" !== t.op && o.push(t);
22372
- }
22373
- }
22374
- return {
22375
- type: "path",
22376
- ops: n.concat(o)
22377
- };
22341
+ return m$2(t, !0, e);
22342
+ }([[t, e], [t + s, e], [t + s, e + n], [t, e + n]], a);
22343
+ }
22344
+ function x(t, e) {
22345
+ let s = _(t, 1 * (1 + .2 * e.roughness), e);
22346
+ if (!e.disableMultiStroke) {
22347
+ const n = _(t, 1.5 * (1 + .22 * e.roughness), function (t) {
22348
+ const e = Object.assign({}, t);
22349
+ e.randomizer = void 0, t.seed && (e.seed = t.seed + 1);
22350
+ return e;
22351
+ }(e));
22352
+ s = s.concat(n);
22378
22353
  }
22379
22354
  return {
22380
22355
  type: "path",
22381
- ops: []
22356
+ ops: s
22382
22357
  };
22383
22358
  }
22384
- function T(t, e, s) {
22359
+ function P(t, e, s) {
22385
22360
  const n = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(e / 2, 2)) / 2)),
22386
- o = Math.ceil(Math.max(s.curveStepCount, s.curveStepCount / Math.sqrt(200) * n)),
22387
- a = 2 * Math.PI / o;
22361
+ a = Math.ceil(Math.max(s.curveStepCount, s.curveStepCount / Math.sqrt(200) * n)),
22362
+ o = 2 * Math.PI / a;
22388
22363
  let h = Math.abs(t / 2),
22389
22364
  r = Math.abs(e / 2);
22390
22365
  const i = 1 - s.curveFitting;
22391
- return h += G(h * i, s), r += G(r * i, s), {
22392
- increment: a,
22366
+ return h += A(h * i, s), r += A(r * i, s), {
22367
+ increment: o,
22393
22368
  rx: h,
22394
22369
  ry: r
22395
22370
  };
22396
22371
  }
22397
- function D(t, e, s, n) {
22398
- const [o, a] = F(n.increment, t, e, n.rx, n.ry, 1, n.increment * E(.1, E(.4, 1, s), s), s);
22399
- let h = q(o, null, s);
22372
+ function v(t, e, s, n) {
22373
+ const [a, o] = z(n.increment, t, e, n.rx, n.ry, 1, n.increment * D(.1, D(.4, 1, s), s), s);
22374
+ let h = W(a, null, s);
22400
22375
  if (!s.disableMultiStroke && 0 !== s.roughness) {
22401
- const [o] = F(n.increment, t, e, n.rx, n.ry, 1.5, 0, s),
22402
- a = q(o, null, s);
22403
- h = h.concat(a);
22376
+ const [a] = z(n.increment, t, e, n.rx, n.ry, 1.5, 0, s),
22377
+ o = W(a, null, s);
22378
+ h = h.concat(o);
22404
22379
  }
22405
22380
  return {
22406
- estimatedPoints: a,
22381
+ estimatedPoints: o,
22407
22382
  opset: {
22408
22383
  type: "path",
22409
22384
  ops: h
22410
22385
  }
22411
22386
  };
22412
22387
  }
22413
- function A(t, e, s, n, o, a, h, r, i) {
22388
+ function O(t, e, s, n, a, o, h, r, i) {
22414
22389
  const c = t,
22415
22390
  l = e;
22416
22391
  let u = Math.abs(s / 2),
22417
22392
  p = Math.abs(n / 2);
22418
- u += G(.01 * u, i), p += G(.01 * p, i);
22419
- let f = o,
22420
- d = a;
22393
+ u += A(.01 * u, i), p += A(.01 * p, i);
22394
+ let f = a,
22395
+ d = o;
22421
22396
  for (; f < 0;) f += 2 * Math.PI, d += 2 * Math.PI;
22422
22397
  d - f > 2 * Math.PI && (f = 0, d = 2 * Math.PI);
22423
22398
  const g = 2 * Math.PI / i.curveStepCount,
22424
22399
  M = Math.min(g / 2, (d - f) / 2),
22425
- k = V(M, c, l, u, p, f, d, 1, i);
22400
+ k = E(M, c, l, u, p, f, d, 1, i);
22426
22401
  if (!i.disableMultiStroke) {
22427
- const t = V(M, c, l, u, p, f, d, 1.5, i);
22402
+ const t = E(M, c, l, u, p, f, d, 1.5, i);
22428
22403
  k.push(...t);
22429
22404
  }
22430
- return h && (r ? k.push(...$(c, l, c + u * Math.cos(f), l + p * Math.sin(f), i), ...$(c, l, c + u * Math.cos(d), l + p * Math.sin(d), i)) : k.push({
22405
+ return h && (r ? k.push(...I(c, l, c + u * Math.cos(f), l + p * Math.sin(f), i), ...I(c, l, c + u * Math.cos(d), l + p * Math.sin(d), i)) : k.push({
22431
22406
  op: "lineTo",
22432
22407
  data: [c, l]
22433
22408
  }, {
@@ -22438,48 +22413,19 @@
22438
22413
  ops: k
22439
22414
  };
22440
22415
  }
22441
- function _(t, e) {
22442
- const s = m$2(y(b(t))),
22443
- n = [];
22444
- let o = [0, 0],
22445
- a = [0, 0];
22446
- for (const {
22447
- key: t,
22448
- data: h
22449
- } of s) switch (t) {
22450
- case "M":
22451
- a = [h[0], h[1]], o = [h[0], h[1]];
22452
- break;
22453
- case "L":
22454
- n.push(...$(a[0], a[1], h[0], h[1], e)), a = [h[0], h[1]];
22455
- break;
22456
- case "C":
22457
- {
22458
- const [t, s, o, r, i, c] = h;
22459
- n.push(...Z(t, s, o, r, i, c, a, e)), a = [i, c];
22460
- break;
22461
- }
22462
- case "Z":
22463
- n.push(...$(a[0], a[1], o[0], o[1], e)), a = [o[0], o[1]];
22464
- }
22465
- return {
22466
- type: "path",
22467
- ops: n
22468
- };
22469
- }
22470
- function I(t, e) {
22416
+ function S(t, e) {
22471
22417
  const s = [];
22472
22418
  for (const n of t) if (n.length) {
22473
22419
  const t = e.maxRandomnessOffset || 0,
22474
- o = n.length;
22475
- if (o > 2) {
22420
+ a = n.length;
22421
+ if (a > 2) {
22476
22422
  s.push({
22477
22423
  op: "move",
22478
- data: [n[0][0] + G(t, e), n[0][1] + G(t, e)]
22424
+ data: [n[0][0] + A(t, e), n[0][1] + A(t, e)]
22479
22425
  });
22480
- for (let a = 1; a < o; a++) s.push({
22426
+ for (let o = 1; o < a; o++) s.push({
22481
22427
  op: "lineTo",
22482
- data: [n[a][0] + G(t, e), n[a][1] + G(t, e)]
22428
+ data: [n[o][0] + A(t, e), n[o][1] + A(t, e)]
22483
22429
  });
22484
22430
  }
22485
22431
  }
@@ -22488,76 +22434,73 @@
22488
22434
  ops: s
22489
22435
  };
22490
22436
  }
22491
- function C(t, e) {
22437
+ function L(t, e) {
22492
22438
  return function (t, e) {
22493
22439
  let s = t.fillStyle || "hachure";
22494
- if (!u[s]) switch (s) {
22440
+ if (!c[s]) switch (s) {
22495
22441
  case "zigzag":
22496
- u[s] || (u[s] = new h(e));
22442
+ c[s] || (c[s] = new a(e));
22497
22443
  break;
22498
22444
  case "cross-hatch":
22499
- u[s] || (u[s] = new r(e));
22445
+ c[s] || (c[s] = new o(e));
22500
22446
  break;
22501
22447
  case "dots":
22502
- u[s] || (u[s] = new i(e));
22448
+ c[s] || (c[s] = new h(e));
22503
22449
  break;
22504
22450
  case "dashed":
22505
- u[s] || (u[s] = new c(e));
22451
+ c[s] || (c[s] = new r(e));
22506
22452
  break;
22507
22453
  case "zigzag-line":
22508
- u[s] || (u[s] = new l(e));
22454
+ c[s] || (c[s] = new i(e));
22509
22455
  break;
22456
+ case "hachure":
22510
22457
  default:
22511
- s = "hachure", u[s] || (u[s] = new o(e));
22458
+ s = "hachure", c[s] || (c[s] = new n(e));
22512
22459
  }
22513
- return u[s];
22514
- }(e, P).fillPolygons(t, e);
22515
- }
22516
- function z(t) {
22517
- const e = Object.assign({}, t);
22518
- return e.randomizer = void 0, t.seed && (e.seed = t.seed + 1), e;
22460
+ return c[s];
22461
+ }(e, b).fillPolygons(t, e);
22519
22462
  }
22520
- function W(t) {
22521
- return t.randomizer || (t.randomizer = new p(t.seed || 0)), t.randomizer.next();
22463
+ function T(t) {
22464
+ return t.randomizer || (t.randomizer = new l(t.seed || 0)), t.randomizer.next();
22522
22465
  }
22523
- function E(t, e, s) {
22466
+ function D(t, e, s) {
22524
22467
  let n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
22525
- return s.roughness * n * (W(s) * (e - t) + t);
22468
+ return s.roughness * n * (T(s) * (e - t) + t);
22526
22469
  }
22527
- function G(t, e) {
22470
+ function A(t, e) {
22528
22471
  let s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
22529
- return E(-t, t, e, s);
22472
+ return D(-t, t, e, s);
22530
22473
  }
22531
- function $(t, e, s, n, o) {
22532
- let a = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
22533
- const h = a ? o.disableMultiStrokeFill : o.disableMultiStroke,
22534
- r = R(t, e, s, n, o, !0, !1);
22474
+ function I(t, e, s, n, a) {
22475
+ let o = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !1;
22476
+ const h = o ? a.disableMultiStrokeFill : a.disableMultiStroke,
22477
+ r = C(t, e, s, n, a, !0, !1);
22535
22478
  if (h) return r;
22536
- const i = R(t, e, s, n, o, !0, !0);
22479
+ const i = C(t, e, s, n, a, !0, !0);
22537
22480
  return r.concat(i);
22538
22481
  }
22539
- function R(t, e, s, n, o, a, h) {
22482
+ function C(t, e, s, n, a, o, h) {
22540
22483
  const r = Math.pow(t - s, 2) + Math.pow(e - n, 2),
22541
22484
  i = Math.sqrt(r);
22542
22485
  let c = 1;
22543
22486
  c = i < 200 ? 1 : i > 500 ? .4 : -.0016668 * i + 1.233334;
22544
- let l = o.maxRandomnessOffset || 0;
22487
+ let l = a.maxRandomnessOffset || 0;
22545
22488
  l * l * 100 > r && (l = i / 10);
22546
22489
  const u = l / 2,
22547
- p = .2 + .2 * W(o);
22548
- let f = o.bowing * o.maxRandomnessOffset * (n - e) / 200,
22549
- d = o.bowing * o.maxRandomnessOffset * (t - s) / 200;
22550
- f = G(f, o, c), d = G(d, o, c);
22490
+ p = .2 + .2 * T(a);
22491
+ let f = a.bowing * a.maxRandomnessOffset * (n - e) / 200,
22492
+ d = a.bowing * a.maxRandomnessOffset * (t - s) / 200;
22493
+ f = A(f, a, c), d = A(d, a, c);
22551
22494
  const g = [],
22552
- M = () => G(u, o, c),
22553
- k = () => G(l, o, c),
22554
- b = o.preserveVertices;
22555
- return a && (h ? g.push({
22495
+ M = () => A(u, a, c),
22496
+ k = () => A(l, a, c),
22497
+ b = a.preserveVertices;
22498
+ return o && (h ? g.push({
22556
22499
  op: "move",
22557
22500
  data: [t + (b ? 0 : M()), e + (b ? 0 : M())]
22558
22501
  }) : g.push({
22559
22502
  op: "move",
22560
- data: [t + (b ? 0 : G(l, o, c)), e + (b ? 0 : G(l, o, c))]
22503
+ data: [t + (b ? 0 : A(l, a, c)), e + (b ? 0 : A(l, a, c))]
22561
22504
  })), h ? g.push({
22562
22505
  op: "bcurveTo",
22563
22506
  data: [f + t + (s - t) * p + M(), d + e + (n - e) * p + M(), f + t + 2 * (s - t) * p + M(), d + e + 2 * (n - e) * p + M(), s + (b ? 0 : M()), n + (b ? 0 : M())]
@@ -22566,76 +22509,75 @@
22566
22509
  data: [f + t + (s - t) * p + k(), d + e + (n - e) * p + k(), f + t + 2 * (s - t) * p + k(), d + e + 2 * (n - e) * p + k(), s + (b ? 0 : k()), n + (b ? 0 : k())]
22567
22510
  }), g;
22568
22511
  }
22569
- function j(t, e, s) {
22570
- if (!t.length) return [];
22512
+ function _(t, e, s) {
22571
22513
  const n = [];
22572
- n.push([t[0][0] + G(e, s), t[0][1] + G(e, s)]), n.push([t[0][0] + G(e, s), t[0][1] + G(e, s)]);
22573
- for (let o = 1; o < t.length; o++) n.push([t[o][0] + G(e, s), t[o][1] + G(e, s)]), o === t.length - 1 && n.push([t[o][0] + G(e, s), t[o][1] + G(e, s)]);
22574
- return q(n, null, s);
22514
+ n.push([t[0][0] + A(e, s), t[0][1] + A(e, s)]), n.push([t[0][0] + A(e, s), t[0][1] + A(e, s)]);
22515
+ for (let a = 1; a < t.length; a++) n.push([t[a][0] + A(e, s), t[a][1] + A(e, s)]), a === t.length - 1 && n.push([t[a][0] + A(e, s), t[a][1] + A(e, s)]);
22516
+ return W(n, null, s);
22575
22517
  }
22576
- function q(t, e, s) {
22518
+ function W(t, e, s) {
22577
22519
  const n = t.length,
22578
- o = [];
22520
+ a = [];
22579
22521
  if (n > 3) {
22580
- const a = [],
22522
+ const o = [],
22581
22523
  h = 1 - s.curveTightness;
22582
- o.push({
22524
+ a.push({
22583
22525
  op: "move",
22584
22526
  data: [t[1][0], t[1][1]]
22585
22527
  });
22586
22528
  for (let e = 1; e + 2 < n; e++) {
22587
22529
  const s = t[e];
22588
- a[0] = [s[0], s[1]], a[1] = [s[0] + (h * t[e + 1][0] - h * t[e - 1][0]) / 6, s[1] + (h * t[e + 1][1] - h * t[e - 1][1]) / 6], a[2] = [t[e + 1][0] + (h * t[e][0] - h * t[e + 2][0]) / 6, t[e + 1][1] + (h * t[e][1] - h * t[e + 2][1]) / 6], a[3] = [t[e + 1][0], t[e + 1][1]], o.push({
22530
+ o[0] = [s[0], s[1]], o[1] = [s[0] + (h * t[e + 1][0] - h * t[e - 1][0]) / 6, s[1] + (h * t[e + 1][1] - h * t[e - 1][1]) / 6], o[2] = [t[e + 1][0] + (h * t[e][0] - h * t[e + 2][0]) / 6, t[e + 1][1] + (h * t[e][1] - h * t[e + 2][1]) / 6], o[3] = [t[e + 1][0], t[e + 1][1]], a.push({
22589
22531
  op: "bcurveTo",
22590
- data: [a[1][0], a[1][1], a[2][0], a[2][1], a[3][0], a[3][1]]
22532
+ data: [o[1][0], o[1][1], o[2][0], o[2][1], o[3][0], o[3][1]]
22591
22533
  });
22592
22534
  }
22593
22535
  if (e && 2 === e.length) {
22594
22536
  const t = s.maxRandomnessOffset;
22595
- o.push({
22537
+ a.push({
22596
22538
  op: "lineTo",
22597
- data: [e[0] + G(t, s), e[1] + G(t, s)]
22539
+ data: [e[0] + A(t, s), e[1] + A(t, s)]
22598
22540
  });
22599
22541
  }
22600
- } else 3 === n ? (o.push({
22542
+ } else 3 === n ? (a.push({
22601
22543
  op: "move",
22602
22544
  data: [t[1][0], t[1][1]]
22603
- }), o.push({
22545
+ }), a.push({
22604
22546
  op: "bcurveTo",
22605
22547
  data: [t[1][0], t[1][1], t[2][0], t[2][1], t[2][0], t[2][1]]
22606
- })) : 2 === n && o.push(...R(t[0][0], t[0][1], t[1][0], t[1][1], s, !0, !0));
22607
- return o;
22548
+ })) : 2 === n && a.push(...I(t[0][0], t[0][1], t[1][0], t[1][1], s));
22549
+ return a;
22608
22550
  }
22609
- function F(t, e, s, n, o, a, h, r) {
22551
+ function z(t, e, s, n, a, o, h, r) {
22610
22552
  const i = [],
22611
22553
  c = [];
22612
22554
  if (0 === r.roughness) {
22613
- t /= 4, c.push([e + n * Math.cos(-t), s + o * Math.sin(-t)]);
22614
- for (let a = 0; a <= 2 * Math.PI; a += t) {
22615
- const t = [e + n * Math.cos(a), s + o * Math.sin(a)];
22555
+ t /= 4, c.push([e + n * Math.cos(-t), s + a * Math.sin(-t)]);
22556
+ for (let o = 0; o <= 2 * Math.PI; o += t) {
22557
+ const t = [e + n * Math.cos(o), s + a * Math.sin(o)];
22616
22558
  i.push(t), c.push(t);
22617
22559
  }
22618
- c.push([e + n * Math.cos(0), s + o * Math.sin(0)]), c.push([e + n * Math.cos(t), s + o * Math.sin(t)]);
22560
+ c.push([e + n * Math.cos(0), s + a * Math.sin(0)]), c.push([e + n * Math.cos(t), s + a * Math.sin(t)]);
22619
22561
  } else {
22620
- const l = G(.5, r) - Math.PI / 2;
22621
- c.push([G(a, r) + e + .9 * n * Math.cos(l - t), G(a, r) + s + .9 * o * Math.sin(l - t)]);
22562
+ const l = A(.5, r) - Math.PI / 2;
22563
+ c.push([A(o, r) + e + .9 * n * Math.cos(l - t), A(o, r) + s + .9 * a * Math.sin(l - t)]);
22622
22564
  const u = 2 * Math.PI + l - .01;
22623
22565
  for (let h = l; h < u; h += t) {
22624
- const t = [G(a, r) + e + n * Math.cos(h), G(a, r) + s + o * Math.sin(h)];
22566
+ const t = [A(o, r) + e + n * Math.cos(h), A(o, r) + s + a * Math.sin(h)];
22625
22567
  i.push(t), c.push(t);
22626
22568
  }
22627
- c.push([G(a, r) + e + n * Math.cos(l + 2 * Math.PI + .5 * h), G(a, r) + s + o * Math.sin(l + 2 * Math.PI + .5 * h)]), c.push([G(a, r) + e + .98 * n * Math.cos(l + h), G(a, r) + s + .98 * o * Math.sin(l + h)]), c.push([G(a, r) + e + .9 * n * Math.cos(l + .5 * h), G(a, r) + s + .9 * o * Math.sin(l + .5 * h)]);
22569
+ c.push([A(o, r) + e + n * Math.cos(l + 2 * Math.PI + .5 * h), A(o, r) + s + a * Math.sin(l + 2 * Math.PI + .5 * h)]), c.push([A(o, r) + e + .98 * n * Math.cos(l + h), A(o, r) + s + .98 * a * Math.sin(l + h)]), c.push([A(o, r) + e + .9 * n * Math.cos(l + .5 * h), A(o, r) + s + .9 * a * Math.sin(l + .5 * h)]);
22628
22570
  }
22629
22571
  return [c, i];
22630
22572
  }
22631
- function V(t, e, s, n, o, a, h, r, i) {
22632
- const c = a + G(.1, i),
22573
+ function E(t, e, s, n, a, o, h, r, i) {
22574
+ const c = o + A(.1, i),
22633
22575
  l = [];
22634
- l.push([G(r, i) + e + .9 * n * Math.cos(c - t), G(r, i) + s + .9 * o * Math.sin(c - t)]);
22635
- for (let a = c; a <= h; a += t) l.push([G(r, i) + e + n * Math.cos(a), G(r, i) + s + o * Math.sin(a)]);
22636
- return l.push([e + n * Math.cos(h), s + o * Math.sin(h)]), l.push([e + n * Math.cos(h), s + o * Math.sin(h)]), q(l, null, i);
22576
+ l.push([A(r, i) + e + .9 * n * Math.cos(c - t), A(r, i) + s + .9 * a * Math.sin(c - t)]);
22577
+ for (let o = c; o <= h; o += t) l.push([A(r, i) + e + n * Math.cos(o), A(r, i) + s + a * Math.sin(o)]);
22578
+ return l.push([e + n * Math.cos(h), s + a * Math.sin(h)]), l.push([e + n * Math.cos(h), s + a * Math.sin(h)]), W(l, null, i);
22637
22579
  }
22638
- function Z(t, e, s, n, o, a, h, r) {
22580
+ function $(t, e, s, n, a, o, h, r) {
22639
22581
  const i = [],
22640
22582
  c = [r.maxRandomnessOffset || 1, (r.maxRandomnessOffset || 1) + .3];
22641
22583
  let l = [0, 0];
@@ -22646,112 +22588,93 @@
22646
22588
  data: [h[0], h[1]]
22647
22589
  }) : i.push({
22648
22590
  op: "move",
22649
- data: [h[0] + (p ? 0 : G(c[0], r)), h[1] + (p ? 0 : G(c[0], r))]
22650
- }), l = p ? [o, a] : [o + G(c[f], r), a + G(c[f], r)], i.push({
22591
+ data: [h[0] + (p ? 0 : A(c[0], r)), h[1] + (p ? 0 : A(c[0], r))]
22592
+ }), l = p ? [a, o] : [a + A(c[f], r), o + A(c[f], r)], i.push({
22651
22593
  op: "bcurveTo",
22652
- data: [t + G(c[f], r), e + G(c[f], r), s + G(c[f], r), n + G(c[f], r), l[0], l[1]]
22594
+ data: [t + A(c[f], r), e + A(c[f], r), s + A(c[f], r), n + A(c[f], r), l[0], l[1]]
22653
22595
  });
22654
22596
  return i;
22655
22597
  }
22656
- function Q(t) {
22598
+ function G(t) {
22657
22599
  return [...t];
22658
22600
  }
22659
- function H(t) {
22660
- let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22661
- const s = t.length;
22662
- if (s < 3) throw new Error("A curve must have at least three points.");
22663
- const n = [];
22664
- if (3 === s) n.push(Q(t[0]), Q(t[1]), Q(t[2]), Q(t[2]));else {
22665
- const s = [];
22666
- s.push(t[0], t[0]);
22667
- for (let e = 1; e < t.length; e++) s.push(t[e]), e === t.length - 1 && s.push(t[e]);
22668
- const o = [],
22669
- a = 1 - e;
22670
- n.push(Q(s[0]));
22671
- for (let t = 1; t + 2 < s.length; t++) {
22672
- const e = s[t];
22673
- o[0] = [e[0], e[1]], o[1] = [e[0] + (a * s[t + 1][0] - a * s[t - 1][0]) / 6, e[1] + (a * s[t + 1][1] - a * s[t - 1][1]) / 6], o[2] = [s[t + 1][0] + (a * s[t][0] - a * s[t + 2][0]) / 6, s[t + 1][1] + (a * s[t][1] - a * s[t + 2][1]) / 6], o[3] = [s[t + 1][0], s[t + 1][1]], n.push(o[1], o[2], o[3]);
22674
- }
22675
- }
22676
- return n;
22677
- }
22678
- function N(t, e) {
22601
+ function R(t, e) {
22679
22602
  return Math.pow(t[0] - e[0], 2) + Math.pow(t[1] - e[1], 2);
22680
22603
  }
22681
- function B(t, e, s) {
22682
- const n = N(e, s);
22683
- if (0 === n) return N(t, e);
22684
- let o = ((t[0] - e[0]) * (s[0] - e[0]) + (t[1] - e[1]) * (s[1] - e[1])) / n;
22685
- return o = Math.max(0, Math.min(1, o)), N(t, J(e, s, o));
22604
+ function q(t, e, s) {
22605
+ const n = R(e, s);
22606
+ if (0 === n) return R(t, e);
22607
+ let a = ((t[0] - e[0]) * (s[0] - e[0]) + (t[1] - e[1]) * (s[1] - e[1])) / n;
22608
+ return a = Math.max(0, Math.min(1, a)), R(t, j(e, s, a));
22686
22609
  }
22687
- function J(t, e, s) {
22610
+ function j(t, e, s) {
22688
22611
  return [t[0] + (e[0] - t[0]) * s, t[1] + (e[1] - t[1]) * s];
22689
22612
  }
22690
- function K(t, e, s, n) {
22691
- const o = n || [];
22613
+ function F(t, e, s, n) {
22614
+ const a = n || [];
22692
22615
  if (function (t, e) {
22693
22616
  const s = t[e + 0],
22694
22617
  n = t[e + 1],
22695
- o = t[e + 2],
22696
- a = t[e + 3];
22697
- let h = 3 * n[0] - 2 * s[0] - a[0];
22618
+ a = t[e + 2],
22619
+ o = t[e + 3];
22620
+ let h = 3 * n[0] - 2 * s[0] - o[0];
22698
22621
  h *= h;
22699
- let r = 3 * n[1] - 2 * s[1] - a[1];
22622
+ let r = 3 * n[1] - 2 * s[1] - o[1];
22700
22623
  r *= r;
22701
- let i = 3 * o[0] - 2 * a[0] - s[0];
22624
+ let i = 3 * a[0] - 2 * o[0] - s[0];
22702
22625
  i *= i;
22703
- let c = 3 * o[1] - 2 * a[1] - s[1];
22626
+ let c = 3 * a[1] - 2 * o[1] - s[1];
22704
22627
  return c *= c, h < i && (h = i), r < c && (r = c), h + r;
22705
22628
  }(t, e) < s) {
22706
22629
  const s = t[e + 0];
22707
- if (o.length) {
22708
- (a = o[o.length - 1], h = s, Math.sqrt(N(a, h))) > 1 && o.push(s);
22709
- } else o.push(s);
22710
- o.push(t[e + 3]);
22630
+ if (a.length) {
22631
+ (o = a[a.length - 1], h = s, Math.sqrt(R(o, h))) > 1 && a.push(s);
22632
+ } else a.push(s);
22633
+ a.push(t[e + 3]);
22711
22634
  } else {
22712
22635
  const n = .5,
22713
- a = t[e + 0],
22636
+ o = t[e + 0],
22714
22637
  h = t[e + 1],
22715
22638
  r = t[e + 2],
22716
22639
  i = t[e + 3],
22717
- c = J(a, h, n),
22718
- l = J(h, r, n),
22719
- u = J(r, i, n),
22720
- p = J(c, l, n),
22721
- f = J(l, u, n),
22722
- d = J(p, f, n);
22723
- K([a, c, p, d], 0, s, o), K([d, f, u, i], 0, s, o);
22724
- }
22725
- var a, h;
22726
- return o;
22640
+ c = j(o, h, n),
22641
+ l = j(h, r, n),
22642
+ u = j(r, i, n),
22643
+ p = j(c, l, n),
22644
+ f = j(l, u, n),
22645
+ d = j(p, f, n);
22646
+ F([o, c, p, d], 0, s, a), F([d, f, u, i], 0, s, a);
22647
+ }
22648
+ var o, h;
22649
+ return a;
22727
22650
  }
22728
- function U(t, e) {
22729
- return X(t, 0, t.length, e);
22651
+ function V(t, e) {
22652
+ return Z(t, 0, t.length, e);
22730
22653
  }
22731
- function X(t, e, s, n, o) {
22732
- const a = o || [],
22654
+ function Z(t, e, s, n, a) {
22655
+ const o = a || [],
22733
22656
  h = t[e],
22734
22657
  r = t[s - 1];
22735
22658
  let i = 0,
22736
22659
  c = 1;
22737
22660
  for (let n = e + 1; n < s - 1; ++n) {
22738
- const e = B(t[n], h, r);
22661
+ const e = q(t[n], h, r);
22739
22662
  e > i && (i = e, c = n);
22740
22663
  }
22741
- return Math.sqrt(i) > n ? (X(t, e, c + 1, n, a), X(t, c, s, n, a)) : (a.length || a.push(h), a.push(r)), a;
22664
+ return Math.sqrt(i) > n ? (Z(t, e, c + 1, n, o), Z(t, c, s, n, o)) : (o.length || o.push(h), o.push(r)), o;
22742
22665
  }
22743
- function Y(t) {
22666
+ function Q(t) {
22744
22667
  let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .15;
22745
22668
  let s = arguments.length > 2 ? arguments[2] : undefined;
22746
22669
  const n = [],
22747
- o = (t.length - 1) / 3;
22748
- for (let s = 0; s < o; s++) {
22749
- K(t, 3 * s, e, n);
22670
+ a = (t.length - 1) / 3;
22671
+ for (let s = 0; s < a; s++) {
22672
+ F(t, 3 * s, e, n);
22750
22673
  }
22751
- return s && s > 0 ? X(n, 0, n.length, s) : n;
22674
+ return s && s > 0 ? Z(n, 0, n.length, s) : n;
22752
22675
  }
22753
- const tt$1 = "none";
22754
- class et {
22676
+ const H = "none";
22677
+ class N {
22755
22678
  constructor(t) {
22756
22679
  this.defaultOptions = {
22757
22680
  maxRandomnessOffset: 2,
@@ -22772,8 +22695,7 @@
22772
22695
  seed: 0,
22773
22696
  disableMultiStroke: !1,
22774
22697
  disableMultiStrokeFill: !1,
22775
- preserveVertices: !1,
22776
- fillShapeRoughnessGain: .8
22698
+ preserveVertices: !1
22777
22699
  }, this.config = t || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
22778
22700
  }
22779
22701
  static newSeed() {
@@ -22789,161 +22711,187 @@
22789
22711
  options: s || this.defaultOptions
22790
22712
  };
22791
22713
  }
22792
- line(t, e, s, n, o) {
22793
- const a = this._o(o);
22794
- return this._d("line", [v(t, e, s, n, a)], a);
22714
+ line(t, e, s, n, a) {
22715
+ const o = this._o(a);
22716
+ return this._d("line", [y(t, e, s, n, o)], o);
22795
22717
  }
22796
- rectangle(t, e, s, n, o) {
22797
- const a = this._o(o),
22718
+ rectangle(t, e, s, n, a) {
22719
+ const o = this._o(a),
22798
22720
  h = [],
22799
- r = O(t, e, s, n, a);
22800
- if (a.fill) {
22801
- const o = [[t, e], [t + s, e], [t + s, e + n], [t, e + n]];
22802
- "solid" === a.fillStyle ? h.push(I([o], a)) : h.push(C([o], a));
22721
+ r = w(t, e, s, n, o);
22722
+ if (o.fill) {
22723
+ const a = [[t, e], [t + s, e], [t + s, e + n], [t, e + n]];
22724
+ "solid" === o.fillStyle ? h.push(S([a], o)) : h.push(L([a], o));
22803
22725
  }
22804
- return a.stroke !== tt$1 && h.push(r), this._d("rectangle", h, a);
22726
+ return o.stroke !== H && h.push(r), this._d("rectangle", h, o);
22805
22727
  }
22806
- ellipse(t, e, s, n, o) {
22807
- const a = this._o(o),
22728
+ ellipse(t, e, s, n, a) {
22729
+ const o = this._o(a),
22808
22730
  h = [],
22809
- r = T(s, n, a),
22810
- i = D(t, e, a, r);
22811
- if (a.fill) if ("solid" === a.fillStyle) {
22812
- const s = D(t, e, a, r).opset;
22731
+ r = P(s, n, o),
22732
+ i = v(t, e, o, r);
22733
+ if (o.fill) if ("solid" === o.fillStyle) {
22734
+ const s = v(t, e, o, r).opset;
22813
22735
  s.type = "fillPath", h.push(s);
22814
- } else h.push(C([i.estimatedPoints], a));
22815
- return a.stroke !== tt$1 && h.push(i.opset), this._d("ellipse", h, a);
22736
+ } else h.push(L([i.estimatedPoints], o));
22737
+ return o.stroke !== H && h.push(i.opset), this._d("ellipse", h, o);
22816
22738
  }
22817
22739
  circle(t, e, s, n) {
22818
- const o = this.ellipse(t, e, s, s, n);
22819
- return o.shape = "circle", o;
22740
+ const a = this.ellipse(t, e, s, s, n);
22741
+ return a.shape = "circle", a;
22820
22742
  }
22821
22743
  linearPath(t, e) {
22822
22744
  const s = this._o(e);
22823
- return this._d("linearPath", [S(t, !1, s)], s);
22745
+ return this._d("linearPath", [m$2(t, !1, s)], s);
22824
22746
  }
22825
- arc(t, e, s, n, o, a) {
22747
+ arc(t, e, s, n, a, o) {
22826
22748
  let h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
22827
22749
  let r = arguments.length > 7 ? arguments[7] : undefined;
22828
22750
  const i = this._o(r),
22829
22751
  c = [],
22830
- l = A(t, e, s, n, o, a, h, !0, i);
22752
+ l = O(t, e, s, n, a, o, h, !0, i);
22831
22753
  if (h && i.fill) if ("solid" === i.fillStyle) {
22832
22754
  const h = Object.assign({}, i);
22833
22755
  h.disableMultiStroke = !0;
22834
- const r = A(t, e, s, n, o, a, !0, !1, h);
22756
+ const r = O(t, e, s, n, a, o, !0, !1, h);
22835
22757
  r.type = "fillPath", c.push(r);
22836
- } else c.push(function (t, e, s, n, o, a, h) {
22758
+ } else c.push(function (t, e, s, n, a, o, h) {
22837
22759
  const r = t,
22838
22760
  i = e;
22839
22761
  let c = Math.abs(s / 2),
22840
22762
  l = Math.abs(n / 2);
22841
- c += G(.01 * c, h), l += G(.01 * l, h);
22842
- let u = o,
22843
- p = a;
22763
+ c += A(.01 * c, h), l += A(.01 * l, h);
22764
+ let u = a,
22765
+ p = o;
22844
22766
  for (; u < 0;) u += 2 * Math.PI, p += 2 * Math.PI;
22845
22767
  p - u > 2 * Math.PI && (u = 0, p = 2 * Math.PI);
22846
22768
  const f = (p - u) / h.curveStepCount,
22847
22769
  d = [];
22848
22770
  for (let t = u; t <= p; t += f) d.push([r + c * Math.cos(t), i + l * Math.sin(t)]);
22849
- return d.push([r + c * Math.cos(p), i + l * Math.sin(p)]), d.push([r, i]), C([d], h);
22850
- }(t, e, s, n, o, a, i));
22851
- return i.stroke !== tt$1 && c.push(l), this._d("arc", c, i);
22771
+ return d.push([r + c * Math.cos(p), i + l * Math.sin(p)]), d.push([r, i]), L([d], h);
22772
+ }(t, e, s, n, a, o, i));
22773
+ return i.stroke !== H && c.push(l), this._d("arc", c, i);
22852
22774
  }
22853
22775
  curve(t, e) {
22854
22776
  const s = this._o(e),
22855
22777
  n = [],
22856
- o = L(t, s);
22857
- if (s.fill && s.fill !== tt$1) if ("solid" === s.fillStyle) {
22858
- const e = L(t, Object.assign(Object.assign({}, s), {
22859
- disableMultiStroke: !0,
22860
- roughness: s.roughness ? s.roughness + s.fillShapeRoughnessGain : 0
22861
- }));
22862
- n.push({
22863
- type: "fillPath",
22864
- ops: this._mergedShape(e.ops)
22865
- });
22866
- } else {
22867
- const e = [],
22868
- o = t;
22869
- if (o.length) {
22870
- const t = "number" == typeof o[0][0] ? [o] : o;
22871
- for (const n of t) n.length < 3 ? e.push(...n) : 3 === n.length ? e.push(...Y(H([n[0], n[0], n[1], n[2]]), 10, (1 + s.roughness) / 2)) : e.push(...Y(H(n), 10, (1 + s.roughness) / 2));
22872
- }
22873
- e.length && n.push(C([e], s));
22778
+ a = x(t, s);
22779
+ if (s.fill && s.fill !== H && t.length >= 3) {
22780
+ const e = Q(function (t) {
22781
+ let e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22782
+ const s = t.length;
22783
+ if (s < 3) throw new Error("A curve must have at least three points.");
22784
+ const n = [];
22785
+ if (3 === s) n.push(G(t[0]), G(t[1]), G(t[2]), G(t[2]));else {
22786
+ const s = [];
22787
+ s.push(t[0], t[0]);
22788
+ for (let e = 1; e < t.length; e++) s.push(t[e]), e === t.length - 1 && s.push(t[e]);
22789
+ const a = [],
22790
+ o = 1 - e;
22791
+ n.push(G(s[0]));
22792
+ for (let t = 1; t + 2 < s.length; t++) {
22793
+ const e = s[t];
22794
+ a[0] = [e[0], e[1]], a[1] = [e[0] + (o * s[t + 1][0] - o * s[t - 1][0]) / 6, e[1] + (o * s[t + 1][1] - o * s[t - 1][1]) / 6], a[2] = [s[t + 1][0] + (o * s[t][0] - o * s[t + 2][0]) / 6, s[t + 1][1] + (o * s[t][1] - o * s[t + 2][1]) / 6], a[3] = [s[t + 1][0], s[t + 1][1]], n.push(a[1], a[2], a[3]);
22795
+ }
22796
+ }
22797
+ return n;
22798
+ }(t), 10, (1 + s.roughness) / 2);
22799
+ "solid" === s.fillStyle ? n.push(S([e], s)) : n.push(L([e], s));
22874
22800
  }
22875
- return s.stroke !== tt$1 && n.push(o), this._d("curve", n, s);
22801
+ return s.stroke !== H && n.push(a), this._d("curve", n, s);
22876
22802
  }
22877
22803
  polygon(t, e) {
22878
22804
  const s = this._o(e),
22879
22805
  n = [],
22880
- o = S(t, !0, s);
22881
- return s.fill && ("solid" === s.fillStyle ? n.push(I([t], s)) : n.push(C([t], s))), s.stroke !== tt$1 && n.push(o), this._d("polygon", n, s);
22806
+ a = m$2(t, !0, s);
22807
+ return s.fill && ("solid" === s.fillStyle ? n.push(S([t], s)) : n.push(L([t], s))), s.stroke !== H && n.push(a), this._d("polygon", n, s);
22882
22808
  }
22883
22809
  path(t, e) {
22884
22810
  const s = this._o(e),
22885
22811
  n = [];
22886
22812
  if (!t) return this._d("path", n, s);
22887
22813
  t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
22888
- const o = s.fill && "transparent" !== s.fill && s.fill !== tt$1,
22889
- a = s.stroke !== tt$1,
22814
+ const a = s.fill && "transparent" !== s.fill && s.fill !== H,
22815
+ o = s.stroke !== H,
22890
22816
  h = !!(s.simplification && s.simplification < 1),
22891
22817
  r = function (t, e, s) {
22892
- const n = m$2(y(b(t))),
22893
- o = [];
22894
- let a = [],
22818
+ const n = g(d(f(t))),
22819
+ a = [];
22820
+ let o = [],
22895
22821
  h = [0, 0],
22896
22822
  r = [];
22897
22823
  const i = () => {
22898
- r.length >= 4 && a.push(...Y(r, e)), r = [];
22824
+ r.length >= 4 && o.push(...Q(r, e)), r = [];
22899
22825
  },
22900
22826
  c = () => {
22901
- i(), a.length && (o.push(a), a = []);
22827
+ i(), o.length && (a.push(o), o = []);
22902
22828
  };
22903
22829
  for (const {
22904
22830
  key: t,
22905
22831
  data: e
22906
22832
  } of n) switch (t) {
22907
22833
  case "M":
22908
- c(), h = [e[0], e[1]], a.push(h);
22834
+ c(), h = [e[0], e[1]], o.push(h);
22909
22835
  break;
22910
22836
  case "L":
22911
- i(), a.push([e[0], e[1]]);
22837
+ i(), o.push([e[0], e[1]]);
22912
22838
  break;
22913
22839
  case "C":
22914
22840
  if (!r.length) {
22915
- const t = a.length ? a[a.length - 1] : h;
22841
+ const t = o.length ? o[o.length - 1] : h;
22916
22842
  r.push([t[0], t[1]]);
22917
22843
  }
22918
22844
  r.push([e[0], e[1]]), r.push([e[2], e[3]]), r.push([e[4], e[5]]);
22919
22845
  break;
22920
22846
  case "Z":
22921
- i(), a.push([h[0], h[1]]);
22847
+ i(), o.push([h[0], h[1]]);
22922
22848
  }
22923
- if (c(), !s) return o;
22849
+ if (c(), !s) return a;
22924
22850
  const l = [];
22925
- for (const t of o) {
22926
- const e = U(t, s);
22851
+ for (const t of a) {
22852
+ const e = V(t, s);
22927
22853
  e.length && l.push(e);
22928
22854
  }
22929
22855
  return l;
22930
- }(t, 1, h ? 4 - 4 * (s.simplification || 1) : (1 + s.roughness) / 2),
22931
- i = _(t, s);
22932
- if (o) if ("solid" === s.fillStyle) {
22933
- if (1 === r.length) {
22934
- const e = _(t, Object.assign(Object.assign({}, s), {
22935
- disableMultiStroke: !0,
22936
- roughness: s.roughness ? s.roughness + s.fillShapeRoughnessGain : 0
22937
- }));
22938
- n.push({
22939
- type: "fillPath",
22940
- ops: this._mergedShape(e.ops)
22941
- });
22942
- } else n.push(I(r, s));
22943
- } else n.push(C(r, s));
22944
- return a && (h ? r.forEach(t => {
22945
- n.push(S(t, !1, s));
22946
- }) : n.push(i)), this._d("path", n, s);
22856
+ }(t, 1, h ? 4 - 4 * s.simplification : (1 + s.roughness) / 2);
22857
+ return a && ("solid" === s.fillStyle ? n.push(S(r, s)) : n.push(L(r, s))), o && (h ? r.forEach(t => {
22858
+ n.push(m$2(t, !1, s));
22859
+ }) : n.push(function (t, e) {
22860
+ const s = g(d(f(t))),
22861
+ n = [];
22862
+ let a = [0, 0],
22863
+ o = [0, 0];
22864
+ for (const {
22865
+ key: t,
22866
+ data: h
22867
+ } of s) switch (t) {
22868
+ case "M":
22869
+ {
22870
+ const t = 1 * (e.maxRandomnessOffset || 0),
22871
+ s = e.preserveVertices;
22872
+ n.push({
22873
+ op: "move",
22874
+ data: h.map(n => n + (s ? 0 : A(t, e)))
22875
+ }), o = [h[0], h[1]], a = [h[0], h[1]];
22876
+ break;
22877
+ }
22878
+ case "L":
22879
+ n.push(...I(o[0], o[1], h[0], h[1], e)), o = [h[0], h[1]];
22880
+ break;
22881
+ case "C":
22882
+ {
22883
+ const [t, s, a, r, i, c] = h;
22884
+ n.push(...$(t, s, a, r, i, c, o, e)), o = [i, c];
22885
+ break;
22886
+ }
22887
+ case "Z":
22888
+ n.push(...I(o[0], o[1], a[0], a[1], e)), o = [a[0], a[1]];
22889
+ }
22890
+ return {
22891
+ type: "path",
22892
+ ops: n
22893
+ };
22894
+ }(t, s))), this._d("path", n, s);
22947
22895
  }
22948
22896
  opsToPath(t, e) {
22949
22897
  let s = "";
@@ -22974,15 +22922,15 @@
22974
22922
  d: this.opsToPath(t),
22975
22923
  stroke: s.stroke,
22976
22924
  strokeWidth: s.strokeWidth,
22977
- fill: tt$1
22925
+ fill: H
22978
22926
  };
22979
22927
  break;
22980
22928
  case "fillPath":
22981
22929
  e = {
22982
22930
  d: this.opsToPath(t),
22983
- stroke: tt$1,
22931
+ stroke: H,
22984
22932
  strokeWidth: 0,
22985
- fill: s.fill || tt$1
22933
+ fill: s.fill || H
22986
22934
  };
22987
22935
  break;
22988
22936
  case "fillSketch":
@@ -22996,37 +22944,34 @@
22996
22944
  let s = e.fillWeight;
22997
22945
  return s < 0 && (s = e.strokeWidth / 2), {
22998
22946
  d: this.opsToPath(t),
22999
- stroke: e.fill || tt$1,
22947
+ stroke: e.fill || H,
23000
22948
  strokeWidth: s,
23001
- fill: tt$1
22949
+ fill: H
23002
22950
  };
23003
22951
  }
23004
- _mergedShape(t) {
23005
- return t.filter((t, e) => 0 === e || "move" !== t.op);
23006
- }
23007
22952
  }
23008
- class st {
22953
+ class B {
23009
22954
  constructor(t, e) {
23010
- this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new et(e);
22955
+ this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new N(e);
23011
22956
  }
23012
22957
  draw(t) {
23013
22958
  const e = t.sets || [],
23014
22959
  s = t.options || this.getDefaultOptions(),
23015
22960
  n = this.ctx,
23016
- o = t.options.fixedDecimalPlaceDigits;
23017
- for (const a of e) switch (a.type) {
22961
+ a = t.options.fixedDecimalPlaceDigits;
22962
+ for (const o of e) switch (o.type) {
23018
22963
  case "path":
23019
- n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n, a, o), n.restore();
22964
+ n.save(), n.strokeStyle = "none" === s.stroke ? "transparent" : s.stroke, n.lineWidth = s.strokeWidth, s.strokeLineDash && n.setLineDash(s.strokeLineDash), s.strokeLineDashOffset && (n.lineDashOffset = s.strokeLineDashOffset), this._drawToContext(n, o, a), n.restore();
23020
22965
  break;
23021
22966
  case "fillPath":
23022
22967
  {
23023
22968
  n.save(), n.fillStyle = s.fill || "";
23024
22969
  const e = "curve" === t.shape || "polygon" === t.shape || "path" === t.shape ? "evenodd" : "nonzero";
23025
- this._drawToContext(n, a, o, e), n.restore();
22970
+ this._drawToContext(n, o, a, e), n.restore();
23026
22971
  break;
23027
22972
  }
23028
22973
  case "fillSketch":
23029
- this.fillSketch(n, a, s);
22974
+ this.fillSketch(n, o, s);
23030
22975
  }
23031
22976
  }
23032
22977
  fillSketch(t, e, s) {
@@ -23057,21 +23002,21 @@
23057
23002
  getDefaultOptions() {
23058
23003
  return this.gen.defaultOptions;
23059
23004
  }
23060
- line(t, e, s, n, o) {
23061
- const a = this.gen.line(t, e, s, n, o);
23062
- return this.draw(a), a;
23005
+ line(t, e, s, n, a) {
23006
+ const o = this.gen.line(t, e, s, n, a);
23007
+ return this.draw(o), o;
23063
23008
  }
23064
- rectangle(t, e, s, n, o) {
23065
- const a = this.gen.rectangle(t, e, s, n, o);
23066
- return this.draw(a), a;
23009
+ rectangle(t, e, s, n, a) {
23010
+ const o = this.gen.rectangle(t, e, s, n, a);
23011
+ return this.draw(o), o;
23067
23012
  }
23068
- ellipse(t, e, s, n, o) {
23069
- const a = this.gen.ellipse(t, e, s, n, o);
23070
- return this.draw(a), a;
23013
+ ellipse(t, e, s, n, a) {
23014
+ const o = this.gen.ellipse(t, e, s, n, a);
23015
+ return this.draw(o), o;
23071
23016
  }
23072
23017
  circle(t, e, s, n) {
23073
- const o = this.gen.circle(t, e, s, n);
23074
- return this.draw(o), o;
23018
+ const a = this.gen.circle(t, e, s, n);
23019
+ return this.draw(a), a;
23075
23020
  }
23076
23021
  linearPath(t, e) {
23077
23022
  const s = this.gen.linearPath(t, e);
@@ -23081,10 +23026,10 @@
23081
23026
  const s = this.gen.polygon(t, e);
23082
23027
  return this.draw(s), s;
23083
23028
  }
23084
- arc(t, e, s, n, o, a) {
23029
+ arc(t, e, s, n, a, o) {
23085
23030
  let h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
23086
23031
  let r = arguments.length > 7 ? arguments[7] : undefined;
23087
- const i = this.gen.arc(t, e, s, n, o, a, h, r);
23032
+ const i = this.gen.arc(t, e, s, n, a, o, h, r);
23088
23033
  return this.draw(i), i;
23089
23034
  }
23090
23035
  curve(t, e) {
@@ -23096,38 +23041,38 @@
23096
23041
  return this.draw(s), s;
23097
23042
  }
23098
23043
  }
23099
- const nt = "http://www.w3.org/2000/svg";
23100
- class ot {
23044
+ const J = "http://www.w3.org/2000/svg";
23045
+ class K {
23101
23046
  constructor(t, e) {
23102
- this.svg = t, this.gen = new et(e);
23047
+ this.svg = t, this.gen = new N(e);
23103
23048
  }
23104
23049
  draw(t) {
23105
23050
  const e = t.sets || [],
23106
23051
  s = t.options || this.getDefaultOptions(),
23107
23052
  n = this.svg.ownerDocument || window.document,
23108
- o = n.createElementNS(nt, "g"),
23109
- a = t.options.fixedDecimalPlaceDigits;
23053
+ a = n.createElementNS(J, "g"),
23054
+ o = t.options.fixedDecimalPlaceDigits;
23110
23055
  for (const h of e) {
23111
23056
  let e = null;
23112
23057
  switch (h.type) {
23113
23058
  case "path":
23114
- e = n.createElementNS(nt, "path"), e.setAttribute("d", this.opsToPath(h, a)), e.setAttribute("stroke", s.stroke), e.setAttribute("stroke-width", s.strokeWidth + ""), e.setAttribute("fill", "none"), s.strokeLineDash && e.setAttribute("stroke-dasharray", s.strokeLineDash.join(" ").trim()), s.strokeLineDashOffset && e.setAttribute("stroke-dashoffset", `${s.strokeLineDashOffset}`);
23059
+ e = n.createElementNS(J, "path"), e.setAttribute("d", this.opsToPath(h, o)), e.setAttribute("stroke", s.stroke), e.setAttribute("stroke-width", s.strokeWidth + ""), e.setAttribute("fill", "none"), s.strokeLineDash && e.setAttribute("stroke-dasharray", s.strokeLineDash.join(" ").trim()), s.strokeLineDashOffset && e.setAttribute("stroke-dashoffset", `${s.strokeLineDashOffset}`);
23115
23060
  break;
23116
23061
  case "fillPath":
23117
- e = n.createElementNS(nt, "path"), e.setAttribute("d", this.opsToPath(h, a)), e.setAttribute("stroke", "none"), e.setAttribute("stroke-width", "0"), e.setAttribute("fill", s.fill || ""), "curve" !== t.shape && "polygon" !== t.shape || e.setAttribute("fill-rule", "evenodd");
23062
+ e = n.createElementNS(J, "path"), e.setAttribute("d", this.opsToPath(h, o)), e.setAttribute("stroke", "none"), e.setAttribute("stroke-width", "0"), e.setAttribute("fill", s.fill || ""), "curve" !== t.shape && "polygon" !== t.shape || e.setAttribute("fill-rule", "evenodd");
23118
23063
  break;
23119
23064
  case "fillSketch":
23120
23065
  e = this.fillSketch(n, h, s);
23121
23066
  }
23122
- e && o.appendChild(e);
23067
+ e && a.appendChild(e);
23123
23068
  }
23124
- return o;
23069
+ return a;
23125
23070
  }
23126
23071
  fillSketch(t, e, s) {
23127
23072
  let n = s.fillWeight;
23128
23073
  n < 0 && (n = s.strokeWidth / 2);
23129
- const o = t.createElementNS(nt, "path");
23130
- return o.setAttribute("d", this.opsToPath(e, s.fixedDecimalPlaceDigits)), o.setAttribute("stroke", s.fill || ""), o.setAttribute("stroke-width", n + ""), o.setAttribute("fill", "none"), s.fillLineDash && o.setAttribute("stroke-dasharray", s.fillLineDash.join(" ").trim()), s.fillLineDashOffset && o.setAttribute("stroke-dashoffset", `${s.fillLineDashOffset}`), o;
23074
+ const a = t.createElementNS(J, "path");
23075
+ return a.setAttribute("d", this.opsToPath(e, s.fixedDecimalPlaceDigits)), a.setAttribute("stroke", s.fill || ""), a.setAttribute("stroke-width", n + ""), a.setAttribute("fill", "none"), s.fillLineDash && a.setAttribute("stroke-dasharray", s.fillLineDash.join(" ").trim()), s.fillLineDashOffset && a.setAttribute("stroke-dashoffset", `${s.fillLineDashOffset}`), a;
23131
23076
  }
23132
23077
  get generator() {
23133
23078
  return this.gen;
@@ -23138,21 +23083,21 @@
23138
23083
  opsToPath(t, e) {
23139
23084
  return this.gen.opsToPath(t, e);
23140
23085
  }
23141
- line(t, e, s, n, o) {
23142
- const a = this.gen.line(t, e, s, n, o);
23143
- return this.draw(a);
23086
+ line(t, e, s, n, a) {
23087
+ const o = this.gen.line(t, e, s, n, a);
23088
+ return this.draw(o);
23144
23089
  }
23145
- rectangle(t, e, s, n, o) {
23146
- const a = this.gen.rectangle(t, e, s, n, o);
23147
- return this.draw(a);
23090
+ rectangle(t, e, s, n, a) {
23091
+ const o = this.gen.rectangle(t, e, s, n, a);
23092
+ return this.draw(o);
23148
23093
  }
23149
- ellipse(t, e, s, n, o) {
23150
- const a = this.gen.ellipse(t, e, s, n, o);
23151
- return this.draw(a);
23094
+ ellipse(t, e, s, n, a) {
23095
+ const o = this.gen.ellipse(t, e, s, n, a);
23096
+ return this.draw(o);
23152
23097
  }
23153
23098
  circle(t, e, s, n) {
23154
- const o = this.gen.circle(t, e, s, n);
23155
- return this.draw(o);
23099
+ const a = this.gen.circle(t, e, s, n);
23100
+ return this.draw(a);
23156
23101
  }
23157
23102
  linearPath(t, e) {
23158
23103
  const s = this.gen.linearPath(t, e);
@@ -23162,10 +23107,10 @@
23162
23107
  const s = this.gen.polygon(t, e);
23163
23108
  return this.draw(s);
23164
23109
  }
23165
- arc(t, e, s, n, o, a) {
23110
+ arc(t, e, s, n, a, o) {
23166
23111
  let h = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
23167
23112
  let r = arguments.length > 7 ? arguments[7] : undefined;
23168
- const i = this.gen.arc(t, e, s, n, o, a, h, r);
23113
+ const i = this.gen.arc(t, e, s, n, a, o, h, r);
23169
23114
  return this.draw(i);
23170
23115
  }
23171
23116
  curve(t, e) {
@@ -23177,11 +23122,11 @@
23177
23122
  return this.draw(s);
23178
23123
  }
23179
23124
  }
23180
- var at = {
23181
- canvas: (t, e) => new st(t, e),
23182
- svg: (t, e) => new ot(t, e),
23183
- generator: t => new et(t),
23184
- newSeed: () => et.newSeed()
23125
+ var U = {
23126
+ canvas: (t, e) => new B(t, e),
23127
+ svg: (t, e) => new K(t, e),
23128
+ generator: t => new N(t),
23129
+ newSeed: () => N.newSeed()
23185
23130
  };
23186
23131
 
23187
23132
  const defaultRouthThemeSpec = {
@@ -23620,7 +23565,7 @@
23620
23565
  } = drawContext;
23621
23566
  if (!context) return;
23622
23567
  const canvas = context.canvas.nativeCanvas,
23623
- rc = at.canvas(canvas),
23568
+ rc = U.canvas(canvas),
23624
23569
  customPath = new CustomPath2D(),
23625
23570
  roughContext = new RoughContext2d(context, customPath);
23626
23571
  context.save(), context.transformFromMatrix(graphic.transMatrix, !0);
@@ -23718,7 +23663,7 @@
23718
23663
  } = drawContext;
23719
23664
  if (!context) return;
23720
23665
  const canvas = context.canvas.nativeCanvas,
23721
- rc = at.canvas(canvas);
23666
+ rc = U.canvas(canvas);
23722
23667
  context.highPerformanceSave();
23723
23668
  const arcAttribute = arc.getGraphicTheme();
23724
23669
  let {
@@ -23806,7 +23751,7 @@
23806
23751
  if (fillCb) return super.drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb);
23807
23752
  context.highPerformanceSave();
23808
23753
  const canvas = context.canvas.nativeCanvas,
23809
- rc = at.canvas(canvas, {}),
23754
+ rc = U.canvas(canvas, {}),
23810
23755
  customPath = new CustomPath2D();
23811
23756
  drawAreaSegments(customPath, cache, clipRange, {
23812
23757
  offsetX: offsetX,
@@ -23896,7 +23841,7 @@
23896
23841
  } = drawContext;
23897
23842
  if (!context) return;
23898
23843
  const canvas = context.canvas.nativeCanvas,
23899
- rc = at.canvas(canvas, {}),
23844
+ rc = U.canvas(canvas, {}),
23900
23845
  circleAttribute = circle.getGraphicTheme();
23901
23846
  let {
23902
23847
  x = circleAttribute.x,
@@ -23970,7 +23915,7 @@
23970
23915
  } = drawContext;
23971
23916
  if (!context) return;
23972
23917
  const canvas = context.canvas.nativeCanvas,
23973
- rc = at.canvas(canvas, {});
23918
+ rc = U.canvas(canvas, {});
23974
23919
  context.highPerformanceSave();
23975
23920
  const pathAttribute = path.getGraphicTheme();
23976
23921
  context.transformFromMatrix(path.transMatrix, !0);
@@ -39330,7 +39275,7 @@
39330
39275
 
39331
39276
  exports.AXIS_ELEMENT_NAME = void 0;
39332
39277
  !function (AXIS_ELEMENT_NAME) {
39333
- AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
39278
+ AXIS_ELEMENT_NAME.innerView = "inner-view", AXIS_ELEMENT_NAME.axisContainer = "axis-container", AXIS_ELEMENT_NAME.labelContainer = "axis-label-container", AXIS_ELEMENT_NAME.tickContainer = "axis-tick-container", AXIS_ELEMENT_NAME.tick = "axis-tick", AXIS_ELEMENT_NAME.subTick = "axis-sub-tick", AXIS_ELEMENT_NAME.label = "axis-label", AXIS_ELEMENT_NAME.title = "axis-title", AXIS_ELEMENT_NAME.labelHoverOnAxis = "axis-label-hover-on-axis", AXIS_ELEMENT_NAME.gridContainer = "axis-grid-container", AXIS_ELEMENT_NAME.grid = "axis-grid", AXIS_ELEMENT_NAME.gridRegion = "axis-grid-region", AXIS_ELEMENT_NAME.line = "axis-line", AXIS_ELEMENT_NAME.background = "axis-background", AXIS_ELEMENT_NAME.axisLabelBackground = "axis-label-background", AXIS_ELEMENT_NAME.axisBreak = "axis-break", AXIS_ELEMENT_NAME.axisBreakSymbol = "axis-break-symbol";
39334
39279
  }(exports.AXIS_ELEMENT_NAME || (exports.AXIS_ELEMENT_NAME = {}));
39335
39280
  exports.AxisStateValue = void 0;
39336
39281
  !function (AxisStateValue) {
@@ -39367,6 +39312,25 @@
39367
39312
  fillOpacity: 1
39368
39313
  }
39369
39314
  },
39315
+ labelHoverOnAxis: {
39316
+ visible: !1,
39317
+ space: 4,
39318
+ position: 0,
39319
+ autoRotate: !1,
39320
+ textStyle: {
39321
+ fontSize: 12,
39322
+ fill: "white",
39323
+ fontWeight: "normal",
39324
+ fillOpacity: 1
39325
+ },
39326
+ background: {
39327
+ visible: !0,
39328
+ style: {
39329
+ cornerRadius: 2,
39330
+ fill: "black"
39331
+ }
39332
+ }
39333
+ },
39370
39334
  tick: {
39371
39335
  visible: !0,
39372
39336
  inside: !1,
@@ -40358,7 +40322,8 @@
40358
40322
  loadLineAxisComponent();
40359
40323
  class LineAxis extends AxisBase {
40360
40324
  constructor(attributes, options) {
40361
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options);
40325
+ var _a;
40326
+ attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), attributes.labelHoverOnAxis.space = null !== (_a = attributes.labelHoverOnAxis.space) && void 0 !== _a ? _a : attributes.label.space), super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null;
40362
40327
  }
40363
40328
  _renderInner(container) {
40364
40329
  var _a;
@@ -40420,6 +40385,15 @@
40420
40385
  }, panel.style));
40421
40386
  bgRect.name = exports.AXIS_ELEMENT_NAME.background, bgRect.id = this._getNodeId("background"), bgRect.states = merge({}, DEFAULT_STATES$1, null !== (_a = panel.state) && void 0 !== _a ? _a : {}), axisContainer.insertBefore(bgRect, axisContainer.firstChild);
40422
40387
  }
40388
+ const {
40389
+ labelHoverOnAxis: labelHoverOnAxis
40390
+ } = this.attribute;
40391
+ labelHoverOnAxis && labelHoverOnAxis.visible && this.renderLabelHoverOnAxis();
40392
+ }
40393
+ renderLabelHoverOnAxis() {
40394
+ const hoverOnLabelAttributes = this.getLabelHoverOnAxisAttribute(),
40395
+ hoverOnLabel = new Tag(Object.assign({}, hoverOnLabelAttributes));
40396
+ hoverOnLabel.name = exports.AXIS_ELEMENT_NAME.title, hoverOnLabel.id = this._getNodeId("hover-on-label"), this.labelHoverOnAxisGroup = hoverOnLabel, this.axisContainer.add(hoverOnLabel);
40423
40397
  }
40424
40398
  renderLine(container) {
40425
40399
  const {
@@ -40560,6 +40534,79 @@
40560
40534
  visible: !0
40561
40535
  }, background.style)), attrs;
40562
40536
  }
40537
+ getLabelHoverOnAxisAttribute() {
40538
+ var _a, _b;
40539
+ const {
40540
+ orient: orient
40541
+ } = this.attribute,
40542
+ _c = this.attribute.labelHoverOnAxis,
40543
+ {
40544
+ position = 0,
40545
+ space = 4,
40546
+ autoRotate = !0,
40547
+ textStyle = {},
40548
+ background = {},
40549
+ formatMethod: formatMethod,
40550
+ text: textContent = "",
40551
+ maxWidth: maxWidth
40552
+ } = _c,
40553
+ restAttrs = __rest$b(_c, ["position", "space", "autoRotate", "textStyle", "background", "formatMethod", "text", "maxWidth"]),
40554
+ point = this.getTickCoord(0);
40555
+ "bottom" === orient || "top" === orient ? point.x = position : point.y = position;
40556
+ let tickLength = 0;
40557
+ (null === (_a = this.attribute.tick) || void 0 === _a ? void 0 : _a.visible) && !1 === this.attribute.tick.inside && (tickLength = this.attribute.tick.length || 4), (null === (_b = this.attribute.subTick) || void 0 === _b ? void 0 : _b.visible) && !1 === this.attribute.subTick.inside && (tickLength = Math.max(tickLength, this.attribute.subTick.length || 2));
40558
+ const offset = tickLength + 0 + space,
40559
+ labelPoint = this.getVerticalCoord(point, offset, !1),
40560
+ vector = this.getVerticalVector(offset, !1, {
40561
+ x: 0,
40562
+ y: 0
40563
+ });
40564
+ let textBaseline,
40565
+ {
40566
+ angle: angle
40567
+ } = restAttrs,
40568
+ textAlign = "center";
40569
+ if (isNil$1(angle) && autoRotate) {
40570
+ const axisVector = this.getRelativeVector();
40571
+ angle = angleTo(axisVector, [1, 0], !0);
40572
+ const {
40573
+ verticalFactor = 1
40574
+ } = this.attribute;
40575
+ textBaseline = 1 === -1 * verticalFactor ? "bottom" : "top";
40576
+ } else textAlign = this.getTextAlign(vector), textBaseline = this.getTextBaseline(vector, !1);
40577
+ let maxTagWidth = maxWidth;
40578
+ if (isNil$1(maxTagWidth)) {
40579
+ const {
40580
+ verticalLimitSize: verticalLimitSize,
40581
+ verticalMinSize: verticalMinSize,
40582
+ orient: orient
40583
+ } = this.attribute,
40584
+ limitSize = Math.min(verticalLimitSize || 1 / 0, verticalMinSize || 1 / 0);
40585
+ if (isValidNumber$1(limitSize)) {
40586
+ if ("bottom" === orient || "top" === orient) {
40587
+ if (angle !== Math.PI / 2) {
40588
+ const cosValue = Math.abs(Math.cos(null != angle ? angle : 0));
40589
+ maxTagWidth = cosValue < 1e-6 ? 1 / 0 : this.attribute.end.x / cosValue;
40590
+ } else maxTagWidth = limitSize - offset;
40591
+ } else if (angle && 0 !== angle) {
40592
+ const sinValue = Math.abs(Math.sin(angle));
40593
+ maxTagWidth = sinValue < 1e-6 ? 1 / 0 : this.attribute.end.y / sinValue;
40594
+ } else maxTagWidth = limitSize - offset;
40595
+ }
40596
+ }
40597
+ const text = formatMethod ? formatMethod(textContent) : textContent,
40598
+ attrs = Object.assign(Object.assign(Object.assign({}, labelPoint), restAttrs), {
40599
+ maxWidth: maxTagWidth,
40600
+ textStyle: Object.assign({
40601
+ textAlign: textAlign,
40602
+ textBaseline: textBaseline
40603
+ }, textStyle),
40604
+ text: text
40605
+ });
40606
+ return attrs.angle = angle, background && background.visible && (attrs.panel = Object.assign(Object.assign({
40607
+ visible: !0
40608
+ }, restAttrs.panel), background.style)), attrs;
40609
+ }
40563
40610
  getTextBaseline(vector, inside) {
40564
40611
  let base = "middle";
40565
40612
  const {
@@ -40750,6 +40797,25 @@
40750
40797
  }
40751
40798
  return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength;
40752
40799
  }
40800
+ showLabelHoverOnAxis(position, text) {
40801
+ if (this.attribute.labelHoverOnAxis) if (this.labelHoverOnAxisGroup) {
40802
+ const {
40803
+ formatMethod: formatMethod
40804
+ } = this.attribute.labelHoverOnAxis,
40805
+ textStr = formatMethod ? formatMethod(text) : text;
40806
+ this.labelHoverOnAxisGroup.setAttribute("text", textStr), this.labelHoverOnAxisGroup.setAttribute("visible", !0), this.labelHoverOnAxisGroup.setAttribute("visibleAll", !0), "left" === this.attribute.orient || "right" === this.attribute.orient ? this.labelHoverOnAxisGroup.setAttributes({
40807
+ y: position
40808
+ }) : this.labelHoverOnAxisGroup.setAttributes({
40809
+ x: position
40810
+ });
40811
+ } else this.attribute.labelHoverOnAxis.visible = !0, this.attribute.labelHoverOnAxis.position = position, this.attribute.labelHoverOnAxis.text = text, this.renderLabelHoverOnAxis();
40812
+ }
40813
+ hideLabelHoverOnAxis() {
40814
+ this.attribute.labelHoverOnAxis && this.labelHoverOnAxisGroup && this.labelHoverOnAxisGroup.setAttributes({
40815
+ visible: !1,
40816
+ visibleAll: !1
40817
+ });
40818
+ }
40753
40819
  release() {
40754
40820
  super.release(), this._breaks = null;
40755
40821
  }
@@ -42808,16 +42874,7 @@
42808
42874
  data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
42809
42875
  }
42810
42876
  let labels = this._initText(data);
42811
- labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels);
42812
- const filteredLabels = [],
42813
- overlapLabels = labels;
42814
- if (!isBoolean$1(overlap) && isFunction$1(overlap.filterBeforeOverlap)) {
42815
- const getRelatedGraphic = this.getRelatedGraphic.bind(this);
42816
- labels.forEach(label => {
42817
- overlap.filterBeforeOverlap(label, getRelatedGraphic, this) ? overlapLabels.push(label) : filteredLabels.push(label);
42818
- });
42819
- }
42820
- isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(overlapLabels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this).concat(filteredLabels) : !1 !== overlap && (labels = this._overlapping(overlapLabels).concat(filteredLabels)), isFunction$1(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this), labels && labels.length && labels.forEach(label => {
42877
+ labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels), isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : !1 !== overlap && (labels = this._overlapping(labels)), isFunction$1(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this), labels && labels.length && labels.forEach(label => {
42821
42878
  this._bindEvent(label), this._setStatesOfText(label);
42822
42879
  }), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels), !1 !== this._enableAnimation && this._baseMarks.forEach((mark, index) => {
42823
42880
  mark.initAttributes(markAttributeList[index]);
@@ -52817,7 +52874,7 @@
52817
52874
  select: !0
52818
52875
  };
52819
52876
 
52820
- const version = "1.0.25";
52877
+ const version = "1.0.26-alpha.0";
52821
52878
  preLoadAllModule();
52822
52879
  if (isBrowserEnv()) {
52823
52880
  loadBrowserEnv(container);