@wp-playground/components 3.1.54 → 3.1.56

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,21 +1,21 @@
1
- import r, { forwardRef as $t, useMemo as Ft, useState as te, useRef as M, useEffect as H, useImperativeHandle as Wt, useLayoutEffect as qt, useCallback as Ue } from "react";
2
- import { joinPaths as je, dirname as Le, normalizePath as Jt, basename as et, isParentOf as Xt, concatUint8Arrays as Qt } from "@php-wasm/util";
3
- import { __experimentalTreeGrid as er, Popover as tr, NavigableMenu as rr, MenuItem as it, __experimentalTreeGridRow as nr, __experimentalTreeGridCell as ar, Button as tt, Modal as or, Icon as St, Tooltip as Ht, VisuallyHidden as ir, Notice as lr } from "@wordpress/components";
4
- import De from "classnames";
5
- import { forwardRef as Ut, cloneElement as sr, createElement as cr } from "@wordpress/element";
6
- import ur from "clsx";
7
- import { Compartment as Tt, EditorSelection as gt, EditorState as fr } from "@codemirror/state";
8
- import { ViewPlugin as dr, lineNumbers as mr, highlightActiveLineGutter as pr, highlightActiveLine as hr, dropCursor as vr, rectangularSelection as wr, crosshairCursor as gr, EditorView as ct, keymap as Er } from "@codemirror/view";
9
- import { history as yr, historyKeymap as _r, defaultKeymap as br, indentWithTab as xr } from "@codemirror/commands";
10
- import { highlightSelectionMatches as Cr, searchKeymap as Rr } from "@codemirror/search";
11
- import { closeBrackets as kr, autocompletion as Pr, closeBracketsKeymap as Sr, completionKeymap as Tr } from "@codemirror/autocomplete";
12
- import { foldGutter as Dr, syntaxHighlighting as Ar, defaultHighlightStyle as Nr, indentOnInput as Fr, bracketMatching as Ir, foldKeymap as Lr } from "@codemirror/language";
13
- import { php as ut } from "@codemirror/lang-php";
14
- import { FilePickerTree as Or, BinaryFilePreview as Br } from "@wp-playground/components";
15
- import { logger as Xe } from "@php-wasm/logger";
16
- import Lt from "@php-wasm/universal/mime-types";
17
- import { createPortal as Mr } from "react-dom";
18
- const ja = (n) => /* @__PURE__ */ r.createElement(
1
+ import r, { forwardRef as bt, useMemo as ft, useState as K, useRef as O, useEffect as W, useImperativeHandle as xt, useLayoutEffect as er, useCallback as ze } from "react";
2
+ import { joinPaths as Me, dirname as Ne, normalizePath as tr, basename as tt, isParentOf as rr, concatUint8Arrays as nr } from "@php-wasm/util";
3
+ import { __experimentalTreeGrid as ar, Popover as or, NavigableMenu as ir, MenuItem as Qe, __experimentalTreeGridRow as lr, __experimentalTreeGridCell as sr, Button as He, Modal as zt, Icon as At, Tooltip as Gt, VisuallyHidden as cr, Notice as ur, TextControl as Nt, Flex as fr } from "@wordpress/components";
4
+ import Fe from "classnames";
5
+ import { createPortal as Yt } from "react-dom";
6
+ import { logger as Ye } from "@php-wasm/logger";
7
+ import { forwardRef as Zt, cloneElement as dr, createElement as mr } from "@wordpress/element";
8
+ import pr from "clsx";
9
+ import { Compartment as Ft, EditorSelection as yt, EditorState as hr } from "@codemirror/state";
10
+ import { ViewPlugin as vr, lineNumbers as wr, highlightActiveLineGutter as gr, highlightActiveLine as Er, dropCursor as _r, rectangularSelection as yr, crosshairCursor as br, EditorView as dt, keymap as xr } from "@codemirror/view";
11
+ import { history as Cr, historyKeymap as Rr, defaultKeymap as Pr, indentWithTab as kr } from "@codemirror/commands";
12
+ import { highlightSelectionMatches as Tr, searchKeymap as Sr } from "@codemirror/search";
13
+ import { closeBrackets as Dr, autocompletion as Ar, closeBracketsKeymap as Nr, completionKeymap as Fr } from "@codemirror/autocomplete";
14
+ import { foldGutter as Lr, syntaxHighlighting as Ir, defaultHighlightStyle as Mr, indentOnInput as Or, bracketMatching as jr, foldKeymap as Br } from "@codemirror/language";
15
+ import { php as mt } from "@codemirror/lang-php";
16
+ import { FilePickerTree as Vr, BinaryFilePreview as $r } from "@wp-playground/components";
17
+ import jt from "@php-wasm/universal/mime-types";
18
+ const Ya = (i) => /* @__PURE__ */ r.createElement(
19
19
  "svg",
20
20
  {
21
21
  width: "32",
@@ -23,7 +23,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
23
23
  viewBox: "0 0 32 32",
24
24
  fill: "none",
25
25
  xmlns: "http://www.w3.org/2000/svg",
26
- ...n
26
+ ...i
27
27
  },
28
28
  /* @__PURE__ */ r.createElement(
29
29
  "rect",
@@ -58,7 +58,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
58
58
  strokeWidth: "1.93129"
59
59
  }
60
60
  )
61
- ), Va = (n) => /* @__PURE__ */ r.createElement(
61
+ ), Za = (i) => /* @__PURE__ */ r.createElement(
62
62
  "svg",
63
63
  {
64
64
  width: "16",
@@ -66,7 +66,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
66
66
  viewBox: "0 0 16 17",
67
67
  fill: "none",
68
68
  xmlns: "http://www.w3.org/2000/svg",
69
- ...n
69
+ ...i
70
70
  },
71
71
  /* @__PURE__ */ r.createElement(
72
72
  "path",
@@ -77,7 +77,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
77
77
  fill: "#949494"
78
78
  }
79
79
  )
80
- ), $a = (n) => /* @__PURE__ */ r.createElement(
80
+ ), Ka = (i) => /* @__PURE__ */ r.createElement(
81
81
  "svg",
82
82
  {
83
83
  width: "20",
@@ -85,7 +85,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
85
85
  viewBox: "0 0 20 21",
86
86
  fill: "none",
87
87
  xmlns: "http://www.w3.org/2000/svg",
88
- ...n
88
+ ...i
89
89
  },
90
90
  /* @__PURE__ */ r.createElement(
91
91
  "path",
@@ -94,7 +94,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
94
94
  fill: "#ffffff"
95
95
  }
96
96
  )
97
- ), jr = /* @__PURE__ */ r.createElement(
97
+ ), Hr = /* @__PURE__ */ r.createElement(
98
98
  "svg",
99
99
  {
100
100
  xmlns: "http://www.w3.org/2000/svg",
@@ -111,7 +111,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
111
111
  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"
112
112
  }
113
113
  )
114
- ), Vr = /* @__PURE__ */ r.createElement(
114
+ ), Wr = /* @__PURE__ */ r.createElement(
115
115
  "svg",
116
116
  {
117
117
  xmlns: "http://www.w3.org/2000/svg",
@@ -122,7 +122,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
122
122
  viewBox: "0 0 16 16"
123
123
  },
124
124
  /* @__PURE__ */ r.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" })
125
- ), Wa = (n) => /* @__PURE__ */ r.createElement(
125
+ ), qa = (i) => /* @__PURE__ */ r.createElement(
126
126
  "svg",
127
127
  {
128
128
  xmlns: "http://www.w3.org/2000/svg",
@@ -130,7 +130,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
130
130
  height: "18",
131
131
  viewBox: "0 0 14 14",
132
132
  fill: "none",
133
- ...n
133
+ ...i
134
134
  },
135
135
  /* @__PURE__ */ r.createElement(
136
136
  "path",
@@ -141,7 +141,7 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
141
141
  fill: "#949494"
142
142
  }
143
143
  )
144
- ), Ha = /* @__PURE__ */ r.createElement(
144
+ ), Ja = /* @__PURE__ */ r.createElement(
145
145
  "svg",
146
146
  {
147
147
  xmlns: "http://www.w3.org/2000/svg",
@@ -160,18 +160,18 @@ const ja = (n) => /* @__PURE__ */ r.createElement(
160
160
  }
161
161
  )
162
162
  );
163
- function Ua(n) {
164
- return `data:${n.mime};base64,${n.data}`;
163
+ function Xa(i) {
164
+ return `data:${i.mime};base64,${i.data}`;
165
165
  }
166
- function za({
167
- size: n = 24,
168
- sidebarActive: c = !1
166
+ function Qa({
167
+ size: i = 24,
168
+ sidebarActive: s = !1
169
169
  }) {
170
170
  return /* @__PURE__ */ r.createElement(
171
171
  "svg",
172
172
  {
173
- width: n,
174
- height: n,
173
+ width: i,
174
+ height: i,
175
175
  viewBox: "0 0 24 24",
176
176
  xmlns: "http://www.w3.org/2000/svg",
177
177
  fill: "none",
@@ -181,7 +181,7 @@ function za({
181
181
  strokeLinejoin: "round"
182
182
  },
183
183
  /* @__PURE__ */ r.createElement("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
184
- c ? /* @__PURE__ */ r.createElement(
184
+ s ? /* @__PURE__ */ r.createElement(
185
185
  "rect",
186
186
  {
187
187
  x: "3",
@@ -208,17 +208,17 @@ function za({
208
208
  )
209
209
  );
210
210
  }
211
- const Ot = Ut(({
212
- icon: n,
213
- size: c = 24,
211
+ const Bt = Zt(({
212
+ icon: i,
213
+ size: s = 24,
214
214
  ...f
215
- }, l) => sr(n, {
216
- width: c,
217
- height: c,
215
+ }, u) => dr(i, {
216
+ width: s,
217
+ height: s,
218
218
  ...f,
219
- ref: l
219
+ ref: u
220
220
  }));
221
- var It = { exports: {} }, lt = {};
221
+ var Ot = { exports: {} }, ct = {};
222
222
  /**
223
223
  * @license React
224
224
  * react-jsx-runtime.production.min.js
@@ -228,21 +228,21 @@ var It = { exports: {} }, lt = {};
228
228
  * This source code is licensed under the MIT license found in the
229
229
  * LICENSE file in the root directory of this source tree.
230
230
  */
231
- var Bt;
232
- function $r() {
233
- if (Bt) return lt;
234
- Bt = 1;
235
- var n = r, c = Symbol.for("react.element"), f = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, R = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
236
- function P(A, T, v) {
237
- var D, _ = {}, k = null, Z = null;
238
- v !== void 0 && (k = "" + v), T.key !== void 0 && (k = "" + T.key), T.ref !== void 0 && (Z = T.ref);
239
- for (D in T) l.call(T, D) && !d.hasOwnProperty(D) && (_[D] = T[D]);
240
- if (A && A.defaultProps) for (D in T = A.defaultProps, T) _[D] === void 0 && (_[D] = T[D]);
241
- return { $$typeof: c, type: A, key: k, ref: Z, props: _, _owner: R.current };
231
+ var Vt;
232
+ function Ur() {
233
+ if (Vt) return ct;
234
+ Vt = 1;
235
+ var i = r, s = Symbol.for("react.element"), f = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, v = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, h = { key: !0, ref: !0, __self: !0, __source: !0 };
236
+ function x(E, R, b) {
237
+ var D, k = {}, F = null, Q = null;
238
+ b !== void 0 && (F = "" + b), R.key !== void 0 && (F = "" + R.key), R.ref !== void 0 && (Q = R.ref);
239
+ for (D in R) u.call(R, D) && !h.hasOwnProperty(D) && (k[D] = R[D]);
240
+ if (E && E.defaultProps) for (D in R = E.defaultProps, R) k[D] === void 0 && (k[D] = R[D]);
241
+ return { $$typeof: s, type: E, key: F, ref: Q, props: k, _owner: v.current };
242
242
  }
243
- return lt.Fragment = f, lt.jsx = P, lt.jsxs = P, lt;
243
+ return ct.Fragment = f, ct.jsx = x, ct.jsxs = x, ct;
244
244
  }
245
- var st = {};
245
+ var ut = {};
246
246
  /**
247
247
  * @license React
248
248
  * react-jsx-runtime.development.js
@@ -252,54 +252,54 @@ var st = {};
252
252
  * This source code is licensed under the MIT license found in the
253
253
  * LICENSE file in the root directory of this source tree.
254
254
  */
255
- var Mt;
256
- function Wr() {
257
- return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
258
- var n = r, c = Symbol.for("react.element"), f = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), P = Symbol.for("react.provider"), A = Symbol.for("react.context"), T = Symbol.for("react.forward_ref"), v = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), _ = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), Z = Symbol.for("react.offscreen"), j = Symbol.iterator, x = "@@iterator";
259
- function K(e) {
255
+ var $t;
256
+ function zr() {
257
+ return $t || ($t = 1, process.env.NODE_ENV !== "production" && function() {
258
+ var i = r, s = Symbol.for("react.element"), f = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), x = Symbol.for("react.provider"), E = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), k = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), Q = Symbol.for("react.offscreen"), J = Symbol.iterator, w = "@@iterator";
259
+ function Z(e) {
260
260
  if (e === null || typeof e != "object")
261
261
  return null;
262
- var s = j && e[j] || e[x];
263
- return typeof s == "function" ? s : null;
262
+ var n = J && e[J] || e[w];
263
+ return typeof n == "function" ? n : null;
264
264
  }
265
- var W = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
265
+ var T = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
266
266
  function m(e) {
267
267
  {
268
- for (var s = arguments.length, p = new Array(s > 1 ? s - 1 : 0), C = 1; C < s; C++)
269
- p[C - 1] = arguments[C];
270
- V("error", e, p);
268
+ for (var n = arguments.length, l = new Array(n > 1 ? n - 1 : 0), p = 1; p < n; p++)
269
+ l[p - 1] = arguments[p];
270
+ N("error", e, l);
271
271
  }
272
272
  }
273
- function V(e, s, p) {
273
+ function N(e, n, l) {
274
274
  {
275
- var C = W.ReactDebugCurrentFrame, z = C.getStackAddendum();
276
- z !== "" && (s += "%s", p = p.concat([z]));
277
- var Y = p.map(function(B) {
278
- return String(B);
275
+ var p = T.ReactDebugCurrentFrame, S = p.getStackAddendum();
276
+ S !== "" && (n += "%s", l = l.concat([S]));
277
+ var I = l.map(function(A) {
278
+ return String(A);
279
279
  });
280
- Y.unshift("Warning: " + s), Function.prototype.apply.call(console[e], console, Y);
280
+ I.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, I);
281
281
  }
282
282
  }
283
- var J = !1, ce = !1, Q = !1, g = !1, $ = !1, N;
284
- N = Symbol.for("react.module.reference");
285
- function h(e) {
286
- return !!(typeof e == "string" || typeof e == "function" || e === l || e === d || $ || e === R || e === v || e === D || g || e === Z || J || ce || Q || typeof e == "object" && e !== null && (e.$$typeof === k || e.$$typeof === _ || e.$$typeof === P || e.$$typeof === A || e.$$typeof === T || // This needs to include all possible module reference object
283
+ var j = !1, L = !1, U = !1, re = !1, ne = !1, X;
284
+ X = Symbol.for("react.module.reference");
285
+ function ae(e) {
286
+ return !!(typeof e == "string" || typeof e == "function" || e === u || e === h || ne || e === v || e === b || e === D || re || e === Q || j || L || U || typeof e == "object" && e !== null && (e.$$typeof === F || e.$$typeof === k || e.$$typeof === x || e.$$typeof === E || e.$$typeof === R || // This needs to include all possible module reference object
287
287
  // types supported by any Flight configuration anywhere since
288
288
  // we don't know which Flight build this will end up being used
289
289
  // with.
290
- e.$$typeof === N || e.getModuleId !== void 0));
290
+ e.$$typeof === X || e.getModuleId !== void 0));
291
291
  }
292
- function O(e, s, p) {
293
- var C = e.displayName;
294
- if (C)
295
- return C;
296
- var z = s.displayName || s.name || "";
297
- return z !== "" ? p + "(" + z + ")" : p;
292
+ function _(e, n, l) {
293
+ var p = e.displayName;
294
+ if (p)
295
+ return p;
296
+ var S = n.displayName || n.name || "";
297
+ return S !== "" ? l + "(" + S + ")" : l;
298
298
  }
299
- function G(e) {
299
+ function d(e) {
300
300
  return e.displayName || "Context";
301
301
  }
302
- function re(e) {
302
+ function P(e) {
303
303
  if (e == null)
304
304
  return null;
305
305
  if (typeof e.tag == "number" && m("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
@@ -307,36 +307,36 @@ function Wr() {
307
307
  if (typeof e == "string")
308
308
  return e;
309
309
  switch (e) {
310
- case l:
310
+ case u:
311
311
  return "Fragment";
312
312
  case f:
313
313
  return "Portal";
314
- case d:
314
+ case h:
315
315
  return "Profiler";
316
- case R:
317
- return "StrictMode";
318
316
  case v:
317
+ return "StrictMode";
318
+ case b:
319
319
  return "Suspense";
320
320
  case D:
321
321
  return "SuspenseList";
322
322
  }
323
323
  if (typeof e == "object")
324
324
  switch (e.$$typeof) {
325
- case A:
326
- var s = e;
327
- return G(s) + ".Consumer";
328
- case P:
329
- var p = e;
330
- return G(p._context) + ".Provider";
331
- case T:
332
- return O(e, e.render, "ForwardRef");
333
- case _:
334
- var C = e.displayName || null;
335
- return C !== null ? C : re(e.type) || "Memo";
336
- case k: {
337
- var z = e, Y = z._payload, B = z._init;
325
+ case E:
326
+ var n = e;
327
+ return d(n) + ".Consumer";
328
+ case x:
329
+ var l = e;
330
+ return d(l._context) + ".Provider";
331
+ case R:
332
+ return _(e, e.render, "ForwardRef");
333
+ case k:
334
+ var p = e.displayName || null;
335
+ return p !== null ? p : P(e.type) || "Memo";
336
+ case F: {
337
+ var S = e, I = S._payload, A = S._init;
338
338
  try {
339
- return re(B(Y));
339
+ return P(A(I));
340
340
  } catch {
341
341
  return null;
342
342
  }
@@ -344,18 +344,18 @@ function Wr() {
344
344
  }
345
345
  return null;
346
346
  }
347
- var I = Object.assign, ee = 0, X, ve, me, Ne, Pe, ne, Oe;
348
- function ae() {
347
+ var V = Object.assign, z = 0, $, G, ce, me, Y, ee, ue;
348
+ function Pe() {
349
349
  }
350
- ae.__reactDisabledLog = !0;
351
- function Me() {
350
+ Pe.__reactDisabledLog = !0;
351
+ function oe() {
352
352
  {
353
- if (ee === 0) {
354
- X = console.log, ve = console.info, me = console.warn, Ne = console.error, Pe = console.group, ne = console.groupCollapsed, Oe = console.groupEnd;
353
+ if (z === 0) {
354
+ $ = console.log, G = console.info, ce = console.warn, me = console.error, Y = console.group, ee = console.groupCollapsed, ue = console.groupEnd;
355
355
  var e = {
356
356
  configurable: !0,
357
357
  enumerable: !0,
358
- value: ae,
358
+ value: Pe,
359
359
  writable: !0
360
360
  };
361
361
  Object.defineProperties(console, {
@@ -368,332 +368,332 @@ function Wr() {
368
368
  groupEnd: e
369
369
  });
370
370
  }
371
- ee++;
371
+ z++;
372
372
  }
373
373
  }
374
- function _e() {
374
+ function Te() {
375
375
  {
376
- if (ee--, ee === 0) {
376
+ if (z--, z === 0) {
377
377
  var e = {
378
378
  configurable: !0,
379
379
  enumerable: !0,
380
380
  writable: !0
381
381
  };
382
382
  Object.defineProperties(console, {
383
- log: I({}, e, {
384
- value: X
383
+ log: V({}, e, {
384
+ value: $
385
385
  }),
386
- info: I({}, e, {
387
- value: ve
386
+ info: V({}, e, {
387
+ value: G
388
388
  }),
389
- warn: I({}, e, {
390
- value: me
389
+ warn: V({}, e, {
390
+ value: ce
391
391
  }),
392
- error: I({}, e, {
393
- value: Ne
392
+ error: V({}, e, {
393
+ value: me
394
394
  }),
395
- group: I({}, e, {
396
- value: Pe
395
+ group: V({}, e, {
396
+ value: Y
397
397
  }),
398
- groupCollapsed: I({}, e, {
399
- value: ne
398
+ groupCollapsed: V({}, e, {
399
+ value: ee
400
400
  }),
401
- groupEnd: I({}, e, {
402
- value: Oe
401
+ groupEnd: V({}, e, {
402
+ value: ue
403
403
  })
404
404
  });
405
405
  }
406
- ee < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
406
+ z < 0 && m("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
407
407
  }
408
408
  }
409
- var ke = W.ReactCurrentDispatcher, Fe;
410
- function Se(e, s, p) {
409
+ var we = T.ReactCurrentDispatcher, Ce;
410
+ function ie(e, n, l) {
411
411
  {
412
- if (Fe === void 0)
412
+ if (Ce === void 0)
413
413
  try {
414
414
  throw Error();
415
- } catch (z) {
416
- var C = z.stack.trim().match(/\n( *(at )?)/);
417
- Fe = C && C[1] || "";
415
+ } catch (S) {
416
+ var p = S.stack.trim().match(/\n( *(at )?)/);
417
+ Ce = p && p[1] || "";
418
418
  }
419
419
  return `
420
- ` + Fe + e;
420
+ ` + Ce + e;
421
421
  }
422
422
  }
423
- var de = !1, U;
423
+ var Be = !1, ge;
424
424
  {
425
- var E = typeof WeakMap == "function" ? WeakMap : Map;
426
- U = new E();
425
+ var Se = typeof WeakMap == "function" ? WeakMap : Map;
426
+ ge = new Se();
427
427
  }
428
- function he(e, s) {
429
- if (!e || de)
428
+ function g(e, n) {
429
+ if (!e || Be)
430
430
  return "";
431
431
  {
432
- var p = U.get(e);
433
- if (p !== void 0)
434
- return p;
432
+ var l = ge.get(e);
433
+ if (l !== void 0)
434
+ return l;
435
435
  }
436
- var C;
437
- de = !0;
438
- var z = Error.prepareStackTrace;
436
+ var p;
437
+ Be = !0;
438
+ var S = Error.prepareStackTrace;
439
439
  Error.prepareStackTrace = void 0;
440
- var Y;
441
- Y = ke.current, ke.current = null, Me();
440
+ var I;
441
+ I = we.current, we.current = null, oe();
442
442
  try {
443
- if (s) {
444
- var B = function() {
443
+ if (n) {
444
+ var A = function() {
445
445
  throw Error();
446
446
  };
447
- if (Object.defineProperty(B.prototype, "props", {
447
+ if (Object.defineProperty(A.prototype, "props", {
448
448
  set: function() {
449
449
  throw Error();
450
450
  }
451
451
  }), typeof Reflect == "object" && Reflect.construct) {
452
452
  try {
453
- Reflect.construct(B, []);
454
- } catch (Ce) {
455
- C = Ce;
453
+ Reflect.construct(A, []);
454
+ } catch (Re) {
455
+ p = Re;
456
456
  }
457
- Reflect.construct(e, [], B);
457
+ Reflect.construct(e, [], A);
458
458
  } else {
459
459
  try {
460
- B.call();
461
- } catch (Ce) {
462
- C = Ce;
460
+ A.call();
461
+ } catch (Re) {
462
+ p = Re;
463
463
  }
464
- e.call(B.prototype);
464
+ e.call(A.prototype);
465
465
  }
466
466
  } else {
467
467
  try {
468
468
  throw Error();
469
- } catch (Ce) {
470
- C = Ce;
469
+ } catch (Re) {
470
+ p = Re;
471
471
  }
472
472
  e();
473
473
  }
474
- } catch (Ce) {
475
- if (Ce && C && typeof Ce.stack == "string") {
476
- for (var F = Ce.stack.split(`
477
- `), Ee = C.stack.split(`
478
- `), se = F.length - 1, fe = Ee.length - 1; se >= 1 && fe >= 0 && F[se] !== Ee[fe]; )
479
- fe--;
480
- for (; se >= 1 && fe >= 0; se--, fe--)
481
- if (F[se] !== Ee[fe]) {
482
- if (se !== 1 || fe !== 1)
474
+ } catch (Re) {
475
+ if (Re && p && typeof Re.stack == "string") {
476
+ for (var M = Re.stack.split(`
477
+ `), be = p.stack.split(`
478
+ `), te = M.length - 1, se = be.length - 1; te >= 1 && se >= 0 && M[te] !== be[se]; )
479
+ se--;
480
+ for (; te >= 1 && se >= 0; te--, se--)
481
+ if (M[te] !== be[se]) {
482
+ if (te !== 1 || se !== 1)
483
483
  do
484
- if (se--, fe--, fe < 0 || F[se] !== Ee[fe]) {
485
- var Te = `
486
- ` + F[se].replace(" at new ", " at ");
487
- return e.displayName && Te.includes("<anonymous>") && (Te = Te.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, Te), Te;
484
+ if (te--, se--, se < 0 || M[te] !== be[se]) {
485
+ var Ae = `
486
+ ` + M[te].replace(" at new ", " at ");
487
+ return e.displayName && Ae.includes("<anonymous>") && (Ae = Ae.replace("<anonymous>", e.displayName)), typeof e == "function" && ge.set(e, Ae), Ae;
488
488
  }
489
- while (se >= 1 && fe >= 0);
489
+ while (te >= 1 && se >= 0);
490
490
  break;
491
491
  }
492
492
  }
493
493
  } finally {
494
- de = !1, ke.current = Y, _e(), Error.prepareStackTrace = z;
494
+ Be = !1, we.current = I, Te(), Error.prepareStackTrace = S;
495
495
  }
496
- var Je = e ? e.displayName || e.name : "", He = Je ? Se(Je) : "";
497
- return typeof e == "function" && U.set(e, He), He;
496
+ var Xe = e ? e.displayName || e.name : "", Ue = Xe ? ie(Xe) : "";
497
+ return typeof e == "function" && ge.set(e, Ue), Ue;
498
498
  }
499
- function pe(e, s, p) {
500
- return he(e, !1);
499
+ function Ee(e, n, l) {
500
+ return g(e, !1);
501
501
  }
502
- function we(e) {
503
- var s = e.prototype;
504
- return !!(s && s.isReactComponent);
502
+ function he(e) {
503
+ var n = e.prototype;
504
+ return !!(n && n.isReactComponent);
505
505
  }
506
- function b(e, s, p) {
506
+ function H(e, n, l) {
507
507
  if (e == null)
508
508
  return "";
509
509
  if (typeof e == "function")
510
- return he(e, we(e));
510
+ return g(e, he(e));
511
511
  if (typeof e == "string")
512
- return Se(e);
512
+ return ie(e);
513
513
  switch (e) {
514
- case v:
515
- return Se("Suspense");
514
+ case b:
515
+ return ie("Suspense");
516
516
  case D:
517
- return Se("SuspenseList");
517
+ return ie("SuspenseList");
518
518
  }
519
519
  if (typeof e == "object")
520
520
  switch (e.$$typeof) {
521
- case T:
522
- return pe(e.render);
523
- case _:
524
- return b(e.type, s, p);
525
- case k: {
526
- var C = e, z = C._payload, Y = C._init;
521
+ case R:
522
+ return Ee(e.render);
523
+ case k:
524
+ return H(e.type, n, l);
525
+ case F: {
526
+ var p = e, S = p._payload, I = p._init;
527
527
  try {
528
- return b(Y(z), s, p);
528
+ return H(I(S), n, l);
529
529
  } catch {
530
530
  }
531
531
  }
532
532
  }
533
533
  return "";
534
534
  }
535
- var S = Object.prototype.hasOwnProperty, ie = {}, le = W.ReactDebugCurrentFrame;
536
- function ue(e) {
535
+ var fe = Object.prototype.hasOwnProperty, We = {}, ve = T.ReactDebugCurrentFrame;
536
+ function _e(e) {
537
537
  if (e) {
538
- var s = e._owner, p = b(e.type, e._source, s ? s.type : null);
539
- le.setExtraStackFrame(p);
538
+ var n = e._owner, l = H(e.type, e._source, n ? n.type : null);
539
+ ve.setExtraStackFrame(l);
540
540
  } else
541
- le.setExtraStackFrame(null);
541
+ ve.setExtraStackFrame(null);
542
542
  }
543
- function be(e, s, p, C, z) {
543
+ function Ve(e, n, l, p, S) {
544
544
  {
545
- var Y = Function.call.bind(S);
546
- for (var B in e)
547
- if (Y(e, B)) {
548
- var F = void 0;
545
+ var I = Function.call.bind(fe);
546
+ for (var A in e)
547
+ if (I(e, A)) {
548
+ var M = void 0;
549
549
  try {
550
- if (typeof e[B] != "function") {
551
- var Ee = Error((C || "React class") + ": " + p + " type `" + B + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[B] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
552
- throw Ee.name = "Invariant Violation", Ee;
550
+ if (typeof e[A] != "function") {
551
+ var be = Error((p || "React class") + ": " + l + " type `" + A + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[A] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
552
+ throw be.name = "Invariant Violation", be;
553
553
  }
554
- F = e[B](s, B, C, p, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
555
- } catch (se) {
556
- F = se;
554
+ M = e[A](n, A, p, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
555
+ } catch (te) {
556
+ M = te;
557
557
  }
558
- F && !(F instanceof Error) && (ue(z), m("%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).", C || "React class", p, B, typeof F), ue(null)), F instanceof Error && !(F.message in ie) && (ie[F.message] = !0, ue(z), m("Failed %s type: %s", p, F.message), ue(null));
558
+ M && !(M instanceof Error) && (_e(S), m("%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).", p || "React class", l, A, typeof M), _e(null)), M instanceof Error && !(M.message in We) && (We[M.message] = !0, _e(S), m("Failed %s type: %s", l, M.message), _e(null));
559
559
  }
560
560
  }
561
561
  }
562
- var $e = Array.isArray;
563
- function ge(e) {
564
- return $e(e);
562
+ var C = Array.isArray;
563
+ function y(e) {
564
+ return C(e);
565
565
  }
566
- function Ie(e) {
566
+ function pe(e) {
567
567
  {
568
- var s = typeof Symbol == "function" && Symbol.toStringTag, p = s && e[Symbol.toStringTag] || e.constructor.name || "Object";
569
- return p;
568
+ var n = typeof Symbol == "function" && Symbol.toStringTag, l = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
569
+ return l;
570
570
  }
571
571
  }
572
- function at(e) {
572
+ function de(e) {
573
573
  try {
574
- return Ge(e), !1;
574
+ return le(e), !1;
575
575
  } catch {
576
576
  return !0;
577
577
  }
578
578
  }
579
- function Ge(e) {
579
+ function le(e) {
580
580
  return "" + e;
581
581
  }
582
- function ft(e) {
583
- if (at(e))
584
- return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ie(e)), Ge(e);
582
+ function ke(e) {
583
+ if (de(e))
584
+ return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", pe(e)), le(e);
585
585
  }
586
- var dt = W.ReactCurrentOwner, Et = {
586
+ var Oe = T.ReactCurrentOwner, Ie = {
587
587
  key: !0,
588
588
  ref: !0,
589
589
  __self: !0,
590
590
  __source: !0
591
- }, mt, We;
592
- function Ye(e) {
593
- if (S.call(e, "ref")) {
594
- var s = Object.getOwnPropertyDescriptor(e, "ref").get;
595
- if (s && s.isReactWarning)
591
+ }, De, Ze;
592
+ function at(e) {
593
+ if (fe.call(e, "ref")) {
594
+ var n = Object.getOwnPropertyDescriptor(e, "ref").get;
595
+ if (n && n.isReactWarning)
596
596
  return !1;
597
597
  }
598
598
  return e.ref !== void 0;
599
599
  }
600
- function yt(e) {
601
- if (S.call(e, "key")) {
602
- var s = Object.getOwnPropertyDescriptor(e, "key").get;
603
- if (s && s.isReactWarning)
600
+ function Ct(e) {
601
+ if (fe.call(e, "key")) {
602
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
603
+ if (n && n.isReactWarning)
604
604
  return !1;
605
605
  }
606
606
  return e.key !== void 0;
607
607
  }
608
- function _t(e, s) {
609
- typeof e.ref == "string" && dt.current;
608
+ function Rt(e, n) {
609
+ typeof e.ref == "string" && Oe.current;
610
610
  }
611
- function bt(e, s) {
611
+ function Pt(e, n) {
612
612
  {
613
- var p = function() {
614
- mt || (mt = !0, m("%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)", s));
613
+ var l = function() {
614
+ De || (De = !0, m("%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)", n));
615
615
  };
616
- p.isReactWarning = !0, Object.defineProperty(e, "key", {
617
- get: p,
616
+ l.isReactWarning = !0, Object.defineProperty(e, "key", {
617
+ get: l,
618
618
  configurable: !0
619
619
  });
620
620
  }
621
621
  }
622
- function xt(e, s) {
622
+ function Ke(e, n) {
623
623
  {
624
- var p = function() {
625
- We || (We = !0, m("%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)", s));
624
+ var l = function() {
625
+ Ze || (Ze = !0, m("%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)", n));
626
626
  };
627
- p.isReactWarning = !0, Object.defineProperty(e, "ref", {
628
- get: p,
627
+ l.isReactWarning = !0, Object.defineProperty(e, "ref", {
628
+ get: l,
629
629
  configurable: !0
630
630
  });
631
631
  }
632
632
  }
633
- var Ct = function(e, s, p, C, z, Y, B) {
634
- var F = {
633
+ var qe = function(e, n, l, p, S, I, A) {
634
+ var M = {
635
635
  // This tag allows us to uniquely identify this as a React Element
636
- $$typeof: c,
636
+ $$typeof: s,
637
637
  // Built-in properties that belong on the element
638
638
  type: e,
639
- key: s,
640
- ref: p,
641
- props: B,
639
+ key: n,
640
+ ref: l,
641
+ props: A,
642
642
  // Record the component responsible for creating this element.
643
- _owner: Y
643
+ _owner: I
644
644
  };
645
- return F._store = {}, Object.defineProperty(F._store, "validated", {
645
+ return M._store = {}, Object.defineProperty(M._store, "validated", {
646
646
  configurable: !1,
647
647
  enumerable: !1,
648
648
  writable: !0,
649
649
  value: !1
650
- }), Object.defineProperty(F, "_self", {
650
+ }), Object.defineProperty(M, "_self", {
651
651
  configurable: !1,
652
652
  enumerable: !1,
653
653
  writable: !1,
654
- value: C
655
- }), Object.defineProperty(F, "_source", {
654
+ value: p
655
+ }), Object.defineProperty(M, "_source", {
656
656
  configurable: !1,
657
657
  enumerable: !1,
658
658
  writable: !1,
659
- value: z
660
- }), Object.freeze && (Object.freeze(F.props), Object.freeze(F)), F;
659
+ value: S
660
+ }), Object.freeze && (Object.freeze(M.props), Object.freeze(M)), M;
661
661
  };
662
- function pt(e, s, p, C, z) {
662
+ function kt(e, n, l, p, S) {
663
663
  {
664
- var Y, B = {}, F = null, Ee = null;
665
- p !== void 0 && (ft(p), F = "" + p), yt(s) && (ft(s.key), F = "" + s.key), Ye(s) && (Ee = s.ref, _t(s, z));
666
- for (Y in s)
667
- S.call(s, Y) && !Et.hasOwnProperty(Y) && (B[Y] = s[Y]);
664
+ var I, A = {}, M = null, be = null;
665
+ l !== void 0 && (ke(l), M = "" + l), Ct(n) && (ke(n.key), M = "" + n.key), at(n) && (be = n.ref, Rt(n, S));
666
+ for (I in n)
667
+ fe.call(n, I) && !Ie.hasOwnProperty(I) && (A[I] = n[I]);
668
668
  if (e && e.defaultProps) {
669
- var se = e.defaultProps;
670
- for (Y in se)
671
- B[Y] === void 0 && (B[Y] = se[Y]);
669
+ var te = e.defaultProps;
670
+ for (I in te)
671
+ A[I] === void 0 && (A[I] = te[I]);
672
672
  }
673
- if (F || Ee) {
674
- var fe = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
675
- F && bt(B, fe), Ee && xt(B, fe);
673
+ if (M || be) {
674
+ var se = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
675
+ M && Pt(A, se), be && Ke(A, se);
676
676
  }
677
- return Ct(e, F, Ee, z, C, dt.current, B);
677
+ return qe(e, M, be, S, p, Oe.current, A);
678
678
  }
679
679
  }
680
- var Ze = W.ReactCurrentOwner, ot = W.ReactDebugCurrentFrame;
681
- function Ve(e) {
680
+ var ot = T.ReactCurrentOwner, pt = T.ReactDebugCurrentFrame;
681
+ function $e(e) {
682
682
  if (e) {
683
- var s = e._owner, p = b(e.type, e._source, s ? s.type : null);
684
- ot.setExtraStackFrame(p);
683
+ var n = e._owner, l = H(e.type, e._source, n ? n.type : null);
684
+ pt.setExtraStackFrame(l);
685
685
  } else
686
- ot.setExtraStackFrame(null);
686
+ pt.setExtraStackFrame(null);
687
687
  }
688
- var Ke;
689
- Ke = !1;
690
- function qe(e) {
691
- return typeof e == "object" && e !== null && e.$$typeof === c;
688
+ var it;
689
+ it = !1;
690
+ function Je(e) {
691
+ return typeof e == "object" && e !== null && e.$$typeof === s;
692
692
  }
693
- function ht() {
693
+ function lt() {
694
694
  {
695
- if (Ze.current) {
696
- var e = re(Ze.current.type);
695
+ if (ot.current) {
696
+ var e = P(ot.current.type);
697
697
  if (e)
698
698
  return `
699
699
 
@@ -702,148 +702,148 @@ Check the render method of \`` + e + "`.";
702
702
  return "";
703
703
  }
704
704
  }
705
- function Rt(e) {
705
+ function ht(e) {
706
706
  return "";
707
707
  }
708
708
  var vt = {};
709
- function kt(e) {
709
+ function wt(e) {
710
710
  {
711
- var s = ht();
712
- if (!s) {
713
- var p = typeof e == "string" ? e : e.displayName || e.name;
714
- p && (s = `
711
+ var n = lt();
712
+ if (!n) {
713
+ var l = typeof e == "string" ? e : e.displayName || e.name;
714
+ l && (n = `
715
715
 
716
- Check the top-level render call using <` + p + ">.");
716
+ Check the top-level render call using <` + l + ">.");
717
717
  }
718
- return s;
718
+ return n;
719
719
  }
720
720
  }
721
- function wt(e, s) {
721
+ function st(e, n) {
722
722
  {
723
723
  if (!e._store || e._store.validated || e.key != null)
724
724
  return;
725
725
  e._store.validated = !0;
726
- var p = kt(s);
727
- if (vt[p])
726
+ var l = wt(n);
727
+ if (vt[l])
728
728
  return;
729
- vt[p] = !0;
730
- var C = "";
731
- e && e._owner && e._owner !== Ze.current && (C = " It was passed a child from " + re(e._owner.type) + "."), Ve(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', p, C), Ve(null);
729
+ vt[l] = !0;
730
+ var p = "";
731
+ e && e._owner && e._owner !== ot.current && (p = " It was passed a child from " + P(e._owner.type) + "."), $e(e), m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, p), $e(null);
732
732
  }
733
733
  }
734
- function t(e, s) {
734
+ function gt(e, n) {
735
735
  {
736
736
  if (typeof e != "object")
737
737
  return;
738
- if (ge(e))
739
- for (var p = 0; p < e.length; p++) {
740
- var C = e[p];
741
- qe(C) && wt(C, s);
738
+ if (y(e))
739
+ for (var l = 0; l < e.length; l++) {
740
+ var p = e[l];
741
+ Je(p) && st(p, n);
742
742
  }
743
- else if (qe(e))
743
+ else if (Je(e))
744
744
  e._store && (e._store.validated = !0);
745
745
  else if (e) {
746
- var z = K(e);
747
- if (typeof z == "function" && z !== e.entries)
748
- for (var Y = z.call(e), B; !(B = Y.next()).done; )
749
- qe(B.value) && wt(B.value, s);
746
+ var S = Z(e);
747
+ if (typeof S == "function" && S !== e.entries)
748
+ for (var I = S.call(e), A; !(A = I.next()).done; )
749
+ Je(A.value) && st(A.value, n);
750
750
  }
751
751
  }
752
752
  }
753
- function a(e) {
753
+ function Tt(e) {
754
754
  {
755
- var s = e.type;
756
- if (s == null || typeof s == "string")
755
+ var n = e.type;
756
+ if (n == null || typeof n == "string")
757
757
  return;
758
- var p;
759
- if (typeof s == "function")
760
- p = s.propTypes;
761
- else if (typeof s == "object" && (s.$$typeof === T || // Note: Memo only checks outer props here.
758
+ var l;
759
+ if (typeof n == "function")
760
+ l = n.propTypes;
761
+ else if (typeof n == "object" && (n.$$typeof === R || // Note: Memo only checks outer props here.
762
762
  // Inner props are checked in the reconciler.
763
- s.$$typeof === _))
764
- p = s.propTypes;
763
+ n.$$typeof === k))
764
+ l = n.propTypes;
765
765
  else
766
766
  return;
767
- if (p) {
768
- var C = re(s);
769
- be(p, e.props, "prop", C, e);
770
- } else if (s.PropTypes !== void 0 && !Ke) {
771
- Ke = !0;
772
- var z = re(s);
773
- m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", z || "Unknown");
767
+ if (l) {
768
+ var p = P(n);
769
+ Ve(l, e.props, "prop", p, e);
770
+ } else if (n.PropTypes !== void 0 && !it) {
771
+ it = !0;
772
+ var S = P(n);
773
+ m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", S || "Unknown");
774
774
  }
775
- typeof s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
775
+ typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
776
776
  }
777
777
  }
778
- function o(e) {
778
+ function St(e) {
779
779
  {
780
- for (var s = Object.keys(e.props), p = 0; p < s.length; p++) {
781
- var C = s[p];
782
- if (C !== "children" && C !== "key") {
783
- Ve(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", C), Ve(null);
780
+ for (var n = Object.keys(e.props), l = 0; l < n.length; l++) {
781
+ var p = n[l];
782
+ if (p !== "children" && p !== "key") {
783
+ $e(e), m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), $e(null);
784
784
  break;
785
785
  }
786
786
  }
787
- e.ref !== null && (Ve(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), Ve(null));
787
+ e.ref !== null && ($e(e), m("Invalid attribute `ref` supplied to `React.Fragment`."), $e(null));
788
788
  }
789
789
  }
790
- var i = {};
791
- function u(e, s, p, C, z, Y) {
790
+ var Et = {};
791
+ function _t(e, n, l, p, S, I) {
792
792
  {
793
- var B = h(e);
794
- if (!B) {
795
- var F = "";
796
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (F += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
797
- var Ee = Rt();
798
- Ee ? F += Ee : F += ht();
799
- var se;
800
- e === null ? se = "null" : ge(e) ? se = "array" : e !== void 0 && e.$$typeof === c ? (se = "<" + (re(e.type) || "Unknown") + " />", F = " Did you accidentally export a JSX literal instead of a component?") : se = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", se, F);
793
+ var A = ae(e);
794
+ if (!A) {
795
+ var M = "";
796
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (M += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
797
+ var be = ht();
798
+ be ? M += be : M += lt();
799
+ var te;
800
+ e === null ? te = "null" : y(e) ? te = "array" : e !== void 0 && e.$$typeof === s ? (te = "<" + (P(e.type) || "Unknown") + " />", M = " Did you accidentally export a JSX literal instead of a component?") : te = typeof e, m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", te, M);
801
801
  }
802
- var fe = pt(e, s, p, z, Y);
803
- if (fe == null)
804
- return fe;
805
- if (B) {
806
- var Te = s.children;
807
- if (Te !== void 0)
808
- if (C)
809
- if (ge(Te)) {
810
- for (var Je = 0; Je < Te.length; Je++)
811
- t(Te[Je], e);
812
- Object.freeze && Object.freeze(Te);
802
+ var se = kt(e, n, l, S, I);
803
+ if (se == null)
804
+ return se;
805
+ if (A) {
806
+ var Ae = n.children;
807
+ if (Ae !== void 0)
808
+ if (p)
809
+ if (y(Ae)) {
810
+ for (var Xe = 0; Xe < Ae.length; Xe++)
811
+ gt(Ae[Xe], e);
812
+ Object.freeze && Object.freeze(Ae);
813
813
  } else
814
814
  m("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
815
815
  else
816
- t(Te, e);
816
+ gt(Ae, e);
817
817
  }
818
- if (S.call(s, "key")) {
819
- var He = re(e), Ce = Object.keys(s).filter(function(Kt) {
820
- return Kt !== "key";
821
- }), Pt = Ce.length > 0 ? "{key: someKey, " + Ce.join(": ..., ") + ": ...}" : "{key: someKey}";
822
- if (!i[He + Pt]) {
823
- var Zt = Ce.length > 0 ? "{" + Ce.join(": ..., ") + ": ...}" : "{}";
818
+ if (fe.call(n, "key")) {
819
+ var Ue = P(e), Re = Object.keys(n).filter(function(Qt) {
820
+ return Qt !== "key";
821
+ }), Dt = Re.length > 0 ? "{key: someKey, " + Re.join(": ..., ") + ": ...}" : "{key: someKey}";
822
+ if (!Et[Ue + Dt]) {
823
+ var Xt = Re.length > 0 ? "{" + Re.join(": ..., ") + ": ...}" : "{}";
824
824
  m(`A props object containing a "key" prop is being spread into JSX:
825
825
  let props = %s;
826
826
  <%s {...props} />
827
827
  React keys must be passed directly to JSX without using spread:
828
828
  let props = %s;
829
- <%s key={someKey} {...props} />`, Pt, He, Zt, He), i[He + Pt] = !0;
829
+ <%s key={someKey} {...props} />`, Dt, Ue, Xt, Ue), Et[Ue + Dt] = !0;
830
830
  }
831
831
  }
832
- return e === l ? o(fe) : a(fe), fe;
832
+ return e === u ? St(se) : Tt(se), se;
833
833
  }
834
834
  }
835
- function w(e, s, p) {
836
- return u(e, s, p, !0);
835
+ function t(e, n, l) {
836
+ return _t(e, n, l, !0);
837
837
  }
838
- function y(e, s, p) {
839
- return u(e, s, p, !1);
838
+ function a(e, n, l) {
839
+ return _t(e, n, l, !1);
840
840
  }
841
- var oe = y, xe = w;
842
- st.Fragment = l, st.jsx = oe, st.jsxs = xe;
843
- }()), st;
841
+ var o = a, c = t;
842
+ ut.Fragment = u, ut.jsx = o, ut.jsxs = c;
843
+ }()), ut;
844
844
  }
845
- process.env.NODE_ENV === "production" ? It.exports = $r() : It.exports = Wr();
846
- var Ae = It.exports, rt = (n) => cr("path", n), nt = Ut(
845
+ process.env.NODE_ENV === "production" ? Ot.exports = Ur() : Ot.exports = zr();
846
+ var Le = Ot.exports, rt = (i) => mr("path", i), nt = Zt(
847
847
  /**
848
848
  * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
849
849
  * Other props will be passed through to svg component.
@@ -851,650 +851,675 @@ var Ae = It.exports, rt = (n) => cr("path", n), nt = Ut(
851
851
  *
852
852
  * @return {React.JSX.Element} Stop component
853
853
  */
854
- ({ className: n, isPressed: c, ...f }, l) => {
855
- const R = {
854
+ ({ className: i, isPressed: s, ...f }, u) => {
855
+ const v = {
856
856
  ...f,
857
- className: ur(n, { "is-pressed": c }) || void 0,
857
+ className: pr(i, { "is-pressed": s }) || void 0,
858
858
  "aria-hidden": !0,
859
859
  focusable: !1
860
860
  };
861
- return /* @__PURE__ */ Ae.jsx("svg", { ...R, ref: l });
861
+ return /* @__PURE__ */ Le.jsx("svg", { ...v, ref: u });
862
862
  }
863
863
  );
864
864
  nt.displayName = "SVG";
865
- const Hr = /* @__PURE__ */ Ae.jsx(nt, {
865
+ const Gr = /* @__PURE__ */ Le.jsx(nt, {
866
866
  viewBox: "0 0 24 24",
867
867
  xmlns: "http://www.w3.org/2000/svg",
868
- children: /* @__PURE__ */ Ae.jsx(rt, {
868
+ children: /* @__PURE__ */ Le.jsx(rt, {
869
869
  d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
870
870
  })
871
- }), Ur = /* @__PURE__ */ Ae.jsx(nt, {
871
+ }), Yr = /* @__PURE__ */ Le.jsx(nt, {
872
872
  xmlns: "http://www.w3.org/2000/svg",
873
873
  viewBox: "0 0 24 24",
874
- children: /* @__PURE__ */ Ae.jsx(rt, {
874
+ children: /* @__PURE__ */ Le.jsx(rt, {
875
875
  d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
876
876
  })
877
- }), zr = /* @__PURE__ */ Ae.jsx(nt, {
877
+ }), Zr = /* @__PURE__ */ Le.jsx(nt, {
878
878
  viewBox: "0 0 24 24",
879
879
  xmlns: "http://www.w3.org/2000/svg",
880
- children: /* @__PURE__ */ Ae.jsx(rt, {
880
+ children: /* @__PURE__ */ Le.jsx(rt, {
881
881
  fillRule: "evenodd",
882
882
  clipRule: "evenodd",
883
883
  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"
884
884
  })
885
- }), Gr = /* @__PURE__ */ Ae.jsxs(nt, {
885
+ }), Kr = /* @__PURE__ */ Le.jsxs(nt, {
886
886
  xmlns: "http://www.w3.org/2000/svg",
887
887
  viewBox: "0 0 24 24",
888
- children: [/* @__PURE__ */ Ae.jsx(rt, {
888
+ children: [/* @__PURE__ */ Le.jsx(rt, {
889
889
  d: "M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"
890
- }), /* @__PURE__ */ Ae.jsx(rt, {
890
+ }), /* @__PURE__ */ Le.jsx(rt, {
891
891
  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"
892
892
  })]
893
- }), Yr = /* @__PURE__ */ Ae.jsx(nt, {
893
+ }), qr = /* @__PURE__ */ Le.jsx(nt, {
894
894
  xmlns: "http://www.w3.org/2000/svg",
895
895
  viewBox: "0 0 24 24",
896
- children: /* @__PURE__ */ Ae.jsx(rt, {
896
+ children: /* @__PURE__ */ Le.jsx(rt, {
897
897
  d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
898
898
  })
899
- }), Zr = "_file-picker-tree_ad9od_1", Kr = "_file-node-button_ad9od_17", qr = "_selected_ad9od_56", Jr = "_focused_ad9od_75", Xr = "_dropTarget_ad9od_83", Qr = "_dropTargetInvalid_ad9od_95", en = "_renaming_ad9od_104", tn = "_renameInput_ad9od_109", rn = "_file-name_ad9od_124", Re = {
900
- filePickerTree: Zr,
901
- fileNodeButton: Kr,
902
- selected: qr,
903
- focused: Jr,
904
- dropTarget: Xr,
905
- dropTargetInvalid: Qr,
906
- renaming: en,
907
- renameInput: tn,
908
- fileName: rn
899
+ }), Jr = "_file-picker-tree_12ffp_1", Xr = "_file-node-button_12ffp_17", Qr = "_selected_12ffp_56", en = "_focused_12ffp_75", tn = "_dropTarget_12ffp_83", rn = "_dropTargetInvalid_12ffp_95", nn = "_renaming_12ffp_104", an = "_renameInput_12ffp_109", on = "_file-name_12ffp_124", ln = "_path-badge_12ffp_128", sn = "_path-badge-tooltip_12ffp_140", ye = {
900
+ filePickerTree: Jr,
901
+ fileNodeButton: Xr,
902
+ selected: Qr,
903
+ focused: en,
904
+ dropTarget: tn,
905
+ dropTargetInvalid: rn,
906
+ renaming: nn,
907
+ renameInput: an,
908
+ fileName: on,
909
+ pathBadge: ln,
910
+ pathBadgeTooltip: sn
909
911
  };
910
- function Dt(n) {
911
- if (!n) return [];
912
- const c = Jt(n), f = c.startsWith("/"), l = c.split("/").filter(Boolean), R = [];
913
- let d = f ? "/" : "";
914
- f && R.push("/");
915
- for (const P of l)
916
- !d || d === "/" ? d = d === "/" ? `/${P}` : P : d = `${d}/${P}`, R.push(d);
917
- return R;
912
+ function Lt(i) {
913
+ if (!i) return [];
914
+ const s = tr(i), f = s.startsWith("/"), u = s.split("/").filter(Boolean), v = [];
915
+ let h = f ? "/" : "";
916
+ f && v.push("/");
917
+ for (const x of u)
918
+ !h || h === "/" ? h = h === "/" ? `/${x}` : x : h = `${h}/${x}`, v.push(h);
919
+ return v;
918
920
  }
919
- function ze(n, c, f) {
920
- return n && (n === c ? f : n.startsWith(c === "/" ? "/" : `${c}/`) ? f + n.slice(c.length) : n);
921
+ function Ge(i, s, f) {
922
+ return i && (i === s ? f : i.startsWith(s === "/" ? "/" : `${s}/`) ? f + i.slice(s.length) : i);
921
923
  }
922
- const nn = $t(function({
923
- withContextMenu: c = !0,
924
+ const cn = bt(function({
925
+ withContextMenu: s = !0,
924
926
  readOnly: f = !1,
925
- filesystem: l,
926
- root: R = "/wordpress",
927
- initialSelectedPath: d,
928
- onSelect: P = () => {
927
+ filesystem: u,
928
+ root: v = "/wordpress",
929
+ initialSelectedPath: h,
930
+ onSelect: x = () => {
929
931
  },
930
- onDoubleClickFile: A
931
- }, T) {
932
- const v = Ft(() => je("/", R || "/"), [R]), [D, _] = te(() => {
933
- if (!d)
932
+ onDoubleClickFile: E,
933
+ pathBadges: R,
934
+ onMountFromGit: b,
935
+ onPathRenamed: D
936
+ }, k) {
937
+ const F = ft(() => Me("/", v || "/"), [v]), Q = ft(
938
+ () => Me(F, "wp-content", "plugins"),
939
+ [F]
940
+ ), J = ft(
941
+ () => Me(F, "wp-content", "themes"),
942
+ [F]
943
+ ), [w, Z] = K(() => {
944
+ if (!h)
934
945
  return {};
935
946
  const t = {};
936
- for (const a of Dt(d))
947
+ for (const a of Lt(h))
937
948
  t[a] = !0;
938
949
  return t;
939
- }), [k, Z] = te(
940
- () => d ?? null
941
- ), [j, x] = te(
942
- () => d ?? null
943
- ), [K, W] = te({}), [m, V] = te(
950
+ }), [T, m] = K(
951
+ () => h ?? null
952
+ ), [N, j] = K(
953
+ () => h ?? null
954
+ ), [L, U] = K({}), [re, ne] = K(
944
955
  {}
945
- ), [J, ce] = te(null), [Q, g] = te(
956
+ ), [X, ae] = K(null), [_, d] = K(
946
957
  null
947
- ), $ = M({}), N = M(!1), h = M(null), O = M(null), G = M(m), re = M(K), I = () => {
948
- for (const t of Object.keys($.current))
949
- clearTimeout($.current[t]), delete $.current[t];
950
- }, ee = (t) => {
951
- const a = $.current[t];
952
- a && (clearTimeout(a), delete $.current[t]);
958
+ ), P = O({}), V = O(!1), z = O(null), $ = O(null), G = O(re), ce = O(L), me = () => {
959
+ for (const t of Object.keys(P.current))
960
+ clearTimeout(P.current[t]), delete P.current[t];
961
+ }, Y = (t) => {
962
+ const a = P.current[t];
963
+ a && (clearTimeout(a), delete P.current[t]);
953
964
  };
954
- H(() => {
955
- G.current = m;
956
- }, [m]), H(() => {
957
- re.current = K;
958
- }, [K]);
959
- const X = (t) => {
965
+ W(() => {
966
+ G.current = re;
967
+ }, [re]), W(() => {
968
+ ce.current = L;
969
+ }, [L]);
970
+ const ee = (t) => {
960
971
  var o;
961
- const a = (o = h.current) == null ? void 0 : o.querySelector(
972
+ const a = (o = z.current) == null ? void 0 : o.querySelector(
962
973
  `[data-path="${CSS.escape(t)}"]`
963
974
  );
964
975
  a && typeof a.focus == "function" && (a.focus(), a.scrollIntoView({
965
976
  behavior: "smooth",
966
977
  block: "nearest"
967
978
  }));
968
- }, ve = (t, a = "") => a ? je(a, t.name) : je("/", t.name), me = (t, a) => t.children ? t.children : K[a], Ne = async (t, a) => {
969
- const o = await t.listFiles(a), i = [];
970
- for (const u of o) {
971
- const w = a === "/" ? `/${u}` : `${a}/${u}`, y = await t.isDir(w);
972
- i.push({ name: u, type: y ? "folder" : "file" });
973
- }
974
- return i.sort((u, w) => {
975
- var e;
976
- if (u.type !== w.type) return u.type === "folder" ? -1 : 1;
977
- const y = a === "/" ? `/${u.name}` : `${a}/${u.name}`, oe = a === "/" ? `/${w.name}` : `${a}/${w.name}`, xe = (e = we.current) == null ? void 0 : e.tempPath;
978
- if (xe) {
979
- if (y === xe) return -1;
980
- if (oe === xe) return 1;
979
+ }, ue = (t, a = "") => a ? Me(a, t.name) : Me("/", t.name), Pe = (t, a) => t.children ? t.children : L[a], oe = async (t, a) => {
980
+ const o = await t.listFiles(a), c = [];
981
+ for (const e of o) {
982
+ const n = a === "/" ? `/${e}` : `${a}/${e}`, l = await t.isDir(n);
983
+ c.push({ name: e, type: l ? "folder" : "file" });
984
+ }
985
+ return c.sort((e, n) => {
986
+ var I;
987
+ if (e.type !== n.type) return e.type === "folder" ? -1 : 1;
988
+ const l = a === "/" ? `/${e.name}` : `${a}/${e.name}`, p = a === "/" ? `/${n.name}` : `${a}/${n.name}`, S = (I = _e.current) == null ? void 0 : I.tempPath;
989
+ if (S) {
990
+ if (l === S) return -1;
991
+ if (p === S) return 1;
981
992
  }
982
- return u.name.localeCompare(w.name);
983
- }), i;
984
- }, Pe = async (t) => await Ne(l, t), ne = (t, a) => {
993
+ return e.name.localeCompare(n.name);
994
+ }), c;
995
+ }, Te = async (t) => await oe(u, t), we = (t, a) => {
985
996
  if (a.type !== "folder")
986
997
  return a.children;
987
- const o = a.children ?? re.current[t];
988
- return o || G.current[t] ? o : (V((i) => ({ ...i, [t]: !0 })), new Promise((i) => {
989
- Pe(t).then((u) => {
990
- W((w) => ({
991
- ...w,
992
- [t]: u ?? []
993
- })), i(u ?? []);
998
+ const o = a.children ?? ce.current[t];
999
+ return o || G.current[t] ? o : (ne((c) => ({ ...c, [t]: !0 })), new Promise((c) => {
1000
+ Te(t).then((e) => {
1001
+ U((n) => ({
1002
+ ...n,
1003
+ [t]: e ?? []
1004
+ })), c(e ?? []);
994
1005
  }).catch(() => {
995
- i([]);
1006
+ c([]);
996
1007
  }).finally(() => {
997
- V((u) => {
998
- const w = { ...u };
999
- return delete w[t], w;
1008
+ ne((e) => {
1009
+ const n = { ...e };
1010
+ return delete n[t], n;
1000
1011
  });
1001
1012
  });
1002
1013
  }));
1003
- }, Oe = (t, a) => {
1004
- a.type === "folder" && (typeof window > "u" || $.current[t] || ($.current[t] = window.setTimeout(() => {
1005
- _((o) => o[t] ? o : { ...o, [t]: !0 }), ne(t, a), delete $.current[t];
1014
+ }, Ce = (t, a) => {
1015
+ a.type === "folder" && (typeof window > "u" || P.current[t] || (P.current[t] = window.setTimeout(() => {
1016
+ Z((o) => o[t] ? o : { ...o, [t]: !0 }), we(t, a), delete P.current[t];
1006
1017
  }, 600)));
1007
- }, ae = (t) => (V((a) => ({ ...a, [t]: !0 })), new Promise((a) => {
1008
- Pe(t).then((o) => {
1009
- W((i) => ({
1010
- ...i,
1018
+ }, ie = (t) => (ne((a) => ({ ...a, [t]: !0 })), new Promise((a) => {
1019
+ Te(t).then((o) => {
1020
+ U((c) => ({
1021
+ ...c,
1011
1022
  [t]: o ?? []
1012
1023
  })), a(o ?? []);
1013
1024
  }).catch(() => {
1014
1025
  a([]);
1015
1026
  }).finally(() => {
1016
- V((o) => {
1017
- const i = { ...o };
1018
- return delete i[t], i;
1027
+ ne((o) => {
1028
+ const c = { ...o };
1029
+ return delete c[t], c;
1019
1030
  });
1020
1031
  });
1021
- })), Me = (t, a, o) => {
1022
- _((i) => ({
1023
- ...i,
1032
+ })), Be = (t, a, o) => {
1033
+ Z((c) => ({
1034
+ ...c,
1024
1035
  [t]: o
1025
- })), o ? ne(t, a) : W((i) => {
1026
- if (i[t] === void 0)
1027
- return i;
1028
- const u = { ...i };
1029
- return delete u[t], u;
1036
+ })), o ? we(t, a) : U((c) => {
1037
+ if (c[t] === void 0)
1038
+ return c;
1039
+ const e = { ...c };
1040
+ return delete e[t], e;
1030
1041
  });
1031
- }, _e = async (t) => {
1042
+ }, ge = async (t) => {
1032
1043
  if (!t) return;
1033
- const a = Dt(t);
1044
+ const a = Lt(t);
1034
1045
  if (a.length === 0) return;
1035
- _((u) => {
1036
- const w = { ...u };
1037
- for (const y of a)
1038
- w[y] = !0;
1039
- return w;
1046
+ Z((e) => {
1047
+ const n = { ...e };
1048
+ for (const l of a)
1049
+ n[l] = !0;
1050
+ return n;
1040
1051
  });
1041
1052
  let o = [
1042
- { name: v, type: "folder" }
1043
- ], i = "";
1044
- for (const u of a) {
1045
- const w = o == null ? void 0 : o.find((oe) => ve(oe, i) === u);
1046
- if (!w || w.type !== "folder") {
1047
- i = u, o = [];
1053
+ { name: F, type: "folder" }
1054
+ ], c = "";
1055
+ for (const e of a) {
1056
+ const n = o == null ? void 0 : o.find((p) => ue(p, c) === e);
1057
+ if (!n || n.type !== "folder") {
1058
+ c = e, o = [];
1048
1059
  continue;
1049
1060
  }
1050
- o = await ne(u, w) ?? re.current[u], i = u;
1051
- }
1052
- }, ke = (t, a) => {
1053
- !t || !a || t === a || (_((o) => {
1054
- let i = !1;
1055
- const u = { ...o };
1056
- for (const w of Object.keys(o)) {
1057
- const y = ze(w, t, a);
1058
- y && y !== w && (u[y] = o[w], delete u[w], i = !0);
1061
+ o = await we(e, n) ?? ce.current[e], c = e;
1062
+ }
1063
+ }, Se = (t, a) => {
1064
+ !t || !a || t === a || (Z((o) => {
1065
+ let c = !1;
1066
+ const e = { ...o };
1067
+ for (const n of Object.keys(o)) {
1068
+ const l = Ge(n, t, a);
1069
+ l && l !== n && (e[l] = o[n], delete e[n], c = !0);
1059
1070
  }
1060
- return i ? u : o;
1061
- }), W((o) => {
1062
- let i = !1;
1063
- const u = { ...o };
1064
- for (const w of Object.keys(o)) {
1065
- const y = ze(w, t, a);
1066
- y && y !== w && (u[y] = o[w], delete u[w], i = !0);
1071
+ return c ? e : o;
1072
+ }), U((o) => {
1073
+ let c = !1;
1074
+ const e = { ...o };
1075
+ for (const n of Object.keys(o)) {
1076
+ const l = Ge(n, t, a);
1077
+ l && l !== n && (e[l] = o[n], delete e[n], c = !0);
1067
1078
  }
1068
- return i ? u : o;
1069
- }), Z((o) => ze(o, t, a)), x((o) => ze(o, t, a)));
1070
- }, Fe = () => {
1071
- ce(null), g(null), I();
1072
- }, Se = (t, a = !0) => {
1073
- Z(t), a && P(t);
1074
- }, de = Ft(() => [{ name: v, type: "folder" }], [v]), [U, E] = te(null), [he, pe] = te(null), we = M(null), b = f ? null : he;
1075
- Wt(
1076
- T,
1079
+ return c ? e : o;
1080
+ }), m((o) => Ge(o, t, a)), j((o) => Ge(o, t, a)));
1081
+ }, g = () => {
1082
+ ae(null), d(null), me();
1083
+ }, Ee = (t, a = !0) => {
1084
+ m(t), a && x(t);
1085
+ }, he = ft(() => [{ name: F, type: "folder" }], [F]), [H, fe] = K(null), [We, ve] = K(null), _e = O(null), Ve = f ? null : We;
1086
+ xt(
1087
+ k,
1077
1088
  () => ({
1078
1089
  focusPath: (t, a = {}) => {
1079
1090
  if (!t) return;
1080
1091
  const {
1081
1092
  select: o = !0,
1082
- domFocus: i = !0,
1083
- notify: u = !1
1093
+ domFocus: c = !0,
1094
+ notify: e = !1
1084
1095
  } = a;
1085
- o && Se(t, u), x(t), i && X(t);
1096
+ o && Ee(t, e), j(t), c && ee(t);
1086
1097
  },
1087
1098
  selectPath: (t) => {
1088
- t && (Se(t), x(t), X(t));
1099
+ t && (Ee(t), j(t), ee(t));
1089
1100
  },
1090
- getSelectedPath: () => k,
1091
- expandToPath: async (t) => await _e(t),
1092
- refresh: async (t) => await ae(t),
1093
- remapPath: ke,
1101
+ getSelectedPath: () => T,
1102
+ expandToPath: async (t) => await ge(t),
1103
+ refresh: async (t) => await ie(t),
1104
+ revealPath: async (t) => {
1105
+ const a = Ne(t);
1106
+ await ie(a), await ge(a), await ie(t), Z((o) => ({ ...o, [t]: !0 })), Ee(t, !1), j(t), setTimeout(() => ee(t), 0);
1107
+ },
1108
+ remapPath: Se,
1094
1109
  createFile: async (t) => {
1095
- f || await Ye(t, "file", "untitled.php");
1110
+ f || await qe(t, "file", "untitled.php");
1096
1111
  },
1097
1112
  createFolder: async (t) => {
1098
- f || await Ye(t, "folder", "New Folder");
1113
+ f || await qe(t, "folder", "New Folder");
1099
1114
  },
1100
1115
  importFiles: async (t, a) => {
1101
- f || await Ve(t, a);
1116
+ f || await vt(t, a);
1102
1117
  },
1103
1118
  importDataTransfer: async (t, a) => {
1104
- f || await Ke(t, a);
1119
+ f || await wt(t, a);
1105
1120
  }
1106
1121
  }),
1107
- [k, ae, ke, _e, f]
1122
+ [T, ie, Se, ge, f]
1108
1123
  );
1109
- const S = M(!1), ie = M(
1110
- d ?? null
1111
- ), le = M(d);
1112
- H(() => {
1113
- N.current = !1;
1114
- }, [v]), H(() => {
1115
- d && d !== le.current ? ie.current = d : d || (ie.current = null), le.current = d;
1116
- }, [d]), H(() => {
1117
- if (!d || S.current)
1124
+ const C = O(!1), y = O(
1125
+ h ?? null
1126
+ ), pe = O(h);
1127
+ W(() => {
1128
+ V.current = !1;
1129
+ }, [F]), W(() => {
1130
+ h && h !== pe.current ? y.current = h : h || (y.current = null), pe.current = h;
1131
+ }, [h]), W(() => {
1132
+ if (!h || C.current)
1118
1133
  return;
1119
- S.current = !0;
1120
- const t = Dt(d);
1121
- _((o) => {
1122
- const i = { ...o };
1123
- for (const u of t)
1124
- i[u] = !0;
1125
- return i;
1134
+ C.current = !0;
1135
+ const t = Lt(h);
1136
+ Z((o) => {
1137
+ const c = { ...o };
1138
+ for (const e of t)
1139
+ c[e] = !0;
1140
+ return c;
1126
1141
  });
1127
- const a = t[t.length - 1] || d;
1128
- x(a), Z(a), _e(d);
1129
- }, [d, _e]), H(() => {
1130
- const t = ie.current;
1131
- !t || de.length === 0 || (ie.current = null, _e(t));
1132
- }, [de, _e]), H(() => {
1133
- if (!j) {
1134
- if (de.length > 0) {
1135
- const t = ve(de[0]);
1136
- x(t);
1142
+ const a = t[t.length - 1] || h;
1143
+ j(a), m(a), ge(h);
1144
+ }, [h, ge]), W(() => {
1145
+ const t = y.current;
1146
+ !t || he.length === 0 || (y.current = null, ge(t));
1147
+ }, [he, ge]), W(() => {
1148
+ if (!N) {
1149
+ if (he.length > 0) {
1150
+ const t = ue(he[0]);
1151
+ j(t);
1137
1152
  }
1138
1153
  return;
1139
1154
  }
1140
- b && b === j || X(j);
1141
- }, [de, j, b]), H(() => {
1142
- if (de.length === 0)
1155
+ Ve && Ve === N || ee(N);
1156
+ }, [he, N, Ve]), W(() => {
1157
+ if (he.length === 0)
1143
1158
  return;
1144
- const t = de[0];
1145
- if ((t == null ? void 0 : t.type) !== "folder" || N.current)
1159
+ const t = he[0];
1160
+ if ((t == null ? void 0 : t.type) !== "folder" || V.current)
1146
1161
  return;
1147
1162
  const a = t.name;
1148
- N.current = !0, _(
1163
+ V.current = !0, Z(
1149
1164
  (o) => o[a] ? o : { ...o, [a]: !0 }
1150
- ), !re.current[a] && !G.current[a] && ne(a, t);
1151
- }, [de, ne, v]), H(() => () => {
1152
- O.current && clearTimeout(O.current), I();
1153
- }, []), H(() => {
1154
- U && setTimeout(() => {
1165
+ ), !ce.current[a] && !G.current[a] && we(a, t);
1166
+ }, [he, we, F]), W(() => () => {
1167
+ $.current && clearTimeout($.current), me();
1168
+ }, []), W(() => {
1169
+ H && setTimeout(() => {
1155
1170
  const t = document.querySelector(
1156
1171
  '[role="menu"] [role="menuitem"]'
1157
1172
  );
1158
1173
  t && typeof t.focus == "function" && t.focus();
1159
1174
  }, 0);
1160
- }, [U]);
1161
- const [ue, be] = te(""), $e = (t, a) => {
1175
+ }, [H]);
1176
+ const [de, le] = K(""), ke = (t, a) => {
1162
1177
  if (t.type === "folder")
1163
1178
  return a;
1164
- const o = Le(a);
1179
+ const o = Ne(a);
1165
1180
  return o && o || "/";
1166
- }, ge = (t, a, o) => {
1167
- const i = $e(t, a);
1168
- return i ? o && Xt(o, i) ? { allowed: !1, state: "invalid", destination: null } : { allowed: !0, state: "valid", destination: i } : { allowed: !1, state: "invalid", destination: null };
1181
+ }, Oe = (t, a, o) => {
1182
+ const c = ke(t, a);
1183
+ return c ? o && rr(o, c) ? { allowed: !1, state: "invalid", destination: null } : { allowed: !0, state: "valid", destination: c } : { allowed: !1, state: "invalid", destination: null };
1169
1184
  }, Ie = (t, a, o) => {
1170
- a.type !== "folder" && a.type !== "file" || (ce(o), g(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
1185
+ a.type !== "folder" && a.type !== "file" || (ae(o), d(null), t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData(
1171
1186
  "application/x-wp-playground-path",
1172
1187
  o
1173
1188
  ), t.dataTransfer.setData("text/plain", o)));
1174
- }, at = () => {
1175
- Fe();
1176
- }, Ge = (t, a, o) => {
1177
- const i = ge(a, o, J);
1178
- i.allowed && a.type === "folder" && Oe(o, a), g((u) => (u == null ? void 0 : u.path) === o && u.state === i.state ? u : { path: o, state: i.state });
1179
- }, ft = (t, a, o) => {
1180
- const i = ge(a, o, J);
1181
- i.allowed && i.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = J ? "move" : "copy"), a.type === "folder" && Oe(o, a), g((u) => (u == null ? void 0 : u.path) === o && u.state === i.state ? u : { path: o, state: i.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), ee(o), g((u) => (u == null ? void 0 : u.path) === o && u.state === "invalid" ? u : { path: o, state: "invalid" }));
1182
- }, dt = (t, a, o) => {
1183
- ee(o);
1184
- const i = t.relatedTarget;
1185
- i && t.currentTarget.contains(i) || g((u) => (u == null ? void 0 : u.path) === o ? null : u);
1186
- }, Et = async (t, a, o) => {
1187
- const i = J, u = ge(a, o, i);
1188
- if (!u.allowed || !u.destination) {
1189
- Fe();
1189
+ }, De = () => {
1190
+ g();
1191
+ }, Ze = (t, a, o) => {
1192
+ const c = Oe(a, o, X);
1193
+ c.allowed && a.type === "folder" && Ce(o, a), d((e) => (e == null ? void 0 : e.path) === o && e.state === c.state ? e : { path: o, state: c.state });
1194
+ }, at = (t, a, o) => {
1195
+ const c = Oe(a, o, X);
1196
+ c.allowed && c.destination ? (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = X ? "move" : "copy"), a.type === "folder" && Ce(o, a), d((e) => (e == null ? void 0 : e.path) === o && e.state === c.state ? e : { path: o, state: c.state })) : (t.dataTransfer && (t.dataTransfer.dropEffect = "none"), Y(o), d((e) => (e == null ? void 0 : e.path) === o && e.state === "invalid" ? e : { path: o, state: "invalid" }));
1197
+ }, Ct = (t, a, o) => {
1198
+ Y(o);
1199
+ const c = t.relatedTarget;
1200
+ c && t.currentTarget.contains(c) || d((e) => (e == null ? void 0 : e.path) === o ? null : e);
1201
+ }, Rt = async (t, a, o) => {
1202
+ const c = X, e = Oe(a, o, c);
1203
+ if (!e.allowed || !e.destination) {
1204
+ g();
1190
1205
  return;
1191
1206
  }
1192
- t.preventDefault(), t.stopPropagation(), ee(o), g(null);
1207
+ t.preventDefault(), t.stopPropagation(), Y(o), d(null);
1193
1208
  try {
1194
- i ? await bt(i, u.destination) : await Ke(
1209
+ c ? await pt(c, e.destination) : await wt(
1195
1210
  t.dataTransfer,
1196
- u.destination
1211
+ e.destination
1197
1212
  );
1198
1213
  } finally {
1199
- Fe();
1214
+ g();
1200
1215
  }
1201
- }, mt = (t, a, o) => {
1202
- c && (t.preventDefault(), t.stopPropagation(), pe(null), E({
1216
+ }, Pt = (t, a, o) => {
1217
+ s && (t.preventDefault(), t.stopPropagation(), ve(null), fe({
1203
1218
  absPath: o,
1204
1219
  type: a.type,
1205
1220
  x: t.clientX,
1206
1221
  y: t.clientY
1207
1222
  }));
1208
- }, We = async (t, a) => {
1209
- let o = a, i = 0;
1210
- const u = (y) => {
1211
- const oe = y.lastIndexOf(".");
1212
- return oe > 0 ? { stem: y.slice(0, oe), ext: y.slice(oe) } : { stem: y, ext: "" };
1213
- }, w = t === "/" ? "" : t;
1214
- for (; await (l == null ? void 0 : l.fileExists(`${w}/${o}`)) || await (l == null ? void 0 : l.isDir(`${w}/${o}`)); ) {
1215
- i += 1;
1216
- const { stem: y, ext: oe } = u(a);
1217
- o = `${y} (${i})${oe}`;
1223
+ }, Ke = async (t, a) => {
1224
+ let o = a, c = 0;
1225
+ const e = (l) => {
1226
+ const p = l.lastIndexOf(".");
1227
+ return p > 0 ? { stem: l.slice(0, p), ext: l.slice(p) } : { stem: l, ext: "" };
1228
+ }, n = t === "/" ? "" : t;
1229
+ for (; await (u == null ? void 0 : u.fileExists(`${n}/${o}`)) || await (u == null ? void 0 : u.isDir(`${n}/${o}`)); ) {
1230
+ c += 1;
1231
+ const { stem: l, ext: p } = e(a);
1232
+ o = `${l} (${c})${p}`;
1218
1233
  }
1219
1234
  return o;
1220
- }, Ye = async (t, a, o) => {
1221
- if (!l) return;
1222
- let i = t || k || v;
1235
+ }, qe = async (t, a, o) => {
1236
+ if (!u) return;
1237
+ let c = t || T || F;
1223
1238
  try {
1224
- await l.isDir(i) || (i = Le(i));
1239
+ await u.isDir(c) || (c = Ne(c));
1225
1240
  } catch {
1226
- i = Le(i);
1241
+ c = Ne(c);
1227
1242
  }
1228
- const u = i, w = await We(u, o), y = je(u, w);
1229
- a === "folder" ? await l.mkdir(y) : await l.writeFile(y, ""), we.current = { type: a, tempPath: y }, pe(y), await ae(u), setTimeout(() => {
1230
- x(y), X(y);
1243
+ const e = c, n = await Ke(e, o), l = Me(e, n);
1244
+ a === "folder" ? await u.mkdir(l) : await u.writeFile(l, ""), _e.current = { type: a, tempPath: l }, ve(l), await ie(e), setTimeout(() => {
1245
+ j(l), ee(l);
1231
1246
  }, 0);
1232
- }, yt = async (t) => {
1233
- if (!l) return !1;
1247
+ }, kt = async (t) => {
1248
+ if (!u) return !1;
1234
1249
  try {
1235
- if (await l.fileExists(t))
1250
+ if (await u.fileExists(t))
1236
1251
  return !0;
1237
1252
  } catch {
1238
1253
  }
1239
1254
  try {
1240
- if (await l.isDir(t))
1255
+ if (await u.isDir(t))
1241
1256
  return !0;
1242
1257
  } catch {
1243
1258
  }
1244
1259
  return !1;
1245
- }, _t = async (t) => {
1246
- if (l)
1260
+ }, ot = async (t) => {
1261
+ if (u)
1247
1262
  try {
1248
- await l.mkdir(t);
1263
+ await u.mkdir(t);
1249
1264
  } catch (a) {
1250
- if (!await l.isDir(t).catch(() => !1))
1265
+ if (!await u.isDir(t).catch(() => !1))
1251
1266
  throw a;
1252
1267
  }
1253
- }, bt = async (t, a) => {
1254
- if (!l) return;
1255
- const o = et(t), i = je(a, o);
1256
- if (i === t || await yt(i))
1268
+ }, pt = async (t, a) => {
1269
+ if (!u) return;
1270
+ const o = tt(t), c = Me(a, o);
1271
+ if (c === t || await kt(c))
1257
1272
  return;
1258
- const u = Le(t);
1273
+ const e = Ne(t);
1259
1274
  try {
1260
- await l.mv(t, i), ke(t, i);
1261
- const w = ze(
1262
- k,
1275
+ await u.mv(t, c), Se(t, c);
1276
+ const n = Ge(
1277
+ T,
1263
1278
  t,
1264
- i
1279
+ c
1265
1280
  );
1266
- k && (k === t || k.startsWith(`${t}/`)) && P(w), x(
1267
- (y) => ze(y, t, i)
1268
- ), _((y) => ({
1269
- ...y,
1281
+ T && (T === t || T.startsWith(`${t}/`)) && x(n), j(
1282
+ (l) => Ge(l, t, c)
1283
+ ), Z((l) => ({
1284
+ ...l,
1270
1285
  [a]: !0
1271
1286
  })), await Promise.all([
1272
- ae(u),
1273
- ae(a)
1274
- ]), Z(
1275
- (y) => ze(y, t, i)
1276
- ), X(i);
1287
+ ie(e),
1288
+ ie(a)
1289
+ ]), m(
1290
+ (l) => Ge(l, t, c)
1291
+ ), ee(c);
1277
1292
  } catch {
1278
1293
  }
1279
- }, xt = (t) => {
1294
+ }, $e = (t) => {
1280
1295
  const a = t;
1281
1296
  return a.webkitGetAsEntry ? a.webkitGetAsEntry() : null;
1282
- }, Ct = (t) => new Promise((a, o) => {
1297
+ }, it = (t) => new Promise((a, o) => {
1283
1298
  t.file(a, o);
1284
- }), pt = async (t, a) => {
1285
- if (!l) return;
1286
- const o = t.name || "untitled", i = await We(a, o), u = je(a, i), w = new Uint8Array(await t.arrayBuffer());
1287
- await l.writeFile(u, w);
1288
- }, Ze = async (t, a) => {
1289
- const o = await Ct(t);
1290
- await pt(o, a);
1291
- }, ot = async (t, a) => {
1292
- const o = await We(
1299
+ }), Je = async (t, a) => {
1300
+ if (!u) return;
1301
+ const o = t.name || "untitled", c = await Ke(a, o), e = Me(a, c), n = new Uint8Array(await t.arrayBuffer());
1302
+ await u.writeFile(e, n);
1303
+ }, lt = async (t, a) => {
1304
+ const o = await it(t);
1305
+ await Je(o, a);
1306
+ }, ht = async (t, a) => {
1307
+ const o = await Ke(
1293
1308
  a,
1294
1309
  t.name || "New Folder"
1295
- ), i = je(a, o);
1296
- await _t(i);
1297
- const u = t.createReader(), w = () => new Promise((y, oe) => {
1298
- u.readEntries(
1299
- (xe) => y(Array.from(xe)),
1300
- oe
1310
+ ), c = Me(a, o);
1311
+ await ot(c);
1312
+ const e = t.createReader(), n = () => new Promise((l, p) => {
1313
+ e.readEntries(
1314
+ (S) => l(Array.from(S)),
1315
+ p
1301
1316
  );
1302
1317
  });
1303
1318
  for (; ; ) {
1304
- const y = await w();
1305
- if (!y.length)
1319
+ const l = await n();
1320
+ if (!l.length)
1306
1321
  break;
1307
- for (const oe of y)
1308
- oe.isFile ? await Ze(
1309
- oe,
1310
- i
1311
- ) : oe.isDirectory && await ot(
1312
- oe,
1313
- i
1322
+ for (const p of l)
1323
+ p.isFile ? await lt(
1324
+ p,
1325
+ c
1326
+ ) : p.isDirectory && await ht(
1327
+ p,
1328
+ c
1314
1329
  );
1315
1330
  }
1316
- }, Ve = (t, a) => qe([], t, a), Ke = (t, a) => {
1317
- const i = Array.from(t.items).filter((w) => w.kind === "file").map((w) => xt(w)).filter((w) => !!w), u = Array.from(t.files);
1318
- return qe(i, u, a);
1319
- }, qe = async (t, a, o) => {
1320
- if (l) {
1331
+ }, vt = (t, a) => st([], t, a), wt = (t, a) => {
1332
+ const c = Array.from(t.items).filter((n) => n.kind === "file").map((n) => $e(n)).filter((n) => !!n), e = Array.from(t.files);
1333
+ return st(c, e, a);
1334
+ }, st = async (t, a, o) => {
1335
+ if (u) {
1321
1336
  if (t.length > 0)
1322
- for (const i of t)
1323
- i.isFile ? await Ze(
1324
- i,
1337
+ for (const c of t)
1338
+ c.isFile ? await lt(
1339
+ c,
1325
1340
  o
1326
- ) : i.isDirectory && await ot(
1327
- i,
1341
+ ) : c.isDirectory && await ht(
1342
+ c,
1328
1343
  o
1329
1344
  );
1330
1345
  else
1331
- for (const i of a)
1332
- await pt(i, o);
1333
- await ae(o), _((i) => ({
1334
- ...i,
1346
+ for (const c of a)
1347
+ await Je(c, o);
1348
+ await ie(o), Z((c) => ({
1349
+ ...c,
1335
1350
  [o]: !0
1336
1351
  }));
1337
1352
  }
1338
- }, ht = async (t, a) => {
1339
- if (!l) return;
1353
+ }, gt = async (t, a) => {
1354
+ if (!u) return;
1340
1355
  const o = t;
1341
- E(null);
1356
+ fe(null);
1342
1357
  try {
1343
- a === "folder" ? await l.rmdir(o, { recursive: !0 }) : await l.unlink(o);
1358
+ a === "folder" ? await u.rmdir(o, { recursive: !0 }) : await u.unlink(o);
1344
1359
  } catch {
1345
1360
  } finally {
1346
- pe(null);
1347
- const i = Le(o);
1348
- await ae(i), k && (k === o || k.startsWith(`${o}/`)) && P(null);
1361
+ ve(null);
1362
+ const c = Ne(o);
1363
+ await ie(c), T && (T === o || T.startsWith(`${o}/`)) && x(null);
1349
1364
  }
1350
- }, Rt = async (t) => {
1351
- if (l)
1365
+ }, Tt = async (t) => {
1366
+ if (u)
1352
1367
  try {
1353
- const o = await (await l.read(t)).arrayBuffer(), i = new Blob([o]), u = URL.createObjectURL(i), w = document.createElement("a");
1354
- w.href = u, w.download = et(t) || "download", document.body.appendChild(w), w.click(), document.body.removeChild(w), setTimeout(() => URL.revokeObjectURL(u), 6e4);
1368
+ const o = await (await u.read(t)).arrayBuffer(), c = new Blob([o]), e = URL.createObjectURL(c), n = document.createElement("a");
1369
+ n.href = e, n.download = tt(t) || "download", document.body.appendChild(n), n.click(), document.body.removeChild(n), setTimeout(() => URL.revokeObjectURL(e), 6e4);
1355
1370
  } catch (a) {
1356
1371
  console.error("Failed to download file", a);
1357
1372
  }
1358
- }, vt = (t) => {
1373
+ }, St = (t) => {
1359
1374
  var a;
1360
- if (!he)
1375
+ if (!We)
1361
1376
  if (t.key.length === 1 && t.key.match(/\S/)) {
1362
- const o = ue + t.key.toLowerCase();
1363
- if (be(o), O.current && clearTimeout(O.current), O.current = setTimeout(() => {
1364
- be("");
1365
- }, 1e3), !h.current)
1377
+ const o = de + t.key.toLowerCase();
1378
+ if (le(o), $.current && clearTimeout($.current), $.current = setTimeout(() => {
1379
+ le("");
1380
+ }, 1e3), !z.current)
1366
1381
  return;
1367
- const i = Array.from(
1368
- h.current.querySelectorAll(".file-node-button")
1369
- ), u = document.activeElement;
1370
- let w = 0;
1371
- u && i.includes(u) && (w = i.indexOf(
1372
- u
1382
+ const c = Array.from(
1383
+ z.current.querySelectorAll(".file-node-button")
1384
+ ), e = document.activeElement;
1385
+ let n = 0;
1386
+ e && c.includes(e) && (n = c.indexOf(
1387
+ e
1373
1388
  ));
1374
- for (let y = 0; y < i.length; y++) {
1375
- const oe = (w + y) % i.length, xe = i[oe];
1376
- if ((a = xe.textContent) != null && a.toLowerCase().trim().startsWith(o)) {
1377
- xe.focus();
1378
- const e = xe.getAttribute("data-path");
1379
- e && x(e);
1389
+ for (let l = 0; l < c.length; l++) {
1390
+ const p = (n + l) % c.length, S = c[p];
1391
+ if ((a = S.textContent) != null && a.toLowerCase().trim().startsWith(o)) {
1392
+ S.focus();
1393
+ const I = S.getAttribute("data-path");
1394
+ I && j(I);
1380
1395
  break;
1381
1396
  }
1382
1397
  }
1383
1398
  } else
1384
- be(""), O.current && clearTimeout(O.current);
1385
- }, kt = async (t, a) => {
1399
+ le(""), $.current && clearTimeout($.current);
1400
+ }, Et = async (t, a) => {
1386
1401
  if (f) return;
1387
- const o = we.current, i = (o == null ? void 0 : o.tempPath) === t, u = Le(t);
1388
- if (!a || a === "." || a === ".." || et(a) !== a) {
1389
- if (i) {
1402
+ const o = _e.current, c = (o == null ? void 0 : o.tempPath) === t, e = Ne(t);
1403
+ if (!a || a === "." || a === ".." || tt(a) !== a) {
1404
+ if (c) {
1390
1405
  try {
1391
- o.type === "folder" ? await l.rmdir(t, {
1406
+ o.type === "folder" ? await u.rmdir(t, {
1392
1407
  recursive: !0
1393
- }) : await l.unlink(t);
1408
+ }) : await u.unlink(t);
1394
1409
  } catch {
1395
1410
  }
1396
- we.current = null;
1411
+ _e.current = null;
1397
1412
  }
1398
- pe(i ? null : t);
1413
+ ve(c ? null : t);
1399
1414
  return;
1400
1415
  }
1401
- let w = je(u, a), y = w;
1402
- if (y === t) {
1403
- pe(null);
1404
- const s = i && (o == null ? void 0 : o.type) === "file";
1405
- i && (we.current = null), setTimeout(() => {
1406
- x(y), X(y), s && A && A(y);
1416
+ let n = Me(e, a), l = n;
1417
+ if (l === t) {
1418
+ ve(null);
1419
+ const A = c && (o == null ? void 0 : o.type) === "file";
1420
+ c && (_e.current = null), setTimeout(() => {
1421
+ j(l), ee(l), A && E && E(l);
1407
1422
  }, 0);
1408
1423
  return;
1409
1424
  }
1410
- const oe = await l.fileExists(y), xe = await l.isDir(y);
1411
- if ((oe || xe) && y !== t)
1412
- if (i)
1425
+ const p = await u.fileExists(l), S = await u.isDir(l);
1426
+ if ((p || S) && l !== t)
1427
+ if (c)
1413
1428
  try {
1414
- const s = await We(
1415
- u === "/" ? "/" : u,
1429
+ const A = await Ke(
1430
+ e === "/" ? "/" : e,
1416
1431
  a
1417
1432
  );
1418
- w = je(u, s), y = w;
1433
+ n = Me(e, A), l = n;
1419
1434
  } catch {
1420
1435
  }
1421
1436
  else {
1422
- pe(t);
1437
+ ve(t);
1423
1438
  return;
1424
1439
  }
1425
- let e = (o == null ? void 0 : o.type) === "folder";
1440
+ let I = (o == null ? void 0 : o.type) === "folder";
1426
1441
  try {
1427
- await l.mv(t, w), o || (e = await l.isDir(w)), e && ke(t, y), k === t && P(y), await ae(u), x(y), X(y), i && !e && A && A(y);
1442
+ if (await u.mv(t, n), o || (I = await u.isDir(n)), I && (Se(t, l), !c))
1443
+ try {
1444
+ await (D == null ? void 0 : D(t, l));
1445
+ } catch (A) {
1446
+ Ye.error(
1447
+ "Failed to update metadata after renaming a path",
1448
+ A
1449
+ );
1450
+ }
1451
+ T === t && x(l), await ie(e), j(l), ee(l), c && !I && E && E(l);
1428
1452
  } catch {
1429
- if (i)
1453
+ if (c)
1430
1454
  try {
1431
- (o == null ? void 0 : o.type) === "folder" ? await l.rmdir(t, {
1455
+ (o == null ? void 0 : o.type) === "folder" ? await u.rmdir(t, {
1432
1456
  recursive: !0
1433
- }) : await l.unlink(t);
1457
+ }) : await u.unlink(t);
1434
1458
  } catch {
1435
1459
  }
1436
1460
  } finally {
1437
- we.current = null, pe(null);
1461
+ _e.current = null, ve(null);
1438
1462
  }
1439
- }, wt = async (t) => {
1440
- const a = we.current;
1441
- if (!l || (a == null ? void 0 : a.tempPath) !== t) {
1442
- pe((i) => i === t ? null : i);
1463
+ }, _t = async (t) => {
1464
+ const a = _e.current;
1465
+ if (!u || (a == null ? void 0 : a.tempPath) !== t) {
1466
+ ve((c) => c === t ? null : c);
1443
1467
  return;
1444
1468
  }
1445
1469
  try {
1446
- a.type === "folder" ? await l.rmdir(t, { recursive: !0 }) : await l.unlink(t);
1470
+ a.type === "folder" ? await u.rmdir(t, { recursive: !0 }) : await u.unlink(t);
1447
1471
  } catch {
1448
1472
  }
1449
- we.current = null, pe(null);
1450
- const o = Le(t);
1451
- await ae(o), x(o), X(o);
1473
+ _e.current = null, ve(null);
1474
+ const o = Ne(t);
1475
+ await ie(o), j(o), ee(o);
1452
1476
  };
1453
- return /* @__PURE__ */ r.createElement("div", { onKeyDown: vt, ref: h }, /* @__PURE__ */ r.createElement(er, { className: Re.filePickerTree }, de.map((t, a) => /* @__PURE__ */ r.createElement(
1454
- zt,
1477
+ return /* @__PURE__ */ r.createElement("div", { onKeyDown: St, ref: z }, /* @__PURE__ */ r.createElement(ar, { className: ye.filePickerTree }, he.map((t, a) => /* @__PURE__ */ r.createElement(
1478
+ Kt,
1455
1479
  {
1456
1480
  key: t.name,
1457
1481
  node: t,
1458
1482
  level: 0,
1459
1483
  position: a + 1,
1460
- setSize: de.length,
1461
- expandedNodePaths: D,
1462
- onToggle: Me,
1463
- selectedNode: k,
1464
- focusPath: (o) => x(o),
1465
- focusedNode: j,
1466
- selectPath: Se,
1467
- generatePath: ve,
1468
- getChildren: me,
1469
- onContextMenu: f ? void 0 : mt,
1470
- renamingPath: b,
1471
- onRename: kt,
1472
- onRenameCancel: wt,
1473
- dropIndicator: Q,
1484
+ setSize: he.length,
1485
+ expandedNodePaths: w,
1486
+ onToggle: Be,
1487
+ selectedNode: T,
1488
+ focusPath: (o) => j(o),
1489
+ focusedNode: N,
1490
+ selectPath: Ee,
1491
+ generatePath: ue,
1492
+ getChildren: Pe,
1493
+ onContextMenu: f ? void 0 : Pt,
1494
+ renamingPath: Ve,
1495
+ onRename: Et,
1496
+ onRenameCancel: _t,
1497
+ dropIndicator: _,
1474
1498
  onDragStart: f ? void 0 : Ie,
1475
- onDragEnd: f ? void 0 : at,
1476
- onDragEnter: f ? void 0 : Ge,
1477
- onDragOver: f ? void 0 : ft,
1478
- onDragLeave: f ? void 0 : dt,
1479
- onDrop: f ? void 0 : Et,
1480
- rootPath: v,
1481
- onDoubleClickFile: A
1482
- }
1483
- ))), !f && U && /* @__PURE__ */ r.createElement(
1484
- tr,
1499
+ onDragEnd: f ? void 0 : De,
1500
+ onDragEnter: f ? void 0 : Ze,
1501
+ onDragOver: f ? void 0 : at,
1502
+ onDragLeave: f ? void 0 : Ct,
1503
+ onDrop: f ? void 0 : Rt,
1504
+ rootPath: F,
1505
+ onDoubleClickFile: E,
1506
+ pathBadges: R
1507
+ }
1508
+ ))), !f && H && /* @__PURE__ */ r.createElement(
1509
+ or,
1485
1510
  {
1486
1511
  placement: "bottom-start",
1487
- onClose: () => E(null),
1512
+ onClose: () => fe(null),
1488
1513
  anchor: {
1489
1514
  getBoundingClientRect: () => ({
1490
- x: U.x,
1491
- y: U.y,
1515
+ x: H.x,
1516
+ y: H.y,
1492
1517
  width: 0,
1493
1518
  height: 0,
1494
- top: U.y,
1495
- left: U.x,
1496
- right: U.x,
1497
- bottom: U.y,
1519
+ top: H.y,
1520
+ left: H.x,
1521
+ right: H.x,
1522
+ bottom: H.y,
1498
1523
  toJSON: () => ({})
1499
1524
  }),
1500
1525
  ownerDocument: document
@@ -1503,950 +1528,1036 @@ const nn = $t(function({
1503
1528
  resize: !1,
1504
1529
  focusOnMount: "firstElement"
1505
1530
  },
1506
- /* @__PURE__ */ r.createElement(rr, { role: "menu" }, U.type === "folder" && /* @__PURE__ */ r.createElement(
1507
- it,
1531
+ /* @__PURE__ */ r.createElement(ir, { role: "menu" }, H.type === "folder" && /* @__PURE__ */ r.createElement(
1532
+ Qe,
1508
1533
  {
1509
1534
  role: "menuitem",
1510
1535
  onClick: async () => {
1511
- E(null), await Ye(
1512
- U.absPath,
1536
+ fe(null), await qe(
1537
+ H.absPath,
1513
1538
  "file",
1514
1539
  "untitled.php"
1515
1540
  );
1516
1541
  }
1517
1542
  },
1518
1543
  "Create file"
1519
- ), U.type === "folder" && /* @__PURE__ */ r.createElement(
1520
- it,
1544
+ ), H.type === "folder" && /* @__PURE__ */ r.createElement(
1545
+ Qe,
1521
1546
  {
1522
1547
  role: "menuitem",
1523
1548
  onClick: async () => {
1524
- E(null), await Ye(
1525
- U.absPath,
1549
+ fe(null), await qe(
1550
+ H.absPath,
1526
1551
  "folder",
1527
1552
  "New Folder"
1528
1553
  );
1529
1554
  }
1530
1555
  },
1531
1556
  "Create directory"
1557
+ ), b && H.type === "folder" && (H.absPath === Q || H.absPath === J) && /* @__PURE__ */ r.createElement(
1558
+ Qe,
1559
+ {
1560
+ role: "menuitem",
1561
+ onClick: () => {
1562
+ fe(null), b(
1563
+ H.absPath === Q ? "plugin" : "theme",
1564
+ H.absPath
1565
+ );
1566
+ }
1567
+ },
1568
+ "Mount via git…"
1532
1569
  ), /* @__PURE__ */ r.createElement(
1533
- it,
1570
+ Qe,
1534
1571
  {
1535
1572
  role: "menuitem",
1536
1573
  onClick: () => {
1537
- E(null), pe(U.absPath);
1574
+ fe(null), ve(H.absPath);
1538
1575
  }
1539
1576
  },
1540
1577
  "Rename"
1541
- ), U.type === "file" && /* @__PURE__ */ r.createElement(
1542
- it,
1578
+ ), H.type === "file" && /* @__PURE__ */ r.createElement(
1579
+ Qe,
1543
1580
  {
1544
1581
  role: "menuitem",
1545
1582
  onClick: async () => {
1546
- E(null), await Rt(
1547
- U.absPath
1583
+ fe(null), await Tt(
1584
+ H.absPath
1548
1585
  );
1549
1586
  }
1550
1587
  },
1551
1588
  "Download"
1552
1589
  ), /* @__PURE__ */ r.createElement(
1553
- it,
1590
+ Qe,
1554
1591
  {
1555
1592
  role: "menuitem",
1556
- onClick: () => ht(
1557
- U.absPath,
1558
- U.type
1593
+ onClick: () => gt(
1594
+ H.absPath,
1595
+ H.type
1559
1596
  )
1560
1597
  },
1561
1598
  "Delete"
1562
1599
  ))
1563
1600
  ));
1564
- }), zt = ({
1565
- node: n,
1566
- level: c,
1601
+ }), Kt = ({
1602
+ node: i,
1603
+ level: s,
1567
1604
  position: f,
1568
- setSize: l,
1569
- expandedNodePaths: R,
1570
- onToggle: d,
1571
- selectedNode: P,
1572
- focusPath: A,
1573
- focusedNode: T,
1574
- selectPath: v,
1605
+ setSize: u,
1606
+ expandedNodePaths: v,
1607
+ onToggle: h,
1608
+ selectedNode: x,
1609
+ focusPath: E,
1610
+ focusedNode: R,
1611
+ selectPath: b,
1575
1612
  generatePath: D,
1576
- getChildren: _,
1577
- onContextMenu: k,
1578
- renamingPath: Z,
1579
- onRename: j,
1580
- onRenameCancel: x,
1581
- parentPath: K = "",
1582
- dropIndicator: W,
1613
+ getChildren: k,
1614
+ onContextMenu: F,
1615
+ renamingPath: Q,
1616
+ onRename: J,
1617
+ onRenameCancel: w,
1618
+ parentPath: Z = "",
1619
+ dropIndicator: T,
1583
1620
  onDragStart: m,
1584
- onDragEnd: V,
1585
- onDragEnter: J,
1586
- onDragOver: ce,
1587
- onDragLeave: Q,
1588
- onDrop: g,
1589
- rootPath: $,
1590
- onDoubleClickFile: N
1621
+ onDragEnd: N,
1622
+ onDragEnter: j,
1623
+ onDragOver: L,
1624
+ onDragLeave: U,
1625
+ onDrop: re,
1626
+ rootPath: ne,
1627
+ onDoubleClickFile: X,
1628
+ pathBadges: ae
1591
1629
  }) => {
1592
- const h = D(n, K), O = R[h], G = Z === h, re = M(null), [I, ee] = te(n.name), X = M(!1), ve = (W == null ? void 0 : W.path) === h, me = ve && (W == null ? void 0 : W.state) === "valid", Ne = ve && (W == null ? void 0 : W.state) === "invalid", Pe = !!m && !G && h !== $, ne = M(null), Oe = {
1593
- onDragEnter: (E) => J == null ? void 0 : J(E, n, h),
1594
- onDragOver: (E) => ce == null ? void 0 : ce(E, n, h),
1595
- onDragLeave: (E) => Q == null ? void 0 : Q(E, n, h),
1596
- onDrop: (E) => g == null ? void 0 : g(E, n, h)
1597
- }, ae = _(n, h) ?? [];
1598
- H(() => {
1599
- var E;
1600
- G ? (ee(n.name), X.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
1601
- var he;
1602
- (he = re.current) == null || he.select();
1603
- }) : (E = re.current) == null || E.select()) : X.current = !1;
1604
- }, [G, n.name]);
1605
- const Me = () => {
1606
- n.type === "folder" && d(h, n, !O);
1607
- }, _e = (E) => {
1608
- var he, pe;
1609
- if (E.key === "ArrowLeft")
1610
- O ? Me() : (he = document.querySelector(
1611
- `[data-path="${CSS.escape(K)}"]`
1612
- )) == null || he.focus(), E.preventDefault(), E.stopPropagation();
1613
- else if (E.key === "ArrowRight") {
1614
- if (O) {
1615
- if (ae != null && ae.length) {
1616
- const we = D(
1617
- ae[0],
1618
- h
1630
+ const _ = D(i, Z), d = v[_], P = Q === _, V = O(null), [z, $] = K(i.name), G = O(!1), ce = (T == null ? void 0 : T.path) === _, me = ce && (T == null ? void 0 : T.state) === "valid", Y = ce && (T == null ? void 0 : T.state) === "invalid", ee = !!m && !P && _ !== ne, ue = O(null), Pe = {
1631
+ onDragEnter: (g) => j == null ? void 0 : j(g, i, _),
1632
+ onDragOver: (g) => L == null ? void 0 : L(g, i, _),
1633
+ onDragLeave: (g) => U == null ? void 0 : U(g, i, _),
1634
+ onDrop: (g) => re == null ? void 0 : re(g, i, _)
1635
+ }, oe = k(i, _) ?? [];
1636
+ W(() => {
1637
+ var g;
1638
+ P ? ($(i.name), G.current = !1, typeof window < "u" && requestAnimationFrame ? requestAnimationFrame(() => {
1639
+ var Ee;
1640
+ (Ee = V.current) == null || Ee.select();
1641
+ }) : (g = V.current) == null || g.select()) : G.current = !1;
1642
+ }, [P, i.name]);
1643
+ const Te = () => {
1644
+ i.type === "folder" && h(_, i, !d);
1645
+ }, we = (g) => {
1646
+ var Ee, he;
1647
+ if (g.key === "ArrowLeft")
1648
+ d ? Te() : (Ee = document.querySelector(
1649
+ `[data-path="${CSS.escape(Z)}"]`
1650
+ )) == null || Ee.focus(), g.preventDefault(), g.stopPropagation();
1651
+ else if (g.key === "ArrowRight") {
1652
+ if (d) {
1653
+ if (oe != null && oe.length) {
1654
+ const H = D(
1655
+ oe[0],
1656
+ _
1619
1657
  );
1620
- (pe = document.querySelector(
1621
- `[data-path="${CSS.escape(we)}"]`
1622
- )) == null || pe.focus();
1658
+ (he = document.querySelector(
1659
+ `[data-path="${CSS.escape(H)}"]`
1660
+ )) == null || he.focus();
1623
1661
  }
1624
1662
  } else
1625
- Me();
1626
- E.preventDefault(), E.stopPropagation();
1627
- } else E.key === " " || E.key === "Space" || E.key === "Spacebar" ? (n.type === "folder" && d(h, n, !O), E.preventDefault()) : E.key === "Enter" && (n.type === "folder" ? d(h, n, !O) : (v(h, !1), A(h), N ? N(h) : v(h, !0)), E.preventDefault());
1628
- }, ke = (E) => {
1629
- k == null || k(E, n, h);
1630
- }, Fe = (E) => {
1631
- E.preventDefault(), X.current = !0, j == null || j(h, I);
1632
- }, Se = (E) => {
1633
- if (E.key === "Escape") {
1634
- E.preventDefault(), E.stopPropagation(), X.current = !0, x == null || x(h);
1663
+ Te();
1664
+ g.preventDefault(), g.stopPropagation();
1665
+ } else g.key === " " || g.key === "Space" || g.key === "Spacebar" ? (i.type === "folder" && h(_, i, !d), g.preventDefault()) : g.key === "Enter" && (i.type === "folder" ? h(_, i, !d) : (b(_, !1), E(_), X ? X(_) : b(_, !0)), g.preventDefault());
1666
+ }, Ce = (g) => {
1667
+ F == null || F(g, i, _);
1668
+ }, ie = (g) => {
1669
+ g.preventDefault(), G.current = !0, J == null || J(_, z);
1670
+ }, Be = (g) => {
1671
+ if (g.key === "Escape") {
1672
+ g.preventDefault(), g.stopPropagation(), G.current = !0, w == null || w(_);
1635
1673
  return;
1636
1674
  }
1637
- (E.key === "ArrowLeft" || E.key === "ArrowRight" || E.key === "ArrowUp" || E.key === "ArrowDown") && E.stopPropagation();
1638
- }, de = () => {
1639
- X.current || x == null || x(h), X.current = !1;
1640
- }, U = () => {
1641
- if (n.type === "folder") {
1642
- Me(), v(h), A(h);
1675
+ (g.key === "ArrowLeft" || g.key === "ArrowRight" || g.key === "ArrowUp" || g.key === "ArrowDown") && g.stopPropagation();
1676
+ }, ge = () => {
1677
+ G.current || w == null || w(_), G.current = !1;
1678
+ }, Se = () => {
1679
+ if (i.type === "folder") {
1680
+ Te(), b(_), E(_);
1643
1681
  return;
1644
1682
  }
1645
- const E = ne.current !== null;
1646
- if (E && ne.current && clearTimeout(ne.current), ne.current = null, E) {
1647
- N ? N(h) : v(h, !0);
1683
+ const g = ue.current !== null;
1684
+ if (g && ue.current && clearTimeout(ue.current), ue.current = null, g) {
1685
+ X ? X(_) : b(_, !0);
1648
1686
  return;
1649
1687
  }
1650
- v(h, !1), A(h), v(h, !0), ne.current = window.setTimeout(() => {
1651
- ne.current = null;
1688
+ b(_, !1), E(_), b(_, !0), ue.current = window.setTimeout(() => {
1689
+ ue.current = null;
1652
1690
  }, 300);
1653
1691
  };
1654
- return H(() => () => {
1655
- ne.current !== null && typeof window < "u" && clearTimeout(ne.current);
1692
+ return W(() => () => {
1693
+ ue.current !== null && typeof window < "u" && clearTimeout(ue.current);
1656
1694
  }, []), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1657
- nr,
1695
+ lr,
1658
1696
  {
1659
- level: c,
1697
+ level: s,
1660
1698
  positionInSet: f,
1661
- setSize: l
1699
+ setSize: u
1662
1700
  },
1663
- /* @__PURE__ */ r.createElement(ar, null, () => /* @__PURE__ */ r.createElement(r.Fragment, null, G ? /* @__PURE__ */ r.createElement(
1701
+ /* @__PURE__ */ r.createElement(sr, null, () => /* @__PURE__ */ r.createElement(r.Fragment, null, P ? /* @__PURE__ */ r.createElement(
1664
1702
  "form",
1665
1703
  {
1666
- onSubmit: Fe,
1667
- className: De(
1668
- Re.fileNodeButton,
1669
- Re.renaming,
1704
+ onSubmit: ie,
1705
+ className: Fe(
1706
+ ye.fileNodeButton,
1707
+ ye.renaming,
1670
1708
  "file-node-button",
1671
1709
  {
1672
- [Re.selected]: P === h,
1673
- [Re.focused]: T === h,
1674
- [Re.dropTarget]: me,
1675
- [Re.dropTargetInvalid]: Ne
1710
+ [ye.selected]: x === _,
1711
+ [ye.focused]: R === _,
1712
+ [ye.dropTarget]: me,
1713
+ [ye.dropTargetInvalid]: Y
1676
1714
  }
1677
1715
  ),
1678
- "data-path": h,
1679
- onContextMenu: ke,
1680
- ...Oe
1716
+ "data-path": _,
1717
+ onContextMenu: Ce,
1718
+ ...Pe
1681
1719
  },
1682
1720
  /* @__PURE__ */ r.createElement(
1683
- jt,
1721
+ Ht,
1684
1722
  {
1685
- node: n,
1686
- isOpen: n.type === "folder" && O,
1687
- level: c,
1688
- hideName: !0
1723
+ node: i,
1724
+ isOpen: i.type === "folder" && d,
1725
+ level: s,
1726
+ hideName: !0,
1727
+ badge: ae == null ? void 0 : ae[_]
1689
1728
  }
1690
1729
  ),
1691
1730
  /* @__PURE__ */ r.createElement(
1692
1731
  "input",
1693
1732
  {
1694
- ref: re,
1695
- className: Re.renameInput,
1696
- value: I,
1697
- onChange: (E) => ee(E.target.value),
1698
- onBlur: de,
1699
- onFocus: () => A(h),
1700
- onKeyDown: Se
1733
+ ref: V,
1734
+ className: ye.renameInput,
1735
+ value: z,
1736
+ onChange: (g) => $(g.target.value),
1737
+ onBlur: ge,
1738
+ onFocus: () => E(_),
1739
+ onKeyDown: Be
1701
1740
  }
1702
1741
  )
1703
1742
  ) : /* @__PURE__ */ r.createElement(
1704
- tt,
1743
+ He,
1705
1744
  {
1706
- ...Oe,
1707
- draggable: Pe,
1708
- onDragStart: (E) => m == null ? void 0 : m(E, n, h),
1709
- onDragEnd: (E) => V == null ? void 0 : V(E, n, h),
1710
- onClick: U,
1711
- onKeyDown: _e,
1745
+ ...Pe,
1746
+ draggable: ee,
1747
+ onDragStart: (g) => m == null ? void 0 : m(g, i, _),
1748
+ onDragEnd: (g) => N == null ? void 0 : N(g, i, _),
1749
+ onClick: Se,
1750
+ onKeyDown: we,
1712
1751
  onFocus: () => {
1713
- A(h);
1752
+ E(_);
1714
1753
  },
1715
- onContextMenu: ke,
1716
- className: De(
1717
- Re.fileNodeButton,
1754
+ onContextMenu: Ce,
1755
+ className: Fe(
1756
+ ye.fileNodeButton,
1718
1757
  "file-node-button",
1719
1758
  {
1720
- [Re.selected]: P === h,
1721
- [Re.focused]: T === h,
1722
- [Re.dropTarget]: me,
1723
- [Re.dropTargetInvalid]: Ne
1759
+ [ye.selected]: x === _,
1760
+ [ye.focused]: R === _,
1761
+ [ye.dropTarget]: me,
1762
+ [ye.dropTargetInvalid]: Y
1724
1763
  }
1725
1764
  ),
1726
- "data-path": h,
1727
- "data-expanded": O ? "true" : "false"
1765
+ "data-path": _,
1766
+ "data-expanded": d ? "true" : "false"
1728
1767
  },
1729
1768
  /* @__PURE__ */ r.createElement(
1730
- jt,
1769
+ Ht,
1731
1770
  {
1732
- node: n,
1733
- isOpen: n.type === "folder" && O,
1734
- level: c
1771
+ node: i,
1772
+ isOpen: i.type === "folder" && d,
1773
+ level: s,
1774
+ badge: ae == null ? void 0 : ae[_]
1735
1775
  }
1736
1776
  )
1737
1777
  )))
1738
- ), O && ae && ae.map((E, he) => /* @__PURE__ */ r.createElement(
1739
- zt,
1778
+ ), d && oe && oe.map((g, Ee) => /* @__PURE__ */ r.createElement(
1779
+ Kt,
1740
1780
  {
1741
- key: E.name,
1742
- node: E,
1743
- level: c + 1,
1744
- position: he + 1,
1745
- setSize: ae.length,
1746
- expandedNodePaths: R,
1747
- onToggle: d,
1748
- selectedNode: P,
1749
- focusPath: A,
1750
- focusedNode: T,
1751
- selectPath: v,
1781
+ key: g.name,
1782
+ node: g,
1783
+ level: s + 1,
1784
+ position: Ee + 1,
1785
+ setSize: oe.length,
1786
+ expandedNodePaths: v,
1787
+ onToggle: h,
1788
+ selectedNode: x,
1789
+ focusPath: E,
1790
+ focusedNode: R,
1791
+ selectPath: b,
1752
1792
  generatePath: D,
1753
- getChildren: _,
1754
- onContextMenu: k,
1755
- renamingPath: Z,
1756
- onRename: j,
1757
- onRenameCancel: x,
1758
- parentPath: h,
1759
- dropIndicator: W,
1793
+ getChildren: k,
1794
+ onContextMenu: F,
1795
+ renamingPath: Q,
1796
+ onRename: J,
1797
+ onRenameCancel: w,
1798
+ parentPath: _,
1799
+ dropIndicator: T,
1760
1800
  onDragStart: m,
1761
- onDragEnd: V,
1762
- onDragEnter: J,
1763
- onDragOver: ce,
1764
- onDragLeave: Q,
1765
- onDrop: g,
1766
- rootPath: $,
1767
- onDoubleClickFile: N
1801
+ onDragEnd: N,
1802
+ onDragEnter: j,
1803
+ onDragOver: L,
1804
+ onDragLeave: U,
1805
+ onDrop: re,
1806
+ rootPath: ne,
1807
+ onDoubleClickFile: X,
1808
+ pathBadges: ae
1768
1809
  }
1769
1810
  )));
1770
- }, jt = ({ node: n, level: c, isOpen: f, hideName: l = !1 }) => {
1771
- const R = [];
1772
- for (let d = 0; d < c; d++)
1773
- R.push("&nbsp;&nbsp;&nbsp;&nbsp;");
1774
- return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1811
+ }, Ht = ({ node: i, level: s, isOpen: f, hideName: u = !1, badge: v }) => {
1812
+ const h = [];
1813
+ for (let b = 0; b < s; b++)
1814
+ h.push("&nbsp;&nbsp;&nbsp;&nbsp;");
1815
+ const x = O(null), [E, R] = K(null);
1816
+ return W(() => {
1817
+ if (!E)
1818
+ return;
1819
+ const b = () => R(null);
1820
+ return window.addEventListener("scroll", b, !0), window.addEventListener("resize", b), () => {
1821
+ window.removeEventListener("scroll", b, !0), window.removeEventListener("resize", b);
1822
+ };
1823
+ }, [E]), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1775
1824
  "span",
1776
1825
  {
1777
1826
  "aria-hidden": "true",
1778
- dangerouslySetInnerHTML: { __html: R.join("") }
1779
- }
1780
- ), n.type === "folder" ? /* @__PURE__ */ r.createElement(Ot, { width: 16, icon: f ? Hr : Ur }) : /* @__PURE__ */ r.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ r.createElement(Ot, { width: 16, icon: n.type === "folder" ? jr : Vr }), !l && /* @__PURE__ */ r.createElement("span", { className: Re.fileName }, n.name));
1781
- }, an = "_control_kp9d9_1", on = "_browse-label_kp9d9_11", ln = "_path-preview_kp9d9_37", sn = "_modal_kp9d9_43", cn = "_modal-footer_kp9d9_48", Qe = {
1782
- control: an,
1783
- browseLabel: on,
1784
- pathPreview: ln,
1785
- modal: sn,
1786
- modalFooter: cn
1827
+ dangerouslySetInnerHTML: { __html: h.join("") }
1828
+ }
1829
+ ), i.type === "folder" ? /* @__PURE__ */ r.createElement(Bt, { width: 16, icon: f ? Gr : Yr }) : /* @__PURE__ */ r.createElement("div", { style: { width: 16 } }, " "), /* @__PURE__ */ r.createElement(Bt, { width: 16, icon: i.type === "folder" ? Hr : Wr }), !u && /* @__PURE__ */ r.createElement("span", { className: ye.fileName }, i.name), v ? (
1830
+ // A plain hover-controlled DOM tooltip is used here instead of
1831
+ // the WordPress `Tooltip` component: this badge is nested
1832
+ // inside the row's own clickable Button, and Ariakit's hover
1833
+ // handling (which Tooltip is built on) does not reliably
1834
+ // trigger for an element nested inside another interactive
1835
+ // element. The tooltip itself is portaled to `document.body`
1836
+ // and positioned from the badge's screen coordinates so it
1837
+ // escapes the file tree sidebar's clipping/scroll container.
1838
+ /* @__PURE__ */ r.createElement(
1839
+ "span",
1840
+ {
1841
+ ref: x,
1842
+ className: ye.pathBadge,
1843
+ "aria-label": v.tooltip,
1844
+ onMouseEnter: () => {
1845
+ var D;
1846
+ const b = (D = x.current) == null ? void 0 : D.getBoundingClientRect();
1847
+ b && R({
1848
+ top: b.top,
1849
+ left: b.left
1850
+ });
1851
+ },
1852
+ onMouseLeave: () => R(null)
1853
+ },
1854
+ v.icon,
1855
+ E ? Yt(
1856
+ /* @__PURE__ */ r.createElement(
1857
+ "span",
1858
+ {
1859
+ className: ye.pathBadgeTooltip,
1860
+ role: "tooltip",
1861
+ style: {
1862
+ top: E.top,
1863
+ left: E.left
1864
+ }
1865
+ },
1866
+ v.tooltip
1867
+ ),
1868
+ document.body
1869
+ ) : null
1870
+ )
1871
+ ) : null);
1872
+ }, un = "_control_kp9d9_1", fn = "_browse-label_kp9d9_11", dn = "_path-preview_kp9d9_37", mn = "_modal_kp9d9_43", pn = "_modal-footer_kp9d9_48", et = {
1873
+ control: un,
1874
+ browseLabel: fn,
1875
+ pathPreview: dn,
1876
+ modal: mn,
1877
+ modalFooter: pn
1787
1878
  };
1788
- function un({ path: n }) {
1789
- if (!n)
1790
- return /* @__PURE__ */ r.createElement("div", { className: Qe.pathPreview }, /* @__PURE__ */ r.createElement("i", null, "Select a path"));
1791
- const c = n.split("/");
1792
- let f = (c.length > 2 ? "/" : "") + c.pop();
1879
+ function hn({ path: i }) {
1880
+ if (!i)
1881
+ return /* @__PURE__ */ r.createElement("div", { className: et.pathPreview }, /* @__PURE__ */ r.createElement("i", null, "Select a path"));
1882
+ const s = i.split("/");
1883
+ let f = (s.length > 2 ? "/" : "") + s.pop();
1793
1884
  f.length > 10 && (f = f.substring(f.length - 10));
1794
- const l = n.substring(
1885
+ const u = i.substring(
1795
1886
  0,
1796
- n.length - f.length
1887
+ i.length - f.length
1797
1888
  );
1798
1889
  return /* @__PURE__ */ r.createElement(
1799
1890
  "div",
1800
1891
  {
1801
- className: Qe.pathPreview,
1802
- "data-content-start": l,
1892
+ className: et.pathPreview,
1893
+ "data-content-start": u,
1803
1894
  "data-content-end": f
1804
1895
  }
1805
1896
  );
1806
1897
  }
1807
- function Ga({
1808
- value: n = "",
1809
- onChange: c,
1898
+ function eo({
1899
+ value: i = "",
1900
+ onChange: s,
1810
1901
  filesystem: f
1811
1902
  }) {
1812
- const [l, R] = te(!1), d = () => R(!0), P = () => R(!1), [A, T] = te(
1813
- n || null
1903
+ const [u, v] = K(!1), h = () => v(!0), x = () => v(!1), [E, R] = K(
1904
+ i || null
1814
1905
  );
1815
- function v(D) {
1816
- D == null || D.preventDefault(), c(A || ""), P();
1906
+ function b(D) {
1907
+ D == null || D.preventDefault(), s(E || ""), x();
1817
1908
  }
1818
1909
  return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
1819
- tt,
1910
+ He,
1820
1911
  {
1821
1912
  variant: "tertiary",
1822
- className: Qe.control,
1823
- onClick: d
1913
+ className: et.control,
1914
+ onClick: h
1824
1915
  },
1825
- /* @__PURE__ */ r.createElement("span", { className: Qe.browseLabel }, "Browse"),
1826
- /* @__PURE__ */ r.createElement(un, { path: n || "" })
1827
- ), l && /* @__PURE__ */ r.createElement(
1828
- or,
1916
+ /* @__PURE__ */ r.createElement("span", { className: et.browseLabel }, "Browse"),
1917
+ /* @__PURE__ */ r.createElement(hn, { path: i || "" })
1918
+ ), u && /* @__PURE__ */ r.createElement(
1919
+ zt,
1829
1920
  {
1830
1921
  title: "Select a path ",
1831
- onRequestClose: P,
1832
- className: Qe.modal
1922
+ onRequestClose: x,
1923
+ className: et.modal
1833
1924
  },
1834
- /* @__PURE__ */ r.createElement("form", { onSubmit: v }, /* @__PURE__ */ r.createElement(
1835
- nn,
1925
+ /* @__PURE__ */ r.createElement("form", { onSubmit: b }, /* @__PURE__ */ r.createElement(
1926
+ cn,
1836
1927
  {
1837
1928
  filesystem: f,
1838
- initialSelectedPath: n,
1839
- onSelect: T
1929
+ initialSelectedPath: i,
1930
+ onSelect: R
1840
1931
  }
1841
- ), /* @__PURE__ */ r.createElement("div", { className: Qe.modalFooter }, /* @__PURE__ */ r.createElement(tt, { type: "submit", variant: "primary" }, "Select Path")))
1932
+ ), /* @__PURE__ */ r.createElement("div", { className: et.modalFooter }, /* @__PURE__ */ r.createElement(He, { type: "submit", variant: "primary" }, "Select Path")))
1842
1933
  ));
1843
1934
  }
1844
- const fn = "_container_1h0az_1", dn = "_header_1h0az_9", mn = "_filename_1h0az_18", pn = "_downloadLink_1h0az_26", hn = "_previewArea_1h0az_38", vn = "_imagePreview_1h0az_51", wn = "_videoPreview_1h0az_57", gn = "_audioPreview_1h0az_64", En = "_unsupportedMessage_1h0az_68", yn = "_actions_1h0az_74", Be = {
1845
- container: fn,
1846
- header: dn,
1847
- filename: mn,
1848
- downloadLink: pn,
1849
- previewArea: hn,
1850
- imagePreview: vn,
1851
- videoPreview: wn,
1852
- audioPreview: gn,
1853
- unsupportedMessage: En,
1854
- actions: yn
1855
- }, _n = (n) => {
1856
- if (!n)
1935
+ const vn = "_container_1h0az_1", wn = "_header_1h0az_9", gn = "_filename_1h0az_18", En = "_downloadLink_1h0az_26", _n = "_previewArea_1h0az_38", yn = "_imagePreview_1h0az_51", bn = "_videoPreview_1h0az_57", xn = "_audioPreview_1h0az_64", Cn = "_unsupportedMessage_1h0az_68", Rn = "_actions_1h0az_74", je = {
1936
+ container: vn,
1937
+ header: wn,
1938
+ filename: gn,
1939
+ downloadLink: En,
1940
+ previewArea: _n,
1941
+ imagePreview: yn,
1942
+ videoPreview: bn,
1943
+ audioPreview: xn,
1944
+ unsupportedMessage: Cn,
1945
+ actions: Rn
1946
+ }, Pn = (i) => {
1947
+ if (!i)
1857
1948
  return {
1858
1949
  isImage: !1,
1859
1950
  isVideo: !1,
1860
1951
  isAudio: !1
1861
1952
  };
1862
- const c = n.toLowerCase();
1953
+ const s = i.toLowerCase();
1863
1954
  return {
1864
- isImage: c.startsWith("image/"),
1865
- isVideo: c.startsWith("video/"),
1866
- isAudio: c.startsWith("audio/")
1955
+ isImage: s.startsWith("image/"),
1956
+ isVideo: s.startsWith("video/"),
1957
+ isAudio: s.startsWith("audio/")
1867
1958
  };
1868
1959
  };
1869
- function Ya({
1870
- filename: n,
1871
- mimeType: c,
1960
+ function to({
1961
+ filename: i,
1962
+ mimeType: s,
1872
1963
  dataUrl: f,
1873
- downloadUrl: l,
1874
- showHeader: R = !0
1964
+ downloadUrl: u,
1965
+ showHeader: v = !0
1875
1966
  }) {
1876
- const { isImage: d, isVideo: P, isAudio: A } = _n(c), T = R !== !1, v = !!(l && n), D = () => v ? /* @__PURE__ */ r.createElement(
1967
+ const { isImage: h, isVideo: x, isAudio: E } = Pn(s), R = v !== !1, b = !!(u && i), D = () => b ? /* @__PURE__ */ r.createElement(
1877
1968
  "a",
1878
1969
  {
1879
- className: Be.downloadLink,
1880
- href: l,
1881
- download: n
1970
+ className: je.downloadLink,
1971
+ href: u,
1972
+ download: i
1882
1973
  },
1883
1974
  "Download"
1884
- ) : null, _ = () => d ? /* @__PURE__ */ r.createElement(
1975
+ ) : null, k = () => h ? /* @__PURE__ */ r.createElement(
1885
1976
  "img",
1886
1977
  {
1887
- className: Be.imagePreview,
1978
+ className: je.imagePreview,
1888
1979
  src: f,
1889
- alt: n || "Preview"
1980
+ alt: i || "Preview"
1890
1981
  }
1891
- ) : P ? /* @__PURE__ */ r.createElement(
1982
+ ) : x ? /* @__PURE__ */ r.createElement(
1892
1983
  "video",
1893
1984
  {
1894
- className: Be.videoPreview,
1985
+ className: je.videoPreview,
1895
1986
  controls: !0,
1896
1987
  preload: "metadata"
1897
1988
  },
1898
- /* @__PURE__ */ r.createElement("source", { src: f, type: c }),
1989
+ /* @__PURE__ */ r.createElement("source", { src: f, type: s }),
1899
1990
  "Your browser does not support the video tag."
1900
- ) : A ? /* @__PURE__ */ r.createElement("audio", { className: Be.audioPreview, controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: f, type: c }), "Your browser does not support the audio tag.") : /* @__PURE__ */ r.createElement("div", { className: Be.unsupportedMessage }, /* @__PURE__ */ r.createElement("p", null, "Preview unavailable for this file type."), v ? /* @__PURE__ */ r.createElement("p", null, D()) : /* @__PURE__ */ r.createElement("p", null, "Download the file to inspect its contents."));
1901
- return /* @__PURE__ */ r.createElement("div", { className: Be.container }, T && /* @__PURE__ */ r.createElement("div", { className: Be.header }, /* @__PURE__ */ r.createElement("span", { className: Be.filename, title: n }, n), D()), /* @__PURE__ */ r.createElement("div", { className: Be.previewArea }, _()), !T && v && /* @__PURE__ */ r.createElement("div", { className: Be.actions }, D()));
1991
+ ) : E ? /* @__PURE__ */ r.createElement("audio", { className: je.audioPreview, controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: f, type: s }), "Your browser does not support the audio tag.") : /* @__PURE__ */ r.createElement("div", { className: je.unsupportedMessage }, /* @__PURE__ */ r.createElement("p", null, "Preview unavailable for this file type."), b ? /* @__PURE__ */ r.createElement("p", null, D()) : /* @__PURE__ */ r.createElement("p", null, "Download the file to inspect its contents."));
1992
+ return /* @__PURE__ */ r.createElement("div", { className: je.container }, R && /* @__PURE__ */ r.createElement("div", { className: je.header }, /* @__PURE__ */ r.createElement("span", { className: je.filename, title: i }, i), D()), /* @__PURE__ */ r.createElement("div", { className: je.previewArea }, k()), !R && b && /* @__PURE__ */ r.createElement("div", { className: je.actions }, D()));
1902
1993
  }
1903
- const At = /* @__PURE__ */ new Map(), bn = async (n) => {
1904
- var R;
1905
- if (!n)
1906
- return ut();
1907
- const c = (R = n.split(".").pop()) == null ? void 0 : R.toLowerCase();
1908
- if (!c || c === "php")
1909
- return ut();
1910
- const f = n;
1911
- if (At.has(f))
1912
- return At.get(f);
1913
- let l;
1914
- switch (c) {
1994
+ const It = /* @__PURE__ */ new Map(), kn = async (i) => {
1995
+ var v;
1996
+ if (!i)
1997
+ return mt();
1998
+ const s = (v = i.split(".").pop()) == null ? void 0 : v.toLowerCase();
1999
+ if (!s || s === "php")
2000
+ return mt();
2001
+ const f = i;
2002
+ if (It.has(f))
2003
+ return It.get(f);
2004
+ let u;
2005
+ switch (s) {
1915
2006
  case "css":
1916
- l = await import("@codemirror/lang-css").then(
1917
- (d) => d.css()
2007
+ u = await import("@codemirror/lang-css").then(
2008
+ (h) => h.css()
1918
2009
  );
1919
2010
  break;
1920
2011
  case "js":
1921
2012
  case "jsx":
1922
2013
  case "ts":
1923
2014
  case "tsx":
1924
- l = await import("@codemirror/lang-javascript").then(
1925
- (d) => d.javascript({
1926
- jsx: c === "jsx" || c === "tsx",
1927
- typescript: c === "ts" || c === "tsx"
2015
+ u = await import("@codemirror/lang-javascript").then(
2016
+ (h) => h.javascript({
2017
+ jsx: s === "jsx" || s === "tsx",
2018
+ typescript: s === "ts" || s === "tsx"
1928
2019
  })
1929
2020
  );
1930
2021
  break;
1931
2022
  case "json":
1932
- l = await import("@codemirror/lang-json").then(
1933
- (d) => d.json()
2023
+ u = await import("@codemirror/lang-json").then(
2024
+ (h) => h.json()
1934
2025
  );
1935
2026
  break;
1936
2027
  case "html":
1937
2028
  case "htm":
1938
- l = await import("@codemirror/lang-html").then(
1939
- (d) => d.html()
2029
+ u = await import("@codemirror/lang-html").then(
2030
+ (h) => h.html()
1940
2031
  );
1941
2032
  break;
1942
2033
  case "md":
1943
2034
  case "markdown":
1944
- l = await import("@codemirror/lang-markdown").then(
1945
- (d) => d.markdown()
2035
+ u = await import("@codemirror/lang-markdown").then(
2036
+ (h) => h.markdown()
1946
2037
  );
1947
2038
  break;
1948
2039
  default:
1949
- l = ut();
2040
+ u = mt();
1950
2041
  }
1951
- return At.set(f, l), l;
2042
+ return It.set(f, u), u;
1952
2043
  };
1953
- class xn {
1954
- constructor(c) {
1955
- this.view = c, this.handleClick = this.handleClick.bind(this), this.view.dom.addEventListener("mousedown", this.handleClick);
2044
+ class Tn {
2045
+ constructor(s) {
2046
+ this.view = s, this.handleClick = this.handleClick.bind(this), this.view.dom.addEventListener("mousedown", this.handleClick);
1956
2047
  }
1957
- handleClick(c) {
1958
- const f = c.target;
2048
+ handleClick(s) {
2049
+ const f = s.target;
1959
2050
  if ((f.classList.contains("cm-scroller") || f.classList.contains("cm-content")) && this.view.posAtCoords({
1960
- x: c.clientX,
1961
- y: c.clientY
2051
+ x: s.clientX,
2052
+ y: s.clientY
1962
2053
  }) === null) {
1963
- const R = this.view.state.doc.length, d = gt.create([
1964
- gt.range(R, R)
2054
+ const v = this.view.state.doc.length, h = yt.create([
2055
+ yt.range(v, v)
1965
2056
  ]);
1966
2057
  this.view.dispatch({
1967
- selection: d,
1968
- effects: ct.scrollIntoView(R, {
2058
+ selection: h,
2059
+ effects: dt.scrollIntoView(v, {
1969
2060
  y: "center"
1970
2061
  })
1971
- }), this.view.focus(), c.preventDefault();
2062
+ }), this.view.focus(), s.preventDefault();
1972
2063
  }
1973
2064
  }
1974
2065
  destroy() {
1975
2066
  this.view.dom.removeEventListener("mousedown", this.handleClick);
1976
2067
  }
1977
2068
  }
1978
- const Cn = dr.define(
1979
- (n) => new xn(n)
1980
- ), Gt = $t(
2069
+ const Sn = vr.define(
2070
+ (i) => new Tn(i)
2071
+ ), qt = bt(
1981
2072
  function({
1982
- code: c,
2073
+ code: s,
1983
2074
  onChange: f,
1984
- currentPath: l,
1985
- language: R,
1986
- className: d,
1987
- onSaveShortcut: P,
1988
- readOnly: A = !1,
1989
- additionalExtensions: T
1990
- }, v) {
1991
- const D = M(
2075
+ currentPath: u,
2076
+ language: v,
2077
+ className: h,
2078
+ onSaveShortcut: x,
2079
+ readOnly: E = !1,
2080
+ additionalExtensions: R
2081
+ }, b) {
2082
+ const D = O(
1992
2083
  null
1993
- ), _ = M(null), k = M(new Tt()), Z = M(new Tt()), j = M(new Tt()), x = M(c), K = M(f), W = M(!1);
1994
- return Wt(v, () => ({
2084
+ ), k = O(null), F = O(new Ft()), Q = O(new Ft()), J = O(new Ft()), w = O(s), Z = O(f), T = O(!1);
2085
+ return xt(b, () => ({
1995
2086
  focus: () => {
1996
2087
  var m;
1997
- (m = _.current) == null || m.focus();
2088
+ (m = k.current) == null || m.focus();
1998
2089
  },
1999
2090
  blur: () => {
2000
- const m = _.current;
2091
+ const m = k.current;
2001
2092
  m && m.contentDOM.blur();
2002
2093
  },
2003
- getCursorPosition: () => _.current ? _.current.state.selection.main.anchor : null,
2094
+ getCursorPosition: () => k.current ? k.current.state.selection.main.anchor : null,
2004
2095
  setCursorPosition: (m) => {
2005
- if (!_.current)
2096
+ if (!k.current)
2006
2097
  return;
2007
- const V = Math.min(
2098
+ const N = Math.min(
2008
2099
  m,
2009
- _.current.state.doc.length
2010
- ), J = gt.create([
2011
- gt.range(V, V)
2100
+ k.current.state.doc.length
2101
+ ), j = yt.create([
2102
+ yt.range(N, N)
2012
2103
  ]);
2013
- _.current.dispatch({
2014
- selection: J,
2104
+ k.current.dispatch({
2105
+ selection: j,
2015
2106
  scrollIntoView: !0
2016
2107
  });
2017
2108
  }
2018
- })), H(() => {
2019
- x.current = c;
2020
- }, [c]), H(() => {
2021
- K.current = f;
2022
- }, [f]), H(() => {
2023
- if (_.current)
2109
+ })), W(() => {
2110
+ w.current = s;
2111
+ }, [s]), W(() => {
2112
+ Z.current = f;
2113
+ }, [f]), W(() => {
2114
+ if (k.current)
2024
2115
  return;
2025
2116
  const m = D.current;
2026
2117
  if (!m)
2027
2118
  return;
2028
- const V = fr.create({
2029
- doc: c,
2119
+ const N = hr.create({
2120
+ doc: s,
2030
2121
  extensions: [
2031
- j.current.of(T ?? []),
2032
- mr(),
2033
- pr(),
2034
- hr(),
2035
- Dr(),
2036
- vr(),
2122
+ J.current.of(R ?? []),
2037
2123
  wr(),
2038
2124
  gr(),
2039
- Cn,
2040
- k.current.of(R ?? ut()),
2041
- Z.current.of(
2042
- ct.editable.of(!A)
2043
- ),
2044
- Ar(Nr),
2045
- Fr(),
2046
- Ir(),
2047
- kr(),
2125
+ Er(),
2126
+ Lr(),
2127
+ _r(),
2048
2128
  yr(),
2129
+ br(),
2130
+ Sn,
2131
+ F.current.of(v ?? mt()),
2132
+ Q.current.of(
2133
+ dt.editable.of(!E)
2134
+ ),
2135
+ Ir(Mr),
2136
+ Or(),
2137
+ jr(),
2138
+ Dr(),
2049
2139
  Cr(),
2050
- Pr(),
2051
- ct.updateListener.of((ce) => {
2052
- if (!ce.docChanged)
2140
+ Tr(),
2141
+ Ar(),
2142
+ dt.updateListener.of((L) => {
2143
+ if (!L.docChanged)
2053
2144
  return;
2054
- const Q = ce.state.doc.toString();
2055
- Q !== x.current && (x.current = Q, K.current(Q));
2145
+ const U = L.state.doc.toString();
2146
+ U !== w.current && (w.current = U, Z.current(U));
2056
2147
  }),
2057
- Er.of([
2148
+ xr.of([
2058
2149
  {
2059
2150
  key: "Mod-s",
2060
2151
  preventDefault: !0,
2061
- run: () => (P == null || P(), !0)
2152
+ run: () => (x == null || x(), !0)
2062
2153
  },
2154
+ ...Nr,
2155
+ ...Fr,
2156
+ ...Br,
2063
2157
  ...Sr,
2064
- ...Tr,
2065
- ...Lr,
2066
2158
  ...Rr,
2067
- ..._r,
2068
- ...br,
2069
- xr
2159
+ ...Pr,
2160
+ kr
2070
2161
  ])
2071
2162
  ]
2072
- }), J = new ct({ state: V, parent: m });
2073
- return _.current = J, () => {
2074
- J.destroy(), _.current = null;
2163
+ }), j = new dt({ state: N, parent: m });
2164
+ return k.current = j, () => {
2165
+ j.destroy(), k.current = null;
2075
2166
  };
2076
- }, []), H(() => {
2077
- const m = _.current;
2167
+ }, []), W(() => {
2168
+ const m = k.current;
2078
2169
  m && m.dispatch({
2079
- effects: j.current.reconfigure(
2080
- T ?? []
2170
+ effects: J.current.reconfigure(
2171
+ R ?? []
2081
2172
  )
2082
2173
  });
2083
- }, [T]), H(() => {
2084
- const m = _.current;
2174
+ }, [R]), W(() => {
2175
+ const m = k.current;
2085
2176
  if (!m)
2086
2177
  return;
2087
- const V = m.state.doc.toString();
2088
- c !== V && m.dispatch({
2089
- changes: { from: 0, to: m.state.doc.length, insert: c }
2178
+ const N = m.state.doc.toString();
2179
+ s !== N && m.dispatch({
2180
+ changes: { from: 0, to: m.state.doc.length, insert: s }
2090
2181
  });
2091
- }, [c]), H(() => {
2092
- var Q;
2093
- const m = _.current;
2182
+ }, [s]), W(() => {
2183
+ var U;
2184
+ const m = k.current;
2094
2185
  if (!m)
2095
2186
  return;
2096
- if (R) {
2187
+ if (v) {
2097
2188
  m.dispatch({
2098
- effects: k.current.reconfigure(R)
2189
+ effects: F.current.reconfigure(v)
2099
2190
  });
2100
2191
  return;
2101
2192
  }
2102
- const V = (Q = l == null ? void 0 : l.split(".").pop()) == null ? void 0 : Q.toLowerCase();
2103
- (!V || V === "php") && m.dispatch({
2104
- effects: k.current.reconfigure(ut())
2193
+ const N = (U = u == null ? void 0 : u.split(".").pop()) == null ? void 0 : U.toLowerCase();
2194
+ (!N || N === "php") && m.dispatch({
2195
+ effects: F.current.reconfigure(mt())
2105
2196
  });
2106
- let ce = !1;
2107
- return bn(l).then((g) => {
2108
- ce || !_.current || _.current.dispatch({
2109
- effects: k.current.reconfigure(g)
2197
+ let L = !1;
2198
+ return kn(u).then((re) => {
2199
+ L || !k.current || k.current.dispatch({
2200
+ effects: F.current.reconfigure(re)
2110
2201
  });
2111
2202
  }), () => {
2112
- ce = !0;
2203
+ L = !0;
2113
2204
  };
2114
- }, [l, R]), H(() => {
2115
- const m = _.current;
2116
- m && (m.hasFocus && (W.current = !0), m.dispatch({
2117
- effects: Z.current.reconfigure(
2118
- ct.editable.of(!A)
2205
+ }, [u, v]), W(() => {
2206
+ const m = k.current;
2207
+ m && (m.hasFocus && (T.current = !0), m.dispatch({
2208
+ effects: Q.current.reconfigure(
2209
+ dt.editable.of(!E)
2119
2210
  )
2120
2211
  }));
2121
- }, [A]), qt(() => {
2122
- const m = _.current;
2123
- m && W.current && !m.hasFocus && (m.focus(), W.current = !1);
2124
- }, [l, A]), /* @__PURE__ */ r.createElement("div", { ref: D, className: d });
2212
+ }, [E]), er(() => {
2213
+ const m = k.current;
2214
+ m && T.current && !m.hasFocus && (m.focus(), T.current = !1);
2215
+ }, [u, E]), /* @__PURE__ */ r.createElement("div", { ref: D, className: h });
2125
2216
  }
2126
2217
  );
2127
- Gt.displayName = "CodeEditor";
2128
- const Rn = "_fileExplorerContainer_rb5rx_1", kn = "_dropActive_rb5rx_9", Pn = "_fileExplorerHeader_rb5rx_14", Sn = "_fileExplorerTitle_rb5rx_23", Tn = "_fileExplorerSubsectionTitle_rb5rx_31", Dn = "_fileExplorerActions_rb5rx_35", An = "_fileExplorerButton_rb5rx_41", Nn = "_fileExplorerIconButton_rb5rx_71", Fn = "_fileExplorerTree_rb5rx_83", In = "_dockPresentation_rb5rx_92", Ln = "_fileExplorerUploadButton_rb5rx_152", ye = {
2129
- fileExplorerContainer: Rn,
2130
- dropActive: kn,
2131
- fileExplorerHeader: Pn,
2132
- fileExplorerTitle: Sn,
2133
- fileExplorerSubsectionTitle: Tn,
2134
- fileExplorerActions: Dn,
2135
- fileExplorerButton: An,
2136
- fileExplorerIconButton: Nn,
2137
- fileExplorerTree: Fn,
2138
- dockPresentation: In,
2139
- fileExplorerUploadButton: Ln
2140
- }, Yt = 1024 * 1024, On = (n) => {
2141
- const c = n.byteLength;
2142
- for (let f = 0; f < Math.min(c, 4096); f++)
2143
- if (n[f] === 0)
2218
+ qt.displayName = "CodeEditor";
2219
+ const Dn = "_fileExplorerContainer_rb5rx_1", An = "_dropActive_rb5rx_9", Nn = "_fileExplorerHeader_rb5rx_14", Fn = "_fileExplorerTitle_rb5rx_23", Ln = "_fileExplorerSubsectionTitle_rb5rx_31", In = "_fileExplorerActions_rb5rx_35", Mn = "_fileExplorerButton_rb5rx_41", On = "_fileExplorerIconButton_rb5rx_71", jn = "_fileExplorerTree_rb5rx_83", Bn = "_dockPresentation_rb5rx_92", Vn = "_fileExplorerUploadButton_rb5rx_152", xe = {
2220
+ fileExplorerContainer: Dn,
2221
+ dropActive: An,
2222
+ fileExplorerHeader: Nn,
2223
+ fileExplorerTitle: Fn,
2224
+ fileExplorerSubsectionTitle: Ln,
2225
+ fileExplorerActions: In,
2226
+ fileExplorerButton: Mn,
2227
+ fileExplorerIconButton: On,
2228
+ fileExplorerTree: jn,
2229
+ dockPresentation: Bn,
2230
+ fileExplorerUploadButton: Vn
2231
+ }, Jt = 1024 * 1024, $n = (i) => {
2232
+ const s = i.byteLength;
2233
+ for (let f = 0; f < Math.min(s, 4096); f++)
2234
+ if (i[f] === 0)
2144
2235
  return !0;
2145
2236
  try {
2146
- return new TextDecoder("utf-8", { fatal: !0 }).decode(n), !1;
2237
+ return new TextDecoder("utf-8", { fatal: !0 }).decode(i), !1;
2147
2238
  } catch {
2148
2239
  return !0;
2149
2240
  }
2150
- }, Vt = (n, c) => {
2151
- const f = new Blob([n]), l = URL.createObjectURL(f);
2152
- return setTimeout(() => URL.revokeObjectURL(l), 6e4), { url: l, filename: c };
2241
+ }, Wt = (i, s) => {
2242
+ const f = new Blob([i]), u = URL.createObjectURL(f);
2243
+ return setTimeout(() => URL.revokeObjectURL(u), 6e4), { url: u, filename: s };
2153
2244
  };
2154
- async function Bn(n, c = Yt) {
2155
- const f = Mn(n);
2156
- if (f !== void 0 && f > c)
2245
+ async function Hn(i, s = Jt) {
2246
+ const f = Wn(i);
2247
+ if (f !== void 0 && f > s)
2157
2248
  return { type: "too-large" };
2158
- if (typeof n.stream == "function")
2159
- return jn(n, c);
2160
- const l = new Uint8Array(await n.arrayBuffer());
2161
- return l.byteLength > c ? { type: "too-large" } : { type: "inline", data: l };
2249
+ if (typeof i.stream == "function")
2250
+ return Un(i, s);
2251
+ const u = new Uint8Array(await i.arrayBuffer());
2252
+ return u.byteLength > s ? { type: "too-large" } : { type: "inline", data: u };
2162
2253
  }
2163
- function Mn(n) {
2164
- if (typeof n.filesize == "number")
2165
- return n.filesize;
2166
- if (typeof n.size == "number")
2167
- return n.size;
2254
+ function Wn(i) {
2255
+ if (typeof i.filesize == "number")
2256
+ return i.filesize;
2257
+ if (typeof i.size == "number")
2258
+ return i.size;
2168
2259
  }
2169
- async function jn(n, c) {
2170
- const f = n.stream().getReader(), l = [];
2171
- let R = 0;
2260
+ async function Un(i, s) {
2261
+ const f = i.stream().getReader(), u = [];
2262
+ let v = 0;
2172
2263
  try {
2173
2264
  for (; ; ) {
2174
- const { done: d, value: P } = await f.read();
2175
- if (d)
2265
+ const { done: h, value: x } = await f.read();
2266
+ if (h)
2176
2267
  return {
2177
2268
  type: "inline",
2178
- data: Qt(l)
2269
+ data: nr(u)
2179
2270
  };
2180
- if (P) {
2181
- if (R += P.byteLength, R > c)
2271
+ if (x) {
2272
+ if (v += x.byteLength, v > s)
2182
2273
  return await f.cancel().catch(() => {
2183
2274
  }), { type: "too-large" };
2184
- l.push(P);
2275
+ u.push(x);
2185
2276
  }
2186
2277
  }
2187
2278
  } finally {
2188
2279
  f.releaseLock();
2189
2280
  }
2190
2281
  }
2191
- const Vn = (n) => {
2192
- const c = n.split(".").pop();
2193
- return Lt[c] || Lt._default;
2194
- }, $n = (n) => n.startsWith("image/") || n.startsWith("video/") || n.startsWith("audio/");
2195
- function Wn({
2196
- filesystem: n,
2197
- currentPath: c,
2198
- selectedDirPath: f,
2199
- setSelectedDirPath: l,
2200
- onFileOpened: R,
2201
- onSelectionCleared: d,
2202
- onShowMessage: P,
2203
- documentRoot: A,
2204
- readOnly: T = !1,
2205
- title: v = "Files",
2206
- mobileSubsectionTitle: D,
2207
- showBinaryPreviewHeader: _ = !0,
2208
- dockPresentation: k = !1,
2209
- useWordPressTooltips: Z = !1
2210
- }) {
2211
- const j = M(null), x = M(null), K = Ft(() => c ? Le(c) : f ?? A, [c, A]), [W, m] = te(!1);
2212
- H(() => {
2213
- !c || !j.current || (l(Le(c)), j.current.focusPath(c, {
2282
+ const zn = (i) => {
2283
+ const s = i.split(".").pop();
2284
+ return jt[s] || jt._default;
2285
+ }, Gn = (i) => i.startsWith("image/") || i.startsWith("video/") || i.startsWith("audio/"), Yn = bt(function({
2286
+ filesystem: s,
2287
+ currentPath: f,
2288
+ selectedDirPath: u,
2289
+ setSelectedDirPath: v,
2290
+ onFileOpened: h,
2291
+ onSelectionCleared: x,
2292
+ onShowMessage: E,
2293
+ documentRoot: R,
2294
+ readOnly: b = !1,
2295
+ title: D = "Files",
2296
+ mobileSubsectionTitle: k,
2297
+ showBinaryPreviewHeader: F = !0,
2298
+ dockPresentation: Q = !1,
2299
+ useWordPressTooltips: J = !1,
2300
+ pathBadges: w,
2301
+ onMountFromGit: Z,
2302
+ onPathRenamed: T
2303
+ }, m) {
2304
+ const N = O(null), j = O(null);
2305
+ xt(
2306
+ m,
2307
+ () => ({
2308
+ refreshPath: async (d) => {
2309
+ var P;
2310
+ await ((P = N.current) == null ? void 0 : P.refresh(d));
2311
+ },
2312
+ revealPath: async (d) => {
2313
+ var P;
2314
+ await ((P = N.current) == null ? void 0 : P.revealPath(d));
2315
+ }
2316
+ }),
2317
+ []
2318
+ );
2319
+ const L = ft(() => f ? Ne(f) : u ?? R, [f, R]), [U, re] = K(!1);
2320
+ W(() => {
2321
+ !f || !N.current || (v(Ne(f)), N.current.focusPath(f, {
2214
2322
  select: !0,
2215
2323
  domFocus: !1,
2216
2324
  notify: !1
2217
- }), j.current.expandToPath(c));
2218
- }, [c, l]);
2219
- const V = async (g, $) => {
2325
+ }), N.current.expandToPath(f));
2326
+ }, [f, v]);
2327
+ const ne = async (d, P) => {
2220
2328
  try {
2221
- const N = await n.read(g), h = await Bn(N);
2222
- if (h.type === "too-large") {
2223
- const I = Yt / 1024 / 1024;
2224
- if (!k) {
2225
- await P(
2226
- g,
2227
- /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${I}MB).`), /* @__PURE__ */ r.createElement("p", null, "Open or download it outside the in-browser editor."))
2329
+ const V = await s.read(d), z = await Hn(V);
2330
+ if (z.type === "too-large") {
2331
+ const me = Jt / 1024 / 1024;
2332
+ if (!Q) {
2333
+ await E(
2334
+ d,
2335
+ /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${me}MB).`), /* @__PURE__ */ r.createElement("p", null, "Open or download it outside the in-browser editor."))
2228
2336
  );
2229
2337
  return;
2230
2338
  }
2231
- const ee = et(g) || "download";
2232
- await P(
2233
- g,
2234
- /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${I}MB).`), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement(
2235
- tt,
2339
+ const Y = tt(d) || "download";
2340
+ await E(
2341
+ d,
2342
+ /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, `File too large to open (>${me}MB).`), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement(
2343
+ He,
2236
2344
  {
2237
2345
  type: "button",
2238
2346
  variant: "link",
2239
2347
  onClick: () => {
2240
- J(g, ee);
2348
+ X(d, Y);
2241
2349
  }
2242
2350
  },
2243
2351
  "Download ",
2244
- ee
2352
+ Y
2245
2353
  )))
2246
2354
  );
2247
2355
  return;
2248
2356
  }
2249
- const O = h.data, G = et(g) || "download";
2250
- if (On(O)) {
2251
- const I = Vn(G), { url: ee, filename: X } = Vt(
2252
- O,
2357
+ const $ = z.data, G = tt(d) || "download";
2358
+ if ($n($)) {
2359
+ const me = zn(G), { url: Y, filename: ee } = Wt(
2360
+ $,
2253
2361
  G
2254
2362
  );
2255
- if ($n(I)) {
2256
- const ve = new Blob([O], { type: I }), me = URL.createObjectURL(ve);
2257
- await P(
2258
- g,
2363
+ if (Gn(me)) {
2364
+ const ue = new Blob([$], { type: me }), Pe = URL.createObjectURL(ue);
2365
+ await E(
2366
+ d,
2259
2367
  /* @__PURE__ */ r.createElement(
2260
- Br,
2368
+ $r,
2261
2369
  {
2262
- filename: X,
2263
- mimeType: I,
2264
- dataUrl: me,
2265
- downloadUrl: ee,
2266
- showHeader: _
2370
+ filename: ee,
2371
+ mimeType: me,
2372
+ dataUrl: Pe,
2373
+ downloadUrl: Y,
2374
+ showHeader: F
2267
2375
  }
2268
2376
  )
2269
2377
  );
2270
2378
  return;
2271
2379
  }
2272
- await P(
2273
- g,
2274
- /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, "Binary file. Cannot be edited."), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement("a", { href: ee, download: X }, "Download ", X)))
2380
+ await E(
2381
+ d,
2382
+ /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("p", null, "Binary file. Cannot be edited."), /* @__PURE__ */ r.createElement("p", null, /* @__PURE__ */ r.createElement("a", { href: Y, download: ee }, "Download ", ee)))
2275
2383
  );
2276
2384
  return;
2277
2385
  }
2278
- const re = new TextDecoder("utf-8").decode(O);
2279
- await R(g, re, $);
2280
- } catch (N) {
2281
- Xe.error("Could not open file", N), await P(null, "Could not open file.");
2386
+ const ce = new TextDecoder("utf-8").decode($);
2387
+ await h(d, ce, P);
2388
+ } catch (V) {
2389
+ Ye.error("Could not open file", V), await E(null, "Could not open file.");
2282
2390
  }
2283
- }, J = async (g, $) => {
2391
+ }, X = async (d, P) => {
2284
2392
  try {
2285
- const N = await n.read(g), h = new Uint8Array(await N.arrayBuffer()), { url: O } = Vt(h, $), G = document.createElement("a");
2286
- G.href = O, G.download = $, document.body.appendChild(G), G.click(), document.body.removeChild(G);
2287
- } catch (N) {
2288
- Xe.error("Could not download file", N), await P(g, "Could not download file.");
2289
- }
2290
- }, ce = (g) => {
2291
- var N;
2292
- const $ = Array.from(g.target.files ?? []);
2293
- g.target.value = "", $.length !== 0 && ((N = j.current) == null || N.importFiles($, f ?? A).catch((h) => Xe.error("Failed to import files", h)));
2294
- }, Q = (g) => {
2295
- var $;
2296
- g.dataTransfer.types.includes(
2393
+ const V = await s.read(d), z = new Uint8Array(await V.arrayBuffer()), { url: $ } = Wt(z, P), G = document.createElement("a");
2394
+ G.href = $, G.download = P, document.body.appendChild(G), G.click(), document.body.removeChild(G);
2395
+ } catch (V) {
2396
+ Ye.error("Could not download file", V), await E(d, "Could not download file.");
2397
+ }
2398
+ }, ae = (d) => {
2399
+ var V;
2400
+ const P = Array.from(d.target.files ?? []);
2401
+ d.target.value = "", P.length !== 0 && ((V = N.current) == null || V.importFiles(P, u ?? R).catch((z) => Ye.error("Failed to import files", z)));
2402
+ }, _ = (d) => {
2403
+ var P;
2404
+ d.dataTransfer.types.includes(
2297
2405
  "application/x-wp-playground-path"
2298
- ) || (g.preventDefault(), !T && (($ = j.current) == null || $.importDataTransfer(
2299
- g.dataTransfer,
2300
- f ?? A
2406
+ ) || (d.preventDefault(), !b && ((P = N.current) == null || P.importDataTransfer(
2407
+ d.dataTransfer,
2408
+ u ?? R
2301
2409
  ).catch(
2302
- (N) => Xe.error("Failed to import dropped files", N)
2410
+ (V) => Ye.error("Failed to import dropped files", V)
2303
2411
  )));
2304
2412
  };
2305
2413
  return /* @__PURE__ */ r.createElement(
2306
2414
  "div",
2307
2415
  {
2308
- className: De(ye.fileExplorerContainer, {
2309
- [ye.dropActive]: W,
2310
- [ye.dockPresentation]: k
2416
+ className: Fe(xe.fileExplorerContainer, {
2417
+ [xe.dropActive]: U,
2418
+ [xe.dockPresentation]: Q
2311
2419
  }),
2312
- onDragEnter: (g) => {
2313
- g.dataTransfer.types.includes(
2420
+ onDragEnter: (d) => {
2421
+ d.dataTransfer.types.includes(
2314
2422
  "application/x-wp-playground-path"
2315
- ) || (g.preventDefault(), T || m(!0));
2423
+ ) || (d.preventDefault(), b || re(!0));
2316
2424
  },
2317
- onDragOver: (g) => {
2318
- g.dataTransfer.types.includes(
2425
+ onDragOver: (d) => {
2426
+ d.dataTransfer.types.includes(
2319
2427
  "application/x-wp-playground-path"
2320
- ) || (g.preventDefault(), g.dataTransfer.dropEffect = T ? "none" : "copy");
2428
+ ) || (d.preventDefault(), d.dataTransfer.dropEffect = b ? "none" : "copy");
2321
2429
  },
2322
- onDragLeave: (g) => {
2323
- const $ = g.relatedTarget;
2324
- (!$ || !g.currentTarget.contains($)) && m(!1);
2430
+ onDragLeave: (d) => {
2431
+ const P = d.relatedTarget;
2432
+ (!P || !d.currentTarget.contains(P)) && re(!1);
2325
2433
  },
2326
- onDropCapture: () => m(!1),
2327
- onDrop: Q
2434
+ onDropCapture: () => re(!1),
2435
+ onDrop: _
2328
2436
  },
2329
- /* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerHeader }, /* @__PURE__ */ r.createElement("span", { className: ye.fileExplorerTitle }, v), D ? /* @__PURE__ */ r.createElement("span", { className: ye.fileExplorerSubsectionTitle }, D) : null, T ? null : /* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerActions }, /* @__PURE__ */ r.createElement(
2330
- Nt,
2437
+ /* @__PURE__ */ r.createElement("div", { className: xe.fileExplorerHeader }, /* @__PURE__ */ r.createElement("span", { className: xe.fileExplorerTitle }, D), k ? /* @__PURE__ */ r.createElement("span", { className: xe.fileExplorerSubsectionTitle }, k) : null, b ? null : /* @__PURE__ */ r.createElement("div", { className: xe.fileExplorerActions }, /* @__PURE__ */ r.createElement(
2438
+ Mt,
2331
2439
  {
2332
2440
  label: "Create new file",
2333
- useWordPressTooltip: Z
2441
+ useWordPressTooltip: J
2334
2442
  },
2335
2443
  /* @__PURE__ */ r.createElement(
2336
2444
  "button",
2337
2445
  {
2338
- className: De(
2339
- ye.fileExplorerButton,
2340
- ye.fileExplorerIconButton
2446
+ className: Fe(
2447
+ xe.fileExplorerButton,
2448
+ xe.fileExplorerIconButton
2341
2449
  ),
2342
2450
  type: "button",
2343
2451
  onClick: () => {
2344
- j.current && j.current.createFile();
2452
+ N.current && N.current.createFile();
2345
2453
  },
2346
2454
  "aria-label": "Create new file",
2347
- title: Z ? void 0 : "Create new file"
2455
+ title: J ? void 0 : "Create new file"
2348
2456
  },
2349
- k ? /* @__PURE__ */ r.createElement(Hn, null) : /* @__PURE__ */ r.createElement(St, { icon: Gr, size: 20 })
2457
+ Q ? /* @__PURE__ */ r.createElement(Zn, null) : /* @__PURE__ */ r.createElement(At, { icon: Kr, size: 20 })
2350
2458
  )
2351
2459
  ), /* @__PURE__ */ r.createElement(
2352
- Nt,
2460
+ Mt,
2353
2461
  {
2354
2462
  label: "Create new folder",
2355
- useWordPressTooltip: Z
2463
+ useWordPressTooltip: J
2356
2464
  },
2357
2465
  /* @__PURE__ */ r.createElement(
2358
2466
  "button",
2359
2467
  {
2360
- className: De(
2361
- ye.fileExplorerButton,
2362
- ye.fileExplorerIconButton
2468
+ className: Fe(
2469
+ xe.fileExplorerButton,
2470
+ xe.fileExplorerIconButton
2363
2471
  ),
2364
2472
  type: "button",
2365
2473
  onClick: () => {
2366
- j.current && j.current.createFolder();
2474
+ N.current && N.current.createFolder();
2367
2475
  },
2368
2476
  "aria-label": "Create new folder",
2369
- title: Z ? void 0 : "Create new folder"
2477
+ title: J ? void 0 : "Create new folder"
2370
2478
  },
2371
- k ? /* @__PURE__ */ r.createElement(Un, null) : /* @__PURE__ */ r.createElement(St, { icon: zr, size: 20 })
2479
+ Q ? /* @__PURE__ */ r.createElement(Kn, null) : /* @__PURE__ */ r.createElement(At, { icon: Zr, size: 20 })
2372
2480
  )
2373
2481
  ), /* @__PURE__ */ r.createElement(
2374
- Nt,
2482
+ Mt,
2375
2483
  {
2376
2484
  label: "Upload files",
2377
- useWordPressTooltip: Z
2485
+ useWordPressTooltip: J
2378
2486
  },
2379
2487
  /* @__PURE__ */ r.createElement(
2380
2488
  "button",
2381
2489
  {
2382
- className: De(
2383
- ye.fileExplorerButton,
2384
- ye.fileExplorerIconButton,
2385
- ye.fileExplorerUploadButton
2490
+ className: Fe(
2491
+ xe.fileExplorerButton,
2492
+ xe.fileExplorerIconButton,
2493
+ xe.fileExplorerUploadButton
2386
2494
  ),
2387
2495
  type: "button",
2388
2496
  onClick: () => {
2389
- var g;
2390
- return (g = x.current) == null ? void 0 : g.click();
2497
+ var d;
2498
+ return (d = j.current) == null ? void 0 : d.click();
2391
2499
  },
2392
2500
  "aria-label": "Upload files",
2393
- title: Z ? void 0 : "Upload files"
2501
+ title: J ? void 0 : "Upload files"
2394
2502
  },
2395
2503
  /* @__PURE__ */ r.createElement(
2396
- St,
2504
+ At,
2397
2505
  {
2398
- icon: Yr,
2399
- size: k ? 16 : 20
2506
+ icon: qr,
2507
+ size: Q ? 16 : 20
2400
2508
  }
2401
2509
  )
2402
2510
  )
2403
2511
  ), /* @__PURE__ */ r.createElement(
2404
2512
  "input",
2405
2513
  {
2406
- ref: x,
2514
+ ref: j,
2407
2515
  type: "file",
2408
2516
  multiple: !0,
2409
2517
  style: { display: "none" },
2410
- onChange: ce
2518
+ onChange: ae
2411
2519
  }
2412
2520
  ))),
2413
- /* @__PURE__ */ r.createElement("div", { className: ye.fileExplorerTree }, /* @__PURE__ */ r.createElement(
2414
- Or,
2521
+ /* @__PURE__ */ r.createElement("div", { className: xe.fileExplorerTree }, /* @__PURE__ */ r.createElement(
2522
+ Vr,
2415
2523
  {
2416
- ref: j,
2417
- readOnly: T,
2418
- filesystem: n,
2419
- root: A,
2420
- initialSelectedPath: K,
2421
- onSelect: async (g) => {
2422
- if (!g) {
2423
- l(A), await d();
2524
+ ref: N,
2525
+ readOnly: b,
2526
+ filesystem: s,
2527
+ root: R,
2528
+ initialSelectedPath: L,
2529
+ pathBadges: w,
2530
+ onMountFromGit: Z,
2531
+ onPathRenamed: T,
2532
+ onSelect: async (d) => {
2533
+ if (!d) {
2534
+ v(R), await x();
2424
2535
  return;
2425
2536
  }
2426
2537
  try {
2427
- if (await n.isDir(g)) {
2428
- l(g);
2538
+ if (await s.isDir(d)) {
2539
+ v(d);
2429
2540
  return;
2430
2541
  }
2431
2542
  } catch {
2432
2543
  }
2433
- l(Le(g)), await V(g, !1);
2544
+ v(Ne(d)), await ne(d, !1);
2434
2545
  },
2435
- onDoubleClickFile: async (g) => {
2436
- await V(g, !0);
2546
+ onDoubleClickFile: async (d) => {
2547
+ await ne(d, !0);
2437
2548
  }
2438
2549
  }
2439
2550
  ))
2440
2551
  );
2441
- }
2442
- function Nt({
2443
- label: n,
2444
- useWordPressTooltip: c,
2552
+ });
2553
+ function Mt({
2554
+ label: i,
2555
+ useWordPressTooltip: s,
2445
2556
  children: f
2446
2557
  }) {
2447
- return c ? /* @__PURE__ */ r.createElement(Ht, { text: n, delay: 0, placement: "top" }, f) : f;
2558
+ return s ? /* @__PURE__ */ r.createElement(Gt, { text: i, delay: 0, placement: "top" }, f) : f;
2448
2559
  }
2449
- const Hn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32", width: "24", height: "24", "aria-hidden": "true" }, /* @__PURE__ */ r.createElement(
2560
+ const Zn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32", width: "24", height: "24", "aria-hidden": "true" }, /* @__PURE__ */ r.createElement(
2450
2561
  "path",
2451
2562
  {
2452
2563
  d: "M11 6h7l5 5v12a2 2 0 0 1-2 2H11a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",
@@ -2473,7 +2584,7 @@ const Hn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32",
2473
2584
  strokeWidth: "2",
2474
2585
  strokeLinecap: "round"
2475
2586
  }
2476
- ))), Un = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32", width: "24", height: "24", "aria-hidden": "true" }, /* @__PURE__ */ r.createElement(
2587
+ ))), Kn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32", width: "24", height: "24", "aria-hidden": "true" }, /* @__PURE__ */ r.createElement(
2477
2588
  "path",
2478
2589
  {
2479
2590
  d: "M6 9h7l3 3h10v11a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9z",
@@ -2500,391 +2611,526 @@ const Hn = () => /* @__PURE__ */ r.createElement("svg", { viewBox: "0 0 32 32",
2500
2611
  strokeWidth: "2",
2501
2612
  strokeLinecap: "round"
2502
2613
  }
2503
- ))), zn = "_container_a36e6_1", Gn = "_content_a36e6_9", Yn = "_sidebarWrapper_a36e6_17", Zn = "_editorWrapper_a36e6_28", Kn = "_editorHeader_a36e6_37", qn = "_editorPath_a36e6_49", Jn = "_editorPathDirectory_a36e6_61", Xn = "_editorPathFilename_a36e6_68", Qn = "_editorPathPlaceholder_a36e6_73", ea = "_editorPathPortaled_a36e6_77", ta = "_editorHeaderActions_a36e6_83", ra = "_saveStatus_a36e6_90", na = "_saveStatusSaving_a36e6_97", aa = "_saveStatusPending_a36e6_98", oa = "_saveStatusError_a36e6_102", ia = "_editor_a36e6_28", la = "_placeholder_a36e6_124", sa = "_messageArea_a36e6_135", ca = "_mobileToggle_a36e6_171", ua = "_mobileOverlay_a36e6_175", fa = "_dockPresentation_a36e6_181", da = "_dockDirtyIndicator_a36e6_205", ma = "_dockSaveButton_a36e6_214", pa = "_sidebarOpen_a36e6_269", ha = "_editorHeaderPathPortaled_a36e6_367", q = {
2504
- container: zn,
2505
- content: Gn,
2506
- sidebarWrapper: Yn,
2507
- editorWrapper: Zn,
2508
- editorHeader: Kn,
2509
- editorPath: qn,
2510
- editorPathDirectory: Jn,
2511
- editorPathFilename: Xn,
2512
- editorPathPlaceholder: Qn,
2513
- editorPathPortaled: ea,
2514
- editorHeaderActions: ta,
2515
- saveStatus: ra,
2516
- saveStatusSaving: na,
2517
- saveStatusPending: aa,
2518
- saveStatusError: oa,
2519
- editor: ia,
2520
- placeholder: la,
2521
- messageArea: sa,
2522
- mobileToggle: ca,
2523
- mobileOverlay: ua,
2524
- dockPresentation: fa,
2525
- dockDirtyIndicator: da,
2526
- dockSaveButton: ma,
2527
- sidebarOpen: pa,
2528
- editorHeaderPathPortaled: ha
2529
- }, va = 1500, wa = 700, ga = 1e3, L = {
2614
+ ))), qn = "_container_a36e6_1", Jn = "_content_a36e6_9", Xn = "_sidebarWrapper_a36e6_17", Qn = "_editorWrapper_a36e6_28", ea = "_editorHeader_a36e6_37", ta = "_editorPath_a36e6_49", ra = "_editorPathDirectory_a36e6_61", na = "_editorPathFilename_a36e6_68", aa = "_editorPathPlaceholder_a36e6_73", oa = "_editorPathPortaled_a36e6_77", ia = "_editorHeaderActions_a36e6_83", la = "_saveStatus_a36e6_90", sa = "_saveStatusSaving_a36e6_97", ca = "_saveStatusPending_a36e6_98", ua = "_saveStatusError_a36e6_102", fa = "_editor_a36e6_28", da = "_placeholder_a36e6_124", ma = "_messageArea_a36e6_135", pa = "_mobileToggle_a36e6_171", ha = "_mobileOverlay_a36e6_175", va = "_dockPresentation_a36e6_181", wa = "_dockDirtyIndicator_a36e6_205", ga = "_dockSaveButton_a36e6_214", Ea = "_sidebarOpen_a36e6_269", _a = "_editorHeaderPathPortaled_a36e6_367", q = {
2615
+ container: qn,
2616
+ content: Jn,
2617
+ sidebarWrapper: Xn,
2618
+ editorWrapper: Qn,
2619
+ editorHeader: ea,
2620
+ editorPath: ta,
2621
+ editorPathDirectory: ra,
2622
+ editorPathFilename: na,
2623
+ editorPathPlaceholder: aa,
2624
+ editorPathPortaled: oa,
2625
+ editorHeaderActions: ia,
2626
+ saveStatus: la,
2627
+ saveStatusSaving: sa,
2628
+ saveStatusPending: ca,
2629
+ saveStatusError: ua,
2630
+ editor: fa,
2631
+ placeholder: da,
2632
+ messageArea: ma,
2633
+ mobileToggle: pa,
2634
+ mobileOverlay: ha,
2635
+ dockPresentation: va,
2636
+ dockDirtyIndicator: wa,
2637
+ dockSaveButton: ga,
2638
+ sidebarOpen: Ea,
2639
+ editorHeaderPathPortaled: _a
2640
+ }, ya = 1500, ba = 700, xa = 1e3, B = {
2530
2641
  IDLE: "idle",
2531
2642
  PENDING: "pending",
2532
2643
  SAVING: "saving",
2533
2644
  SAVED: "saved",
2534
2645
  ERROR: "error"
2535
- };
2536
- function Za({
2537
- filesystem: n,
2538
- isVisible: c = !0,
2539
- documentRoot: f,
2540
- initialPath: l = null,
2541
- placeholderText: R = "Select a file to view or edit its contents.",
2542
- dockPresentation: d = !1,
2543
- mobileHeaderTarget: P = null
2544
- }) {
2545
- const [A, T] = te(
2546
- f
2547
- ), [v, D] = te(null), [_, k] = te(""), [Z, j] = te(!0), [x, K] = te(L.IDLE), [W, m] = te(null), [V, J] = te("idle"), [ce, Q] = te(!1), [g, $] = te(null), N = M(null), h = M(null), O = M(!1), G = M(v), re = M(
2548
- n
2549
- ), I = M(null), ee = M(null), X = M(
2646
+ }, ro = bt(function({
2647
+ filesystem: s,
2648
+ isVisible: f = !0,
2649
+ documentRoot: u,
2650
+ initialPath: v = null,
2651
+ placeholderText: h = "Select a file to view or edit its contents.",
2652
+ dockPresentation: x = !1,
2653
+ mobileHeaderTarget: E = null,
2654
+ pathBadges: R,
2655
+ onMountFromGit: b,
2656
+ onPathRenamed: D
2657
+ }, k) {
2658
+ const F = O(null);
2659
+ xt(
2660
+ k,
2661
+ () => ({
2662
+ refreshPath: async (C) => {
2663
+ var y;
2664
+ await ((y = F.current) == null ? void 0 : y.refreshPath(C));
2665
+ },
2666
+ revealPath: async (C) => {
2667
+ var y;
2668
+ await ((y = F.current) == null ? void 0 : y.revealPath(C));
2669
+ }
2670
+ }),
2671
+ []
2672
+ );
2673
+ const [Q, J] = K(
2674
+ u
2675
+ ), [w, Z] = K(null), [T, m] = K(""), [N, j] = K(!0), [L, U] = K(B.IDLE), [re, ne] = K(null), [X, ae] = K("idle"), [_, d] = K(!1), [P, V] = K(null), z = O(null), $ = O(null), G = O(!1), ce = O(w), me = O(
2676
+ s
2677
+ ), Y = O(null), ee = O(null), ue = O(
2550
2678
  /* @__PURE__ */ new WeakMap()
2551
- ), ve = M(!0), me = M(/* @__PURE__ */ new Map()), Ne = M(!1);
2552
- re.current = n, H(() => {
2553
- G.current = v;
2554
- }, [v]);
2555
- const Pe = Ue(async (b) => {
2556
- const { filesystem: S, path: ie, content: le } = b, ue = ee.current === b, be = X.current, ge = (be.get(S) ?? Promise.resolve()).catch(() => {
2557
- }).then(() => S.writeFile(ie, le));
2558
- be.set(S, ge);
2559
- let Ie = !1;
2679
+ ), Pe = O(!0), oe = O(/* @__PURE__ */ new Map()), Te = O(!1);
2680
+ me.current = s, W(() => {
2681
+ ce.current = w;
2682
+ }, [w]);
2683
+ const we = ze(async (C) => {
2684
+ const { filesystem: y, path: pe, content: de } = C, le = ee.current === C, ke = ue.current, Ie = (ke.get(y) ?? Promise.resolve()).catch(() => {
2685
+ }).then(() => y.writeFile(pe, de));
2686
+ ke.set(y, Ie);
2687
+ let De = !1;
2560
2688
  try {
2561
- await ge;
2562
- } catch (Ge) {
2563
- Ie = !0, Xe.error("Failed to save file", Ge);
2564
- }
2565
- const at = ve.current && be.get(S) === ge && re.current === S && G.current === ie && I.current === null;
2566
- be.get(S) === ge && be.delete(S), ee.current === b && (ee.current = null), at && (K(Ie ? L.ERROR : L.SAVED), m(
2567
- Ie ? "Could not save changes. Try again." : null
2568
- ), ue && J(Ie ? "idle" : "saved"));
2569
- }, []), ne = Ue(() => {
2570
- const b = I.current;
2571
- b && (h.current !== null && (window.clearTimeout(h.current), h.current = null), I.current = null, Pe(b));
2572
- }, [Pe]);
2573
- H(() => (ve.current = !0, () => {
2574
- ve.current = !1;
2575
- }), []), H(() => () => {
2576
- var b;
2577
- ((b = I.current) == null ? void 0 : b.filesystem) === n && ne();
2578
- }, [f, n, ne]), H(() => {
2579
- O.current = !0, T(f), k(""), D(null), j(!0), K(L.IDLE), m(null), Q(!1), $(null), me.current.clear(), Ne.current = !1;
2580
- }, [f, n]), H(() => {
2581
- if (!n || !l || Ne.current)
2689
+ await Ie;
2690
+ } catch (at) {
2691
+ De = !0, Ye.error("Failed to save file", at);
2692
+ }
2693
+ const Ze = Pe.current && ke.get(y) === Ie && me.current === y && ce.current === pe && Y.current === null;
2694
+ ke.get(y) === Ie && ke.delete(y), ee.current === C && (ee.current = null), Ze && (U(De ? B.ERROR : B.SAVED), ne(
2695
+ De ? "Could not save changes. Try again." : null
2696
+ ), le && ae(De ? "idle" : "saved"));
2697
+ }, []), Ce = ze(() => {
2698
+ const C = Y.current;
2699
+ C && ($.current !== null && (window.clearTimeout($.current), $.current = null), Y.current = null, we(C));
2700
+ }, [we]);
2701
+ W(() => (Pe.current = !0, () => {
2702
+ Pe.current = !1;
2703
+ }), []), W(() => () => {
2704
+ var C;
2705
+ ((C = Y.current) == null ? void 0 : C.filesystem) === s && Ce();
2706
+ }, [u, s, Ce]), W(() => {
2707
+ G.current = !0, J(u), m(""), Z(null), j(!0), U(B.IDLE), ne(null), d(!1), V(null), oe.current.clear(), Te.current = !1;
2708
+ }, [u, s]), W(() => {
2709
+ if (!s || !v || Te.current)
2582
2710
  return;
2583
- let b = !1;
2711
+ let C = !1;
2584
2712
  return (async () => {
2585
2713
  try {
2586
- if (await n.fileExists(l) && !b) {
2587
- const le = await n.readFileAsText(l);
2588
- if (b)
2714
+ if (await s.fileExists(v) && !C) {
2715
+ const de = await s.readFileAsText(v);
2716
+ if (C)
2589
2717
  return;
2590
- O.current = !0, D(l), k(le), j(!1), K(L.IDLE), m(null), setTimeout(() => {
2591
- var ue;
2592
- (ue = N.current) == null || ue.focus();
2718
+ G.current = !0, Z(v), m(de), j(!1), U(B.IDLE), ne(null), setTimeout(() => {
2719
+ var le;
2720
+ (le = z.current) == null || le.focus();
2593
2721
  }, 100);
2594
2722
  }
2595
- } catch (ie) {
2596
- Xe.debug("Could not auto-open initial path:", ie);
2723
+ } catch (pe) {
2724
+ Ye.debug("Could not auto-open initial path:", pe);
2597
2725
  } finally {
2598
- b || (Ne.current = !0);
2726
+ C || (Te.current = !0);
2599
2727
  }
2600
2728
  })(), () => {
2601
- b = !0;
2729
+ C = !0;
2602
2730
  };
2603
- }, [n, l]), H(() => {
2604
- if (!n || !v) {
2605
- h.current !== null && (window.clearTimeout(h.current), h.current = null), I.current = null, v || K(L.IDLE);
2731
+ }, [s, v]), W(() => {
2732
+ if (!s || !w) {
2733
+ $.current !== null && (window.clearTimeout($.current), $.current = null), Y.current = null, w || U(B.IDLE);
2606
2734
  return;
2607
2735
  }
2608
- if (O.current) {
2609
- O.current = !1, I.current = null;
2736
+ if (G.current) {
2737
+ G.current = !1, Y.current = null;
2610
2738
  return;
2611
2739
  }
2612
- h.current !== null && (window.clearTimeout(h.current), h.current = null), K(L.PENDING);
2613
- const b = {
2614
- filesystem: n,
2615
- path: v,
2616
- content: _
2740
+ $.current !== null && (window.clearTimeout($.current), $.current = null), U(B.PENDING);
2741
+ const C = {
2742
+ filesystem: s,
2743
+ path: w,
2744
+ content: T
2617
2745
  };
2618
- I.current = b;
2619
- const S = window.setTimeout(() => {
2620
- I.current === b && (h.current = null, I.current = null, K(L.SAVING), Pe(b));
2621
- }, va);
2622
- return h.current = S, () => {
2623
- h.current === S && (window.clearTimeout(S), h.current = null);
2746
+ Y.current = C;
2747
+ const y = window.setTimeout(() => {
2748
+ Y.current === C && ($.current = null, Y.current = null, U(B.SAVING), we(C));
2749
+ }, ya);
2750
+ return $.current = y, () => {
2751
+ $.current === y && (window.clearTimeout(y), $.current = null);
2624
2752
  };
2625
- }, [_, v, n, Pe]), H(() => {
2626
- if (x !== L.SAVED)
2753
+ }, [T, w, s, we]), W(() => {
2754
+ if (L !== B.SAVED)
2627
2755
  return;
2628
- const b = window.setTimeout(() => {
2629
- K(
2630
- (S) => S === L.SAVED ? L.IDLE : S
2756
+ const C = window.setTimeout(() => {
2757
+ U(
2758
+ (y) => y === B.SAVED ? B.IDLE : y
2631
2759
  );
2632
2760
  }, 2e3);
2633
- return () => window.clearTimeout(b);
2634
- }, [x]), H(() => {
2635
- V === "idle" || x === L.SAVING || x === L.SAVED || J("idle");
2636
- }, [V, x]), H(() => {
2637
- if (V !== "saved")
2761
+ return () => window.clearTimeout(C);
2762
+ }, [L]), W(() => {
2763
+ X === "idle" || L === B.SAVING || L === B.SAVED || ae("idle");
2764
+ }, [X, L]), W(() => {
2765
+ if (X !== "saved")
2638
2766
  return;
2639
- const b = window.setTimeout(
2640
- () => J("idle"),
2641
- ga
2767
+ const C = window.setTimeout(
2768
+ () => ae("idle"),
2769
+ xa
2642
2770
  );
2643
- return () => window.clearTimeout(b);
2644
- }, [V]), H(() => {
2645
- if (V !== "waiting")
2771
+ return () => window.clearTimeout(C);
2772
+ }, [X]), W(() => {
2773
+ if (X !== "waiting")
2646
2774
  return;
2647
- const b = window.setTimeout(
2648
- () => J(
2649
- (S) => S === "waiting" ? "saving" : S
2775
+ const C = window.setTimeout(
2776
+ () => ae(
2777
+ (y) => y === "waiting" ? "saving" : y
2650
2778
  ),
2651
- wa
2779
+ ba
2652
2780
  );
2653
- return () => window.clearTimeout(b);
2654
- }, [V]);
2655
- const Oe = Ue(
2656
- async (b, S, ie = !0) => {
2657
- var ue;
2658
- const le = (ue = N.current) == null ? void 0 : ue.getCursorPosition();
2659
- le != null && G.current && me.current.set(
2660
- G.current,
2661
- le
2662
- ), O.current = !0, D(b), k(S), $(null), j(!1), K(L.IDLE), m(null), Q(!1), setTimeout(() => {
2663
- var $e, ge, Ie;
2664
- const be = me.current.get(b);
2665
- be !== void 0 && (($e = N.current) == null || $e.setCursorPosition(be)), ie ? (ge = N.current) == null || ge.focus() : (Ie = N.current) == null || Ie.blur();
2781
+ return () => window.clearTimeout(C);
2782
+ }, [X]);
2783
+ const ie = ze(
2784
+ async (C, y, pe = !0) => {
2785
+ var le;
2786
+ const de = (le = z.current) == null ? void 0 : le.getCursorPosition();
2787
+ de != null && ce.current && oe.current.set(
2788
+ ce.current,
2789
+ de
2790
+ ), G.current = !0, Z(C), m(y), V(null), j(!1), U(B.IDLE), ne(null), d(!1), setTimeout(() => {
2791
+ var Oe, Ie, De;
2792
+ const ke = oe.current.get(C);
2793
+ ke !== void 0 && ((Oe = z.current) == null || Oe.setCursorPosition(ke)), pe ? (Ie = z.current) == null || Ie.focus() : (De = z.current) == null || De.blur();
2666
2794
  }, 50);
2667
2795
  },
2668
2796
  []
2669
2797
  );
2670
- H(() => {
2671
- var ie;
2672
- if (!v)
2798
+ W(() => {
2799
+ var pe;
2800
+ if (!w)
2673
2801
  return;
2674
- const b = setInterval(() => {
2675
- var ue;
2676
- const le = (ue = N.current) == null ? void 0 : ue.getCursorPosition();
2677
- le != null && me.current.set(v, le);
2678
- }, 1e3), S = (ie = N.current) == null ? void 0 : ie.getCursorPosition();
2679
- return S != null && me.current.set(v, S), () => {
2680
- var ue;
2681
- clearInterval(b);
2682
- const le = (ue = N.current) == null ? void 0 : ue.getCursorPosition();
2683
- le != null && me.current.set(v, le);
2802
+ const C = setInterval(() => {
2803
+ var le;
2804
+ const de = (le = z.current) == null ? void 0 : le.getCursorPosition();
2805
+ de != null && oe.current.set(w, de);
2806
+ }, 1e3), y = (pe = z.current) == null ? void 0 : pe.getCursorPosition();
2807
+ return y != null && oe.current.set(w, y), () => {
2808
+ var le;
2809
+ clearInterval(C);
2810
+ const de = (le = z.current) == null ? void 0 : le.getCursorPosition();
2811
+ de != null && oe.current.set(w, de);
2684
2812
  };
2685
- }, [v]), H(() => {
2686
- if (!c || !v)
2813
+ }, [w]), W(() => {
2814
+ if (!f || !w)
2687
2815
  return;
2688
- const b = setTimeout(() => {
2689
- var ie;
2690
- const S = me.current.get(v);
2691
- S !== void 0 && ((ie = N.current) == null || ie.setCursorPosition(S));
2816
+ const C = setTimeout(() => {
2817
+ var pe;
2818
+ const y = oe.current.get(w);
2819
+ y !== void 0 && ((pe = z.current) == null || pe.setCursorPosition(y));
2692
2820
  }, 100);
2693
- return () => clearTimeout(b);
2694
- }, [c, v]);
2695
- const ae = Ue(async () => {
2696
- var S;
2697
- const b = (S = N.current) == null ? void 0 : S.getCursorPosition();
2698
- b != null && G.current && me.current.set(G.current, b), O.current = !0, D(null), k(""), $(null), j(!0), K(L.IDLE), m(null);
2699
- }, []), Me = Ue(
2700
- async (b, S) => {
2701
- O.current = !0, D(null), typeof S == "string" ? (k(S), $(null)) : (k(""), $(S)), j(!0), K(L.IDLE), m(null), Q(!1);
2821
+ return () => clearTimeout(C);
2822
+ }, [f, w]);
2823
+ const Be = ze(async () => {
2824
+ var y;
2825
+ const C = (y = z.current) == null ? void 0 : y.getCursorPosition();
2826
+ C != null && ce.current && oe.current.set(ce.current, C), G.current = !0, Z(null), m(""), V(null), j(!0), U(B.IDLE), ne(null);
2827
+ }, []), ge = ze(
2828
+ async (C, y) => {
2829
+ G.current = !0, Z(null), typeof y == "string" ? (m(y), V(null)) : (m(""), V(y)), j(!0), U(B.IDLE), ne(null), d(!1);
2702
2830
  },
2703
2831
  []
2704
- ), _e = Ue(() => {
2705
- I.current && (ee.current = I.current, J("waiting"), K(L.SAVING), ne());
2706
- }, [ne]), ke = Ue(() => {
2707
- !I.current && x === L.ERROR && n && v && (I.current = {
2708
- filesystem: n,
2709
- path: v,
2710
- content: _
2711
- }), I.current && (m(null), _e());
2712
- }, [_, v, n, _e, x]), Fe = Ea(x, W), Se = ya(x, q), de = _a(x);
2713
- let U = "Save";
2714
- x === L.ERROR ? U = "Retry" : x === L.SAVED && V === "saved" ? U = "Saved" : x === L.SAVING && V === "saving" && (U = "Saving…");
2715
- const E = x === L.PENDING || x === L.SAVING || x === L.ERROR;
2716
- if (!n)
2832
+ ), Se = ze(() => {
2833
+ Y.current && (ee.current = Y.current, ae("waiting"), U(B.SAVING), Ce());
2834
+ }, [Ce]), g = ze(() => {
2835
+ !Y.current && L === B.ERROR && s && w && (Y.current = {
2836
+ filesystem: s,
2837
+ path: w,
2838
+ content: T
2839
+ }), Y.current && (ne(null), Se());
2840
+ }, [T, w, s, Se, L]), Ee = Ca(L, re), he = Ra(L, q), H = Pa(L);
2841
+ let fe = "Save";
2842
+ L === B.ERROR ? fe = "Retry" : L === B.SAVED && X === "saved" ? fe = "Saved" : L === B.SAVING && X === "saving" && (fe = "Saving…");
2843
+ const We = L === B.PENDING || L === B.SAVING || L === B.ERROR;
2844
+ if (!s)
2717
2845
  return /* @__PURE__ */ r.createElement(
2718
2846
  "div",
2719
2847
  {
2720
- className: De(q.container, {
2721
- [q.dockPresentation]: d
2848
+ className: Fe(q.container, {
2849
+ [q.dockPresentation]: x
2722
2850
  })
2723
2851
  },
2724
- /* @__PURE__ */ r.createElement("div", { className: q.placeholder }, R)
2852
+ /* @__PURE__ */ r.createElement("div", { className: q.placeholder }, h)
2725
2853
  );
2726
- const he = v ? Le(v) : null, pe = v ? et(v) : null, we = /* @__PURE__ */ r.createElement(
2854
+ const ve = w ? Ne(w) : null, _e = w ? tt(w) : null, Ve = /* @__PURE__ */ r.createElement(
2727
2855
  "div",
2728
2856
  {
2729
- className: De(q.editorPath, {
2730
- [q.editorPathPlaceholder]: !(v != null && v.length),
2731
- [q.editorPathPortaled]: P
2857
+ className: Fe(q.editorPath, {
2858
+ [q.editorPathPlaceholder]: !(w != null && w.length),
2859
+ [q.editorPathPortaled]: E
2732
2860
  }),
2733
- title: v ?? void 0
2861
+ title: w ?? void 0
2734
2862
  },
2735
- he && pe ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("span", { className: q.editorPathDirectory }, he === "/" ? "" : he), /* @__PURE__ */ r.createElement("span", { className: q.editorPathFilename }, "/", pe)) : `Browse files under ${f}`
2863
+ ve && _e ? /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("span", { className: q.editorPathDirectory }, ve === "/" ? "" : ve), /* @__PURE__ */ r.createElement("span", { className: q.editorPathFilename }, "/", _e)) : `Browse files under ${u}`
2736
2864
  );
2737
2865
  return /* @__PURE__ */ r.createElement(
2738
2866
  "div",
2739
2867
  {
2740
- className: De(q.container, {
2741
- [q.dockPresentation]: d
2868
+ className: Fe(q.container, {
2869
+ [q.dockPresentation]: x
2742
2870
  })
2743
2871
  },
2744
2872
  /* @__PURE__ */ r.createElement(
2745
2873
  "div",
2746
2874
  {
2747
- className: De(q.content, {
2748
- [q.sidebarOpen]: ce
2875
+ className: Fe(q.content, {
2876
+ [q.sidebarOpen]: _
2749
2877
  })
2750
2878
  },
2751
2879
  /* @__PURE__ */ r.createElement(
2752
2880
  "div",
2753
2881
  {
2754
2882
  className: q.mobileOverlay,
2755
- onClick: () => Q(!1)
2883
+ onClick: () => d(!1)
2756
2884
  }
2757
2885
  ),
2758
2886
  /* @__PURE__ */ r.createElement("aside", { className: q.sidebarWrapper }, /* @__PURE__ */ r.createElement(
2759
- Wn,
2887
+ Yn,
2760
2888
  {
2761
- filesystem: n,
2762
- currentPath: v,
2763
- selectedDirPath: A,
2764
- setSelectedDirPath: T,
2765
- onFileOpened: Oe,
2766
- onSelectionCleared: ae,
2767
- onShowMessage: Me,
2768
- documentRoot: f,
2769
- dockPresentation: d,
2770
- useWordPressTooltips: d
2889
+ ref: F,
2890
+ filesystem: s,
2891
+ currentPath: w,
2892
+ selectedDirPath: Q,
2893
+ setSelectedDirPath: J,
2894
+ onFileOpened: ie,
2895
+ onSelectionCleared: Be,
2896
+ onShowMessage: ge,
2897
+ documentRoot: u,
2898
+ dockPresentation: x,
2899
+ useWordPressTooltips: x,
2900
+ pathBadges: R,
2901
+ onMountFromGit: b,
2902
+ onPathRenamed: D
2771
2903
  }
2772
2904
  )),
2773
2905
  /* @__PURE__ */ r.createElement("section", { className: q.editorWrapper }, /* @__PURE__ */ r.createElement(
2774
2906
  "div",
2775
2907
  {
2776
- className: De(q.editorHeader, {
2777
- [q.editorHeaderPathPortaled]: P
2908
+ className: Fe(q.editorHeader, {
2909
+ [q.editorHeaderPathPortaled]: E
2778
2910
  })
2779
2911
  },
2780
2912
  /* @__PURE__ */ r.createElement(
2781
- tt,
2913
+ He,
2782
2914
  {
2783
2915
  className: q.mobileToggle,
2784
2916
  variant: "secondary",
2785
- onClick: () => Q((b) => !b)
2917
+ onClick: () => d((C) => !C)
2786
2918
  },
2787
- ce ? "Hide files" : "Browse files"
2919
+ _ ? "Hide files" : "Browse files"
2788
2920
  ),
2789
- P ? Mr(we, P) : we,
2790
- d && !Z && v ? /* @__PURE__ */ r.createElement("div", { className: q.editorHeaderActions }, E ? /* @__PURE__ */ r.createElement(
2921
+ E ? Yt(Ve, E) : Ve,
2922
+ x && !N && w ? /* @__PURE__ */ r.createElement("div", { className: q.editorHeaderActions }, We ? /* @__PURE__ */ r.createElement(
2791
2923
  "span",
2792
2924
  {
2793
2925
  className: q.dockDirtyIndicator,
2794
2926
  "aria-hidden": "true"
2795
2927
  }
2796
- ) : null, /* @__PURE__ */ r.createElement(Ht, { text: de, placement: "top" }, /* @__PURE__ */ r.createElement(
2797
- tt,
2928
+ ) : null, /* @__PURE__ */ r.createElement(Gt, { text: H, placement: "top" }, /* @__PURE__ */ r.createElement(
2929
+ He,
2798
2930
  {
2799
2931
  variant: "secondary",
2800
2932
  className: q.dockSaveButton,
2801
- isDestructive: x === L.ERROR,
2802
- onClick: ke
2933
+ isDestructive: L === B.ERROR,
2934
+ onClick: g
2803
2935
  },
2804
- U
2805
- ))) : d ? null : /* @__PURE__ */ r.createElement(
2936
+ fe
2937
+ ))) : x ? null : /* @__PURE__ */ r.createElement(
2806
2938
  "div",
2807
2939
  {
2808
- className: De(
2940
+ className: Fe(
2809
2941
  q.saveStatus,
2810
- Se
2942
+ he
2811
2943
  )
2812
2944
  },
2813
- Fe
2945
+ Ee
2814
2946
  ),
2815
- d && !Z && v ? /* @__PURE__ */ r.createElement(ir, { role: "status", "aria-live": "polite" }, de) : null
2816
- ), W ? /* @__PURE__ */ r.createElement("div", { style: { padding: "8px 16px" } }, /* @__PURE__ */ r.createElement(lr, { status: "error", isDismissible: !1 }, W)) : null, v || _ || g ? g ? /* @__PURE__ */ r.createElement("div", { className: q.messageArea }, g) : /* @__PURE__ */ r.createElement(
2817
- Gt,
2947
+ x && !N && w ? /* @__PURE__ */ r.createElement(cr, { role: "status", "aria-live": "polite" }, H) : null
2948
+ ), re ? /* @__PURE__ */ r.createElement("div", { style: { padding: "8px 16px" } }, /* @__PURE__ */ r.createElement(ur, { status: "error", isDismissible: !1 }, re)) : null, w || T || P ? P ? /* @__PURE__ */ r.createElement("div", { className: q.messageArea }, P) : /* @__PURE__ */ r.createElement(
2949
+ qt,
2818
2950
  {
2819
- ref: N,
2820
- code: _,
2821
- onChange: k,
2822
- currentPath: v,
2951
+ ref: z,
2952
+ code: T,
2953
+ onChange: m,
2954
+ currentPath: w,
2823
2955
  className: q.editor,
2824
- onSaveShortcut: _e,
2825
- readOnly: Z
2956
+ onSaveShortcut: Se,
2957
+ readOnly: N
2826
2958
  }
2827
- ) : /* @__PURE__ */ r.createElement("div", { className: q.placeholder }, R))
2959
+ ) : /* @__PURE__ */ r.createElement("div", { className: q.placeholder }, h))
2828
2960
  )
2829
2961
  );
2830
- }
2831
- function Ea(n, c) {
2832
- switch (n) {
2833
- case L.PENDING:
2834
- case L.SAVING:
2962
+ });
2963
+ function Ca(i, s) {
2964
+ switch (i) {
2965
+ case B.PENDING:
2966
+ case B.SAVING:
2835
2967
  return "Saving…";
2836
- case L.SAVED:
2968
+ case B.SAVED:
2837
2969
  return "Saved";
2838
- case L.ERROR:
2839
- return c ?? "Save failed";
2970
+ case B.ERROR:
2971
+ return s ?? "Save failed";
2840
2972
  default:
2841
2973
  return "";
2842
2974
  }
2843
2975
  }
2844
- function ya(n, c) {
2845
- switch (n) {
2846
- case L.PENDING:
2847
- return c.saveStatusPending;
2848
- case L.SAVING:
2849
- return c.saveStatusSaving;
2850
- case L.ERROR:
2851
- return c.saveStatusError;
2976
+ function Ra(i, s) {
2977
+ switch (i) {
2978
+ case B.PENDING:
2979
+ return s.saveStatusPending;
2980
+ case B.SAVING:
2981
+ return s.saveStatusSaving;
2982
+ case B.ERROR:
2983
+ return s.saveStatusError;
2852
2984
  default:
2853
2985
  return;
2854
2986
  }
2855
2987
  }
2856
- function _a(n) {
2857
- switch (n) {
2858
- case L.PENDING:
2988
+ function Pa(i) {
2989
+ switch (i) {
2990
+ case B.PENDING:
2859
2991
  return "Unsaved changes. Click to save now.";
2860
- case L.SAVING:
2992
+ case B.SAVING:
2861
2993
  return "Saving changes…";
2862
- case L.ERROR:
2994
+ case B.ERROR:
2863
2995
  return "Saving failed. Click to retry.";
2864
2996
  default:
2865
2997
  return "All changes saved.";
2866
2998
  }
2867
2999
  }
3000
+ const ka = "_modal_1i30f_1", Ta = "_actions_1i30f_5", Ut = {
3001
+ modal: ka,
3002
+ actions: Ta
3003
+ };
3004
+ function no({
3005
+ kind: i,
3006
+ isBusy: s,
3007
+ error: f,
3008
+ onSubmit: u,
3009
+ onCancel: v
3010
+ }) {
3011
+ const [h, x] = K(""), [E, R] = K(""), [b, D] = K(""), k = h.trim(), F = (w) => {
3012
+ const Z = Sa(w);
3013
+ if (Z) {
3014
+ x(Z.url), R(Z.ref);
3015
+ return;
3016
+ }
3017
+ x(w);
3018
+ }, Q = () => {
3019
+ !k || s || u({
3020
+ url: k,
3021
+ ref: E.trim() || "HEAD",
3022
+ path: b.trim() || void 0
3023
+ });
3024
+ }, J = () => {
3025
+ s || v();
3026
+ };
3027
+ return /* @__PURE__ */ r.createElement(
3028
+ zt,
3029
+ {
3030
+ title: `Mount ${i} via git`,
3031
+ onRequestClose: J,
3032
+ isDismissible: !s,
3033
+ className: Ut.modal
3034
+ },
3035
+ /* @__PURE__ */ r.createElement(
3036
+ "form",
3037
+ {
3038
+ onSubmit: (w) => {
3039
+ w.preventDefault(), Q();
3040
+ },
3041
+ style: { display: "flex", flexDirection: "column", gap: 12 }
3042
+ },
3043
+ /* @__PURE__ */ r.createElement(
3044
+ Nt,
3045
+ {
3046
+ __nextHasNoMarginBottom: !0,
3047
+ label: "Repository URL",
3048
+ value: h,
3049
+ onChange: F,
3050
+ placeholder: "github.com/owner/repo",
3051
+ autoFocus: !0,
3052
+ disabled: s
3053
+ }
3054
+ ),
3055
+ /* @__PURE__ */ r.createElement(
3056
+ Nt,
3057
+ {
3058
+ __nextHasNoMarginBottom: !0,
3059
+ label: "Branch, tag, or commit",
3060
+ value: E,
3061
+ onChange: (w) => R(w),
3062
+ placeholder: "HEAD",
3063
+ disabled: s
3064
+ }
3065
+ ),
3066
+ /* @__PURE__ */ r.createElement(
3067
+ Nt,
3068
+ {
3069
+ __nextHasNoMarginBottom: !0,
3070
+ label: "Path within the repository (optional)",
3071
+ value: b,
3072
+ onChange: (w) => D(w),
3073
+ placeholder: "Leave empty to use the repository root",
3074
+ disabled: s
3075
+ }
3076
+ ),
3077
+ f ? /* @__PURE__ */ r.createElement("p", { role: "alert" }, f) : null,
3078
+ /* @__PURE__ */ r.createElement(fr, { justify: "end", className: Ut.actions }, /* @__PURE__ */ r.createElement(
3079
+ He,
3080
+ {
3081
+ type: "button",
3082
+ variant: "link",
3083
+ disabled: s,
3084
+ onClick: v
3085
+ },
3086
+ "Cancel"
3087
+ ), /* @__PURE__ */ r.createElement(
3088
+ He,
3089
+ {
3090
+ type: "submit",
3091
+ variant: "primary",
3092
+ isBusy: s,
3093
+ disabled: !k || s
3094
+ },
3095
+ "Mount ",
3096
+ i
3097
+ ))
3098
+ )
3099
+ );
3100
+ }
3101
+ function Sa(i) {
3102
+ const s = i.trim().match(
3103
+ /^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/]+)\/([^/]+)\/tree\/(.+)$/i
3104
+ );
3105
+ if (!s)
3106
+ return null;
3107
+ const [, f, u, v] = s;
3108
+ return {
3109
+ url: `https://github.com/${f}/${u.replace(/\.git$/i, "")}`,
3110
+ ref: v
3111
+ };
3112
+ }
2868
3113
  export {
2869
- Ya as BinaryFilePreview,
2870
- Wa as ClockIcon,
2871
- Gt as CodeEditor,
2872
- Wn as FileExplorerSidebar,
2873
- Ga as FilePickerControl,
2874
- nn as FilePickerTree,
2875
- Yt as MAX_INLINE_FILE_BYTES,
2876
- Za as PlaygroundFileEditor,
2877
- za as SiteManagerIcon,
2878
- $a as WordPressIcon,
2879
- Vt as createDownloadUrl,
2880
- Vr as file,
2881
- jr as folder,
2882
- Ua as getLogoDataURL,
2883
- Vn as getMimeType,
2884
- $n as isPreviewableBinary,
2885
- Ha as layout,
2886
- ja as playgroundLogo,
2887
- On as seemsLikeBinary,
2888
- Va as temporaryStorage
3114
+ to as BinaryFilePreview,
3115
+ qa as ClockIcon,
3116
+ qt as CodeEditor,
3117
+ Yn as FileExplorerSidebar,
3118
+ eo as FilePickerControl,
3119
+ cn as FilePickerTree,
3120
+ Jt as MAX_INLINE_FILE_BYTES,
3121
+ no as MountGitDirectoryModal,
3122
+ ro as PlaygroundFileEditor,
3123
+ Qa as SiteManagerIcon,
3124
+ Ka as WordPressIcon,
3125
+ Wt as createDownloadUrl,
3126
+ Wr as file,
3127
+ Hr as folder,
3128
+ Xa as getLogoDataURL,
3129
+ zn as getMimeType,
3130
+ Gn as isPreviewableBinary,
3131
+ Ja as layout,
3132
+ Ya as playgroundLogo,
3133
+ $n as seemsLikeBinary,
3134
+ Za as temporaryStorage
2889
3135
  };
2890
3136
  //# sourceMappingURL=index.js.map