@wp-playground/components 3.0.22 → 3.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,10 +1,20 @@
1
- import f, { forwardRef as St, useMemo as gt, useState as ae, useRef as ie, useEffect as ue, useImperativeHandle as Ot } from "react";
2
- import { __experimentalTreeGrid as Dt, Popover as jt, NavigableMenu as Ft, MenuItem as tt, __experimentalTreeGridRow as At, __experimentalTreeGridCell as $t, Button as pt, Modal as Nt } from "@wordpress/components";
3
- import yt from "classnames";
4
- import { dirname as je, joinPaths as Ne, basename as Mt } from "@php-wasm/util";
5
- import { forwardRef as Ct, cloneElement as It, createElement as Vt } from "@wordpress/element";
6
- import Lt from "clsx";
7
- const wr = (s) => /* @__PURE__ */ f.createElement(
1
+ import o, { forwardRef as Bt, useMemo as Nt, useState as Q, useRef as M, useEffect as I, useImperativeHandle as Wt, useLayoutEffect as Gt, useCallback as ft } from "react";
2
+ import { dirname as Oe, joinPaths as We, basename as Ot, normalizePath as At } from "@php-wasm/util";
3
+ import { __experimentalTreeGrid as Kt, Popover as qt, NavigableMenu as Jt, MenuItem as qe, __experimentalTreeGridRow as Xt, __experimentalTreeGridCell as Qt, Button as mt, Modal as er, Icon as Ft, Notice as tr } from "@wordpress/components";
4
+ import et from "classnames";
5
+ import { forwardRef as Ht, cloneElement as rr, createElement as nr } from "@wordpress/element";
6
+ import ar from "clsx";
7
+ import { Compartment as Tt, EditorSelection as pt, EditorState as or } from "@codemirror/state";
8
+ import { ViewPlugin as ir, lineNumbers as sr, highlightActiveLineGutter as lr, highlightActiveLine as cr, dropCursor as ur, rectangularSelection as fr, crosshairCursor as dr, EditorView as Qe, keymap as mr } from "@codemirror/view";
9
+ import { history as pr, historyKeymap as hr, defaultKeymap as wr, indentWithTab as vr } from "@codemirror/commands";
10
+ import { highlightSelectionMatches as gr, searchKeymap as Er } from "@codemirror/search";
11
+ import { closeBrackets as yr, autocompletion as _r, closeBracketsKeymap as br, completionKeymap as Cr } from "@codemirror/autocomplete";
12
+ import { foldGutter as xr, syntaxHighlighting as Rr, indentOnInput as Tr, bracketMatching as Pr, defaultHighlightStyle as kr, foldKeymap as Sr } from "@codemirror/language";
13
+ import { php as tt } from "@codemirror/lang-php";
14
+ import { FilePickerTree as Nr, BinaryFilePreview as Dr } from "@wp-playground/components";
15
+ import { logger as dt } from "@php-wasm/logger";
16
+ import Lt from "@php-wasm/universal/mime-types";
17
+ const fa = (n) => /* @__PURE__ */ o.createElement(
8
18
  "svg",
9
19
  {
10
20
  width: "32",
@@ -12,9 +22,9 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
12
22
  viewBox: "0 0 32 32",
13
23
  fill: "none",
14
24
  xmlns: "http://www.w3.org/2000/svg",
15
- ...s
25
+ ...n
16
26
  },
17
- /* @__PURE__ */ f.createElement(
27
+ /* @__PURE__ */ o.createElement(
18
28
  "rect",
19
29
  {
20
30
  width: "10.4176",
@@ -25,7 +35,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
25
35
  strokeWidth: "0.965644"
26
36
  }
27
37
  ),
28
- /* @__PURE__ */ f.createElement(
38
+ /* @__PURE__ */ o.createElement(
29
39
  "rect",
30
40
  {
31
41
  width: "13.2346",
@@ -36,7 +46,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
36
46
  strokeWidth: "1.44847"
37
47
  }
38
48
  ),
39
- /* @__PURE__ */ f.createElement(
49
+ /* @__PURE__ */ o.createElement(
40
50
  "rect",
41
51
  {
42
52
  width: "17.451",
@@ -47,7 +57,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
47
57
  strokeWidth: "1.93129"
48
58
  }
49
59
  )
50
- ), gr = (s) => /* @__PURE__ */ f.createElement(
60
+ ), da = (n) => /* @__PURE__ */ o.createElement(
51
61
  "svg",
52
62
  {
53
63
  width: "16",
@@ -55,9 +65,9 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
55
65
  viewBox: "0 0 16 17",
56
66
  fill: "none",
57
67
  xmlns: "http://www.w3.org/2000/svg",
58
- ...s
68
+ ...n
59
69
  },
60
- /* @__PURE__ */ f.createElement(
70
+ /* @__PURE__ */ o.createElement(
61
71
  "path",
62
72
  {
63
73
  fillRule: "evenodd",
@@ -66,7 +76,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
66
76
  fill: "#949494"
67
77
  }
68
78
  )
69
- ), yr = (s) => /* @__PURE__ */ f.createElement(
79
+ ), ma = (n) => /* @__PURE__ */ o.createElement(
70
80
  "svg",
71
81
  {
72
82
  width: "20",
@@ -74,16 +84,16 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
74
84
  viewBox: "0 0 20 21",
75
85
  fill: "none",
76
86
  xmlns: "http://www.w3.org/2000/svg",
77
- ...s
87
+ ...n
78
88
  },
79
- /* @__PURE__ */ f.createElement(
89
+ /* @__PURE__ */ o.createElement(
80
90
  "path",
81
91
  {
82
92
  d: "M20 10.5C20 4.99 15.51 0.5 10 0.5C4.48 0.5 0 4.99 0 10.5C0 16.02 4.48 20.5 10 20.5C15.51 20.5 20 16.02 20 10.5ZM7.78 15.87L4.37 6.72C4.92 6.7 5.54 6.64 5.54 6.64C6.04 6.58 5.98 5.51 5.48 5.53C5.48 5.53 4.03 5.64 3.11 5.64C2.93 5.64 2.74 5.64 2.53 5.63C4.12 3.19 6.87 1.61 10 1.61C12.33 1.61 14.45 2.48 16.05 3.95C15.37 3.84 14.4 4.34 14.4 5.53C14.4 6.27 14.85 6.89 15.3 7.63C15.65 8.24 15.85 8.99 15.85 10.09C15.85 11.58 14.45 15.09 14.45 15.09L11.42 6.72C11.96 6.7 12.24 6.55 12.24 6.55C12.74 6.5 12.68 5.3 12.18 5.33C12.18 5.33 10.74 5.45 9.8 5.45C8.93 5.45 7.47 5.33 7.47 5.33C6.97 5.3 6.91 6.53 7.41 6.55L8.33 6.63L9.59 10.04L7.78 15.87ZM17.41 10.5C17.65 9.86 18.15 8.63 17.84 6.25C18.54 7.54 18.89 8.96 18.89 10.5C18.89 13.79 17.16 16.74 14.49 18.28C15.46 15.69 16.43 13.08 17.41 10.5ZM6.1 18.59C3.12 17.15 1.11 14.03 1.11 10.5C1.11 9.2 1.34 8.02 1.83 6.91C3.25 10.8 4.67 14.7 6.1 18.59ZM10.13 11.96L12.71 18.94C11.85 19.23 10.95 19.39 10 19.39C9.21 19.39 8.43 19.28 7.71 19.06C8.52 16.68 9.33 14.32 10.13 11.96Z",
83
93
  fill: "#ffffff"
84
94
  }
85
95
  )
86
- ), Wt = /* @__PURE__ */ f.createElement(
96
+ ), Or = /* @__PURE__ */ o.createElement(
87
97
  "svg",
88
98
  {
89
99
  xmlns: "http://www.w3.org/2000/svg",
@@ -92,7 +102,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
92
102
  viewBox: "0 0 15 14",
93
103
  fill: "none"
94
104
  },
95
- /* @__PURE__ */ f.createElement(
105
+ /* @__PURE__ */ o.createElement(
96
106
  "path",
97
107
  {
98
108
  fillRule: "evenodd",
@@ -100,7 +110,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
100
110
  d: "M7.59196 3.59524L6.77745 1.96623C6.70755 1.82641 6.56464 1.7381 6.40832 1.7381H1.65079C1.42287 1.7381 1.2381 1.92287 1.2381 2.15079V11.8492C1.2381 12.0771 1.42287 12.2619 1.65079 12.2619H13.2063C13.4343 12.2619 13.619 12.0771 13.619 11.8492V4.00794C13.619 3.78001 13.4343 3.59524 13.2063 3.59524H7.59196ZM8.35714 2.35714L7.88484 1.41254C7.60521 0.853274 7.0336 0.5 6.40832 0.5H1.65079C0.739085 0.5 0 1.23909 0 2.15079V11.8492C0 12.7609 0.739085 13.5 1.65079 13.5H13.2063C14.1181 13.5 14.8571 12.7609 14.8571 11.8492V4.00794C14.8571 3.09623 14.1181 2.35714 13.2063 2.35714H8.35714Z"
101
111
  }
102
112
  )
103
- ), Bt = /* @__PURE__ */ f.createElement(
113
+ ), Ar = /* @__PURE__ */ o.createElement(
104
114
  "svg",
105
115
  {
106
116
  xmlns: "http://www.w3.org/2000/svg",
@@ -110,8 +120,8 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
110
120
  className: "bi bi-file-earmark",
111
121
  viewBox: "0 0 16 16"
112
122
  },
113
- /* @__PURE__ */ f.createElement("path", { d: "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" })
114
- ), vr = (s) => /* @__PURE__ */ f.createElement(
123
+ /* @__PURE__ */ o.createElement("path", { d: "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" })
124
+ ), pa = (n) => /* @__PURE__ */ o.createElement(
115
125
  "svg",
116
126
  {
117
127
  xmlns: "http://www.w3.org/2000/svg",
@@ -119,9 +129,9 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
119
129
  height: "18",
120
130
  viewBox: "0 0 14 14",
121
131
  fill: "none",
122
- ...s
132
+ ...n
123
133
  },
124
- /* @__PURE__ */ f.createElement(
134
+ /* @__PURE__ */ o.createElement(
125
135
  "path",
126
136
  {
127
137
  fillRule: "evenodd",
@@ -130,7 +140,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
130
140
  fill: "#949494"
131
141
  }
132
142
  )
133
- ), Er = /* @__PURE__ */ f.createElement(
143
+ ), ha = /* @__PURE__ */ o.createElement(
134
144
  "svg",
135
145
  {
136
146
  xmlns: "http://www.w3.org/2000/svg",
@@ -139,7 +149,7 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
139
149
  viewBox: "0 0 14 14",
140
150
  fill: "none"
141
151
  },
142
- /* @__PURE__ */ f.createElement(
152
+ /* @__PURE__ */ o.createElement(
143
153
  "path",
144
154
  {
145
155
  fillRule: "evenodd",
@@ -149,18 +159,18 @@ const wr = (s) => /* @__PURE__ */ f.createElement(
149
159
  }
150
160
  )
151
161
  );
152
- function _r(s) {
153
- return `data:${s.mime};base64,${s.data}`;
162
+ function wa(n) {
163
+ return `data:${n.mime};base64,${n.data}`;
154
164
  }
155
- function br({
156
- size: s = 24,
157
- sidebarActive: l = !1
165
+ function va({
166
+ size: n = 24,
167
+ sidebarActive: u = !1
158
168
  }) {
159
- return /* @__PURE__ */ f.createElement(
169
+ return /* @__PURE__ */ o.createElement(
160
170
  "svg",
161
171
  {
162
- width: s,
163
- height: s,
172
+ width: n,
173
+ height: n,
164
174
  viewBox: "0 0 24 24",
165
175
  xmlns: "http://www.w3.org/2000/svg",
166
176
  fill: "none",
@@ -169,8 +179,8 @@ function br({
169
179
  strokeLinecap: "round",
170
180
  strokeLinejoin: "round"
171
181
  },
172
- /* @__PURE__ */ f.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
173
- l ? /* @__PURE__ */ f.createElement(
182
+ /* @__PURE__ */ o.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
183
+ u ? /* @__PURE__ */ o.createElement(
174
184
  "rect",
175
185
  {
176
186
  x: "3",
@@ -181,7 +191,7 @@ function br({
181
191
  ry: "2",
182
192
  fill: "currentColor"
183
193
  }
184
- ) : /* @__PURE__ */ f.createElement(
194
+ ) : /* @__PURE__ */ o.createElement(
185
195
  "rect",
186
196
  {
187
197
  x: "3",
@@ -197,17 +207,17 @@ function br({
197
207
  )
198
208
  );
199
209
  }
200
- const vt = Ct(({
201
- icon: s,
202
- size: l = 24,
203
- ...E
204
- }, g) => It(s, {
205
- width: l,
206
- height: l,
207
- ...E,
208
- ref: g
210
+ const jt = Ht(({
211
+ icon: n,
212
+ size: u = 24,
213
+ ...l
214
+ }, m) => rr(n, {
215
+ width: u,
216
+ height: u,
217
+ ...l,
218
+ ref: m
209
219
  }));
210
- var ht = { exports: {} }, Ye = {};
220
+ var Dt = { exports: {} }, Je = {};
211
221
  /**
212
222
  * @license React
213
223
  * react-jsx-runtime.production.min.js
@@ -217,21 +227,21 @@ var ht = { exports: {} }, Ye = {};
217
227
  * This source code is licensed under the MIT license found in the
218
228
  * LICENSE file in the root directory of this source tree.
219
229
  */
220
- var Et;
221
- function Ht() {
222
- if (Et) return Ye;
223
- Et = 1;
224
- var s = f, l = Symbol.for("react.element"), E = Symbol.for("react.fragment"), g = Object.prototype.hasOwnProperty, k = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, C = { key: !0, ref: !0, __self: !0, __source: !0 };
225
- function M(P, S, I) {
226
- var _, R = {}, V = null, Q = null;
227
- I !== void 0 && (V = "" + I), S.key !== void 0 && (V = "" + S.key), S.ref !== void 0 && (Q = S.ref);
228
- for (_ in S) g.call(S, _) && !C.hasOwnProperty(_) && (R[_] = S[_]);
229
- if (P && P.defaultProps) for (_ in S = P.defaultProps, S) R[_] === void 0 && (R[_] = S[_]);
230
- return { $$typeof: l, type: P, key: V, ref: Q, props: R, _owner: k.current };
230
+ var It;
231
+ function Fr() {
232
+ if (It) return Je;
233
+ It = 1;
234
+ var n = o, u = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, E = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
235
+ function k(V, T, y) {
236
+ var v, N = {}, P = null, j = null;
237
+ y !== void 0 && (P = "" + y), T.key !== void 0 && (P = "" + T.key), T.ref !== void 0 && (j = T.ref);
238
+ for (v in T) m.call(T, v) && !g.hasOwnProperty(v) && (N[v] = T[v]);
239
+ if (V && V.defaultProps) for (v in T = V.defaultProps, T) N[v] === void 0 && (N[v] = T[v]);
240
+ return { $$typeof: u, type: V, key: P, ref: j, props: N, _owner: E.current };
231
241
  }
232
- return Ye.Fragment = E, Ye.jsx = M, Ye.jsxs = M, Ye;
242
+ return Je.Fragment = l, Je.jsx = k, Je.jsxs = k, Je;
233
243
  }
234
- var ze = {};
244
+ var Xe = {};
235
245
  /**
236
246
  * @license React
237
247
  * react-jsx-runtime.development.js
@@ -241,91 +251,91 @@ var ze = {};
241
251
  * This source code is licensed under the MIT license found in the
242
252
  * LICENSE file in the root directory of this source tree.
243
253
  */
244
- var _t;
245
- function Yt() {
246
- return _t || (_t = 1, process.env.NODE_ENV !== "production" && function() {
247
- var s = f, l = Symbol.for("react.element"), E = Symbol.for("react.portal"), g = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), M = Symbol.for("react.provider"), P = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), I = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), Q = Symbol.for("react.offscreen"), $ = Symbol.iterator, Z = "@@iterator";
248
- function he(e) {
254
+ var Mt;
255
+ function Lr() {
256
+ return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
257
+ var n = o, u = Symbol.for("react.element"), l = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), V = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), Z = Symbol.iterator, A = "@@iterator";
258
+ function D(e) {
249
259
  if (e === null || typeof e != "object")
250
260
  return null;
251
- var o = $ && e[$] || e[Z];
252
- return typeof o == "function" ? o : null;
261
+ var c = Z && e[Z] || e[A];
262
+ return typeof c == "function" ? c : null;
253
263
  }
254
- var j = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
255
- function T(e) {
264
+ var p = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
265
+ function b(e) {
256
266
  {
257
- for (var o = arguments.length, c = new Array(o > 1 ? o - 1 : 0), w = 1; w < o; w++)
258
- c[w - 1] = arguments[w];
259
- fe("error", e, c);
267
+ for (var c = arguments.length, f = new Array(c > 1 ? c - 1 : 0), R = 1; R < c; R++)
268
+ f[R - 1] = arguments[R];
269
+ q("error", e, f);
260
270
  }
261
271
  }
262
- function fe(e, o, c) {
272
+ function q(e, c, f) {
263
273
  {
264
- var w = j.ReactDebugCurrentFrame, b = w.getStackAddendum();
265
- b !== "" && (o += "%s", c = c.concat([b]));
266
- var x = c.map(function(v) {
267
- return String(v);
274
+ var R = p.ReactDebugCurrentFrame, $ = R.getStackAddendum();
275
+ $ !== "" && (c += "%s", f = f.concat([$]));
276
+ var Y = f.map(function(L) {
277
+ return String(L);
268
278
  });
269
- x.unshift("Warning: " + o), Function.prototype.apply.call(console[e], console, x);
279
+ Y.unshift("Warning: " + c), Function.prototype.apply.call(console[e], console, Y);
270
280
  }
271
281
  }
272
- var we = !1, ve = !1, q = !1, B = !1, Ee = !1, ee;
273
- ee = Symbol.for("react.module.reference");
274
- function m(e) {
275
- return !!(typeof e == "string" || typeof e == "function" || e === g || e === C || Ee || e === k || e === I || e === _ || B || e === Q || we || ve || q || typeof e == "object" && e !== null && (e.$$typeof === V || e.$$typeof === R || e.$$typeof === M || e.$$typeof === P || e.$$typeof === S || // This needs to include all possible module reference object
282
+ var B = !1, G = !1, ee = !1, W = !1, F = !1, te;
283
+ te = Symbol.for("react.module.reference");
284
+ function _(e) {
285
+ return !!(typeof e == "string" || typeof e == "function" || e === m || e === g || F || e === E || e === y || e === v || W || e === j || B || G || ee || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === N || e.$$typeof === k || e.$$typeof === V || e.$$typeof === T || // This needs to include all possible module reference object
276
286
  // types supported by any Flight configuration anywhere since
277
287
  // we don't know which Flight build this will end up being used
278
288
  // with.
279
- e.$$typeof === ee || e.getModuleId !== void 0));
289
+ e.$$typeof === te || e.getModuleId !== void 0));
280
290
  }
281
- function H(e, o, c) {
282
- var w = e.displayName;
283
- if (w)
284
- return w;
285
- var b = o.displayName || o.name || "";
286
- return b !== "" ? c + "(" + b + ")" : c;
291
+ function H(e, c, f) {
292
+ var R = e.displayName;
293
+ if (R)
294
+ return R;
295
+ var $ = c.displayName || c.name || "";
296
+ return $ !== "" ? f + "(" + $ + ")" : f;
287
297
  }
288
- function oe(e) {
298
+ function de(e) {
289
299
  return e.displayName || "Context";
290
300
  }
291
- function Y(e) {
301
+ function ae(e) {
292
302
  if (e == null)
293
303
  return null;
294
- if (typeof e.tag == "number" && T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
304
+ if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
295
305
  return e.displayName || e.name || null;
296
306
  if (typeof e == "string")
297
307
  return e;
298
308
  switch (e) {
299
- case g:
309
+ case m:
300
310
  return "Fragment";
301
- case E:
311
+ case l:
302
312
  return "Portal";
303
- case C:
313
+ case g:
304
314
  return "Profiler";
305
- case k:
315
+ case E:
306
316
  return "StrictMode";
307
- case I:
317
+ case y:
308
318
  return "Suspense";
309
- case _:
319
+ case v:
310
320
  return "SuspenseList";
311
321
  }
312
322
  if (typeof e == "object")
313
323
  switch (e.$$typeof) {
314
- case P:
315
- var o = e;
316
- return oe(o) + ".Consumer";
317
- case M:
324
+ case V:
318
325
  var c = e;
319
- return oe(c._context) + ".Provider";
320
- case S:
326
+ return de(c) + ".Consumer";
327
+ case k:
328
+ var f = e;
329
+ return de(f._context) + ".Provider";
330
+ case T:
321
331
  return H(e, e.render, "ForwardRef");
322
- case R:
323
- var w = e.displayName || null;
324
- return w !== null ? w : Y(e.type) || "Memo";
325
- case V: {
326
- var b = e, x = b._payload, v = b._init;
332
+ case N:
333
+ var R = e.displayName || null;
334
+ return R !== null ? R : ae(e.type) || "Memo";
335
+ case P: {
336
+ var $ = e, Y = $._payload, L = $._init;
327
337
  try {
328
- return Y(v(x));
338
+ return ae(L(Y));
329
339
  } catch {
330
340
  return null;
331
341
  }
@@ -333,18 +343,18 @@ function Yt() {
333
343
  }
334
344
  return null;
335
345
  }
336
- var K = Object.assign, L = 0, te, Te, ke, _e, de, G, z;
337
- function se() {
346
+ var re = Object.assign, ue = 0, oe, be, Re, Te, Pe, le, S;
347
+ function C() {
338
348
  }
339
- se.__reactDisabledLog = !0;
340
- function le() {
349
+ C.__reactDisabledLog = !0;
350
+ function J() {
341
351
  {
342
- if (L === 0) {
343
- te = console.log, Te = console.info, ke = console.warn, _e = console.error, de = console.group, G = console.groupCollapsed, z = console.groupEnd;
352
+ if (ue === 0) {
353
+ oe = console.log, be = console.info, Re = console.warn, Te = console.error, Pe = console.group, le = console.groupCollapsed, S = console.groupEnd;
344
354
  var e = {
345
355
  configurable: !0,
346
356
  enumerable: !0,
347
- value: se,
357
+ value: C,
348
358
  writable: !0
349
359
  };
350
360
  Object.defineProperties(console, {
@@ -357,332 +367,332 @@ function Yt() {
357
367
  groupEnd: e
358
368
  });
359
369
  }
360
- L++;
370
+ ue++;
361
371
  }
362
372
  }
363
- function be() {
373
+ function z() {
364
374
  {
365
- if (L--, L === 0) {
375
+ if (ue--, ue === 0) {
366
376
  var e = {
367
377
  configurable: !0,
368
378
  enumerable: !0,
369
379
  writable: !0
370
380
  };
371
381
  Object.defineProperties(console, {
372
- log: K({}, e, {
373
- value: te
382
+ log: re({}, e, {
383
+ value: oe
374
384
  }),
375
- info: K({}, e, {
376
- value: Te
385
+ info: re({}, e, {
386
+ value: be
377
387
  }),
378
- warn: K({}, e, {
379
- value: ke
388
+ warn: re({}, e, {
389
+ value: Re
380
390
  }),
381
- error: K({}, e, {
382
- value: _e
391
+ error: re({}, e, {
392
+ value: Te
383
393
  }),
384
- group: K({}, e, {
385
- value: de
394
+ group: re({}, e, {
395
+ value: Pe
386
396
  }),
387
- groupCollapsed: K({}, e, {
388
- value: G
397
+ groupCollapsed: re({}, e, {
398
+ value: le
389
399
  }),
390
- groupEnd: K({}, e, {
391
- value: z
400
+ groupEnd: re({}, e, {
401
+ value: S
392
402
  })
393
403
  });
394
404
  }
395
- L < 0 && T("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
405
+ ue < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
396
406
  }
397
407
  }
398
- var me = j.ReactCurrentDispatcher, ge;
399
- function W(e, o, c) {
408
+ var ie = p.ReactCurrentDispatcher, Ee;
409
+ function ve(e, c, f) {
400
410
  {
401
- if (ge === void 0)
411
+ if (Ee === void 0)
402
412
  try {
403
413
  throw Error();
404
- } catch (b) {
405
- var w = b.stack.trim().match(/\n( *(at )?)/);
406
- ge = w && w[1] || "";
414
+ } catch ($) {
415
+ var R = $.stack.trim().match(/\n( *(at )?)/);
416
+ Ee = R && R[1] || "";
407
417
  }
408
418
  return `
409
- ` + ge + e;
419
+ ` + Ee + e;
410
420
  }
411
421
  }
412
- var D = !1, re;
422
+ var ce = !1, U;
413
423
  {
414
- var d = typeof WeakMap == "function" ? WeakMap : Map;
415
- re = new d();
424
+ var h = typeof WeakMap == "function" ? WeakMap : Map;
425
+ U = new h();
416
426
  }
417
- function F(e, o) {
418
- if (!e || D)
427
+ function ge(e, c) {
428
+ if (!e || ce)
419
429
  return "";
420
430
  {
421
- var c = re.get(e);
422
- if (c !== void 0)
423
- return c;
431
+ var f = U.get(e);
432
+ if (f !== void 0)
433
+ return f;
424
434
  }
425
- var w;
426
- D = !0;
427
- var b = Error.prepareStackTrace;
435
+ var R;
436
+ ce = !0;
437
+ var $ = Error.prepareStackTrace;
428
438
  Error.prepareStackTrace = void 0;
429
- var x;
430
- x = me.current, me.current = null, le();
439
+ var Y;
440
+ Y = ie.current, ie.current = null, J();
431
441
  try {
432
- if (o) {
433
- var v = function() {
442
+ if (c) {
443
+ var L = function() {
434
444
  throw Error();
435
445
  };
436
- if (Object.defineProperty(v.prototype, "props", {
446
+ if (Object.defineProperty(L.prototype, "props", {
437
447
  set: function() {
438
448
  throw Error();
439
449
  }
440
450
  }), typeof Reflect == "object" && Reflect.construct) {
441
451
  try {
442
- Reflect.construct(v, []);
443
- } catch (J) {
444
- w = J;
452
+ Reflect.construct(L, []);
453
+ } catch (he) {
454
+ R = he;
445
455
  }
446
- Reflect.construct(e, [], v);
456
+ Reflect.construct(e, [], L);
447
457
  } else {
448
458
  try {
449
- v.call();
450
- } catch (J) {
451
- w = J;
459
+ L.call();
460
+ } catch (he) {
461
+ R = he;
452
462
  }
453
- e.call(v.prototype);
463
+ e.call(L.prototype);
454
464
  }
455
465
  } else {
456
466
  try {
457
467
  throw Error();
458
- } catch (J) {
459
- w = J;
468
+ } catch (he) {
469
+ R = he;
460
470
  }
461
471
  e();
462
472
  }
463
- } catch (J) {
464
- if (J && w && typeof J.stack == "string") {
465
- for (var y = J.stack.split(`
466
- `), U = w.stack.split(`
467
- `), A = y.length - 1, N = U.length - 1; A >= 1 && N >= 0 && y[A] !== U[N]; )
468
- N--;
469
- for (; A >= 1 && N >= 0; A--, N--)
470
- if (y[A] !== U[N]) {
471
- if (A !== 1 || N !== 1)
473
+ } catch (he) {
474
+ if (he && R && typeof he.stack == "string") {
475
+ for (var O = he.stack.split(`
476
+ `), pe = R.stack.split(`
477
+ `), ne = O.length - 1, se = pe.length - 1; ne >= 1 && se >= 0 && O[ne] !== pe[se]; )
478
+ se--;
479
+ for (; ne >= 1 && se >= 0; ne--, se--)
480
+ if (O[ne] !== pe[se]) {
481
+ if (ne !== 1 || se !== 1)
472
482
  do
473
- if (A--, N--, N < 0 || y[A] !== U[N]) {
474
- var ce = `
475
- ` + y[A].replace(" at new ", " at ");
476
- return e.displayName && ce.includes("<anonymous>") && (ce = ce.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, ce), ce;
483
+ if (ne--, se--, se < 0 || O[ne] !== pe[se]) {
484
+ var _e = `
485
+ ` + O[ne].replace(" at new ", " at ");
486
+ return e.displayName && _e.includes("<anonymous>") && (_e = _e.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, _e), _e;
477
487
  }
478
- while (A >= 1 && N >= 0);
488
+ while (ne >= 1 && se >= 0);
479
489
  break;
480
490
  }
481
491
  }
482
492
  } finally {
483
- D = !1, me.current = x, be(), Error.prepareStackTrace = b;
493
+ ce = !1, ie.current = Y, z(), Error.prepareStackTrace = $;
484
494
  }
485
- var $e = e ? e.displayName || e.name : "", De = $e ? W($e) : "";
486
- return typeof e == "function" && re.set(e, De), De;
495
+ var Be = e ? e.displayName || e.name : "", je = Be ? ve(Be) : "";
496
+ return typeof e == "function" && U.set(e, je), je;
487
497
  }
488
- function ne(e, o, c) {
489
- return F(e, !1);
498
+ function me(e, c, f) {
499
+ return ge(e, !1);
490
500
  }
491
- function Ce(e) {
492
- var o = e.prototype;
493
- return !!(o && o.isReactComponent);
501
+ function ye(e) {
502
+ var c = e.prototype;
503
+ return !!(c && c.isReactComponent);
494
504
  }
495
- function Pe(e, o, c) {
505
+ function ke(e, c, f) {
496
506
  if (e == null)
497
507
  return "";
498
508
  if (typeof e == "function")
499
- return F(e, Ce(e));
509
+ return ge(e, ye(e));
500
510
  if (typeof e == "string")
501
- return W(e);
511
+ return ve(e);
502
512
  switch (e) {
503
- case I:
504
- return W("Suspense");
505
- case _:
506
- return W("SuspenseList");
513
+ case y:
514
+ return ve("Suspense");
515
+ case v:
516
+ return ve("SuspenseList");
507
517
  }
508
518
  if (typeof e == "object")
509
519
  switch (e.$$typeof) {
510
- case S:
511
- return ne(e.render);
512
- case R:
513
- return Pe(e.type, o, c);
514
- case V: {
515
- var w = e, b = w._payload, x = w._init;
520
+ case T:
521
+ return me(e.render);
522
+ case N:
523
+ return ke(e.type, c, f);
524
+ case P: {
525
+ var R = e, $ = R._payload, Y = R._init;
516
526
  try {
517
- return Pe(x(b), o, c);
527
+ return ke(Y($), c, f);
518
528
  } catch {
519
529
  }
520
530
  }
521
531
  }
522
532
  return "";
523
533
  }
524
- var pe = Object.prototype.hasOwnProperty, Ie = {}, Ze = j.ReactDebugCurrentFrame;
525
- function xe(e) {
534
+ var Ne = Object.prototype.hasOwnProperty, Ae = {}, ze = p.ReactDebugCurrentFrame;
535
+ function Me(e) {
526
536
  if (e) {
527
- var o = e._owner, c = Pe(e.type, e._source, o ? o.type : null);
528
- Ze.setExtraStackFrame(c);
537
+ var c = e._owner, f = ke(e.type, e._source, c ? c.type : null);
538
+ ze.setExtraStackFrame(f);
529
539
  } else
530
- Ze.setExtraStackFrame(null);
540
+ ze.setExtraStackFrame(null);
531
541
  }
532
- function rt(e, o, c, w, b) {
542
+ function Ue(e, c, f, R, $) {
533
543
  {
534
- var x = Function.call.bind(pe);
535
- for (var v in e)
536
- if (x(e, v)) {
537
- var y = void 0;
544
+ var Y = Function.call.bind(Ne);
545
+ for (var L in e)
546
+ if (Y(e, L)) {
547
+ var O = void 0;
538
548
  try {
539
- if (typeof e[v] != "function") {
540
- var U = Error((w || "React class") + ": " + c + " type `" + v + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[v] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
541
- throw U.name = "Invariant Violation", U;
549
+ if (typeof e[L] != "function") {
550
+ var pe = Error((R || "React class") + ": " + f + " type `" + L + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[L] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
551
+ throw pe.name = "Invariant Violation", pe;
542
552
  }
543
- y = e[v](o, v, w, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
544
- } catch (A) {
545
- y = A;
553
+ O = e[L](c, L, R, f, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
554
+ } catch (ne) {
555
+ O = ne;
546
556
  }
547
- y && !(y instanceof Error) && (xe(b), T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", w || "React class", c, v, typeof y), xe(null)), y instanceof Error && !(y.message in Ie) && (Ie[y.message] = !0, xe(b), T("Failed %s type: %s", c, y.message), xe(null));
557
+ O && !(O instanceof Error) && (Me($), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", R || "React class", f, L, typeof O), Me(null)), O instanceof Error && !(O.message in Ae) && (Ae[O.message] = !0, Me($), b("Failed %s type: %s", f, O.message), Me(null));
548
558
  }
549
559
  }
550
560
  }
551
- var Ve = Array.isArray;
552
- function Le(e) {
553
- return Ve(e);
561
+ var ht = Array.isArray;
562
+ function Fe(e) {
563
+ return ht(e);
554
564
  }
555
- function nt(e) {
565
+ function wt(e) {
556
566
  {
557
- var o = typeof Symbol == "function" && Symbol.toStringTag, c = o && e[Symbol.toStringTag] || e.constructor.name || "Object";
558
- return c;
567
+ var c = typeof Symbol == "function" && Symbol.toStringTag, f = c && e[Symbol.toStringTag] || e.constructor.name || "Object";
568
+ return f;
559
569
  }
560
570
  }
561
- function at(e) {
571
+ function vt(e) {
562
572
  try {
563
- return qe(e), !1;
573
+ return at(e), !1;
564
574
  } catch {
565
575
  return !0;
566
576
  }
567
577
  }
568
- function qe(e) {
578
+ function at(e) {
569
579
  return "" + e;
570
580
  }
571
- function Ke(e) {
572
- if (at(e))
573
- return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", nt(e)), qe(e);
581
+ function ot(e) {
582
+ if (vt(e))
583
+ return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", wt(e)), at(e);
574
584
  }
575
- var Ge = j.ReactCurrentOwner, it = {
585
+ var it = p.ReactCurrentOwner, gt = {
576
586
  key: !0,
577
587
  ref: !0,
578
588
  __self: !0,
579
589
  __source: !0
580
- }, Se, Oe;
581
- function ot(e) {
582
- if (pe.call(e, "ref")) {
583
- var o = Object.getOwnPropertyDescriptor(e, "ref").get;
584
- if (o && o.isReactWarning)
590
+ }, st, Le;
591
+ function Ve(e) {
592
+ if (Ne.call(e, "ref")) {
593
+ var c = Object.getOwnPropertyDescriptor(e, "ref").get;
594
+ if (c && c.isReactWarning)
585
595
  return !1;
586
596
  }
587
597
  return e.ref !== void 0;
588
598
  }
589
- function st(e) {
590
- if (pe.call(e, "key")) {
591
- var o = Object.getOwnPropertyDescriptor(e, "key").get;
592
- if (o && o.isReactWarning)
599
+ function Et(e) {
600
+ if (Ne.call(e, "key")) {
601
+ var c = Object.getOwnPropertyDescriptor(e, "key").get;
602
+ if (c && c.isReactWarning)
593
603
  return !1;
594
604
  }
595
605
  return e.key !== void 0;
596
606
  }
597
- function lt(e, o) {
598
- typeof e.ref == "string" && Ge.current;
607
+ function yt(e, c) {
608
+ typeof e.ref == "string" && it.current;
599
609
  }
600
- function ct(e, o) {
610
+ function _t(e, c) {
601
611
  {
602
- var c = function() {
603
- Se || (Se = !0, T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
612
+ var f = function() {
613
+ st || (st = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
604
614
  };
605
- c.isReactWarning = !0, Object.defineProperty(e, "key", {
606
- get: c,
615
+ f.isReactWarning = !0, Object.defineProperty(e, "key", {
616
+ get: f,
607
617
  configurable: !0
608
618
  });
609
619
  }
610
620
  }
611
- function ut(e, o) {
621
+ function bt(e, c) {
612
622
  {
613
- var c = function() {
614
- Oe || (Oe = !0, T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", o));
623
+ var f = function() {
624
+ Le || (Le = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", c));
615
625
  };
616
- c.isReactWarning = !0, Object.defineProperty(e, "ref", {
617
- get: c,
626
+ f.isReactWarning = !0, Object.defineProperty(e, "ref", {
627
+ get: f,
618
628
  configurable: !0
619
629
  });
620
630
  }
621
631
  }
622
- var Je = function(e, o, c, w, b, x, v) {
623
- var y = {
632
+ var Ct = function(e, c, f, R, $, Y, L) {
633
+ var O = {
624
634
  // This tag allows us to uniquely identify this as a React Element
625
- $$typeof: l,
635
+ $$typeof: u,
626
636
  // Built-in properties that belong on the element
627
637
  type: e,
628
- key: o,
629
- ref: c,
630
- props: v,
638
+ key: c,
639
+ ref: f,
640
+ props: L,
631
641
  // Record the component responsible for creating this element.
632
- _owner: x
642
+ _owner: Y
633
643
  };
634
- return y._store = {}, Object.defineProperty(y._store, "validated", {
644
+ return O._store = {}, Object.defineProperty(O._store, "validated", {
635
645
  configurable: !1,
636
646
  enumerable: !1,
637
647
  writable: !0,
638
648
  value: !1
639
- }), Object.defineProperty(y, "_self", {
649
+ }), Object.defineProperty(O, "_self", {
640
650
  configurable: !1,
641
651
  enumerable: !1,
642
652
  writable: !1,
643
- value: w
644
- }), Object.defineProperty(y, "_source", {
653
+ value: R
654
+ }), Object.defineProperty(O, "_source", {
645
655
  configurable: !1,
646
656
  enumerable: !1,
647
657
  writable: !1,
648
- value: b
649
- }), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
658
+ value: $
659
+ }), Object.freeze && (Object.freeze(O.props), Object.freeze(O)), O;
650
660
  };
651
- function Xe(e, o, c, w, b) {
661
+ function lt(e, c, f, R, $) {
652
662
  {
653
- var x, v = {}, y = null, U = null;
654
- c !== void 0 && (Ke(c), y = "" + c), st(o) && (Ke(o.key), y = "" + o.key), ot(o) && (U = o.ref, lt(o, b));
655
- for (x in o)
656
- pe.call(o, x) && !it.hasOwnProperty(x) && (v[x] = o[x]);
663
+ var Y, L = {}, O = null, pe = null;
664
+ f !== void 0 && (ot(f), O = "" + f), Et(c) && (ot(c.key), O = "" + c.key), Ve(c) && (pe = c.ref, yt(c, $));
665
+ for (Y in c)
666
+ Ne.call(c, Y) && !gt.hasOwnProperty(Y) && (L[Y] = c[Y]);
657
667
  if (e && e.defaultProps) {
658
- var A = e.defaultProps;
659
- for (x in A)
660
- v[x] === void 0 && (v[x] = A[x]);
668
+ var ne = e.defaultProps;
669
+ for (Y in ne)
670
+ L[Y] === void 0 && (L[Y] = ne[Y]);
661
671
  }
662
- if (y || U) {
663
- var N = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
664
- y && ct(v, N), U && ut(v, N);
672
+ if (O || pe) {
673
+ var se = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
674
+ O && _t(L, se), pe && bt(L, se);
665
675
  }
666
- return Je(e, y, U, b, w, Ge.current, v);
676
+ return Ct(e, O, pe, $, R, it.current, L);
667
677
  }
668
678
  }
669
- var Fe = j.ReactCurrentOwner, Qe = j.ReactDebugCurrentFrame;
670
- function Re(e) {
679
+ var $e = p.ReactCurrentOwner, Ye = p.ReactDebugCurrentFrame;
680
+ function De(e) {
671
681
  if (e) {
672
- var o = e._owner, c = Pe(e.type, e._source, o ? o.type : null);
673
- Qe.setExtraStackFrame(c);
682
+ var c = e._owner, f = ke(e.type, e._source, c ? c.type : null);
683
+ Ye.setExtraStackFrame(f);
674
684
  } else
675
- Qe.setExtraStackFrame(null);
685
+ Ye.setExtraStackFrame(null);
676
686
  }
677
- var We;
678
- We = !1;
679
- function Be(e) {
680
- return typeof e == "object" && e !== null && e.$$typeof === l;
687
+ var Ze;
688
+ Ze = !1;
689
+ function Ge(e) {
690
+ return typeof e == "object" && e !== null && e.$$typeof === u;
681
691
  }
682
- function et() {
692
+ function ct() {
683
693
  {
684
- if (Fe.current) {
685
- var e = Y(Fe.current.type);
694
+ if ($e.current) {
695
+ var e = ae($e.current.type);
686
696
  if (e)
687
697
  return `
688
698
 
@@ -691,149 +701,148 @@ Check the render method of \`` + e + "`.";
691
701
  return "";
692
702
  }
693
703
  }
694
- function t(e) {
704
+ function xt(e) {
695
705
  return "";
696
706
  }
697
- var r = {};
698
- function n(e) {
707
+ var ut = {};
708
+ function t(e) {
699
709
  {
700
- var o = et();
701
- if (!o) {
702
- var c = typeof e == "string" ? e : e.displayName || e.name;
703
- c && (o = `
710
+ var c = ct();
711
+ if (!c) {
712
+ var f = typeof e == "string" ? e : e.displayName || e.name;
713
+ f && (c = `
704
714
 
705
- Check the top-level render call using <` + c + ">.");
715
+ Check the top-level render call using <` + f + ">.");
706
716
  }
707
- return o;
717
+ return c;
708
718
  }
709
719
  }
710
- function i(e, o) {
720
+ function r(e, c) {
711
721
  {
712
722
  if (!e._store || e._store.validated || e.key != null)
713
723
  return;
714
724
  e._store.validated = !0;
715
- var c = n(o);
716
- if (r[c])
725
+ var f = t(c);
726
+ if (ut[f])
717
727
  return;
718
- r[c] = !0;
719
- var w = "";
720
- e && e._owner && e._owner !== Fe.current && (w = " It was passed a child from " + Y(e._owner.type) + "."), Re(e), T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, w), Re(null);
728
+ ut[f] = !0;
729
+ var R = "";
730
+ e && e._owner && e._owner !== $e.current && (R = " It was passed a child from " + ae(e._owner.type) + "."), De(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', f, R), De(null);
721
731
  }
722
732
  }
723
- function a(e, o) {
733
+ function a(e, c) {
724
734
  {
725
735
  if (typeof e != "object")
726
736
  return;
727
- if (Le(e))
728
- for (var c = 0; c < e.length; c++) {
729
- var w = e[c];
730
- Be(w) && i(w, o);
737
+ if (Fe(e))
738
+ for (var f = 0; f < e.length; f++) {
739
+ var R = e[f];
740
+ Ge(R) && r(R, c);
731
741
  }
732
- else if (Be(e))
742
+ else if (Ge(e))
733
743
  e._store && (e._store.validated = !0);
734
744
  else if (e) {
735
- var b = he(e);
736
- if (typeof b == "function" && b !== e.entries)
737
- for (var x = b.call(e), v; !(v = x.next()).done; )
738
- Be(v.value) && i(v.value, o);
745
+ var $ = D(e);
746
+ if (typeof $ == "function" && $ !== e.entries)
747
+ for (var Y = $.call(e), L; !(L = Y.next()).done; )
748
+ Ge(L.value) && r(L.value, c);
739
749
  }
740
750
  }
741
751
  }
742
- function p(e) {
752
+ function s(e) {
743
753
  {
744
- var o = e.type;
745
- if (o == null || typeof o == "string")
754
+ var c = e.type;
755
+ if (c == null || typeof c == "string")
746
756
  return;
747
- var c;
748
- if (typeof o == "function")
749
- c = o.propTypes;
750
- else if (typeof o == "object" && (o.$$typeof === S || // Note: Memo only checks outer props here.
757
+ var f;
758
+ if (typeof c == "function")
759
+ f = c.propTypes;
760
+ else if (typeof c == "object" && (c.$$typeof === T || // Note: Memo only checks outer props here.
751
761
  // Inner props are checked in the reconciler.
752
- o.$$typeof === R))
753
- c = o.propTypes;
762
+ c.$$typeof === N))
763
+ f = c.propTypes;
754
764
  else
755
765
  return;
756
- if (c) {
757
- var w = Y(o);
758
- rt(c, e.props, "prop", w, e);
759
- } else if (o.PropTypes !== void 0 && !We) {
760
- We = !0;
761
- var b = Y(o);
762
- T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown");
766
+ if (f) {
767
+ var R = ae(c);
768
+ Ue(f, e.props, "prop", R, e);
769
+ } else if (c.PropTypes !== void 0 && !Ze) {
770
+ Ze = !0;
771
+ var $ = ae(c);
772
+ b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", $ || "Unknown");
763
773
  }
764
- typeof o.getDefaultProps == "function" && !o.getDefaultProps.isReactClassApproved && T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
774
+ typeof c.getDefaultProps == "function" && !c.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
765
775
  }
766
776
  }
767
- function u(e) {
777
+ function i(e) {
768
778
  {
769
- for (var o = Object.keys(e.props), c = 0; c < o.length; c++) {
770
- var w = o[c];
771
- if (w !== "children" && w !== "key") {
772
- Re(e), T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", w), Re(null);
779
+ for (var c = Object.keys(e.props), f = 0; f < c.length; f++) {
780
+ var R = c[f];
781
+ if (R !== "children" && R !== "key") {
782
+ De(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", R), De(null);
773
783
  break;
774
784
  }
775
785
  }
776
- e.ref !== null && (Re(e), T("Invalid attribute `ref` supplied to `React.Fragment`."), Re(null));
786
+ e.ref !== null && (De(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), De(null));
777
787
  }
778
788
  }
779
- var h = {};
780
- function O(e, o, c, w, b, x) {
789
+ var w = {};
790
+ function d(e, c, f, R, $, Y) {
781
791
  {
782
- var v = m(e);
783
- if (!v) {
784
- var y = "";
785
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (y += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
786
- var U = t();
787
- U ? y += U : y += et();
788
- var A;
789
- e === null ? A = "null" : Le(e) ? A = "array" : e !== void 0 && e.$$typeof === l ? (A = "<" + (Y(e.type) || "Unknown") + " />", y = " Did you accidentally export a JSX literal instead of a component?") : A = typeof e, T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", A, y);
792
+ var L = _(e);
793
+ if (!L) {
794
+ var O = "";
795
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (O += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
796
+ var pe = xt();
797
+ pe ? O += pe : O += ct();
798
+ var ne;
799
+ e === null ? ne = "null" : Fe(e) ? ne = "array" : e !== void 0 && e.$$typeof === u ? (ne = "<" + (ae(e.type) || "Unknown") + " />", O = " Did you accidentally export a JSX literal instead of a component?") : ne = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", ne, O);
790
800
  }
791
- var N = Xe(e, o, c, b, x);
792
- if (N == null)
793
- return N;
794
- if (v) {
795
- var ce = o.children;
796
- if (ce !== void 0)
797
- if (w)
798
- if (Le(ce)) {
799
- for (var $e = 0; $e < ce.length; $e++)
800
- a(ce[$e], e);
801
- Object.freeze && Object.freeze(ce);
801
+ var se = lt(e, c, f, $, Y);
802
+ if (se == null)
803
+ return se;
804
+ if (L) {
805
+ var _e = c.children;
806
+ if (_e !== void 0)
807
+ if (R)
808
+ if (Fe(_e)) {
809
+ for (var Be = 0; Be < _e.length; Be++)
810
+ a(_e[Be], e);
811
+ Object.freeze && Object.freeze(_e);
802
812
  } else
803
- T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
813
+ b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
804
814
  else
805
- a(ce, e);
815
+ a(_e, e);
806
816
  }
807
- if (pe.call(o, "key")) {
808
- var De = Y(e), J = Object.keys(o).filter(function(Pt) {
809
- return Pt !== "key";
810
- }), ft = J.length > 0 ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}";
811
- if (!h[De + ft]) {
812
- var kt = J.length > 0 ? "{" + J.join(": ..., ") + ": ...}" : "{}";
813
- T(`A props object containing a "key" prop is being spread into JSX:
817
+ if (Ne.call(c, "key")) {
818
+ var je = ae(e), he = Object.keys(c).filter(function(Zt) {
819
+ return Zt !== "key";
820
+ }), Rt = he.length > 0 ? "{key: someKey, " + he.join(": ..., ") + ": ...}" : "{key: someKey}";
821
+ if (!w[je + Rt]) {
822
+ var Yt = he.length > 0 ? "{" + he.join(": ..., ") + ": ...}" : "{}";
823
+ b(`A props object containing a "key" prop is being spread into JSX:
814
824
  let props = %s;
815
825
  <%s {...props} />
816
826
  React keys must be passed directly to JSX without using spread:
817
827
  let props = %s;
818
- <%s key={someKey} {...props} />`, ft, De, kt, De), h[De + ft] = !0;
828
+ <%s key={someKey} {...props} />`, Rt, je, Yt, je), w[je + Rt] = !0;
819
829
  }
820
830
  }
821
- return e === g ? u(N) : p(N), N;
831
+ return e === m ? i(se) : s(se), se;
822
832
  }
823
833
  }
824
- function ye(e, o, c) {
825
- return O(e, o, c, !0);
834
+ function x(e, c, f) {
835
+ return d(e, c, f, !0);
826
836
  }
827
- function He(e, o, c) {
828
- return O(e, o, c, !1);
837
+ function X(e, c, f) {
838
+ return d(e, c, f, !1);
829
839
  }
830
- var Ae = He, Tt = ye;
831
- ze.Fragment = g, ze.jsx = Ae, ze.jsxs = Tt;
832
- }()), ze;
840
+ var Se = X, Ke = x;
841
+ Xe.Fragment = m, Xe.jsx = Se, Xe.jsxs = Ke;
842
+ }()), Xe;
833
843
  }
834
- process.env.NODE_ENV === "production" ? ht.exports = Ht() : ht.exports = Yt();
835
- var Ue = ht.exports;
836
- const xt = (s) => Vt("path", s), wt = Ct(
844
+ process.env.NODE_ENV === "production" ? Dt.exports = Fr() : Dt.exports = Lr();
845
+ var xe = Dt.exports, rt = (n) => nr("path", n), nt = Ht(
837
846
  /**
838
847
  * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
839
848
  * Other props will be passed through to svg component.
@@ -841,371 +850,388 @@ const xt = (s) => Vt("path", s), wt = Ct(
841
850
  *
842
851
  * @return {JSX.Element} Stop component
843
852
  */
844
- ({ className: s, isPressed: l, ...E }, g) => {
845
- const k = {
846
- ...E,
847
- className: Lt(s, { "is-pressed": l }) || void 0,
853
+ ({ className: n, isPressed: u, ...l }, m) => {
854
+ const E = {
855
+ ...l,
856
+ className: ar(n, { "is-pressed": u }) || void 0,
848
857
  "aria-hidden": !0,
849
858
  focusable: !1
850
859
  };
851
- return /* @__PURE__ */ Ue.jsx("svg", { ...k, ref: g });
860
+ return /* @__PURE__ */ xe.jsx("svg", { ...E, ref: m });
852
861
  }
853
862
  );
854
- wt.displayName = "SVG";
855
- const zt = /* @__PURE__ */ Ue.jsx(wt, {
863
+ nt.displayName = "SVG";
864
+ const jr = /* @__PURE__ */ xe.jsx(nt, {
856
865
  viewBox: "0 0 24 24",
857
866
  xmlns: "http://www.w3.org/2000/svg",
858
- children: /* @__PURE__ */ Ue.jsx(xt, {
867
+ children: /* @__PURE__ */ xe.jsx(rt, {
859
868
  d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
860
869
  })
861
- }), Ut = /* @__PURE__ */ Ue.jsx(wt, {
870
+ }), Ir = /* @__PURE__ */ xe.jsx(nt, {
862
871
  xmlns: "http://www.w3.org/2000/svg",
863
872
  viewBox: "0 0 24 24",
864
- children: /* @__PURE__ */ Ue.jsx(xt, {
873
+ children: /* @__PURE__ */ xe.jsx(rt, {
865
874
  d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
866
875
  })
867
- }), Zt = "_file-picker-tree_3rwm2_1", qt = "_file-node-button_3rwm2_17", Kt = "_selected_3rwm2_53", Gt = "_focused_3rwm2_65", Jt = "_dropTarget_3rwm2_70", Xt = "_dropTargetInvalid_3rwm2_79", Qt = "_renaming_3rwm2_88", er = "_renameInput_3rwm2_93", tr = "_file-name_3rwm2_108", X = {
868
- filePickerTree: Zt,
869
- fileNodeButton: qt,
870
- selected: Kt,
871
- focused: Gt,
872
- dropTarget: Jt,
873
- dropTargetInvalid: Xt,
874
- renaming: Qt,
875
- renameInput: er,
876
- fileName: tr
876
+ }), Mr = /* @__PURE__ */ xe.jsx(nt, {
877
+ viewBox: "0 0 24 24",
878
+ xmlns: "http://www.w3.org/2000/svg",
879
+ children: /* @__PURE__ */ xe.jsx(rt, {
880
+ fillRule: "evenodd",
881
+ clipRule: "evenodd",
882
+ d: "M12.848 8a1 1 0 0 1-.914-.594l-.723-1.63a.5.5 0 0 0-.447-.276H5a.5.5 0 0 0-.5.5v11.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5v-9A.5.5 0 0 0 19 8h-6.152Zm.612-1.5a.5.5 0 0 1-.462-.31l-.445-1.084A2 2 0 0 0 10.763 4H5a2 2 0 0 0-2 2v11.5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2h-5.54Z"
883
+ })
884
+ }), Vr = /* @__PURE__ */ xe.jsxs(nt, {
885
+ xmlns: "http://www.w3.org/2000/svg",
886
+ viewBox: "0 0 24 24",
887
+ children: [/* @__PURE__ */ xe.jsx(rt, {
888
+ d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
889
+ }), /* @__PURE__ */ xe.jsx(rt, {
890
+ d: "M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"
891
+ })]
892
+ }), $r = "_file-picker-tree_3rwm2_1", Br = "_file-node-button_3rwm2_17", Wr = "_selected_3rwm2_53", Hr = "_focused_3rwm2_65", zr = "_dropTarget_3rwm2_70", Ur = "_dropTargetInvalid_3rwm2_79", Yr = "_renaming_3rwm2_88", Zr = "_renameInput_3rwm2_93", Gr = "_file-name_3rwm2_108", we = {
893
+ filePickerTree: $r,
894
+ fileNodeButton: Br,
895
+ selected: Wr,
896
+ focused: Hr,
897
+ dropTarget: zr,
898
+ dropTargetInvalid: Ur,
899
+ renaming: Yr,
900
+ renameInput: Zr,
901
+ fileName: Gr
877
902
  };
878
- function dt(s) {
879
- if (!s) return [];
880
- const l = s.replaceAll(/\\+/g, "/").replace(/\/{2,}/g, "/").replace(/\/$/, "") || s, E = l.startsWith("/"), g = l.split("/").filter(Boolean), k = [];
881
- let C = E ? "/" : "";
882
- E && k.push("/");
883
- for (const M of g)
884
- !C || C === "/" ? C = C === "/" ? `/${M}` : M : C = `${C}/${M}`, k.push(C);
885
- return k;
903
+ function Pt(n) {
904
+ if (!n) return [];
905
+ const u = n.replaceAll(/\\+/g, "/").replace(/\/{2,}/g, "/").replace(/\/$/, "") || n, l = u.startsWith("/"), m = u.split("/").filter(Boolean), E = [];
906
+ let g = l ? "/" : "";
907
+ l && E.push("/");
908
+ for (const k of m)
909
+ !g || g === "/" ? g = g === "/" ? `/${k}` : k : g = `${g}/${k}`, E.push(g);
910
+ return E;
886
911
  }
887
- function rr(s, l) {
888
- if (!s || !l || s === l) return !1;
889
- const E = s === "/" ? "/" : s.replace(/\/{2,}/g, "/"), g = l.replace(/\/{2,}/g, "/");
890
- return E === "/" ? g.startsWith("/") && g !== "/" : g.startsWith(`${E}/`);
912
+ function Kr(n, u) {
913
+ if (!n || !u || n === u) return !1;
914
+ const l = n === "/" ? "/" : n.replace(/\/{2,}/g, "/"), m = u.replace(/\/{2,}/g, "/");
915
+ return l === "/" ? m.startsWith("/") && m !== "/" : m.startsWith(`${l}/`);
891
916
  }
892
- function mt(s, l, E) {
893
- return s && (s === l ? E : s.startsWith(l === "/" ? "/" : `${l}/`) ? E + s.slice(l.length) : s);
917
+ function kt(n, u, l) {
918
+ return n && (n === u ? l : n.startsWith(u === "/" ? "/" : `${u}/`) ? l + n.slice(u.length) : n);
894
919
  }
895
- const nr = St(function({
920
+ const qr = Bt(function({
921
+ withContextMenu: u = !0,
896
922
  filesystem: l,
897
- root: E = "/wordpress",
898
- initialSelectedPath: g,
899
- onSelect: k = () => {
923
+ root: m = "/wordpress",
924
+ initialSelectedPath: E,
925
+ onSelect: g = () => {
900
926
  },
901
- onDoubleClickFile: C
902
- }, M) {
903
- const P = gt(() => {
904
- let t = (E || "/").replace(/\\+/g, "/");
927
+ onDoubleClickFile: k
928
+ }, V) {
929
+ const T = Nt(() => {
930
+ let t = (m || "/").replace(/\\+/g, "/");
905
931
  return t.startsWith("/") || (t = `/${t}`), t = t.replace(/\/{2,}/g, "/"), t.length > 1 && t.endsWith("/") && (t = t.slice(0, -1)), t || "/";
906
- }, [E]), S = (t) => !t || t === "." || t === ".." ? !1 : !/[\\/]/.test(t), [I, _] = ae(() => {
907
- if (!g)
932
+ }, [m]), y = (t) => !t || t === "." || t === ".." ? !1 : !/[\\/]/.test(t), [v, N] = Q(() => {
933
+ if (!E)
908
934
  return {};
909
935
  const t = {};
910
- for (const r of dt(g))
936
+ for (const r of Pt(E))
911
937
  t[r] = !0;
912
938
  return t;
913
- }), [R, V] = ae(
914
- () => g ?? null
915
- ), [Q, $] = ae(
916
- () => g ?? null
917
- ), [Z, he] = ae({}), [j, T] = ae(
939
+ }), [P, j] = Q(
940
+ () => E ?? null
941
+ ), [Z, A] = Q(
942
+ () => E ?? null
943
+ ), [D, p] = Q({}), [b, q] = Q(
918
944
  {}
919
- ), [fe, we] = ae(null), [ve, q] = ae(
945
+ ), [B, G] = Q(null), [ee, W] = Q(
920
946
  null
921
- ), B = ie({}), Ee = ie(!1), ee = ie(null), m = ie(null), H = ie(j), oe = ie(Z), Y = () => {
922
- for (const t of Object.keys(B.current))
923
- clearTimeout(B.current[t]), delete B.current[t];
924
- }, K = (t) => {
925
- const r = B.current[t];
926
- r && (clearTimeout(r), delete B.current[t]);
947
+ ), F = M({}), te = M(!1), _ = M(null), H = M(null), de = M(b), ae = M(D), re = () => {
948
+ for (const t of Object.keys(F.current))
949
+ clearTimeout(F.current[t]), delete F.current[t];
950
+ }, ue = (t) => {
951
+ const r = F.current[t];
952
+ r && (clearTimeout(r), delete F.current[t]);
927
953
  };
928
- ue(() => {
929
- H.current = j;
930
- }, [j]), ue(() => {
931
- oe.current = Z;
932
- }, [Z]);
933
- const L = (t) => {
934
- var n;
935
- const r = (n = ee.current) == null ? void 0 : n.querySelector(
954
+ I(() => {
955
+ de.current = b;
956
+ }, [b]), I(() => {
957
+ ae.current = D;
958
+ }, [D]);
959
+ const oe = (t) => {
960
+ var a;
961
+ const r = (a = _.current) == null ? void 0 : a.querySelector(
936
962
  `[data-path="${t}"]`
937
963
  );
938
964
  r && typeof r.focus == "function" && (r.focus(), r.scrollIntoView({
939
965
  behavior: "smooth",
940
966
  block: "nearest"
941
967
  }));
942
- }, te = (t, r = "") => (r ? `${r}/${t.name}` : t.name).replaceAll(/\\+/g, "/").replace(/\/{2,}/g, "/"), Te = (t, r) => t.children ? t.children : Z[r], ke = async (t, r) => {
943
- const n = await t.listFiles(r), i = [];
944
- for (const a of n) {
945
- const p = r === "/" ? `/${a}` : `${r}/${a}`, u = await t.isDir(p);
946
- i.push({ name: a, type: u ? "folder" : "file" });
947
- }
948
- return i.sort((a, p) => {
949
- var ye;
950
- if (a.type !== p.type) return a.type === "folder" ? -1 : 1;
951
- const u = r === "/" ? `/${a.name}` : `${r}/${a.name}`, h = r === "/" ? `/${p.name}` : `${r}/${p.name}`, O = (ye = ne.current) == null ? void 0 : ye.tempPath;
952
- if (O) {
953
- if (u === O) return -1;
954
- if (h === O) return 1;
968
+ }, be = (t, r = "") => (r ? `${r}/${t.name}` : t.name).replaceAll(/\\+/g, "/").replace(/\/{2,}/g, "/"), Re = (t, r) => t.children ? t.children : D[r], Te = async (t, r) => {
969
+ const a = await t.listFiles(r), s = [];
970
+ for (const i of a) {
971
+ const w = r === "/" ? `/${i}` : `${r}/${i}`, d = await t.isDir(w);
972
+ s.push({ name: i, type: d ? "folder" : "file" });
973
+ }
974
+ return s.sort((i, w) => {
975
+ var Se;
976
+ if (i.type !== w.type) return i.type === "folder" ? -1 : 1;
977
+ const d = r === "/" ? `/${i.name}` : `${r}/${i.name}`, x = r === "/" ? `/${w.name}` : `${r}/${w.name}`, X = (Se = ye.current) == null ? void 0 : Se.tempPath;
978
+ if (X) {
979
+ if (d === X) return -1;
980
+ if (x === X) return 1;
955
981
  }
956
- return a.name.localeCompare(p.name);
957
- }), i;
958
- }, _e = async (t) => await ke(l, t), de = (t, r) => {
982
+ return i.name.localeCompare(w.name);
983
+ }), s;
984
+ }, Pe = async (t) => await Te(l, t), le = (t, r) => {
959
985
  if (r.type !== "folder")
960
986
  return r.children;
961
- const n = r.children ?? oe.current[t];
962
- return n || H.current[t] ? n : (T((i) => ({ ...i, [t]: !0 })), new Promise((i) => {
963
- _e(t).then((a) => {
964
- he((p) => ({
965
- ...p,
966
- [t]: a ?? []
967
- })), i(a ?? []);
987
+ const a = r.children ?? ae.current[t];
988
+ return a || de.current[t] ? a : (q((s) => ({ ...s, [t]: !0 })), new Promise((s) => {
989
+ Pe(t).then((i) => {
990
+ p((w) => ({
991
+ ...w,
992
+ [t]: i ?? []
993
+ })), s(i ?? []);
968
994
  }).catch(() => {
969
- i([]);
995
+ s([]);
970
996
  }).finally(() => {
971
- T((a) => {
972
- const p = { ...a };
973
- return delete p[t], p;
997
+ q((i) => {
998
+ const w = { ...i };
999
+ return delete w[t], w;
974
1000
  });
975
1001
  });
976
1002
  }));
977
- }, G = (t, r) => {
978
- r.type === "folder" && (typeof window > "u" || B.current[t] || (B.current[t] = window.setTimeout(() => {
979
- _((n) => n[t] ? n : { ...n, [t]: !0 }), de(t, r), delete B.current[t];
1003
+ }, S = (t, r) => {
1004
+ r.type === "folder" && (typeof window > "u" || F.current[t] || (F.current[t] = window.setTimeout(() => {
1005
+ N((a) => a[t] ? a : { ...a, [t]: !0 }), le(t, r), delete F.current[t];
980
1006
  }, 600)));
981
- }, z = (t) => (T((r) => ({ ...r, [t]: !0 })), new Promise((r) => {
982
- _e(t).then((n) => {
983
- he((i) => ({
984
- ...i,
985
- [t]: n ?? []
986
- })), r(n ?? []);
1007
+ }, C = (t) => (q((r) => ({ ...r, [t]: !0 })), new Promise((r) => {
1008
+ Pe(t).then((a) => {
1009
+ p((s) => ({
1010
+ ...s,
1011
+ [t]: a ?? []
1012
+ })), r(a ?? []);
987
1013
  }).catch(() => {
988
1014
  r([]);
989
1015
  }).finally(() => {
990
- T((n) => {
991
- const i = { ...n };
992
- return delete i[t], i;
1016
+ q((a) => {
1017
+ const s = { ...a };
1018
+ return delete s[t], s;
993
1019
  });
994
1020
  });
995
- })), se = (t, r, n) => {
996
- _((i) => ({
997
- ...i,
998
- [t]: n
999
- })), n ? de(t, r) : he((i) => {
1000
- if (i[t] === void 0)
1001
- return i;
1002
- const a = { ...i };
1003
- return delete a[t], a;
1021
+ })), J = (t, r, a) => {
1022
+ N((s) => ({
1023
+ ...s,
1024
+ [t]: a
1025
+ })), a ? le(t, r) : p((s) => {
1026
+ if (s[t] === void 0)
1027
+ return s;
1028
+ const i = { ...s };
1029
+ return delete i[t], i;
1004
1030
  });
1005
- }, le = async (t) => {
1031
+ }, z = async (t) => {
1006
1032
  if (!t) return;
1007
- const r = dt(t);
1033
+ const r = Pt(t);
1008
1034
  if (r.length === 0) return;
1009
- _((a) => {
1010
- const p = { ...a };
1011
- for (const u of r)
1012
- p[u] = !0;
1013
- return p;
1035
+ N((i) => {
1036
+ const w = { ...i };
1037
+ for (const d of r)
1038
+ w[d] = !0;
1039
+ return w;
1014
1040
  });
1015
- let n = [
1016
- { name: P, type: "folder" }
1017
- ], i = "";
1018
- for (const a of r) {
1019
- const p = n == null ? void 0 : n.find((h) => te(h, i) === a);
1020
- if (!p || p.type !== "folder") {
1021
- i = a, n = [];
1041
+ let a = [
1042
+ { name: T, type: "folder" }
1043
+ ], s = "";
1044
+ for (const i of r) {
1045
+ const w = a == null ? void 0 : a.find((x) => be(x, s) === i);
1046
+ if (!w || w.type !== "folder") {
1047
+ s = i, a = [];
1022
1048
  continue;
1023
1049
  }
1024
- n = await de(a, p) ?? oe.current[a], i = a;
1050
+ a = await le(i, w) ?? ae.current[i], s = i;
1025
1051
  }
1026
- }, be = (t, r) => {
1052
+ }, ie = (t, r) => {
1027
1053
  if (!t || !r || t === r)
1028
1054
  return;
1029
- const n = t === "/" ? "/" : `${t}/`, i = (a) => a === t ? r : a.startsWith(n) ? r + a.slice(t.length) : null;
1030
- _((a) => {
1031
- let p = !1;
1032
- const u = { ...a };
1033
- for (const h of Object.keys(a)) {
1034
- const O = i(h);
1035
- O && O !== h && (u[O] = a[h], delete u[h], p = !0);
1055
+ const a = t === "/" ? "/" : `${t}/`, s = (i) => i === t ? r : i.startsWith(a) ? r + i.slice(t.length) : null;
1056
+ N((i) => {
1057
+ let w = !1;
1058
+ const d = { ...i };
1059
+ for (const x of Object.keys(i)) {
1060
+ const X = s(x);
1061
+ X && X !== x && (d[X] = i[x], delete d[x], w = !0);
1036
1062
  }
1037
- return p ? u : a;
1038
- }), he((a) => {
1039
- let p = !1;
1040
- const u = { ...a };
1041
- for (const h of Object.keys(a)) {
1042
- const O = i(h);
1043
- O && O !== h && (u[O] = a[h], delete u[h], p = !0);
1063
+ return w ? d : i;
1064
+ }), p((i) => {
1065
+ let w = !1;
1066
+ const d = { ...i };
1067
+ for (const x of Object.keys(i)) {
1068
+ const X = s(x);
1069
+ X && X !== x && (d[X] = i[x], delete d[x], w = !0);
1044
1070
  }
1045
- return p ? u : a;
1046
- }), V((a) => a && (i(a) ?? a)), $((a) => a && (i(a) ?? a));
1047
- }, me = () => {
1048
- we(null), q(null), Y();
1049
- }, ge = (t, r = !0) => {
1050
- V(t), r && k(t);
1051
- }, W = gt(() => [{ name: P, type: "folder" }], [P]), [D, re] = ae(null), [d, F] = ae(null), ne = ie(null), Ce = d;
1052
- Ot(
1053
- M,
1071
+ return w ? d : i;
1072
+ }), j((i) => i && (s(i) ?? i)), A((i) => i && (s(i) ?? i));
1073
+ }, Ee = () => {
1074
+ G(null), W(null), re();
1075
+ }, ve = (t, r = !0) => {
1076
+ j(t), r && g(t);
1077
+ }, ce = Nt(() => [{ name: T, type: "folder" }], [T]), [U, h] = Q(null), [ge, me] = Q(null), ye = M(null), ke = ge;
1078
+ Wt(
1079
+ V,
1054
1080
  () => ({
1055
1081
  focusPath: (t, r = {}) => {
1056
1082
  if (!t) return;
1057
1083
  const {
1058
- select: n = !0,
1059
- domFocus: i = !0,
1060
- notify: a = !1
1084
+ select: a = !0,
1085
+ domFocus: s = !0,
1086
+ notify: i = !1
1061
1087
  } = r;
1062
- n && ge(t, a), $(t), i && L(t);
1088
+ a && ve(t, i), A(t), s && oe(t);
1063
1089
  },
1064
1090
  selectPath: (t) => {
1065
- t && (ge(t), $(t), L(t));
1091
+ t && (ve(t), A(t), oe(t));
1066
1092
  },
1067
- getSelectedPath: () => R,
1068
- expandToPath: async (t) => await le(t),
1069
- refresh: async (t) => await z(t),
1070
- remapPath: be,
1093
+ getSelectedPath: () => P,
1094
+ expandToPath: async (t) => await z(t),
1095
+ refresh: async (t) => await C(t),
1096
+ remapPath: ie,
1071
1097
  createFile: async (t) => {
1072
- await Oe(t, "file", "untitled.php");
1098
+ await Ve(t, "file", "untitled.php");
1073
1099
  },
1074
1100
  createFolder: async (t) => {
1075
- await Oe(t, "folder", "New Folder");
1101
+ await Ve(t, "folder", "New Folder");
1076
1102
  }
1077
1103
  }),
1078
- [R, z, be, le]
1104
+ [P, C, ie, z]
1079
1105
  );
1080
- const Pe = ie(!1), pe = ie(
1081
- g ?? null
1082
- ), Ie = ie(g);
1083
- ue(() => {
1084
- Ee.current = !1;
1085
- }, [P]), ue(() => {
1086
- g && g !== Ie.current ? pe.current = g : g || (pe.current = null), Ie.current = g;
1087
- }, [g]), ue(() => {
1088
- if (!g || Pe.current)
1106
+ const Ne = M(!1), Ae = M(
1107
+ E ?? null
1108
+ ), ze = M(E);
1109
+ I(() => {
1110
+ te.current = !1;
1111
+ }, [T]), I(() => {
1112
+ E && E !== ze.current ? Ae.current = E : E || (Ae.current = null), ze.current = E;
1113
+ }, [E]), I(() => {
1114
+ if (!E || Ne.current)
1089
1115
  return;
1090
- Pe.current = !0;
1091
- const t = dt(g);
1092
- _((n) => {
1093
- const i = { ...n };
1094
- for (const a of t)
1095
- i[a] = !0;
1096
- return i;
1116
+ Ne.current = !0;
1117
+ const t = Pt(E);
1118
+ N((a) => {
1119
+ const s = { ...a };
1120
+ for (const i of t)
1121
+ s[i] = !0;
1122
+ return s;
1097
1123
  });
1098
- const r = t[t.length - 1] || g;
1099
- $(r), V(r), le(g);
1100
- }, [g, le]), ue(() => {
1101
- const t = pe.current;
1102
- !t || W.length === 0 || (pe.current = null, le(t));
1103
- }, [W, le]), ue(() => {
1104
- if (!Q) {
1105
- if (W.length > 0) {
1106
- const t = te(W[0]);
1107
- $(t);
1124
+ const r = t[t.length - 1] || E;
1125
+ A(r), j(r), z(E);
1126
+ }, [E, z]), I(() => {
1127
+ const t = Ae.current;
1128
+ !t || ce.length === 0 || (Ae.current = null, z(t));
1129
+ }, [ce, z]), I(() => {
1130
+ if (!Z) {
1131
+ if (ce.length > 0) {
1132
+ const t = be(ce[0]);
1133
+ A(t);
1108
1134
  }
1109
1135
  return;
1110
1136
  }
1111
- Ce && Ce === Q || L(Q);
1112
- }, [W, Q, Ce]), ue(() => {
1113
- if (W.length === 0)
1137
+ ke && ke === Z || oe(Z);
1138
+ }, [ce, Z, ke]), I(() => {
1139
+ if (ce.length === 0)
1114
1140
  return;
1115
- const t = W[0];
1116
- if ((t == null ? void 0 : t.type) !== "folder" || Ee.current)
1141
+ const t = ce[0];
1142
+ if ((t == null ? void 0 : t.type) !== "folder" || te.current)
1117
1143
  return;
1118
1144
  const r = t.name;
1119
- Ee.current = !0, _(
1120
- (n) => n[r] ? n : { ...n, [r]: !0 }
1121
- ), !oe.current[r] && !H.current[r] && de(r, t);
1122
- }, [W, de, P]), ue(() => () => {
1123
- m.current && clearTimeout(m.current), Y();
1124
- }, []), ue(() => {
1125
- D && setTimeout(() => {
1145
+ te.current = !0, N(
1146
+ (a) => a[r] ? a : { ...a, [r]: !0 }
1147
+ ), !ae.current[r] && !de.current[r] && le(r, t);
1148
+ }, [ce, le, T]), I(() => () => {
1149
+ H.current && clearTimeout(H.current), re();
1150
+ }, []), I(() => {
1151
+ U && setTimeout(() => {
1126
1152
  const t = document.querySelector(
1127
1153
  '[role="menu"] [role="menuitem"]'
1128
1154
  );
1129
1155
  t && typeof t.focus == "function" && t.focus();
1130
1156
  }, 0);
1131
- }, [D]);
1132
- const [Ze, xe] = ae(""), rt = (t, r) => {
1157
+ }, [U]);
1158
+ const [Me, Ue] = Q(""), ht = (t, r) => {
1133
1159
  if (t.type === "folder")
1134
1160
  return r;
1135
- const n = je(r);
1136
- return n && n || "/";
1137
- }, Ve = (t, r, n) => {
1138
- const i = rt(t, r);
1139
- if (!i)
1161
+ const a = Oe(r);
1162
+ return a && a || "/";
1163
+ }, Fe = (t, r, a) => {
1164
+ const s = ht(t, r);
1165
+ if (!s)
1140
1166
  return { allowed: !1, state: "invalid", destination: null };
1141
- if (n) {
1142
- if (i === n)
1167
+ if (a) {
1168
+ if (s === a)
1143
1169
  return { allowed: !1, state: "invalid", destination: null };
1144
- if (rr(n, i))
1170
+ if (Kr(a, s))
1145
1171
  return { allowed: !1, state: "invalid", destination: null };
1146
1172
  }
1147
- return { allowed: !0, state: "valid", destination: i };
1148
- }, Le = (t, r, n) => {
1149
- r.type !== "folder" && r.type !== "file" || (we(n), q(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
1173
+ return { allowed: !0, state: "valid", destination: s };
1174
+ }, wt = (t, r, a) => {
1175
+ r.type !== "folder" && r.type !== "file" || (G(a), W(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
1150
1176
  "application/x-wp-playground-path",
1151
- n
1152
- ), t.dataTransfer.setData("text/plain", n)));
1153
- }, nt = () => {
1154
- me();
1155
- }, at = (t, r, n) => {
1156
- const i = Ve(r, n, fe);
1157
- i.allowed && r.type === "folder" && G(n, r), q((a) => (a == null ? void 0 : a.path) === n && a.state === i.state ? a : { path: n, state: i.state });
1158
- }, qe = (t, r, n) => {
1159
- const i = Ve(r, n, fe);
1160
- i.allowed && i.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = fe ? "move" : "copy"), r.type === "folder" && G(n, r), q((a) => (a == null ? void 0 : a.path) === n && a.state === i.state ? a : { path: n, state: i.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), K(n), q((a) => (a == null ? void 0 : a.path) === n && a.state === "invalid" ? a : { path: n, state: "invalid" }));
1161
- }, Ke = (t, r, n) => {
1162
- K(n);
1163
- const i = t.relatedTarget;
1164
- i && t.currentTarget.contains(i) || q((a) => (a == null ? void 0 : a.path) === n ? null : a);
1165
- }, Ge = async (t, r, n) => {
1166
- const i = fe, a = Ve(r, n, i);
1167
- if (!a.allowed || !a.destination) {
1168
- me();
1177
+ a
1178
+ ), t.dataTransfer.setData("text/plain", a)));
1179
+ }, vt = () => {
1180
+ Ee();
1181
+ }, at = (t, r, a) => {
1182
+ const s = Fe(r, a, B);
1183
+ s.allowed && r.type === "folder" && S(a, r), W((i) => (i == null ? void 0 : i.path) === a && i.state === s.state ? i : { path: a, state: s.state });
1184
+ }, ot = (t, r, a) => {
1185
+ const s = Fe(r, a, B);
1186
+ s.allowed && s.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = B ? "move" : "copy"), r.type === "folder" && S(a, r), W((i) => (i == null ? void 0 : i.path) === a && i.state === s.state ? i : { path: a, state: s.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), ue(a), W((i) => (i == null ? void 0 : i.path) === a && i.state === "invalid" ? i : { path: a, state: "invalid" }));
1187
+ }, it = (t, r, a) => {
1188
+ ue(a);
1189
+ const s = t.relatedTarget;
1190
+ s && t.currentTarget.contains(s) || W((i) => (i == null ? void 0 : i.path) === a ? null : i);
1191
+ }, gt = async (t, r, a) => {
1192
+ const s = B, i = Fe(r, a, s);
1193
+ if (!i.allowed || !i.destination) {
1194
+ Ee();
1169
1195
  return;
1170
1196
  }
1171
- t.preventDefault(), t.stopPropagation(), K(n), q(null);
1197
+ t.preventDefault(), t.stopPropagation(), ue(a), W(null);
1172
1198
  try {
1173
- i ? await lt(i, a.destination) : await Qe(t, a.destination);
1199
+ s ? await _t(s, i.destination) : await De(t, i.destination);
1174
1200
  } finally {
1175
- me();
1201
+ Ee();
1176
1202
  }
1177
- }, it = (t, r, n) => {
1178
- t.preventDefault(), t.stopPropagation(), F(null), re({
1179
- absPath: n,
1203
+ }, st = (t, r, a) => {
1204
+ u && (t.preventDefault(), t.stopPropagation(), me(null), h({
1205
+ absPath: a,
1180
1206
  type: r.type,
1181
1207
  x: t.clientX,
1182
1208
  y: t.clientY
1183
- });
1184
- }, Se = async (t, r) => {
1185
- let n = r, i = 0;
1186
- const a = (u) => {
1187
- const h = u.lastIndexOf(".");
1188
- return h > 0 ? { stem: u.slice(0, h), ext: u.slice(h) } : { stem: u, ext: "" };
1189
- }, p = t === "/" ? "" : t;
1190
- for (; await (l == null ? void 0 : l.fileExists(`${p}/${n}`)) || await (l == null ? void 0 : l.isDir(`${p}/${n}`)); ) {
1191
- i += 1;
1192
- const { stem: u, ext: h } = a(r);
1193
- n = `${u} (${i})${h}`;
1194
- }
1195
- return n;
1196
- }, Oe = async (t, r, n) => {
1209
+ }));
1210
+ }, Le = async (t, r) => {
1211
+ let a = r, s = 0;
1212
+ const i = (d) => {
1213
+ const x = d.lastIndexOf(".");
1214
+ return x > 0 ? { stem: d.slice(0, x), ext: d.slice(x) } : { stem: d, ext: "" };
1215
+ }, w = t === "/" ? "" : t;
1216
+ for (; await (l == null ? void 0 : l.fileExists(`${w}/${a}`)) || await (l == null ? void 0 : l.isDir(`${w}/${a}`)); ) {
1217
+ s += 1;
1218
+ const { stem: d, ext: x } = i(r);
1219
+ a = `${d} (${s})${x}`;
1220
+ }
1221
+ return a;
1222
+ }, Ve = async (t, r, a) => {
1197
1223
  if (!l) return;
1198
- let i = t || R || P;
1224
+ let s = t || P || T;
1199
1225
  try {
1200
- await l.isDir(i) || (i = je(i));
1226
+ await l.isDir(s) || (s = Oe(s));
1201
1227
  } catch {
1202
- i = je(i);
1228
+ s = Oe(s);
1203
1229
  }
1204
- const a = i, p = await Se(a, n), u = Ne(a, p);
1205
- r === "folder" ? await l.mkdir(u) : await l.writeFile(u, ""), ne.current = { type: r, tempPath: u }, F(u), await z(a), setTimeout(() => {
1206
- $(u), L(u);
1230
+ const i = s, w = await Le(i, a), d = We(i, w);
1231
+ r === "folder" ? await l.mkdir(d) : await l.writeFile(d, ""), ye.current = { type: r, tempPath: d }, me(d), await C(i), setTimeout(() => {
1232
+ A(d), oe(d);
1207
1233
  }, 0);
1208
- }, ot = async (t) => {
1234
+ }, Et = async (t) => {
1209
1235
  if (!l) return !1;
1210
1236
  try {
1211
1237
  if (await l.fileExists(t))
@@ -1218,7 +1244,7 @@ const nr = St(function({
1218
1244
  } catch {
1219
1245
  }
1220
1246
  return !1;
1221
- }, st = async (t) => {
1247
+ }, yt = async (t) => {
1222
1248
  if (l)
1223
1249
  try {
1224
1250
  await l.mkdir(t);
@@ -1226,242 +1252,250 @@ const nr = St(function({
1226
1252
  if (!await l.isDir(t).catch(() => !1))
1227
1253
  throw r;
1228
1254
  }
1229
- }, lt = async (t, r) => {
1255
+ }, _t = async (t, r) => {
1230
1256
  if (!l) return;
1231
- const n = Mt(t), i = Ne(r, n);
1232
- if (i === t || await ot(i))
1257
+ const a = Ot(t), s = We(r, a);
1258
+ if (s === t || await Et(s))
1233
1259
  return;
1234
- const a = je(t);
1260
+ const i = Oe(t);
1235
1261
  try {
1236
- await l.mv(t, i), be(t, i);
1237
- const p = mt(
1238
- R,
1262
+ await l.mv(t, s), ie(t, s);
1263
+ const w = kt(
1264
+ P,
1239
1265
  t,
1240
- i
1266
+ s
1241
1267
  );
1242
- R && (R === t || R.startsWith(`${t}/`)) && k(p), $(
1243
- (u) => mt(u, t, i)
1244
- ), _((u) => ({
1245
- ...u,
1268
+ P && (P === t || P.startsWith(`${t}/`)) && g(w), A(
1269
+ (d) => kt(d, t, s)
1270
+ ), N((d) => ({
1271
+ ...d,
1246
1272
  [r]: !0
1247
1273
  })), await Promise.all([
1248
- z(a),
1249
- z(r)
1250
- ]), V(
1251
- (u) => mt(u, t, i)
1252
- ), L(i);
1274
+ C(i),
1275
+ C(r)
1276
+ ]), j(
1277
+ (d) => kt(d, t, s)
1278
+ ), oe(s);
1253
1279
  } catch {
1254
1280
  }
1255
- }, ct = (t) => {
1281
+ }, bt = (t) => {
1256
1282
  const r = t;
1257
1283
  return r.webkitGetAsEntry ? r.webkitGetAsEntry() : null;
1258
- }, ut = (t) => new Promise((r, n) => {
1259
- t.file(r, n);
1260
- }), Je = async (t, r) => {
1284
+ }, Ct = (t) => new Promise((r, a) => {
1285
+ t.file(r, a);
1286
+ }), lt = async (t, r) => {
1261
1287
  if (!l) return;
1262
- const n = t.name || "untitled", i = await Se(r, n), a = Ne(r, i), p = new Uint8Array(await t.arrayBuffer());
1263
- await l.writeFile(a, p);
1264
- }, Xe = async (t, r) => {
1265
- const n = await ut(t);
1266
- await Je(n, r);
1267
- }, Fe = async (t, r) => {
1268
- const n = await Se(
1288
+ const a = t.name || "untitled", s = await Le(r, a), i = We(r, s), w = new Uint8Array(await t.arrayBuffer());
1289
+ await l.writeFile(i, w);
1290
+ }, $e = async (t, r) => {
1291
+ const a = await Ct(t);
1292
+ await lt(a, r);
1293
+ }, Ye = async (t, r) => {
1294
+ const a = await Le(
1269
1295
  r,
1270
1296
  t.name || "New Folder"
1271
- ), i = Ne(r, n);
1272
- await st(i);
1273
- const a = t.createReader(), p = () => new Promise((u, h) => {
1274
- a.readEntries(
1275
- (O) => u(Array.from(O)),
1276
- h
1297
+ ), s = We(r, a);
1298
+ await yt(s);
1299
+ const i = t.createReader(), w = () => new Promise((d, x) => {
1300
+ i.readEntries(
1301
+ (X) => d(Array.from(X)),
1302
+ x
1277
1303
  );
1278
1304
  });
1279
1305
  for (; ; ) {
1280
- const u = await p();
1281
- if (!u.length)
1306
+ const d = await w();
1307
+ if (!d.length)
1282
1308
  break;
1283
- for (const h of u)
1284
- h.isFile ? await Xe(
1285
- h,
1286
- i
1287
- ) : h.isDirectory && await Fe(
1288
- h,
1289
- i
1309
+ for (const x of d)
1310
+ x.isFile ? await $e(
1311
+ x,
1312
+ s
1313
+ ) : x.isDirectory && await Ye(
1314
+ x,
1315
+ s
1290
1316
  );
1291
1317
  }
1292
- }, Qe = async (t, r) => {
1293
- var a, p;
1318
+ }, De = async (t, r) => {
1319
+ var i, w;
1294
1320
  if (!l) return;
1295
- const i = ((a = t.dataTransfer) != null && a.items ? Array.from(t.dataTransfer.items) : []).filter((u) => u.kind === "file").map((u) => ct(u)).filter((u) => !!u);
1296
- if (i.length > 0)
1297
- for (const u of i)
1298
- u.isFile ? await Xe(
1299
- u,
1321
+ const s = ((i = t.dataTransfer) != null && i.items ? Array.from(t.dataTransfer.items) : []).filter((d) => d.kind === "file").map((d) => bt(d)).filter((d) => !!d);
1322
+ if (s.length > 0)
1323
+ for (const d of s)
1324
+ d.isFile ? await $e(
1325
+ d,
1300
1326
  r
1301
- ) : u.isDirectory && await Fe(
1302
- u,
1327
+ ) : d.isDirectory && await Ye(
1328
+ d,
1303
1329
  r
1304
1330
  );
1305
1331
  else {
1306
- const u = (p = t.dataTransfer) != null && p.files ? Array.from(t.dataTransfer.files) : [];
1307
- for (const h of u)
1308
- await Je(h, r);
1332
+ const d = (w = t.dataTransfer) != null && w.files ? Array.from(t.dataTransfer.files) : [];
1333
+ for (const x of d)
1334
+ await lt(x, r);
1309
1335
  }
1310
- await z(r), _((u) => ({
1311
- ...u,
1336
+ await C(r), N((d) => ({
1337
+ ...d,
1312
1338
  [r]: !0
1313
1339
  }));
1314
- }, Re = async (t, r) => {
1340
+ }, Ze = async (t, r) => {
1315
1341
  if (!l) return;
1316
- const n = t;
1317
- re(null);
1342
+ const a = t;
1343
+ h(null);
1318
1344
  try {
1319
- r === "folder" ? await l.rmdir(n, { recursive: !0 }) : await l.unlink(n);
1345
+ r === "folder" ? await l.rmdir(a, { recursive: !0 }) : await l.unlink(a);
1320
1346
  } catch {
1321
1347
  } finally {
1322
- F(null);
1323
- const i = je(n);
1324
- await z(i), R && (R === n || R.startsWith(`${n}/`)) && k(null);
1348
+ me(null);
1349
+ const s = Oe(a);
1350
+ await C(s), P && (P === a || P.startsWith(`${a}/`)) && g(null);
1325
1351
  }
1326
- }, We = (t) => {
1352
+ }, Ge = async (t) => {
1353
+ if (l)
1354
+ try {
1355
+ const a = await (await l.read(t)).arrayBuffer(), s = new Blob([a]), i = URL.createObjectURL(s), w = document.createElement("a");
1356
+ w.href = i, w.download = Ot(t) || "download", document.body.appendChild(w), w.click(), document.body.removeChild(w), setTimeout(() => URL.revokeObjectURL(i), 6e4);
1357
+ } catch (r) {
1358
+ console.error("Failed to download file", r);
1359
+ }
1360
+ }, ct = (t) => {
1327
1361
  var r;
1328
- if (!d)
1362
+ if (!ge)
1329
1363
  if (t.key.length === 1 && t.key.match(/\S/)) {
1330
- const n = Ze + t.key.toLowerCase();
1331
- if (xe(n), m.current && clearTimeout(m.current), m.current = setTimeout(() => {
1332
- xe("");
1333
- }, 1e3), !ee.current)
1364
+ const a = Me + t.key.toLowerCase();
1365
+ if (Ue(a), H.current && clearTimeout(H.current), H.current = setTimeout(() => {
1366
+ Ue("");
1367
+ }, 1e3), !_.current)
1334
1368
  return;
1335
- const i = Array.from(
1336
- ee.current.querySelectorAll(".file-node-button")
1337
- ), a = document.activeElement;
1338
- let p = 0;
1339
- a && i.includes(a) && (p = i.indexOf(
1340
- a
1369
+ const s = Array.from(
1370
+ _.current.querySelectorAll(".file-node-button")
1371
+ ), i = document.activeElement;
1372
+ let w = 0;
1373
+ i && s.includes(i) && (w = s.indexOf(
1374
+ i
1341
1375
  ));
1342
- for (let u = 0; u < i.length; u++) {
1343
- const h = (p + u) % i.length, O = i[h];
1344
- if ((r = O.textContent) != null && r.toLowerCase().trim().startsWith(n)) {
1345
- O.focus();
1346
- const ye = O.getAttribute("data-path");
1347
- ye && $(ye);
1376
+ for (let d = 0; d < s.length; d++) {
1377
+ const x = (w + d) % s.length, X = s[x];
1378
+ if ((r = X.textContent) != null && r.toLowerCase().trim().startsWith(a)) {
1379
+ X.focus();
1380
+ const Se = X.getAttribute("data-path");
1381
+ Se && A(Se);
1348
1382
  break;
1349
1383
  }
1350
1384
  }
1351
1385
  } else
1352
- xe(""), m.current && clearTimeout(m.current);
1353
- }, Be = async (t, r) => {
1354
- const n = ne.current, i = (n == null ? void 0 : n.tempPath) === t, a = je(t), p = (r || "").trim();
1355
- if (!S(p)) {
1356
- if (i) {
1386
+ Ue(""), H.current && clearTimeout(H.current);
1387
+ }, xt = async (t, r) => {
1388
+ const a = ye.current, s = (a == null ? void 0 : a.tempPath) === t, i = Oe(t), w = (r || "").trim();
1389
+ if (!y(w)) {
1390
+ if (s) {
1357
1391
  try {
1358
- n.type === "folder" ? await l.rmdir(t, {
1392
+ a.type === "folder" ? await l.rmdir(t, {
1359
1393
  recursive: !0
1360
1394
  }) : await l.unlink(t);
1361
1395
  } catch {
1362
1396
  }
1363
- ne.current = null;
1397
+ ye.current = null;
1364
1398
  }
1365
- F(i ? null : t);
1399
+ me(s ? null : t);
1366
1400
  return;
1367
1401
  }
1368
- let u = Ne(a, p), h = u;
1369
- if (h === t) {
1370
- F(null);
1371
- const Ae = i && (n == null ? void 0 : n.type) === "file";
1372
- i && (ne.current = null), setTimeout(() => {
1373
- $(h), L(h), Ae && C && C(h);
1402
+ let d = We(i, w), x = d;
1403
+ if (x === t) {
1404
+ me(null);
1405
+ const e = s && (a == null ? void 0 : a.type) === "file";
1406
+ s && (ye.current = null), setTimeout(() => {
1407
+ A(x), oe(x), e && k && k(x);
1374
1408
  }, 0);
1375
1409
  return;
1376
1410
  }
1377
- const O = await l.fileExists(h), ye = await l.isDir(h);
1378
- if ((O || ye) && h !== t)
1379
- if (i)
1411
+ const X = await l.fileExists(x), Se = await l.isDir(x);
1412
+ if ((X || Se) && x !== t)
1413
+ if (s)
1380
1414
  try {
1381
- const Ae = await Se(
1382
- a === "/" ? "/" : a,
1383
- p
1415
+ const e = await Le(
1416
+ i === "/" ? "/" : i,
1417
+ w
1384
1418
  );
1385
- u = Ne(a, Ae), h = u;
1419
+ d = We(i, e), x = d;
1386
1420
  } catch {
1387
1421
  }
1388
1422
  else {
1389
- F(t);
1423
+ me(t);
1390
1424
  return;
1391
1425
  }
1392
- let He = (n == null ? void 0 : n.type) === "folder";
1426
+ let Ke = (a == null ? void 0 : a.type) === "folder";
1393
1427
  try {
1394
- await l.mv(t, u), n || (He = await l.isDir(u)), He && be(t, h), R === t && k(h), await z(a), $(h), L(h), i && !He && C && C(h);
1428
+ await l.mv(t, d), a || (Ke = await l.isDir(d)), Ke && ie(t, x), P === t && g(x), await C(i), A(x), oe(x), s && !Ke && k && k(x);
1395
1429
  } catch {
1396
- if (i)
1430
+ if (s)
1397
1431
  try {
1398
- (n == null ? void 0 : n.type) === "folder" ? await l.rmdir(t, {
1432
+ (a == null ? void 0 : a.type) === "folder" ? await l.rmdir(t, {
1399
1433
  recursive: !0
1400
1434
  }) : await l.unlink(t);
1401
1435
  } catch {
1402
1436
  }
1403
1437
  } finally {
1404
- ne.current = null, F(null);
1438
+ ye.current = null, me(null);
1405
1439
  }
1406
- }, et = async (t) => {
1407
- const r = ne.current;
1440
+ }, ut = async (t) => {
1441
+ const r = ye.current;
1408
1442
  if (!l || (r == null ? void 0 : r.tempPath) !== t) {
1409
- F((i) => i === t ? null : i);
1443
+ me((s) => s === t ? null : s);
1410
1444
  return;
1411
1445
  }
1412
1446
  try {
1413
1447
  r.type === "folder" ? await l.rmdir(t, { recursive: !0 }) : await l.unlink(t);
1414
1448
  } catch {
1415
1449
  }
1416
- ne.current = null, F(null);
1417
- const n = je(t);
1418
- await z(n), $(n), L(n);
1450
+ ye.current = null, me(null);
1451
+ const a = Oe(t);
1452
+ await C(a), A(a), oe(a);
1419
1453
  };
1420
- return /* @__PURE__ */ f.createElement("div", { onKeyDown: We, ref: ee }, /* @__PURE__ */ f.createElement(Dt, { className: X.filePickerTree }, W.map((t, r) => /* @__PURE__ */ f.createElement(
1421
- Rt,
1454
+ return /* @__PURE__ */ o.createElement("div", { onKeyDown: ct, ref: _ }, /* @__PURE__ */ o.createElement(Kt, { className: we.filePickerTree }, ce.map((t, r) => /* @__PURE__ */ o.createElement(
1455
+ zt,
1422
1456
  {
1423
1457
  key: t.name,
1424
1458
  node: t,
1425
1459
  level: 0,
1426
1460
  position: r + 1,
1427
- setSize: W.length,
1428
- expandedNodePaths: I,
1429
- onToggle: se,
1430
- selectedNode: R,
1431
- focusPath: (n) => $(n),
1432
- focusedNode: Q,
1433
- selectPath: ge,
1434
- generatePath: te,
1435
- getChildren: Te,
1436
- onContextMenu: it,
1437
- renamingPath: Ce,
1438
- onRename: Be,
1439
- onRenameCancel: et,
1440
- dropIndicator: ve,
1441
- onDragStart: Le,
1442
- onDragEnd: nt,
1461
+ setSize: ce.length,
1462
+ expandedNodePaths: v,
1463
+ onToggle: J,
1464
+ selectedNode: P,
1465
+ focusPath: (a) => A(a),
1466
+ focusedNode: Z,
1467
+ selectPath: ve,
1468
+ generatePath: be,
1469
+ getChildren: Re,
1470
+ onContextMenu: st,
1471
+ renamingPath: ke,
1472
+ onRename: xt,
1473
+ onRenameCancel: ut,
1474
+ dropIndicator: ee,
1475
+ onDragStart: wt,
1476
+ onDragEnd: vt,
1443
1477
  onDragEnter: at,
1444
- onDragOver: qe,
1445
- onDragLeave: Ke,
1446
- onDrop: Ge,
1447
- rootPath: P,
1448
- onDoubleClickFile: C
1449
- }
1450
- ))), D && /* @__PURE__ */ f.createElement(
1451
- jt,
1478
+ onDragOver: ot,
1479
+ onDragLeave: it,
1480
+ onDrop: gt,
1481
+ rootPath: T,
1482
+ onDoubleClickFile: k
1483
+ }
1484
+ ))), U && /* @__PURE__ */ o.createElement(
1485
+ qt,
1452
1486
  {
1453
1487
  placement: "bottom-start",
1454
- onClose: () => re(null),
1488
+ onClose: () => h(null),
1455
1489
  anchor: {
1456
1490
  getBoundingClientRect: () => ({
1457
- x: D.x,
1458
- y: D.y,
1491
+ x: U.x,
1492
+ y: U.y,
1459
1493
  width: 0,
1460
1494
  height: 0,
1461
- top: D.y,
1462
- left: D.x,
1463
- right: D.x,
1464
- bottom: D.y,
1495
+ top: U.y,
1496
+ left: U.x,
1497
+ right: U.x,
1498
+ bottom: U.y,
1465
1499
  toJSON: () => ({})
1466
1500
  }),
1467
1501
  ownerDocument: document
@@ -1470,344 +1504,1042 @@ const nr = St(function({
1470
1504
  resize: !1,
1471
1505
  focusOnMount: "firstElement"
1472
1506
  },
1473
- /* @__PURE__ */ f.createElement(Ft, { role: "menu" }, D.type === "folder" && /* @__PURE__ */ f.createElement(
1474
- tt,
1507
+ /* @__PURE__ */ o.createElement(Jt, { role: "menu" }, U.type === "folder" && /* @__PURE__ */ o.createElement(
1508
+ qe,
1475
1509
  {
1476
1510
  role: "menuitem",
1477
1511
  onClick: async () => {
1478
- re(null), await Oe(
1479
- D.absPath,
1512
+ h(null), await Ve(
1513
+ U.absPath,
1480
1514
  "file",
1481
1515
  "untitled.php"
1482
1516
  );
1483
1517
  }
1484
1518
  },
1485
1519
  "Create file"
1486
- ), D.type === "folder" && /* @__PURE__ */ f.createElement(
1487
- tt,
1520
+ ), U.type === "folder" && /* @__PURE__ */ o.createElement(
1521
+ qe,
1488
1522
  {
1489
1523
  role: "menuitem",
1490
1524
  onClick: async () => {
1491
- re(null), await Oe(
1492
- D.absPath,
1525
+ h(null), await Ve(
1526
+ U.absPath,
1493
1527
  "folder",
1494
1528
  "New Folder"
1495
1529
  );
1496
1530
  }
1497
1531
  },
1498
1532
  "Create directory"
1499
- ), /* @__PURE__ */ f.createElement(
1500
- tt,
1533
+ ), /* @__PURE__ */ o.createElement(
1534
+ qe,
1501
1535
  {
1502
1536
  role: "menuitem",
1503
1537
  onClick: () => {
1504
- re(null), F(D.absPath);
1538
+ h(null), me(U.absPath);
1505
1539
  }
1506
1540
  },
1507
1541
  "Rename"
1508
- ), /* @__PURE__ */ f.createElement(
1509
- tt,
1542
+ ), U.type === "file" && /* @__PURE__ */ o.createElement(
1543
+ qe,
1544
+ {
1545
+ role: "menuitem",
1546
+ onClick: async () => {
1547
+ h(null), await Ge(
1548
+ U.absPath
1549
+ );
1550
+ }
1551
+ },
1552
+ "Download"
1553
+ ), /* @__PURE__ */ o.createElement(
1554
+ qe,
1510
1555
  {
1511
1556
  role: "menuitem",
1512
- onClick: () => Re(
1513
- D.absPath,
1514
- D.type
1557
+ onClick: () => Ze(
1558
+ U.absPath,
1559
+ U.type
1515
1560
  )
1516
1561
  },
1517
1562
  "Delete"
1518
1563
  ))
1519
1564
  ));
1520
- }), Rt = ({
1521
- node: s,
1522
- level: l,
1523
- position: E,
1524
- setSize: g,
1525
- expandedNodePaths: k,
1526
- onToggle: C,
1527
- selectedNode: M,
1528
- focusPath: P,
1529
- focusedNode: S,
1530
- selectPath: I,
1531
- generatePath: _,
1532
- getChildren: R,
1533
- onContextMenu: V,
1534
- renamingPath: Q,
1535
- onRename: $,
1536
- onRenameCancel: Z,
1537
- parentPath: he = "",
1538
- dropIndicator: j,
1539
- onDragStart: T,
1540
- onDragEnd: fe,
1541
- onDragEnter: we,
1542
- onDragOver: ve,
1543
- onDragLeave: q,
1544
- onDrop: B,
1545
- rootPath: Ee,
1546
- onDoubleClickFile: ee
1565
+ }), zt = ({
1566
+ node: n,
1567
+ level: u,
1568
+ position: l,
1569
+ setSize: m,
1570
+ expandedNodePaths: E,
1571
+ onToggle: g,
1572
+ selectedNode: k,
1573
+ focusPath: V,
1574
+ focusedNode: T,
1575
+ selectPath: y,
1576
+ generatePath: v,
1577
+ getChildren: N,
1578
+ onContextMenu: P,
1579
+ renamingPath: j,
1580
+ onRename: Z,
1581
+ onRenameCancel: A,
1582
+ parentPath: D = "",
1583
+ dropIndicator: p,
1584
+ onDragStart: b,
1585
+ onDragEnd: q,
1586
+ onDragEnter: B,
1587
+ onDragOver: G,
1588
+ onDragLeave: ee,
1589
+ onDrop: W,
1590
+ rootPath: F,
1591
+ onDoubleClickFile: te
1547
1592
  }) => {
1548
- const m = _(s, he), H = k[m], oe = Q === m, Y = ie(null), [K, L] = ae(s.name), te = ie(!1), Te = (j == null ? void 0 : j.path) === m, ke = Te && (j == null ? void 0 : j.state) === "valid", _e = Te && (j == null ? void 0 : j.state) === "invalid", de = !oe && m !== Ee, G = ie(null), z = {
1549
- onDragEnter: (d) => we == null ? void 0 : we(d, s, m),
1550
- onDragOver: (d) => ve == null ? void 0 : ve(d, s, m),
1551
- onDragLeave: (d) => q == null ? void 0 : q(d, s, m),
1552
- onDrop: (d) => B == null ? void 0 : B(d, s, m)
1553
- }, se = R(s, m) ?? [];
1554
- ue(() => {
1555
- var d;
1556
- oe ? (L(s.name), te.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
1557
- var F;
1558
- (F = Y.current) == null || F.select();
1559
- }) : (d = Y.current) == null || d.select()) : te.current = !1;
1560
- }, [oe, s.name]);
1561
- const le = () => {
1562
- s.type === "folder" && C(m, s, !H);
1563
- }, be = (d) => {
1564
- var F, ne;
1565
- if (d.key === "ArrowLeft")
1566
- H ? le() : (F = document.querySelector(
1567
- `[data-path="${he}"]`
1568
- )) == null || F.focus(), d.preventDefault(), d.stopPropagation();
1569
- else if (d.key === "ArrowRight") {
1593
+ const _ = v(n, D), H = E[_], de = j === _, ae = M(null), [re, ue] = Q(n.name), oe = M(!1), be = (p == null ? void 0 : p.path) === _, Re = be && (p == null ? void 0 : p.state) === "valid", Te = be && (p == null ? void 0 : p.state) === "invalid", Pe = !de && _ !== F, le = M(null), S = {
1594
+ onDragEnter: (h) => B == null ? void 0 : B(h, n, _),
1595
+ onDragOver: (h) => G == null ? void 0 : G(h, n, _),
1596
+ onDragLeave: (h) => ee == null ? void 0 : ee(h, n, _),
1597
+ onDrop: (h) => W == null ? void 0 : W(h, n, _)
1598
+ }, C = N(n, _) ?? [];
1599
+ I(() => {
1600
+ var h;
1601
+ de ? (ue(n.name), oe.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
1602
+ var ge;
1603
+ (ge = ae.current) == null || ge.select();
1604
+ }) : (h = ae.current) == null || h.select()) : oe.current = !1;
1605
+ }, [de, n.name]);
1606
+ const J = () => {
1607
+ n.type === "folder" && g(_, n, !H);
1608
+ }, z = (h) => {
1609
+ var ge, me;
1610
+ if (h.key === "ArrowLeft")
1611
+ H ? J() : (ge = document.querySelector(
1612
+ `[data-path="${D}"]`
1613
+ )) == null || ge.focus(), h.preventDefault(), h.stopPropagation();
1614
+ else if (h.key === "ArrowRight") {
1570
1615
  if (H) {
1571
- if (se != null && se.length) {
1572
- const Ce = _(
1573
- se[0],
1574
- m
1616
+ if (C != null && C.length) {
1617
+ const ye = v(
1618
+ C[0],
1619
+ _
1575
1620
  );
1576
- (ne = document.querySelector(
1577
- `[data-path="${Ce}"]`
1578
- )) == null || ne.focus();
1621
+ (me = document.querySelector(
1622
+ `[data-path="${ye}"]`
1623
+ )) == null || me.focus();
1579
1624
  }
1580
1625
  } else
1581
- le();
1582
- d.preventDefault(), d.stopPropagation();
1583
- } else d.key === " " || d.key === "Space" || d.key === "Spacebar" ? (s.type === "folder" && C(m, s, !H), d.preventDefault()) : d.key === "Enter" && (s.type === "folder" ? C(m, s, !H) : (I(m, !1), P(m), ee ? ee(m) : I(m, !0)), d.preventDefault());
1584
- }, me = (d) => {
1585
- V == null || V(d, s, m);
1586
- }, ge = (d) => {
1587
- d.preventDefault(), te.current = !0, $ == null || $(m, K.trim());
1588
- }, W = (d) => {
1589
- if (d.key === "Escape") {
1590
- d.preventDefault(), d.stopPropagation(), te.current = !0, Z == null || Z(m);
1626
+ J();
1627
+ h.preventDefault(), h.stopPropagation();
1628
+ } else h.key === " " || h.key === "Space" || h.key === "Spacebar" ? (n.type === "folder" && g(_, n, !H), h.preventDefault()) : h.key === "Enter" && (n.type === "folder" ? g(_, n, !H) : (y(_, !1), V(_), te ? te(_) : y(_, !0)), h.preventDefault());
1629
+ }, ie = (h) => {
1630
+ P == null || P(h, n, _);
1631
+ }, Ee = (h) => {
1632
+ h.preventDefault(), oe.current = !0, Z == null || Z(_, re.trim());
1633
+ }, ve = (h) => {
1634
+ if (h.key === "Escape") {
1635
+ h.preventDefault(), h.stopPropagation(), oe.current = !0, A == null || A(_);
1591
1636
  return;
1592
1637
  }
1593
- (d.key === "ArrowLeft" || d.key === "ArrowRight" || d.key === "ArrowUp" || d.key === "ArrowDown") && d.stopPropagation();
1594
- }, D = () => {
1595
- te.current || Z == null || Z(m), te.current = !1;
1596
- }, re = () => {
1597
- if (s.type === "folder") {
1598
- le(), I(m), P(m);
1638
+ (h.key === "ArrowLeft" || h.key === "ArrowRight" || h.key === "ArrowUp" || h.key === "ArrowDown") && h.stopPropagation();
1639
+ }, ce = () => {
1640
+ oe.current || A == null || A(_), oe.current = !1;
1641
+ }, U = () => {
1642
+ if (n.type === "folder") {
1643
+ J(), y(_), V(_);
1599
1644
  return;
1600
1645
  }
1601
- const d = G.current !== null;
1602
- if (d && G.current && clearTimeout(G.current), G.current = null, d) {
1603
- ee ? ee(m) : I(m, !0);
1646
+ const h = le.current !== null;
1647
+ if (h && le.current && clearTimeout(le.current), le.current = null, h) {
1648
+ te ? te(_) : y(_, !0);
1604
1649
  return;
1605
1650
  }
1606
- I(m, !1), P(m), I(m, !0), G.current = window.setTimeout(() => {
1607
- G.current = null;
1651
+ y(_, !1), V(_), y(_, !0), le.current = window.setTimeout(() => {
1652
+ le.current = null;
1608
1653
  }, 300);
1609
1654
  };
1610
- return ue(() => () => {
1611
- G.current !== null && typeof window < "u" && clearTimeout(G.current);
1612
- }, []), /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
1613
- At,
1655
+ return I(() => () => {
1656
+ le.current !== null && typeof window < "u" && clearTimeout(le.current);
1657
+ }, []), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1658
+ Xt,
1614
1659
  {
1615
- level: l,
1616
- positionInSet: E,
1617
- setSize: g
1660
+ level: u,
1661
+ positionInSet: l,
1662
+ setSize: m
1618
1663
  },
1619
- /* @__PURE__ */ f.createElement($t, null, () => /* @__PURE__ */ f.createElement(f.Fragment, null, oe ? /* @__PURE__ */ f.createElement(
1664
+ /* @__PURE__ */ o.createElement(Qt, null, () => /* @__PURE__ */ o.createElement(o.Fragment, null, de ? /* @__PURE__ */ o.createElement(
1620
1665
  "form",
1621
1666
  {
1622
- onSubmit: ge,
1623
- className: yt(
1624
- X.fileNodeButton,
1625
- X.renaming,
1667
+ onSubmit: Ee,
1668
+ className: et(
1669
+ we.fileNodeButton,
1670
+ we.renaming,
1626
1671
  "file-node-button",
1627
1672
  {
1628
- [X.selected]: M === m,
1629
- [X.focused]: S === m,
1630
- [X.dropTarget]: ke,
1631
- [X.dropTargetInvalid]: _e
1673
+ [we.selected]: k === _,
1674
+ [we.focused]: T === _,
1675
+ [we.dropTarget]: Re,
1676
+ [we.dropTargetInvalid]: Te
1632
1677
  }
1633
1678
  ),
1634
- "data-path": m,
1635
- onContextMenu: me,
1636
- ...z
1679
+ "data-path": _,
1680
+ onContextMenu: ie,
1681
+ ...S
1637
1682
  },
1638
- /* @__PURE__ */ f.createElement(
1639
- bt,
1683
+ /* @__PURE__ */ o.createElement(
1684
+ Vt,
1640
1685
  {
1641
- node: s,
1642
- isOpen: s.type === "folder" && H,
1643
- level: l,
1686
+ node: n,
1687
+ isOpen: n.type === "folder" && H,
1688
+ level: u,
1644
1689
  hideName: !0
1645
1690
  }
1646
1691
  ),
1647
- /* @__PURE__ */ f.createElement(
1692
+ /* @__PURE__ */ o.createElement(
1648
1693
  "input",
1649
1694
  {
1650
- ref: Y,
1651
- className: X.renameInput,
1652
- value: K,
1653
- onChange: (d) => L(d.target.value),
1654
- onBlur: D,
1655
- onFocus: () => P(m),
1656
- onKeyDown: W
1695
+ ref: ae,
1696
+ className: we.renameInput,
1697
+ value: re,
1698
+ onChange: (h) => ue(h.target.value),
1699
+ onBlur: ce,
1700
+ onFocus: () => V(_),
1701
+ onKeyDown: ve
1657
1702
  }
1658
1703
  )
1659
- ) : /* @__PURE__ */ f.createElement(
1660
- pt,
1704
+ ) : /* @__PURE__ */ o.createElement(
1705
+ mt,
1661
1706
  {
1662
- ...z,
1663
- draggable: de,
1664
- onDragStart: (d) => T == null ? void 0 : T(d, s, m),
1665
- onDragEnd: (d) => fe == null ? void 0 : fe(d, s, m),
1666
- onClick: re,
1667
- onKeyDown: be,
1707
+ ...S,
1708
+ draggable: Pe,
1709
+ onDragStart: (h) => b == null ? void 0 : b(h, n, _),
1710
+ onDragEnd: (h) => q == null ? void 0 : q(h, n, _),
1711
+ onClick: U,
1712
+ onKeyDown: z,
1668
1713
  onFocus: () => {
1669
- P(m);
1714
+ V(_);
1670
1715
  },
1671
- onContextMenu: me,
1672
- className: yt(
1673
- X.fileNodeButton,
1716
+ onContextMenu: ie,
1717
+ className: et(
1718
+ we.fileNodeButton,
1674
1719
  "file-node-button",
1675
1720
  {
1676
- [X.selected]: M === m,
1677
- [X.focused]: S === m,
1678
- [X.dropTarget]: ke,
1679
- [X.dropTargetInvalid]: _e
1721
+ [we.selected]: k === _,
1722
+ [we.focused]: T === _,
1723
+ [we.dropTarget]: Re,
1724
+ [we.dropTargetInvalid]: Te
1680
1725
  }
1681
1726
  ),
1682
- "data-path": m,
1727
+ "data-path": _,
1683
1728
  "data-expanded": H ? "true" : "false"
1684
1729
  },
1685
- /* @__PURE__ */ f.createElement(
1686
- bt,
1730
+ /* @__PURE__ */ o.createElement(
1731
+ Vt,
1687
1732
  {
1688
- node: s,
1689
- isOpen: s.type === "folder" && H,
1690
- level: l
1733
+ node: n,
1734
+ isOpen: n.type === "folder" && H,
1735
+ level: u
1691
1736
  }
1692
1737
  )
1693
1738
  )))
1694
- ), H && se && se.map((d, F) => /* @__PURE__ */ f.createElement(
1695
- Rt,
1739
+ ), H && C && C.map((h, ge) => /* @__PURE__ */ o.createElement(
1740
+ zt,
1696
1741
  {
1697
- key: d.name,
1698
- node: d,
1699
- level: l + 1,
1700
- position: F + 1,
1701
- setSize: se.length,
1702
- expandedNodePaths: k,
1703
- onToggle: C,
1704
- selectedNode: M,
1705
- focusPath: P,
1706
- focusedNode: S,
1707
- selectPath: I,
1708
- generatePath: _,
1709
- getChildren: R,
1710
- onContextMenu: V,
1711
- renamingPath: Q,
1712
- onRename: $,
1713
- onRenameCancel: Z,
1714
- parentPath: m,
1715
- dropIndicator: j,
1716
- onDragStart: T,
1717
- onDragEnd: fe,
1718
- onDragEnter: we,
1719
- onDragOver: ve,
1720
- onDragLeave: q,
1721
- onDrop: B,
1722
- rootPath: Ee,
1723
- onDoubleClickFile: ee
1742
+ key: h.name,
1743
+ node: h,
1744
+ level: u + 1,
1745
+ position: ge + 1,
1746
+ setSize: C.length,
1747
+ expandedNodePaths: E,
1748
+ onToggle: g,
1749
+ selectedNode: k,
1750
+ focusPath: V,
1751
+ focusedNode: T,
1752
+ selectPath: y,
1753
+ generatePath: v,
1754
+ getChildren: N,
1755
+ onContextMenu: P,
1756
+ renamingPath: j,
1757
+ onRename: Z,
1758
+ onRenameCancel: A,
1759
+ parentPath: _,
1760
+ dropIndicator: p,
1761
+ onDragStart: b,
1762
+ onDragEnd: q,
1763
+ onDragEnter: B,
1764
+ onDragOver: G,
1765
+ onDragLeave: ee,
1766
+ onDrop: W,
1767
+ rootPath: F,
1768
+ onDoubleClickFile: te
1724
1769
  }
1725
1770
  )));
1726
- }, bt = ({ node: s, level: l, isOpen: E, hideName: g = !1 }) => {
1727
- const k = [];
1728
- for (let C = 0; C < l; C++)
1729
- k.push("&nbsp;&nbsp;&nbsp;&nbsp;");
1730
- return /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
1771
+ }, Vt = ({ node: n, level: u, isOpen: l, hideName: m = !1 }) => {
1772
+ const E = [];
1773
+ for (let g = 0; g < u; g++)
1774
+ E.push("&nbsp;&nbsp;&nbsp;&nbsp;");
1775
+ return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1731
1776
  "span",
1732
1777
  {
1733
1778
  "aria-hidden": "true",
1734
- dangerouslySetInnerHTML: { __html: k.join("") }
1735
- }
1736
- ), s.type === "folder" ? /* @__PURE__ */ f.createElement(vt, { width: 16, icon: E ? zt : Ut }) : /* @__PURE__ */ f.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ f.createElement(vt, { width: 16, icon: s.type === "folder" ? Wt : Bt }), !g && /* @__PURE__ */ f.createElement("span", { className: X.fileName }, s.name));
1737
- }, ar = "_control_kp9d9_1", ir = "_browse-label_kp9d9_11", or = "_path-preview_kp9d9_37", sr = "_modal_kp9d9_43", lr = "_modal-footer_kp9d9_48", Me = {
1738
- control: ar,
1739
- browseLabel: ir,
1740
- pathPreview: or,
1741
- modal: sr,
1742
- modalFooter: lr
1779
+ dangerouslySetInnerHTML: { __html: E.join("") }
1780
+ }
1781
+ ), n.type === "folder" ? /* @__PURE__ */ o.createElement(jt, { width: 16, icon: l ? jr : Ir }) : /* @__PURE__ */ o.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ o.createElement(jt, { width: 16, icon: n.type === "folder" ? Or : Ar }), !m && /* @__PURE__ */ o.createElement("span", { className: we.fileName }, n.name));
1782
+ }, Jr = "_control_kp9d9_1", Xr = "_browse-label_kp9d9_11", Qr = "_path-preview_kp9d9_37", en = "_modal_kp9d9_43", tn = "_modal-footer_kp9d9_48", He = {
1783
+ control: Jr,
1784
+ browseLabel: Xr,
1785
+ pathPreview: Qr,
1786
+ modal: en,
1787
+ modalFooter: tn
1743
1788
  };
1744
- function cr({ path: s }) {
1745
- if (!s)
1746
- return /* @__PURE__ */ f.createElement("div", { className: Me.pathPreview }, /* @__PURE__ */ f.createElement("i", null, "Select a path"));
1747
- const l = s.split("/");
1748
- let E = (l.length > 2 ? "/" : "") + l.pop();
1749
- E.length > 10 && (E = E.substring(E.length - 10));
1750
- const g = s.substring(
1789
+ function rn({ path: n }) {
1790
+ if (!n)
1791
+ return /* @__PURE__ */ o.createElement("div", { className: He.pathPreview }, /* @__PURE__ */ o.createElement("i", null, "Select a path"));
1792
+ const u = n.split("/");
1793
+ let l = (u.length > 2 ? "/" : "") + u.pop();
1794
+ l.length > 10 && (l = l.substring(l.length - 10));
1795
+ const m = n.substring(
1751
1796
  0,
1752
- s.length - E.length
1797
+ n.length - l.length
1753
1798
  );
1754
- return /* @__PURE__ */ f.createElement(
1799
+ return /* @__PURE__ */ o.createElement(
1755
1800
  "div",
1756
1801
  {
1757
- className: Me.pathPreview,
1758
- "data-content-start": g,
1759
- "data-content-end": E
1802
+ className: He.pathPreview,
1803
+ "data-content-start": m,
1804
+ "data-content-end": l
1760
1805
  }
1761
1806
  );
1762
1807
  }
1763
- function Cr({
1764
- value: s = "",
1765
- onChange: l,
1766
- filesystem: E
1808
+ function ga({
1809
+ value: n = "",
1810
+ onChange: u,
1811
+ filesystem: l
1767
1812
  }) {
1768
- const [g, k] = ae(!1), C = () => k(!0), M = () => k(!1), [P, S] = ae(
1769
- s || null
1813
+ const [m, E] = Q(!1), g = () => E(!0), k = () => E(!1), [V, T] = Q(
1814
+ n || null
1770
1815
  );
1771
- function I(_) {
1772
- _ == null || _.preventDefault(), l(P || ""), M();
1816
+ function y(v) {
1817
+ v == null || v.preventDefault(), u(V || ""), k();
1773
1818
  }
1774
- return /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
1775
- pt,
1819
+ return /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
1820
+ mt,
1776
1821
  {
1777
1822
  variant: "tertiary",
1778
- className: Me.control,
1779
- onClick: C
1823
+ className: He.control,
1824
+ onClick: g
1780
1825
  },
1781
- /* @__PURE__ */ f.createElement("span", { className: Me.browseLabel }, "Browse"),
1782
- /* @__PURE__ */ f.createElement(cr, { path: s || "" })
1783
- ), g && /* @__PURE__ */ f.createElement(
1784
- Nt,
1826
+ /* @__PURE__ */ o.createElement("span", { className: He.browseLabel }, "Browse"),
1827
+ /* @__PURE__ */ o.createElement(rn, { path: n || "" })
1828
+ ), m && /* @__PURE__ */ o.createElement(
1829
+ er,
1785
1830
  {
1786
1831
  title: "Select a path ",
1787
- onRequestClose: M,
1788
- className: Me.modal
1832
+ onRequestClose: k,
1833
+ className: He.modal
1789
1834
  },
1790
- /* @__PURE__ */ f.createElement("form", { onSubmit: I }, /* @__PURE__ */ f.createElement(
1791
- nr,
1835
+ /* @__PURE__ */ o.createElement("form", { onSubmit: y }, /* @__PURE__ */ o.createElement(
1836
+ qr,
1792
1837
  {
1793
- filesystem: E,
1794
- initialSelectedPath: s,
1795
- onSelect: S
1838
+ filesystem: l,
1839
+ initialSelectedPath: n,
1840
+ onSelect: T
1796
1841
  }
1797
- ), /* @__PURE__ */ f.createElement("div", { className: Me.modalFooter }, /* @__PURE__ */ f.createElement(pt, { type: "submit", variant: "primary" }, "Select Path")))
1842
+ ), /* @__PURE__ */ o.createElement("div", { className: He.modalFooter }, /* @__PURE__ */ o.createElement(mt, { type: "submit", variant: "primary" }, "Select Path")))
1798
1843
  ));
1799
1844
  }
1845
+ const nn = "_container_1h0az_1", an = "_header_1h0az_9", on = "_filename_1h0az_18", sn = "_downloadLink_1h0az_26", ln = "_previewArea_1h0az_38", cn = "_imagePreview_1h0az_51", un = "_videoPreview_1h0az_57", fn = "_audioPreview_1h0az_64", dn = "_unsupportedMessage_1h0az_68", mn = "_actions_1h0az_74", Ce = {
1846
+ container: nn,
1847
+ header: an,
1848
+ filename: on,
1849
+ downloadLink: sn,
1850
+ previewArea: ln,
1851
+ imagePreview: cn,
1852
+ videoPreview: un,
1853
+ audioPreview: fn,
1854
+ unsupportedMessage: dn,
1855
+ actions: mn
1856
+ }, pn = (n) => {
1857
+ if (!n)
1858
+ return {
1859
+ isImage: !1,
1860
+ isVideo: !1,
1861
+ isAudio: !1
1862
+ };
1863
+ const u = n.toLowerCase();
1864
+ return {
1865
+ isImage: u.startsWith("image/"),
1866
+ isVideo: u.startsWith("video/"),
1867
+ isAudio: u.startsWith("audio/")
1868
+ };
1869
+ };
1870
+ function Ea({
1871
+ filename: n,
1872
+ mimeType: u,
1873
+ dataUrl: l,
1874
+ downloadUrl: m,
1875
+ showHeader: E = !0
1876
+ }) {
1877
+ const { isImage: g, isVideo: k, isAudio: V } = pn(u), T = E !== !1, y = !!(m && n), v = () => y ? /* @__PURE__ */ o.createElement(
1878
+ "a",
1879
+ {
1880
+ className: Ce.downloadLink,
1881
+ href: m,
1882
+ download: n
1883
+ },
1884
+ "Download"
1885
+ ) : null, N = () => g ? /* @__PURE__ */ o.createElement(
1886
+ "img",
1887
+ {
1888
+ className: Ce.imagePreview,
1889
+ src: l,
1890
+ alt: n || "Preview"
1891
+ }
1892
+ ) : k ? /* @__PURE__ */ o.createElement(
1893
+ "video",
1894
+ {
1895
+ className: Ce.videoPreview,
1896
+ controls: !0,
1897
+ preload: "metadata"
1898
+ },
1899
+ /* @__PURE__ */ o.createElement("source", { src: l, type: u }),
1900
+ "Your browser does not support the video tag."
1901
+ ) : V ? /* @__PURE__ */ o.createElement("audio", { className: Ce.audioPreview, controls: !0 }, /* @__PURE__ */ o.createElement("source", { src: l, type: u }), "Your browser does not support the audio tag.") : /* @__PURE__ */ o.createElement("div", { className: Ce.unsupportedMessage }, /* @__PURE__ */ o.createElement("p", null, "Preview unavailable for this file type."), y ? /* @__PURE__ */ o.createElement("p", null, v()) : /* @__PURE__ */ o.createElement("p", null, "Download the file to inspect its contents."));
1902
+ return /* @__PURE__ */ o.createElement("div", { className: Ce.container }, T && /* @__PURE__ */ o.createElement("div", { className: Ce.header }, /* @__PURE__ */ o.createElement("span", { className: Ce.filename, title: n }, n), v()), /* @__PURE__ */ o.createElement("div", { className: Ce.previewArea }, N()), !T && y && /* @__PURE__ */ o.createElement("div", { className: Ce.actions }, v()));
1903
+ }
1904
+ const St = /* @__PURE__ */ new Map(), hn = async (n) => {
1905
+ var E;
1906
+ if (!n)
1907
+ return tt();
1908
+ const u = (E = n.split(".").pop()) == null ? void 0 : E.toLowerCase();
1909
+ if (!u || u === "php")
1910
+ return tt();
1911
+ const l = n;
1912
+ if (St.has(l))
1913
+ return St.get(l);
1914
+ let m;
1915
+ switch (u) {
1916
+ case "css":
1917
+ m = await import("@codemirror/lang-css").then(
1918
+ (g) => g.css()
1919
+ );
1920
+ break;
1921
+ case "js":
1922
+ case "jsx":
1923
+ case "ts":
1924
+ case "tsx":
1925
+ m = await import("@codemirror/lang-javascript").then(
1926
+ (g) => g.javascript({
1927
+ jsx: u === "jsx" || u === "tsx",
1928
+ typescript: u === "ts" || u === "tsx"
1929
+ })
1930
+ );
1931
+ break;
1932
+ case "json":
1933
+ m = await import("@codemirror/lang-json").then(
1934
+ (g) => g.json()
1935
+ );
1936
+ break;
1937
+ case "html":
1938
+ case "htm":
1939
+ m = await import("@codemirror/lang-html").then(
1940
+ (g) => g.html()
1941
+ );
1942
+ break;
1943
+ case "md":
1944
+ case "markdown":
1945
+ m = await import("@codemirror/lang-markdown").then(
1946
+ (g) => g.markdown()
1947
+ );
1948
+ break;
1949
+ default:
1950
+ m = tt();
1951
+ }
1952
+ return St.set(l, m), m;
1953
+ };
1954
+ class wn {
1955
+ constructor(u) {
1956
+ this.view = u, this.handleClick = this.handleClick.bind(this), this.view.dom.addEventListener("mousedown", this.handleClick);
1957
+ }
1958
+ handleClick(u) {
1959
+ const l = u.target;
1960
+ if ((l.classList.contains("cm-scroller") || l.classList.contains("cm-content")) && this.view.posAtCoords({
1961
+ x: u.clientX,
1962
+ y: u.clientY
1963
+ }) === null) {
1964
+ const E = this.view.state.doc.length, g = pt.create([
1965
+ pt.range(E, E)
1966
+ ]);
1967
+ this.view.dispatch({
1968
+ selection: g,
1969
+ effects: Qe.scrollIntoView(E, {
1970
+ y: "center"
1971
+ })
1972
+ }), this.view.focus(), u.preventDefault();
1973
+ }
1974
+ }
1975
+ destroy() {
1976
+ this.view.dom.removeEventListener("mousedown", this.handleClick);
1977
+ }
1978
+ }
1979
+ const vn = ir.define(
1980
+ (n) => new wn(n)
1981
+ ), Ut = Bt(
1982
+ function({
1983
+ code: u,
1984
+ onChange: l,
1985
+ currentPath: m,
1986
+ className: E,
1987
+ onSaveShortcut: g,
1988
+ readOnly: k = !1,
1989
+ additionalExtensions: V
1990
+ }, T) {
1991
+ const y = M(
1992
+ null
1993
+ ), v = M(null), N = M(new Tt()), P = M(new Tt()), j = M(new Tt()), Z = M(u), A = M(l), D = M(!1);
1994
+ return Wt(T, () => ({
1995
+ focus: () => {
1996
+ var p;
1997
+ (p = v.current) == null || p.focus();
1998
+ },
1999
+ blur: () => {
2000
+ const p = v.current;
2001
+ p && p.contentDOM.blur();
2002
+ },
2003
+ getCursorPosition: () => v.current ? v.current.state.selection.main.anchor : null,
2004
+ setCursorPosition: (p) => {
2005
+ if (!v.current)
2006
+ return;
2007
+ const b = Math.min(
2008
+ p,
2009
+ v.current.state.doc.length
2010
+ ), q = pt.create([
2011
+ pt.range(b, b)
2012
+ ]);
2013
+ v.current.dispatch({
2014
+ selection: q,
2015
+ scrollIntoView: !0
2016
+ });
2017
+ }
2018
+ })), I(() => {
2019
+ Z.current = u;
2020
+ }, [u]), I(() => {
2021
+ A.current = l;
2022
+ }, [l]), I(() => {
2023
+ if (v.current)
2024
+ return;
2025
+ const p = y.current;
2026
+ if (!p)
2027
+ return;
2028
+ const b = or.create({
2029
+ doc: u,
2030
+ extensions: [
2031
+ j.current.of(V ?? []),
2032
+ sr(),
2033
+ lr(),
2034
+ cr(),
2035
+ xr(),
2036
+ ur(),
2037
+ fr(),
2038
+ dr(),
2039
+ vn,
2040
+ N.current.of(tt()),
2041
+ P.current.of(
2042
+ Qe.editable.of(!k)
2043
+ ),
2044
+ Rr(kr),
2045
+ Tr(),
2046
+ Pr(),
2047
+ yr(),
2048
+ pr(),
2049
+ gr(),
2050
+ _r(),
2051
+ Qe.updateListener.of((B) => {
2052
+ if (!B.docChanged)
2053
+ return;
2054
+ const G = B.state.doc.toString();
2055
+ G !== Z.current && (Z.current = G, A.current(G));
2056
+ }),
2057
+ mr.of([
2058
+ {
2059
+ key: "Mod-s",
2060
+ preventDefault: !0,
2061
+ run: () => (g == null || g(), !0)
2062
+ },
2063
+ ...br,
2064
+ ...Cr,
2065
+ ...Sr,
2066
+ ...Er,
2067
+ ...hr,
2068
+ ...wr,
2069
+ vr
2070
+ ])
2071
+ ]
2072
+ }), q = new Qe({ state: b, parent: p });
2073
+ return v.current = q, () => {
2074
+ q.destroy(), v.current = null;
2075
+ };
2076
+ }, []), I(() => {
2077
+ const p = v.current;
2078
+ p && p.dispatch({
2079
+ effects: j.current.reconfigure(
2080
+ V ?? []
2081
+ )
2082
+ });
2083
+ }, [V]), I(() => {
2084
+ const p = v.current;
2085
+ if (!p)
2086
+ return;
2087
+ const b = p.state.doc.toString();
2088
+ u !== b && p.dispatch({
2089
+ changes: { from: 0, to: p.state.doc.length, insert: u }
2090
+ });
2091
+ }, [u]), I(() => {
2092
+ var G;
2093
+ const p = v.current;
2094
+ if (!p)
2095
+ return;
2096
+ const b = (G = m == null ? void 0 : m.split(".").pop()) == null ? void 0 : G.toLowerCase();
2097
+ (!b || b === "php") && p.dispatch({
2098
+ effects: N.current.reconfigure(tt())
2099
+ });
2100
+ let B = !1;
2101
+ return hn(m).then((ee) => {
2102
+ B || !v.current || v.current.dispatch({
2103
+ effects: N.current.reconfigure(ee)
2104
+ });
2105
+ }), () => {
2106
+ B = !0;
2107
+ };
2108
+ }, [m]), I(() => {
2109
+ const p = v.current;
2110
+ p && (p.hasFocus && (D.current = !0), p.dispatch({
2111
+ effects: P.current.reconfigure(
2112
+ Qe.editable.of(!k)
2113
+ )
2114
+ }));
2115
+ }, [k]), Gt(() => {
2116
+ const p = v.current;
2117
+ p && D.current && !p.hasFocus && (p.focus(), D.current = !1);
2118
+ }, [m, k]), /* @__PURE__ */ o.createElement("div", { ref: y, className: E });
2119
+ }
2120
+ );
2121
+ Ut.displayName = "CodeEditor";
2122
+ const gn = "_fileExplorerContainer_1m4t6_1", En = "_fileExplorerHeader_1m4t6_14", yn = "_fileExplorerTitle_1m4t6_23", _n = "_fileExplorerActions_1m4t6_31", bn = "_fileExplorerButton_1m4t6_37", Cn = "_fileExplorerTree_1m4t6_84", Ie = {
2123
+ fileExplorerContainer: gn,
2124
+ fileExplorerHeader: En,
2125
+ fileExplorerTitle: yn,
2126
+ fileExplorerActions: _n,
2127
+ fileExplorerButton: bn,
2128
+ fileExplorerTree: Cn
2129
+ }, xn = 1024 * 1024, Rn = (n) => {
2130
+ const u = n.byteLength;
2131
+ for (let l = 0; l < Math.min(u, 4096); l++)
2132
+ if (n[l] === 0)
2133
+ return !0;
2134
+ try {
2135
+ return new TextDecoder("utf-8", { fatal: !0 }).decode(n), !1;
2136
+ } catch {
2137
+ return !0;
2138
+ }
2139
+ }, $t = (n, u) => {
2140
+ const l = new Blob([n]), m = URL.createObjectURL(l);
2141
+ return setTimeout(() => URL.revokeObjectURL(m), 6e4), { url: m, filename: u };
2142
+ }, Tn = (n) => {
2143
+ const u = n.split(".").pop();
2144
+ return Lt[u] || Lt._default;
2145
+ }, Pn = (n) => n.startsWith("image/") || n.startsWith("video/") || n.startsWith("audio/");
2146
+ function kn({
2147
+ filesystem: n,
2148
+ currentPath: u,
2149
+ selectedDirPath: l,
2150
+ setSelectedDirPath: m,
2151
+ onFileOpened: E,
2152
+ onSelectionCleared: g,
2153
+ onShowMessage: k,
2154
+ documentRoot: V
2155
+ }) {
2156
+ const T = M(null), y = Nt(() => At(
2157
+ u ? Oe(At(u)) : l ?? V
2158
+ ), [u, V]), [v, N] = Q(
2159
+ null
2160
+ ), P = async (j, Z) => {
2161
+ try {
2162
+ const A = await n.read(j), D = new Uint8Array(await A.arrayBuffer()), p = D.byteLength, b = j.split("/").pop() || "download";
2163
+ if (p > xn) {
2164
+ const { url: B, filename: G } = $t(
2165
+ D,
2166
+ b
2167
+ );
2168
+ await k(
2169
+ j,
2170
+ /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("p", null, "File too large to open (>1MB)."), /* @__PURE__ */ o.createElement("p", null, /* @__PURE__ */ o.createElement("a", { href: B, download: G }, "Download ", G)))
2171
+ );
2172
+ return;
2173
+ }
2174
+ if (Rn(D)) {
2175
+ const B = Tn(b), { url: G, filename: ee } = $t(
2176
+ D,
2177
+ b
2178
+ );
2179
+ if (Pn(B)) {
2180
+ const W = new Blob([D], { type: B }), F = URL.createObjectURL(W);
2181
+ await k(
2182
+ j,
2183
+ /* @__PURE__ */ o.createElement(
2184
+ Dr,
2185
+ {
2186
+ filename: ee,
2187
+ mimeType: B,
2188
+ dataUrl: F,
2189
+ downloadUrl: G
2190
+ }
2191
+ )
2192
+ );
2193
+ return;
2194
+ }
2195
+ await k(
2196
+ j,
2197
+ /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement("p", null, "Binary file. Cannot be edited."), /* @__PURE__ */ o.createElement("p", null, /* @__PURE__ */ o.createElement("a", { href: G, download: ee }, "Download ", ee)))
2198
+ );
2199
+ return;
2200
+ }
2201
+ const q = new TextDecoder("utf-8").decode(D);
2202
+ await E(j, q, Z);
2203
+ } catch (A) {
2204
+ dt.error("Could not open file", A), await k(null, "Could not open file.");
2205
+ }
2206
+ };
2207
+ return /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerContainer }, /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerHeader }, /* @__PURE__ */ o.createElement("span", { className: Ie.fileExplorerTitle }, "Files"), /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerActions }, /* @__PURE__ */ o.createElement(
2208
+ "button",
2209
+ {
2210
+ className: Ie.fileExplorerButton,
2211
+ type: "button",
2212
+ onClick: () => {
2213
+ T.current && T.current.createFile(
2214
+ v ?? void 0
2215
+ );
2216
+ },
2217
+ title: "Create new file"
2218
+ },
2219
+ /* @__PURE__ */ o.createElement(Ft, { icon: Vr, size: 16 }),
2220
+ "New File"
2221
+ ), /* @__PURE__ */ o.createElement(
2222
+ "button",
2223
+ {
2224
+ className: Ie.fileExplorerButton,
2225
+ type: "button",
2226
+ onClick: () => {
2227
+ T.current && T.current.createFolder(
2228
+ v ?? void 0
2229
+ );
2230
+ },
2231
+ title: "Create new folder"
2232
+ },
2233
+ /* @__PURE__ */ o.createElement(Ft, { icon: Mr, size: 16 }),
2234
+ "New Folder"
2235
+ ))), /* @__PURE__ */ o.createElement("div", { className: Ie.fileExplorerTree }, /* @__PURE__ */ o.createElement(
2236
+ Nr,
2237
+ {
2238
+ ref: T,
2239
+ filesystem: n,
2240
+ root: V,
2241
+ initialSelectedPath: y,
2242
+ onSelect: async (j) => {
2243
+ if (N(j), !j) {
2244
+ await g();
2245
+ return;
2246
+ }
2247
+ try {
2248
+ if (await n.isDir(j)) {
2249
+ m(j);
2250
+ return;
2251
+ }
2252
+ } catch {
2253
+ }
2254
+ await P(j, !1);
2255
+ },
2256
+ onDoubleClickFile: async (j) => {
2257
+ await P(j, !0);
2258
+ }
2259
+ }
2260
+ )));
2261
+ }
2262
+ const Sn = "_container_15o5h_1", Nn = "_content_15o5h_9", Dn = "_sidebarWrapper_15o5h_17", On = "_editorWrapper_15o5h_28", An = "_editorHeader_15o5h_37", Fn = "_editorPath_15o5h_49", Ln = "_editorPathPlaceholder_15o5h_60", jn = "_saveStatus_15o5h_71", In = "_saveStatusSaving_15o5h_78", Mn = "_saveStatusPending_15o5h_79", Vn = "_saveStatusError_15o5h_83", $n = "_editor_15o5h_28", Bn = "_placeholder_15o5h_105", Wn = "_messageArea_15o5h_116", Hn = "_mobileToggle_15o5h_152", zn = "_mobileOverlay_15o5h_156", Un = "_sidebarOpen_15o5h_171", fe = {
2263
+ container: Sn,
2264
+ content: Nn,
2265
+ sidebarWrapper: Dn,
2266
+ editorWrapper: On,
2267
+ editorHeader: An,
2268
+ editorPath: Fn,
2269
+ editorPathPlaceholder: Ln,
2270
+ saveStatus: jn,
2271
+ saveStatusSaving: In,
2272
+ saveStatusPending: Mn,
2273
+ saveStatusError: Vn,
2274
+ editor: $n,
2275
+ placeholder: Bn,
2276
+ messageArea: Wn,
2277
+ mobileToggle: Hn,
2278
+ mobileOverlay: zn,
2279
+ sidebarOpen: Un
2280
+ }, Yn = 1500, K = {
2281
+ IDLE: "idle",
2282
+ PENDING: "pending",
2283
+ SAVING: "saving",
2284
+ SAVED: "saved",
2285
+ ERROR: "error"
2286
+ };
2287
+ function ya({
2288
+ filesystem: n,
2289
+ isVisible: u = !0,
2290
+ documentRoot: l,
2291
+ initialPath: m = null,
2292
+ placeholderText: E = "Select a file to view or edit its contents.",
2293
+ onSaveFile: g,
2294
+ onBeforeFilesystemChange: k
2295
+ }) {
2296
+ const [V, T] = Q(
2297
+ l
2298
+ ), [y, v] = Q(null), [N, P] = Q(""), [j, Z] = Q(!0), [A, D] = Q(K.IDLE), [p, b] = Q(null), [q, B] = Q(!1), [G, ee] = Q(null), W = M(null), F = M(null), te = M(!1), _ = M(N), H = M(y), de = M(n), ae = M(null), re = M(/* @__PURE__ */ new Map()), ue = M(!1);
2299
+ I(() => {
2300
+ _.current = N;
2301
+ }, [N]), I(() => {
2302
+ H.current = y;
2303
+ }, [y]), I(() => {
2304
+ de.current = n;
2305
+ }, [n]), I(() => {
2306
+ const S = ae.current;
2307
+ S && S !== n && k && k(S), ae.current = n;
2308
+ }, [n, k]), I(() => {
2309
+ n || (te.current = !0, P(""), v(null), Z(!0), D(K.IDLE), b(null), B(!1), ee(null), ue.current = !1);
2310
+ }, [n]), I(() => {
2311
+ if (!n || !m || ue.current)
2312
+ return;
2313
+ (async () => {
2314
+ try {
2315
+ if (await n.fileExists(m)) {
2316
+ const J = await n.readFileAsText(m);
2317
+ te.current = !0, v(m), P(J), Z(!1), D(K.IDLE), b(null), setTimeout(() => {
2318
+ var z;
2319
+ (z = W.current) == null || z.focus();
2320
+ }, 100);
2321
+ }
2322
+ } catch (C) {
2323
+ dt.debug("Could not auto-open initial path:", C);
2324
+ } finally {
2325
+ ue.current = !0;
2326
+ }
2327
+ })();
2328
+ }, [n, m]), I(() => {
2329
+ T(l), v(null), P(""), Z(!0), D(K.IDLE), b(null), te.current = !0, ee(null), ue.current = !1;
2330
+ }, [l]), I(() => () => {
2331
+ F.current !== null && (window.clearTimeout(F.current), F.current = null);
2332
+ }, []), I(() => {
2333
+ const S = de.current;
2334
+ if (!S || !y) {
2335
+ F.current !== null && (window.clearTimeout(F.current), F.current = null), y || D(K.IDLE);
2336
+ return;
2337
+ }
2338
+ if (te.current) {
2339
+ te.current = !1;
2340
+ return;
2341
+ }
2342
+ F.current !== null && (window.clearTimeout(F.current), F.current = null), D(K.PENDING);
2343
+ const C = window.setTimeout(async () => {
2344
+ F.current = null, D(K.SAVING);
2345
+ try {
2346
+ const J = H.current, z = _.current;
2347
+ g ? await g(J, z) : await S.writeFile(J, z), D(K.SAVED), b(null);
2348
+ } catch (J) {
2349
+ dt.error("Failed to save file", J), D(K.ERROR), b("Could not save changes. Try again.");
2350
+ }
2351
+ }, Yn);
2352
+ return F.current = C, () => {
2353
+ F.current === C && (window.clearTimeout(C), F.current = null);
2354
+ };
2355
+ }, [N, y, g]), I(() => {
2356
+ if (A !== K.SAVED)
2357
+ return;
2358
+ const S = window.setTimeout(() => {
2359
+ D(
2360
+ (C) => C === K.SAVED ? K.IDLE : C
2361
+ );
2362
+ }, 2e3);
2363
+ return () => window.clearTimeout(S);
2364
+ }, [A]);
2365
+ const oe = ft(
2366
+ async (S, C, J = !0) => {
2367
+ var ie;
2368
+ const z = (ie = W.current) == null ? void 0 : ie.getCursorPosition();
2369
+ z != null && H.current && re.current.set(
2370
+ H.current,
2371
+ z
2372
+ ), te.current = !0, v(S), P(C), ee(null), Z(!1), D(K.IDLE), b(null), B(!1), setTimeout(() => {
2373
+ var ve, ce, U;
2374
+ const Ee = re.current.get(S);
2375
+ Ee !== void 0 && ((ve = W.current) == null || ve.setCursorPosition(Ee)), J ? (ce = W.current) == null || ce.focus() : (U = W.current) == null || U.blur();
2376
+ }, 50);
2377
+ },
2378
+ []
2379
+ );
2380
+ I(() => {
2381
+ var J;
2382
+ if (!y)
2383
+ return;
2384
+ const S = setInterval(() => {
2385
+ var ie;
2386
+ const z = (ie = W.current) == null ? void 0 : ie.getCursorPosition();
2387
+ z != null && re.current.set(y, z);
2388
+ }, 1e3), C = (J = W.current) == null ? void 0 : J.getCursorPosition();
2389
+ return C != null && re.current.set(y, C), () => {
2390
+ var ie;
2391
+ clearInterval(S);
2392
+ const z = (ie = W.current) == null ? void 0 : ie.getCursorPosition();
2393
+ z != null && re.current.set(y, z);
2394
+ };
2395
+ }, [y]), I(() => {
2396
+ if (!u || !y)
2397
+ return;
2398
+ const S = setTimeout(() => {
2399
+ var J;
2400
+ const C = re.current.get(y);
2401
+ C !== void 0 && ((J = W.current) == null || J.setCursorPosition(C));
2402
+ }, 100);
2403
+ return () => clearTimeout(S);
2404
+ }, [u, y]);
2405
+ const be = ft(async () => {
2406
+ var C;
2407
+ const S = (C = W.current) == null ? void 0 : C.getCursorPosition();
2408
+ S != null && H.current && re.current.set(H.current, S), te.current = !0, v(null), P(""), ee(null), Z(!0), D(K.IDLE), b(null);
2409
+ }, []), Re = ft(
2410
+ async (S, C) => {
2411
+ te.current = !0, v(null), typeof C == "string" ? (P(C), ee(null)) : (P(""), ee(C)), Z(!0), D(K.IDLE), b(null), B(!1);
2412
+ },
2413
+ []
2414
+ ), Te = ft(async () => {
2415
+ if (F.current !== null) {
2416
+ if (!de.current || !H.current) {
2417
+ window.clearTimeout(F.current), F.current = null;
2418
+ return;
2419
+ }
2420
+ window.clearTimeout(F.current), F.current = null, D(K.SAVING);
2421
+ try {
2422
+ const S = H.current, C = _.current;
2423
+ g ? await g(S, C) : await de.current.writeFile(
2424
+ S,
2425
+ C
2426
+ ), D(K.SAVED), b(null);
2427
+ } catch (S) {
2428
+ dt.error("Failed to save file", S), D(K.ERROR), b("Could not save changes. Try again.");
2429
+ }
2430
+ }
2431
+ }, [g]), Pe = Zn(A, p), le = Gn(A, fe);
2432
+ return n ? /* @__PURE__ */ o.createElement("div", { className: fe.container }, /* @__PURE__ */ o.createElement(
2433
+ "div",
2434
+ {
2435
+ className: et(fe.content, {
2436
+ [fe.sidebarOpen]: q
2437
+ })
2438
+ },
2439
+ /* @__PURE__ */ o.createElement(
2440
+ "div",
2441
+ {
2442
+ className: fe.mobileOverlay,
2443
+ onClick: () => B(!1)
2444
+ }
2445
+ ),
2446
+ /* @__PURE__ */ o.createElement("aside", { className: fe.sidebarWrapper }, /* @__PURE__ */ o.createElement(
2447
+ kn,
2448
+ {
2449
+ filesystem: n,
2450
+ currentPath: y,
2451
+ selectedDirPath: V,
2452
+ setSelectedDirPath: T,
2453
+ onFileOpened: oe,
2454
+ onSelectionCleared: be,
2455
+ onShowMessage: Re,
2456
+ documentRoot: l
2457
+ }
2458
+ )),
2459
+ /* @__PURE__ */ o.createElement("section", { className: fe.editorWrapper }, /* @__PURE__ */ o.createElement("div", { className: fe.editorHeader }, /* @__PURE__ */ o.createElement(
2460
+ mt,
2461
+ {
2462
+ className: fe.mobileToggle,
2463
+ variant: "secondary",
2464
+ onClick: () => B((S) => !S)
2465
+ },
2466
+ q ? "Hide files" : "Browse files"
2467
+ ), /* @__PURE__ */ o.createElement(
2468
+ "div",
2469
+ {
2470
+ className: et(fe.editorPath, {
2471
+ [fe.editorPathPlaceholder]: !(y != null && y.length)
2472
+ })
2473
+ },
2474
+ y != null && y.length ? y : `Browse files under ${l}`
2475
+ ), /* @__PURE__ */ o.createElement(
2476
+ "div",
2477
+ {
2478
+ className: et(
2479
+ fe.saveStatus,
2480
+ le
2481
+ )
2482
+ },
2483
+ Pe
2484
+ )), p ? /* @__PURE__ */ o.createElement("div", { style: { padding: "8px 16px" } }, /* @__PURE__ */ o.createElement(tr, { status: "error", isDismissible: !1 }, p)) : null, y || N || G ? G ? /* @__PURE__ */ o.createElement("div", { className: fe.messageArea }, G) : /* @__PURE__ */ o.createElement(
2485
+ Ut,
2486
+ {
2487
+ ref: W,
2488
+ code: N,
2489
+ onChange: P,
2490
+ currentPath: y,
2491
+ className: fe.editor,
2492
+ onSaveShortcut: Te,
2493
+ readOnly: j
2494
+ }
2495
+ ) : /* @__PURE__ */ o.createElement("div", { className: fe.placeholder }, E))
2496
+ )) : /* @__PURE__ */ o.createElement("div", { className: fe.container }, /* @__PURE__ */ o.createElement("div", { className: fe.placeholder }, E));
2497
+ }
2498
+ function Zn(n, u) {
2499
+ switch (n) {
2500
+ case K.PENDING:
2501
+ case K.SAVING:
2502
+ return "Saving…";
2503
+ case K.SAVED:
2504
+ return "Saved";
2505
+ case K.ERROR:
2506
+ return u ?? "Save failed";
2507
+ default:
2508
+ return "";
2509
+ }
2510
+ }
2511
+ function Gn(n, u) {
2512
+ switch (n) {
2513
+ case K.PENDING:
2514
+ return u.saveStatusPending;
2515
+ case K.SAVING:
2516
+ return u.saveStatusSaving;
2517
+ case K.ERROR:
2518
+ return u.saveStatusError;
2519
+ default:
2520
+ return;
2521
+ }
2522
+ }
1800
2523
  export {
1801
- vr as ClockIcon,
1802
- Cr as FilePickerControl,
1803
- nr as FilePickerTree,
1804
- br as SiteManagerIcon,
1805
- yr as WordPressIcon,
1806
- Bt as file,
1807
- Wt as folder,
1808
- _r as getLogoDataURL,
1809
- Er as layout,
1810
- wr as playgroundLogo,
1811
- gr as temporaryStorage
2524
+ Ea as BinaryFilePreview,
2525
+ pa as ClockIcon,
2526
+ Ut as CodeEditor,
2527
+ kn as FileExplorerSidebar,
2528
+ ga as FilePickerControl,
2529
+ qr as FilePickerTree,
2530
+ xn as MAX_INLINE_FILE_BYTES,
2531
+ ya as PlaygroundFileEditor,
2532
+ va as SiteManagerIcon,
2533
+ ma as WordPressIcon,
2534
+ $t as createDownloadUrl,
2535
+ Ar as file,
2536
+ Or as folder,
2537
+ wa as getLogoDataURL,
2538
+ Tn as getMimeType,
2539
+ Pn as isPreviewableBinary,
2540
+ ha as layout,
2541
+ fa as playgroundLogo,
2542
+ Rn as seemsLikeBinary,
2543
+ da as temporaryStorage
1812
2544
  };
1813
2545
  //# sourceMappingURL=index.js.map