chunk-JXYBFGFY.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. import {
  2. g
  3. } from "./chunk-EPMXCACW.js";
  4. import {
  5. s,
  6. t
  7. } from "./chunk-R24MO4IV.js";
  8. import {
  9. e,
  10. n
  11. } from "./chunk-QISOH77W.js";
  12. import {
  13. X,
  14. o
  15. } from "./chunk-XO5VJRK4.js";
  16. import {
  17. a
  18. } from "./chunk-ZLNEXZAN.js";
  19. import {
  20. has
  21. } from "./chunk-SPWQ3AWG.js";
  22. // node_modules/@arcgis/core/geometry/libtess.js
  23. var s2 = 128e3;
  24. var n2 = null;
  25. var e2 = null;
  26. async function i() {
  27. return n2 || (n2 = o2()), n2;
  28. }
  29. async function o2() {
  30. const s4 = has("esri-csp-restrictions") ? await import("./libtess-asm-P656RRWQ.js").then((t2) => t2.l) : await import("./libtess-KSRIGUYS.js").then((t2) => t2.l);
  31. e2 = await s4.load({ locateFile: (s5) => a(`esri/core/libs/libtess/${s5}`) });
  32. }
  33. function r(t2, n5) {
  34. const i2 = Math.max(t2.length, s2);
  35. return e2.triangulate(t2, n5, i2);
  36. }
  37. // node_modules/@arcgis/core/views/2d/engine/webgl/TileClipper.js
  38. var e3 = class {
  39. constructor(i2, t2, s4) {
  40. this.ratio = i2, this.x = t2, this.y = s4;
  41. }
  42. };
  43. var n3 = class {
  44. constructor(t2, s4, h2, e4 = 8, n5 = 8) {
  45. this._lines = [], this._starts = [], this.validateTessellation = true, this._pixelRatio = e4, this._pixelMargin = n5, this._tileSize = o * e4, this._dz = t2, this._yPos = s4, this._xPos = h2;
  46. }
  47. setPixelMargin(i2) {
  48. i2 !== this._pixelMargin && (this._pixelMargin = i2, this.setExtent(this._extent));
  49. }
  50. setExtent(i2) {
  51. this._extent = i2, this._finalRatio = this._tileSize / i2 * (1 << this._dz);
  52. let t2 = this._pixelRatio * this._pixelMargin;
  53. t2 /= this._finalRatio;
  54. const s4 = i2 >> this._dz;
  55. t2 > s4 && (t2 = s4), this._margin = t2, this._xmin = s4 * this._xPos - t2, this._ymin = s4 * this._yPos - t2, this._xmax = this._xmin + s4 + 2 * t2, this._ymax = this._ymin + s4 + 2 * t2;
  56. }
  57. reset(i2) {
  58. this._type = i2, this._lines = [], this._starts = [], this._line = null, this._start = 0;
  59. }
  60. moveTo(i2, s4) {
  61. this._pushLine(), this._prevIsIn = this._isIn(i2, s4), this._moveTo(i2, s4, this._prevIsIn), this._prevPt = new t(i2, s4), this._firstPt = new t(i2, s4), this._dist = 0;
  62. }
  63. lineTo(i2, s4) {
  64. const h2 = this._isIn(i2, s4), n5 = new t(i2, s4), _3 = t.distance(this._prevPt, n5);
  65. let l3, x3, a3, y2, o4, r3, m, p;
  66. if (h2)
  67. this._prevIsIn ? this._lineTo(i2, s4, true) : (l3 = this._prevPt, x3 = n5, a3 = this._intersect(x3, l3), this._start = this._dist + _3 * (1 - this._r), this._lineTo(a3.x, a3.y, true), this._lineTo(x3.x, x3.y, true));
  68. else if (this._prevIsIn)
  69. x3 = this._prevPt, l3 = n5, a3 = this._intersect(x3, l3), this._lineTo(a3.x, a3.y, true), this._lineTo(l3.x, l3.y, false);
  70. else {
  71. const i3 = this._prevPt, t2 = n5;
  72. if (i3.x <= this._xmin && t2.x <= this._xmin || i3.x >= this._xmax && t2.x >= this._xmax || i3.y <= this._ymin && t2.y <= this._ymin || i3.y >= this._ymax && t2.y >= this._ymax)
  73. this._lineTo(t2.x, t2.y, false);
  74. else {
  75. const s5 = [];
  76. if ((i3.x < this._xmin && t2.x > this._xmin || i3.x > this._xmin && t2.x < this._xmin) && (y2 = (this._xmin - i3.x) / (t2.x - i3.x), p = i3.y + y2 * (t2.y - i3.y), p <= this._ymin ? r3 = false : p >= this._ymax ? r3 = true : s5.push(new e3(y2, this._xmin, p))), (i3.x < this._xmax && t2.x > this._xmax || i3.x > this._xmax && t2.x < this._xmax) && (y2 = (this._xmax - i3.x) / (t2.x - i3.x), p = i3.y + y2 * (t2.y - i3.y), p <= this._ymin ? r3 = false : p >= this._ymax ? r3 = true : s5.push(new e3(y2, this._xmax, p))), (i3.y < this._ymin && t2.y > this._ymin || i3.y > this._ymin && t2.y < this._ymin) && (y2 = (this._ymin - i3.y) / (t2.y - i3.y), m = i3.x + y2 * (t2.x - i3.x), m <= this._xmin ? o4 = false : m >= this._xmax ? o4 = true : s5.push(new e3(y2, m, this._ymin))), (i3.y < this._ymax && t2.y > this._ymax || i3.y > this._ymax && t2.y < this._ymax) && (y2 = (this._ymax - i3.y) / (t2.y - i3.y), m = i3.x + y2 * (t2.x - i3.x), m <= this._xmin ? o4 = false : m >= this._xmax ? o4 = true : s5.push(new e3(y2, m, this._ymax))), 0 === s5.length)
  77. o4 ? r3 ? this._lineTo(this._xmax, this._ymax, true) : this._lineTo(this._xmax, this._ymin, true) : r3 ? this._lineTo(this._xmin, this._ymax, true) : this._lineTo(this._xmin, this._ymin, true);
  78. else if (s5.length > 1 && s5[0].ratio > s5[1].ratio)
  79. this._start = this._dist + _3 * s5[1].ratio, this._lineTo(s5[1].x, s5[1].y, true), this._lineTo(s5[0].x, s5[0].y, true);
  80. else {
  81. this._start = this._dist + _3 * s5[0].ratio;
  82. for (let i4 = 0; i4 < s5.length; i4++)
  83. this._lineTo(s5[i4].x, s5[i4].y, true);
  84. }
  85. this._lineTo(t2.x, t2.y, false);
  86. }
  87. }
  88. this._dist += _3, this._prevIsIn = h2, this._prevPt = n5;
  89. }
  90. close() {
  91. if (this._line.length > 2) {
  92. const i2 = this._firstPt, t2 = this._prevPt;
  93. i2.x === t2.x && i2.y === t2.y || this.lineTo(i2.x, i2.y);
  94. const s4 = this._line;
  95. let h2 = s4.length;
  96. for (; h2 >= 4 && (s4[0].x === s4[1].x && s4[0].x === s4[h2 - 2].x || s4[0].y === s4[1].y && s4[0].y === s4[h2 - 2].y); )
  97. s4.pop(), s4[0].x = s4[h2 - 2].x, s4[0].y = s4[h2 - 2].y, --h2;
  98. }
  99. }
  100. result(i2 = true) {
  101. return this._pushLine(), 0 === this._lines.length ? null : (this._type === s.Polygon && i2 && x.simplify(this._tileSize, this._margin * this._finalRatio, this._lines), this._lines);
  102. }
  103. resultWithStarts() {
  104. if (this._type !== s.LineString)
  105. throw new Error("Only valid for lines");
  106. this._pushLine();
  107. const i2 = this._lines, t2 = i2.length;
  108. if (0 === t2)
  109. return null;
  110. const h2 = [];
  111. for (let s4 = 0; s4 < t2; s4++)
  112. h2.push({ line: i2[s4], start: this._starts[s4] || 0 });
  113. return h2;
  114. }
  115. _isIn(i2, t2) {
  116. return i2 >= this._xmin && i2 <= this._xmax && t2 >= this._ymin && t2 <= this._ymax;
  117. }
  118. _intersect(i2, s4) {
  119. let h2, e4, n5;
  120. if (s4.x >= this._xmin && s4.x <= this._xmax)
  121. e4 = s4.y <= this._ymin ? this._ymin : this._ymax, n5 = (e4 - i2.y) / (s4.y - i2.y), h2 = i2.x + n5 * (s4.x - i2.x);
  122. else if (s4.y >= this._ymin && s4.y <= this._ymax)
  123. h2 = s4.x <= this._xmin ? this._xmin : this._xmax, n5 = (h2 - i2.x) / (s4.x - i2.x), e4 = i2.y + n5 * (s4.y - i2.y);
  124. else {
  125. e4 = s4.y <= this._ymin ? this._ymin : this._ymax, h2 = s4.x <= this._xmin ? this._xmin : this._xmax;
  126. const t2 = (h2 - i2.x) / (s4.x - i2.x), _3 = (e4 - i2.y) / (s4.y - i2.y);
  127. t2 < _3 ? (n5 = t2, e4 = i2.y + t2 * (s4.y - i2.y)) : (n5 = _3, h2 = i2.x + _3 * (s4.x - i2.x));
  128. }
  129. return this._r = n5, new t(h2, e4);
  130. }
  131. _pushLine() {
  132. this._line && (this._type === s.Point ? this._line.length > 0 && (this._lines.push(this._line), this._starts.push(this._start)) : this._type === s.LineString ? this._line.length > 1 && (this._lines.push(this._line), this._starts.push(this._start)) : this._type === s.Polygon && this._line.length > 3 && (this._lines.push(this._line), this._starts.push(this._start))), this._line = [], this._start = 0;
  133. }
  134. _moveTo(i2, h2, e4) {
  135. this._type !== s.Polygon ? e4 && (i2 = Math.round((i2 - (this._xmin + this._margin)) * this._finalRatio), h2 = Math.round((h2 - (this._ymin + this._margin)) * this._finalRatio), this._line.push(new t(i2, h2))) : (e4 || (i2 < this._xmin && (i2 = this._xmin), i2 > this._xmax && (i2 = this._xmax), h2 < this._ymin && (h2 = this._ymin), h2 > this._ymax && (h2 = this._ymax)), i2 = Math.round((i2 - (this._xmin + this._margin)) * this._finalRatio), h2 = Math.round((h2 - (this._ymin + this._margin)) * this._finalRatio), this._line.push(new t(i2, h2)), this._isH = false, this._isV = false);
  136. }
  137. _lineTo(i2, h2, e4) {
  138. let n5, _3;
  139. if (this._type !== s.Polygon)
  140. if (e4) {
  141. if (i2 = Math.round((i2 - (this._xmin + this._margin)) * this._finalRatio), h2 = Math.round((h2 - (this._ymin + this._margin)) * this._finalRatio), this._line.length > 0 && (n5 = this._line[this._line.length - 1], n5.equals(i2, h2)))
  142. return;
  143. this._line.push(new t(i2, h2));
  144. } else
  145. this._line && this._line.length > 0 && this._pushLine();
  146. else if (e4 || (i2 < this._xmin && (i2 = this._xmin), i2 > this._xmax && (i2 = this._xmax), h2 < this._ymin && (h2 = this._ymin), h2 > this._ymax && (h2 = this._ymax)), i2 = Math.round((i2 - (this._xmin + this._margin)) * this._finalRatio), h2 = Math.round((h2 - (this._ymin + this._margin)) * this._finalRatio), this._line && this._line.length > 0) {
  147. n5 = this._line[this._line.length - 1];
  148. const s4 = n5.x === i2, e5 = n5.y === h2;
  149. if (s4 && e5)
  150. return;
  151. this._isH && s4 || this._isV && e5 ? (n5.x = i2, n5.y = h2, _3 = this._line[this._line.length - 2], _3.x === i2 && _3.y === h2 ? (this._line.pop(), this._line.length <= 1 ? (this._isH = false, this._isV = false) : (_3 = this._line[this._line.length - 2], this._isH = _3.x === i2, this._isV = _3.y === h2)) : (this._isH = _3.x === i2, this._isV = _3.y === h2)) : (this._line.push(new t(i2, h2)), this._isH = s4, this._isV = e5);
  152. } else
  153. this._line.push(new t(i2, h2));
  154. }
  155. };
  156. var _ = class {
  157. setExtent(i2) {
  158. this._ratio = 4096 === i2 ? 1 : 4096 / i2;
  159. }
  160. get validateTessellation() {
  161. return this._ratio < 1;
  162. }
  163. reset(i2) {
  164. this._lines = [], this._line = null;
  165. }
  166. moveTo(i2, s4) {
  167. this._line && this._lines.push(this._line), this._line = [];
  168. const h2 = this._ratio;
  169. this._line.push(new t(i2 * h2, s4 * h2));
  170. }
  171. lineTo(i2, s4) {
  172. const h2 = this._ratio;
  173. this._line.push(new t(i2 * h2, s4 * h2));
  174. }
  175. close() {
  176. const i2 = this._line;
  177. i2 && !i2[0].isEqual(i2[i2.length - 1]) && i2.push(i2[0]);
  178. }
  179. result() {
  180. return this._line && this._lines.push(this._line), 0 === this._lines.length ? null : this._lines;
  181. }
  182. };
  183. var l;
  184. !function(i2) {
  185. i2[i2.sideLeft = 0] = "sideLeft", i2[i2.sideRight = 1] = "sideRight", i2[i2.sideTop = 2] = "sideTop", i2[i2.sideBottom = 3] = "sideBottom";
  186. }(l || (l = {}));
  187. var x = class {
  188. static simplify(i2, t2, s4) {
  189. if (!s4)
  190. return;
  191. const h2 = -t2, e4 = i2 + t2, n5 = -t2, _3 = i2 + t2, a3 = [], y2 = [], o4 = s4.length;
  192. for (let x3 = 0; x3 < o4; ++x3) {
  193. const i3 = s4[x3];
  194. if (!i3 || i3.length < 2)
  195. continue;
  196. let t3, o5 = i3[0];
  197. const r4 = i3.length;
  198. for (let s5 = 1; s5 < r4; ++s5)
  199. t3 = i3[s5], o5.x === t3.x && (o5.x <= h2 && (o5.y > t3.y ? (a3.push(x3), a3.push(s5), a3.push(l.sideLeft), a3.push(-1)) : (y2.push(x3), y2.push(s5), y2.push(l.sideLeft), y2.push(-1))), o5.x >= e4 && (o5.y < t3.y ? (a3.push(x3), a3.push(s5), a3.push(l.sideRight), a3.push(-1)) : (y2.push(x3), y2.push(s5), y2.push(l.sideRight), y2.push(-1)))), o5.y === t3.y && (o5.y <= n5 && (o5.x < t3.x ? (a3.push(x3), a3.push(s5), a3.push(l.sideTop), a3.push(-1)) : (y2.push(x3), y2.push(s5), y2.push(l.sideTop), y2.push(-1))), o5.y >= _3 && (o5.x > t3.x ? (a3.push(x3), a3.push(s5), a3.push(l.sideBottom), a3.push(-1)) : (y2.push(x3), y2.push(s5), y2.push(l.sideBottom), y2.push(-1)))), o5 = t3;
  200. }
  201. if (0 === a3.length || 0 === y2.length)
  202. return;
  203. x.fillParent(s4, y2, a3), x.fillParent(s4, a3, y2);
  204. const r3 = [];
  205. x.calcDeltas(r3, y2, a3), x.calcDeltas(r3, a3, y2), x.addDeltas(r3, s4);
  206. }
  207. static fillParent(i2, t2, s4) {
  208. const e4 = s4.length, n5 = t2.length;
  209. for (let _3 = 0; _3 < n5; _3 += 4) {
  210. const n6 = t2[_3], x3 = t2[_3 + 1], a3 = t2[_3 + 2], y2 = i2[n6][x3 - 1], o4 = i2[n6][x3];
  211. let r3 = 8092, m = -1;
  212. for (let t3 = 0; t3 < e4; t3 += 4) {
  213. if (s4[t3 + 2] !== a3)
  214. continue;
  215. const e5 = s4[t3], n7 = s4[t3 + 1], _4 = i2[e5][n7 - 1], x4 = i2[e5][n7];
  216. switch (a3) {
  217. case l.sideLeft:
  218. case l.sideRight:
  219. if (g(y2.y, _4.y, x4.y) && g(o4.y, _4.y, x4.y)) {
  220. const i3 = Math.abs(x4.y - _4.y);
  221. i3 < r3 && (r3 = i3, m = t3);
  222. }
  223. break;
  224. case l.sideTop:
  225. case l.sideBottom:
  226. if (g(y2.x, _4.x, x4.x) && g(o4.x, _4.x, x4.x)) {
  227. const i3 = Math.abs(x4.x - _4.x);
  228. i3 < r3 && (r3 = i3, m = t3);
  229. }
  230. }
  231. }
  232. t2[_3 + 3] = m;
  233. }
  234. }
  235. static calcDeltas(i2, t2, s4) {
  236. const h2 = t2.length;
  237. for (let e4 = 0; e4 < h2; e4 += 4) {
  238. const h3 = [], n5 = x.calcDelta(e4, t2, s4, h3);
  239. i2.push(t2[e4]), i2.push(t2[e4 + 1]), i2.push(t2[e4 + 2]), i2.push(n5);
  240. }
  241. }
  242. static calcDelta(i2, t2, s4, h2) {
  243. const e4 = t2[i2 + 3];
  244. if (-1 === e4)
  245. return 0;
  246. const n5 = h2.length;
  247. return n5 > 1 && h2[n5 - 2] === e4 ? 0 : (h2.push(e4), x.calcDelta(e4, s4, t2, h2) + 1);
  248. }
  249. static addDeltas(i2, t2) {
  250. const s4 = i2.length;
  251. let h2 = 0;
  252. for (let e4 = 0; e4 < s4; e4 += 4) {
  253. const t3 = i2[e4 + 3];
  254. t3 > h2 && (h2 = t3);
  255. }
  256. for (let e4 = 0; e4 < s4; e4 += 4) {
  257. const s5 = t2[i2[e4]], n5 = i2[e4 + 1], _3 = h2 - i2[e4 + 3];
  258. switch (i2[e4 + 2]) {
  259. case l.sideLeft:
  260. s5[n5 - 1].x -= _3, s5[n5].x -= _3, 1 === n5 && (s5[s5.length - 1].x -= _3), n5 === s5.length - 1 && (s5[0].x -= _3);
  261. break;
  262. case l.sideRight:
  263. s5[n5 - 1].x += _3, s5[n5].x += _3, 1 === n5 && (s5[s5.length - 1].x += _3), n5 === s5.length - 1 && (s5[0].x += _3);
  264. break;
  265. case l.sideTop:
  266. s5[n5 - 1].y -= _3, s5[n5].y -= _3, 1 === n5 && (s5[s5.length - 1].y -= _3), n5 === s5.length - 1 && (s5[0].y -= _3);
  267. break;
  268. case l.sideBottom:
  269. s5[n5 - 1].y += _3, s5[n5].y += _3, 1 === n5 && (s5[s5.length - 1].y += _3), n5 === s5.length - 1 && (s5[0].y += _3);
  270. }
  271. }
  272. }
  273. };
  274. // node_modules/@arcgis/core/views/2d/engine/webgl/TurboLine.js
  275. function x2(t2, e4) {
  276. return t2.x === e4.x && t2.y === e4.y;
  277. }
  278. function r2(t2) {
  279. if (!t2)
  280. return;
  281. const e4 = t2.length;
  282. if (e4 <= 1)
  283. return;
  284. let i2 = 0;
  285. for (let r3 = 1; r3 < e4; r3++)
  286. x2(t2[r3], t2[i2]) || ++i2 === r3 || (t2[i2] = t2[r3]);
  287. t2.length = i2 + 1;
  288. }
  289. function n4(t2, e4) {
  290. return t2.x = e4.y, t2.y = -e4.x, t2;
  291. }
  292. function s3(t2, e4) {
  293. return t2.x = -e4.y, t2.y = e4.x, t2;
  294. }
  295. function y(t2, e4) {
  296. return t2.x = e4.x, t2.y = e4.y, t2;
  297. }
  298. function o3(t2, e4) {
  299. return t2.x = -e4.x, t2.y = -e4.y, t2;
  300. }
  301. function h(t2) {
  302. return Math.sqrt(t2.x * t2.x + t2.y * t2.y);
  303. }
  304. function l2(t2, e4) {
  305. return t2.x * e4.y - t2.y * e4.x;
  306. }
  307. function _2(t2, e4) {
  308. return t2.x * e4.x + t2.y * e4.y;
  309. }
  310. function a2(t2, e4, i2, x3) {
  311. return t2.x = e4.x * i2 + e4.y * x3, t2.y = e4.x * x3 - e4.y * i2, t2;
  312. }
  313. var c = class {
  314. constructor(t2, e4, i2) {
  315. this._writeVertex = t2, this._writeTriangle = e4, this._canUseThinTessellation = i2, this._prevNormal = { x: void 0, y: void 0 }, this._nextNormal = { x: void 0, y: void 0 }, this._textureNormalLeft = { x: 0, y: 1 }, this._textureNormalRight = { x: 0, y: -1 }, this._textureNormal = { x: void 0, y: void 0 }, this._joinNormal = { x: void 0, y: void 0 }, this._inner = { x: void 0, y: void 0 }, this._outer = { x: void 0, y: void 0 }, this._roundStart = { x: void 0, y: void 0 }, this._roundEnd = { x: void 0, y: void 0 }, this._startBreak = { x: void 0, y: void 0 }, this._endBreak = { x: void 0, y: void 0 }, this._innerPrev = { x: void 0, y: void 0 }, this._innerNext = { x: void 0, y: void 0 }, this._bevelStart = { x: void 0, y: void 0 }, this._bevelEnd = { x: void 0, y: void 0 }, this._bevelMiddle = { x: void 0, y: void 0 };
  316. }
  317. tessellate(t2, e4) {
  318. r2(t2), this._canUseThinTessellation && e4.halfWidth < X && !e4.offset ? this._tessellateThin(t2, e4) : this._tessellate(t2, e4);
  319. }
  320. _tessellateThin(t2, e4) {
  321. if (t2.length < 2)
  322. return;
  323. const i2 = e4.wrapDistance || 65535;
  324. let x3 = e4.initialDistance || 0, r3 = false, n5 = t2[0].x, s4 = t2[0].y;
  325. const y2 = t2.length;
  326. for (let o4 = 1; o4 < y2; ++o4) {
  327. r3 && (r3 = false, x3 = 0);
  328. let e5 = t2[o4].x, y3 = t2[o4].y, h2 = e5 - n5, l3 = y3 - s4, _3 = Math.sqrt(h2 * h2 + l3 * l3);
  329. if (h2 /= _3, l3 /= _3, x3 + _3 > i2) {
  330. r3 = true;
  331. const t3 = (i2 - x3) / _3;
  332. _3 = i2 - x3, e5 = (1 - t3) * n5 + t3 * e5, y3 = (1 - t3) * s4 + t3 * y3, --o4;
  333. }
  334. const a3 = this._writeVertex(n5, s4, 0, 0, h2, l3, l3, -h2, 0, -1, x3), c2 = this._writeVertex(n5, s4, 0, 0, h2, l3, -l3, h2, 0, 1, x3);
  335. x3 += _3;
  336. const d = this._writeVertex(e5, y3, 0, 0, h2, l3, l3, -h2, 0, -1, x3), u = this._writeVertex(e5, y3, 0, 0, h2, l3, -l3, h2, 0, 1, x3);
  337. this._writeTriangle(a3, c2, d), this._writeTriangle(c2, d, u), n5 = e5, s4 = y3;
  338. }
  339. }
  340. _tessellate(i2, r3) {
  341. const c2 = i2[0], d = i2[i2.length - 1], u = x2(c2, d), v = u ? 3 : 2;
  342. if (i2.length < v)
  343. return;
  344. const f = r3.pixelCoordRatio, w = null != r3.capType ? r3.capType : e.BUTT, T = null != r3.joinType ? r3.joinType : n.MITER, g2 = null != r3.miterLimit ? Math.min(r3.miterLimit, 4) : 2, m = null != r3.roundLimit ? Math.min(r3.roundLimit, 1.05) : 1.05, V = null != r3.halfWidth ? r3.halfWidth : 2, N = !!r3.textured;
  345. let E, b, R, U = null;
  346. const k = this._prevNormal, p = this._nextNormal;
  347. let M = -1, B = -1;
  348. const L = this._joinNormal;
  349. let D, S;
  350. const j = this._textureNormalLeft, A = this._textureNormalRight, O = this._textureNormal;
  351. let I = -1, P = -1;
  352. const W = r3.wrapDistance || 65535;
  353. let q = r3.initialDistance || 0;
  354. const Q = this._writeVertex, X2 = this._writeTriangle, C = (t2, e4, i3, x3, r4, n5) => {
  355. const s4 = Q(b, R, D, S, i3, x3, t2, e4, r4, n5, q);
  356. return I >= 0 && P >= 0 && s4 >= 0 && X2(I, P, s4), I = P, P = s4, s4;
  357. };
  358. u && (E = i2[i2.length - 2], p.x = d.x - E.x, p.y = d.y - E.y, B = h(p), p.x /= B, p.y /= B);
  359. let z = false;
  360. for (let x3 = 0; x3 < i2.length; ++x3) {
  361. if (z && (z = false, q = 0), E && (k.x = -p.x, k.y = -p.y, M = B, q + M > W && (z = true)), z) {
  362. const t2 = (W - q) / M;
  363. M = W - q, E = { x: (1 - t2) * E.x + t2 * i2[x3].x, y: (1 - t2) * E.y + t2 * i2[x3].y }, --x3;
  364. } else
  365. E = i2[x3];
  366. b = E.x, R = E.y;
  367. const r4 = x3 <= 0 && !z, c3 = x3 === i2.length - 1;
  368. if (r4 || (q += M), U = c3 ? u ? i2[1] : null : i2[x3 + 1], U ? (p.x = U.x - b, p.y = U.y - R, B = h(p), p.x /= B, p.y /= B) : (p.x = void 0, p.y = void 0), !u) {
  369. if (r4) {
  370. s3(L, p), D = L.x, S = L.y, w === e.SQUARE && (C(-p.y - p.x, p.x - p.y, p.x, p.y, 0, -1), C(p.y - p.x, -p.x - p.y, p.x, p.y, 0, 1)), w === e.ROUND && (C(-p.y - p.x, p.x - p.y, p.x, p.y, -1, -1), C(p.y - p.x, -p.x - p.y, p.x, p.y, -1, 1)), w !== e.ROUND && w !== e.BUTT || (C(-p.y, p.x, p.x, p.y, 0, -1), C(p.y, -p.x, p.x, p.y, 0, 1));
  371. continue;
  372. }
  373. if (c3) {
  374. n4(L, k), D = L.x, S = L.y, w !== e.ROUND && w !== e.BUTT || (C(k.y, -k.x, -k.x, -k.y, 0, -1), C(-k.y, k.x, -k.x, -k.y, 0, 1)), w === e.SQUARE && (C(k.y - k.x, -k.x - k.y, -k.x, -k.y, 0, -1), C(-k.y - k.x, k.x - k.y, -k.x, -k.y, 0, 1)), w === e.ROUND && (C(k.y - k.x, -k.x - k.y, -k.x, -k.y, 1, -1), C(-k.y - k.x, k.x - k.y, -k.x, -k.y, 1, 1));
  375. continue;
  376. }
  377. }
  378. let d2, v2, Q2 = -l2(k, p);
  379. if (Math.abs(Q2) < 0.01)
  380. _2(k, p) > 0 ? (L.x = k.x, L.y = k.y, Q2 = 1, d2 = Number.MAX_VALUE, v2 = true) : (s3(L, p), Q2 = 1, d2 = 1, v2 = false);
  381. else {
  382. L.x = (k.x + p.x) / Q2, L.y = (k.y + p.y) / Q2, d2 = h(L);
  383. const t2 = (d2 - 1) * V * f;
  384. v2 = d2 > 4 || t2 > M && t2 > B;
  385. }
  386. D = L.x, S = L.y;
  387. let X3 = T;
  388. switch (T) {
  389. case n.BEVEL:
  390. d2 < 1.05 && (X3 = n.MITER);
  391. break;
  392. case n.ROUND:
  393. d2 < m && (X3 = n.MITER);
  394. break;
  395. case n.MITER:
  396. d2 > g2 && (X3 = n.BEVEL);
  397. }
  398. switch (X3) {
  399. case n.MITER:
  400. if (C(L.x, L.y, -k.x, -k.y, 0, -1), C(-L.x, -L.y, -k.x, -k.y, 0, 1), c3)
  401. break;
  402. if (N) {
  403. const t2 = z ? 0 : q;
  404. I = this._writeVertex(b, R, D, S, p.x, p.y, L.x, L.y, 0, -1, t2), P = this._writeVertex(b, R, D, S, p.x, p.y, -L.x, -L.y, 0, 1, t2);
  405. }
  406. break;
  407. case n.BEVEL: {
  408. const t2 = Q2 < 0;
  409. let e4, i3, x4, r5;
  410. if (t2) {
  411. const t3 = I;
  412. I = P, P = t3, e4 = j, i3 = A;
  413. } else
  414. e4 = A, i3 = j;
  415. if (v2)
  416. x4 = t2 ? s3(this._innerPrev, k) : n4(this._innerPrev, k), r5 = t2 ? n4(this._innerNext, p) : s3(this._innerNext, p);
  417. else {
  418. const e5 = t2 ? o3(this._inner, L) : y(this._inner, L);
  419. x4 = e5, r5 = e5;
  420. }
  421. const h2 = t2 ? n4(this._bevelStart, k) : s3(this._bevelStart, k);
  422. C(x4.x, x4.y, -k.x, -k.y, e4.x, e4.y);
  423. const l3 = C(h2.x, h2.y, -k.x, -k.y, i3.x, i3.y);
  424. if (c3)
  425. break;
  426. const _3 = t2 ? s3(this._bevelEnd, p) : n4(this._bevelEnd, p);
  427. if (v2) {
  428. const t3 = this._writeVertex(b, R, D, S, -k.x, -k.y, 0, 0, 0, 0, q);
  429. I = this._writeVertex(b, R, D, S, p.x, p.y, r5.x, r5.y, e4.x, e4.y, q), P = this._writeVertex(b, R, D, S, p.x, p.y, _3.x, _3.y, i3.x, i3.y, q), this._writeTriangle(l3, t3, P);
  430. } else {
  431. if (N) {
  432. const t3 = this._bevelMiddle;
  433. t3.x = (h2.x + _3.x) / 2, t3.y = (h2.y + _3.y) / 2, a2(O, t3, -k.x, -k.y), C(t3.x, t3.y, -k.x, -k.y, O.x, O.y), a2(O, t3, p.x, p.y), I = this._writeVertex(b, R, D, S, p.x, p.y, t3.x, t3.y, O.x, O.y, q), P = this._writeVertex(b, R, D, S, p.x, p.y, r5.x, r5.y, e4.x, e4.y, q);
  434. } else {
  435. const t3 = I;
  436. I = P, P = t3;
  437. }
  438. C(_3.x, _3.y, p.x, p.y, i3.x, i3.y);
  439. }
  440. if (t2) {
  441. const t3 = I;
  442. I = P, P = t3;
  443. }
  444. break;
  445. }
  446. case n.ROUND: {
  447. const t2 = Q2 < 0;
  448. let e4, i3;
  449. if (t2) {
  450. const t3 = I;
  451. I = P, P = t3, e4 = j, i3 = A;
  452. } else
  453. e4 = A, i3 = j;
  454. const x4 = t2 ? o3(this._inner, L) : y(this._inner, L);
  455. let r5, h2;
  456. v2 ? (r5 = t2 ? s3(this._innerPrev, k) : n4(this._innerPrev, k), h2 = t2 ? n4(this._innerNext, p) : s3(this._innerNext, p)) : (r5 = x4, h2 = x4);
  457. const l3 = t2 ? n4(this._roundStart, k) : s3(this._roundStart, k), u2 = t2 ? s3(this._roundEnd, p) : n4(this._roundEnd, p), f2 = C(r5.x, r5.y, -k.x, -k.y, e4.x, e4.y), w2 = C(l3.x, l3.y, -k.x, -k.y, i3.x, i3.y);
  458. if (c3)
  459. break;
  460. const T2 = this._writeVertex(b, R, D, S, -k.x, -k.y, 0, 0, 0, 0, q);
  461. v2 || this._writeTriangle(I, P, T2);
  462. const g3 = o3(this._outer, x4), m2 = this._writeVertex(b, R, D, S, p.x, p.y, u2.x, u2.y, i3.x, i3.y, q);
  463. let V2, E2;
  464. const U2 = d2 > 2;
  465. if (U2) {
  466. let e5;
  467. d2 !== Number.MAX_VALUE ? (g3.x /= d2, g3.y /= d2, e5 = _2(k, g3), e5 = (d2 * (e5 * e5 - 1) + 1) / e5) : e5 = -1, V2 = t2 ? n4(this._startBreak, k) : s3(this._startBreak, k), V2.x += k.x * e5, V2.y += k.y * e5, E2 = t2 ? s3(this._endBreak, p) : n4(this._endBreak, p), E2.x += p.x * e5, E2.y += p.y * e5;
  468. }
  469. a2(O, g3, -k.x, -k.y);
  470. const M2 = this._writeVertex(b, R, D, S, -k.x, -k.y, g3.x, g3.y, O.x, O.y, q);
  471. a2(O, g3, p.x, p.y);
  472. const B2 = N ? this._writeVertex(b, R, D, S, p.x, p.y, g3.x, g3.y, O.x, O.y, q) : M2, W2 = T2, X4 = N ? this._writeVertex(b, R, D, S, p.x, p.y, 0, 0, 0, 0, q) : T2;
  473. let z2 = -1, F = -1;
  474. if (U2 && (a2(O, V2, -k.x, -k.y), z2 = this._writeVertex(b, R, D, S, -k.x, -k.y, V2.x, V2.y, O.x, O.y, q), a2(O, E2, p.x, p.y), F = this._writeVertex(b, R, D, S, p.x, p.y, E2.x, E2.y, O.x, O.y, q)), N ? U2 ? (this._writeTriangle(W2, w2, z2), this._writeTriangle(W2, z2, M2), this._writeTriangle(X4, B2, F), this._writeTriangle(X4, F, m2)) : (this._writeTriangle(W2, w2, M2), this._writeTriangle(X4, B2, m2)) : U2 ? (this._writeTriangle(T2, w2, z2), this._writeTriangle(T2, z2, F), this._writeTriangle(T2, F, m2)) : (this._writeTriangle(T2, w2, M2), this._writeTriangle(T2, B2, m2)), v2 ? (I = this._writeVertex(b, R, D, S, p.x, p.y, h2.x, h2.y, e4.x, e4.y, q), P = m2) : (I = N ? this._writeVertex(b, R, D, S, p.x, p.y, h2.x, h2.y, e4.x, e4.y, q) : f2, this._writeTriangle(I, X4, m2), P = m2), t2) {
  475. const t3 = I;
  476. I = P, P = t3;
  477. }
  478. break;
  479. }
  480. }
  481. }
  482. }
  483. };
  484. export {
  485. i,
  486. r,
  487. n3 as n,
  488. _,
  489. c
  490. };
  491. //# sourceMappingURL=chunk-JXYBFGFY.js.map