@templatical/media-library 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as ee, a as D, at as O, b as te, c as ne, d as k, et as re, f as A, g as ie, h as ae, i as oe, it as j, j as M, k as N, l as se, m as ce, n as le, nt as ue, o as de, ot as P, p as fe, q as F, r as pe, rt as I, s as me, st as L, t as he, tt as ge, u as _e, v as ve, w as R, x as ye, y as be, z } from "./chunks/icons-z3cCPQd8.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as ee, c as te, d as ne, et as re, f as A, g as ie, h as ae, i as oe, it as j, j as M, k as N, l as se, m as ce, n as le, nt as ue, o as de, ot as P, p as fe, q as F, r as pe, rt as I, s as me, st as L, t as he, tt as ge, u as _e, v as ve, w as R, x as ye, y as be, z } from "./chunks/icons-CbIgFLAS.js";
2
2
  //#region ../types/src/config.ts
3
3
  var xe = class extends Error {
4
4
  statusCode;
@@ -415,7 +415,7 @@ var je = {
415
415
  class: "tpl:transition-colors tpl:duration-150 tpl:hover:underline",
416
416
  style: { color: "var(--tpl-primary)" },
417
417
  onClick: n[0] ||= (e) => o("navigate", null)
418
- }, L(j(s).mediaLibrary.allFiles), 1), (z(!0), t(R, null, S(c.value, (e, n) => (z(), t(R, { key: e.id }, [p(j(fe), {
418
+ }, L(j(s).mediaLibrary.allFiles), 1), (z(!0), t(R, null, S(c.value, (e, n) => (z(), t(R, { key: e.id }, [p(j(ie), {
419
419
  size: 12,
420
420
  "stroke-width": 2
421
421
  }), n < c.value.length - 1 ? (z(), t("button", {
@@ -4056,31 +4056,31 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4056
4056
  },
4057
4057
  emits: ["save", "close"],
4058
4058
  setup(n, { emit: o }) {
4059
- let c = n, d = o, { t: f } = Ae(), m = l("tplUiTheme"), g = l(Ve, e(null)), _ = f.mediaLibrary, { isImageMimeType: v } = Fe(), y = e(""), x = e(""), C = e(null), w = e("free"), T = e(void 0), E = e(void 0), ee = e(""), D = e(""), ne = e(void 0), k = e(null), re = e(!1), A = e(!1), ie = e(!1), ae = a(() => c.item ? [
4059
+ let c = n, d = o, { t: f } = Ae(), m = l("tplUiTheme"), g = l(Ve, e(null)), _ = f.mediaLibrary, { isImageMimeType: v } = Fe(), y = e(""), x = e(""), C = e(null), w = e("free"), T = e(void 0), E = e(void 0), D = e(""), O = e(""), te = e(void 0), ne = e(null), re = e(!1), A = e(!1), ie = e(!1), ae = a(() => c.item ? [
4060
4060
  "image/jpeg",
4061
4061
  "image/png",
4062
4062
  "image/webp",
4063
4063
  "image/gif"
4064
- ].includes(c.item.mime_type) : !1), oe = a(() => w.value === "original" ? ne.value : Ie[w.value]), se = a(() => k.value ? Be(k.value.width, k.value.height, T.value, E.value) : null);
4064
+ ].includes(c.item.mime_type) : !1), oe = a(() => w.value === "original" ? te.value : Ie[w.value]), se = a(() => ne.value ? Be(ne.value.width, ne.value.height, T.value, E.value) : null);
4065
4065
  s(() => c.visible, (e) => {
4066
- e && c.item && (y.value = c.item.filename, x.value = c.item.alt_text || "", w.value = "free", T.value = void 0, E.value = void 0, ee.value = "", D.value = "", ne.value = void 0, k.value = null, re.value = !1, ie.value = !1, c.item.width && c.item.height && (ne.value = c.item.width / c.item.height));
4066
+ e && c.item && (y.value = c.item.filename, x.value = c.item.alt_text || "", w.value = "free", T.value = void 0, E.value = void 0, D.value = "", O.value = "", te.value = void 0, ne.value = null, re.value = !1, ie.value = !1, c.item.width && c.item.height && (te.value = c.item.width / c.item.height));
4067
4067
  });
4068
4068
  function ce(e) {
4069
- e.coordinates && (k.value = {
4069
+ e.coordinates && (ne.value = {
4070
4070
  width: Math.round(e.coordinates.width),
4071
4071
  height: Math.round(e.coordinates.height)
4072
4072
  }, ie.value = !0);
4073
4073
  }
4074
4074
  function le() {
4075
- re.value = !0, !ne.value && c.item?.width && c.item?.height && (ne.value = c.item.width / c.item.height);
4075
+ re.value = !0, !te.value && c.item?.width && c.item?.height && (te.value = c.item.width / c.item.height);
4076
4076
  }
4077
4077
  function ue(e) {
4078
4078
  let t = e.target.value;
4079
- ee.value = t, T.value = t && parseInt(t, 10) || void 0;
4079
+ D.value = t, T.value = t && parseInt(t, 10) || void 0;
4080
4080
  }
4081
4081
  function de(e) {
4082
4082
  let t = e.target.value;
4083
- D.value = t, E.value = t && parseInt(t, 10) || void 0;
4083
+ O.value = t, E.value = t && parseInt(t, 10) || void 0;
4084
4084
  }
4085
4085
  async function fe() {
4086
4086
  let e = y.value.trim();
@@ -4121,7 +4121,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4121
4121
  onClick: a[3] ||= r((e) => d("close"), ["self"]),
4122
4122
  onKeydown: pe
4123
4123
  }, [i("div", {
4124
- class: O(["tpl:mx-4 tpl:flex tpl:max-h-[90vh] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", ae.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
4124
+ class: k(["tpl:mx-4 tpl:flex tpl:max-h-[90vh] tpl:w-full tpl:flex-col tpl:overflow-hidden tpl:rounded-lg tpl:shadow-xl", ae.value ? "tpl:max-w-2xl" : "tpl:max-w-sm"]),
4125
4125
  style: { "background-color": "var(--tpl-bg-elevated)" }
4126
4126
  }, [
4127
4127
  i("div", Rn, [i("h3", zn, L(j(f).mediaLibrary.editFile), 1)]),
@@ -4154,7 +4154,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4154
4154
  onClick: (t) => w.value = e
4155
4155
  }, L(j(_)[`crop${e.charAt(0).toUpperCase()}${e.slice(1)}`]), 13, Kn)), 64))])]),
4156
4156
  i("div", qn, [i("div", Jn, [i("label", Yn, [M(L(j(f).mediaLibrary.cropMaxWidth) + " ", 1), i("span", Xn, L(j(f).mediaLibrary.cropOptional), 1)]), i("div", Zn, [i("input", {
4157
- value: ee.value,
4157
+ value: D.value,
4158
4158
  type: "number",
4159
4159
  min: "1",
4160
4160
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-8 tpl:pl-3 tpl:text-xs tpl:outline-none",
@@ -4163,10 +4163,10 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4163
4163
  "background-color": "var(--tpl-bg)",
4164
4164
  color: "var(--tpl-text)"
4165
4165
  },
4166
- placeholder: k.value?.width?.toString() || "",
4166
+ placeholder: ne.value?.width?.toString() || "",
4167
4167
  onInput: ue
4168
4168
  }, null, 40, Qn), i("span", $n, L(j(f).mediaLibrary.cropPixels), 1)])]), i("div", er, [i("label", tr, [M(L(j(f).mediaLibrary.cropMaxHeight) + " ", 1), i("span", nr, L(j(f).mediaLibrary.cropOptional), 1)]), i("div", rr, [i("input", {
4169
- value: D.value,
4169
+ value: O.value,
4170
4170
  type: "number",
4171
4171
  min: "1",
4172
4172
  class: "tpl:w-full tpl:rounded-md tpl:border tpl:py-1.5 tpl:pr-8 tpl:pl-3 tpl:text-xs tpl:outline-none",
@@ -4175,7 +4175,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4175
4175
  "background-color": "var(--tpl-bg)",
4176
4176
  color: "var(--tpl-text)"
4177
4177
  },
4178
- placeholder: k.value?.height?.toString() || "",
4178
+ placeholder: ne.value?.height?.toString() || "",
4179
4179
  onInput: de
4180
4180
  }, null, 40, ir), i("span", ar, L(j(f).mediaLibrary.cropPixels), 1)])])]),
4181
4181
  se.value ? (z(), t("div", or, [i("span", null, L(j(f).mediaLibrary.cropOutputSize) + ": ", 1), i("span", sr, L(se.value.width) + " x " + L(se.value.height) + " " + L(j(f).mediaLibrary.cropPixels), 1)])) : N("", !0)
@@ -4190,7 +4190,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4190
4190
  color: "var(--tpl-text)"
4191
4191
  },
4192
4192
  autofocus: !ae.value
4193
- }, null, 8, ur), [[te, y.value]])]),
4193
+ }, null, 8, ur), [[ee, y.value]])]),
4194
4194
  j(v)(n.item.mime_type) ? (z(), t("div", dr, [i("label", fr, L(j(f).mediaLibrary.altText), 1), u(i("input", {
4195
4195
  "onUpdate:modelValue": a[1] ||= (e) => x.value = e,
4196
4196
  type: "text",
@@ -4201,7 +4201,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4201
4201
  color: "var(--tpl-text)"
4202
4202
  },
4203
4203
  placeholder: j(f).mediaLibrary.altTextPlaceholder
4204
- }, null, 8, pr), [[te, x.value]])])) : N("", !0)
4204
+ }, null, 8, pr), [[ee, x.value]])])) : N("", !0)
4205
4205
  ]),
4206
4206
  i("div", mr, [i("button", {
4207
4207
  class: "tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150",
@@ -4253,17 +4253,17 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4253
4253
  for (let n of e) if (n.id === t || n.children && E(n.children, t)) return !0;
4254
4254
  return !1;
4255
4255
  }
4256
- function ee() {
4256
+ function D() {
4257
4257
  d.value = !d.value;
4258
4258
  }
4259
- function D() {
4259
+ function O() {
4260
4260
  f.value = !0, m.value = s.folder.name;
4261
4261
  }
4262
- function ne() {
4262
+ function te() {
4263
4263
  let e = m.value.trim();
4264
4264
  e && e !== s.folder.name && c("renameFolder", s.folder.id, e), f.value = !1, m.value = "";
4265
4265
  }
4266
- function k() {
4266
+ function ne() {
4267
4267
  f.value = !1, m.value = "";
4268
4268
  }
4269
4269
  function re() {
@@ -4272,7 +4272,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4272
4272
  function A() {
4273
4273
  _.value.trim() && c("createFolder", _.value.trim(), s.folder.id), g.value = !1, _.value = "";
4274
4274
  }
4275
- function ie() {
4275
+ function ae() {
4276
4276
  g.value = !1, _.value = "";
4277
4277
  }
4278
4278
  return (e, a) => {
@@ -4288,16 +4288,16 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4288
4288
  v.value || g.value ? (z(), t("button", {
4289
4289
  key: 0,
4290
4290
  class: "tpl:flex tpl:size-4 tpl:shrink-0 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
4291
- onClick: r(ee, ["stop"])
4292
- }, [p(j(fe), {
4293
- class: O(["tpl:transition-transform tpl:duration-150", { "tpl:rotate-90": T.value }]),
4291
+ onClick: r(D, ["stop"])
4292
+ }, [p(j(ie), {
4293
+ class: k(["tpl:transition-transform tpl:duration-150", { "tpl:rotate-90": T.value }]),
4294
4294
  size: 10,
4295
4295
  "stroke-width": 2
4296
4296
  }, null, 8, ["class"])])) : (z(), t("span", yr)),
4297
4297
  i("button", {
4298
4298
  class: "tpl:flex tpl:min-w-0 tpl:flex-1 tpl:items-center tpl:gap-1.5",
4299
4299
  onClick: a[0] ||= (e) => c("navigate", n.folder.id)
4300
- }, [p(j(_e), {
4300
+ }, [p(j(fe), {
4301
4301
  class: "tpl:shrink-0",
4302
4302
  size: 14,
4303
4303
  "stroke-width": 1.5
@@ -4313,10 +4313,10 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4313
4313
  color: "var(--tpl-text)"
4314
4314
  },
4315
4315
  autofocus: "",
4316
- onKeydown: [y(ne, ["enter"]), y(k, ["escape"])],
4317
- onBlur: ne,
4316
+ onKeydown: [y(te, ["enter"]), y(ne, ["escape"])],
4317
+ onBlur: te,
4318
4318
  onClick: a[2] ||= r(() => {}, ["stop"])
4319
- }, null, 544)), [[te, m.value]]) : N("", !0),
4319
+ }, null, 544)), [[ee, m.value]]) : N("", !0),
4320
4320
  f.value ? N("", !0) : (z(), t("span", xr, [
4321
4321
  b.value ? (z(), t("button", {
4322
4322
  key: 0,
@@ -4330,7 +4330,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4330
4330
  i("button", {
4331
4331
  class: "tpl:flex tpl:size-6 tpl:items-center tpl:justify-center tpl:rounded tpl:transition-colors",
4332
4332
  title: j(l).mediaLibrary.renameFolder,
4333
- onClick: r(D, ["stop"])
4333
+ onClick: r(O, ["stop"])
4334
4334
  }, [p(j(me), {
4335
4335
  size: 12,
4336
4336
  "stroke-width": 2
@@ -4372,9 +4372,9 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4372
4372
  },
4373
4373
  placeholder: j(l).mediaLibrary.subfolderName,
4374
4374
  autofocus: "",
4375
- onKeydown: [y(A, ["enter"]), y(ie, ["escape"])],
4375
+ onKeydown: [y(A, ["enter"]), y(ae, ["escape"])],
4376
4376
  onBlur: A
4377
- }, null, 40, Tr), [[te, _.value]])], 4)) : N("", !0)])) : N("", !0)]);
4377
+ }, null, 40, Tr), [[ee, _.value]])], 4)) : N("", !0)])) : N("", !0)]);
4378
4378
  };
4379
4379
  }
4380
4380
  }), Or = { class: "tpl:flex tpl:h-full tpl:flex-col tpl:overflow-y-auto" }, kr = {
@@ -4414,7 +4414,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4414
4414
  color: n.viewMode === "files" && n.currentFolderId === null ? "var(--tpl-primary)" : "var(--tpl-text)"
4415
4415
  }),
4416
4416
  onClick: r[0] ||= (e) => a("navigate", null)
4417
- }, [p(j(k), {
4417
+ }, [p(j(ce), {
4418
4418
  size: 14,
4419
4419
  "stroke-width": 1.5
4420
4420
  }), M(" " + L(j(o).mediaLibrary.allFiles), 1)], 4),
@@ -4441,7 +4441,7 @@ var Ln = ["data-tpl-theme"], Rn = { class: "tpl:shrink-0 tpl:p-5 tpl:pb-4" }, zn
4441
4441
  autofocus: "",
4442
4442
  onKeydown: [y(d, ["enter"]), y(f, ["escape"])],
4443
4443
  onBlur: d
4444
- }, null, 40, Ar), [[te, c.value]])])) : N("", !0),
4444
+ }, null, 40, Ar), [[ee, c.value]])])) : N("", !0),
4445
4445
  s.value ? N("", !0) : (z(), t("button", {
4446
4446
  key: 1,
4447
4447
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-2 tpl:px-3 tpl:py-2 tpl:text-left tpl:text-xs tpl:transition-all tpl:duration-150",
@@ -5124,19 +5124,19 @@ var pi = { class: "tpl:p-4" }, mi = {
5124
5124
  return (e, a) => (z(), t("div", pi, [
5125
5125
  n.isLoading && n.items.length === 0 ? (z(), t("div", {
5126
5126
  key: 0,
5127
- class: O(n.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
5127
+ class: k(n.layout === "list" ? "tpl:flex tpl:flex-col tpl:gap-1" : "tpl:grid tpl:grid-cols-4 tpl:gap-3")
5128
5128
  }, [(z(), t(R, null, S(8, (e) => i("div", {
5129
5129
  key: e,
5130
- class: O(["tpl-pulse tpl:rounded-lg", n.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
5130
+ class: k(["tpl-pulse tpl:rounded-lg", n.layout === "list" ? "tpl:h-12" : "tpl:aspect-square"]),
5131
5131
  style: { "background-color": "var(--tpl-bg-hover)" }
5132
- }, null, 2)), 64))], 2)) : n.items.length === 0 ? (z(), t("div", mi, [p(j(k), {
5132
+ }, null, 2)), 64))], 2)) : n.items.length === 0 ? (z(), t("div", mi, [p(j(ce), {
5133
5133
  class: "tpl:mb-3",
5134
5134
  size: 40,
5135
5135
  "stroke-width": 1,
5136
5136
  style: { color: "var(--tpl-text-dim)" }
5137
5137
  }), i("p", hi, L(j(f).mediaLibrary.noFiles), 1)])) : n.layout === "list" ? (z(), t("div", Oi, [(z(!0), t(R, null, S(n.items, (e) => (z(), t("div", {
5138
5138
  key: e.id,
5139
- class: O(["tpl-media-list-item tpl:group tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-3 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:transition-all tpl:duration-150", [!u(e) && !n.selectedIds.has(e.id) ? "tpl:opacity-60" : ""]]),
5139
+ class: k(["tpl-media-list-item tpl:group tpl:flex tpl:cursor-pointer tpl:items-center tpl:gap-3 tpl:rounded-lg tpl:px-3 tpl:py-2 tpl:transition-all tpl:duration-150", [!u(e) && !n.selectedIds.has(e.id) ? "tpl:opacity-60" : ""]]),
5140
5140
  style: P({ backgroundColor: n.selectedIds.has(e.id) ? "var(--tpl-bg-hover)" : "transparent" }),
5141
5141
  onClick: (t) => d(e)
5142
5142
  }, [
@@ -5161,17 +5161,17 @@ var pi = { class: "tpl:p-4" }, mi = {
5161
5161
  style: { color: "var(--tpl-text-muted)" },
5162
5162
  title: j(f).mediaLibrary.replaceFile,
5163
5163
  onClick: r((t) => s("replace", e), ["stop"])
5164
- }, [p(j(D), {
5164
+ }, [p(j(O), {
5165
5165
  size: 12,
5166
5166
  "stroke-width": 2
5167
5167
  })], 8, Ri)]),
5168
- n.selectedIds.has(e.id) ? (z(), t("div", zi, [p(j(ce), {
5168
+ n.selectedIds.has(e.id) ? (z(), t("div", zi, [p(j(D), {
5169
5169
  size: 12,
5170
5170
  "stroke-width": 3
5171
5171
  })])) : N("", !0)
5172
5172
  ], 14, ki))), 128))])) : (z(), t("div", gi, [(z(!0), t(R, null, S(n.items, (e) => (z(), t("div", {
5173
5173
  key: e.id,
5174
- class: O(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
5174
+ class: k(["tpl-media-item tpl:group tpl:relative tpl:overflow-hidden tpl:rounded-lg tpl:border-2 tpl:transition-all tpl:duration-150", [
5175
5175
  "tpl:cursor-pointer",
5176
5176
  !u(e) && !n.selectedIds.has(e.id) ? "tpl:opacity-60" : "",
5177
5177
  n.selectedIds.has(e.id) ? "tpl-media-item--selected" : ""
@@ -5206,11 +5206,11 @@ var pi = { class: "tpl:p-4" }, mi = {
5206
5206
  style: { "background-color": "rgba(0, 0, 0, 0.6)" },
5207
5207
  title: j(f).mediaLibrary.replaceFile,
5208
5208
  onClick: r((t) => s("replace", e), ["stop"])
5209
- }, [p(j(D), {
5209
+ }, [p(j(O), {
5210
5210
  size: 11,
5211
5211
  "stroke-width": 2
5212
5212
  })], 8, Ei)]),
5213
- n.selectedIds.has(e.id) ? (z(), t("div", Di, [p(j(ce), {
5213
+ n.selectedIds.has(e.id) ? (z(), t("div", Di, [p(j(D), {
5214
5214
  size: 12,
5215
5215
  "stroke-width": 3
5216
5216
  })])) : N("", !0)
@@ -5220,7 +5220,7 @@ var pi = { class: "tpl:p-4" }, mi = {
5220
5220
  ref: m,
5221
5221
  class: "tpl:h-4"
5222
5222
  }, null, 512),
5223
- n.isLoading && n.items.length > 0 ? (z(), t("div", Bi, [p(j(ie), {
5223
+ n.isLoading && n.items.length > 0 ? (z(), t("div", Bi, [p(j(se), {
5224
5224
  class: "tpl-spinner",
5225
5225
  size: 20,
5226
5226
  "stroke-width": 2,
@@ -5293,10 +5293,10 @@ var pi = { class: "tpl:p-4" }, mi = {
5293
5293
  placeholder: j(d).mediaLibrary.importUrlPlaceholder,
5294
5294
  disabled: n.isImporting,
5295
5295
  autofocus: ""
5296
- }, null, 8, Ki), [[te, g.value]])]),
5296
+ }, null, 8, Ki), [[ee, g.value]])]),
5297
5297
  n.error ? (z(), t("p", qi, L(n.error), 1)) : N("", !0),
5298
5298
  i("div", Ji, [i("button", {
5299
- class: O(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150", { "tpl:cursor-not-allowed tpl:opacity-50": n.isImporting }]),
5299
+ class: k(["tpl:cursor-pointer tpl:rounded-md tpl:border tpl:px-3 tpl:py-1.5 tpl:text-xs tpl:font-medium tpl:transition-all tpl:duration-150", { "tpl:cursor-not-allowed tpl:opacity-50": n.isImporting }]),
5300
5300
  style: {
5301
5301
  "border-color": "var(--tpl-border)",
5302
5302
  color: "var(--tpl-text)",
@@ -5309,7 +5309,7 @@ var pi = { class: "tpl:p-4" }, mi = {
5309
5309
  style: { background: "linear-gradient(\n 135deg,\n var(--tpl-primary),\n var(--tpl-primary-hover)\n )" },
5310
5310
  disabled: !g.value.trim() || n.isImporting,
5311
5311
  onClick: _
5312
- }, [n.isImporting ? (z(), t("span", Zi, [p(j(ie), {
5312
+ }, [n.isImporting ? (z(), t("span", Zi, [p(j(se), {
5313
5313
  class: "tpl:animate-spin",
5314
5314
  size: 12,
5315
5315
  "stroke-width": 2
@@ -5355,7 +5355,7 @@ var pi = { class: "tpl:p-4" }, mi = {
5355
5355
  class: "tpl:flex tpl:w-full tpl:items-center tpl:gap-1.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors tpl:duration-100",
5356
5356
  style: { color: "var(--tpl-text)" },
5357
5357
  onClick: r[0] ||= (e) => a("select", null)
5358
- }, [p(j(k), {
5358
+ }, [p(j(ce), {
5359
5359
  class: "tpl:shrink-0",
5360
5360
  size: 14,
5361
5361
  "stroke-width": 1.5
@@ -5370,7 +5370,7 @@ var pi = { class: "tpl:p-4" }, mi = {
5370
5370
  disabled: e.id === n.currentFolderId,
5371
5371
  onClick: (t) => a("select", e.id)
5372
5372
  }, [
5373
- p(j(_e), {
5373
+ p(j(fe), {
5374
5374
  class: "tpl:shrink-0",
5375
5375
  size: 14,
5376
5376
  "stroke-width": 1.5
@@ -5481,7 +5481,7 @@ var pi = { class: "tpl:p-4" }, mi = {
5481
5481
  g.value && e.item.width && e.item.height ? (z(), t(R, { key: 0 }, [M(" · " + L(e.item.width) + "×" + L(e.item.height) + "px ", 1)], 64)) : N("", !0),
5482
5482
  h.value ? (z(), t(R, { key: 1 }, [
5483
5483
  r[0] ||= M(" · ", -1),
5484
- p(j(_e), {
5484
+ p(j(fe), {
5485
5485
  class: "tpl:mb-px tpl:inline",
5486
5486
  size: 9,
5487
5487
  "stroke-width": 2
@@ -5491,7 +5491,7 @@ var pi = { class: "tpl:p-4" }, mi = {
5491
5491
  ]),
5492
5492
  g.value ? (z(), t("p", {
5493
5493
  key: 0,
5494
- class: O(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !e.item.alt_text }]),
5494
+ class: k(["tpl:mt-0.5 tpl:truncate tpl:text-[10px] tpl:italic", { "tpl:invisible": !e.item.alt_text }]),
5495
5495
  style: { color: "var(--tpl-text-dim)" }
5496
5496
  }, L(e.item.alt_text || "\xA0"), 3)) : N("", !0)
5497
5497
  ]),
@@ -5659,13 +5659,13 @@ var pi = { class: "tpl:p-4" }, mi = {
5659
5659
  }), (e, r) => (z(), t("div", {
5660
5660
  ref_key: "dropZoneRef",
5661
5661
  ref: d,
5662
- class: O(["tpl-upload-zone tpl:flex tpl:cursor-pointer tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded-lg tpl:border-2 tpl:border-dashed tpl:p-5 tpl:text-center tpl:transition-all tpl:duration-150", j(h) ? "tpl-upload-zone-active" : ""]),
5662
+ class: k(["tpl-upload-zone tpl:flex tpl:cursor-pointer tpl:flex-col tpl:items-center tpl:justify-center tpl:rounded-lg tpl:border-2 tpl:border-dashed tpl:p-5 tpl:text-center tpl:transition-all tpl:duration-150", j(h) ? "tpl-upload-zone-active" : ""]),
5663
5663
  style: {
5664
5664
  "border-color": "var(--tpl-border-light)",
5665
5665
  "background-color": "var(--tpl-bg)"
5666
5666
  },
5667
5667
  onClick: r[0] ||= (e) => j(g)()
5668
- }, [n.isUploading ? (z(), t("div", ja, [p(j(ie), {
5668
+ }, [n.isUploading ? (z(), t("div", ja, [p(j(se), {
5669
5669
  class: "tpl-spinner",
5670
5670
  size: 20,
5671
5671
  "stroke-width": 2,
@@ -5933,9 +5933,9 @@ var pi = { class: "tpl:p-4" }, mi = {
5933
5933
  //#region src/composable.ts
5934
5934
  function Ha(t) {
5935
5935
  if (!t.projectId) throw Error("projectId is required for useMediaLibrary");
5936
- let n = new Va(t.authManager), r = e([]), i = e([]), a = e(null), o = e("files"), s = e(""), c = e(null), l = e("newest"), u = e(!1), d = e(!1), f = e(!1), p = e(null), m = e(null), h = e(/* @__PURE__ */ new Set()), g = e(null), _ = e([]), v = e({}), y = e(!1), b = e([]), x = e(!1), S = e(null), C = e(!1), w = e(null), T = e(!1), E = e(null), ee = e(null), D = 0;
5937
- async function O() {
5938
- let e = ++D;
5936
+ let n = new Va(t.authManager), r = e([]), i = e([]), a = e(null), o = e("files"), s = e(""), c = e(null), l = e("newest"), u = e(!1), d = e(!1), f = e(!1), p = e(null), m = e(null), h = e(/* @__PURE__ */ new Set()), g = e(null), _ = e([]), v = e({}), y = e(!1), b = e([]), x = e(!1), S = e(null), C = e(!1), w = e(null), T = e(!1), E = e(null), D = e(null), O = 0;
5937
+ async function k() {
5938
+ let e = ++O;
5939
5939
  u.value = !0;
5940
5940
  try {
5941
5941
  let t = await n.browseMedia({
@@ -5944,18 +5944,18 @@ function Ha(t) {
5944
5944
  category: c.value || void 0,
5945
5945
  sort: l.value === "newest" ? void 0 : l.value
5946
5946
  });
5947
- if (e !== D) return;
5947
+ if (e !== O) return;
5948
5948
  r.value = t.data, p.value = t.meta.next_cursor, f.value = !!t.meta.next_cursor;
5949
5949
  } catch (n) {
5950
- if (e !== D) return;
5950
+ if (e !== O) return;
5951
5951
  t.onError?.(n);
5952
5952
  } finally {
5953
- e === D && (u.value = !1);
5953
+ e === O && (u.value = !1);
5954
5954
  }
5955
5955
  }
5956
- async function te() {
5956
+ async function ee() {
5957
5957
  if (!f.value || !p.value || u.value) return;
5958
- let e = ++D;
5958
+ let e = ++O;
5959
5959
  u.value = !0;
5960
5960
  try {
5961
5961
  let t = await n.browseMedia({
@@ -5965,26 +5965,26 @@ function Ha(t) {
5965
5965
  sort: l.value === "newest" ? void 0 : l.value,
5966
5966
  cursor: p.value
5967
5967
  });
5968
- if (e !== D) return;
5968
+ if (e !== O) return;
5969
5969
  r.value = [...r.value, ...t.data], p.value = t.meta.next_cursor, f.value = !!t.meta.next_cursor;
5970
5970
  } catch (n) {
5971
- if (e !== D) return;
5971
+ if (e !== O) return;
5972
5972
  t.onError?.(n);
5973
5973
  } finally {
5974
- e === D && (u.value = !1);
5974
+ e === O && (u.value = !1);
5975
5975
  }
5976
5976
  }
5977
- async function ne(e) {
5978
- s.value = e, await O();
5977
+ async function te(e) {
5978
+ s.value = e, await k();
5979
5979
  }
5980
- async function k(e) {
5981
- c.value = e, await O();
5980
+ async function ne(e) {
5981
+ c.value = e, await k();
5982
5982
  }
5983
5983
  async function re(e) {
5984
- l.value = e, await O();
5984
+ l.value = e, await k();
5985
5985
  }
5986
5986
  async function A(e) {
5987
- o.value = "files", a.value = e, s.value = "", h.value = /* @__PURE__ */ new Set(), g.value = null, await O();
5987
+ o.value = "files", a.value = e, s.value = "", h.value = /* @__PURE__ */ new Set(), g.value = null, await k();
5988
5988
  }
5989
5989
  async function ie() {
5990
5990
  o.value = "frequently-used", a.value = null, s.value = "", h.value = /* @__PURE__ */ new Set(), g.value = null, await se();
@@ -6012,7 +6012,8 @@ function Ha(t) {
6012
6012
  total: e.length
6013
6013
  };
6014
6014
  try {
6015
- r.value = [await n.uploadMedia(e[i], a.value), ...r.value];
6015
+ let t = await n.uploadMedia(e[i], a.value);
6016
+ r.value = [t, ...r.value];
6016
6017
  } catch (e) {
6017
6018
  t.onError?.(e);
6018
6019
  }
@@ -6133,7 +6134,7 @@ function Ha(t) {
6133
6134
  async function he(e) {
6134
6135
  try {
6135
6136
  let t = me(i.value, e)?.parent_id ?? null;
6136
- await n.deleteMediaFolder(e), a.value === e && (a.value = t), await pe(), await O();
6137
+ await n.deleteMediaFolder(e), a.value === e && (a.value = t), await pe(), await k();
6137
6138
  } catch (e) {
6138
6139
  t.onError?.(e);
6139
6140
  }
@@ -6141,20 +6142,21 @@ function Ha(t) {
6141
6142
  async function ge(e) {
6142
6143
  E.value = e, w.value = null;
6143
6144
  try {
6144
- ee.value = (await n.checkMediaUsage([e.id])).data[e.id] ?? null, T.value = !0;
6145
+ let t = await n.checkMediaUsage([e.id]);
6146
+ D.value = t.data[e.id] ?? null, T.value = !0;
6145
6147
  } catch (e) {
6146
6148
  t.onError?.(e);
6147
6149
  }
6148
6150
  }
6149
6151
  function _e() {
6150
- T.value = !1, E.value = null, ee.value = null, w.value = null;
6152
+ T.value = !1, E.value = null, D.value = null, w.value = null;
6151
6153
  }
6152
6154
  async function ve(e) {
6153
6155
  if (!E.value) return null;
6154
6156
  C.value = !0, w.value = null;
6155
6157
  try {
6156
6158
  let t = await n.replaceMedia(E.value.id, e);
6157
- return r.value = r.value.map((e) => e.id === t.id ? t : e), _.value = _.value.map((e) => e.id === t.id ? t : e), g.value?.id === t.id && (g.value = t), T.value = !1, E.value = null, ee.value = null, t;
6159
+ return r.value = r.value.map((e) => e.id === t.id ? t : e), _.value = _.value.map((e) => e.id === t.id ? t : e), g.value?.id === t.id && (g.value = t), T.value = !1, E.value = null, D.value = null, t;
6158
6160
  } catch (e) {
6159
6161
  return w.value = e instanceof Error ? e.message : "Replace failed", t.onError?.(e), null;
6160
6162
  } finally {
@@ -6186,10 +6188,10 @@ function Ha(t) {
6186
6188
  frequentlyUsedItems: _,
6187
6189
  deleteUsageInfo: v,
6188
6190
  showDeleteWarning: y,
6189
- loadItems: O,
6190
- loadMore: te,
6191
- search: ne,
6192
- filterByCategory: k,
6191
+ loadItems: k,
6192
+ loadMore: ee,
6193
+ search: te,
6194
+ filterByCategory: ne,
6193
6195
  sortBy: re,
6194
6196
  navigateToFolder: A,
6195
6197
  showFrequentlyUsed: ie,
@@ -6217,7 +6219,7 @@ function Ha(t) {
6217
6219
  replaceError: w,
6218
6220
  showReplaceWarning: T,
6219
6221
  pendingReplaceItem: E,
6220
- replaceUsageInfo: ee,
6222
+ replaceUsageInfo: D,
6221
6223
  checkUsageBeforeReplace: ge,
6222
6224
  cancelReplace: _e,
6223
6225
  replaceFile: ve,
@@ -6270,22 +6272,22 @@ function Ua(t) {
6270
6272
  function E(e) {
6271
6273
  n.selectItem(e);
6272
6274
  }
6273
- async function ee(e, t) {
6275
+ async function D(e, t) {
6274
6276
  await n.createFolder(e, t);
6275
6277
  }
6276
- async function D(e, t) {
6278
+ async function O(e, t) {
6277
6279
  await n.renameFolder(e, t);
6278
6280
  }
6279
- async function O(e) {
6281
+ async function k(e) {
6280
6282
  await n.deleteFolder(e);
6281
6283
  }
6282
- function te(e) {
6284
+ function ee(e) {
6283
6285
  f.value = e;
6284
6286
  }
6285
- async function ne(e, t, r, i) {
6287
+ async function te(e, t, r, i) {
6286
6288
  i && await n.replaceMediaDirectly(e, i.file), await n.updateFile(e, t, r), f.value = null;
6287
6289
  }
6288
- async function k(e) {
6290
+ async function ne(e) {
6289
6291
  await n.importFromUrl(e) && (p.value = !1);
6290
6292
  }
6291
6293
  async function re(e) {
@@ -6321,12 +6323,12 @@ function Ua(t) {
6321
6323
  handleSearchInput: S,
6322
6324
  handleUpload: T,
6323
6325
  handleSelect: E,
6324
- handleCreateFolder: ee,
6325
- handleRenameFolder: D,
6326
- handleDeleteFolder: O,
6327
- handleEditItem: te,
6328
- handleEditSave: ne,
6329
- handleImportFromUrl: k,
6326
+ handleCreateFolder: D,
6327
+ handleRenameFolder: O,
6328
+ handleDeleteFolder: k,
6329
+ handleEditItem: ee,
6330
+ handleEditSave: te,
6331
+ handleImportFromUrl: ne,
6330
6332
  handleMoveToFolder: re,
6331
6333
  handleDeleteClick: A,
6332
6334
  handleReplaceItem: ie,
@@ -6501,7 +6503,7 @@ var Wa = {
6501
6503
  }),
6502
6504
  title: j(b).showSidebar.value ? u.value.mediaLibrary.hideFolders : u.value.mediaLibrary.showFolders,
6503
6505
  onClick: n[1] ||= (e) => j(b).showSidebar.value = !j(b).showSidebar.value
6504
- }, [p(j(ae), {
6506
+ }, [p(j(te), {
6505
6507
  size: 16,
6506
6508
  "stroke-width": 2
6507
6509
  })], 12, to)) : N("", !0),
@@ -6523,7 +6525,7 @@ var Wa = {
6523
6525
  }),
6524
6526
  title: u.value.mediaLibrary.viewGrid,
6525
6527
  onClick: n[2] ||= (e) => j(b).layoutMode.value = "grid"
6526
- }, [p(j(ee), {
6528
+ }, [p(j(A), {
6527
6529
  size: 14,
6528
6530
  "stroke-width": 2
6529
6531
  })], 12, io), i("button", {
@@ -6534,7 +6536,7 @@ var Wa = {
6534
6536
  }),
6535
6537
  title: u.value.mediaLibrary.viewList,
6536
6538
  onClick: n[3] ||= (e) => j(b).layoutMode.value = "list"
6537
- }, [p(j(ne), {
6539
+ }, [p(j(_e), {
6538
6540
  size: 14,
6539
6541
  "stroke-width": 2
6540
6542
  })], 12, ao)])
@@ -6584,7 +6586,7 @@ var Wa = {
6584
6586
  "background-color": "var(--tpl-bg)"
6585
6587
  },
6586
6588
  onClick: n[6] ||= (e) => j(b).showImportUrlModal.value = !0
6587
- }, [p(j(se), {
6589
+ }, [p(j(ne), {
6588
6590
  size: 14,
6589
6591
  "stroke-width": 2
6590
6592
  }), M(" " + L(u.value.mediaLibrary.importFromUrl), 1)])) : N("", !0)])) : N("", !0), p(Vi, {
@@ -6669,7 +6671,7 @@ var Wa = {
6669
6671
  }, [i("div", bo, [
6670
6672
  i("h3", xo, L(u.value.mediaLibrary.deleteWarningTitle), 1),
6671
6673
  i("p", {
6672
- class: O(["tpl:text-xs", j(b).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
6674
+ class: k(["tpl:text-xs", j(b).hasUsedFiles.value ? "tpl:mb-2" : "tpl:mb-4"]),
6673
6675
  style: { color: "var(--tpl-text-muted)" }
6674
6676
  }, L(u.value.mediaLibrary.deleteWarningMessage), 3),
6675
6677
  j(b).hasUsedFiles.value ? (z(), t("p", So, L(u.value.mediaLibrary.deleteWarningUsageNote), 1)) : N("", !0),
@@ -6717,11 +6719,11 @@ var Wa = {
6717
6719
  backgroundColor: "var(--tpl-bg)"
6718
6720
  }),
6719
6721
  onClick: n[13] ||= (e) => j(b).copy(j(b).selectedUrl.value)
6720
- }, [j(b).copied.value ? (z(), h(j(ce), {
6722
+ }, [j(b).copied.value ? (z(), h(j(D), {
6721
6723
  key: 1,
6722
6724
  size: 12,
6723
6725
  "stroke-width": 2
6724
- })) : (z(), h(j(A), {
6726
+ })) : (z(), h(j(ae), {
6725
6727
  key: 0,
6726
6728
  size: 12,
6727
6729
  "stroke-width": 2