@dovetail-v2/refine 0.2.0-alpha.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,301 +25,308 @@ function getDefaultExportFromCjs(x) {
25
25
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
26
26
  }
27
27
  var dayjs_min = { exports: {} };
28
- (function(module, exports) {
29
- !function(t2, e2) {
30
- module.exports = e2();
31
- }(commonjsGlobal, function() {
32
- var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i = "second", s2 = "minute", u = "hour", a2 = "day", o = "week", c2 = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
33
- var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
34
- return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
35
- } }, m = function(t3, e3, n3) {
36
- var r3 = String(t3);
37
- return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
38
- }, v = { s: m, z: function(t3) {
39
- var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i2 = n3 % 60;
40
- return (e3 <= 0 ? "+" : "-") + m(r3, 2, "0") + ":" + m(i2, 2, "0");
41
- }, m: function t3(e3, n3) {
42
- if (e3.date() < n3.date())
43
- return -t3(n3, e3);
44
- var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i2 = e3.clone().add(r3, c2), s3 = n3 - i2 < 0, u2 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
45
- return +(-(r3 + (n3 - i2) / (s3 ? i2 - u2 : u2 - i2)) || 0);
46
- }, a: function(t3) {
47
- return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
48
- }, p: function(t3) {
49
- return { M: c2, y: h, w: o, d: a2, D: d, h: u, m: s2, s: i, ms: r2, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
50
- }, u: function(t3) {
51
- return void 0 === t3;
52
- } }, g = "en", D = {};
53
- D[g] = M;
54
- var p = "$isDayjsObject", S = function(t3) {
55
- return t3 instanceof _ || !(!t3 || !t3[p]);
56
- }, w = function t3(e3, n3, r3) {
57
- var i2;
58
- if (!e3)
59
- return g;
60
- if ("string" == typeof e3) {
61
- var s3 = e3.toLowerCase();
62
- D[s3] && (i2 = s3), n3 && (D[s3] = n3, i2 = s3);
63
- var u2 = e3.split("-");
64
- if (!i2 && u2.length > 1)
65
- return t3(u2[0]);
66
- } else {
67
- var a3 = e3.name;
68
- D[a3] = e3, i2 = a3;
69
- }
70
- return !r3 && i2 && (g = i2), i2 || !r3 && g;
71
- }, O = function(t3, e3) {
72
- if (S(t3))
73
- return t3.clone();
74
- var n3 = "object" == typeof e3 ? e3 : {};
75
- return n3.date = t3, n3.args = arguments, new _(n3);
76
- }, b = v;
77
- b.l = w, b.i = S, b.w = function(t3, e3) {
78
- return O(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
79
- };
80
- var _ = function() {
81
- function M2(t3) {
82
- this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
83
- }
84
- var m2 = M2.prototype;
85
- return m2.parse = function(t3) {
86
- this.$d = function(t4) {
87
- var e3 = t4.date, n3 = t4.utc;
88
- if (null === e3)
89
- return /* @__PURE__ */ new Date(NaN);
90
- if (b.u(e3))
91
- return /* @__PURE__ */ new Date();
92
- if (e3 instanceof Date)
93
- return new Date(e3);
94
- if ("string" == typeof e3 && !/Z$/i.test(e3)) {
95
- var r3 = e3.match($);
96
- if (r3) {
97
- var i2 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
98
- return n3 ? new Date(Date.UTC(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
99
- }
100
- }
101
- return new Date(e3);
102
- }(t3), this.init();
103
- }, m2.init = function() {
104
- var t3 = this.$d;
105
- this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
106
- }, m2.$utils = function() {
107
- return b;
108
- }, m2.isValid = function() {
109
- return !(this.$d.toString() === l);
110
- }, m2.isSame = function(t3, e3) {
111
- var n3 = O(t3);
112
- return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
113
- }, m2.isAfter = function(t3, e3) {
114
- return O(t3) < this.startOf(e3);
115
- }, m2.isBefore = function(t3, e3) {
116
- return this.endOf(e3) < O(t3);
117
- }, m2.$g = function(t3, e3, n3) {
118
- return b.u(t3) ? this[e3] : this.set(n3, t3);
119
- }, m2.unix = function() {
120
- return Math.floor(this.valueOf() / 1e3);
121
- }, m2.valueOf = function() {
122
- return this.$d.getTime();
123
- }, m2.startOf = function(t3, e3) {
124
- var n3 = this, r3 = !!b.u(e3) || e3, f2 = b.p(t3), l2 = function(t4, e4) {
125
- var i2 = b.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
126
- return r3 ? i2 : i2.endOf(a2);
127
- }, $2 = function(t4, e4) {
128
- return b.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
129
- }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
130
- switch (f2) {
131
- case h:
132
- return r3 ? l2(1, 0) : l2(31, 11);
133
- case c2:
134
- return r3 ? l2(1, M3) : l2(0, M3 + 1);
135
- case o:
136
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
137
- return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
138
- case a2:
139
- case d:
140
- return $2(v2 + "Hours", 0);
141
- case u:
142
- return $2(v2 + "Minutes", 1);
143
- case s2:
144
- return $2(v2 + "Seconds", 2);
145
- case i:
146
- return $2(v2 + "Milliseconds", 3);
147
- default:
148
- return this.clone();
149
- }
150
- }, m2.endOf = function(t3) {
151
- return this.startOf(t3, false);
152
- }, m2.$set = function(t3, e3) {
153
- var n3, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a2] = f2 + "Date", n3[d] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i] = f2 + "Seconds", n3[r2] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a2 ? this.$D + (e3 - this.$W) : e3;
154
- if (o2 === c2 || o2 === h) {
155
- var y2 = this.clone().set(d, 1);
156
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
157
- } else
158
- l2 && this.$d[l2]($2);
159
- return this.init(), this;
160
- }, m2.set = function(t3, e3) {
161
- return this.clone().$set(t3, e3);
162
- }, m2.get = function(t3) {
163
- return this[b.p(t3)]();
164
- }, m2.add = function(r3, f2) {
165
- var d2, l2 = this;
166
- r3 = Number(r3);
167
- var $2 = b.p(f2), y2 = function(t3) {
168
- var e3 = O(l2);
169
- return b.w(e3.date(e3.date() + Math.round(t3 * r3)), l2);
170
- };
171
- if ($2 === c2)
172
- return this.set(c2, this.$M + r3);
173
- if ($2 === h)
174
- return this.set(h, this.$y + r3);
175
- if ($2 === a2)
176
- return y2(1);
177
- if ($2 === o)
178
- return y2(7);
179
- var M3 = (d2 = {}, d2[s2] = e2, d2[u] = n2, d2[i] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
180
- return b.w(m3, this);
181
- }, m2.subtract = function(t3, e3) {
182
- return this.add(-1 * t3, e3);
183
- }, m2.format = function(t3) {
184
- var e3 = this, n3 = this.$locale();
185
- if (!this.isValid())
186
- return n3.invalidDate || l;
187
- var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s3 = this.$H, u2 = this.$m, a3 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t4, n4, i3, s4) {
188
- return t4 && (t4[n4] || t4(e3, r3)) || i3[n4].slice(0, s4);
189
- }, d2 = function(t4) {
190
- return b.s(s3 % 12 || 12, t4, "0");
191
- }, $2 = f2 || function(t4, e4, n4) {
192
- var r4 = t4 < 12 ? "AM" : "PM";
193
- return n4 ? r4.toLowerCase() : r4;
194
- };
195
- return r3.replace(y, function(t4, r4) {
196
- return r4 || function(t5) {
197
- switch (t5) {
198
- case "YY":
199
- return String(e3.$y).slice(-2);
200
- case "YYYY":
201
- return b.s(e3.$y, 4, "0");
202
- case "M":
203
- return a3 + 1;
204
- case "MM":
205
- return b.s(a3 + 1, 2, "0");
206
- case "MMM":
207
- return h2(n3.monthsShort, a3, c3, 3);
208
- case "MMMM":
209
- return h2(c3, a3);
210
- case "D":
211
- return e3.$D;
212
- case "DD":
213
- return b.s(e3.$D, 2, "0");
214
- case "d":
215
- return String(e3.$W);
216
- case "dd":
217
- return h2(n3.weekdaysMin, e3.$W, o2, 2);
218
- case "ddd":
219
- return h2(n3.weekdaysShort, e3.$W, o2, 3);
220
- case "dddd":
221
- return o2[e3.$W];
222
- case "H":
223
- return String(s3);
224
- case "HH":
225
- return b.s(s3, 2, "0");
226
- case "h":
227
- return d2(1);
228
- case "hh":
229
- return d2(2);
230
- case "a":
231
- return $2(s3, u2, true);
232
- case "A":
233
- return $2(s3, u2, false);
234
- case "m":
235
- return String(u2);
236
- case "mm":
237
- return b.s(u2, 2, "0");
238
- case "s":
239
- return String(e3.$s);
240
- case "ss":
241
- return b.s(e3.$s, 2, "0");
242
- case "SSS":
243
- return b.s(e3.$ms, 3, "0");
244
- case "Z":
245
- return i2;
28
+ var hasRequiredDayjs_min;
29
+ function requireDayjs_min() {
30
+ if (hasRequiredDayjs_min)
31
+ return dayjs_min.exports;
32
+ hasRequiredDayjs_min = 1;
33
+ (function(module, exports) {
34
+ !function(t2, e2) {
35
+ module.exports = e2();
36
+ }(commonjsGlobal, function() {
37
+ var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i = "second", s2 = "minute", u = "hour", a2 = "day", o = "week", c2 = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
38
+ var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
39
+ return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
40
+ } }, m = function(t3, e3, n3) {
41
+ var r3 = String(t3);
42
+ return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
43
+ }, v = { s: m, z: function(t3) {
44
+ var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i2 = n3 % 60;
45
+ return (e3 <= 0 ? "+" : "-") + m(r3, 2, "0") + ":" + m(i2, 2, "0");
46
+ }, m: function t3(e3, n3) {
47
+ if (e3.date() < n3.date())
48
+ return -t3(n3, e3);
49
+ var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i2 = e3.clone().add(r3, c2), s3 = n3 - i2 < 0, u2 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
50
+ return +(-(r3 + (n3 - i2) / (s3 ? i2 - u2 : u2 - i2)) || 0);
51
+ }, a: function(t3) {
52
+ return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
53
+ }, p: function(t3) {
54
+ return { M: c2, y: h, w: o, d: a2, D: d, h: u, m: s2, s: i, ms: r2, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
55
+ }, u: function(t3) {
56
+ return void 0 === t3;
57
+ } }, g = "en", D = {};
58
+ D[g] = M;
59
+ var p = "$isDayjsObject", S = function(t3) {
60
+ return t3 instanceof _ || !(!t3 || !t3[p]);
61
+ }, w = function t3(e3, n3, r3) {
62
+ var i2;
63
+ if (!e3)
64
+ return g;
65
+ if ("string" == typeof e3) {
66
+ var s3 = e3.toLowerCase();
67
+ D[s3] && (i2 = s3), n3 && (D[s3] = n3, i2 = s3);
68
+ var u2 = e3.split("-");
69
+ if (!i2 && u2.length > 1)
70
+ return t3(u2[0]);
71
+ } else {
72
+ var a3 = e3.name;
73
+ D[a3] = e3, i2 = a3;
74
+ }
75
+ return !r3 && i2 && (g = i2), i2 || !r3 && g;
76
+ }, O = function(t3, e3) {
77
+ if (S(t3))
78
+ return t3.clone();
79
+ var n3 = "object" == typeof e3 ? e3 : {};
80
+ return n3.date = t3, n3.args = arguments, new _(n3);
81
+ }, b = v;
82
+ b.l = w, b.i = S, b.w = function(t3, e3) {
83
+ return O(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
84
+ };
85
+ var _ = function() {
86
+ function M2(t3) {
87
+ this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
88
+ }
89
+ var m2 = M2.prototype;
90
+ return m2.parse = function(t3) {
91
+ this.$d = function(t4) {
92
+ var e3 = t4.date, n3 = t4.utc;
93
+ if (null === e3)
94
+ return /* @__PURE__ */ new Date(NaN);
95
+ if (b.u(e3))
96
+ return /* @__PURE__ */ new Date();
97
+ if (e3 instanceof Date)
98
+ return new Date(e3);
99
+ if ("string" == typeof e3 && !/Z$/i.test(e3)) {
100
+ var r3 = e3.match($);
101
+ if (r3) {
102
+ var i2 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
103
+ return n3 ? new Date(Date.UTC(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i2, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
104
+ }
246
105
  }
247
- return null;
248
- }(t4) || i2.replace(":", "");
249
- });
250
- }, m2.utcOffset = function() {
251
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
252
- }, m2.diff = function(r3, d2, l2) {
253
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r3), v2 = (m3.utcOffset() - this.utcOffset()) * e2, g2 = this - m3, D2 = function() {
254
- return b.m(y2, m3);
106
+ return new Date(e3);
107
+ }(t3), this.init();
108
+ }, m2.init = function() {
109
+ var t3 = this.$d;
110
+ this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
111
+ }, m2.$utils = function() {
112
+ return b;
113
+ }, m2.isValid = function() {
114
+ return !(this.$d.toString() === l);
115
+ }, m2.isSame = function(t3, e3) {
116
+ var n3 = O(t3);
117
+ return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
118
+ }, m2.isAfter = function(t3, e3) {
119
+ return O(t3) < this.startOf(e3);
120
+ }, m2.isBefore = function(t3, e3) {
121
+ return this.endOf(e3) < O(t3);
122
+ }, m2.$g = function(t3, e3, n3) {
123
+ return b.u(t3) ? this[e3] : this.set(n3, t3);
124
+ }, m2.unix = function() {
125
+ return Math.floor(this.valueOf() / 1e3);
126
+ }, m2.valueOf = function() {
127
+ return this.$d.getTime();
128
+ }, m2.startOf = function(t3, e3) {
129
+ var n3 = this, r3 = !!b.u(e3) || e3, f2 = b.p(t3), l2 = function(t4, e4) {
130
+ var i2 = b.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
131
+ return r3 ? i2 : i2.endOf(a2);
132
+ }, $2 = function(t4, e4) {
133
+ return b.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
134
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
135
+ switch (f2) {
136
+ case h:
137
+ return r3 ? l2(1, 0) : l2(31, 11);
138
+ case c2:
139
+ return r3 ? l2(1, M3) : l2(0, M3 + 1);
140
+ case o:
141
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
142
+ return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
143
+ case a2:
144
+ case d:
145
+ return $2(v2 + "Hours", 0);
146
+ case u:
147
+ return $2(v2 + "Minutes", 1);
148
+ case s2:
149
+ return $2(v2 + "Seconds", 2);
150
+ case i:
151
+ return $2(v2 + "Milliseconds", 3);
152
+ default:
153
+ return this.clone();
154
+ }
155
+ }, m2.endOf = function(t3) {
156
+ return this.startOf(t3, false);
157
+ }, m2.$set = function(t3, e3) {
158
+ var n3, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a2] = f2 + "Date", n3[d] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i] = f2 + "Seconds", n3[r2] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a2 ? this.$D + (e3 - this.$W) : e3;
159
+ if (o2 === c2 || o2 === h) {
160
+ var y2 = this.clone().set(d, 1);
161
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
162
+ } else
163
+ l2 && this.$d[l2]($2);
164
+ return this.init(), this;
165
+ }, m2.set = function(t3, e3) {
166
+ return this.clone().$set(t3, e3);
167
+ }, m2.get = function(t3) {
168
+ return this[b.p(t3)]();
169
+ }, m2.add = function(r3, f2) {
170
+ var d2, l2 = this;
171
+ r3 = Number(r3);
172
+ var $2 = b.p(f2), y2 = function(t3) {
173
+ var e3 = O(l2);
174
+ return b.w(e3.date(e3.date() + Math.round(t3 * r3)), l2);
175
+ };
176
+ if ($2 === c2)
177
+ return this.set(c2, this.$M + r3);
178
+ if ($2 === h)
179
+ return this.set(h, this.$y + r3);
180
+ if ($2 === a2)
181
+ return y2(1);
182
+ if ($2 === o)
183
+ return y2(7);
184
+ var M3 = (d2 = {}, d2[s2] = e2, d2[u] = n2, d2[i] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
185
+ return b.w(m3, this);
186
+ }, m2.subtract = function(t3, e3) {
187
+ return this.add(-1 * t3, e3);
188
+ }, m2.format = function(t3) {
189
+ var e3 = this, n3 = this.$locale();
190
+ if (!this.isValid())
191
+ return n3.invalidDate || l;
192
+ var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s3 = this.$H, u2 = this.$m, a3 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t4, n4, i3, s4) {
193
+ return t4 && (t4[n4] || t4(e3, r3)) || i3[n4].slice(0, s4);
194
+ }, d2 = function(t4) {
195
+ return b.s(s3 % 12 || 12, t4, "0");
196
+ }, $2 = f2 || function(t4, e4, n4) {
197
+ var r4 = t4 < 12 ? "AM" : "PM";
198
+ return n4 ? r4.toLowerCase() : r4;
199
+ };
200
+ return r3.replace(y, function(t4, r4) {
201
+ return r4 || function(t5) {
202
+ switch (t5) {
203
+ case "YY":
204
+ return String(e3.$y).slice(-2);
205
+ case "YYYY":
206
+ return b.s(e3.$y, 4, "0");
207
+ case "M":
208
+ return a3 + 1;
209
+ case "MM":
210
+ return b.s(a3 + 1, 2, "0");
211
+ case "MMM":
212
+ return h2(n3.monthsShort, a3, c3, 3);
213
+ case "MMMM":
214
+ return h2(c3, a3);
215
+ case "D":
216
+ return e3.$D;
217
+ case "DD":
218
+ return b.s(e3.$D, 2, "0");
219
+ case "d":
220
+ return String(e3.$W);
221
+ case "dd":
222
+ return h2(n3.weekdaysMin, e3.$W, o2, 2);
223
+ case "ddd":
224
+ return h2(n3.weekdaysShort, e3.$W, o2, 3);
225
+ case "dddd":
226
+ return o2[e3.$W];
227
+ case "H":
228
+ return String(s3);
229
+ case "HH":
230
+ return b.s(s3, 2, "0");
231
+ case "h":
232
+ return d2(1);
233
+ case "hh":
234
+ return d2(2);
235
+ case "a":
236
+ return $2(s3, u2, true);
237
+ case "A":
238
+ return $2(s3, u2, false);
239
+ case "m":
240
+ return String(u2);
241
+ case "mm":
242
+ return b.s(u2, 2, "0");
243
+ case "s":
244
+ return String(e3.$s);
245
+ case "ss":
246
+ return b.s(e3.$s, 2, "0");
247
+ case "SSS":
248
+ return b.s(e3.$ms, 3, "0");
249
+ case "Z":
250
+ return i2;
251
+ }
252
+ return null;
253
+ }(t4) || i2.replace(":", "");
254
+ });
255
+ }, m2.utcOffset = function() {
256
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
257
+ }, m2.diff = function(r3, d2, l2) {
258
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r3), v2 = (m3.utcOffset() - this.utcOffset()) * e2, g2 = this - m3, D2 = function() {
259
+ return b.m(y2, m3);
260
+ };
261
+ switch (M3) {
262
+ case h:
263
+ $2 = D2() / 12;
264
+ break;
265
+ case c2:
266
+ $2 = D2();
267
+ break;
268
+ case f:
269
+ $2 = D2() / 3;
270
+ break;
271
+ case o:
272
+ $2 = (g2 - v2) / 6048e5;
273
+ break;
274
+ case a2:
275
+ $2 = (g2 - v2) / 864e5;
276
+ break;
277
+ case u:
278
+ $2 = g2 / n2;
279
+ break;
280
+ case s2:
281
+ $2 = g2 / e2;
282
+ break;
283
+ case i:
284
+ $2 = g2 / t2;
285
+ break;
286
+ default:
287
+ $2 = g2;
288
+ }
289
+ return l2 ? $2 : b.a($2);
290
+ }, m2.daysInMonth = function() {
291
+ return this.endOf(c2).$D;
292
+ }, m2.$locale = function() {
293
+ return D[this.$L];
294
+ }, m2.locale = function(t3, e3) {
295
+ if (!t3)
296
+ return this.$L;
297
+ var n3 = this.clone(), r3 = w(t3, e3, true);
298
+ return r3 && (n3.$L = r3), n3;
299
+ }, m2.clone = function() {
300
+ return b.w(this.$d, this);
301
+ }, m2.toDate = function() {
302
+ return new Date(this.valueOf());
303
+ }, m2.toJSON = function() {
304
+ return this.isValid() ? this.toISOString() : null;
305
+ }, m2.toISOString = function() {
306
+ return this.$d.toISOString();
307
+ }, m2.toString = function() {
308
+ return this.$d.toUTCString();
309
+ }, M2;
310
+ }(), k = _.prototype;
311
+ return O.prototype = k, [["$ms", r2], ["$s", i], ["$m", s2], ["$H", u], ["$W", a2], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t3) {
312
+ k[t3[1]] = function(e3) {
313
+ return this.$g(e3, t3[0], t3[1]);
255
314
  };
256
- switch (M3) {
257
- case h:
258
- $2 = D2() / 12;
259
- break;
260
- case c2:
261
- $2 = D2();
262
- break;
263
- case f:
264
- $2 = D2() / 3;
265
- break;
266
- case o:
267
- $2 = (g2 - v2) / 6048e5;
268
- break;
269
- case a2:
270
- $2 = (g2 - v2) / 864e5;
271
- break;
272
- case u:
273
- $2 = g2 / n2;
274
- break;
275
- case s2:
276
- $2 = g2 / e2;
277
- break;
278
- case i:
279
- $2 = g2 / t2;
280
- break;
281
- default:
282
- $2 = g2;
283
- }
284
- return l2 ? $2 : b.a($2);
285
- }, m2.daysInMonth = function() {
286
- return this.endOf(c2).$D;
287
- }, m2.$locale = function() {
288
- return D[this.$L];
289
- }, m2.locale = function(t3, e3) {
290
- if (!t3)
291
- return this.$L;
292
- var n3 = this.clone(), r3 = w(t3, e3, true);
293
- return r3 && (n3.$L = r3), n3;
294
- }, m2.clone = function() {
295
- return b.w(this.$d, this);
296
- }, m2.toDate = function() {
297
- return new Date(this.valueOf());
298
- }, m2.toJSON = function() {
299
- return this.isValid() ? this.toISOString() : null;
300
- }, m2.toISOString = function() {
301
- return this.$d.toISOString();
302
- }, m2.toString = function() {
303
- return this.$d.toUTCString();
304
- }, M2;
305
- }(), k = _.prototype;
306
- return O.prototype = k, [["$ms", r2], ["$s", i], ["$m", s2], ["$H", u], ["$W", a2], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t3) {
307
- k[t3[1]] = function(e3) {
308
- return this.$g(e3, t3[0], t3[1]);
309
- };
310
- }), O.extend = function(t3, e3) {
311
- return t3.$i || (t3(e3, _, O), t3.$i = true), O;
312
- }, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
313
- return O(1e3 * t3);
314
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
315
- });
316
- })(dayjs_min);
317
- var dayjs_minExports = dayjs_min.exports;
315
+ }), O.extend = function(t3, e3) {
316
+ return t3.$i || (t3(e3, _, O), t3.$i = true), O;
317
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
318
+ return O(1e3 * t3);
319
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
320
+ });
321
+ })(dayjs_min);
322
+ return dayjs_min.exports;
323
+ }
324
+ var dayjs_minExports = requireDayjs_min();
318
325
  const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
319
326
  var zh = { exports: {} };
320
327
  (function(module, exports) {
321
328
  !function(e2, _) {
322
- module.exports = _(dayjs_minExports);
329
+ module.exports = _(requireDayjs_min());
323
330
  }(commonjsGlobal, function(e2) {
324
331
  function _(e3) {
325
332
  return e3 && "object" == typeof e3 && "default" in e3 ? e3 : { default: e3 };
@@ -9884,21 +9891,25 @@ class ResourceModel {
9884
9891
  class IngressModel extends ResourceModel {
9885
9892
  constructor(_rawYaml, _globalStore) {
9886
9893
  super(_rawYaml, _globalStore);
9887
- __publicField(this, "flattenedRules", []);
9888
9894
  this._rawYaml = _rawYaml;
9889
9895
  }
9890
- async init() {
9896
+ getFullPath(rule2, path2 = "", port2) {
9897
+ if (!rule2.host) {
9898
+ return path2 || "";
9899
+ }
9900
+ const hostValue = rule2.host || "";
9901
+ const protocal = this._rawYaml.spec.tls ? "https://" : "http://";
9902
+ const portText = port2 ? `:${port2}` : "";
9903
+ return `${protocal}${hostValue}${portText}${path2}`;
9904
+ }
9905
+ getFlattenedRules(services) {
9891
9906
  var _a, _b, _c, _d;
9892
- const services = await this._globalStore.get("services", {
9893
- resourceBasePath: "/api/v1",
9894
- kind: "Service"
9895
- });
9896
9907
  const protocal = !!this._rawYaml.spec.tls ? "https" : "http";
9897
- const servicePort = (_c = (_b = (_a = services.items.find((s2) => {
9908
+ const servicePort = (_c = (_b = (_a = services.find((s2) => {
9898
9909
  var _a2, _b2;
9899
9910
  return ((_a2 = s2.metadata) == null ? void 0 : _a2.name) === "contour-envoy" && ((_b2 = s2.spec) == null ? void 0 : _b2.type) === "NodePort";
9900
9911
  })) == null ? void 0 : _a.spec) == null ? void 0 : _b.ports) == null ? void 0 : _c.find((p) => p.name === protocal);
9901
- this.flattenedRules = ((_d = this._rawYaml.spec.rules) == null ? void 0 : _d.reduce((res, rule2) => {
9912
+ return ((_d = this._rawYaml.spec.rules) == null ? void 0 : _d.reduce((res, rule2) => {
9902
9913
  var _a2;
9903
9914
  const paths = (_a2 = rule2.http) == null ? void 0 : _a2.paths.map((p) => {
9904
9915
  var _a3, _b2, _c2, _d2, _e, _f;
@@ -9914,15 +9925,6 @@ class IngressModel extends ResourceModel {
9914
9925
  return [...res, ...paths || []];
9915
9926
  }, [])) || [];
9916
9927
  }
9917
- getFullPath(rule2, path2 = "", port2) {
9918
- if (!rule2.host) {
9919
- return path2 || "";
9920
- }
9921
- const hostValue = rule2.host || "";
9922
- const protocal = this._rawYaml.spec.tls ? "https://" : "http://";
9923
- const portText = port2 ? `:${port2}` : "";
9924
- return `${protocal}${hostValue}${portText}${path2}`;
9925
- }
9926
9928
  }
9927
9929
  class NetworkPolicyModel extends ResourceModel {
9928
9930
  constructor(_rawYaml, _globalStore) {
@@ -11494,7 +11496,7 @@ function useOpenForm(options) {
11494
11496
  function K8sDropdown(props) {
11495
11497
  var _a;
11496
11498
  const { record, size = "normal" } = props;
11497
- const { globalStore } = useGlobalStore();
11499
+ const globalStore = useGlobalStore();
11498
11500
  const useResourceResult = useResource();
11499
11501
  const resource = useResourceResult.resource;
11500
11502
  const configs = useContext(ConfigsContext);
@@ -11999,9 +12001,17 @@ const ResourceLink = (props) => {
11999
12001
  };
12000
12002
  const IngressRulesTable = ({ ingress }) => {
12001
12003
  const { t: t2 } = useTranslation();
12004
+ const { data: serviceData } = useList({
12005
+ resource: "services",
12006
+ meta: {
12007
+ kind: "Service",
12008
+ apiVersion: "v1"
12009
+ }
12010
+ });
12011
+ const flattenedRules = useMemo(() => (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [], [serviceData == null ? void 0 : serviceData.data, ingress]);
12002
12012
  const rows = useMemo(() => {
12003
- return addId(ingress.flattenedRules || [], "fullPath");
12004
- }, [ingress.flattenedRules]);
12013
+ return addId(flattenedRules || [], "fullPath");
12014
+ }, [flattenedRules]);
12005
12015
  const component = useContext(ComponentContext);
12006
12016
  const Table2 = component.Table || Table$1;
12007
12017
  const currentSize = 10;
@@ -35849,7 +35859,7 @@ function PodShellModal(props) {
35849
35859
  const { pod: pod2 } = props;
35850
35860
  const { t: t2 } = useTranslation();
35851
35861
  const popModal = usePopModal();
35852
- const { globalStore } = useContext(GlobalStoreContext);
35862
+ const globalStore = useGlobalStore();
35853
35863
  const [socketStatus, setSocketStatus] = useState(SocketStatus.Opening);
35854
35864
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
35855
35865
  Modal,
@@ -36354,6 +36364,59 @@ function FormModeSegmentControl({
36354
36364
  }
36355
36365
  ) : null;
36356
36366
  }
36367
+ function immutableSet(obj, path2, value2) {
36368
+ return setWith(clone(obj), path2, value2, clone);
36369
+ }
36370
+ function usePathMap(options) {
36371
+ const { pathMap, transformInitValues, transformApplyValues } = options;
36372
+ return {
36373
+ /**
36374
+ * Transforms initial values by mapping paths from source to target structure
36375
+ * @param values Initial values to transform
36376
+ * @returns Transformed values with updated paths
36377
+ */
36378
+ transformInitValues(values) {
36379
+ const initValues = values._rawYaml || values;
36380
+ let result = initValues;
36381
+ for (const { from, to } of pathMap || []) {
36382
+ result = immutableSet(initValues, to, get$3(initValues, from));
36383
+ const fromPath = [...from];
36384
+ const lastKey = fromPath.pop();
36385
+ if (lastKey) {
36386
+ const obj = get$3(result, fromPath);
36387
+ if (obj && typeof obj === "object") {
36388
+ delete obj[lastKey];
36389
+ }
36390
+ }
36391
+ }
36392
+ return (transformInitValues == null ? void 0 : transformInitValues(result)) || result;
36393
+ },
36394
+ /**
36395
+ * Transforms values back to original structure before applying/saving
36396
+ * @param values Values to transform back
36397
+ * @returns Transformed values in original structure
36398
+ */
36399
+ transformApplyValues(values) {
36400
+ let result = values;
36401
+ for (const { from, to } of pathMap || []) {
36402
+ result = immutableSet(
36403
+ values,
36404
+ from,
36405
+ get$3(result, to)
36406
+ );
36407
+ const toPath = [...to];
36408
+ const lastKey = toPath.pop();
36409
+ if (lastKey) {
36410
+ const obj = get$3(result, toPath);
36411
+ if (obj && typeof obj === "object") {
36412
+ delete obj[lastKey];
36413
+ }
36414
+ }
36415
+ }
36416
+ return (transformApplyValues == null ? void 0 : transformApplyValues(result)) || result;
36417
+ }
36418
+ };
36419
+ }
36357
36420
  var isCheckBoxInput = (element) => element.type === "checkbox";
36358
36421
  var isDateObject = (value2) => value2 instanceof Date;
36359
36422
  var isNullOrUndefined = (value2) => value2 == null;
@@ -38083,59 +38146,6 @@ const RefineFormContent = (props) => {
38083
38146
  })]
38084
38147
  });
38085
38148
  };
38086
- function immutableSet(obj, path2, value2) {
38087
- return setWith(clone(obj), path2, value2, clone);
38088
- }
38089
- function usePathMap(options) {
38090
- const { pathMap, transformInitValues, transformApplyValues } = options;
38091
- return {
38092
- /**
38093
- * Transforms initial values by mapping paths from source to target structure
38094
- * @param values Initial values to transform
38095
- * @returns Transformed values with updated paths
38096
- */
38097
- transformInitValues(values) {
38098
- const initValues = values._rawYaml || values;
38099
- let result = initValues;
38100
- for (const { from, to } of pathMap || []) {
38101
- result = immutableSet(initValues, to, get$3(initValues, from));
38102
- const fromPath = [...from];
38103
- const lastKey = fromPath.pop();
38104
- if (lastKey) {
38105
- const obj = get$3(result, fromPath.join("."));
38106
- if (obj && typeof obj === "object") {
38107
- delete obj[lastKey];
38108
- }
38109
- }
38110
- }
38111
- return (transformInitValues == null ? void 0 : transformInitValues(result)) || result;
38112
- },
38113
- /**
38114
- * Transforms values back to original structure before applying/saving
38115
- * @param values Values to transform back
38116
- * @returns Transformed values in original structure
38117
- */
38118
- transformApplyValues(values) {
38119
- let result = values;
38120
- for (const { from, to } of pathMap || []) {
38121
- result = immutableSet(
38122
- values,
38123
- from,
38124
- get$3(result, to)
38125
- );
38126
- const toPath = [...to];
38127
- const lastKey = toPath.pop();
38128
- if (lastKey) {
38129
- const obj = get$3(result, toPath.join("."));
38130
- if (obj && typeof obj === "object") {
38131
- delete obj[lastKey];
38132
- }
38133
- }
38134
- }
38135
- return (transformApplyValues == null ? void 0 : transformApplyValues(result)) || result;
38136
- }
38137
- };
38138
- }
38139
38149
  var isArray$4 = Array.isArray;
38140
38150
  var isArray_1 = isArray$4;
38141
38151
  var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
@@ -38737,7 +38747,7 @@ const useForm = ({
38737
38747
  });
38738
38748
  return () => subscription.unsubscribe();
38739
38749
  }, [watch]);
38740
- const onValuesChange = (changeValues) => {
38750
+ const onValuesChange = useCallback((changeValues) => {
38741
38751
  var _a;
38742
38752
  if (warnWhenUnsavedChanges) {
38743
38753
  setWarnWhen(true);
@@ -38751,20 +38761,22 @@ const useForm = ({
38751
38761
  return onFinishAutoSave(changeValues);
38752
38762
  }
38753
38763
  return changeValues;
38754
- };
38755
- const handleSubmit = (onValid, onInvalid) => async (e2) => {
38764
+ }, [warnWhenUnsavedChanges, refineCoreProps == null ? void 0 : refineCoreProps.autoSave, setWarnWhen, onFinishAutoSave]);
38765
+ const handleSubmit = useCallback((onValid, onInvalid) => async (e2) => {
38756
38766
  setWarnWhen(false);
38757
38767
  return handleSubmitReactHookForm(onValid, onInvalid)(e2);
38758
- };
38759
- const saveButtonProps = {
38760
- disabled: formLoading,
38761
- onClick: (e2) => {
38762
- handleSubmit(
38763
- (v) => onFinish(transformApplyValues ? transformApplyValues(v) : v),
38764
- () => false
38765
- )(e2);
38766
- }
38767
- };
38768
+ }, [handleSubmitReactHookForm, setWarnWhen]);
38769
+ const saveButtonProps = useMemo(() => {
38770
+ return {
38771
+ disabled: formLoading,
38772
+ onClick: (e2) => {
38773
+ handleSubmit(
38774
+ (v) => onFinish(transformApplyValues ? transformApplyValues(v) : v),
38775
+ () => false
38776
+ )(e2);
38777
+ }
38778
+ };
38779
+ }, [formLoading, handleSubmit, onFinish, transformApplyValues]);
38768
38780
  return {
38769
38781
  ...useHookFormResult,
38770
38782
  handleSubmit,
@@ -38833,7 +38845,7 @@ const Separator = () => {
38833
38845
  });
38834
38846
  };
38835
38847
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38836
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-b8952aa0.js"));
38848
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-c33773fc.js"));
38837
38849
  const YamlEditorComponent = forwardRef(
38838
38850
  function YamlEditorComponent2(props, ref) {
38839
38851
  const {
@@ -39168,8 +39180,9 @@ function generateYamlBySchema(defaultValue, schema) {
39168
39180
  const content = yaml$2.dump(merged);
39169
39181
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
39170
39182
  }
39171
- const useGlobalStore = () => {
39172
- return useContext(GlobalStoreContext);
39183
+ const useGlobalStore = (name2 = "default") => {
39184
+ const globalStores = useContext(GlobalStoreContext);
39185
+ return globalStores[name2];
39173
39186
  };
39174
39187
  const useYamlForm = ({
39175
39188
  action: actionFromProps,
@@ -39207,14 +39220,13 @@ const useYamlForm = ({
39207
39220
  var _a;
39208
39221
  const editor = useRef(null);
39209
39222
  const { t: t2 } = useTranslation();
39210
- const [enableEditor, setEnableEditor] = useState(false);
39211
39223
  const [isYamlValid, setIsYamlValid] = useState(true);
39212
39224
  const [isSchemaValid, setIsSchemaValid] = useState(true);
39213
39225
  const [editorErrors, setEditorErrors] = useState([]);
39214
39226
  const [rulesErrors, setRulesErrors] = useState([]);
39215
39227
  const [errorResponseBody, setErrorResponseBody] = useState(null);
39216
39228
  const useResourceResult = useResource();
39217
- const { globalStore } = useGlobalStore();
39229
+ const globalStore = useGlobalStore();
39218
39230
  const {
39219
39231
  schema,
39220
39232
  loading: isLoadingSchema,
@@ -39281,36 +39293,9 @@ const useYamlForm = ({
39281
39293
  const finalErrors = useMemo(() => {
39282
39294
  return uniq([...editorErrors, ...rulesErrors]);
39283
39295
  }, [editorErrors, rulesErrors]);
39284
- const onKeyUp = (event2) => {
39285
- if (submitOnEnter && event2.key === "Enter") {
39286
- form2.submit();
39287
- }
39288
- };
39289
- const onValuesChange = (changeValues) => {
39290
- if (changeValues && warnWhenUnsavedChanges) {
39291
- setWarnWhen(true);
39292
- }
39293
- return changeValues;
39294
- };
39295
- const validateYaml = (yamlValue) => {
39296
- const errorMap = {};
39297
- if (rules && isYamlValid && isSchemaValid) {
39298
- const formValue = yaml$2.load(yamlValue || "");
39299
- rules.forEach((rule2) => {
39300
- const { path: path2, validators } = rule2;
39301
- const value2 = get$3(formValue, path2);
39302
- for (const validator of validators || []) {
39303
- const { isValid, errorMsg } = validator(value2, formValue, FormType.YAML);
39304
- if (!isValid) {
39305
- errorMap[path2.join(".")] = `${errorMsg}(${path2.join(".")})`;
39306
- break;
39307
- }
39308
- }
39309
- });
39310
- }
39311
- setRulesErrors(uniq(Object.values(errorMap)));
39312
- return errorMap;
39313
- };
39296
+ const schemas = useMemo(() => {
39297
+ return schema ? [schema] : [];
39298
+ }, [schema]);
39314
39299
  const saveButtonProps = useMemo(
39315
39300
  () => ({
39316
39301
  loading: formLoading,
@@ -39320,15 +39305,15 @@ const useYamlForm = ({
39320
39305
  }),
39321
39306
  [formLoading, form2]
39322
39307
  );
39323
- const schemas = useMemo(() => {
39324
- return schema ? [schema] : [];
39325
- }, [schema]);
39308
+ const emptySchemas = useMemo(() => {
39309
+ return [];
39310
+ }, []);
39326
39311
  const editorProps = useMemo(() => {
39327
39312
  var _a2;
39328
39313
  return {
39329
39314
  ref: editor,
39330
39315
  defaultValue: schema && (editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations) ? generateYamlBySchema(initialValues || {}, schema) : yaml$2.dump(initialValues),
39331
- schemas,
39316
+ schemas: schemas || emptySchemas,
39332
39317
  id: ((_a2 = useResourceResult.resource) == null ? void 0 : _a2.name) || "",
39333
39318
  errorMsgs: finalErrors,
39334
39319
  onValidate(yamlValid, schemaValid) {
@@ -39350,6 +39335,7 @@ const useYamlForm = ({
39350
39335
  };
39351
39336
  }, [
39352
39337
  schema,
39338
+ emptySchemas,
39353
39339
  editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations,
39354
39340
  initialValues,
39355
39341
  schemas,
@@ -39358,6 +39344,36 @@ const useYamlForm = ({
39358
39344
  finalErrors,
39359
39345
  fold2
39360
39346
  ]);
39347
+ const onKeyUp = (event2) => {
39348
+ if (submitOnEnter && event2.key === "Enter") {
39349
+ form2.submit();
39350
+ }
39351
+ };
39352
+ const onValuesChange = (changeValues) => {
39353
+ if (changeValues && warnWhenUnsavedChanges) {
39354
+ setWarnWhen(true);
39355
+ }
39356
+ return changeValues;
39357
+ };
39358
+ const validateRules = (yamlValue) => {
39359
+ const errorMap = {};
39360
+ if (rules && isYamlValid && isSchemaValid) {
39361
+ const formValue = yaml$2.load(yamlValue || "");
39362
+ rules.forEach((rule2) => {
39363
+ const { path: path2, validators } = rule2;
39364
+ const value2 = get$3(formValue, path2);
39365
+ for (const validator of validators || []) {
39366
+ const { isValid, errorMsg } = validator(value2, formValue, FormType.YAML);
39367
+ if (!isValid) {
39368
+ errorMap[path2.join(".")] = `${errorMsg}(${path2.join(".")})`;
39369
+ break;
39370
+ }
39371
+ }
39372
+ });
39373
+ }
39374
+ setRulesErrors(uniq(Object.values(errorMap)));
39375
+ return errorMap;
39376
+ };
39361
39377
  return {
39362
39378
  form: formSF.form,
39363
39379
  formProps: {
@@ -39373,7 +39389,7 @@ const useYamlForm = ({
39373
39389
  setRulesErrors([]);
39374
39390
  return;
39375
39391
  }
39376
- const rulesErrors2 = validateYaml(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "");
39392
+ const rulesErrors2 = validateRules(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "");
39377
39393
  if (Object.keys(rulesErrors2).length) {
39378
39394
  setRulesErrors(Object.values(rulesErrors2));
39379
39395
  return;
@@ -39399,26 +39415,12 @@ const useYamlForm = ({
39399
39415
  },
39400
39416
  saveButtonProps,
39401
39417
  ...useFormCoreResult,
39402
- editorProps,
39403
- enableEditor,
39404
39418
  errorResponseBody,
39419
+ editorProps,
39405
39420
  schemas: schema ? [schema] : [],
39406
39421
  isLoadingSchema,
39407
39422
  loadSchemaError,
39408
- fetchSchema,
39409
- switchEditor() {
39410
- var _a2, _b;
39411
- if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
39412
- const value2 = yaml$2.load((_b = editor.current) == null ? void 0 : _b.getEditorValue());
39413
- form2 == null ? void 0 : form2.setFieldsValue(value2);
39414
- }
39415
- setEnableEditor(!enableEditor);
39416
- },
39417
- onFinish: async (values) => {
39418
- var _a2;
39419
- const finalValues = enableEditor ? yaml$2.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values ?? formSF.form.getFieldsValue(true);
39420
- return await onFinish(finalValues);
39421
- }
39423
+ fetchSchema
39422
39424
  };
39423
39425
  };
39424
39426
  const YamlForm_1lo4xcc = "";
@@ -39499,9 +39501,6 @@ function YamlForm(props) {
39499
39501
  const formWrapperProps = isShowLayout ? {
39500
39502
  saveButtonProps
39501
39503
  } : {};
39502
- const schemas = useMemo(() => {
39503
- return editorProps.schemas || [];
39504
- }, [editorProps.schemas]);
39505
39504
  const responseErrors = useMemo(() => errorResponseBody ? getCommonErrors(errorResponseBody, i18n2) : [], [errorResponseBody, i18n2]);
39506
39505
  const onFinish = useCallback(async (store) => {
39507
39506
  var _a, _b;
@@ -39544,7 +39543,6 @@ function YamlForm(props) {
39544
39543
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(YamlEditorComponent, {
39545
39544
  ...editorProps,
39546
39545
  className: EditorStyle,
39547
- schemas,
39548
39546
  collapsable: false
39549
39547
  })
39550
39548
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, {
@@ -39588,45 +39586,58 @@ function RefineFormContainer({
39588
39586
  },
39589
39587
  redirect: false,
39590
39588
  ...formConfig == null ? void 0 : formConfig.refineCoreProps
39591
- }
39589
+ },
39590
+ formConfig
39591
+ });
39592
+ const {
39593
+ transformApplyValues
39594
+ } = usePathMap({
39595
+ pathMap: formConfig == null ? void 0 : formConfig.pathMap,
39596
+ transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
39597
+ transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
39592
39598
  });
39593
39599
  const yamlFormProps = useMemo(() => {
39594
- const transformApplyValues = (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v);
39600
+ if (isYamlMode) {
39601
+ return {
39602
+ ...customYamlFormProps,
39603
+ config,
39604
+ transformInitValues: void 0,
39605
+ transformApplyValues: void 0,
39606
+ initialValuesForCreate: transformApplyValues(
39607
+ refineFormResult.formResult.getValues()
39608
+ ),
39609
+ initialValuesForEdit: transformApplyValues(refineFormResult.formResult.getValues()),
39610
+ id,
39611
+ action,
39612
+ isShowLayout: false,
39613
+ useFormProps: {
39614
+ redirect: false
39615
+ },
39616
+ rules: fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
39617
+ path: config2.path,
39618
+ validators: config2.validators
39619
+ })),
39620
+ onSaveButtonPropsChange,
39621
+ onErrorsChange(errors) {
39622
+ if (errors.length) {
39623
+ onError == null ? void 0 : onError();
39624
+ }
39625
+ },
39626
+ onFinish: onSuccess
39627
+ };
39628
+ }
39595
39629
  return {
39596
- ...customYamlFormProps,
39597
- config,
39598
- transformInitValues: void 0,
39599
- transformApplyValues: void 0,
39600
- initialValuesForCreate: transformApplyValues(
39601
- refineFormResult.formResult.getValues()
39602
- ),
39603
- initialValuesForEdit: transformApplyValues(refineFormResult.formResult.getValues()),
39604
- id,
39605
- action,
39606
- isShowLayout: false,
39607
- useFormProps: {
39608
- redirect: false
39609
- },
39610
- rules: fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
39611
- path: config2.path,
39612
- validators: config2.validators
39613
- })),
39614
- onSaveButtonPropsChange,
39615
- onErrorsChange(errors) {
39616
- if (errors.length) {
39617
- onError == null ? void 0 : onError();
39618
- }
39619
- },
39620
- onFinish: onSuccess
39630
+ config
39621
39631
  };
39622
39632
  }, [
39623
39633
  action,
39634
+ isYamlMode,
39624
39635
  customYamlFormProps,
39625
39636
  fieldsConfig,
39626
39637
  config,
39627
39638
  id,
39628
39639
  refineFormResult,
39629
- formConfig,
39640
+ transformApplyValues,
39630
39641
  onSaveButtonPropsChange,
39631
39642
  onSuccess,
39632
39643
  onError
@@ -39635,7 +39646,7 @@ function RefineFormContainer({
39635
39646
  if (!isYamlMode) {
39636
39647
  onSaveButtonPropsChange == null ? void 0 : onSaveButtonPropsChange(refineFormResult.formResult.saveButtonProps);
39637
39648
  }
39638
- }, [isYamlMode, onSaveButtonPropsChange]);
39649
+ }, [isYamlMode, refineFormResult.formResult.saveButtonProps, onSaveButtonPropsChange]);
39639
39650
  if (isYamlMode) {
39640
39651
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
39641
39652
  }
@@ -40441,7 +40452,15 @@ function ResourceSelect(props) {
40441
40452
  );
40442
40453
  }
40443
40454
  const IngressRulesComponent = ({ ingress }) => {
40444
- const result = ingress.flattenedRules.map((r2) => {
40455
+ const { data: serviceData } = useList({
40456
+ resource: "services",
40457
+ meta: {
40458
+ kind: "Service",
40459
+ apiVersion: "v1"
40460
+ }
40461
+ });
40462
+ const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
40463
+ const result = flattenedRules.map((r2) => {
40445
40464
  const divider = " > ";
40446
40465
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
40447
40466
  OverflowTooltip,
@@ -41205,11 +41224,8 @@ const Dovetail = (props) => {
41205
41224
  schemaUrlPrefix,
41206
41225
  Layout: Layout2,
41207
41226
  history,
41208
- globalStore,
41227
+ globalStoreMap,
41209
41228
  accessControlProvider,
41210
- routerProvider: customRouterProvider,
41211
- dataProvider: customDataProvider,
41212
- liveProvider: customLiveProvider,
41213
41229
  antdGetPopupContainer
41214
41230
  } = props;
41215
41231
  const msg = useMessage();
@@ -41256,14 +41272,12 @@ const Dovetail = (props) => {
41256
41272
  antd4Configs: {
41257
41273
  getPopupContainer: antdGetPopupContainer || (() => document.body)
41258
41274
  },
41259
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: { globalStore }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
41275
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: globalStoreMap, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
41260
41276
  Refine,
41261
41277
  {
41262
- dataProvider: {
41263
- default: customDataProvider || dataProvider(globalStore)
41264
- },
41265
- routerProvider: customRouterProvider || routerProvider,
41266
- liveProvider: customLiveProvider || liveProvider(globalStore),
41278
+ dataProvider: dataProvider(globalStoreMap.default),
41279
+ liveProvider: liveProvider(globalStoreMap.default),
41280
+ routerProvider,
41267
41281
  notificationProvider,
41268
41282
  options: {
41269
41283
  warnWhenUnsavedChanges: true,
@@ -41275,6 +41289,7 @@ const Dovetail = (props) => {
41275
41289
  return {
41276
41290
  name: c2.name,
41277
41291
  meta: {
41292
+ dataProviderName: c2.dataProviderName,
41278
41293
  resourceBasePath: c2.basePath,
41279
41294
  kind: c2.kind,
41280
41295
  parent: c2.parent,
@@ -41286,6 +41301,7 @@ const Dovetail = (props) => {
41286
41301
  edit: `${urlPrefix}/${c2.name}/edit`
41287
41302
  };
41288
41303
  }),
41304
+ ...props,
41289
41305
  children: content
41290
41306
  }
41291
41307
  ) })