@openbkn/workshop 0.2.2-rc.5 → 0.2.2-rc.6

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.
Files changed (158) hide show
  1. package/README.md +79 -8
  2. package/component.d.ts +10 -0
  3. package/dist/ActionConfirm-DJ91X3ml.js +236 -0
  4. package/dist/ActionFailure-ZgPt_3B-.js +37 -0
  5. package/dist/AgentChat-CRYai8ge.js +1062 -0
  6. package/dist/AppFormModal-D73ucaHK.js +4282 -0
  7. package/dist/AppListPage-D87piiOw.js +1364 -0
  8. package/dist/AskDrawer-BUMYsRnt.js +38 -0
  9. package/dist/ComputedView-CgYrDbx1.js +3221 -0
  10. package/dist/ConclusionApply-sjGfoEBY.js +153 -0
  11. package/dist/CypherEditor-lus6FA5L.js +485 -0
  12. package/dist/LandingList-6JI6864C.js +230 -0
  13. package/dist/MenuUnfoldOutlined-Cdg24l2h.js +27 -0
  14. package/dist/ModelTrial-ClHFGTpQ.js +359 -0
  15. package/dist/PageRenderer-DBd_g6mN.js +85480 -0
  16. package/dist/README-DjRyTQSR.js +76 -0
  17. package/dist/ScenarioApply-DtW_hh47.js +590 -0
  18. package/dist/SimulateForm-C-i08Jjd.js +153 -0
  19. package/dist/Subgraph-CnrkH9AN.js +32586 -0
  20. package/dist/WorkshopLabPage-DiVXQL9e.js +11364 -0
  21. package/dist/WorkshopRunPage-6hjRUf64.js +253 -0
  22. package/dist/abnfDiagram-WEYOIA3C-beRNhN3c.js +87 -0
  23. package/dist/action-type-tool.service-B2B74fKC.js +1060 -0
  24. package/dist/actionButton-DA5CNEzx.js +94 -0
  25. package/dist/actionButton.en-US-qjeqA7hs.js +94 -0
  26. package/dist/agentChat-EoDznd58.js +116 -0
  27. package/dist/agentChat.en-US-B6-pFd9Y.js +116 -0
  28. package/dist/alertList-DqditwM8.js +84 -0
  29. package/dist/alertList.en-US-BAXAgltP.js +84 -0
  30. package/dist/architectureDiagram-ZHVYKT53-DY2l1qxx.js +4779 -0
  31. package/dist/asOfSlider-QPvHWUMV.js +83 -0
  32. package/dist/asOfSlider.en-US-BI4jVfSn.js +83 -0
  33. package/dist/bkn-agent-execution.service-DVh-SHyl.js +205 -0
  34. package/dist/blockDiagram-RJAE7QA3-DR0mjN2h.js +1435 -0
  35. package/dist/c4Diagram-XDPPPE54-DH5zsGug.js +1518 -0
  36. package/dist/channel-B034hcOF.js +5 -0
  37. package/dist/china-C6m7zXIv.js +9 -0
  38. package/dist/chunk-2E7WHVMD-Ba3svxgx.js +664 -0
  39. package/dist/chunk-2Q5K7J3B-rT4eU6_y.js +15 -0
  40. package/dist/chunk-4EMNKR2T-C1kQZYHK.js +262 -0
  41. package/dist/chunk-55XCU76K-dcpLOktb.js +68 -0
  42. package/dist/chunk-5VM5RSS4-BdpQuzmO.js +19 -0
  43. package/dist/chunk-JWPE2WC7-CDBrSjU7.js +8 -0
  44. package/dist/chunk-VQ5W62QI-BiVKc40w.js +19 -0
  45. package/dist/chunk-XXDRQBXY-CPYrcdVW.js +8 -0
  46. package/dist/chunk-ZCHMQSOR-BG8OLpvb.js +451 -0
  47. package/dist/classDiagram-v2-4MYWR3UA-DqbpQpwI.js +1564 -0
  48. package/dist/component.d-DFoMKuUv.js +179 -0
  49. package/dist/cose-bilkent-JH36ORCC-CdXk4sPf.js +2609 -0
  50. package/dist/customComponents-DasaZ6pq.js +4 -0
  51. package/dist/customComponents.en-US-CkabuCXg.js +79 -0
  52. package/dist/customParseFormat-C0uLEpdq.js +182 -0
  53. package/dist/cynefin-EF2NZ3EQ-D7MVnMHu.js +21746 -0
  54. package/dist/cynefinDiagram-WF24UDRP-BYT_KpDL.js +299 -0
  55. package/dist/cytoscape.esm-BCV9V6aO.js +18760 -0
  56. package/dist/d3-scale-DA8IHmf0.js +1841 -0
  57. package/dist/dagre-NK4GIZVX-l-ghPdM8.js +2154 -0
  58. package/dist/dateRange-BbkLMg8L.js +79 -0
  59. package/dist/dateRange.en-US-CV12Q02G.js +79 -0
  60. package/dist/dayjs.min-DZ-YV8Mv.js +284 -0
  61. package/dist/diagram-CBK3MWTC-Bt3HiwvA.js +542 -0
  62. package/dist/diagram-I5XIIV2D-DcbqfBjx.js +150 -0
  63. package/dist/diagram-ODIL2UCW-9PC1n3n5.js +346 -0
  64. package/dist/diagram-PFBEJUXE-DGhr2kc7.js +478 -0
  65. package/dist/diagram-RJA3I4VV-DwzpOjZ_.js +219 -0
  66. package/dist/diagram-TYUNFSNR-B3Bd3TDU.js +2583 -0
  67. package/dist/dropdownFilter-DOi_8-ZT.js +76 -0
  68. package/dist/dropdownFilter.en-US-BiXpvXtF.js +76 -0
  69. package/dist/ebnfDiagram-V4P3TTPT-E5NN2oKc.js +109 -0
  70. package/dist/elk-QONTBCTQ-dFjcujl_.js +49170 -0
  71. package/dist/erDiagram-KYQIGQAA-BMrasBzB.js +1061 -0
  72. package/dist/eventList-CnsAwfDS.js +115 -0
  73. package/dist/eventList.en-US-Cof3rCLq.js +115 -0
  74. package/dist/eventReport-XS-HegnH.js +76 -0
  75. package/dist/eventReport.en-US-DTx4vzWT.js +76 -0
  76. package/dist/flowDiagram-IUGLLWBU-BGIBH0q0.js +1769 -0
  77. package/dist/ganttChart-DEeSvTJA.js +77 -0
  78. package/dist/ganttChart.en-US-SwRKrnoD.js +77 -0
  79. package/dist/ganttDiagram-R7GPNTJY-C0tb1Lpp.js +1741 -0
  80. package/dist/generateCypher-Ch9_lQa6.js +399 -0
  81. package/dist/gitGraphDiagram-PDYL7XHY-DBqcOa-c.js +815 -0
  82. package/dist/graph-CKJmgLki.js +1541 -0
  83. package/dist/index-BA-GzCXt.js +441 -0
  84. package/dist/infoDiagram-MVDRKAX5-Bwuki4JA.js +24 -0
  85. package/dist/ishikawaDiagram-HPEHV2GE-Dz4d6ygx.js +622 -0
  86. package/dist/journeyDiagram-BOSHW7O7-C99m34Bb.js +834 -0
  87. package/dist/kanban-definition-FNSA4HC5-mdqjODsT.js +724 -0
  88. package/dist/katex-BsrBVQKd.js +11314 -0
  89. package/dist/manifest-BjV1PJ6u.js +41 -0
  90. package/dist/mermaid.core-yQghUlIz.js +17642 -0
  91. package/dist/metricCards-CSb-_cT2.js +104 -0
  92. package/dist/metricCards.en-US-BLLhRsQU.js +104 -0
  93. package/dist/mindmap-definition-6OY57UG3-BZhO2wX4.js +834 -0
  94. package/dist/modelTrial-Bvb-RhGt.js +137 -0
  95. package/dist/modelTrial.en-US-DYcuor-G.js +137 -0
  96. package/dist/models-DekiCOuZ.js +6 -0
  97. package/dist/object-metric-numeric-vs3BeDkH.js +42 -0
  98. package/dist/object-metric.service-flZgBMRX.js +233 -0
  99. package/dist/objectDetail-SQUbp4Py.js +117 -0
  100. package/dist/objectDetail.en-US-DW3mlONM.js +117 -0
  101. package/dist/objectList-D99wPtJH.js +97 -0
  102. package/dist/objectList.en-US-PBBNyVLW.js +97 -0
  103. package/dist/objectTable-0jsFFMN3.js +127 -0
  104. package/dist/objectTable.en-US-yWEs8qc_.js +127 -0
  105. package/dist/pegDiagram-ECIUJNBX-BDa5RfZt.js +95 -0
  106. package/dist/pieDiagram-GNMPY74T-DNVtzXPv.js +165 -0
  107. package/dist/pivotTable-CHmQw18-.js +102 -0
  108. package/dist/pivotTable.en-US-B4uv4P08.js +102 -0
  109. package/dist/prompt-DYrjlEFr.js +373 -0
  110. package/dist/quadrantDiagram-D57K4MC3-vK0f2OvQ.js +1023 -0
  111. package/dist/railroadDiagram-Y72NRBL7-j6ZrTmRp.js +77 -0
  112. package/dist/regionMap-Cme-JyV_.js +128 -0
  113. package/dist/regionMap.en-US-Bwr2_p32.js +128 -0
  114. package/dist/requirementDiagram-EQYSW5RA-DgfEyljA.js +886 -0
  115. package/dist/sankeyDiagram-SY24JHO5-CImx-IX0.js +1160 -0
  116. package/dist/scenarioBar-BV43p7n-.js +122 -0
  117. package/dist/scenarioBar.en-US-5KqMQ2Bg.js +122 -0
  118. package/dist/scheduleGantt-CTYO-zYP.js +180 -0
  119. package/dist/scheduleGantt.en-US-hE7mvVUW.js +180 -0
  120. package/dist/searchBox-Ca7w0f_6.js +67 -0
  121. package/dist/searchBox.en-US-ArS_XBvB.js +67 -0
  122. package/dist/segmentedFilter-MhjVcWo0.js +80 -0
  123. package/dist/segmentedFilter.en-US-BxNrQO5T.js +80 -0
  124. package/dist/sequenceDiagram-BLEHNHQU-nWmjd1ci.js +2969 -0
  125. package/dist/sizeCapture-INFHLROL-D3jlbt7h.js +46 -0
  126. package/dist/stageChain-BxBafwjD.js +74 -0
  127. package/dist/stageChain.en-US-CP0G27n8.js +74 -0
  128. package/dist/stateDiagram-v2-A6IESKWZ-DG1ZetEu.js +1514 -0
  129. package/dist/subgraph-7n4SwliR.js +71 -0
  130. package/dist/subgraph.en-US-BNvY18IW.js +71 -0
  131. package/dist/swimlanes-B3ENRKFQ-cCmJE8AU.js +4991 -0
  132. package/dist/swimlanesDiagram-AYQRV4AK-CtuhyguU.js +14 -0
  133. package/dist/taskInbox-DGWYeI2b.js +118 -0
  134. package/dist/taskInbox.en-US-B-OzDmVl.js +118 -0
  135. package/dist/text-BqSVQKS6.js +78 -0
  136. package/dist/text.en-US-BhAxy_LE.js +78 -0
  137. package/dist/timeline-definition-JXYKGLGB-Cc-INsOv.js +1057 -0
  138. package/dist/trendChart-BjEeRS5_.js +135 -0
  139. package/dist/trendChart.en-US-BBGqWUKM.js +135 -0
  140. package/dist/useLabData-Df-jEHKs.js +20470 -0
  141. package/dist/usecaseDiagram-WPOLBNNX-r8wVjopm.js +7920 -0
  142. package/dist/vennDiagram-Q3Y3IDCW-BZiOcgrj.js +1579 -0
  143. package/dist/wardleyDiagram-IVAIDKWA-16jd07C_.js +675 -0
  144. package/dist/workshop-app-DnHNjBqy.js +86038 -0
  145. package/dist/workshop-app.css +1 -0
  146. package/dist/workshop-app.js +4 -0
  147. package/dist/world-Djau1JyJ.js +9 -0
  148. package/dist/xychartDiagram-4URNHDU4-C8DwWQNh.js +1460 -0
  149. package/dist-cli/workshop.js +340 -217
  150. package/example/host.js +109 -0
  151. package/example/index.html +93 -0
  152. package/example/server.mjs +237 -0
  153. package/index.d.ts +48 -0
  154. package/lib/validate.js +47 -1
  155. package/package.json +17 -5
  156. package/runtime/frame-runtime.js +13 -1
  157. package/workshop-component.js +32 -12
  158. package/workshop.js +2 -0
@@ -0,0 +1,4282 @@
1
+ import { r as b, ar as Me, as as le, at as Zn, au as oe, av as H, aw as Z, ax as dn, ay as fn, az as pn, aA as M, aB as K, aC as es, aD as hn, aE as ts, aF as X, aG as mt, aH as ns, aI as ss, aJ as V, aK as mn, aL as gn, aM as Mt, aN as is, aO as xt, aP as as, aQ as rs, aR as os, aS as ls, aT as vt, _ as cs, aU as yn, aV as us, aW as ds, aX as fs, aY as Bt, a as gt, aZ as Ut, a_ as ps, a$ as hs, b0 as ms, b1 as gs, b2 as qt, b3 as ys, N as bs, R as ws, b4 as Ie, b5 as vs, b6 as Fe, b7 as ks, b8 as bn, b9 as x, ba as $e, bb as kt, bc as St, bd as $t, be as Ss, bf as ge, bg as $s, bh as Is, bi as Ke, bj as It, bk as Kt, bl as Ns, bm as Ht, bn as zt, bo as Ye, bp as Es, bq as Cs, br as wn, bs as Os, bt as me, bu as Je, bv as He, bw as Re, bx as Xt, by as Ts, bz as Ls, bA as As, bB as vn, bC as _s, bD as Ds, bE as Ps, bF as Fs, w as Nt, j as _, u as Rs, i as Vt, I as Gt } from "./workshop-app-DnHNjBqy.js";
2
+ import { bE as js, bF as Ms, bG as xs, bH as Q, bI as Wt, M as Bs, A as Us, bJ as qs, bK as Yt } from "./useLabData-Df-jEHKs.js";
3
+ var Ks = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, name: "delete", theme: "outlined" }, Hs = function(e, n) {
4
+ return /* @__PURE__ */ b.createElement(Me, le({}, e, {
5
+ ref: n,
6
+ icon: Ks
7
+ }));
8
+ }, zs = /* @__PURE__ */ b.forwardRef(Hs);
9
+ const ot = (function(t, e) {
10
+ if (t && e) {
11
+ var n = Array.isArray(e) ? e : e.split(","), s = t.name || "", i = t.type || "", a = i.replace(/\/.*$/, "");
12
+ return n.some(function(r) {
13
+ var o = r.trim();
14
+ if (/^\*(\/\*)?$/.test(r))
15
+ return !0;
16
+ if (o.charAt(0) === ".") {
17
+ var l = s.toLowerCase(), c = o.toLowerCase(), d = [c];
18
+ return (c === ".jpg" || c === ".jpeg") && (d = [".jpg", ".jpeg"]), d.some(function(u) {
19
+ return l.endsWith(u);
20
+ });
21
+ }
22
+ return /\/\*$/.test(o) ? a === o.replace(/\/.*$/, "") : i === o ? !0 : /^\w+$/.test(o) ? (Zn(!1, "Upload takes an invalidate 'accept' type '".concat(o, "'.Skip for check.")), !0) : !1;
23
+ });
24
+ }
25
+ return !0;
26
+ });
27
+ function Xs(t, e) {
28
+ var n = "cannot ".concat(t.method, " ").concat(t.action, " ").concat(e.status, "'"), s = new Error(n);
29
+ return s.status = e.status, s.method = t.method, s.url = t.action, s;
30
+ }
31
+ function Jt(t) {
32
+ var e = t.responseText || t.response;
33
+ if (!e)
34
+ return e;
35
+ try {
36
+ return JSON.parse(e);
37
+ } catch {
38
+ return e;
39
+ }
40
+ }
41
+ function Qt(t) {
42
+ var e = new XMLHttpRequest();
43
+ t.onProgress && e.upload && (e.upload.onprogress = function(a) {
44
+ a.total > 0 && (a.percent = a.loaded / a.total * 100), t.onProgress(a);
45
+ });
46
+ var n = new FormData();
47
+ t.data && Object.keys(t.data).forEach(function(i) {
48
+ var a = t.data[i];
49
+ if (Array.isArray(a)) {
50
+ a.forEach(function(r) {
51
+ n.append("".concat(i, "[]"), r);
52
+ });
53
+ return;
54
+ }
55
+ n.append(i, a);
56
+ }), t.file instanceof Blob ? n.append(t.filename, t.file, t.file.name) : n.append(t.filename, t.file), e.onerror = function(a) {
57
+ t.onError(a);
58
+ }, e.onload = function() {
59
+ return e.status < 200 || e.status >= 300 ? t.onError(Xs(t, e), Jt(e)) : t.onSuccess(Jt(e), e);
60
+ }, e.open(t.method, t.action, !0), t.withCredentials && "withCredentials" in e && (e.withCredentials = !0);
61
+ var s = t.headers || {};
62
+ return s["X-Requested-With"] !== null && e.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(s).forEach(function(i) {
63
+ s[i] !== null && e.setRequestHeader(i, s[i]);
64
+ }), e.send(n), {
65
+ abort: function() {
66
+ e.abort();
67
+ }
68
+ };
69
+ }
70
+ var Vs = /* @__PURE__ */ (function() {
71
+ var t = oe(/* @__PURE__ */ H().mark(function e(n, s) {
72
+ var i, a, r, o, l, c, d, u;
73
+ return H().wrap(function(h) {
74
+ for (; ; ) switch (h.prev = h.next) {
75
+ case 0:
76
+ c = function() {
77
+ return c = oe(/* @__PURE__ */ H().mark(function p(m) {
78
+ return H().wrap(function(S) {
79
+ for (; ; ) switch (S.prev = S.next) {
80
+ case 0:
81
+ return S.abrupt("return", new Promise(function(k) {
82
+ m.file(function($) {
83
+ s($) ? (m.fullPath && !$.webkitRelativePath && (Object.defineProperties($, {
84
+ webkitRelativePath: {
85
+ writable: !0
86
+ }
87
+ }), $.webkitRelativePath = m.fullPath.replace(/^\//, ""), Object.defineProperties($, {
88
+ webkitRelativePath: {
89
+ writable: !1
90
+ }
91
+ })), k($)) : k(null);
92
+ });
93
+ }));
94
+ case 1:
95
+ case "end":
96
+ return S.stop();
97
+ }
98
+ }, p);
99
+ })), c.apply(this, arguments);
100
+ }, l = function(p) {
101
+ return c.apply(this, arguments);
102
+ }, o = function() {
103
+ return o = oe(/* @__PURE__ */ H().mark(function p(m) {
104
+ var v, S, k, $, y;
105
+ return H().wrap(function(N) {
106
+ for (; ; ) switch (N.prev = N.next) {
107
+ case 0:
108
+ v = m.createReader(), S = [];
109
+ case 2:
110
+ return N.next = 5, new Promise(function(w) {
111
+ v.readEntries(w, function() {
112
+ return w([]);
113
+ });
114
+ });
115
+ case 5:
116
+ if (k = N.sent, $ = k.length, $) {
117
+ N.next = 9;
118
+ break;
119
+ }
120
+ return N.abrupt("break", 12);
121
+ case 9:
122
+ for (y = 0; y < $; y++)
123
+ S.push(k[y]);
124
+ N.next = 2;
125
+ break;
126
+ case 12:
127
+ return N.abrupt("return", S);
128
+ case 13:
129
+ case "end":
130
+ return N.stop();
131
+ }
132
+ }, p);
133
+ })), o.apply(this, arguments);
134
+ }, r = function(p) {
135
+ return o.apply(this, arguments);
136
+ }, i = [], a = [], n.forEach(function(g) {
137
+ return a.push(g.webkitGetAsEntry());
138
+ }), d = /* @__PURE__ */ (function() {
139
+ var g = oe(/* @__PURE__ */ H().mark(function p(m, v) {
140
+ var S, k;
141
+ return H().wrap(function(y) {
142
+ for (; ; ) switch (y.prev = y.next) {
143
+ case 0:
144
+ if (m) {
145
+ y.next = 2;
146
+ break;
147
+ }
148
+ return y.abrupt("return");
149
+ case 2:
150
+ if (m.path = v || "", !m.isFile) {
151
+ y.next = 10;
152
+ break;
153
+ }
154
+ return y.next = 6, l(m);
155
+ case 6:
156
+ S = y.sent, S && i.push(S), y.next = 15;
157
+ break;
158
+ case 10:
159
+ if (!m.isDirectory) {
160
+ y.next = 15;
161
+ break;
162
+ }
163
+ return y.next = 13, r(m);
164
+ case 13:
165
+ k = y.sent, a.push.apply(a, Z(k));
166
+ case 15:
167
+ case "end":
168
+ return y.stop();
169
+ }
170
+ }, p);
171
+ }));
172
+ return function(m, v) {
173
+ return g.apply(this, arguments);
174
+ };
175
+ })(), u = 0;
176
+ case 9:
177
+ if (!(u < a.length)) {
178
+ h.next = 15;
179
+ break;
180
+ }
181
+ return h.next = 12, d(a[u]);
182
+ case 12:
183
+ u++, h.next = 9;
184
+ break;
185
+ case 15:
186
+ return h.abrupt("return", i);
187
+ case 16:
188
+ case "end":
189
+ return h.stop();
190
+ }
191
+ }, e);
192
+ }));
193
+ return function(n, s) {
194
+ return t.apply(this, arguments);
195
+ };
196
+ })(), Gs = +/* @__PURE__ */ new Date(), Ws = 0;
197
+ function lt() {
198
+ return "rc-upload-".concat(Gs, "-").concat(++Ws);
199
+ }
200
+ var Ys = ["component", "prefixCls", "className", "classNames", "disabled", "id", "name", "style", "styles", "multiple", "accept", "capture", "children", "directory", "folder", "openFileDialogOnClick", "onMouseEnter", "onMouseLeave", "hasControlInside"], Js = /* @__PURE__ */ (function(t) {
201
+ dn(n, t);
202
+ var e = fn(n);
203
+ function n() {
204
+ var s;
205
+ pn(this, n);
206
+ for (var i = arguments.length, a = new Array(i), r = 0; r < i; r++)
207
+ a[r] = arguments[r];
208
+ return s = e.call.apply(e, [this].concat(a)), M(K(s), "state", {
209
+ uid: lt()
210
+ }), M(K(s), "reqs", {}), M(K(s), "fileInput", void 0), M(K(s), "_isMounted", void 0), M(K(s), "onChange", function(o) {
211
+ var l = s.props, c = l.accept, d = l.directory, u = o.target.files, f = Z(u).filter(function(h) {
212
+ return !d || ot(h, c);
213
+ });
214
+ s.uploadFiles(f), s.reset();
215
+ }), M(K(s), "onClick", function(o) {
216
+ var l = s.fileInput;
217
+ if (l) {
218
+ var c = o.target, d = s.props.onClick;
219
+ if (c && c.tagName === "BUTTON") {
220
+ var u = l.parentNode;
221
+ u.focus(), c.blur();
222
+ }
223
+ l.click(), d && d(o);
224
+ }
225
+ }), M(K(s), "onKeyDown", function(o) {
226
+ o.key === "Enter" && s.onClick(o);
227
+ }), M(K(s), "onDataTransferFiles", /* @__PURE__ */ (function() {
228
+ var o = oe(/* @__PURE__ */ H().mark(function l(c, d) {
229
+ var u, f, h, g, p, m, v;
230
+ return H().wrap(function(k) {
231
+ for (; ; ) switch (k.prev = k.next) {
232
+ case 0:
233
+ if (u = s.props, f = u.multiple, h = u.accept, g = u.directory, p = Z(c.items || []), m = Z(c.files || []), (m.length > 0 || p.some(function($) {
234
+ return $.kind === "file";
235
+ })) && d?.(), !g) {
236
+ k.next = 11;
237
+ break;
238
+ }
239
+ return k.next = 7, Vs(Array.prototype.slice.call(p), function($) {
240
+ return ot($, s.props.accept);
241
+ });
242
+ case 7:
243
+ m = k.sent, s.uploadFiles(m), k.next = 14;
244
+ break;
245
+ case 11:
246
+ v = Z(m).filter(function($) {
247
+ return ot($, h);
248
+ }), f === !1 && (v = m.slice(0, 1)), s.uploadFiles(v);
249
+ case 14:
250
+ case "end":
251
+ return k.stop();
252
+ }
253
+ }, l);
254
+ }));
255
+ return function(l, c) {
256
+ return o.apply(this, arguments);
257
+ };
258
+ })()), M(K(s), "onFilePaste", /* @__PURE__ */ (function() {
259
+ var o = oe(/* @__PURE__ */ H().mark(function l(c) {
260
+ var d, u;
261
+ return H().wrap(function(h) {
262
+ for (; ; ) switch (h.prev = h.next) {
263
+ case 0:
264
+ if (d = s.props.pastable, d) {
265
+ h.next = 3;
266
+ break;
267
+ }
268
+ return h.abrupt("return");
269
+ case 3:
270
+ if (c.type !== "paste") {
271
+ h.next = 6;
272
+ break;
273
+ }
274
+ return u = c.clipboardData, h.abrupt("return", s.onDataTransferFiles(u, function() {
275
+ c.preventDefault();
276
+ }));
277
+ case 6:
278
+ case "end":
279
+ return h.stop();
280
+ }
281
+ }, l);
282
+ }));
283
+ return function(l) {
284
+ return o.apply(this, arguments);
285
+ };
286
+ })()), M(K(s), "onFileDragOver", function(o) {
287
+ o.preventDefault();
288
+ }), M(K(s), "onFileDrop", /* @__PURE__ */ (function() {
289
+ var o = oe(/* @__PURE__ */ H().mark(function l(c) {
290
+ var d;
291
+ return H().wrap(function(f) {
292
+ for (; ; ) switch (f.prev = f.next) {
293
+ case 0:
294
+ if (c.preventDefault(), c.type !== "drop") {
295
+ f.next = 4;
296
+ break;
297
+ }
298
+ return d = c.dataTransfer, f.abrupt("return", s.onDataTransferFiles(d));
299
+ case 4:
300
+ case "end":
301
+ return f.stop();
302
+ }
303
+ }, l);
304
+ }));
305
+ return function(l) {
306
+ return o.apply(this, arguments);
307
+ };
308
+ })()), M(K(s), "uploadFiles", function(o) {
309
+ var l = Z(o), c = l.map(function(d) {
310
+ return d.uid = lt(), s.processFile(d, l);
311
+ });
312
+ Promise.all(c).then(function(d) {
313
+ var u = s.props.onBatchStart;
314
+ u?.(d.map(function(f) {
315
+ var h = f.origin, g = f.parsedFile;
316
+ return {
317
+ file: h,
318
+ parsedFile: g
319
+ };
320
+ })), d.filter(function(f) {
321
+ return f.parsedFile !== null;
322
+ }).forEach(function(f) {
323
+ s.post(f);
324
+ });
325
+ });
326
+ }), M(K(s), "processFile", /* @__PURE__ */ (function() {
327
+ var o = oe(/* @__PURE__ */ H().mark(function l(c, d) {
328
+ var u, f, h, g, p, m, v, S, k;
329
+ return H().wrap(function(y) {
330
+ for (; ; ) switch (y.prev = y.next) {
331
+ case 0:
332
+ if (u = s.props.beforeUpload, f = c, !u) {
333
+ y.next = 14;
334
+ break;
335
+ }
336
+ return y.prev = 3, y.next = 6, u(c, d);
337
+ case 6:
338
+ f = y.sent, y.next = 12;
339
+ break;
340
+ case 9:
341
+ y.prev = 9, y.t0 = y.catch(3), f = !1;
342
+ case 12:
343
+ if (f !== !1) {
344
+ y.next = 14;
345
+ break;
346
+ }
347
+ return y.abrupt("return", {
348
+ origin: c,
349
+ parsedFile: null,
350
+ action: null,
351
+ data: null
352
+ });
353
+ case 14:
354
+ if (h = s.props.action, typeof h != "function") {
355
+ y.next = 21;
356
+ break;
357
+ }
358
+ return y.next = 18, h(c);
359
+ case 18:
360
+ g = y.sent, y.next = 22;
361
+ break;
362
+ case 21:
363
+ g = h;
364
+ case 22:
365
+ if (p = s.props.data, typeof p != "function") {
366
+ y.next = 29;
367
+ break;
368
+ }
369
+ return y.next = 26, p(c);
370
+ case 26:
371
+ m = y.sent, y.next = 30;
372
+ break;
373
+ case 29:
374
+ m = p;
375
+ case 30:
376
+ return v = // string type is from legacy `transformFile`.
377
+ // Not sure if this will work since no related test case works with it
378
+ (es(f) === "object" || typeof f == "string") && f ? f : c, v instanceof File ? S = v : S = new File([v], c.name, {
379
+ type: c.type
380
+ }), k = S, k.uid = c.uid, y.abrupt("return", {
381
+ origin: c,
382
+ data: m,
383
+ parsedFile: k,
384
+ action: g
385
+ });
386
+ case 35:
387
+ case "end":
388
+ return y.stop();
389
+ }
390
+ }, l, null, [[3, 9]]);
391
+ }));
392
+ return function(l, c) {
393
+ return o.apply(this, arguments);
394
+ };
395
+ })()), M(K(s), "saveFileInput", function(o) {
396
+ s.fileInput = o;
397
+ }), s;
398
+ }
399
+ return hn(n, [{
400
+ key: "componentDidMount",
401
+ value: function() {
402
+ this._isMounted = !0;
403
+ var i = this.props.pastable;
404
+ i && document.addEventListener("paste", this.onFilePaste);
405
+ }
406
+ }, {
407
+ key: "componentWillUnmount",
408
+ value: function() {
409
+ this._isMounted = !1, this.abort(), document.removeEventListener("paste", this.onFilePaste);
410
+ }
411
+ }, {
412
+ key: "componentDidUpdate",
413
+ value: function(i) {
414
+ var a = this.props.pastable;
415
+ a && !i.pastable ? document.addEventListener("paste", this.onFilePaste) : !a && i.pastable && document.removeEventListener("paste", this.onFilePaste);
416
+ }
417
+ }, {
418
+ key: "post",
419
+ value: function(i) {
420
+ var a = this, r = i.data, o = i.origin, l = i.action, c = i.parsedFile;
421
+ if (this._isMounted) {
422
+ var d = this.props, u = d.onStart, f = d.customRequest, h = d.name, g = d.headers, p = d.withCredentials, m = d.method, v = o.uid, S = f || Qt, k = {
423
+ action: l,
424
+ filename: h,
425
+ data: r,
426
+ file: c,
427
+ headers: g,
428
+ withCredentials: p,
429
+ method: m || "post",
430
+ onProgress: function(y) {
431
+ var I = a.props.onProgress;
432
+ I?.(y, c);
433
+ },
434
+ onSuccess: function(y, I) {
435
+ var N = a.props.onSuccess;
436
+ N?.(y, c, I), delete a.reqs[v];
437
+ },
438
+ onError: function(y, I) {
439
+ var N = a.props.onError;
440
+ N?.(y, I, c), delete a.reqs[v];
441
+ }
442
+ };
443
+ u(o), this.reqs[v] = S(k, {
444
+ defaultRequest: Qt
445
+ });
446
+ }
447
+ }
448
+ }, {
449
+ key: "reset",
450
+ value: function() {
451
+ this.setState({
452
+ uid: lt()
453
+ });
454
+ }
455
+ }, {
456
+ key: "abort",
457
+ value: function(i) {
458
+ var a = this.reqs;
459
+ if (i) {
460
+ var r = i.uid ? i.uid : i;
461
+ a[r] && a[r].abort && a[r].abort(), delete a[r];
462
+ } else
463
+ Object.keys(a).forEach(function(o) {
464
+ a[o] && a[o].abort && a[o].abort(), delete a[o];
465
+ });
466
+ }
467
+ }, {
468
+ key: "render",
469
+ value: function() {
470
+ var i = this.props, a = i.component, r = i.prefixCls, o = i.className, l = i.classNames, c = l === void 0 ? {} : l, d = i.disabled, u = i.id, f = i.name, h = i.style, g = i.styles, p = g === void 0 ? {} : g, m = i.multiple, v = i.accept, S = i.capture, k = i.children, $ = i.directory, y = i.folder, I = i.openFileDialogOnClick, N = i.onMouseEnter, w = i.onMouseLeave, L = i.hasControlInside, P = ts(i, Ys), G = X(M(M(M({}, r, !0), "".concat(r, "-disabled"), d), o, o)), R = $ || y ? {
471
+ directory: "directory",
472
+ webkitdirectory: "webkitdirectory"
473
+ } : {}, W = d ? {} : {
474
+ onClick: I ? this.onClick : function() {
475
+ },
476
+ onKeyDown: I ? this.onKeyDown : function() {
477
+ },
478
+ onMouseEnter: N,
479
+ onMouseLeave: w,
480
+ onDrop: this.onFileDrop,
481
+ onDragOver: this.onFileDragOver,
482
+ tabIndex: L ? void 0 : "0"
483
+ };
484
+ return /* @__PURE__ */ mt.createElement(a, le({}, W, {
485
+ className: G,
486
+ role: L ? void 0 : "button",
487
+ style: h
488
+ }), /* @__PURE__ */ mt.createElement("input", le({}, ns(P, {
489
+ aria: !0,
490
+ data: !0
491
+ }), {
492
+ id: u,
493
+ name: f,
494
+ disabled: d,
495
+ type: "file",
496
+ ref: this.saveFileInput,
497
+ onClick: function(ee) {
498
+ return ee.stopPropagation();
499
+ },
500
+ key: this.state.uid,
501
+ style: ss({
502
+ display: "none"
503
+ }, p.input),
504
+ className: c.input,
505
+ accept: v
506
+ }, R, {
507
+ multiple: m,
508
+ onChange: this.onChange
509
+ }, S != null ? {
510
+ capture: S
511
+ } : {})), k);
512
+ }
513
+ }]), n;
514
+ })(b.Component);
515
+ function ct() {
516
+ }
517
+ var yt = /* @__PURE__ */ (function(t) {
518
+ dn(n, t);
519
+ var e = fn(n);
520
+ function n() {
521
+ var s;
522
+ pn(this, n);
523
+ for (var i = arguments.length, a = new Array(i), r = 0; r < i; r++)
524
+ a[r] = arguments[r];
525
+ return s = e.call.apply(e, [this].concat(a)), M(K(s), "uploader", void 0), M(K(s), "saveUploader", function(o) {
526
+ s.uploader = o;
527
+ }), s;
528
+ }
529
+ return hn(n, [{
530
+ key: "abort",
531
+ value: function(i) {
532
+ this.uploader.abort(i);
533
+ }
534
+ }, {
535
+ key: "render",
536
+ value: function() {
537
+ return /* @__PURE__ */ mt.createElement(Js, le({}, this.props, {
538
+ ref: this.saveUploader
539
+ }));
540
+ }
541
+ }]), n;
542
+ })(b.Component);
543
+ M(yt, "defaultProps", {
544
+ component: "span",
545
+ prefixCls: "rc-upload",
546
+ data: {},
547
+ headers: {},
548
+ name: "file",
549
+ multipart: !1,
550
+ onStart: ct,
551
+ onError: ct,
552
+ onSuccess: ct,
553
+ multiple: !1,
554
+ beforeUpload: null,
555
+ customRequest: null,
556
+ withCredentials: !1,
557
+ openFileDialogOnClick: !0,
558
+ hasControlInside: !1
559
+ });
560
+ const Qs = (t) => {
561
+ const {
562
+ componentCls: e,
563
+ iconCls: n
564
+ } = t;
565
+ return {
566
+ [`${e}-wrapper`]: {
567
+ [`${e}-drag`]: {
568
+ position: "relative",
569
+ width: "100%",
570
+ height: "100%",
571
+ textAlign: "center",
572
+ background: t.colorFillAlter,
573
+ border: `${V(t.lineWidth)} dashed ${t.colorBorder}`,
574
+ borderRadius: t.borderRadiusLG,
575
+ cursor: "pointer",
576
+ transition: `border-color ${t.motionDurationSlow}`,
577
+ [e]: {
578
+ padding: t.padding
579
+ },
580
+ [`${e}-btn`]: {
581
+ display: "table",
582
+ width: "100%",
583
+ height: "100%",
584
+ outline: "none",
585
+ borderRadius: t.borderRadiusLG,
586
+ "&:focus-visible": {
587
+ outline: `${V(t.lineWidthFocus)} solid ${t.colorPrimaryBorder}`
588
+ }
589
+ },
590
+ [`${e}-drag-container`]: {
591
+ display: "table-cell",
592
+ verticalAlign: "middle"
593
+ },
594
+ [`
595
+ &:not(${e}-disabled):hover,
596
+ &-hover:not(${e}-disabled)
597
+ `]: {
598
+ borderColor: t.colorPrimaryHover
599
+ },
600
+ [`p${e}-drag-icon`]: {
601
+ marginBottom: t.margin,
602
+ [n]: {
603
+ color: t.colorPrimary,
604
+ fontSize: t.uploadThumbnailSize
605
+ }
606
+ },
607
+ [`p${e}-text`]: {
608
+ margin: `0 0 ${V(t.marginXXS)}`,
609
+ color: t.colorTextHeading,
610
+ fontSize: t.fontSizeLG
611
+ },
612
+ [`p${e}-hint`]: {
613
+ color: t.colorTextDescription,
614
+ fontSize: t.fontSize
615
+ },
616
+ // ===================== Disabled =====================
617
+ [`&${e}-disabled`]: {
618
+ [`p${e}-drag-icon ${n},
619
+ p${e}-text,
620
+ p${e}-hint
621
+ `]: {
622
+ color: t.colorTextDisabled
623
+ }
624
+ }
625
+ }
626
+ }
627
+ };
628
+ }, Zs = (t) => {
629
+ const {
630
+ componentCls: e,
631
+ iconCls: n,
632
+ fontSize: s,
633
+ lineHeight: i,
634
+ calc: a
635
+ } = t, r = `${e}-list-item`, o = `${r}-actions`, l = `${r}-action`;
636
+ return {
637
+ [`${e}-wrapper`]: {
638
+ [`${e}-list`]: Object.assign(Object.assign({}, mn()), {
639
+ lineHeight: t.lineHeight,
640
+ [r]: {
641
+ position: "relative",
642
+ height: a(t.lineHeight).mul(s).equal(),
643
+ marginTop: t.marginXS,
644
+ fontSize: s,
645
+ display: "flex",
646
+ alignItems: "center",
647
+ transition: `background-color ${t.motionDurationSlow}`,
648
+ borderRadius: t.borderRadiusSM,
649
+ "&:hover": {
650
+ backgroundColor: t.controlItemBgHover
651
+ },
652
+ [`${r}-name`]: Object.assign(Object.assign({}, gn), {
653
+ padding: `0 ${V(t.paddingXS)}`,
654
+ lineHeight: i,
655
+ flex: "auto",
656
+ transition: `all ${t.motionDurationSlow}`
657
+ }),
658
+ [o]: {
659
+ whiteSpace: "nowrap",
660
+ [l]: {
661
+ opacity: 0
662
+ },
663
+ [n]: {
664
+ color: t.actionsColor,
665
+ transition: `all ${t.motionDurationSlow}`
666
+ },
667
+ [`
668
+ ${l}:focus-visible,
669
+ &.picture ${l}
670
+ `]: {
671
+ opacity: 1
672
+ }
673
+ },
674
+ [`${e}-icon ${n}`]: {
675
+ color: t.colorIcon,
676
+ fontSize: s
677
+ },
678
+ [`${r}-progress`]: {
679
+ position: "absolute",
680
+ bottom: t.calc(t.uploadProgressOffset).mul(-1).equal(),
681
+ width: "100%",
682
+ paddingInlineStart: a(s).add(t.paddingXS).equal(),
683
+ fontSize: s,
684
+ lineHeight: 0,
685
+ pointerEvents: "none",
686
+ "> div": {
687
+ margin: 0
688
+ }
689
+ }
690
+ },
691
+ [`${r}:hover ${l}`]: {
692
+ opacity: 1
693
+ },
694
+ [`${r}-error`]: {
695
+ color: t.colorError,
696
+ [`${r}-name, ${e}-icon ${n}`]: {
697
+ color: t.colorError
698
+ },
699
+ [o]: {
700
+ [`${n}, ${n}:hover`]: {
701
+ color: t.colorError
702
+ },
703
+ [l]: {
704
+ opacity: 1
705
+ }
706
+ }
707
+ },
708
+ [`${e}-list-item-container`]: {
709
+ transition: `opacity ${t.motionDurationSlow}, height ${t.motionDurationSlow}`,
710
+ // For smooth removing animation
711
+ "&::before": {
712
+ display: "table",
713
+ width: 0,
714
+ height: 0,
715
+ content: '""'
716
+ }
717
+ }
718
+ })
719
+ }
720
+ };
721
+ }, ei = (t) => {
722
+ const {
723
+ componentCls: e
724
+ } = t, n = new Mt("uploadAnimateInlineIn", {
725
+ from: {
726
+ width: 0,
727
+ height: 0,
728
+ padding: 0,
729
+ opacity: 0,
730
+ margin: t.calc(t.marginXS).div(-2).equal()
731
+ }
732
+ }), s = new Mt("uploadAnimateInlineOut", {
733
+ to: {
734
+ width: 0,
735
+ height: 0,
736
+ padding: 0,
737
+ opacity: 0,
738
+ margin: t.calc(t.marginXS).div(-2).equal()
739
+ }
740
+ }), i = `${e}-animate-inline`;
741
+ return [{
742
+ [`${e}-wrapper`]: {
743
+ [`${i}-appear, ${i}-enter, ${i}-leave`]: {
744
+ animationDuration: t.motionDurationSlow,
745
+ animationTimingFunction: t.motionEaseInOutCirc,
746
+ animationFillMode: "forwards"
747
+ },
748
+ [`${i}-appear, ${i}-enter`]: {
749
+ animationName: n
750
+ },
751
+ [`${i}-leave`]: {
752
+ animationName: s
753
+ }
754
+ }
755
+ }, {
756
+ [`${e}-wrapper`]: is(t)
757
+ }, n, s];
758
+ }, ti = (t) => {
759
+ const {
760
+ componentCls: e,
761
+ iconCls: n,
762
+ uploadThumbnailSize: s,
763
+ uploadProgressOffset: i,
764
+ calc: a
765
+ } = t, r = `${e}-list`, o = `${r}-item`;
766
+ return {
767
+ [`${e}-wrapper`]: {
768
+ // ${listCls} 增加优先级
769
+ [`
770
+ ${r}${r}-picture,
771
+ ${r}${r}-picture-card,
772
+ ${r}${r}-picture-circle
773
+ `]: {
774
+ [o]: {
775
+ position: "relative",
776
+ height: a(s).add(a(t.lineWidth).mul(2)).add(a(t.paddingXS).mul(2)).equal(),
777
+ padding: t.paddingXS,
778
+ border: `${V(t.lineWidth)} ${t.lineType} ${t.colorBorder}`,
779
+ borderRadius: t.borderRadiusLG,
780
+ "&:hover": {
781
+ background: "transparent"
782
+ },
783
+ [`${o}-thumbnail`]: Object.assign(Object.assign({}, gn), {
784
+ width: s,
785
+ height: s,
786
+ lineHeight: V(a(s).add(t.paddingSM).equal()),
787
+ textAlign: "center",
788
+ flex: "none",
789
+ [n]: {
790
+ fontSize: t.fontSizeHeading2,
791
+ color: t.colorPrimary
792
+ },
793
+ img: {
794
+ display: "block",
795
+ width: "100%",
796
+ height: "100%",
797
+ overflow: "hidden"
798
+ }
799
+ }),
800
+ [`${o}-progress`]: {
801
+ bottom: i,
802
+ width: `calc(100% - ${V(a(t.paddingSM).mul(2).equal())})`,
803
+ marginTop: 0,
804
+ paddingInlineStart: a(s).add(t.paddingXS).equal()
805
+ }
806
+ },
807
+ [`${o}-error`]: {
808
+ borderColor: t.colorError,
809
+ // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
810
+ [`${o}-thumbnail ${n}`]: {
811
+ [`svg path[fill='${xt[0]}']`]: {
812
+ fill: t.colorErrorBg
813
+ },
814
+ [`svg path[fill='${xt.primary}']`]: {
815
+ fill: t.colorError
816
+ }
817
+ }
818
+ },
819
+ [`${o}-uploading`]: {
820
+ borderStyle: "dashed",
821
+ [`${o}-name`]: {
822
+ marginBottom: i
823
+ }
824
+ }
825
+ },
826
+ [`${r}${r}-picture-circle ${o}`]: {
827
+ [`&, &::before, ${o}-thumbnail`]: {
828
+ borderRadius: "50%"
829
+ }
830
+ }
831
+ }
832
+ };
833
+ }, ni = (t) => {
834
+ const {
835
+ componentCls: e,
836
+ iconCls: n,
837
+ fontSizeLG: s,
838
+ colorTextLightSolid: i,
839
+ calc: a
840
+ } = t, r = `${e}-list`, o = `${r}-item`, l = t.uploadPicCardSize;
841
+ return {
842
+ [`
843
+ ${e}-wrapper${e}-picture-card-wrapper,
844
+ ${e}-wrapper${e}-picture-circle-wrapper
845
+ `]: Object.assign(Object.assign({}, mn()), {
846
+ display: "block",
847
+ [`${e}${e}-select`]: {
848
+ width: l,
849
+ height: l,
850
+ textAlign: "center",
851
+ verticalAlign: "top",
852
+ backgroundColor: t.colorFillAlter,
853
+ border: `${V(t.lineWidth)} dashed ${t.colorBorder}`,
854
+ borderRadius: t.borderRadiusLG,
855
+ cursor: "pointer",
856
+ transition: `border-color ${t.motionDurationSlow}`,
857
+ [`> ${e}`]: {
858
+ display: "flex",
859
+ alignItems: "center",
860
+ justifyContent: "center",
861
+ height: "100%",
862
+ textAlign: "center"
863
+ },
864
+ [`&:not(${e}-disabled):hover`]: {
865
+ borderColor: t.colorPrimary
866
+ }
867
+ },
868
+ // list
869
+ [`${r}${r}-picture-card, ${r}${r}-picture-circle`]: {
870
+ display: "flex",
871
+ flexWrap: "wrap",
872
+ "@supports not (gap: 1px)": {
873
+ "& > *": {
874
+ marginBlockEnd: t.marginXS,
875
+ marginInlineEnd: t.marginXS
876
+ }
877
+ },
878
+ "@supports (gap: 1px)": {
879
+ gap: t.marginXS
880
+ },
881
+ [`${r}-item-container`]: {
882
+ display: "inline-block",
883
+ width: l,
884
+ height: l,
885
+ verticalAlign: "top"
886
+ },
887
+ "&::after": {
888
+ display: "none"
889
+ },
890
+ "&::before": {
891
+ display: "none"
892
+ },
893
+ [o]: {
894
+ height: "100%",
895
+ margin: 0,
896
+ "&::before": {
897
+ position: "absolute",
898
+ zIndex: 1,
899
+ width: `calc(100% - ${V(a(t.paddingXS).mul(2).equal())})`,
900
+ height: `calc(100% - ${V(a(t.paddingXS).mul(2).equal())})`,
901
+ backgroundColor: t.colorBgMask,
902
+ opacity: 0,
903
+ transition: `all ${t.motionDurationSlow}`,
904
+ content: '" "'
905
+ }
906
+ },
907
+ [`${o}:hover`]: {
908
+ [`&::before, ${o}-actions`]: {
909
+ opacity: 1
910
+ }
911
+ },
912
+ [`${o}-actions`]: {
913
+ position: "absolute",
914
+ insetInlineStart: 0,
915
+ zIndex: 10,
916
+ width: "100%",
917
+ whiteSpace: "nowrap",
918
+ textAlign: "center",
919
+ opacity: 0,
920
+ transition: `all ${t.motionDurationSlow}`,
921
+ [`
922
+ ${n}-eye,
923
+ ${n}-download,
924
+ ${n}-delete
925
+ `]: {
926
+ zIndex: 10,
927
+ width: s,
928
+ margin: `0 ${V(t.marginXXS)}`,
929
+ fontSize: s,
930
+ cursor: "pointer",
931
+ transition: `all ${t.motionDurationSlow}`,
932
+ color: i,
933
+ "&:hover": {
934
+ color: i
935
+ },
936
+ svg: {
937
+ verticalAlign: "baseline"
938
+ }
939
+ }
940
+ },
941
+ [`${o}-thumbnail, ${o}-thumbnail img`]: {
942
+ position: "static",
943
+ display: "block",
944
+ width: "100%",
945
+ height: "100%",
946
+ objectFit: "contain"
947
+ },
948
+ [`${o}-name`]: {
949
+ display: "none",
950
+ textAlign: "center"
951
+ },
952
+ [`${o}-file + ${o}-name`]: {
953
+ position: "absolute",
954
+ bottom: t.margin,
955
+ display: "block",
956
+ width: `calc(100% - ${V(a(t.paddingXS).mul(2).equal())})`
957
+ },
958
+ [`${o}-uploading`]: {
959
+ [`&${o}`]: {
960
+ backgroundColor: t.colorFillAlter
961
+ },
962
+ [`&::before, ${n}-eye, ${n}-download, ${n}-delete`]: {
963
+ display: "none"
964
+ }
965
+ },
966
+ [`${o}-progress`]: {
967
+ bottom: t.marginXL,
968
+ width: `calc(100% - ${V(a(t.paddingXS).mul(2).equal())})`,
969
+ paddingInlineStart: 0
970
+ }
971
+ }
972
+ }),
973
+ [`${e}-wrapper${e}-picture-circle-wrapper`]: {
974
+ [`${e}${e}-select`]: {
975
+ borderRadius: "50%"
976
+ }
977
+ }
978
+ };
979
+ }, si = (t) => {
980
+ const {
981
+ componentCls: e
982
+ } = t;
983
+ return {
984
+ [`${e}-rtl`]: {
985
+ direction: "rtl"
986
+ }
987
+ };
988
+ }, ii = (t) => {
989
+ const {
990
+ componentCls: e,
991
+ colorTextDisabled: n
992
+ } = t;
993
+ return {
994
+ [`${e}-wrapper`]: Object.assign(Object.assign({}, os(t)), {
995
+ [e]: {
996
+ outline: 0,
997
+ "input[type='file']": {
998
+ cursor: "pointer"
999
+ }
1000
+ },
1001
+ [`${e}-select`]: {
1002
+ display: "inline-block"
1003
+ },
1004
+ [`${e}-hidden`]: {
1005
+ display: "none"
1006
+ },
1007
+ [`${e}-disabled`]: {
1008
+ color: n,
1009
+ cursor: "not-allowed"
1010
+ }
1011
+ })
1012
+ };
1013
+ }, ai = (t) => ({
1014
+ actionsColor: t.colorIcon,
1015
+ pictureCardSize: t.controlHeightLG * 2.55
1016
+ }), ri = as("Upload", (t) => {
1017
+ const {
1018
+ fontSizeHeading3: e,
1019
+ fontHeight: n,
1020
+ lineWidth: s,
1021
+ pictureCardSize: i,
1022
+ calc: a
1023
+ } = t, r = rs(t, {
1024
+ uploadThumbnailSize: a(e).mul(2).equal(),
1025
+ uploadProgressOffset: a(a(n).div(2)).add(s).equal(),
1026
+ uploadPicCardSize: i
1027
+ });
1028
+ return [ii(r), Qs(r), ti(r), ni(r), Zs(r), ei(r), si(r), js(r)];
1029
+ }, ai);
1030
+ var oi = { icon: function(e, n) {
1031
+ return { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M534 352V136H232v752h560V394H576a42 42 0 01-42-42z", fill: n } }, { tag: "path", attrs: { d: "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z", fill: e } }] };
1032
+ }, name: "file", theme: "twotone" }, li = function(e, n) {
1033
+ return /* @__PURE__ */ b.createElement(Me, le({}, e, {
1034
+ ref: n,
1035
+ icon: oi
1036
+ }));
1037
+ }, ci = /* @__PURE__ */ b.forwardRef(li), ui = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" } }] }, name: "paper-clip", theme: "outlined" }, di = function(e, n) {
1038
+ return /* @__PURE__ */ b.createElement(Me, le({}, e, {
1039
+ ref: n,
1040
+ icon: ui
1041
+ }));
1042
+ }, fi = /* @__PURE__ */ b.forwardRef(di), pi = { icon: function(e, n) {
1043
+ return { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z", fill: e } }, { tag: "path", attrs: { d: "M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z", fill: n } }, { tag: "path", attrs: { d: "M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z", fill: n } }, { tag: "path", attrs: { d: "M276 368a28 28 0 1056 0 28 28 0 10-56 0z", fill: n } }, { tag: "path", attrs: { d: "M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z", fill: e } }] };
1044
+ }, name: "picture", theme: "twotone" }, hi = function(e, n) {
1045
+ return /* @__PURE__ */ b.createElement(Me, le({}, e, {
1046
+ ref: n,
1047
+ icon: pi
1048
+ }));
1049
+ }, mi = /* @__PURE__ */ b.forwardRef(hi);
1050
+ function ze(t) {
1051
+ return Object.assign(Object.assign({}, t), {
1052
+ lastModified: t.lastModified,
1053
+ lastModifiedDate: t.lastModifiedDate,
1054
+ name: t.name,
1055
+ size: t.size,
1056
+ type: t.type,
1057
+ uid: t.uid,
1058
+ percent: 0,
1059
+ originFileObj: t
1060
+ });
1061
+ }
1062
+ function Xe(t, e) {
1063
+ const n = Z(e), s = n.findIndex(({
1064
+ uid: i
1065
+ }) => i === t.uid);
1066
+ return s === -1 ? n.push(t) : n[s] = t, n;
1067
+ }
1068
+ function ut(t, e) {
1069
+ const n = t.uid !== void 0 ? "uid" : "name";
1070
+ return e.filter((s) => s[n] === t[n])[0];
1071
+ }
1072
+ function gi(t, e) {
1073
+ const n = t.uid !== void 0 ? "uid" : "name", s = e.filter((i) => i[n] !== t[n]);
1074
+ return s.length === e.length ? null : s;
1075
+ }
1076
+ const yi = (t = "") => {
1077
+ const e = t.split("/"), s = e[e.length - 1].split(/#|\?/)[0];
1078
+ return (/\.[^./\\]*$/.exec(s) || [""])[0];
1079
+ }, kn = (t) => t.indexOf("image/") === 0, bi = (t) => {
1080
+ if (t.type && !t.thumbUrl)
1081
+ return kn(t.type);
1082
+ const e = t.thumbUrl || t.url || "", n = yi(e);
1083
+ return /^data:image\//.test(e) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(n) ? !0 : !(/^data:/.test(e) || n);
1084
+ }, ae = 200;
1085
+ function wi(t) {
1086
+ return new Promise((e) => {
1087
+ if (!t.type || !kn(t.type)) {
1088
+ e("");
1089
+ return;
1090
+ }
1091
+ const n = document.createElement("canvas");
1092
+ n.width = ae, n.height = ae, n.style.cssText = `position: fixed; left: 0; top: 0; width: ${ae}px; height: ${ae}px; z-index: 9999; display: none;`, document.body.appendChild(n);
1093
+ const s = n.getContext("2d"), i = new Image();
1094
+ if (i.onload = () => {
1095
+ const {
1096
+ width: a,
1097
+ height: r
1098
+ } = i;
1099
+ let o = ae, l = ae, c = 0, d = 0;
1100
+ a > r ? (l = r * (ae / a), d = -(l - o) / 2) : (o = a * (ae / r), c = -(o - l) / 2), s.drawImage(i, c, d, o, l);
1101
+ const u = n.toDataURL();
1102
+ document.body.removeChild(n), window.URL.revokeObjectURL(i.src), e(u);
1103
+ }, i.crossOrigin = "anonymous", t.type.startsWith("image/svg+xml")) {
1104
+ const a = new FileReader();
1105
+ a.onload = () => {
1106
+ a.result && typeof a.result == "string" && (i.src = a.result);
1107
+ }, a.readAsDataURL(t);
1108
+ } else if (t.type.startsWith("image/gif")) {
1109
+ const a = new FileReader();
1110
+ a.onload = () => {
1111
+ a.result && e(a.result);
1112
+ }, a.readAsDataURL(t);
1113
+ } else
1114
+ i.src = window.URL.createObjectURL(t);
1115
+ });
1116
+ }
1117
+ var vi = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, name: "download", theme: "outlined" }, ki = function(e, n) {
1118
+ return /* @__PURE__ */ b.createElement(Me, le({}, e, {
1119
+ ref: n,
1120
+ icon: vi
1121
+ }));
1122
+ }, Si = /* @__PURE__ */ b.forwardRef(ki);
1123
+ const $i = /* @__PURE__ */ b.forwardRef(({
1124
+ prefixCls: t,
1125
+ className: e,
1126
+ style: n,
1127
+ locale: s,
1128
+ listType: i,
1129
+ file: a,
1130
+ items: r,
1131
+ progress: o,
1132
+ iconRender: l,
1133
+ actionIconRender: c,
1134
+ itemRender: d,
1135
+ isImgUrl: u,
1136
+ showPreviewIcon: f,
1137
+ showRemoveIcon: h,
1138
+ showDownloadIcon: g,
1139
+ previewIcon: p,
1140
+ removeIcon: m,
1141
+ downloadIcon: v,
1142
+ extra: S,
1143
+ onPreview: k,
1144
+ onDownload: $,
1145
+ onClose: y
1146
+ }, I) => {
1147
+ var N, w;
1148
+ const {
1149
+ status: L
1150
+ } = a, [P, G] = b.useState(L);
1151
+ b.useEffect(() => {
1152
+ L !== "removed" && G(L);
1153
+ }, [L]);
1154
+ const [R, W] = b.useState(!1);
1155
+ b.useEffect(() => {
1156
+ const B = setTimeout(() => {
1157
+ W(!0);
1158
+ }, 300);
1159
+ return () => {
1160
+ clearTimeout(B);
1161
+ };
1162
+ }, []);
1163
+ const se = l(a);
1164
+ let ee = /* @__PURE__ */ b.createElement("div", {
1165
+ className: `${t}-icon`
1166
+ }, se);
1167
+ if (i === "picture" || i === "picture-card" || i === "picture-circle")
1168
+ if (P === "uploading" || !a.thumbUrl && !a.url) {
1169
+ const B = X(`${t}-list-item-thumbnail`, {
1170
+ [`${t}-list-item-file`]: P !== "uploading"
1171
+ });
1172
+ ee = /* @__PURE__ */ b.createElement("div", {
1173
+ className: B
1174
+ }, se);
1175
+ } else {
1176
+ const B = u?.(a) ? /* @__PURE__ */ b.createElement("img", {
1177
+ src: a.thumbUrl || a.url,
1178
+ alt: a.name,
1179
+ className: `${t}-list-item-image`,
1180
+ crossOrigin: a.crossOrigin
1181
+ }) : se, Le = X(`${t}-list-item-thumbnail`, {
1182
+ [`${t}-list-item-file`]: u && !u(a)
1183
+ });
1184
+ ee = /* @__PURE__ */ b.createElement("a", {
1185
+ className: Le,
1186
+ onClick: (qe) => k(a, qe),
1187
+ href: a.url || a.thumbUrl,
1188
+ target: "_blank",
1189
+ rel: "noopener noreferrer"
1190
+ }, B);
1191
+ }
1192
+ const Oe = X(`${t}-list-item`, `${t}-list-item-${P}`), Y = typeof a.linkProps == "string" ? JSON.parse(a.linkProps) : a.linkProps, te = (typeof h == "function" ? h(a) : h) ? c(
1193
+ (typeof m == "function" ? m(a) : m) || /* @__PURE__ */ b.createElement(zs, null),
1194
+ () => y(a),
1195
+ t,
1196
+ s.removeFile,
1197
+ // acceptUploadDisabled is true, only remove icon will follow Upload disabled prop
1198
+ // https://github.com/ant-design/ant-design/issues/46171
1199
+ !0
1200
+ ) : null, j = (typeof g == "function" ? g(a) : g) && P === "done" ? c((typeof v == "function" ? v(a) : v) || /* @__PURE__ */ b.createElement(Si, null), () => $(a), t, s.downloadFile) : null, Te = i !== "picture-card" && i !== "picture-circle" && /* @__PURE__ */ b.createElement("span", {
1201
+ key: "download-delete",
1202
+ className: X(`${t}-list-item-actions`, {
1203
+ picture: i === "picture"
1204
+ })
1205
+ }, j, te), ye = typeof S == "function" ? S(a) : S, ce = ye && /* @__PURE__ */ b.createElement("span", {
1206
+ className: `${t}-list-item-extra`
1207
+ }, ye), E = X(`${t}-list-item-name`), F = a.url ? /* @__PURE__ */ b.createElement("a", Object.assign({
1208
+ key: "view",
1209
+ target: "_blank",
1210
+ rel: "noopener noreferrer",
1211
+ className: E,
1212
+ title: a.name
1213
+ }, Y, {
1214
+ href: a.url,
1215
+ onClick: (B) => k(a, B)
1216
+ }), a.name, ce) : /* @__PURE__ */ b.createElement("span", {
1217
+ key: "view",
1218
+ className: E,
1219
+ onClick: (B) => k(a, B),
1220
+ title: a.name
1221
+ }, a.name, ce), q = (typeof f == "function" ? f(a) : f) && (a.url || a.thumbUrl) ? /* @__PURE__ */ b.createElement("a", {
1222
+ href: a.url || a.thumbUrl,
1223
+ target: "_blank",
1224
+ rel: "noopener noreferrer",
1225
+ onClick: (B) => k(a, B),
1226
+ title: s.previewFile
1227
+ }, typeof p == "function" ? p(a) : p || /* @__PURE__ */ b.createElement(ls, null)) : null, ne = (i === "picture-card" || i === "picture-circle") && P !== "uploading" && /* @__PURE__ */ b.createElement("span", {
1228
+ className: `${t}-list-item-actions`
1229
+ }, q, P === "done" && j, te), {
1230
+ getPrefixCls: be
1231
+ } = b.useContext(vt), ue = be(), de = /* @__PURE__ */ b.createElement("div", {
1232
+ className: Oe
1233
+ }, ee, F, Te, ne, R && /* @__PURE__ */ b.createElement(yn, {
1234
+ motionName: `${ue}-fade`,
1235
+ visible: P === "uploading",
1236
+ motionDeadline: 2e3
1237
+ }, ({
1238
+ className: B
1239
+ }) => {
1240
+ const Le = "percent" in a ? /* @__PURE__ */ b.createElement(Ms, Object.assign({
1241
+ type: "line",
1242
+ percent: a.percent,
1243
+ "aria-label": a["aria-label"],
1244
+ "aria-labelledby": a["aria-labelledby"]
1245
+ }, o)) : null;
1246
+ return /* @__PURE__ */ b.createElement("div", {
1247
+ className: X(`${t}-list-item-progress`, B)
1248
+ }, Le);
1249
+ })), fe = a.response && typeof a.response == "string" ? a.response : ((N = a.error) === null || N === void 0 ? void 0 : N.statusText) || ((w = a.error) === null || w === void 0 ? void 0 : w.message) || s.uploadError, ie = P === "error" ? /* @__PURE__ */ b.createElement(cs, {
1250
+ title: fe,
1251
+ getPopupContainer: (B) => B.parentNode
1252
+ }, de) : de;
1253
+ return /* @__PURE__ */ b.createElement("div", {
1254
+ className: X(`${t}-list-item-container`, e),
1255
+ style: n,
1256
+ ref: I
1257
+ }, d ? d(ie, a, r, {
1258
+ download: $.bind(null, a),
1259
+ preview: k.bind(null, a),
1260
+ remove: y.bind(null, a)
1261
+ }) : ie);
1262
+ }), Ii = (t, e) => {
1263
+ const {
1264
+ listType: n = "text",
1265
+ previewFile: s = wi,
1266
+ onPreview: i,
1267
+ onDownload: a,
1268
+ onRemove: r,
1269
+ locale: o,
1270
+ iconRender: l,
1271
+ isImageUrl: c = bi,
1272
+ prefixCls: d,
1273
+ items: u = [],
1274
+ showPreviewIcon: f = !0,
1275
+ showRemoveIcon: h = !0,
1276
+ showDownloadIcon: g = !1,
1277
+ removeIcon: p,
1278
+ previewIcon: m,
1279
+ downloadIcon: v,
1280
+ extra: S,
1281
+ progress: k = {
1282
+ size: [-1, 2],
1283
+ showInfo: !1
1284
+ },
1285
+ appendAction: $,
1286
+ appendActionVisible: y = !0,
1287
+ itemRender: I,
1288
+ disabled: N
1289
+ } = t, [, w] = xs(), [L, P] = b.useState(!1), G = ["picture-card", "picture-circle"].includes(n);
1290
+ b.useEffect(() => {
1291
+ n.startsWith("picture") && (u || []).forEach((E) => {
1292
+ !(E.originFileObj instanceof File || E.originFileObj instanceof Blob) || E.thumbUrl !== void 0 || (E.thumbUrl = "", s?.(E.originFileObj).then((F) => {
1293
+ E.thumbUrl = F || "", w();
1294
+ }));
1295
+ });
1296
+ }, [n, u, s]), b.useEffect(() => {
1297
+ P(!0);
1298
+ }, []);
1299
+ const R = (E, F) => {
1300
+ if (i)
1301
+ return F?.preventDefault(), i(E);
1302
+ }, W = (E) => {
1303
+ typeof a == "function" ? a(E) : E.url && window.open(E.url);
1304
+ }, se = (E) => {
1305
+ r?.(E);
1306
+ }, ee = (E) => {
1307
+ if (l)
1308
+ return l(E, n);
1309
+ const F = E.status === "uploading";
1310
+ if (n.startsWith("picture")) {
1311
+ const q = n === "picture" ? /* @__PURE__ */ b.createElement(Ut, null) : o.uploading, ne = c?.(E) ? /* @__PURE__ */ b.createElement(mi, null) : /* @__PURE__ */ b.createElement(ci, null);
1312
+ return F ? q : ne;
1313
+ }
1314
+ return F ? /* @__PURE__ */ b.createElement(Ut, null) : /* @__PURE__ */ b.createElement(fi, null);
1315
+ }, Oe = (E, F, q, ne, be) => {
1316
+ const ue = {
1317
+ type: "text",
1318
+ size: "small",
1319
+ title: ne,
1320
+ onClick: (de) => {
1321
+ var fe, ie;
1322
+ F(), /* @__PURE__ */ b.isValidElement(E) && ((ie = (fe = E.props).onClick) === null || ie === void 0 || ie.call(fe, de));
1323
+ },
1324
+ className: `${q}-list-item-action`,
1325
+ disabled: be ? N : !1
1326
+ };
1327
+ return /* @__PURE__ */ b.isValidElement(E) ? /* @__PURE__ */ b.createElement(gt, Object.assign({}, ue, {
1328
+ icon: Bt(E, Object.assign(Object.assign({}, E.props), {
1329
+ onClick: () => {
1330
+ }
1331
+ }))
1332
+ })) : /* @__PURE__ */ b.createElement(gt, Object.assign({}, ue), /* @__PURE__ */ b.createElement("span", null, E));
1333
+ };
1334
+ b.useImperativeHandle(e, () => ({
1335
+ handlePreview: R,
1336
+ handleDownload: W
1337
+ }));
1338
+ const {
1339
+ getPrefixCls: Y
1340
+ } = b.useContext(vt), te = Y("upload", d), j = Y(), Te = X(`${te}-list`, `${te}-list-${n}`), ye = b.useMemo(() => us(ds(j), ["onAppearEnd", "onEnterEnd", "onLeaveEnd"]), [j]), ce = Object.assign(Object.assign({}, G ? {} : ye), {
1341
+ motionDeadline: 2e3,
1342
+ motionName: `${te}-${G ? "animate-inline" : "animate"}`,
1343
+ keys: Z(u.map((E) => ({
1344
+ key: E.uid,
1345
+ file: E
1346
+ }))),
1347
+ motionAppear: L
1348
+ });
1349
+ return /* @__PURE__ */ b.createElement("div", {
1350
+ className: Te
1351
+ }, /* @__PURE__ */ b.createElement(fs, Object.assign({}, ce, {
1352
+ component: !1
1353
+ }), ({
1354
+ key: E,
1355
+ file: F,
1356
+ className: q,
1357
+ style: ne
1358
+ }) => /* @__PURE__ */ b.createElement($i, {
1359
+ key: E,
1360
+ locale: o,
1361
+ prefixCls: te,
1362
+ className: q,
1363
+ style: ne,
1364
+ file: F,
1365
+ items: u,
1366
+ progress: k,
1367
+ listType: n,
1368
+ isImgUrl: c,
1369
+ showPreviewIcon: f,
1370
+ showRemoveIcon: h,
1371
+ showDownloadIcon: g,
1372
+ removeIcon: p,
1373
+ previewIcon: m,
1374
+ downloadIcon: v,
1375
+ extra: S,
1376
+ iconRender: ee,
1377
+ actionIconRender: Oe,
1378
+ itemRender: I,
1379
+ onPreview: R,
1380
+ onDownload: W,
1381
+ onClose: se
1382
+ })), $ && /* @__PURE__ */ b.createElement(yn, Object.assign({}, ce, {
1383
+ visible: y,
1384
+ forceRender: !0
1385
+ }), ({
1386
+ className: E,
1387
+ style: F
1388
+ }) => Bt($, (q) => ({
1389
+ className: X(q.className, E),
1390
+ style: Object.assign(Object.assign(Object.assign({}, F), {
1391
+ // prevent the element has hover css pseudo-class that may cause animation to end prematurely.
1392
+ pointerEvents: E ? "none" : void 0
1393
+ }), q.style)
1394
+ }))));
1395
+ }, Ni = /* @__PURE__ */ b.forwardRef(Ii);
1396
+ var Ei = function(t, e, n, s) {
1397
+ function i(a) {
1398
+ return a instanceof n ? a : new n(function(r) {
1399
+ r(a);
1400
+ });
1401
+ }
1402
+ return new (n || (n = Promise))(function(a, r) {
1403
+ function o(d) {
1404
+ try {
1405
+ c(s.next(d));
1406
+ } catch (u) {
1407
+ r(u);
1408
+ }
1409
+ }
1410
+ function l(d) {
1411
+ try {
1412
+ c(s.throw(d));
1413
+ } catch (u) {
1414
+ r(u);
1415
+ }
1416
+ }
1417
+ function c(d) {
1418
+ d.done ? a(d.value) : i(d.value).then(o, l);
1419
+ }
1420
+ c((s = s.apply(t, [])).next());
1421
+ });
1422
+ };
1423
+ const De = `__LIST_IGNORE_${Date.now()}__`, Ci = (t, e) => {
1424
+ const n = ps("upload"), {
1425
+ fileList: s,
1426
+ defaultFileList: i,
1427
+ onRemove: a,
1428
+ showUploadList: r = !0,
1429
+ listType: o = "text",
1430
+ onPreview: l,
1431
+ onDownload: c,
1432
+ onChange: d,
1433
+ onDrop: u,
1434
+ previewFile: f,
1435
+ disabled: h,
1436
+ locale: g,
1437
+ iconRender: p,
1438
+ isImageUrl: m,
1439
+ progress: v,
1440
+ prefixCls: S,
1441
+ className: k,
1442
+ type: $ = "select",
1443
+ children: y,
1444
+ style: I,
1445
+ itemRender: N,
1446
+ maxCount: w,
1447
+ data: L = {},
1448
+ multiple: P = !1,
1449
+ hasControlInside: G = !0,
1450
+ action: R = "",
1451
+ accept: W = "",
1452
+ supportServerRender: se = !0,
1453
+ rootClassName: ee
1454
+ } = t, Oe = b.useContext(hs), Y = h ?? Oe, te = t.customRequest || n.customRequest, [j, Te] = ms(i || [], {
1455
+ value: s,
1456
+ postState: (C) => C ?? []
1457
+ }), [ye, ce] = b.useState("drop"), E = b.useRef(null), F = b.useRef(null);
1458
+ b.useMemo(() => {
1459
+ const C = Date.now();
1460
+ (s || []).forEach((T, D) => {
1461
+ !T.uid && !Object.isFrozen(T) && (T.uid = `__AUTO__${C}_${D}__`);
1462
+ });
1463
+ }, [s]);
1464
+ const q = (C, T, D) => {
1465
+ let O = Z(T), A = !1;
1466
+ w === 1 ? O = O.slice(-1) : w && (A = O.length > w, O = O.slice(0, w)), qt.flushSync(() => {
1467
+ Te(O);
1468
+ });
1469
+ const z = {
1470
+ file: C,
1471
+ fileList: O
1472
+ };
1473
+ D && (z.event = D), (!A || C.status === "removed" || // We should ignore event if current file is exceed `maxCount`
1474
+ O.some((pe) => pe.uid === C.uid)) && qt.flushSync(() => {
1475
+ d?.(z);
1476
+ });
1477
+ }, ne = (C, T) => Ei(void 0, void 0, void 0, function* () {
1478
+ const {
1479
+ beforeUpload: D,
1480
+ transformFile: O
1481
+ } = t;
1482
+ let A = C;
1483
+ if (D) {
1484
+ const z = yield D(C, T);
1485
+ if (z === !1)
1486
+ return !1;
1487
+ if (delete C[De], z === De)
1488
+ return Object.defineProperty(C, De, {
1489
+ value: !0,
1490
+ configurable: !0
1491
+ }), !1;
1492
+ typeof z == "object" && z && (A = z);
1493
+ }
1494
+ return O && (A = yield O(A)), A;
1495
+ }), be = (C) => {
1496
+ const T = C.filter((A) => !A.file[De]);
1497
+ if (!T.length)
1498
+ return;
1499
+ const D = T.map((A) => ze(A.file));
1500
+ let O = Z(j);
1501
+ D.forEach((A) => {
1502
+ O = Xe(A, O);
1503
+ }), D.forEach((A, z) => {
1504
+ let pe = A;
1505
+ if (T[z].parsedFile)
1506
+ A.status = "uploading";
1507
+ else {
1508
+ const {
1509
+ originFileObj: ve
1510
+ } = A;
1511
+ let he;
1512
+ try {
1513
+ he = new File([ve], ve.name, {
1514
+ type: ve.type
1515
+ });
1516
+ } catch {
1517
+ he = new Blob([ve], {
1518
+ type: ve.type
1519
+ }), he.name = ve.name, he.lastModifiedDate = /* @__PURE__ */ new Date(), he.lastModified = (/* @__PURE__ */ new Date()).getTime();
1520
+ }
1521
+ he.uid = A.uid, pe = he;
1522
+ }
1523
+ q(pe, O);
1524
+ });
1525
+ }, ue = (C, T, D) => {
1526
+ try {
1527
+ typeof C == "string" && (C = JSON.parse(C));
1528
+ } catch {
1529
+ }
1530
+ if (!ut(T, j))
1531
+ return;
1532
+ const O = ze(T);
1533
+ O.status = "done", O.percent = 100, O.response = C, O.xhr = D;
1534
+ const A = Xe(O, j);
1535
+ q(O, A);
1536
+ }, de = (C, T) => {
1537
+ if (!ut(T, j))
1538
+ return;
1539
+ const D = ze(T);
1540
+ D.status = "uploading", D.percent = C.percent;
1541
+ const O = Xe(D, j);
1542
+ q(D, O, C);
1543
+ }, fe = (C, T, D) => {
1544
+ if (!ut(D, j))
1545
+ return;
1546
+ const O = ze(D);
1547
+ O.error = C, O.response = T, O.status = "error";
1548
+ const A = Xe(O, j);
1549
+ q(O, A);
1550
+ }, ie = (C) => {
1551
+ let T;
1552
+ Promise.resolve(typeof a == "function" ? a(C) : a).then((D) => {
1553
+ var O;
1554
+ if (D === !1)
1555
+ return;
1556
+ const A = gi(C, j);
1557
+ A && (T = Object.assign(Object.assign({}, C), {
1558
+ status: "removed"
1559
+ }), j?.forEach((z) => {
1560
+ const pe = T.uid !== void 0 ? "uid" : "name";
1561
+ z[pe] === T[pe] && !Object.isFrozen(z) && (z.status = "removed");
1562
+ }), (O = E.current) === null || O === void 0 || O.abort(T), q(T, A));
1563
+ });
1564
+ }, B = (C) => {
1565
+ ce(C.type), C.type === "drop" && u?.(C);
1566
+ };
1567
+ b.useImperativeHandle(e, () => ({
1568
+ onBatchStart: be,
1569
+ onSuccess: ue,
1570
+ onProgress: de,
1571
+ onError: fe,
1572
+ fileList: j,
1573
+ upload: E.current,
1574
+ nativeElement: F.current
1575
+ }));
1576
+ const {
1577
+ getPrefixCls: Le,
1578
+ direction: qe,
1579
+ upload: we
1580
+ } = b.useContext(vt), U = Le("upload", S), Ae = Object.assign(Object.assign({
1581
+ onBatchStart: be,
1582
+ onError: fe,
1583
+ onProgress: de,
1584
+ onSuccess: ue
1585
+ }, t), {
1586
+ customRequest: te,
1587
+ data: L,
1588
+ multiple: P,
1589
+ action: R,
1590
+ accept: W,
1591
+ supportServerRender: se,
1592
+ prefixCls: U,
1593
+ disabled: Y,
1594
+ beforeUpload: ne,
1595
+ onChange: void 0,
1596
+ hasControlInside: G
1597
+ });
1598
+ delete Ae.className, delete Ae.style, (!y || Y) && delete Ae.id;
1599
+ const Dt = `${U}-wrapper`, [it, Pt, Kn] = ri(U, Dt), [Hn] = gs("Upload", ys.Upload), {
1600
+ showRemoveIcon: Ft,
1601
+ showPreviewIcon: zn,
1602
+ showDownloadIcon: Xn,
1603
+ removeIcon: Vn,
1604
+ previewIcon: Gn,
1605
+ downloadIcon: Wn,
1606
+ extra: Yn
1607
+ } = typeof r == "boolean" ? {} : r, Jn = typeof Ft > "u" ? !Y : Ft, at = (C, T) => r ? /* @__PURE__ */ b.createElement(Ni, {
1608
+ prefixCls: U,
1609
+ listType: o,
1610
+ items: j,
1611
+ previewFile: f,
1612
+ onPreview: l,
1613
+ onDownload: c,
1614
+ onRemove: ie,
1615
+ showRemoveIcon: Jn,
1616
+ showPreviewIcon: zn,
1617
+ showDownloadIcon: Xn,
1618
+ removeIcon: Vn,
1619
+ previewIcon: Gn,
1620
+ downloadIcon: Wn,
1621
+ iconRender: p,
1622
+ extra: Yn,
1623
+ locale: Object.assign(Object.assign({}, Hn), g),
1624
+ isImageUrl: m,
1625
+ progress: v,
1626
+ appendAction: C,
1627
+ appendActionVisible: T,
1628
+ itemRender: N,
1629
+ disabled: Y
1630
+ }) : C, rt = X(Dt, k, ee, Pt, Kn, we?.className, {
1631
+ [`${U}-rtl`]: qe === "rtl",
1632
+ [`${U}-picture-card-wrapper`]: o === "picture-card",
1633
+ [`${U}-picture-circle-wrapper`]: o === "picture-circle"
1634
+ }), Rt = Object.assign(Object.assign({}, we?.style), I);
1635
+ if ($ === "drag") {
1636
+ const C = X(Pt, U, `${U}-drag`, {
1637
+ [`${U}-drag-uploading`]: j.some((T) => T.status === "uploading"),
1638
+ [`${U}-drag-hover`]: ye === "dragover",
1639
+ [`${U}-disabled`]: Y,
1640
+ [`${U}-rtl`]: qe === "rtl"
1641
+ });
1642
+ return it(/* @__PURE__ */ b.createElement("span", {
1643
+ className: rt,
1644
+ ref: F
1645
+ }, /* @__PURE__ */ b.createElement("div", {
1646
+ className: C,
1647
+ style: Rt,
1648
+ onDrop: B,
1649
+ onDragOver: B,
1650
+ onDragLeave: B
1651
+ }, /* @__PURE__ */ b.createElement(yt, Object.assign({}, Ae, {
1652
+ ref: E,
1653
+ className: `${U}-btn`
1654
+ }), /* @__PURE__ */ b.createElement("div", {
1655
+ className: `${U}-drag-container`
1656
+ }, y))), at()));
1657
+ }
1658
+ const Qn = X(U, `${U}-select`, {
1659
+ [`${U}-disabled`]: Y,
1660
+ [`${U}-hidden`]: !y
1661
+ }), jt = /* @__PURE__ */ b.createElement("div", {
1662
+ className: Qn,
1663
+ style: Rt
1664
+ }, /* @__PURE__ */ b.createElement(yt, Object.assign({}, Ae, {
1665
+ ref: E
1666
+ })));
1667
+ return it(o === "picture-card" || o === "picture-circle" ? /* @__PURE__ */ b.createElement("span", {
1668
+ className: rt,
1669
+ ref: F
1670
+ }, at(jt, !!y)) : /* @__PURE__ */ b.createElement("span", {
1671
+ className: rt,
1672
+ ref: F
1673
+ }, jt, at()));
1674
+ }, Sn = /* @__PURE__ */ b.forwardRef(Ci);
1675
+ var Oi = function(t, e) {
1676
+ var n = {};
1677
+ for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
1678
+ if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, s = Object.getOwnPropertySymbols(t); i < s.length; i++)
1679
+ e.indexOf(s[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[i]) && (n[s[i]] = t[s[i]]);
1680
+ return n;
1681
+ };
1682
+ const Ti = /* @__PURE__ */ b.forwardRef((t, e) => {
1683
+ const {
1684
+ style: n,
1685
+ height: s,
1686
+ hasControlInside: i = !1,
1687
+ children: a
1688
+ } = t, r = Oi(t, ["style", "height", "hasControlInside", "children"]), o = Object.assign(Object.assign({}, n), {
1689
+ height: s
1690
+ });
1691
+ return /* @__PURE__ */ b.createElement(Sn, Object.assign({
1692
+ ref: e,
1693
+ hasControlInside: i
1694
+ }, r, {
1695
+ style: o,
1696
+ type: "drag"
1697
+ }), a);
1698
+ }), $n = Sn;
1699
+ $n.Dragger = Ti;
1700
+ $n.LIST_IGNORE = De;
1701
+ var Ve = {}, Zt;
1702
+ function Li() {
1703
+ if (Zt) return Ve;
1704
+ Zt = 1, Object.defineProperty(Ve, "__esModule", { value: !0 });
1705
+ var t = { icon: { tag: "svg", attrs: { "fill-rule": "evenodd", viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, name: "close", theme: "outlined" };
1706
+ return Ve.default = t, Ve;
1707
+ }
1708
+ var Ai = /* @__PURE__ */ Li();
1709
+ const _i = /* @__PURE__ */ bs(Ai);
1710
+ function bt() {
1711
+ return bt = Object.assign ? Object.assign.bind() : function(t) {
1712
+ for (var e = 1; e < arguments.length; e++) {
1713
+ var n = arguments[e];
1714
+ for (var s in n)
1715
+ Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
1716
+ }
1717
+ return t;
1718
+ }, bt.apply(this, arguments);
1719
+ }
1720
+ const Di = (t, e) => /* @__PURE__ */ b.createElement(ws, bt({}, t, {
1721
+ ref: e,
1722
+ icon: _i
1723
+ })), Ia = /* @__PURE__ */ b.forwardRef(Di), Ee = {
1724
+ collection: "map",
1725
+ default: !0,
1726
+ nodeClass: Ie,
1727
+ tag: "tag:yaml.org,2002:map",
1728
+ resolve(t, e) {
1729
+ return vs(t) || e("Expected a mapping for this tag"), t;
1730
+ },
1731
+ createNode: (t, e, n) => Ie.from(t, e, n)
1732
+ }, Ce = {
1733
+ collection: "seq",
1734
+ default: !0,
1735
+ nodeClass: Fe,
1736
+ tag: "tag:yaml.org,2002:seq",
1737
+ resolve(t, e) {
1738
+ return ks(t) || e("Expected a sequence for this tag"), t;
1739
+ },
1740
+ createNode: (t, e, n) => Fe.from(t, e, n)
1741
+ }, Ze = {
1742
+ identify: (t) => typeof t == "string",
1743
+ default: !0,
1744
+ tag: "tag:yaml.org,2002:str",
1745
+ resolve: (t) => t,
1746
+ stringify(t, e, n, s) {
1747
+ return e = Object.assign({ actualString: !0 }, e), bn(t, e, n, s);
1748
+ }
1749
+ }, et = {
1750
+ identify: (t) => t == null,
1751
+ createNode: () => new x(null),
1752
+ default: !0,
1753
+ tag: "tag:yaml.org,2002:null",
1754
+ test: /^(?:~|[Nn]ull|NULL)?$/,
1755
+ resolve: () => new x(null),
1756
+ stringify: ({ source: t }, e) => typeof t == "string" && et.test.test(t) ? t : e.options.nullStr
1757
+ }, Et = {
1758
+ identify: (t) => typeof t == "boolean",
1759
+ default: !0,
1760
+ tag: "tag:yaml.org,2002:bool",
1761
+ test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
1762
+ resolve: (t) => new x(t[0] === "t" || t[0] === "T"),
1763
+ stringify({ source: t, value: e }, n) {
1764
+ if (t && Et.test.test(t)) {
1765
+ const s = t[0] === "t" || t[0] === "T";
1766
+ if (e === s)
1767
+ return t;
1768
+ }
1769
+ return e ? n.options.trueStr : n.options.falseStr;
1770
+ }
1771
+ };
1772
+ function J({ format: t, minFractionDigits: e, tag: n, value: s }) {
1773
+ if (typeof s == "bigint")
1774
+ return String(s);
1775
+ const i = typeof s == "number" ? s : Number(s);
1776
+ if (!isFinite(i))
1777
+ return isNaN(i) ? ".nan" : i < 0 ? "-.inf" : ".inf";
1778
+ let a = Object.is(s, -0) ? "-0" : JSON.stringify(s);
1779
+ if (!t && e && (!n || n === "tag:yaml.org,2002:float") && /^-?\d/.test(a) && !a.includes("e")) {
1780
+ let r = a.indexOf(".");
1781
+ r < 0 && (r = a.length, a += ".");
1782
+ let o = e - (a.length - r - 1);
1783
+ for (; o-- > 0; )
1784
+ a += "0";
1785
+ }
1786
+ return a;
1787
+ }
1788
+ const In = {
1789
+ identify: (t) => typeof t == "number",
1790
+ default: !0,
1791
+ tag: "tag:yaml.org,2002:float",
1792
+ test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
1793
+ resolve: (t) => t.slice(-3).toLowerCase() === "nan" ? NaN : t[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1794
+ stringify: J
1795
+ }, Nn = {
1796
+ identify: (t) => typeof t == "number",
1797
+ default: !0,
1798
+ tag: "tag:yaml.org,2002:float",
1799
+ format: "EXP",
1800
+ test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
1801
+ resolve: (t) => parseFloat(t),
1802
+ stringify(t) {
1803
+ const e = Number(t.value);
1804
+ return isFinite(e) ? e.toExponential() : J(t);
1805
+ }
1806
+ }, En = {
1807
+ identify: (t) => typeof t == "number",
1808
+ default: !0,
1809
+ tag: "tag:yaml.org,2002:float",
1810
+ test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
1811
+ resolve(t) {
1812
+ const e = new x(parseFloat(t)), n = t.indexOf(".");
1813
+ return n !== -1 && t[t.length - 1] === "0" && (e.minFractionDigits = t.length - n - 1), e;
1814
+ },
1815
+ stringify: J
1816
+ }, tt = (t) => typeof t == "bigint" || Number.isInteger(t), Ct = (t, e, n, { intAsBigInt: s }) => s ? BigInt(t) : parseInt(t.substring(e), n);
1817
+ function Cn(t, e, n) {
1818
+ const { value: s } = t;
1819
+ return tt(s) && s >= 0 ? n + s.toString(e) : J(t);
1820
+ }
1821
+ const On = {
1822
+ identify: (t) => tt(t) && t >= 0,
1823
+ default: !0,
1824
+ tag: "tag:yaml.org,2002:int",
1825
+ format: "OCT",
1826
+ test: /^0o[0-7]+$/,
1827
+ resolve: (t, e, n) => Ct(t, 2, 8, n),
1828
+ stringify: (t) => Cn(t, 8, "0o")
1829
+ }, Tn = {
1830
+ identify: tt,
1831
+ default: !0,
1832
+ tag: "tag:yaml.org,2002:int",
1833
+ test: /^[-+]?[0-9]+$/,
1834
+ resolve: (t, e, n) => Ct(t, 0, 10, n),
1835
+ stringify: J
1836
+ }, Ln = {
1837
+ identify: (t) => tt(t) && t >= 0,
1838
+ default: !0,
1839
+ tag: "tag:yaml.org,2002:int",
1840
+ format: "HEX",
1841
+ test: /^0x[0-9a-fA-F]+$/,
1842
+ resolve: (t, e, n) => Ct(t, 2, 16, n),
1843
+ stringify: (t) => Cn(t, 16, "0x")
1844
+ }, Pi = [
1845
+ Ee,
1846
+ Ce,
1847
+ Ze,
1848
+ et,
1849
+ Et,
1850
+ On,
1851
+ Tn,
1852
+ Ln,
1853
+ In,
1854
+ Nn,
1855
+ En
1856
+ ];
1857
+ function en(t) {
1858
+ return typeof t == "bigint" || Number.isInteger(t);
1859
+ }
1860
+ const Ge = ({ value: t }) => JSON.stringify(t), Fi = [
1861
+ {
1862
+ identify: (t) => typeof t == "string",
1863
+ default: !0,
1864
+ tag: "tag:yaml.org,2002:str",
1865
+ resolve: (t) => t,
1866
+ stringify: Ge
1867
+ },
1868
+ {
1869
+ identify: (t) => t == null,
1870
+ createNode: () => new x(null),
1871
+ default: !0,
1872
+ tag: "tag:yaml.org,2002:null",
1873
+ test: /^null$/,
1874
+ resolve: () => null,
1875
+ stringify: Ge
1876
+ },
1877
+ {
1878
+ identify: (t) => typeof t == "boolean",
1879
+ default: !0,
1880
+ tag: "tag:yaml.org,2002:bool",
1881
+ test: /^true$|^false$/,
1882
+ resolve: (t) => t === "true",
1883
+ stringify: Ge
1884
+ },
1885
+ {
1886
+ identify: en,
1887
+ default: !0,
1888
+ tag: "tag:yaml.org,2002:int",
1889
+ test: /^-?(?:0|[1-9][0-9]*)$/,
1890
+ resolve: (t, e, { intAsBigInt: n }) => n ? BigInt(t) : parseInt(t, 10),
1891
+ stringify: ({ value: t }) => en(t) ? t.toString() : JSON.stringify(t)
1892
+ },
1893
+ {
1894
+ identify: (t) => typeof t == "number",
1895
+ default: !0,
1896
+ tag: "tag:yaml.org,2002:float",
1897
+ test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
1898
+ resolve: (t) => parseFloat(t),
1899
+ stringify: Ge
1900
+ }
1901
+ ], Ri = {
1902
+ default: !0,
1903
+ tag: "",
1904
+ test: /^/,
1905
+ resolve(t, e) {
1906
+ return e(`Unresolved plain scalar ${JSON.stringify(t)}`), t;
1907
+ }
1908
+ }, ji = [Ee, Ce].concat(Fi, Ri), Ot = {
1909
+ identify: (t) => t instanceof Uint8Array,
1910
+ // Buffer inherits from Uint8Array
1911
+ default: !1,
1912
+ tag: "tag:yaml.org,2002:binary",
1913
+ /**
1914
+ * Returns a Buffer in node and an Uint8Array in browsers
1915
+ *
1916
+ * To use the resulting buffer as an image, you'll want to do something like:
1917
+ *
1918
+ * const blob = new Blob([buffer], { type: 'image/jpeg' })
1919
+ * document.querySelector('#photo').src = URL.createObjectURL(blob)
1920
+ */
1921
+ resolve(t, e) {
1922
+ if (typeof atob == "function") {
1923
+ const n = atob(t.replace(/[\n\r]/g, "")), s = new Uint8Array(n.length);
1924
+ for (let i = 0; i < n.length; ++i)
1925
+ s[i] = n.charCodeAt(i);
1926
+ return s;
1927
+ } else
1928
+ return e("This environment does not support reading binary tags; either Buffer or atob is required"), t;
1929
+ },
1930
+ stringify({ comment: t, type: e, value: n }, s, i, a) {
1931
+ if (!n)
1932
+ return "";
1933
+ const r = n;
1934
+ let o;
1935
+ if (typeof btoa == "function") {
1936
+ let l = "";
1937
+ for (let c = 0; c < r.length; ++c)
1938
+ l += String.fromCharCode(r[c]);
1939
+ o = btoa(l);
1940
+ } else
1941
+ throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
1942
+ if (e ?? (e = x.BLOCK_LITERAL), e !== x.QUOTE_DOUBLE) {
1943
+ const l = Math.max(s.options.lineWidth - s.indent.length, s.options.minContentWidth), c = Math.ceil(o.length / l), d = new Array(c);
1944
+ for (let u = 0, f = 0; u < c; ++u, f += l)
1945
+ d[u] = o.substr(f, l);
1946
+ o = d.join(e === x.BLOCK_LITERAL ? `
1947
+ ` : " ");
1948
+ }
1949
+ return bn({ comment: t, type: e, value: o }, s, i, a);
1950
+ }
1951
+ };
1952
+ function An({ value: t, source: e }, n) {
1953
+ return e && (t ? _n : Dn).test.test(e) ? e : t ? n.options.trueStr : n.options.falseStr;
1954
+ }
1955
+ const _n = {
1956
+ identify: (t) => t === !0,
1957
+ default: !0,
1958
+ tag: "tag:yaml.org,2002:bool",
1959
+ test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
1960
+ resolve: () => new x(!0),
1961
+ stringify: An
1962
+ }, Dn = {
1963
+ identify: (t) => t === !1,
1964
+ default: !0,
1965
+ tag: "tag:yaml.org,2002:bool",
1966
+ test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
1967
+ resolve: () => new x(!1),
1968
+ stringify: An
1969
+ }, Mi = {
1970
+ identify: (t) => typeof t == "number",
1971
+ default: !0,
1972
+ tag: "tag:yaml.org,2002:float",
1973
+ test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
1974
+ resolve: (t) => t.slice(-3).toLowerCase() === "nan" ? NaN : t[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
1975
+ stringify: J
1976
+ }, xi = {
1977
+ identify: (t) => typeof t == "number",
1978
+ default: !0,
1979
+ tag: "tag:yaml.org,2002:float",
1980
+ format: "EXP",
1981
+ test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
1982
+ resolve: (t) => parseFloat(t.replace(/_/g, "")),
1983
+ stringify(t) {
1984
+ const e = Number(t.value);
1985
+ return isFinite(e) ? e.toExponential() : J(t);
1986
+ }
1987
+ }, Bi = {
1988
+ identify: (t) => typeof t == "number",
1989
+ default: !0,
1990
+ tag: "tag:yaml.org,2002:float",
1991
+ test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
1992
+ resolve(t) {
1993
+ const e = new x(parseFloat(t.replace(/_/g, ""))), n = t.indexOf(".");
1994
+ if (n !== -1) {
1995
+ const s = t.substring(n + 1).replace(/_/g, "");
1996
+ s[s.length - 1] === "0" && (e.minFractionDigits = s.length);
1997
+ }
1998
+ return e;
1999
+ },
2000
+ stringify: J
2001
+ }, xe = (t) => typeof t == "bigint" || Number.isInteger(t);
2002
+ function nt(t, e, n, { intAsBigInt: s }) {
2003
+ const i = t[0];
2004
+ if ((i === "-" || i === "+") && (e += 1), t = t.substring(e).replace(/_/g, ""), s) {
2005
+ switch (n) {
2006
+ case 2:
2007
+ t = `0b${t}`;
2008
+ break;
2009
+ case 8:
2010
+ t = `0o${t}`;
2011
+ break;
2012
+ case 16:
2013
+ t = `0x${t}`;
2014
+ break;
2015
+ }
2016
+ const r = BigInt(t);
2017
+ return i === "-" ? BigInt(-1) * r : r;
2018
+ }
2019
+ const a = parseInt(t, n);
2020
+ return i === "-" ? -1 * a : a;
2021
+ }
2022
+ function Tt(t, e, n) {
2023
+ const { value: s } = t;
2024
+ if (xe(s)) {
2025
+ const i = s.toString(e);
2026
+ return s < 0 ? "-" + n + i.substr(1) : n + i;
2027
+ }
2028
+ return J(t);
2029
+ }
2030
+ const Ui = {
2031
+ identify: xe,
2032
+ default: !0,
2033
+ tag: "tag:yaml.org,2002:int",
2034
+ format: "BIN",
2035
+ test: /^[-+]?0b[0-1_]+$/,
2036
+ resolve: (t, e, n) => nt(t, 2, 2, n),
2037
+ stringify: (t) => Tt(t, 2, "0b")
2038
+ }, qi = {
2039
+ identify: xe,
2040
+ default: !0,
2041
+ tag: "tag:yaml.org,2002:int",
2042
+ format: "OCT",
2043
+ test: /^[-+]?0[0-7_]+$/,
2044
+ resolve: (t, e, n) => nt(t, 1, 8, n),
2045
+ stringify: (t) => Tt(t, 8, "0")
2046
+ }, Ki = {
2047
+ identify: xe,
2048
+ default: !0,
2049
+ tag: "tag:yaml.org,2002:int",
2050
+ test: /^[-+]?[0-9][0-9_]*$/,
2051
+ resolve: (t, e, n) => nt(t, 0, 10, n),
2052
+ stringify: J
2053
+ }, Hi = {
2054
+ identify: xe,
2055
+ default: !0,
2056
+ tag: "tag:yaml.org,2002:int",
2057
+ format: "HEX",
2058
+ test: /^[-+]?0x[0-9a-fA-F_]+$/,
2059
+ resolve: (t, e, n) => nt(t, 2, 16, n),
2060
+ stringify: (t) => Tt(t, 16, "0x")
2061
+ };
2062
+ function Lt(t, e) {
2063
+ const n = t[0], s = n === "-" || n === "+" ? t.substring(1) : t, i = (r) => e ? BigInt(r) : Number(r), a = s.replace(/_/g, "").split(":").reduce((r, o) => r * i(60) + i(o), i(0));
2064
+ return n === "-" ? i(-1) * a : a;
2065
+ }
2066
+ function Pn(t) {
2067
+ let { value: e } = t, n = (r) => r;
2068
+ if (typeof e == "bigint")
2069
+ n = (r) => BigInt(r);
2070
+ else if (isNaN(e) || !isFinite(e))
2071
+ return J(t);
2072
+ let s = "";
2073
+ e < 0 && (s = "-", e *= n(-1));
2074
+ const i = n(60), a = [e % i];
2075
+ return e < 60 ? a.unshift(0) : (e = (e - a[0]) / i, a.unshift(e % i), e >= 60 && (e = (e - a[0]) / i, a.unshift(e))), s + a.map((r) => String(r).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
2076
+ }
2077
+ const Fn = {
2078
+ identify: (t) => typeof t == "bigint" || Number.isInteger(t),
2079
+ default: !0,
2080
+ tag: "tag:yaml.org,2002:int",
2081
+ format: "TIME",
2082
+ test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
2083
+ resolve: (t, e, { intAsBigInt: n }) => Lt(t, n),
2084
+ stringify: Pn
2085
+ }, Rn = {
2086
+ identify: (t) => typeof t == "number",
2087
+ default: !0,
2088
+ tag: "tag:yaml.org,2002:float",
2089
+ format: "TIME",
2090
+ test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
2091
+ resolve: (t) => Lt(t, !1),
2092
+ stringify: Pn
2093
+ }, st = {
2094
+ identify: (t) => t instanceof Date,
2095
+ default: !0,
2096
+ tag: "tag:yaml.org,2002:timestamp",
2097
+ // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
2098
+ // may be omitted altogether, resulting in a date format. In such a case, the time part is
2099
+ // assumed to be 00:00:00Z (start of day, UTC).
2100
+ test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
2101
+ resolve(t) {
2102
+ const e = t.match(st.test);
2103
+ if (!e)
2104
+ throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
2105
+ const [, n, s, i, a, r, o] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
2106
+ let c = Date.UTC(n, s - 1, i, a || 0, r || 0, o || 0, l);
2107
+ const d = e[8];
2108
+ if (d && d !== "Z") {
2109
+ let u = Lt(d, !1);
2110
+ Math.abs(u) < 30 && (u *= 60), c -= 6e4 * u;
2111
+ }
2112
+ return new Date(c);
2113
+ },
2114
+ stringify: ({ value: t }) => t?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
2115
+ }, tn = [
2116
+ Ee,
2117
+ Ce,
2118
+ Ze,
2119
+ et,
2120
+ _n,
2121
+ Dn,
2122
+ Ui,
2123
+ qi,
2124
+ Ki,
2125
+ Hi,
2126
+ Mi,
2127
+ xi,
2128
+ Bi,
2129
+ Ot,
2130
+ $e,
2131
+ kt,
2132
+ St,
2133
+ $t,
2134
+ Fn,
2135
+ Rn,
2136
+ st
2137
+ ], nn = /* @__PURE__ */ new Map([
2138
+ ["core", Pi],
2139
+ ["failsafe", [Ee, Ce, Ze]],
2140
+ ["json", ji],
2141
+ ["yaml11", tn],
2142
+ ["yaml-1.1", tn]
2143
+ ]), sn = {
2144
+ binary: Ot,
2145
+ bool: Et,
2146
+ float: En,
2147
+ floatExp: Nn,
2148
+ floatNaN: In,
2149
+ floatTime: Rn,
2150
+ int: Tn,
2151
+ intHex: Ln,
2152
+ intOct: On,
2153
+ intTime: Fn,
2154
+ map: Ee,
2155
+ merge: $e,
2156
+ null: et,
2157
+ omap: kt,
2158
+ pairs: St,
2159
+ seq: Ce,
2160
+ set: $t,
2161
+ timestamp: st
2162
+ }, zi = {
2163
+ "tag:yaml.org,2002:binary": Ot,
2164
+ "tag:yaml.org,2002:merge": $e,
2165
+ "tag:yaml.org,2002:omap": kt,
2166
+ "tag:yaml.org,2002:pairs": St,
2167
+ "tag:yaml.org,2002:set": $t,
2168
+ "tag:yaml.org,2002:timestamp": st
2169
+ };
2170
+ function dt(t, e, n) {
2171
+ const s = nn.get(e);
2172
+ if (s && !t)
2173
+ return n && !s.includes($e) ? s.concat($e) : s.slice();
2174
+ let i = s;
2175
+ if (!i)
2176
+ if (Array.isArray(t))
2177
+ i = [];
2178
+ else {
2179
+ const a = Array.from(nn.keys()).filter((r) => r !== "yaml11").map((r) => JSON.stringify(r)).join(", ");
2180
+ throw new Error(`Unknown schema "${e}"; use one of ${a} or define customTags array`);
2181
+ }
2182
+ if (Array.isArray(t))
2183
+ for (const a of t)
2184
+ i = i.concat(a);
2185
+ else typeof t == "function" && (i = t(i.slice()));
2186
+ return n && (i = i.concat($e)), i.reduce((a, r) => {
2187
+ const o = typeof r == "string" ? sn[r] : r;
2188
+ if (!o) {
2189
+ const l = JSON.stringify(r), c = Object.keys(sn).map((d) => JSON.stringify(d)).join(", ");
2190
+ throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
2191
+ }
2192
+ return a.includes(o) || a.push(o), a;
2193
+ }, []);
2194
+ }
2195
+ const Xi = (t, e) => t.key < e.key ? -1 : t.key > e.key ? 1 : 0;
2196
+ class At {
2197
+ constructor({ compat: e, customTags: n, merge: s, resolveKnownTags: i, schema: a, sortMapEntries: r, toStringDefaults: o }) {
2198
+ this.compat = Array.isArray(e) ? dt(e, "compat") : e ? dt(null, e) : null, this.name = typeof a == "string" && a || "core", this.knownTags = i ? zi : {}, this.tags = dt(n, this.name, s), this.toStringOptions = o ?? null, Object.defineProperty(this, Ss, { value: Ee }), Object.defineProperty(this, ge, { value: Ze }), Object.defineProperty(this, $s, { value: Ce }), this.sortMapEntries = typeof r == "function" ? r : r === !0 ? Xi : null;
2199
+ }
2200
+ clone() {
2201
+ const e = Object.create(At.prototype, Object.getOwnPropertyDescriptors(this));
2202
+ return e.tags = this.tags.slice(), e;
2203
+ }
2204
+ }
2205
+ function Vi(t, e) {
2206
+ const n = [];
2207
+ let s = e.directives === !0;
2208
+ if (e.directives !== !1 && t.directives) {
2209
+ const l = t.directives.toString(t);
2210
+ l ? (n.push(l), s = !0) : t.directives.docStart && (s = !0);
2211
+ }
2212
+ s && n.push("---");
2213
+ const i = Is(t, e), { commentString: a } = i.options;
2214
+ if (t.commentBefore) {
2215
+ n.length !== 1 && n.unshift("");
2216
+ const l = a(t.commentBefore);
2217
+ n.unshift(Ke(l, ""));
2218
+ }
2219
+ let r = !1, o = null;
2220
+ if (t.contents) {
2221
+ if (It(t.contents)) {
2222
+ if (t.contents.spaceBefore && s && n.push(""), t.contents.commentBefore) {
2223
+ const d = a(t.contents.commentBefore);
2224
+ n.push(Ke(d, ""));
2225
+ }
2226
+ i.forceBlockIndent = !!t.comment, o = t.contents.comment;
2227
+ }
2228
+ const l = o ? void 0 : () => r = !0;
2229
+ let c = Kt(t.contents, i, () => o = null, l);
2230
+ o && (c += Ns(c, "", a(o))), (c[0] === "|" || c[0] === ">") && n[n.length - 1] === "---" ? n[n.length - 1] = `--- ${c}` : n.push(c);
2231
+ } else
2232
+ n.push(Kt(t.contents, i));
2233
+ if (t.directives?.docEnd)
2234
+ if (t.comment) {
2235
+ const l = a(t.comment);
2236
+ l.includes(`
2237
+ `) ? (n.push("..."), n.push(Ke(l, ""))) : n.push(`... ${l}`);
2238
+ } else
2239
+ n.push("...");
2240
+ else {
2241
+ let l = t.comment;
2242
+ l && r && (l = l.replace(/^\n+/, "")), l && ((!r || o) && n[n.length - 1] !== "" && n.push(""), n.push(Ke(a(l), "")));
2243
+ }
2244
+ return n.join(`
2245
+ `) + `
2246
+ `;
2247
+ }
2248
+ class Be {
2249
+ constructor(e, n, s) {
2250
+ this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, Ht, { value: zt });
2251
+ let i = null;
2252
+ typeof n == "function" || Array.isArray(n) ? i = n : s === void 0 && n && (s = n, n = void 0);
2253
+ const a = Object.assign({
2254
+ intAsBigInt: !1,
2255
+ keepSourceTokens: !1,
2256
+ logLevel: "warn",
2257
+ prettyErrors: !0,
2258
+ strict: !0,
2259
+ stringKeys: !1,
2260
+ uniqueKeys: !0,
2261
+ version: "1.2"
2262
+ }, s);
2263
+ this.options = a;
2264
+ let { version: r } = a;
2265
+ s?._directives ? (this.directives = s._directives.atDocument(), this.directives.yaml.explicit && (r = this.directives.yaml.version)) : this.directives = new Ye({ version: r }), this.setSchema(r, s), this.contents = e === void 0 ? null : this.createNode(e, i, s);
2266
+ }
2267
+ /**
2268
+ * Create a deep copy of this Document and its contents.
2269
+ *
2270
+ * Custom Node values that inherit from `Object` still refer to their original instances.
2271
+ */
2272
+ clone() {
2273
+ const e = Object.create(Be.prototype, {
2274
+ [Ht]: { value: zt }
2275
+ });
2276
+ return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = It(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
2277
+ }
2278
+ /** Adds a value to the document. */
2279
+ add(e) {
2280
+ ke(this.contents) && this.contents.add(e);
2281
+ }
2282
+ /** Adds a value to the document. */
2283
+ addIn(e, n) {
2284
+ ke(this.contents) && this.contents.addIn(e, n);
2285
+ }
2286
+ /**
2287
+ * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
2288
+ *
2289
+ * If `node` already has an anchor, `name` is ignored.
2290
+ * Otherwise, the `node.anchor` value will be set to `name`,
2291
+ * or if an anchor with that name is already present in the document,
2292
+ * `name` will be used as a prefix for a new unique anchor.
2293
+ * If `name` is undefined, the generated anchor will use 'a' as a prefix.
2294
+ */
2295
+ createAlias(e, n) {
2296
+ if (!e.anchor) {
2297
+ const s = Es(this);
2298
+ e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2299
+ !n || s.has(n) ? Cs(n || "a", s) : n;
2300
+ }
2301
+ return new wn(e.anchor);
2302
+ }
2303
+ createNode(e, n, s) {
2304
+ let i;
2305
+ if (typeof n == "function")
2306
+ e = n.call({ "": e }, "", e), i = n;
2307
+ else if (Array.isArray(n)) {
2308
+ const m = (S) => typeof S == "number" || S instanceof String || S instanceof Number, v = n.filter(m).map(String);
2309
+ v.length > 0 && (n = n.concat(v)), i = n;
2310
+ } else s === void 0 && n && (s = n, n = void 0);
2311
+ const { aliasDuplicateObjects: a, anchorPrefix: r, flow: o, keepUndefined: l, onTagObj: c, tag: d } = s ?? {}, { onAnchor: u, setAnchors: f, sourceObjects: h } = As(
2312
+ this,
2313
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
2314
+ r || "a"
2315
+ ), g = {
2316
+ aliasDuplicateObjects: a ?? !0,
2317
+ keepUndefined: l ?? !1,
2318
+ onAnchor: u,
2319
+ onTagObj: c,
2320
+ replacer: i,
2321
+ schema: this.schema,
2322
+ sourceObjects: h
2323
+ }, p = Os(e, d, g);
2324
+ return o && me(p) && (p.flow = !0), f(), p;
2325
+ }
2326
+ /**
2327
+ * Convert a key and a value into a `Pair` using the current schema,
2328
+ * recursively wrapping all values as `Scalar` or `Collection` nodes.
2329
+ */
2330
+ createPair(e, n, s = {}) {
2331
+ const i = this.createNode(e, null, s), a = this.createNode(n, null, s);
2332
+ return new Je(i, a);
2333
+ }
2334
+ /**
2335
+ * Removes a value from the document.
2336
+ * @returns `true` if the item was found and removed.
2337
+ */
2338
+ delete(e) {
2339
+ return ke(this.contents) ? this.contents.delete(e) : !1;
2340
+ }
2341
+ /**
2342
+ * Removes a value from the document.
2343
+ * @returns `true` if the item was found and removed.
2344
+ */
2345
+ deleteIn(e) {
2346
+ return He(e) ? this.contents == null ? !1 : (this.contents = null, !0) : ke(this.contents) ? this.contents.deleteIn(e) : !1;
2347
+ }
2348
+ /**
2349
+ * Returns item at `key`, or `undefined` if not found. By default unwraps
2350
+ * scalar values from their surrounding node; to disable set `keepScalar` to
2351
+ * `true` (collections are always returned intact).
2352
+ */
2353
+ get(e, n) {
2354
+ return me(this.contents) ? this.contents.get(e, n) : void 0;
2355
+ }
2356
+ /**
2357
+ * Returns item at `path`, or `undefined` if not found. By default unwraps
2358
+ * scalar values from their surrounding node; to disable set `keepScalar` to
2359
+ * `true` (collections are always returned intact).
2360
+ */
2361
+ getIn(e, n) {
2362
+ return He(e) ? !n && Re(this.contents) ? this.contents.value : this.contents : me(this.contents) ? this.contents.getIn(e, n) : void 0;
2363
+ }
2364
+ /**
2365
+ * Checks if the document includes a value with the key `key`.
2366
+ */
2367
+ has(e) {
2368
+ return me(this.contents) ? this.contents.has(e) : !1;
2369
+ }
2370
+ /**
2371
+ * Checks if the document includes a value at `path`.
2372
+ */
2373
+ hasIn(e) {
2374
+ return He(e) ? this.contents !== void 0 : me(this.contents) ? this.contents.hasIn(e) : !1;
2375
+ }
2376
+ /**
2377
+ * Sets a value in this document. For `!!set`, `value` needs to be a
2378
+ * boolean to add/remove the item from the set.
2379
+ */
2380
+ set(e, n) {
2381
+ this.contents == null ? this.contents = Xt(this.schema, [e], n) : ke(this.contents) && this.contents.set(e, n);
2382
+ }
2383
+ /**
2384
+ * Sets a value in this document. For `!!set`, `value` needs to be a
2385
+ * boolean to add/remove the item from the set.
2386
+ */
2387
+ setIn(e, n) {
2388
+ He(e) ? this.contents = n : this.contents == null ? this.contents = Xt(this.schema, Array.from(e), n) : ke(this.contents) && this.contents.setIn(e, n);
2389
+ }
2390
+ /**
2391
+ * Change the YAML version and schema used by the document.
2392
+ * A `null` version disables support for directives, explicit tags, anchors, and aliases.
2393
+ * It also requires the `schema` option to be given as a `Schema` instance value.
2394
+ *
2395
+ * Overrides all previously set schema options.
2396
+ */
2397
+ setSchema(e, n = {}) {
2398
+ typeof e == "number" && (e = String(e));
2399
+ let s;
2400
+ switch (e) {
2401
+ case "1.1":
2402
+ this.directives ? this.directives.yaml.version = "1.1" : this.directives = new Ye({ version: "1.1" }), s = { resolveKnownTags: !1, schema: "yaml-1.1" };
2403
+ break;
2404
+ case "1.2":
2405
+ case "next":
2406
+ this.directives ? this.directives.yaml.version = e : this.directives = new Ye({ version: e }), s = { resolveKnownTags: !0, schema: "core" };
2407
+ break;
2408
+ case null:
2409
+ this.directives && delete this.directives, s = null;
2410
+ break;
2411
+ default: {
2412
+ const i = JSON.stringify(e);
2413
+ throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`);
2414
+ }
2415
+ }
2416
+ if (n.schema instanceof Object)
2417
+ this.schema = n.schema;
2418
+ else if (s)
2419
+ this.schema = new At(Object.assign(s, n));
2420
+ else
2421
+ throw new Error("With a null YAML version, the { schema: Schema } option is required");
2422
+ }
2423
+ // json & jsonArg are only used from toJSON()
2424
+ toJS({ json: e, jsonArg: n, mapAsMap: s, maxAliasCount: i, onAnchor: a, reviver: r } = {}) {
2425
+ const o = {
2426
+ anchors: /* @__PURE__ */ new Map(),
2427
+ doc: this,
2428
+ keep: !e,
2429
+ mapAsMap: s === !0,
2430
+ mapKeyWarned: !1,
2431
+ maxAliasCount: typeof i == "number" ? i : 100
2432
+ }, l = Ts(this.contents, n ?? "", o);
2433
+ if (typeof a == "function")
2434
+ for (const { count: c, res: d } of o.anchors.values())
2435
+ a(d, c);
2436
+ return typeof r == "function" ? Ls(r, { "": l }, "", l) : l;
2437
+ }
2438
+ /**
2439
+ * A JSON representation of the document `contents`.
2440
+ *
2441
+ * @param jsonArg Used by `JSON.stringify` to indicate the array index or
2442
+ * property name.
2443
+ */
2444
+ toJSON(e, n) {
2445
+ return this.toJS({ json: !0, jsonArg: e, mapAsMap: !1, onAnchor: n });
2446
+ }
2447
+ /** A YAML representation of the document. */
2448
+ toString(e = {}) {
2449
+ if (this.errors.length > 0)
2450
+ throw new Error("Document with errors cannot be stringified");
2451
+ if ("indent" in e && (!Number.isInteger(e.indent) || Number(e.indent) <= 0)) {
2452
+ const n = JSON.stringify(e.indent);
2453
+ throw new Error(`"indent" option must be a positive integer, not ${n}`);
2454
+ }
2455
+ return Vi(this, e);
2456
+ }
2457
+ }
2458
+ function ke(t) {
2459
+ if (me(t))
2460
+ return !0;
2461
+ throw new Error("Expected a YAML collection as document contents");
2462
+ }
2463
+ class jn extends Error {
2464
+ constructor(e, n, s, i) {
2465
+ super(), this.name = e, this.code = s, this.message = i, this.pos = n;
2466
+ }
2467
+ }
2468
+ class Pe extends jn {
2469
+ constructor(e, n, s) {
2470
+ super("YAMLParseError", e, n, s);
2471
+ }
2472
+ }
2473
+ class Gi extends jn {
2474
+ constructor(e, n, s) {
2475
+ super("YAMLWarning", e, n, s);
2476
+ }
2477
+ }
2478
+ const an = (t, e) => (n) => {
2479
+ if (n.pos[0] === -1)
2480
+ return;
2481
+ n.linePos = n.pos.map((o) => e.linePos(o));
2482
+ const { line: s, col: i } = n.linePos[0];
2483
+ n.message += ` at line ${s}, column ${i}`;
2484
+ let a = i - 1, r = t.substring(e.lineStarts[s - 1], e.lineStarts[s]).replace(/[\n\r]+$/, "");
2485
+ if (a >= 60 && r.length > 80) {
2486
+ const o = Math.min(a - 39, r.length - 79);
2487
+ r = "…" + r.substring(o), a -= o - 1;
2488
+ }
2489
+ if (r.length > 80 && (r = r.substring(0, 79) + "…"), s > 1 && /^ *$/.test(r.substring(0, a))) {
2490
+ let o = t.substring(e.lineStarts[s - 2], e.lineStarts[s - 1]);
2491
+ o.length > 80 && (o = o.substring(0, 79) + `…
2492
+ `), r = o + r;
2493
+ }
2494
+ if (/[^ ]/.test(r)) {
2495
+ let o = 1;
2496
+ const l = n.linePos[1];
2497
+ l?.line === s && l.col > i && (o = Math.max(1, Math.min(l.col - i, 80 - a)));
2498
+ const c = " ".repeat(a) + "^".repeat(o);
2499
+ n.message += `:
2500
+
2501
+ ${r}
2502
+ ${c}
2503
+ `;
2504
+ }
2505
+ };
2506
+ function Ne(t, { flow: e, indicator: n, next: s, offset: i, onError: a, parentIndent: r, startOnNewline: o }) {
2507
+ let l = !1, c = o, d = o, u = "", f = "", h = !1, g = !1, p = null, m = null, v = null, S = null, k = null, $ = null, y = null;
2508
+ for (const w of t)
2509
+ switch (g && (w.type !== "space" && w.type !== "newline" && w.type !== "comma" && a(w.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), p && (c && w.type !== "comment" && w.type !== "newline" && a(p, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), p = null), w.type) {
2510
+ case "space":
2511
+ !e && (n !== "doc-start" || s?.type !== "flow-collection") && w.source.includes(" ") && (p = w), d = !0;
2512
+ break;
2513
+ case "comment": {
2514
+ d || a(w, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2515
+ const L = w.source.substring(1) || " ";
2516
+ u ? u += f + L : u = L, f = "", c = !1;
2517
+ break;
2518
+ }
2519
+ case "newline":
2520
+ c ? u ? u += w.source : (!$ || n !== "seq-item-ind") && (l = !0) : f += w.source, c = !0, h = !0, (m || v) && (S = w), d = !0;
2521
+ break;
2522
+ case "anchor":
2523
+ m && a(w, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), w.source.endsWith(":") && a(w.offset + w.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = w, y ?? (y = w.offset), c = !1, d = !1, g = !0;
2524
+ break;
2525
+ case "tag": {
2526
+ v && a(w, "MULTIPLE_TAGS", "A node can have at most one tag"), v = w, y ?? (y = w.offset), c = !1, d = !1, g = !0;
2527
+ break;
2528
+ }
2529
+ case n:
2530
+ (m || v) && a(w, "BAD_PROP_ORDER", `Anchors and tags must be after the ${w.source} indicator`), $ && a(w, "UNEXPECTED_TOKEN", `Unexpected ${w.source} in ${e ?? "collection"}`), $ = w, c = n === "seq-item-ind" || n === "explicit-key-ind", d = !1;
2531
+ break;
2532
+ case "comma":
2533
+ if (e) {
2534
+ k && a(w, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), k = w, c = !1, d = !1;
2535
+ break;
2536
+ }
2537
+ // else fallthrough
2538
+ default:
2539
+ a(w, "UNEXPECTED_TOKEN", `Unexpected ${w.type} token`), c = !1, d = !1;
2540
+ }
2541
+ const I = t[t.length - 1], N = I ? I.offset + I.source.length : i;
2542
+ return g && s && s.type !== "space" && s.type !== "newline" && s.type !== "comma" && (s.type !== "scalar" || s.source !== "") && a(s.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), p && (c && p.indent <= r || s?.type === "block-map" || s?.type === "block-seq") && a(p, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
2543
+ comma: k,
2544
+ found: $,
2545
+ spaceBefore: l,
2546
+ comment: u,
2547
+ hasNewline: h,
2548
+ anchor: m,
2549
+ tag: v,
2550
+ newlineAfterProp: S,
2551
+ end: N,
2552
+ start: y ?? N
2553
+ };
2554
+ }
2555
+ function je(t) {
2556
+ if (!t)
2557
+ return null;
2558
+ switch (t.type) {
2559
+ case "alias":
2560
+ case "scalar":
2561
+ case "double-quoted-scalar":
2562
+ case "single-quoted-scalar":
2563
+ if (t.source.includes(`
2564
+ `))
2565
+ return !0;
2566
+ if (t.end) {
2567
+ for (const e of t.end)
2568
+ if (e.type === "newline")
2569
+ return !0;
2570
+ }
2571
+ return !1;
2572
+ case "flow-collection":
2573
+ for (const e of t.items) {
2574
+ for (const n of e.start)
2575
+ if (n.type === "newline")
2576
+ return !0;
2577
+ if (e.sep) {
2578
+ for (const n of e.sep)
2579
+ if (n.type === "newline")
2580
+ return !0;
2581
+ }
2582
+ if (je(e.key) || je(e.value))
2583
+ return !0;
2584
+ }
2585
+ return !1;
2586
+ default:
2587
+ return !0;
2588
+ }
2589
+ }
2590
+ function wt(t, e, n) {
2591
+ if (e?.type === "flow-collection") {
2592
+ const s = e.end[0];
2593
+ s.indent === t && (s.source === "]" || s.source === "}") && je(e) && n(s, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
2594
+ }
2595
+ }
2596
+ function Mn(t, e, n) {
2597
+ const { uniqueKeys: s } = t.options;
2598
+ if (s === !1)
2599
+ return !1;
2600
+ const i = typeof s == "function" ? s : (a, r) => a === r || Re(a) && Re(r) && a.value === r.value;
2601
+ return e.some((a) => i(a.key, n));
2602
+ }
2603
+ const rn = "All mapping items must start at the same column";
2604
+ function Wi({ composeNode: t, composeEmptyNode: e }, n, s, i, a) {
2605
+ const r = a?.nodeClass ?? Ie, o = new r(n.schema);
2606
+ n.atRoot && (n.atRoot = !1);
2607
+ let l = s.offset, c = null;
2608
+ for (const d of s.items) {
2609
+ const { start: u, key: f, sep: h, value: g } = d, p = Ne(u, {
2610
+ indicator: "explicit-key-ind",
2611
+ next: f ?? h?.[0],
2612
+ offset: l,
2613
+ onError: i,
2614
+ parentIndent: s.indent,
2615
+ startOnNewline: !0
2616
+ }), m = !p.found;
2617
+ if (m) {
2618
+ if (f && (f.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in f && f.indent !== s.indent && i(l, "BAD_INDENT", rn)), !p.anchor && !p.tag && !h) {
2619
+ c = p.end, p.comment && (o.comment ? o.comment += `
2620
+ ` + p.comment : o.comment = p.comment);
2621
+ continue;
2622
+ }
2623
+ (p.newlineAfterProp || je(f)) && i(f ?? u[u.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
2624
+ } else p.found?.indent !== s.indent && i(l, "BAD_INDENT", rn);
2625
+ n.atKey = !0;
2626
+ const v = p.end, S = f ? t(n, f, p, i) : e(n, v, u, null, p, i);
2627
+ n.schema.compat && wt(s.indent, f, i), n.atKey = !1, Mn(n, o.items, S) && i(v, "DUPLICATE_KEY", "Map keys must be unique");
2628
+ const k = Ne(h ?? [], {
2629
+ indicator: "map-value-ind",
2630
+ next: g,
2631
+ offset: S.range[2],
2632
+ onError: i,
2633
+ parentIndent: s.indent,
2634
+ startOnNewline: !f || f.type === "block-scalar"
2635
+ });
2636
+ if (l = k.end, k.found) {
2637
+ m && (g?.type === "block-map" && !k.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), n.options.strict && p.start < k.found.offset - 1024 && i(S.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
2638
+ const $ = g ? t(n, g, k, i) : e(n, l, h, null, k, i);
2639
+ n.schema.compat && wt(s.indent, g, i), l = $.range[2];
2640
+ const y = new Je(S, $);
2641
+ n.options.keepSourceTokens && (y.srcToken = d), o.items.push(y);
2642
+ } else {
2643
+ m && i(S.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), k.comment && (S.comment ? S.comment += `
2644
+ ` + k.comment : S.comment = k.comment);
2645
+ const $ = new Je(S);
2646
+ n.options.keepSourceTokens && ($.srcToken = d), o.items.push($);
2647
+ }
2648
+ }
2649
+ return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), o.range = [s.offset, l, c ?? l], o;
2650
+ }
2651
+ function Yi({ composeNode: t, composeEmptyNode: e }, n, s, i, a) {
2652
+ const r = a?.nodeClass ?? Fe, o = new r(n.schema);
2653
+ n.atRoot && (n.atRoot = !1), n.atKey && (n.atKey = !1);
2654
+ let l = s.offset, c = null;
2655
+ for (const { start: d, value: u } of s.items) {
2656
+ const f = Ne(d, {
2657
+ indicator: "seq-item-ind",
2658
+ next: u,
2659
+ offset: l,
2660
+ onError: i,
2661
+ parentIndent: s.indent,
2662
+ startOnNewline: !0
2663
+ });
2664
+ if (!f.found)
2665
+ if (f.anchor || f.tag || u)
2666
+ u?.type === "block-seq" ? i(f.end, "BAD_INDENT", "All sequence items must start at the same column") : i(l, "MISSING_CHAR", "Sequence item without - indicator");
2667
+ else {
2668
+ c = f.end, f.comment && (o.comment = f.comment);
2669
+ continue;
2670
+ }
2671
+ const h = u ? t(n, u, f, i) : e(n, f.end, d, null, f, i);
2672
+ n.schema.compat && wt(s.indent, u, i), l = h.range[2], o.items.push(h);
2673
+ }
2674
+ return o.range = [s.offset, l, c ?? l], o;
2675
+ }
2676
+ function Ue(t, e, n, s) {
2677
+ let i = "";
2678
+ if (t) {
2679
+ let a = !1, r = "";
2680
+ for (const o of t) {
2681
+ const { source: l, type: c } = o;
2682
+ switch (c) {
2683
+ case "space":
2684
+ a = !0;
2685
+ break;
2686
+ case "comment": {
2687
+ n && !a && s(o, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
2688
+ const d = l.substring(1) || " ";
2689
+ i ? i += r + d : i = d, r = "";
2690
+ break;
2691
+ }
2692
+ case "newline":
2693
+ i && (r += l), a = !0;
2694
+ break;
2695
+ default:
2696
+ s(o, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
2697
+ }
2698
+ e += l.length;
2699
+ }
2700
+ }
2701
+ return { comment: i, offset: e };
2702
+ }
2703
+ const ft = "Block collections are not allowed within flow collections", pt = (t) => t && (t.type === "block-map" || t.type === "block-seq");
2704
+ function Ji({ composeNode: t, composeEmptyNode: e }, n, s, i, a) {
2705
+ const r = s.start.source === "{", o = r ? "flow map" : "flow sequence", l = a?.nodeClass ?? (r ? Ie : Fe), c = new l(n.schema);
2706
+ c.flow = !0;
2707
+ const d = n.atRoot;
2708
+ d && (n.atRoot = !1), n.atKey && (n.atKey = !1);
2709
+ let u = s.offset + s.start.source.length;
2710
+ for (let m = 0; m < s.items.length; ++m) {
2711
+ const v = s.items[m], { start: S, key: k, sep: $, value: y } = v, I = Ne(S, {
2712
+ flow: o,
2713
+ indicator: "explicit-key-ind",
2714
+ next: k ?? $?.[0],
2715
+ offset: u,
2716
+ onError: i,
2717
+ parentIndent: s.indent,
2718
+ startOnNewline: !1
2719
+ });
2720
+ if (!I.found) {
2721
+ if (!I.anchor && !I.tag && !$ && !y) {
2722
+ m === 0 && I.comma ? i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${o}`) : m < s.items.length - 1 && i(I.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${o}`), I.comment && (c.comment ? c.comment += `
2723
+ ` + I.comment : c.comment = I.comment), u = I.end;
2724
+ continue;
2725
+ }
2726
+ !r && n.options.strict && je(k) && i(
2727
+ k,
2728
+ // checked by containsNewline()
2729
+ "MULTILINE_IMPLICIT_KEY",
2730
+ "Implicit keys of flow sequence pairs need to be on a single line"
2731
+ );
2732
+ }
2733
+ if (m === 0)
2734
+ I.comma && i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${o}`);
2735
+ else if (I.comma || i(I.start, "MISSING_CHAR", `Missing , between ${o} items`), I.comment) {
2736
+ let N = "";
2737
+ e: for (const w of S)
2738
+ switch (w.type) {
2739
+ case "comma":
2740
+ case "space":
2741
+ break;
2742
+ case "comment":
2743
+ N = w.source.substring(1);
2744
+ break e;
2745
+ default:
2746
+ break e;
2747
+ }
2748
+ if (N) {
2749
+ let w = c.items[c.items.length - 1];
2750
+ vn(w) && (w = w.value ?? w.key), w.comment ? w.comment += `
2751
+ ` + N : w.comment = N, I.comment = I.comment.substring(N.length + 1);
2752
+ }
2753
+ }
2754
+ if (!r && !$ && !I.found) {
2755
+ const N = y ? t(n, y, I, i) : e(n, I.end, $, null, I, i);
2756
+ c.items.push(N), u = N.range[2], pt(y) && i(N.range, "BLOCK_IN_FLOW", ft);
2757
+ } else {
2758
+ n.atKey = !0;
2759
+ const N = I.end, w = k ? t(n, k, I, i) : e(n, N, S, null, I, i);
2760
+ pt(k) && i(w.range, "BLOCK_IN_FLOW", ft), n.atKey = !1;
2761
+ const L = Ne($ ?? [], {
2762
+ flow: o,
2763
+ indicator: "map-value-ind",
2764
+ next: y,
2765
+ offset: w.range[2],
2766
+ onError: i,
2767
+ parentIndent: s.indent,
2768
+ startOnNewline: !1
2769
+ });
2770
+ if (L.found) {
2771
+ if (!r && !I.found && n.options.strict) {
2772
+ if ($)
2773
+ for (const R of $) {
2774
+ if (R === L.found)
2775
+ break;
2776
+ if (R.type === "newline") {
2777
+ i(R, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
2778
+ break;
2779
+ }
2780
+ }
2781
+ I.start < L.found.offset - 1024 && i(L.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
2782
+ }
2783
+ } else y && ("source" in y && y.source?.[0] === ":" ? i(y, "MISSING_CHAR", `Missing space after : in ${o}`) : i(L.start, "MISSING_CHAR", `Missing , or : between ${o} items`));
2784
+ const P = y ? t(n, y, L, i) : L.found ? e(n, L.end, $, null, L, i) : null;
2785
+ P ? pt(y) && i(P.range, "BLOCK_IN_FLOW", ft) : L.comment && (w.comment ? w.comment += `
2786
+ ` + L.comment : w.comment = L.comment);
2787
+ const G = new Je(w, P);
2788
+ if (n.options.keepSourceTokens && (G.srcToken = v), r) {
2789
+ const R = c;
2790
+ Mn(n, R.items, w) && i(N, "DUPLICATE_KEY", "Map keys must be unique"), R.items.push(G);
2791
+ } else {
2792
+ const R = new Ie(n.schema);
2793
+ R.flow = !0, R.items.push(G);
2794
+ const W = (P ?? w).range;
2795
+ R.range = [w.range[0], W[1], W[2]], c.items.push(R);
2796
+ }
2797
+ u = P ? P.range[2] : L.end;
2798
+ }
2799
+ }
2800
+ const f = r ? "}" : "]", [h, ...g] = s.end;
2801
+ let p = u;
2802
+ if (h?.source === f)
2803
+ p = h.offset + h.source.length;
2804
+ else {
2805
+ const m = o[0].toUpperCase() + o.substring(1), v = d ? `${m} must end with a ${f}` : `${m} in block collection must be sufficiently indented and end with a ${f}`;
2806
+ i(u, d ? "MISSING_CHAR" : "BAD_INDENT", v), h && h.source.length !== 1 && g.unshift(h);
2807
+ }
2808
+ if (g.length > 0) {
2809
+ const m = Ue(g, p, n.options.strict, i);
2810
+ m.comment && (c.comment ? c.comment += `
2811
+ ` + m.comment : c.comment = m.comment), c.range = [s.offset, p, m.offset];
2812
+ } else
2813
+ c.range = [s.offset, p, p];
2814
+ return c;
2815
+ }
2816
+ function ht(t, e, n, s, i, a) {
2817
+ const r = n.type === "block-map" ? Wi(t, e, n, s, a) : n.type === "block-seq" ? Yi(t, e, n, s, a) : Ji(t, e, n, s, a), o = r.constructor;
2818
+ return i === "!" || i === o.tagName ? (r.tag = o.tagName, r) : (i && (r.tag = i), r);
2819
+ }
2820
+ function Qi(t, e, n, s, i) {
2821
+ const a = s.tag, r = a ? e.directives.tagName(a.source, (f) => i(a, "TAG_RESOLVE_FAILED", f)) : null;
2822
+ if (n.type === "block-seq") {
2823
+ const { anchor: f, newlineAfterProp: h } = s, g = f && a ? f.offset > a.offset ? f : a : f ?? a;
2824
+ g && (!h || h.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
2825
+ }
2826
+ const o = n.type === "block-map" ? "map" : n.type === "block-seq" ? "seq" : n.start.source === "{" ? "map" : "seq";
2827
+ if (!a || !r || r === "!" || r === Ie.tagName && o === "map" || r === Fe.tagName && o === "seq")
2828
+ return ht(t, e, n, i, r);
2829
+ let l = e.schema.tags.find((f) => f.tag === r && f.collection === o);
2830
+ if (!l) {
2831
+ const f = e.schema.knownTags[r];
2832
+ if (f?.collection === o)
2833
+ e.schema.tags.push(Object.assign({}, f, { default: !1 })), l = f;
2834
+ else
2835
+ return f ? i(a, "BAD_COLLECTION_TYPE", `${f.tag} used for ${o} collection, but expects ${f.collection ?? "scalar"}`, !0) : i(a, "TAG_RESOLVE_FAILED", `Unresolved tag: ${r}`, !0), ht(t, e, n, i, r);
2836
+ }
2837
+ const c = ht(t, e, n, i, r, l), d = l.resolve?.(c, (f) => i(a, "TAG_RESOLVE_FAILED", f), e.options) ?? c, u = It(d) ? d : new x(d);
2838
+ return u.range = c.range, u.tag = r, l?.format && (u.format = l.format), u;
2839
+ }
2840
+ function Zi(t, e, n) {
2841
+ const s = e.offset, i = ea(e, t.options.strict, n);
2842
+ if (!i)
2843
+ return { value: "", type: null, comment: "", range: [s, s, s] };
2844
+ const a = i.mode === ">" ? x.BLOCK_FOLDED : x.BLOCK_LITERAL, r = e.source ? ta(e.source) : [];
2845
+ let o = r.length;
2846
+ for (let p = r.length - 1; p >= 0; --p) {
2847
+ const m = r[p][1];
2848
+ if (m === "" || m === "\r")
2849
+ o = p;
2850
+ else
2851
+ break;
2852
+ }
2853
+ if (o === 0) {
2854
+ const p = i.chomp === "+" && r.length > 0 ? `
2855
+ `.repeat(Math.max(1, r.length - 1)) : "";
2856
+ let m = s + i.length;
2857
+ return e.source && (m += e.source.length), { value: p, type: a, comment: i.comment, range: [s, m, m] };
2858
+ }
2859
+ let l = e.indent + i.indent, c = e.offset + i.length, d = 0;
2860
+ for (let p = 0; p < o; ++p) {
2861
+ const [m, v] = r[p];
2862
+ if (v === "" || v === "\r")
2863
+ i.indent === 0 && m.length > l && (l = m.length);
2864
+ else {
2865
+ m.length < l && n(c + m.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (l = m.length), d = p, l === 0 && !t.atRoot && n(c, "BAD_INDENT", "Block scalar values in collections must be indented");
2866
+ break;
2867
+ }
2868
+ c += m.length + v.length + 1;
2869
+ }
2870
+ for (let p = r.length - 1; p >= o; --p)
2871
+ r[p][0].length > l && (o = p + 1);
2872
+ let u = "", f = "", h = !1;
2873
+ for (let p = 0; p < d; ++p)
2874
+ u += r[p][0].slice(l) + `
2875
+ `;
2876
+ for (let p = d; p < o; ++p) {
2877
+ let [m, v] = r[p];
2878
+ c += m.length + v.length + 1;
2879
+ const S = v[v.length - 1] === "\r";
2880
+ if (S && (v = v.slice(0, -1)), v && m.length < l) {
2881
+ const $ = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
2882
+ n(c - v.length - (S ? 2 : 1), "BAD_INDENT", $), m = "";
2883
+ }
2884
+ a === x.BLOCK_LITERAL ? (u += f + m.slice(l) + v, f = `
2885
+ `) : m.length > l || v[0] === " " ? (f === " " ? f = `
2886
+ ` : !h && f === `
2887
+ ` && (f = `
2888
+
2889
+ `), u += f + m.slice(l) + v, f = `
2890
+ `, h = !0) : v === "" ? f === `
2891
+ ` ? u += `
2892
+ ` : f = `
2893
+ ` : (u += f + v, f = " ", h = !1);
2894
+ }
2895
+ switch (i.chomp) {
2896
+ case "-":
2897
+ break;
2898
+ case "+":
2899
+ for (let p = o; p < r.length; ++p)
2900
+ u += `
2901
+ ` + r[p][0].slice(l);
2902
+ u[u.length - 1] !== `
2903
+ ` && (u += `
2904
+ `);
2905
+ break;
2906
+ default:
2907
+ u += `
2908
+ `;
2909
+ }
2910
+ const g = s + i.length + e.source.length;
2911
+ return { value: u, type: a, comment: i.comment, range: [s, g, g] };
2912
+ }
2913
+ function ea({ offset: t, props: e }, n, s) {
2914
+ if (e[0].type !== "block-scalar-header")
2915
+ return s(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
2916
+ const { source: i } = e[0], a = i[0];
2917
+ let r = 0, o = "", l = -1;
2918
+ for (let f = 1; f < i.length; ++f) {
2919
+ const h = i[f];
2920
+ if (!o && (h === "-" || h === "+"))
2921
+ o = h;
2922
+ else {
2923
+ const g = Number(h);
2924
+ !r && g ? r = g : l === -1 && (l = t + f);
2925
+ }
2926
+ }
2927
+ l !== -1 && s(l, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
2928
+ let c = !1, d = "", u = i.length;
2929
+ for (let f = 1; f < e.length; ++f) {
2930
+ const h = e[f];
2931
+ switch (h.type) {
2932
+ case "space":
2933
+ c = !0;
2934
+ // fallthrough
2935
+ case "newline":
2936
+ u += h.source.length;
2937
+ break;
2938
+ case "comment":
2939
+ n && !c && s(h, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), u += h.source.length, d = h.source.substring(1);
2940
+ break;
2941
+ case "error":
2942
+ s(h, "UNEXPECTED_TOKEN", h.message), u += h.source.length;
2943
+ break;
2944
+ /* istanbul ignore next should not happen */
2945
+ default: {
2946
+ const g = `Unexpected token in block scalar header: ${h.type}`;
2947
+ s(h, "UNEXPECTED_TOKEN", g);
2948
+ const p = h.source;
2949
+ p && typeof p == "string" && (u += p.length);
2950
+ }
2951
+ }
2952
+ }
2953
+ return { mode: a, indent: r, chomp: o, comment: d, length: u };
2954
+ }
2955
+ function ta(t) {
2956
+ const e = t.split(/\n( *)/), n = e[0], s = n.match(/^( *)/), a = [s?.[1] ? [s[1], n.slice(s[1].length)] : ["", n]];
2957
+ for (let r = 1; r < e.length; r += 2)
2958
+ a.push([e[r], e[r + 1]]);
2959
+ return a;
2960
+ }
2961
+ function na(t, e, n) {
2962
+ const { offset: s, type: i, source: a, end: r } = t;
2963
+ let o, l;
2964
+ const c = (f, h, g) => n(s + f, h, g);
2965
+ switch (i) {
2966
+ case "scalar":
2967
+ o = x.PLAIN, l = sa(a, c);
2968
+ break;
2969
+ case "single-quoted-scalar":
2970
+ o = x.QUOTE_SINGLE, l = ia(a, c);
2971
+ break;
2972
+ case "double-quoted-scalar":
2973
+ o = x.QUOTE_DOUBLE, l = aa(a, c);
2974
+ break;
2975
+ /* istanbul ignore next should not happen */
2976
+ default:
2977
+ return n(t, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
2978
+ value: "",
2979
+ type: null,
2980
+ comment: "",
2981
+ range: [s, s + a.length, s + a.length]
2982
+ };
2983
+ }
2984
+ const d = s + a.length, u = Ue(r, d, e, n);
2985
+ return {
2986
+ value: l,
2987
+ type: o,
2988
+ comment: u.comment,
2989
+ range: [s, d, u.offset]
2990
+ };
2991
+ }
2992
+ function sa(t, e) {
2993
+ let n = "";
2994
+ switch (t[0]) {
2995
+ /* istanbul ignore next should not happen */
2996
+ case " ":
2997
+ n = "a tab character";
2998
+ break;
2999
+ case ",":
3000
+ n = "flow indicator character ,";
3001
+ break;
3002
+ case "%":
3003
+ n = "directive indicator character %";
3004
+ break;
3005
+ case "|":
3006
+ case ">": {
3007
+ n = `block scalar indicator ${t[0]}`;
3008
+ break;
3009
+ }
3010
+ case "@":
3011
+ case "`": {
3012
+ n = `reserved character ${t[0]}`;
3013
+ break;
3014
+ }
3015
+ }
3016
+ return n && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${n}`), xn(t);
3017
+ }
3018
+ function ia(t, e) {
3019
+ return (t[t.length - 1] !== "'" || t.length === 1) && e(t.length, "MISSING_CHAR", "Missing closing 'quote"), xn(t.slice(1, -1)).replace(/''/g, "'");
3020
+ }
3021
+ function xn(t) {
3022
+ let e, n;
3023
+ try {
3024
+ e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
3025
+ `, "sy"), n = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
3026
+ `, "sy");
3027
+ } catch {
3028
+ e = /(.*?)[ \t]*\r?\n/sy, n = /[ \t]*(.*?)[ \t]*\r?\n/sy;
3029
+ }
3030
+ let s = e.exec(t);
3031
+ if (!s)
3032
+ return t;
3033
+ let i = s[1], a = " ", r = e.lastIndex;
3034
+ for (n.lastIndex = r; s = n.exec(t); )
3035
+ s[1] === "" ? a === `
3036
+ ` ? i += a : a = `
3037
+ ` : (i += a + s[1], a = " "), r = n.lastIndex;
3038
+ const o = /[ \t]*(.*)/sy;
3039
+ return o.lastIndex = r, s = o.exec(t), i + a + (s?.[1] ?? "");
3040
+ }
3041
+ function aa(t, e) {
3042
+ let n = "";
3043
+ for (let s = 1; s < t.length - 1; ++s) {
3044
+ const i = t[s];
3045
+ if (!(i === "\r" && t[s + 1] === `
3046
+ `))
3047
+ if (i === `
3048
+ `) {
3049
+ const { fold: a, offset: r } = ra(t, s);
3050
+ n += a, s = r;
3051
+ } else if (i === "\\") {
3052
+ let a = t[++s];
3053
+ const r = oa[a];
3054
+ if (r)
3055
+ n += r;
3056
+ else if (a === `
3057
+ `)
3058
+ for (a = t[s + 1]; a === " " || a === " "; )
3059
+ a = t[++s + 1];
3060
+ else if (a === "\r" && t[s + 1] === `
3061
+ `)
3062
+ for (a = t[++s + 1]; a === " " || a === " "; )
3063
+ a = t[++s + 1];
3064
+ else if (a === "x" || a === "u" || a === "U") {
3065
+ const o = a === "x" ? 2 : a === "u" ? 4 : 8;
3066
+ n += la(t, s + 1, o, e), s += o;
3067
+ } else {
3068
+ const o = t.substr(s - 1, 2);
3069
+ e(s - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${o}`), n += o;
3070
+ }
3071
+ } else if (i === " " || i === " ") {
3072
+ const a = s;
3073
+ let r = t[s + 1];
3074
+ for (; r === " " || r === " "; )
3075
+ r = t[++s + 1];
3076
+ r !== `
3077
+ ` && !(r === "\r" && t[s + 2] === `
3078
+ `) && (n += s > a ? t.slice(a, s + 1) : i);
3079
+ } else
3080
+ n += i;
3081
+ }
3082
+ return (t[t.length - 1] !== '"' || t.length === 1) && e(t.length, "MISSING_CHAR", 'Missing closing "quote'), n;
3083
+ }
3084
+ function ra(t, e) {
3085
+ let n = "", s = t[e + 1];
3086
+ for (; (s === " " || s === " " || s === `
3087
+ ` || s === "\r") && !(s === "\r" && t[e + 2] !== `
3088
+ `); )
3089
+ s === `
3090
+ ` && (n += `
3091
+ `), e += 1, s = t[e + 1];
3092
+ return n || (n = " "), { fold: n, offset: e };
3093
+ }
3094
+ const oa = {
3095
+ 0: "\0",
3096
+ // null character
3097
+ a: "\x07",
3098
+ // bell character
3099
+ b: "\b",
3100
+ // backspace
3101
+ e: "\x1B",
3102
+ // escape character
3103
+ f: "\f",
3104
+ // form feed
3105
+ n: `
3106
+ `,
3107
+ // line feed
3108
+ r: "\r",
3109
+ // carriage return
3110
+ t: " ",
3111
+ // horizontal tab
3112
+ v: "\v",
3113
+ // vertical tab
3114
+ N: "…",
3115
+ // Unicode next line
3116
+ _: " ",
3117
+ // Unicode non-breaking space
3118
+ L: "\u2028",
3119
+ // Unicode line separator
3120
+ P: "\u2029",
3121
+ // Unicode paragraph separator
3122
+ " ": " ",
3123
+ '"': '"',
3124
+ "/": "/",
3125
+ "\\": "\\",
3126
+ " ": " "
3127
+ };
3128
+ function la(t, e, n, s) {
3129
+ const i = t.substr(e, n), r = i.length === n && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
3130
+ try {
3131
+ return String.fromCodePoint(r);
3132
+ } catch {
3133
+ const o = t.substr(e - 2, n + 2);
3134
+ return s(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${o}`), o;
3135
+ }
3136
+ }
3137
+ function Bn(t, e, n, s) {
3138
+ const { value: i, type: a, comment: r, range: o } = e.type === "block-scalar" ? Zi(t, e, s) : na(e, t.options.strict, s), l = n ? t.directives.tagName(n.source, (u) => s(n, "TAG_RESOLVE_FAILED", u)) : null;
3139
+ let c;
3140
+ t.options.stringKeys && t.atKey ? c = t.schema[ge] : l ? c = ca(t.schema, i, l, n, s) : e.type === "scalar" ? c = ua(t, i, e, s) : c = t.schema[ge];
3141
+ let d;
3142
+ try {
3143
+ const u = c.resolve(i, (f) => s(n ?? e, "TAG_RESOLVE_FAILED", f), t.options);
3144
+ d = Re(u) ? u : new x(u);
3145
+ } catch (u) {
3146
+ const f = u instanceof Error ? u.message : String(u);
3147
+ s(n ?? e, "TAG_RESOLVE_FAILED", f), d = new x(i);
3148
+ }
3149
+ return d.range = o, d.source = i, a && (d.type = a), l && (d.tag = l), c.format && (d.format = c.format), r && (d.comment = r), d;
3150
+ }
3151
+ function ca(t, e, n, s, i) {
3152
+ if (n === "!")
3153
+ return t[ge];
3154
+ const a = [];
3155
+ for (const o of t.tags)
3156
+ if (!o.collection && o.tag === n)
3157
+ if (o.default && o.test)
3158
+ a.push(o);
3159
+ else
3160
+ return o;
3161
+ for (const o of a)
3162
+ if (o.test?.test(e))
3163
+ return o;
3164
+ const r = t.knownTags[n];
3165
+ return r && !r.collection ? (t.tags.push(Object.assign({}, r, { default: !1, test: void 0 })), r) : (i(s, "TAG_RESOLVE_FAILED", `Unresolved tag: ${n}`, n !== "tag:yaml.org,2002:str"), t[ge]);
3166
+ }
3167
+ function ua({ atKey: t, directives: e, schema: n }, s, i, a) {
3168
+ const r = n.tags.find((o) => (o.default === !0 || t && o.default === "key") && o.test?.test(s)) || n[ge];
3169
+ if (n.compat) {
3170
+ const o = n.compat.find((l) => l.default && l.test?.test(s)) ?? n[ge];
3171
+ if (r.tag !== o.tag) {
3172
+ const l = e.tagString(r.tag), c = e.tagString(o.tag), d = `Value may be parsed as either ${l} or ${c}`;
3173
+ a(i, "TAG_RESOLVE_FAILED", d, !0);
3174
+ }
3175
+ }
3176
+ return r;
3177
+ }
3178
+ function da(t, e, n) {
3179
+ if (e) {
3180
+ n ?? (n = e.length);
3181
+ for (let s = n - 1; s >= 0; --s) {
3182
+ let i = e[s];
3183
+ switch (i.type) {
3184
+ case "space":
3185
+ case "comment":
3186
+ case "newline":
3187
+ t -= i.source.length;
3188
+ continue;
3189
+ }
3190
+ for (i = e[++s]; i?.type === "space"; )
3191
+ t += i.source.length, i = e[++s];
3192
+ break;
3193
+ }
3194
+ }
3195
+ return t;
3196
+ }
3197
+ const fa = { composeNode: Un, composeEmptyNode: _t };
3198
+ function Un(t, e, n, s) {
3199
+ const i = t.atKey, { spaceBefore: a, comment: r, anchor: o, tag: l } = n;
3200
+ let c, d = !0;
3201
+ switch (e.type) {
3202
+ case "alias":
3203
+ c = pa(t, e, s), (o || l) && s(e, "ALIAS_PROPS", "An alias node must not specify any properties");
3204
+ break;
3205
+ case "scalar":
3206
+ case "single-quoted-scalar":
3207
+ case "double-quoted-scalar":
3208
+ case "block-scalar":
3209
+ c = Bn(t, e, l, s), o && (c.anchor = o.source.substring(1));
3210
+ break;
3211
+ case "block-map":
3212
+ case "block-seq":
3213
+ case "flow-collection":
3214
+ try {
3215
+ c = Qi(fa, t, e, n, s), o && (c.anchor = o.source.substring(1));
3216
+ } catch (u) {
3217
+ const f = u instanceof Error ? u.message : String(u);
3218
+ s(e, "RESOURCE_EXHAUSTION", f);
3219
+ }
3220
+ break;
3221
+ default: {
3222
+ const u = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
3223
+ s(e, "UNEXPECTED_TOKEN", u), d = !1;
3224
+ }
3225
+ }
3226
+ return c ?? (c = _t(t, e.offset, void 0, null, n, s)), o && c.anchor === "" && s(o, "BAD_ALIAS", "Anchor cannot be an empty string"), i && t.options.stringKeys && (!Re(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && s(l ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), a && (c.spaceBefore = !0), r && (e.type === "scalar" && e.source === "" ? c.comment = r : c.commentBefore = r), t.options.keepSourceTokens && d && (c.srcToken = e), c;
3227
+ }
3228
+ function _t(t, e, n, s, { spaceBefore: i, comment: a, anchor: r, tag: o, end: l }, c) {
3229
+ const d = {
3230
+ type: "scalar",
3231
+ offset: da(e, n, s),
3232
+ indent: -1,
3233
+ source: ""
3234
+ }, u = Bn(t, d, o, c);
3235
+ return r && (u.anchor = r.source.substring(1), u.anchor === "" && c(r, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (u.spaceBefore = !0), a && (u.comment = a, u.range[2] = l), u;
3236
+ }
3237
+ function pa({ options: t }, { offset: e, source: n, end: s }, i) {
3238
+ const a = new wn(n.substring(1));
3239
+ a.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), a.source.endsWith(":") && i(e + n.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
3240
+ const r = e + n.length, o = Ue(s, r, t.strict, i);
3241
+ return a.range = [e, r, o.offset], o.comment && (a.comment = o.comment), a;
3242
+ }
3243
+ function ha(t, e, { offset: n, start: s, value: i, end: a }, r) {
3244
+ const o = Object.assign({ _directives: e }, t), l = new Be(void 0, o), c = {
3245
+ atKey: !1,
3246
+ atRoot: !0,
3247
+ directives: l.directives,
3248
+ options: l.options,
3249
+ schema: l.schema
3250
+ }, d = Ne(s, {
3251
+ indicator: "doc-start",
3252
+ next: i ?? a?.[0],
3253
+ offset: n,
3254
+ onError: r,
3255
+ parentIndent: 0,
3256
+ startOnNewline: !0
3257
+ });
3258
+ d.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && r(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ? Un(c, i, d, r) : _t(c, d.end, s, null, d, r);
3259
+ const u = l.contents.range[2], f = Ue(a, u, !1, r);
3260
+ return f.comment && (l.comment = f.comment), l.range = [n, u, f.offset], l;
3261
+ }
3262
+ function _e(t) {
3263
+ if (typeof t == "number")
3264
+ return [t, t + 1];
3265
+ if (Array.isArray(t))
3266
+ return t.length === 2 ? t : [t[0], t[1]];
3267
+ const { offset: e, source: n } = t;
3268
+ return [e, e + (typeof n == "string" ? n.length : 1)];
3269
+ }
3270
+ function on(t) {
3271
+ let e = "", n = !1, s = !1;
3272
+ for (let i = 0; i < t.length; ++i) {
3273
+ const a = t[i];
3274
+ switch (a[0]) {
3275
+ case "#":
3276
+ e += (e === "" ? "" : s ? `
3277
+
3278
+ ` : `
3279
+ `) + (a.substring(1) || " "), n = !0, s = !1;
3280
+ break;
3281
+ case "%":
3282
+ t[i + 1]?.[0] !== "#" && (i += 1), n = !1;
3283
+ break;
3284
+ default:
3285
+ n || (s = !0), n = !1;
3286
+ }
3287
+ }
3288
+ return { comment: e, afterEmptyLine: s };
3289
+ }
3290
+ class ma {
3291
+ constructor(e = {}) {
3292
+ this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (n, s, i, a) => {
3293
+ const r = _e(n);
3294
+ a ? this.warnings.push(new Gi(r, s, i)) : this.errors.push(new Pe(r, s, i));
3295
+ }, this.directives = new Ye({ version: e.version || "1.2" }), this.options = e;
3296
+ }
3297
+ decorate(e, n) {
3298
+ const { comment: s, afterEmptyLine: i } = on(this.prelude);
3299
+ if (s) {
3300
+ const a = e.contents;
3301
+ if (n)
3302
+ e.comment = e.comment ? `${e.comment}
3303
+ ${s}` : s;
3304
+ else if (i || e.directives.docStart || !a)
3305
+ e.commentBefore = s;
3306
+ else if (me(a) && !a.flow && a.items.length > 0) {
3307
+ let r = a.items[0];
3308
+ vn(r) && (r = r.key);
3309
+ const o = r.commentBefore;
3310
+ r.commentBefore = o ? `${s}
3311
+ ${o}` : s;
3312
+ } else {
3313
+ const r = a.commentBefore;
3314
+ a.commentBefore = r ? `${s}
3315
+ ${r}` : s;
3316
+ }
3317
+ }
3318
+ if (n) {
3319
+ for (let a = 0; a < this.errors.length; ++a)
3320
+ e.errors.push(this.errors[a]);
3321
+ for (let a = 0; a < this.warnings.length; ++a)
3322
+ e.warnings.push(this.warnings[a]);
3323
+ } else
3324
+ e.errors = this.errors, e.warnings = this.warnings;
3325
+ this.prelude = [], this.errors = [], this.warnings = [];
3326
+ }
3327
+ /**
3328
+ * Current stream status information.
3329
+ *
3330
+ * Mostly useful at the end of input for an empty stream.
3331
+ */
3332
+ streamInfo() {
3333
+ return {
3334
+ comment: on(this.prelude).comment,
3335
+ directives: this.directives,
3336
+ errors: this.errors,
3337
+ warnings: this.warnings
3338
+ };
3339
+ }
3340
+ /**
3341
+ * Compose tokens into documents.
3342
+ *
3343
+ * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
3344
+ * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
3345
+ */
3346
+ *compose(e, n = !1, s = -1) {
3347
+ for (const i of e)
3348
+ yield* this.next(i);
3349
+ yield* this.end(n, s);
3350
+ }
3351
+ /** Advance the composer by one CST token. */
3352
+ *next(e) {
3353
+ switch (e.type) {
3354
+ case "directive":
3355
+ this.directives.add(e.source, (n, s, i) => {
3356
+ const a = _e(e);
3357
+ a[0] += n, this.onError(a, "BAD_DIRECTIVE", s, i);
3358
+ }), this.prelude.push(e.source), this.atDirectives = !0;
3359
+ break;
3360
+ case "document": {
3361
+ const n = ha(this.options, this.directives, e, this.onError);
3362
+ this.atDirectives && !n.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(n, !1), this.doc && (yield this.doc), this.doc = n, this.atDirectives = !1;
3363
+ break;
3364
+ }
3365
+ case "byte-order-mark":
3366
+ case "space":
3367
+ break;
3368
+ case "comment":
3369
+ case "newline":
3370
+ this.prelude.push(e.source);
3371
+ break;
3372
+ case "error": {
3373
+ const n = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, s = new Pe(_e(e), "UNEXPECTED_TOKEN", n);
3374
+ this.atDirectives || !this.doc ? this.errors.push(s) : this.doc.errors.push(s);
3375
+ break;
3376
+ }
3377
+ case "doc-end": {
3378
+ if (!this.doc) {
3379
+ const s = "Unexpected doc-end without preceding document";
3380
+ this.errors.push(new Pe(_e(e), "UNEXPECTED_TOKEN", s));
3381
+ break;
3382
+ }
3383
+ this.doc.directives.docEnd = !0;
3384
+ const n = Ue(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
3385
+ if (this.decorate(this.doc, !0), n.comment) {
3386
+ const s = this.doc.comment;
3387
+ this.doc.comment = s ? `${s}
3388
+ ${n.comment}` : n.comment;
3389
+ }
3390
+ this.doc.range[2] = n.offset;
3391
+ break;
3392
+ }
3393
+ default:
3394
+ this.errors.push(new Pe(_e(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
3395
+ }
3396
+ }
3397
+ /**
3398
+ * Call at end of input to yield any remaining document.
3399
+ *
3400
+ * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
3401
+ * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
3402
+ */
3403
+ *end(e = !1, n = -1) {
3404
+ if (this.doc)
3405
+ this.decorate(this.doc, !0), yield this.doc, this.doc = null;
3406
+ else if (e) {
3407
+ const s = Object.assign({ _directives: this.directives }, this.options), i = new Be(void 0, s);
3408
+ this.atDirectives && this.onError(n, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, n, n], this.decorate(i, !1), yield i;
3409
+ }
3410
+ }
3411
+ }
3412
+ class ga {
3413
+ constructor() {
3414
+ this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
3415
+ let n = 0, s = this.lineStarts.length;
3416
+ for (; n < s; ) {
3417
+ const a = n + s >> 1;
3418
+ this.lineStarts[a] < e ? n = a + 1 : s = a;
3419
+ }
3420
+ if (this.lineStarts[n] === e)
3421
+ return { line: n + 1, col: 1 };
3422
+ if (n === 0)
3423
+ return { line: 0, col: e };
3424
+ const i = this.lineStarts[n - 1];
3425
+ return { line: n, col: e - i + 1 };
3426
+ };
3427
+ }
3428
+ }
3429
+ function re(t, e) {
3430
+ for (let n = 0; n < t.length; ++n)
3431
+ if (t[n].type === e)
3432
+ return !0;
3433
+ return !1;
3434
+ }
3435
+ function ln(t) {
3436
+ for (let e = 0; e < t.length; ++e)
3437
+ switch (t[e].type) {
3438
+ case "space":
3439
+ case "comment":
3440
+ case "newline":
3441
+ break;
3442
+ default:
3443
+ return e;
3444
+ }
3445
+ return -1;
3446
+ }
3447
+ function qn(t) {
3448
+ switch (t?.type) {
3449
+ case "alias":
3450
+ case "scalar":
3451
+ case "single-quoted-scalar":
3452
+ case "double-quoted-scalar":
3453
+ case "flow-collection":
3454
+ return !0;
3455
+ default:
3456
+ return !1;
3457
+ }
3458
+ }
3459
+ function We(t) {
3460
+ switch (t.type) {
3461
+ case "document":
3462
+ return t.start;
3463
+ case "block-map": {
3464
+ const e = t.items[t.items.length - 1];
3465
+ return e.sep ?? e.start;
3466
+ }
3467
+ case "block-seq":
3468
+ return t.items[t.items.length - 1].start;
3469
+ /* istanbul ignore next should not happen */
3470
+ default:
3471
+ return [];
3472
+ }
3473
+ }
3474
+ function Se(t) {
3475
+ if (t.length === 0)
3476
+ return [];
3477
+ let e = t.length;
3478
+ e: for (; --e >= 0; )
3479
+ switch (t[e].type) {
3480
+ case "doc-start":
3481
+ case "explicit-key-ind":
3482
+ case "map-value-ind":
3483
+ case "seq-item-ind":
3484
+ case "newline":
3485
+ break e;
3486
+ }
3487
+ for (; t[++e]?.type === "space"; )
3488
+ ;
3489
+ return t.splice(e, t.length);
3490
+ }
3491
+ function Qe(t, e) {
3492
+ if (e.length < 1e5)
3493
+ Array.prototype.push.apply(t, e);
3494
+ else
3495
+ for (let n = 0; n < e.length; ++n)
3496
+ t.push(e[n]);
3497
+ }
3498
+ function cn(t) {
3499
+ if (t.start.type === "flow-seq-start")
3500
+ for (const e of t.items)
3501
+ e.sep && !e.value && !re(e.start, "explicit-key-ind") && !re(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, qn(e.value) ? e.value.end ? Qe(e.value.end, e.sep) : e.value.end = e.sep : Qe(e.start, e.sep), delete e.sep);
3502
+ }
3503
+ class ya {
3504
+ /**
3505
+ * @param onNewLine - If defined, called separately with the start position of
3506
+ * each new line (in `parse()`, including the start of input).
3507
+ */
3508
+ constructor(e) {
3509
+ this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new _s(), this.onNewLine = e;
3510
+ }
3511
+ /**
3512
+ * Parse `source` as a YAML stream.
3513
+ * If `incomplete`, a part of the last line may be left as a buffer for the next call.
3514
+ *
3515
+ * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
3516
+ *
3517
+ * @returns A generator of tokens representing each directive, document, and other structure.
3518
+ */
3519
+ *parse(e, n = !1) {
3520
+ this.onNewLine && this.offset === 0 && this.onNewLine(0);
3521
+ for (const s of this.lexer.lex(e, n))
3522
+ yield* this.next(s);
3523
+ n || (yield* this.end());
3524
+ }
3525
+ /**
3526
+ * Advance the parser by the `source` of one lexical token.
3527
+ */
3528
+ *next(e) {
3529
+ if (this.source = e, this.atScalar) {
3530
+ this.atScalar = !1, yield* this.step(), this.offset += e.length;
3531
+ return;
3532
+ }
3533
+ const n = Ds(e);
3534
+ if (n)
3535
+ if (n === "scalar")
3536
+ this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
3537
+ else {
3538
+ switch (this.type = n, yield* this.step(), n) {
3539
+ case "newline":
3540
+ this.atNewLine = !0, this.indent = 0, this.onNewLine && this.onNewLine(this.offset + e.length);
3541
+ break;
3542
+ case "space":
3543
+ this.atNewLine && e[0] === " " && (this.indent += e.length);
3544
+ break;
3545
+ case "explicit-key-ind":
3546
+ case "map-value-ind":
3547
+ case "seq-item-ind":
3548
+ this.atNewLine && (this.indent += e.length);
3549
+ break;
3550
+ case "doc-mode":
3551
+ case "flow-error-end":
3552
+ return;
3553
+ default:
3554
+ this.atNewLine = !1;
3555
+ }
3556
+ this.offset += e.length;
3557
+ }
3558
+ else {
3559
+ const s = `Not a YAML token: ${e}`;
3560
+ yield* this.pop({ type: "error", offset: this.offset, message: s, source: e }), this.offset += e.length;
3561
+ }
3562
+ }
3563
+ /** Call at end of input to push out any remaining constructions */
3564
+ *end() {
3565
+ for (; this.stack.length > 0; )
3566
+ yield* this.pop();
3567
+ }
3568
+ get sourceToken() {
3569
+ return {
3570
+ type: this.type,
3571
+ offset: this.offset,
3572
+ indent: this.indent,
3573
+ source: this.source
3574
+ };
3575
+ }
3576
+ *step() {
3577
+ const e = this.peek(1);
3578
+ if (this.type === "doc-end" && e?.type !== "doc-end") {
3579
+ for (; this.stack.length > 0; )
3580
+ yield* this.pop();
3581
+ this.stack.push({
3582
+ type: "doc-end",
3583
+ offset: this.offset,
3584
+ source: this.source
3585
+ });
3586
+ return;
3587
+ }
3588
+ if (!e)
3589
+ return yield* this.stream();
3590
+ switch (e.type) {
3591
+ case "document":
3592
+ return yield* this.document(e);
3593
+ case "alias":
3594
+ case "scalar":
3595
+ case "single-quoted-scalar":
3596
+ case "double-quoted-scalar":
3597
+ return yield* this.scalar(e);
3598
+ case "block-scalar":
3599
+ return yield* this.blockScalar(e);
3600
+ case "block-map":
3601
+ return yield* this.blockMap(e);
3602
+ case "block-seq":
3603
+ return yield* this.blockSequence(e);
3604
+ case "flow-collection":
3605
+ return yield* this.flowCollection(e);
3606
+ case "doc-end":
3607
+ return yield* this.documentEnd(e);
3608
+ }
3609
+ yield* this.pop();
3610
+ }
3611
+ peek(e) {
3612
+ return this.stack[this.stack.length - e];
3613
+ }
3614
+ *pop(e) {
3615
+ const n = e ?? this.stack.pop();
3616
+ if (!n)
3617
+ yield { type: "error", offset: this.offset, source: "", message: "Tried to pop an empty stack" };
3618
+ else if (this.stack.length === 0)
3619
+ yield n;
3620
+ else {
3621
+ const s = this.peek(1);
3622
+ switch (n.type === "block-scalar" ? n.indent = "indent" in s ? s.indent : 0 : n.type === "flow-collection" && s.type === "document" && (n.indent = 0), n.type === "flow-collection" && cn(n), s.type) {
3623
+ case "document":
3624
+ s.value = n;
3625
+ break;
3626
+ case "block-scalar":
3627
+ s.props.push(n);
3628
+ break;
3629
+ case "block-map": {
3630
+ const i = s.items[s.items.length - 1];
3631
+ if (i.value) {
3632
+ s.items.push({ start: [], key: n, sep: [] }), this.onKeyLine = !0;
3633
+ return;
3634
+ } else if (i.sep)
3635
+ i.value = n;
3636
+ else {
3637
+ Object.assign(i, { key: n, sep: [] }), this.onKeyLine = !i.explicitKey;
3638
+ return;
3639
+ }
3640
+ break;
3641
+ }
3642
+ case "block-seq": {
3643
+ const i = s.items[s.items.length - 1];
3644
+ i.value ? s.items.push({ start: [], value: n }) : i.value = n;
3645
+ break;
3646
+ }
3647
+ case "flow-collection": {
3648
+ const i = s.items[s.items.length - 1];
3649
+ !i || i.value ? s.items.push({ start: [], key: n, sep: [] }) : i.sep ? i.value = n : Object.assign(i, { key: n, sep: [] });
3650
+ return;
3651
+ }
3652
+ /* istanbul ignore next should not happen */
3653
+ default:
3654
+ yield* this.pop(), yield* this.pop(n);
3655
+ }
3656
+ if ((s.type === "document" || s.type === "block-map" || s.type === "block-seq") && (n.type === "block-map" || n.type === "block-seq")) {
3657
+ const i = n.items[n.items.length - 1];
3658
+ i && !i.sep && !i.value && i.start.length > 0 && ln(i.start) === -1 && (n.indent === 0 || i.start.every((a) => a.type !== "comment" || a.indent < n.indent)) && (s.type === "document" ? s.end = i.start : s.items.push({ start: i.start }), n.items.splice(-1, 1));
3659
+ }
3660
+ }
3661
+ }
3662
+ *stream() {
3663
+ switch (this.type) {
3664
+ case "directive-line":
3665
+ yield { type: "directive", offset: this.offset, source: this.source };
3666
+ return;
3667
+ case "byte-order-mark":
3668
+ case "space":
3669
+ case "comment":
3670
+ case "newline":
3671
+ yield this.sourceToken;
3672
+ return;
3673
+ case "doc-mode":
3674
+ case "doc-start": {
3675
+ const e = {
3676
+ type: "document",
3677
+ offset: this.offset,
3678
+ start: []
3679
+ };
3680
+ this.type === "doc-start" && e.start.push(this.sourceToken), this.stack.push(e);
3681
+ return;
3682
+ }
3683
+ }
3684
+ yield {
3685
+ type: "error",
3686
+ offset: this.offset,
3687
+ message: `Unexpected ${this.type} token in YAML stream`,
3688
+ source: this.source
3689
+ };
3690
+ }
3691
+ *document(e) {
3692
+ if (e.value)
3693
+ return yield* this.lineEnd(e);
3694
+ switch (this.type) {
3695
+ case "doc-start": {
3696
+ ln(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
3697
+ return;
3698
+ }
3699
+ case "anchor":
3700
+ case "tag":
3701
+ case "space":
3702
+ case "comment":
3703
+ case "newline":
3704
+ e.start.push(this.sourceToken);
3705
+ return;
3706
+ }
3707
+ const n = this.startBlockValue(e);
3708
+ n ? this.stack.push(n) : yield {
3709
+ type: "error",
3710
+ offset: this.offset,
3711
+ message: `Unexpected ${this.type} token in YAML document`,
3712
+ source: this.source
3713
+ };
3714
+ }
3715
+ *scalar(e) {
3716
+ if (this.type === "map-value-ind") {
3717
+ const n = We(this.peek(2)), s = Se(n);
3718
+ let i;
3719
+ e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
3720
+ const a = {
3721
+ type: "block-map",
3722
+ offset: e.offset,
3723
+ indent: e.indent,
3724
+ items: [{ start: s, key: e, sep: i }]
3725
+ };
3726
+ this.onKeyLine = !0, this.stack[this.stack.length - 1] = a;
3727
+ } else
3728
+ yield* this.lineEnd(e);
3729
+ }
3730
+ *blockScalar(e) {
3731
+ switch (this.type) {
3732
+ case "space":
3733
+ case "comment":
3734
+ case "newline":
3735
+ e.props.push(this.sourceToken);
3736
+ return;
3737
+ case "scalar":
3738
+ if (e.source = this.source, this.atNewLine = !0, this.indent = 0, this.onNewLine) {
3739
+ let n = this.source.indexOf(`
3740
+ `) + 1;
3741
+ for (; n !== 0; )
3742
+ this.onNewLine(this.offset + n), n = this.source.indexOf(`
3743
+ `, n) + 1;
3744
+ }
3745
+ yield* this.pop();
3746
+ break;
3747
+ /* istanbul ignore next should not happen */
3748
+ default:
3749
+ yield* this.pop(), yield* this.step();
3750
+ }
3751
+ }
3752
+ *blockMap(e) {
3753
+ const n = e.items[e.items.length - 1];
3754
+ switch (this.type) {
3755
+ case "newline":
3756
+ if (this.onKeyLine = !1, n.value) {
3757
+ const s = "end" in n.value ? n.value.end : void 0;
3758
+ (Array.isArray(s) ? s[s.length - 1] : void 0)?.type === "comment" ? s?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
3759
+ } else n.sep ? n.sep.push(this.sourceToken) : n.start.push(this.sourceToken);
3760
+ return;
3761
+ case "space":
3762
+ case "comment":
3763
+ if (n.value)
3764
+ e.items.push({ start: [this.sourceToken] });
3765
+ else if (n.sep)
3766
+ n.sep.push(this.sourceToken);
3767
+ else {
3768
+ if (this.atIndentedComment(n.start, e.indent)) {
3769
+ const i = e.items[e.items.length - 2]?.value?.end;
3770
+ if (Array.isArray(i)) {
3771
+ Qe(i, n.start), i.push(this.sourceToken), e.items.pop();
3772
+ return;
3773
+ }
3774
+ }
3775
+ n.start.push(this.sourceToken);
3776
+ }
3777
+ return;
3778
+ }
3779
+ if (this.indent >= e.indent) {
3780
+ const s = !this.onKeyLine && this.indent === e.indent, i = s && (n.sep || n.explicitKey) && this.type !== "seq-item-ind";
3781
+ let a = [];
3782
+ if (i && n.sep && !n.value) {
3783
+ const r = [];
3784
+ for (let o = 0; o < n.sep.length; ++o) {
3785
+ const l = n.sep[o];
3786
+ switch (l.type) {
3787
+ case "newline":
3788
+ r.push(o);
3789
+ break;
3790
+ case "space":
3791
+ break;
3792
+ case "comment":
3793
+ l.indent > e.indent && (r.length = 0);
3794
+ break;
3795
+ default:
3796
+ r.length = 0;
3797
+ }
3798
+ }
3799
+ r.length >= 2 && (a = n.sep.splice(r[1]));
3800
+ }
3801
+ switch (this.type) {
3802
+ case "anchor":
3803
+ case "tag":
3804
+ i || n.value ? (a.push(this.sourceToken), e.items.push({ start: a }), this.onKeyLine = !0) : n.sep ? n.sep.push(this.sourceToken) : n.start.push(this.sourceToken);
3805
+ return;
3806
+ case "explicit-key-ind":
3807
+ !n.sep && !n.explicitKey ? (n.start.push(this.sourceToken), n.explicitKey = !0) : i || n.value ? (a.push(this.sourceToken), e.items.push({ start: a, explicitKey: !0 })) : this.stack.push({
3808
+ type: "block-map",
3809
+ offset: this.offset,
3810
+ indent: this.indent,
3811
+ items: [{ start: [this.sourceToken], explicitKey: !0 }]
3812
+ }), this.onKeyLine = !0;
3813
+ return;
3814
+ case "map-value-ind":
3815
+ if (n.explicitKey)
3816
+ if (n.sep)
3817
+ if (n.value)
3818
+ e.items.push({ start: [], key: null, sep: [this.sourceToken] });
3819
+ else if (re(n.sep, "map-value-ind"))
3820
+ this.stack.push({
3821
+ type: "block-map",
3822
+ offset: this.offset,
3823
+ indent: this.indent,
3824
+ items: [{ start: a, key: null, sep: [this.sourceToken] }]
3825
+ });
3826
+ else if (qn(n.key) && !re(n.sep, "newline")) {
3827
+ const r = Se(n.start), o = n.key, l = n.sep;
3828
+ l.push(this.sourceToken), delete n.key, delete n.sep, this.stack.push({
3829
+ type: "block-map",
3830
+ offset: this.offset,
3831
+ indent: this.indent,
3832
+ items: [{ start: r, key: o, sep: l }]
3833
+ });
3834
+ } else a.length > 0 ? n.sep = n.sep.concat(a, this.sourceToken) : n.sep.push(this.sourceToken);
3835
+ else if (re(n.start, "newline"))
3836
+ Object.assign(n, { key: null, sep: [this.sourceToken] });
3837
+ else {
3838
+ const r = Se(n.start);
3839
+ this.stack.push({
3840
+ type: "block-map",
3841
+ offset: this.offset,
3842
+ indent: this.indent,
3843
+ items: [{ start: r, key: null, sep: [this.sourceToken] }]
3844
+ });
3845
+ }
3846
+ else
3847
+ n.sep ? n.value || i ? e.items.push({ start: a, key: null, sep: [this.sourceToken] }) : re(n.sep, "map-value-ind") ? this.stack.push({
3848
+ type: "block-map",
3849
+ offset: this.offset,
3850
+ indent: this.indent,
3851
+ items: [{ start: [], key: null, sep: [this.sourceToken] }]
3852
+ }) : n.sep.push(this.sourceToken) : Object.assign(n, { key: null, sep: [this.sourceToken] });
3853
+ this.onKeyLine = !0;
3854
+ return;
3855
+ case "alias":
3856
+ case "scalar":
3857
+ case "single-quoted-scalar":
3858
+ case "double-quoted-scalar": {
3859
+ const r = this.flowScalar(this.type);
3860
+ i || n.value ? (e.items.push({ start: a, key: r, sep: [] }), this.onKeyLine = !0) : n.sep ? this.stack.push(r) : (Object.assign(n, { key: r, sep: [] }), this.onKeyLine = !0);
3861
+ return;
3862
+ }
3863
+ default: {
3864
+ const r = this.startBlockValue(e);
3865
+ if (r) {
3866
+ if (r.type === "block-seq") {
3867
+ if (!n.explicitKey && n.sep && !re(n.sep, "newline")) {
3868
+ yield* this.pop({
3869
+ type: "error",
3870
+ offset: this.offset,
3871
+ message: "Unexpected block-seq-ind on same line with key",
3872
+ source: this.source
3873
+ });
3874
+ return;
3875
+ }
3876
+ } else s && e.items.push({ start: a });
3877
+ this.stack.push(r);
3878
+ return;
3879
+ }
3880
+ }
3881
+ }
3882
+ }
3883
+ yield* this.pop(), yield* this.step();
3884
+ }
3885
+ *blockSequence(e) {
3886
+ const n = e.items[e.items.length - 1];
3887
+ switch (this.type) {
3888
+ case "newline":
3889
+ if (n.value) {
3890
+ const s = "end" in n.value ? n.value.end : void 0;
3891
+ (Array.isArray(s) ? s[s.length - 1] : void 0)?.type === "comment" ? s?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
3892
+ } else
3893
+ n.start.push(this.sourceToken);
3894
+ return;
3895
+ case "space":
3896
+ case "comment":
3897
+ if (n.value)
3898
+ e.items.push({ start: [this.sourceToken] });
3899
+ else {
3900
+ if (this.atIndentedComment(n.start, e.indent)) {
3901
+ const i = e.items[e.items.length - 2]?.value?.end;
3902
+ if (Array.isArray(i)) {
3903
+ Qe(i, n.start), i.push(this.sourceToken), e.items.pop();
3904
+ return;
3905
+ }
3906
+ }
3907
+ n.start.push(this.sourceToken);
3908
+ }
3909
+ return;
3910
+ case "anchor":
3911
+ case "tag":
3912
+ if (n.value || this.indent <= e.indent)
3913
+ break;
3914
+ n.start.push(this.sourceToken);
3915
+ return;
3916
+ case "seq-item-ind":
3917
+ if (this.indent !== e.indent)
3918
+ break;
3919
+ n.value || re(n.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : n.start.push(this.sourceToken);
3920
+ return;
3921
+ }
3922
+ if (this.indent > e.indent) {
3923
+ const s = this.startBlockValue(e);
3924
+ if (s) {
3925
+ this.stack.push(s);
3926
+ return;
3927
+ }
3928
+ }
3929
+ yield* this.pop(), yield* this.step();
3930
+ }
3931
+ *flowCollection(e) {
3932
+ const n = e.items[e.items.length - 1];
3933
+ if (this.type === "flow-error-end") {
3934
+ let s;
3935
+ do
3936
+ yield* this.pop(), s = this.peek(1);
3937
+ while (s?.type === "flow-collection");
3938
+ } else if (e.end.length === 0) {
3939
+ switch (this.type) {
3940
+ case "comma":
3941
+ case "explicit-key-ind":
3942
+ !n || n.sep ? e.items.push({ start: [this.sourceToken] }) : n.start.push(this.sourceToken);
3943
+ return;
3944
+ case "map-value-ind":
3945
+ !n || n.value ? e.items.push({ start: [], key: null, sep: [this.sourceToken] }) : n.sep ? n.sep.push(this.sourceToken) : Object.assign(n, { key: null, sep: [this.sourceToken] });
3946
+ return;
3947
+ case "space":
3948
+ case "comment":
3949
+ case "newline":
3950
+ case "anchor":
3951
+ case "tag":
3952
+ !n || n.value ? e.items.push({ start: [this.sourceToken] }) : n.sep ? n.sep.push(this.sourceToken) : n.start.push(this.sourceToken);
3953
+ return;
3954
+ case "alias":
3955
+ case "scalar":
3956
+ case "single-quoted-scalar":
3957
+ case "double-quoted-scalar": {
3958
+ const i = this.flowScalar(this.type);
3959
+ !n || n.value ? e.items.push({ start: [], key: i, sep: [] }) : n.sep ? this.stack.push(i) : Object.assign(n, { key: i, sep: [] });
3960
+ return;
3961
+ }
3962
+ case "flow-map-end":
3963
+ case "flow-seq-end":
3964
+ e.end.push(this.sourceToken);
3965
+ return;
3966
+ }
3967
+ const s = this.startBlockValue(e);
3968
+ s ? this.stack.push(s) : (yield* this.pop(), yield* this.step());
3969
+ } else {
3970
+ const s = this.peek(2);
3971
+ if (s.type === "block-map" && (this.type === "map-value-ind" && s.indent === e.indent || this.type === "newline" && !s.items[s.items.length - 1].sep))
3972
+ yield* this.pop(), yield* this.step();
3973
+ else if (this.type === "map-value-ind" && s.type !== "flow-collection") {
3974
+ const i = We(s), a = Se(i);
3975
+ cn(e);
3976
+ const r = e.end.splice(1, e.end.length);
3977
+ r.push(this.sourceToken);
3978
+ const o = {
3979
+ type: "block-map",
3980
+ offset: e.offset,
3981
+ indent: e.indent,
3982
+ items: [{ start: a, key: e, sep: r }]
3983
+ };
3984
+ this.onKeyLine = !0, this.stack[this.stack.length - 1] = o;
3985
+ } else
3986
+ yield* this.lineEnd(e);
3987
+ }
3988
+ }
3989
+ flowScalar(e) {
3990
+ if (this.onNewLine) {
3991
+ let n = this.source.indexOf(`
3992
+ `) + 1;
3993
+ for (; n !== 0; )
3994
+ this.onNewLine(this.offset + n), n = this.source.indexOf(`
3995
+ `, n) + 1;
3996
+ }
3997
+ return {
3998
+ type: e,
3999
+ offset: this.offset,
4000
+ indent: this.indent,
4001
+ source: this.source
4002
+ };
4003
+ }
4004
+ startBlockValue(e) {
4005
+ switch (this.type) {
4006
+ case "alias":
4007
+ case "scalar":
4008
+ case "single-quoted-scalar":
4009
+ case "double-quoted-scalar":
4010
+ return this.flowScalar(this.type);
4011
+ case "block-scalar-header":
4012
+ return {
4013
+ type: "block-scalar",
4014
+ offset: this.offset,
4015
+ indent: this.indent,
4016
+ props: [this.sourceToken],
4017
+ source: ""
4018
+ };
4019
+ case "flow-map-start":
4020
+ case "flow-seq-start":
4021
+ return {
4022
+ type: "flow-collection",
4023
+ offset: this.offset,
4024
+ indent: this.indent,
4025
+ start: this.sourceToken,
4026
+ items: [],
4027
+ end: []
4028
+ };
4029
+ case "seq-item-ind":
4030
+ return {
4031
+ type: "block-seq",
4032
+ offset: this.offset,
4033
+ indent: this.indent,
4034
+ items: [{ start: [this.sourceToken] }]
4035
+ };
4036
+ case "explicit-key-ind": {
4037
+ this.onKeyLine = !0;
4038
+ const n = We(e), s = Se(n);
4039
+ return s.push(this.sourceToken), {
4040
+ type: "block-map",
4041
+ offset: this.offset,
4042
+ indent: this.indent,
4043
+ items: [{ start: s, explicitKey: !0 }]
4044
+ };
4045
+ }
4046
+ case "map-value-ind": {
4047
+ this.onKeyLine = !0;
4048
+ const n = We(e), s = Se(n);
4049
+ return {
4050
+ type: "block-map",
4051
+ offset: this.offset,
4052
+ indent: this.indent,
4053
+ items: [{ start: s, key: null, sep: [this.sourceToken] }]
4054
+ };
4055
+ }
4056
+ }
4057
+ return null;
4058
+ }
4059
+ atIndentedComment(e, n) {
4060
+ return this.type !== "comment" || this.indent <= n ? !1 : e.every((s) => s.type === "newline" || s.type === "space");
4061
+ }
4062
+ *documentEnd(e) {
4063
+ this.type !== "doc-mode" && (e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop()));
4064
+ }
4065
+ *lineEnd(e) {
4066
+ switch (this.type) {
4067
+ case "comma":
4068
+ case "doc-start":
4069
+ case "doc-end":
4070
+ case "flow-seq-end":
4071
+ case "flow-map-end":
4072
+ case "map-value-ind":
4073
+ yield* this.pop(), yield* this.step();
4074
+ break;
4075
+ case "newline":
4076
+ this.onKeyLine = !1;
4077
+ default:
4078
+ e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop());
4079
+ }
4080
+ }
4081
+ }
4082
+ function ba(t) {
4083
+ const e = t.prettyErrors !== !1;
4084
+ return { lineCounter: t.lineCounter || e && new ga() || null, prettyErrors: e };
4085
+ }
4086
+ function wa(t, e = {}) {
4087
+ const { lineCounter: n, prettyErrors: s } = ba(e), i = new ya(n?.addNewLine), a = new ma(e);
4088
+ let r = null;
4089
+ for (const o of a.compose(i.parse(t), !0, t.length))
4090
+ if (!r)
4091
+ r = o;
4092
+ else if (r.options.logLevel !== "silent") {
4093
+ r.errors.push(new Pe(o.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
4094
+ break;
4095
+ }
4096
+ return s && n && (r.errors.forEach(an(t, n)), r.warnings.forEach(an(t, n))), r;
4097
+ }
4098
+ function Na(t, e, n) {
4099
+ let s;
4100
+ const i = wa(t, n);
4101
+ if (!i)
4102
+ return null;
4103
+ if (i.warnings.forEach((a) => Fs(i.options.logLevel, a)), i.errors.length > 0) {
4104
+ if (i.options.logLevel !== "silent")
4105
+ throw i.errors[0];
4106
+ i.errors = [];
4107
+ }
4108
+ return i.toJS(Object.assign({ reviver: s }, n));
4109
+ }
4110
+ function Ea(t, e, n) {
4111
+ let s = null;
4112
+ if (typeof e == "function" || Array.isArray(e) ? s = e : n === void 0 && e && (n = e), typeof n == "string" && (n = n.length), typeof n == "number") {
4113
+ const i = Math.round(n);
4114
+ n = i < 1 ? void 0 : i > 8 ? { indent: 8 } : { indent: i };
4115
+ }
4116
+ if (t === void 0) {
4117
+ const { keepUndefined: i } = n ?? e ?? {};
4118
+ if (!i)
4119
+ return;
4120
+ }
4121
+ return Ps(t) && !s ? t.toString(n) : new Be(t, s, n).toString(n);
4122
+ }
4123
+ function Ca({ icon: t, size: e }) {
4124
+ const { Icon: n } = Nt().look;
4125
+ return /* @__PURE__ */ _.jsx(n, { icon: t, size: e });
4126
+ }
4127
+ function Oa({ onClick: t }) {
4128
+ const { BackButton: e } = Nt();
4129
+ return /* @__PURE__ */ _.jsx(e, { onClick: t });
4130
+ }
4131
+ const un = 50, va = 500;
4132
+ function Ta({ app: t, networks: e, onCancel: n, onSubmit: s }) {
4133
+ const { t: i } = Rs(), [a] = Q.useForm(), r = Nt().look, o = !t, l = t ? Wt(t) : void 0, c = [...e.choices];
4134
+ for (const g of t ? [Wt(t), ...t.references ?? []] : [])
4135
+ c.some((p) => p.id === g.id) || c.push(g);
4136
+ const d = (g) => c.find((p) => p.id === g), u = Q.useWatch("network", a) ?? l?.id, f = () => {
4137
+ a.validateFields().then((g) => {
4138
+ const p = o && g.network ? d(g.network) : void 0;
4139
+ o && !p || s(
4140
+ {
4141
+ name: g.name.trim(),
4142
+ description: g.description ?? "",
4143
+ icon: g.icon,
4144
+ color: g.color,
4145
+ tags: g.tags ?? [],
4146
+ references: (g.references ?? []).filter((m) => m !== u).map(d).filter((m) => !!m)
4147
+ },
4148
+ p
4149
+ );
4150
+ });
4151
+ }, h = (g) => c.filter((p) => p.id !== g).map((p) => ({ value: p.id, label: p.name }));
4152
+ return /* @__PURE__ */ _.jsx(
4153
+ Bs,
4154
+ {
4155
+ open: !0,
4156
+ destroyOnHidden: !0,
4157
+ width: 640,
4158
+ title: i(o ? "workshopLab.list.create" : "workshopLab.list.editTitle"),
4159
+ okText: i(o ? "workshopLab.list.createOk" : "workshopLab.list.save"),
4160
+ onOk: f,
4161
+ onCancel: n,
4162
+ children: /* @__PURE__ */ _.jsxs(
4163
+ Q,
4164
+ {
4165
+ form: a,
4166
+ layout: "vertical",
4167
+ initialValues: {
4168
+ network: l?.id ?? e.initial,
4169
+ references: (t?.references ?? []).map((g) => g.id),
4170
+ name: t?.name ?? "",
4171
+ description: t?.description ?? "",
4172
+ icon: t?.icon ?? r.defaultIcon,
4173
+ color: t?.color ?? r.defaultColor,
4174
+ tags: t?.tags ?? []
4175
+ },
4176
+ children: [
4177
+ e.error && /* @__PURE__ */ _.jsx(
4178
+ Us,
4179
+ {
4180
+ type: "error",
4181
+ showIcon: !0,
4182
+ message: e.error,
4183
+ action: e.reload && /* @__PURE__ */ _.jsx(gt, { size: "small", loading: e.loading, onClick: e.reload, children: i("workshopLab.store.retry") })
4184
+ }
4185
+ ),
4186
+ /* @__PURE__ */ _.jsx(
4187
+ Q.Item,
4188
+ {
4189
+ label: i("workshopLab.list.networkLabel"),
4190
+ name: "network",
4191
+ extra: i(o ? "workshopLab.list.networkHint" : "workshopLab.list.networkFixed"),
4192
+ rules: [{ required: !0, message: i("workshopLab.list.networkPlaceholder") }],
4193
+ children: /* @__PURE__ */ _.jsx(
4194
+ Vt,
4195
+ {
4196
+ showSearch: !0,
4197
+ optionFilterProp: "label",
4198
+ disabled: !o,
4199
+ loading: e.loading,
4200
+ placeholder: i("workshopLab.list.networkPlaceholder"),
4201
+ options: h()
4202
+ }
4203
+ )
4204
+ }
4205
+ ),
4206
+ /* @__PURE__ */ _.jsx(
4207
+ Q.Item,
4208
+ {
4209
+ label: i("workshopLab.list.referencesLabel"),
4210
+ name: "references",
4211
+ extra: i("workshopLab.list.referencesHint"),
4212
+ children: /* @__PURE__ */ _.jsx(
4213
+ Vt,
4214
+ {
4215
+ mode: "multiple",
4216
+ allowClear: !0,
4217
+ showSearch: !0,
4218
+ optionFilterProp: "label",
4219
+ loading: e.loading,
4220
+ placeholder: i("workshopLab.list.referencesPlaceholder"),
4221
+ options: h(u)
4222
+ }
4223
+ )
4224
+ }
4225
+ ),
4226
+ /* @__PURE__ */ _.jsx(
4227
+ Q.Item,
4228
+ {
4229
+ label: i("workshopLab.list.nameLabel"),
4230
+ name: "name",
4231
+ rules: [
4232
+ { required: !0, whitespace: !0, message: i("workshopLab.list.nameRequired") },
4233
+ { max: un }
4234
+ ],
4235
+ children: /* @__PURE__ */ _.jsx(
4236
+ Gt,
4237
+ {
4238
+ autoFocus: !0,
4239
+ maxLength: un,
4240
+ showCount: !0,
4241
+ placeholder: i("workshopLab.list.namePlaceholder")
4242
+ }
4243
+ )
4244
+ }
4245
+ ),
4246
+ /* @__PURE__ */ _.jsxs(qs, { gutter: 16, children: [
4247
+ /* @__PURE__ */ _.jsx(Yt, { span: 12, children: /* @__PURE__ */ _.jsx(Q.Item, { label: i("workshopLab.list.iconLabel"), name: "icon", children: /* @__PURE__ */ _.jsx(r.IconSelect, {}) }) }),
4248
+ /* @__PURE__ */ _.jsx(Yt, { span: 12, children: /* @__PURE__ */ _.jsx(Q.Item, { label: i("workshopLab.list.colorLabel"), name: "color", children: /* @__PURE__ */ _.jsx(r.ColorSelect, {}) }) })
4249
+ ] }),
4250
+ /* @__PURE__ */ _.jsx(
4251
+ Q.Item,
4252
+ {
4253
+ label: i("workshopLab.list.tagsLabel"),
4254
+ name: "tags",
4255
+ rules: [{ validator: (g, p) => r.validateTags(p) }],
4256
+ children: /* @__PURE__ */ _.jsx(r.TagsSelect, {})
4257
+ }
4258
+ ),
4259
+ /* @__PURE__ */ _.jsx(Q.Item, { label: i("workshopLab.list.descriptionLabel"), name: "description", children: /* @__PURE__ */ _.jsx(
4260
+ Gt.TextArea,
4261
+ {
4262
+ rows: 3,
4263
+ maxLength: va,
4264
+ showCount: !0,
4265
+ placeholder: i("workshopLab.list.descriptionPlaceholder")
4266
+ }
4267
+ ) })
4268
+ ]
4269
+ }
4270
+ )
4271
+ }
4272
+ );
4273
+ }
4274
+ export {
4275
+ Ta as A,
4276
+ Oa as B,
4277
+ Ia as R,
4278
+ $n as U,
4279
+ Ca as a,
4280
+ Na as p,
4281
+ Ea as s
4282
+ };