chunk-MIWGTTJJ.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. import {
  2. g
  3. } from "./chunk-LL6JU3GU.js";
  4. import {
  5. s,
  6. t
  7. } from "./chunk-SRMDO2KR.js";
  8. import {
  9. e,
  10. n
  11. } from "./chunk-YLVXZ2PS.js";
  12. import {
  13. X,
  14. o
  15. } from "./chunk-WFSV2B2I.js";
  16. import {
  17. a as a2
  18. } from "./chunk-MXB2XLKV.js";
  19. import {
  20. a
  21. } from "./chunk-GZT4BVFP.js";
  22. // node_modules/@arcgis/core/geometry/libtess.js
  23. var n2 = 128e3;
  24. var e2 = null;
  25. var i = null;
  26. async function o2() {
  27. return e2 || (e2 = r()), e2;
  28. }
  29. async function r() {
  30. const n5 = a("esri-csp-restrictions") ? await import("./libtess-asm-ZSHP2UIP.js").then((t2) => t2.l) : await import("./libtess-D457IXIM.js").then((t2) => t2.l);
  31. i = await n5.load({ locateFile: (s3) => a2(`esri/core/libs/libtess/${s3}`) });
  32. }
  33. function a3(t2, s3) {
  34. const e4 = Math.max(t2.length, n2);
  35. return i.triangulate(t2, s3, e4);
  36. }
  37. // node_modules/@arcgis/core/views/2d/engine/webgl/TileClipper.js
  38. var e3 = class {
  39. constructor(i2, t2, s3) {
  40. this.ratio = i2, this.x = t2, this.y = s3;
  41. }
  42. };
  43. var n3 = class {
  44. constructor(t2, s3, 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 = s3, 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 s3 = i2 >> this.dz;
  55. t2 > s3 && (t2 = s3), this.margin = t2, this.xmin = s3 * this.xPos - t2, this.ymin = s3 * this.yPos - t2, this.xmax = this.xmin + s3 + 2 * t2, this.ymax = this.ymin + s3 + 2 * t2;
  56. }
  57. reset(i2) {
  58. this.type = i2, this.lines = [], this.starts = [], this.line = null, this.start = 0;
  59. }
  60. moveTo(i2, s3) {
  61. this._pushLine(), this._prevIsIn = this._isIn(i2, s3), this._moveTo(i2, s3, this._prevIsIn), this._prevPt = new t(i2, s3), this._firstPt = new t(i2, s3), this._dist = 0;
  62. }
  63. lineTo(i2, s3) {
  64. const h2 = this._isIn(i2, s3), n5 = new t(i2, s3), l3 = t.distance(this._prevPt, n5);
  65. let x3, a6, y2, o4, r3, m, p, u;
  66. if (h2)
  67. this._prevIsIn ? this._lineTo(i2, s3, true) : (x3 = this._prevPt, a6 = n5, y2 = this._intersect(a6, x3), this.start = this._dist + l3 * (1 - this._r), this._lineTo(y2.x, y2.y, true), this._lineTo(a6.x, a6.y, true));
  68. else if (this._prevIsIn)
  69. a6 = this._prevPt, x3 = n5, y2 = this._intersect(a6, x3), this._lineTo(y2.x, y2.y, true), this._lineTo(x3.x, x3.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 s4 = [];
  76. if ((i3.x < this.xmin && t2.x > this.xmin || i3.x > this.xmin && t2.x < this.xmin) && (o4 = (this.xmin - i3.x) / (t2.x - i3.x), u = i3.y + o4 * (t2.y - i3.y), u <= this.ymin ? m = false : u >= this.ymax ? m = true : s4.push(new e3(o4, this.xmin, u))), (i3.x < this.xmax && t2.x > this.xmax || i3.x > this.xmax && t2.x < this.xmax) && (o4 = (this.xmax - i3.x) / (t2.x - i3.x), u = i3.y + o4 * (t2.y - i3.y), u <= this.ymin ? m = false : u >= this.ymax ? m = true : s4.push(new e3(o4, this.xmax, u))), (i3.y < this.ymin && t2.y > this.ymin || i3.y > this.ymin && t2.y < this.ymin) && (o4 = (this.ymin - i3.y) / (t2.y - i3.y), p = i3.x + o4 * (t2.x - i3.x), p <= this.xmin ? r3 = false : p >= this.xmax ? r3 = true : s4.push(new e3(o4, p, this.ymin))), (i3.y < this.ymax && t2.y > this.ymax || i3.y > this.ymax && t2.y < this.ymax) && (o4 = (this.ymax - i3.y) / (t2.y - i3.y), p = i3.x + o4 * (t2.x - i3.x), p <= this.xmin ? r3 = false : p >= this.xmax ? r3 = true : s4.push(new e3(o4, p, this.ymax))), s4.length === 0)
  77. r3 ? m ? this._lineTo(this.xmax, this.ymax, true) : this._lineTo(this.xmax, this.ymin, true) : m ? this._lineTo(this.xmin, this.ymax, true) : this._lineTo(this.xmin, this.ymin, true);
  78. else if (s4.length > 1 && s4[0].ratio > s4[1].ratio)
  79. this.start = this._dist + l3 * s4[1].ratio, this._lineTo(s4[1].x, s4[1].y, true), this._lineTo(s4[0].x, s4[0].y, true);
  80. else {
  81. this.start = this._dist + l3 * s4[0].ratio;
  82. for (let i4 = 0; i4 < s4.length; i4++)
  83. this._lineTo(s4[i4].x, s4[i4].y, true);
  84. }
  85. this._lineTo(t2.x, t2.y, false);
  86. }
  87. }
  88. this._dist += l3, 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 s3 = this.line;
  95. let h2 = s3.length;
  96. for (; h2 >= 4 && (s3[0].x === s3[1].x && s3[0].x === s3[h2 - 2].x || s3[0].y === s3[1].y && s3[0].y === s3[h2 - 2].y); )
  97. s3.pop(), s3[0].x = s3[h2 - 2].x, s3[0].y = s3[h2 - 2].y, --h2;
  98. }
  99. }
  100. result(i2 = true) {
  101. return this._pushLine(), this.lines.length === 0 ? null : (this.type === s.Polygon && i2 && a4.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 (t2 === 0)
  109. return null;
  110. const h2 = [];
  111. for (let s3 = 0; s3 < t2; s3++)
  112. h2.push({ line: i2[s3], start: this.starts[s3] || 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, s3) {
  119. let h2, e4, n5;
  120. if (s3.x >= this.xmin && s3.x <= this.xmax)
  121. e4 = s3.y <= this.ymin ? this.ymin : this.ymax, n5 = (e4 - i2.y) / (s3.y - i2.y), h2 = i2.x + n5 * (s3.x - i2.x);
  122. else if (s3.y >= this.ymin && s3.y <= this.ymax)
  123. h2 = s3.x <= this.xmin ? this.xmin : this.xmax, n5 = (h2 - i2.x) / (s3.x - i2.x), e4 = i2.y + n5 * (s3.y - i2.y);
  124. else {
  125. e4 = s3.y <= this.ymin ? this.ymin : this.ymax, h2 = s3.x <= this.xmin ? this.xmin : this.xmax;
  126. const t2 = (h2 - i2.x) / (s3.x - i2.x), l3 = (e4 - i2.y) / (s3.y - i2.y);
  127. t2 < l3 ? (n5 = t2, e4 = i2.y + t2 * (s3.y - i2.y)) : (n5 = l3, h2 = i2.x + l3 * (s3.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._is_h = false, this._is_v = false);
  136. }
  137. _lineTo(i2, h2, e4) {
  138. let n5, l3;
  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 s3 = n5.x === i2, e5 = n5.y === h2;
  149. if (s3 && e5)
  150. return;
  151. this._is_h && s3 || this._is_v && e5 ? (n5.x = i2, n5.y = h2, l3 = this.line[this.line.length - 2], l3.x === i2 && l3.y === h2 ? (this.line.pop(), this.line.length <= 1 ? (this._is_h = false, this._is_v = false) : (l3 = this.line[this.line.length - 2], this._is_h = l3.x === i2, this._is_v = l3.y === h2)) : (this._is_h = l3.x === i2, this._is_v = l3.y === h2)) : (this.line.push(new t(i2, h2)), this._is_h = s3, this._is_v = e5);
  152. } else
  153. this.line.push(new t(i2, h2));
  154. }
  155. };
  156. var l = class {
  157. setExtent(i2) {
  158. this._ratio = i2 === 4096 ? 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, s3) {
  167. this.line && this.lines.push(this.line), this.line = [];
  168. const h2 = this._ratio;
  169. this.line.push(new t(i2 * h2, s3 * h2));
  170. }
  171. lineTo(i2, s3) {
  172. const h2 = this._ratio;
  173. this.line.push(new t(i2 * h2, s3 * 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), this.lines.length === 0 ? null : this.lines;
  181. }
  182. };
  183. var x;
  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. }(x || (x = {}));
  187. var a4 = class {
  188. static simplify(i2, t2, s3) {
  189. if (!s3)
  190. return;
  191. const h2 = -t2, e4 = i2 + t2, n5 = -t2, l3 = i2 + t2, y2 = [], o4 = [], r3 = s3.length;
  192. for (let a6 = 0; a6 < r3; ++a6) {
  193. const i3 = s3[a6];
  194. if (!i3 || i3.length < 2)
  195. continue;
  196. let t3, r4 = i3[0];
  197. const m2 = i3.length;
  198. for (let s4 = 1; s4 < m2; ++s4)
  199. t3 = i3[s4], r4.x === t3.x && (r4.x <= h2 && (r4.y > t3.y ? (y2.push(a6), y2.push(s4), y2.push(x.sideLeft), y2.push(-1)) : (o4.push(a6), o4.push(s4), o4.push(x.sideLeft), o4.push(-1))), r4.x >= e4 && (r4.y < t3.y ? (y2.push(a6), y2.push(s4), y2.push(x.sideRight), y2.push(-1)) : (o4.push(a6), o4.push(s4), o4.push(x.sideRight), o4.push(-1)))), r4.y === t3.y && (r4.y <= n5 && (r4.x < t3.x ? (y2.push(a6), y2.push(s4), y2.push(x.sideTop), y2.push(-1)) : (o4.push(a6), o4.push(s4), o4.push(x.sideTop), o4.push(-1))), r4.y >= l3 && (r4.x > t3.x ? (y2.push(a6), y2.push(s4), y2.push(x.sideBottom), y2.push(-1)) : (o4.push(a6), o4.push(s4), o4.push(x.sideBottom), o4.push(-1)))), r4 = t3;
  200. }
  201. if (y2.length === 0 || o4.length === 0)
  202. return;
  203. a4.fillParent(s3, o4, y2), a4.fillParent(s3, y2, o4);
  204. const m = [];
  205. a4.calcDeltas(m, o4, y2), a4.calcDeltas(m, y2, o4), a4.addDeltas(m, s3);
  206. }
  207. static fillParent(i2, t2, s3) {
  208. const e4 = s3.length, n5 = t2.length;
  209. for (let l3 = 0; l3 < n5; l3 += 4) {
  210. const n6 = t2[l3], a6 = t2[l3 + 1], y2 = t2[l3 + 2], o4 = i2[n6][a6 - 1], r3 = i2[n6][a6];
  211. let m = 8092, p = -1;
  212. for (let t3 = 0; t3 < e4; t3 += 4) {
  213. if (s3[t3 + 2] !== y2)
  214. continue;
  215. const e5 = s3[t3], n7 = s3[t3 + 1], l4 = i2[e5][n7 - 1], a7 = i2[e5][n7];
  216. switch (y2) {
  217. case x.sideLeft:
  218. case x.sideRight:
  219. if (g(o4.y, l4.y, a7.y) && g(r3.y, l4.y, a7.y)) {
  220. const i3 = Math.abs(a7.y - l4.y);
  221. i3 < m && (m = i3, p = t3);
  222. }
  223. break;
  224. case x.sideTop:
  225. case x.sideBottom:
  226. if (g(o4.x, l4.x, a7.x) && g(r3.x, l4.x, a7.x)) {
  227. const i3 = Math.abs(a7.x - l4.x);
  228. i3 < m && (m = i3, p = t3);
  229. }
  230. }
  231. }
  232. t2[l3 + 3] = p;
  233. }
  234. }
  235. static calcDeltas(i2, t2, s3) {
  236. const h2 = t2.length;
  237. for (let e4 = 0; e4 < h2; e4 += 4) {
  238. const h3 = [], n5 = a4.calcDelta(e4, t2, s3, 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, s3, h2) {
  243. const e4 = t2[i2 + 3];
  244. if (e4 === -1)
  245. return 0;
  246. const n5 = h2.length;
  247. return n5 > 1 && h2[n5 - 2] === e4 ? 0 : (h2.push(e4), a4.calcDelta(e4, s3, t2, h2) + 1);
  248. }
  249. static addDeltas(i2, t2) {
  250. const s3 = i2.length;
  251. let h2 = 0;
  252. for (let e4 = 0; e4 < s3; e4 += 4) {
  253. const t3 = i2[e4 + 3];
  254. t3 > h2 && (h2 = t3);
  255. }
  256. for (let e4 = 0; e4 < s3; e4 += 4) {
  257. const s4 = t2[i2[e4]], n5 = i2[e4 + 1], l3 = h2 - i2[e4 + 3];
  258. switch (i2[e4 + 2]) {
  259. case x.sideLeft:
  260. s4[n5 - 1].x -= l3, s4[n5].x -= l3, n5 === 1 && (s4[s4.length - 1].x -= l3), n5 === s4.length - 1 && (s4[0].x -= l3);
  261. break;
  262. case x.sideRight:
  263. s4[n5 - 1].x += l3, s4[n5].x += l3, n5 === 1 && (s4[s4.length - 1].x += l3), n5 === s4.length - 1 && (s4[0].x += l3);
  264. break;
  265. case x.sideTop:
  266. s4[n5 - 1].y -= l3, s4[n5].y -= l3, n5 === 1 && (s4[s4.length - 1].y -= l3), n5 === s4.length - 1 && (s4[0].y -= l3);
  267. break;
  268. case x.sideBottom:
  269. s4[n5 - 1].y += l3, s4[n5].y += l3, n5 === 1 && (s4[s4.length - 1].y += l3), n5 === s4.length - 1 && (s4[0].y += l3);
  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 s2(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 a5(t2, e4) {
  308. return t2.x * e4.x + t2.y * e4.y;
  309. }
  310. function c(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 d = 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, s3 = 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 - s3, a6 = Math.sqrt(h2 * h2 + l3 * l3);
  329. if (h2 /= a6, l3 /= a6, x3 + a6 > i2) {
  330. r3 = true;
  331. const t3 = (i2 - x3) / a6;
  332. a6 = i2 - x3, e5 = (1 - t3) * n5 + t3 * e5, y3 = (1 - t3) * s3 + t3 * y3, --o4;
  333. }
  334. const c2 = this.writeVertex(n5, s3, 0, 0, h2, l3, l3, -h2, 0, -1, x3), d2 = this.writeVertex(n5, s3, 0, 0, h2, l3, -l3, h2, 0, 1, x3);
  335. x3 += a6;
  336. const u = this.writeVertex(e5, y3, 0, 0, h2, l3, l3, -h2, 0, -1, x3), v = this.writeVertex(e5, y3, 0, 0, h2, l3, -l3, h2, 0, 1, x3);
  337. this.writeTriangle(c2, d2, u), this.writeTriangle(d2, u, v), n5 = e5, s3 = y3;
  338. }
  339. }
  340. _tessellate(i2, r3) {
  341. const d2 = i2[0], u = i2[i2.length - 1], v = x2(d2, u), f = v ? 3 : 2;
  342. if (i2.length < f)
  343. return;
  344. const w = r3.pixelCoordRatio, T = r3.capType != null ? r3.capType : e.BUTT, g2 = r3.joinType != null ? r3.joinType : n.MITER, m = r3.miterLimit != null ? Math.min(r3.miterLimit, 4) : 2, V = r3.roundLimit != null ? Math.min(r3.roundLimit, 1.05) : 1.05, N = r3.halfWidth != null ? r3.halfWidth : 2, E = !!r3.textured;
  345. let b, R, U = null, k = null;
  346. const p = this.prevNormal, M = this.nextNormal;
  347. let B = -1, L = -1;
  348. const D = this.joinNormal;
  349. let S, j;
  350. const A = this.textureNormalLeft, O = this.textureNormalRight, _ = 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 s3 = Q(b, R, S, j, i3, x3, t2, e4, r4, n5, q);
  356. return I >= 0 && P >= 0 && s3 >= 0 && X2(I, P, s3), I = P, P = s3, s3;
  357. };
  358. v && (U = i2[i2.length - 2], M.x = u.x - U.x, M.y = u.y - U.y, L = h(M), M.x /= L, M.y /= L);
  359. let z = false;
  360. for (let x3 = 0; x3 < i2.length; ++x3) {
  361. if (z && (z = false, q = 0), U && (p.x = -M.x, p.y = -M.y, B = L, q + B > W && (z = true)), z) {
  362. const t2 = (W - q) / B;
  363. B = W - q, U = { x: (1 - t2) * U.x + t2 * i2[x3].x, y: (1 - t2) * U.y + t2 * i2[x3].y }, --x3;
  364. } else
  365. U = i2[x3];
  366. b = U.x, R = U.y;
  367. const r4 = x3 <= 0 && !z, d3 = x3 === i2.length - 1;
  368. if (r4 || (q += B), k = d3 ? v ? i2[1] : null : i2[x3 + 1], k ? (M.x = k.x - b, M.y = k.y - R, L = h(M), M.x /= L, M.y /= L) : (M.x = void 0, M.y = void 0), !v) {
  369. if (r4) {
  370. s2(D, M), S = D.x, j = D.y, T === e.SQUARE && (C(-M.y - M.x, M.x - M.y, M.x, M.y, 0, -1), C(M.y - M.x, -M.x - M.y, M.x, M.y, 0, 1)), T === e.ROUND && (C(-M.y - M.x, M.x - M.y, M.x, M.y, -1, -1), C(M.y - M.x, -M.x - M.y, M.x, M.y, -1, 1)), T !== e.ROUND && T !== e.BUTT || (C(-M.y, M.x, M.x, M.y, 0, -1), C(M.y, -M.x, M.x, M.y, 0, 1));
  371. continue;
  372. }
  373. if (d3) {
  374. n4(D, p), S = D.x, j = D.y, T !== e.ROUND && T !== e.BUTT || (C(p.y, -p.x, -p.x, -p.y, 0, -1), C(-p.y, p.x, -p.x, -p.y, 0, 1)), T === 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)), T === 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));
  375. continue;
  376. }
  377. }
  378. let u2, f2, Q2 = -l2(p, M);
  379. if (Math.abs(Q2) < 0.01)
  380. a5(p, M) > 0 ? (D.x = p.x, D.y = p.y, Q2 = 1, u2 = Number.MAX_VALUE, f2 = true) : (s2(D, M), Q2 = 1, u2 = 1, f2 = false);
  381. else {
  382. D.x = (p.x + M.x) / Q2, D.y = (p.y + M.y) / Q2, u2 = h(D);
  383. const t2 = (u2 - 1) * N * w;
  384. f2 = u2 > 4 || t2 > B && t2 > L;
  385. }
  386. S = D.x, j = D.y;
  387. let X3 = g2;
  388. switch (g2) {
  389. case n.BEVEL:
  390. u2 < 1.05 && (X3 = n.MITER);
  391. break;
  392. case n.ROUND:
  393. u2 < V && (X3 = n.MITER);
  394. break;
  395. case n.MITER:
  396. u2 > m && (X3 = n.BEVEL);
  397. }
  398. switch (X3) {
  399. case n.MITER:
  400. if (C(D.x, D.y, -p.x, -p.y, 0, -1), C(-D.x, -D.y, -p.x, -p.y, 0, 1), d3)
  401. break;
  402. if (E) {
  403. const t2 = z ? 0 : q;
  404. I = this.writeVertex(b, R, S, j, M.x, M.y, D.x, D.y, 0, -1, t2), P = this.writeVertex(b, R, S, j, M.x, M.y, -D.x, -D.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 = A, i3 = O;
  413. } else
  414. e4 = O, i3 = A;
  415. if (f2)
  416. x4 = t2 ? s2(this.innerPrev, p) : n4(this.innerPrev, p), r5 = t2 ? n4(this.innerNext, M) : s2(this.innerNext, M);
  417. else {
  418. const e5 = t2 ? o3(this.inner, D) : y(this.inner, D);
  419. x4 = e5, r5 = e5;
  420. }
  421. const h2 = t2 ? n4(this.bevelStart, p) : s2(this.bevelStart, p);
  422. C(x4.x, x4.y, -p.x, -p.y, e4.x, e4.y);
  423. const l3 = C(h2.x, h2.y, -p.x, -p.y, i3.x, i3.y);
  424. if (d3)
  425. break;
  426. const a6 = t2 ? s2(this.bevelEnd, M) : n4(this.bevelEnd, M);
  427. if (f2) {
  428. const t3 = this.writeVertex(b, R, S, j, -p.x, -p.y, 0, 0, 0, 0, q);
  429. I = this.writeVertex(b, R, S, j, M.x, M.y, r5.x, r5.y, e4.x, e4.y, q), P = this.writeVertex(b, R, S, j, M.x, M.y, a6.x, a6.y, i3.x, i3.y, q), this.writeTriangle(l3, t3, P);
  430. } else {
  431. if (E) {
  432. const t3 = this.bevelMiddle;
  433. t3.x = (h2.x + a6.x) / 2, t3.y = (h2.y + a6.y) / 2, c(_, t3, -p.x, -p.y), C(t3.x, t3.y, -p.x, -p.y, _.x, _.y), c(_, t3, M.x, M.y), I = this.writeVertex(b, R, S, j, M.x, M.y, t3.x, t3.y, _.x, _.y, q), P = this.writeVertex(b, R, S, j, M.x, M.y, r5.x, r5.y, e4.x, e4.y, q);
  434. } else {
  435. const t3 = I;
  436. I = P, P = t3;
  437. }
  438. C(a6.x, a6.y, M.x, M.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 = A, i3 = O;
  452. } else
  453. e4 = O, i3 = A;
  454. const x4 = t2 ? o3(this.inner, D) : y(this.inner, D);
  455. let r5, h2;
  456. f2 ? (r5 = t2 ? s2(this.innerPrev, p) : n4(this.innerPrev, p), h2 = t2 ? n4(this.innerNext, M) : s2(this.innerNext, M)) : (r5 = x4, h2 = x4);
  457. const l3 = t2 ? n4(this.roundStart, p) : s2(this.roundStart, p), v2 = t2 ? s2(this.roundEnd, M) : n4(this.roundEnd, M), w2 = C(r5.x, r5.y, -p.x, -p.y, e4.x, e4.y), T2 = C(l3.x, l3.y, -p.x, -p.y, i3.x, i3.y);
  458. if (d3)
  459. break;
  460. const g3 = this.writeVertex(b, R, S, j, -p.x, -p.y, 0, 0, 0, 0, q);
  461. f2 || this.writeTriangle(I, P, g3);
  462. const m2 = o3(this.outer, x4), V2 = this.writeVertex(b, R, S, j, M.x, M.y, v2.x, v2.y, i3.x, i3.y, q);
  463. let N2, U2;
  464. const k2 = u2 > 2;
  465. if (k2) {
  466. let e5;
  467. u2 !== Number.MAX_VALUE ? (m2.x /= u2, m2.y /= u2, e5 = a5(p, m2), e5 = (u2 * (e5 * e5 - 1) + 1) / e5) : e5 = -1, N2 = t2 ? n4(this.startBreak, p) : s2(this.startBreak, p), N2.x += p.x * e5, N2.y += p.y * e5, U2 = t2 ? s2(this.endBreak, M) : n4(this.endBreak, M), U2.x += M.x * e5, U2.y += M.y * e5;
  468. }
  469. c(_, m2, -p.x, -p.y);
  470. const B2 = this.writeVertex(b, R, S, j, -p.x, -p.y, m2.x, m2.y, _.x, _.y, q);
  471. c(_, m2, M.x, M.y);
  472. const L2 = E ? this.writeVertex(b, R, S, j, M.x, M.y, m2.x, m2.y, _.x, _.y, q) : B2, W2 = g3, X4 = E ? this.writeVertex(b, R, S, j, M.x, M.y, 0, 0, 0, 0, q) : g3;
  473. let z2 = -1, F = -1;
  474. if (k2 && (c(_, N2, -p.x, -p.y), z2 = this.writeVertex(b, R, S, j, -p.x, -p.y, N2.x, N2.y, _.x, _.y, q), c(_, U2, M.x, M.y), F = this.writeVertex(b, R, S, j, M.x, M.y, U2.x, U2.y, _.x, _.y, q)), E ? k2 ? (this.writeTriangle(W2, T2, z2), this.writeTriangle(W2, z2, B2), this.writeTriangle(X4, L2, F), this.writeTriangle(X4, F, V2)) : (this.writeTriangle(W2, T2, B2), this.writeTriangle(X4, L2, V2)) : k2 ? (this.writeTriangle(g3, T2, z2), this.writeTriangle(g3, z2, F), this.writeTriangle(g3, F, V2)) : (this.writeTriangle(g3, T2, B2), this.writeTriangle(g3, L2, V2)), f2 ? (I = this.writeVertex(b, R, S, j, M.x, M.y, h2.x, h2.y, e4.x, e4.y, q), P = V2) : (I = E ? this.writeVertex(b, R, S, j, M.x, M.y, h2.x, h2.y, e4.x, e4.y, q) : w2, this.writeTriangle(I, X4, V2), P = V2), t2) {
  475. const t3 = I;
  476. I = P, P = t3;
  477. }
  478. break;
  479. }
  480. }
  481. }
  482. }
  483. };
  484. export {
  485. o2 as o,
  486. a3 as a,
  487. n3 as n,
  488. l,
  489. d
  490. };
  491. //# sourceMappingURL=chunk-MIWGTTJJ.js.map