@wp-playground/components 3.1.55 → 3.1.57

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