@ozguraltan/strapi-content-input 1.0.8 → 1.0.9

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.
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const reactDom = require("react-dom");
6
6
  const cloneDeep = require("lodash/cloneDeep");
7
- const index = require("./index-DV4pLrQl.js");
7
+ const index = require("./index-ysKdDQY1.js");
8
8
  const admin = require("@strapi/strapi/admin");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
@@ -3188,6 +3188,9 @@ const RichHtmlEditor = ({
3188
3188
  const tr = locale === "tr";
3189
3189
  const effectivePlaceholder = placeholder || (tr ? "Metin içeriğinizi buraya yazın..." : "Type your text content here...");
3190
3190
  const { get, post } = admin.useFetchClient();
3191
+ const components = admin.useStrapiApp("RichHtmlEditor", (state) => state.components);
3192
+ const NativeMediaLibraryDialog = components?.["media-library"];
3193
+ const [nativePickerOpen, setNativePickerOpen] = React.useState(false);
3191
3194
  const [sourceMode, setSourceMode] = React.useState(false);
3192
3195
  const editorRef = React.useRef(null);
3193
3196
  const isFocusedRef = React.useRef(false);
@@ -3297,9 +3300,14 @@ const RichHtmlEditor = ({
3297
3300
  setLinkDownload(false);
3298
3301
  setLinkDownloadName("");
3299
3302
  }
3300
- setShowMediaBrowser(openWithMedia);
3301
- if (openWithMedia) {
3302
- loadMediaLibrary();
3303
+ if (openWithMedia && NativeMediaLibraryDialog) {
3304
+ setShowMediaBrowser(false);
3305
+ setNativePickerOpen(true);
3306
+ } else {
3307
+ setShowMediaBrowser(openWithMedia);
3308
+ if (openWithMedia) {
3309
+ loadMediaLibrary();
3310
+ }
3303
3311
  }
3304
3312
  setLinkModalOpen(true);
3305
3313
  };
@@ -3787,7 +3795,7 @@ const RichHtmlEditor = ({
3787
3795
  position: "fixed",
3788
3796
  inset: 0,
3789
3797
  background: "rgba(15, 23, 42, 0.55)",
3790
- zIndex: 11e3,
3798
+ zIndex: 260,
3791
3799
  display: "flex",
3792
3800
  alignItems: "center",
3793
3801
  justifyContent: "center",
@@ -3912,6 +3920,10 @@ const RichHtmlEditor = ({
3912
3920
  {
3913
3921
  type: "button",
3914
3922
  onClick: () => {
3923
+ if (NativeMediaLibraryDialog) {
3924
+ setNativePickerOpen(true);
3925
+ return;
3926
+ }
3915
3927
  const next = !showMediaBrowser;
3916
3928
  setShowMediaBrowser(next);
3917
3929
  if (next && mediaFiles.length === 0) {
@@ -4388,6 +4400,20 @@ const RichHtmlEditor = ({
4388
4400
  }
4389
4401
  ),
4390
4402
  document.body
4403
+ ),
4404
+ nativePickerOpen && NativeMediaLibraryDialog && /* @__PURE__ */ jsxRuntime.jsx(
4405
+ NativeMediaLibraryDialog,
4406
+ {
4407
+ allowedTypes: ["files", "images", "videos", "audios"],
4408
+ multiple: false,
4409
+ onClose: () => setNativePickerOpen(false),
4410
+ onSelectAssets: (selectedAssets) => {
4411
+ if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
4412
+ selectMediaFileForLink(selectedAssets[0]);
4413
+ }
4414
+ setNativePickerOpen(false);
4415
+ }
4416
+ }
4391
4417
  )
4392
4418
  ]
4393
4419
  }
@@ -5358,7 +5384,7 @@ const TabAccordionEditor = ({ widget, onChange }) => {
5358
5384
  style: {
5359
5385
  position: "fixed",
5360
5386
  inset: 0,
5361
- zIndex: 10030,
5387
+ zIndex: 215,
5362
5388
  background: "rgba(15, 23, 42, 0.65)",
5363
5389
  display: "flex",
5364
5390
  alignItems: "center",
@@ -6910,6 +6936,24 @@ function resolveYoutubeVideoId(raw) {
6910
6936
  if (extracted === "dQw4w9WgXcQ") return "M7lc1UVf-VE";
6911
6937
  return extracted;
6912
6938
  }
6939
+ function buildSharpImageUrl(rawUrl, imageSettings) {
6940
+ if (!rawUrl) return "";
6941
+ if (!imageSettings || !imageSettings.process) return rawUrl;
6942
+ const proc = String(imageSettings.process).toLowerCase();
6943
+ if (proc !== "fit" && proc !== "widen") return rawUrl;
6944
+ const w = Number(imageSettings.cWidth) || 0;
6945
+ const h = Number(imageSettings.cHeight) || 0;
6946
+ if (w <= 0 && h <= 0) return rawUrl;
6947
+ if (rawUrl.includes("/api/content-input/image") || rawUrl.includes("/content-input/image")) {
6948
+ return rawUrl;
6949
+ }
6950
+ const params = new URLSearchParams();
6951
+ params.set("src", rawUrl);
6952
+ params.set("process", proc);
6953
+ if (w > 0) params.set("w", String(w));
6954
+ if (proc === "fit" && h > 0) params.set("h", String(h));
6955
+ return `/api/content-input/image?${params.toString()}`;
6956
+ }
6913
6957
  const WidgetPreview = ({
6914
6958
  widget,
6915
6959
  isEditing,
@@ -7159,7 +7203,7 @@ const WidgetPreview = ({
7159
7203
  const imgProcess = imageSettings.process || "";
7160
7204
  const customW = Number(imageSettings.cWidth) || 0;
7161
7205
  const customH = Number(imageSettings.cHeight) || 0;
7162
- const imgObjectFit = imgProcess === "fit" ? "contain" : "cover";
7206
+ const imgObjectFit = "cover";
7163
7207
  if (images.length === 0) {
7164
7208
  return /* @__PURE__ */ jsxRuntime.jsxs(
7165
7209
  "div",
@@ -7197,7 +7241,7 @@ const WidgetPreview = ({
7197
7241
  position: "fixed",
7198
7242
  inset: 0,
7199
7243
  background: "rgba(15, 23, 42, 0.86)",
7200
- zIndex: 11500,
7244
+ zIndex: 280,
7201
7245
  display: "flex",
7202
7246
  alignItems: "center",
7203
7247
  justifyContent: "center",
@@ -7390,7 +7434,7 @@ const WidgetPreview = ({
7390
7434
  children: /* @__PURE__ */ jsxRuntime.jsx(
7391
7435
  "img",
7392
7436
  {
7393
- src: img.target_url || img.url,
7437
+ src: buildSharpImageUrl(img.target_url || img.url, imageSettings),
7394
7438
  alt: img.caption || `${t("widgets.gallery.label")} ${i + 1}`,
7395
7439
  style: {
7396
7440
  width: "100%",
@@ -7420,18 +7464,17 @@ const WidgetPreview = ({
7420
7464
  const itemIndex = (safeIdx + offset) % images.length;
7421
7465
  return { item: images[itemIndex], index: itemIndex };
7422
7466
  });
7423
- const containerHeight = customH > 0 ? Math.min(customH, 380) : 220;
7467
+ const slideAspectRatio = imgProcess === "fit" && customW > 0 && customH > 0 ? `${customW} / ${customH}` : slidesPerView > 1 ? "4 / 3" : "16 / 9";
7424
7468
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7425
7469
  /* @__PURE__ */ jsxRuntime.jsxs(
7426
7470
  "div",
7427
7471
  {
7428
7472
  style: {
7429
7473
  position: "relative",
7474
+ width: "100%",
7430
7475
  borderRadius: 6,
7431
7476
  overflow: "hidden",
7432
7477
  background: "#0f172a",
7433
- height: containerHeight,
7434
- maxWidth: customW > 0 ? `${customW}px` : void 0,
7435
7478
  cursor: grabCursor ? "grab" : isPopupEnabled ? "zoom-in" : "default"
7436
7479
  },
7437
7480
  children: [
@@ -7440,15 +7483,15 @@ const WidgetPreview = ({
7440
7483
  {
7441
7484
  style: {
7442
7485
  display: "grid",
7443
- gridTemplateColumns: `repeat(${slidesPerView}, 1fr)`,
7486
+ gridTemplateColumns: `repeat(${slidesPerView}, minmax(0, 1fr))`,
7444
7487
  gap: spaceBetween,
7445
7488
  width: "100%",
7446
- height: "100%",
7447
7489
  padding: slidesPerView > 1 && spaceBetween > 0 ? 4 : 0,
7448
7490
  boxSizing: "border-box"
7449
7491
  },
7450
7492
  children: visibleSlides.map(({ item, index: index2 }) => {
7451
- const slideUrl = item?.target_url || item?.url || "";
7493
+ const rawSlideUrl = item?.target_url || item?.url || "";
7494
+ const slideUrl = buildSharpImageUrl(rawSlideUrl, imageSettings);
7452
7495
  return /* @__PURE__ */ jsxRuntime.jsx(
7453
7496
  "div",
7454
7497
  {
@@ -7461,7 +7504,7 @@ const WidgetPreview = ({
7461
7504
  style: {
7462
7505
  position: "relative",
7463
7506
  width: "100%",
7464
- height: "100%",
7507
+ aspectRatio: slideAspectRatio,
7465
7508
  overflow: "hidden",
7466
7509
  borderRadius: slidesPerView > 1 ? 4 : 0,
7467
7510
  background: "#1e293b"
@@ -7896,7 +7939,7 @@ const WidgetPreview = ({
7896
7939
  position: "fixed",
7897
7940
  inset: 0,
7898
7941
  background: "rgba(15, 23, 42, 0.82)",
7899
- zIndex: 11500,
7942
+ zIndex: 280,
7900
7943
  display: "flex",
7901
7944
  alignItems: "center",
7902
7945
  justifyContent: "center",
@@ -11476,11 +11519,17 @@ const UnitInput = ({
11476
11519
  function getFileKey(file) {
11477
11520
  return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
11478
11521
  }
11479
- function mapStrapiFileToAsset(file) {
11480
- const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${f.url} ${f.width}w`).join(", ") : "";
11522
+ function mapStrapiFileToAsset(file, cacheBust) {
11523
+ const appendBust = (u) => {
11524
+ if (!u || !cacheBust) return u;
11525
+ const sep = u.includes("?") ? "&" : "?";
11526
+ return `${u}${sep}v=${Date.now()}`;
11527
+ };
11528
+ const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
11529
+ const finalUrl = appendBust(file.url || "");
11481
11530
  return {
11482
- target_url: file.url || "",
11483
- url: file.url || "",
11531
+ target_url: finalUrl,
11532
+ url: finalUrl,
11484
11533
  filename: file.name || file.filename || "media",
11485
11534
  mime_type: file.mime || file.mime_type || "application/octet-stream",
11486
11535
  size: file.size || 0,
@@ -11490,6 +11539,14 @@ function mapStrapiFileToAsset(file) {
11490
11539
  srcset: srcset || void 0
11491
11540
  };
11492
11541
  }
11542
+ const ASPECT_PRESETS = [
11543
+ { label: "Free", ratio: null },
11544
+ { label: "1:1", ratio: 1 },
11545
+ { label: "16:9", ratio: 16 / 9 },
11546
+ { label: "4:3", ratio: 4 / 3 },
11547
+ { label: "3:2", ratio: 3 / 2 },
11548
+ { label: "4:5", ratio: 4 / 5 }
11549
+ ];
11493
11550
  const StrapiMediaPicker = ({
11494
11551
  value,
11495
11552
  onChange,
@@ -11497,16 +11554,43 @@ const StrapiMediaPicker = ({
11497
11554
  multiple = false,
11498
11555
  onSelectMultiple
11499
11556
  }) => {
11500
- const { t } = useEditorTranslator();
11501
- const { get, post } = admin.useFetchClient();
11557
+ const { t, locale } = useEditorTranslator();
11558
+ const tr = locale === "tr";
11559
+ const { get, post, put, del } = admin.useFetchClient();
11502
11560
  const [modalOpen, setModalOpen] = React.useState(false);
11503
11561
  const [files, setFiles] = React.useState([]);
11562
+ const [folders, setFolders] = React.useState([]);
11563
+ const [currentFolderId, setCurrentFolderId] = React.useState(null);
11504
11564
  const [selectedFiles, setSelectedFiles] = React.useState([]);
11505
11565
  const [loading, setLoading] = React.useState(false);
11506
11566
  const [uploading, setUploading] = React.useState(false);
11507
11567
  const [search, setSearch] = React.useState("");
11508
- const [urlInput, setUrlInput] = React.useState(value?.target_url || value?.url || "");
11568
+ const [typeFilter, setTypeFilter] = React.useState("all");
11569
+ const [sortBy, setSortBy] = React.useState(
11570
+ "newest"
11571
+ );
11572
+ const [creatingFolder, setCreatingFolder] = React.useState(false);
11573
+ const [newFolderName, setNewFolderName] = React.useState("");
11574
+ const [editingFile, setEditingFile] = React.useState(null);
11575
+ const [editTab, setEditTab] = React.useState("crop");
11576
+ const [editName, setEditName] = React.useState("");
11577
+ const [editAlt, setEditAlt] = React.useState("");
11578
+ const [editCaption, setEditCaption] = React.useState("");
11579
+ const [editFolderId, setEditFolderId] = React.useState(null);
11580
+ const [savingDetails, setSavingDetails] = React.useState(false);
11581
+ const [naturalSize, setNaturalSize] = React.useState({
11582
+ width: 0,
11583
+ height: 0
11584
+ });
11585
+ const [cropRect, setCropRect] = React.useState({ x: 0, y: 0, width: 100, height: 100 });
11586
+ const [cropRotate, setCropRotate] = React.useState(0);
11587
+ const [aspectPreset, setAspectPreset] = React.useState(null);
11588
+ const [croppingBusy, setCroppingBusy] = React.useState(false);
11589
+ const [cropError, setCropError] = React.useState(null);
11590
+ const cropImgRef = React.useRef(null);
11591
+ const cropBoxRef = React.useRef(null);
11509
11592
  const fileInputRef = React.useRef(null);
11593
+ const [urlInput, setUrlInput] = React.useState(value?.target_url || value?.url || "");
11510
11594
  const effectiveLabel = label !== void 0 ? label : t("media.selectImage", "Select Image");
11511
11595
  React.useEffect(() => {
11512
11596
  setUrlInput(value?.target_url || value?.url || "");
@@ -11516,33 +11600,71 @@ const StrapiMediaPicker = ({
11516
11600
  try {
11517
11601
  const res = await get("/content-input/media");
11518
11602
  const primaryList = Array.isArray(res?.data?.data) ? res.data.data : Array.isArray(res?.data) ? res.data : null;
11603
+ const folderList = Array.isArray(res?.data?.folders) ? res.data.folders : [];
11604
+ if (folderList.length > 0) {
11605
+ setFolders(folderList);
11606
+ }
11519
11607
  if (primaryList) {
11520
11608
  setFiles(primaryList);
11521
- return;
11609
+ setLoading(false);
11610
+ return primaryList;
11522
11611
  }
11523
11612
  } catch {
11524
11613
  }
11525
11614
  try {
11526
- const fallbackRes = await get("/upload/files?pageSize=100&page=1");
11615
+ const fallbackRes = await get("/upload/files?pageSize=200&page=1");
11527
11616
  const fallbackList = Array.isArray(fallbackRes?.data?.results) ? fallbackRes.data.results : Array.isArray(fallbackRes?.data) ? fallbackRes.data : [];
11528
11617
  setFiles(fallbackList);
11618
+ return fallbackList;
11529
11619
  } catch {
11530
11620
  setFiles([]);
11621
+ return [];
11531
11622
  } finally {
11532
11623
  setLoading(false);
11533
11624
  }
11534
11625
  };
11535
- React.useEffect(() => {
11536
- if (!modalOpen) return;
11537
- setLoading(false);
11538
- }, [files, modalOpen]);
11626
+ const openEditorForFile = (file, initialTab = "crop") => {
11627
+ setEditingFile(file);
11628
+ setEditTab(file?.mime?.startsWith("image/") ? initialTab : "details");
11629
+ setEditName(file?.name || "");
11630
+ setEditAlt(file?.alternativeText || "");
11631
+ setEditCaption(file?.caption || "");
11632
+ setEditFolderId(file?.folder?.id ?? file?.folder ?? null);
11633
+ setCropRotate(0);
11634
+ setAspectPreset(null);
11635
+ setCropError(null);
11636
+ const w = Number(file?.width) || 800;
11637
+ const h = Number(file?.height) || 600;
11638
+ setNaturalSize({ width: w, height: h });
11639
+ setCropRect({
11640
+ x: 0,
11641
+ y: 0,
11642
+ width: w,
11643
+ height: h
11644
+ });
11645
+ };
11539
11646
  const handleOpenModal = (e) => {
11540
11647
  e.preventDefault();
11541
11648
  e.stopPropagation();
11542
11649
  setSelectedFiles([]);
11650
+ setEditingFile(null);
11543
11651
  setModalOpen(true);
11544
11652
  loadLibrary().finally(() => setLoading(false));
11545
11653
  };
11654
+ const handleOpenCropCurrent = async (e) => {
11655
+ e.preventDefault();
11656
+ e.stopPropagation();
11657
+ const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
11658
+ if (!currentUrl) return;
11659
+ setModalOpen(true);
11660
+ const loaded = files.length > 0 ? files : await loadLibrary();
11661
+ const match = loaded.find(
11662
+ (f) => f.url && f.url.split("?")[0] === currentUrl || value?.filename && f.name === value.filename
11663
+ );
11664
+ if (match) {
11665
+ openEditorForFile(match, "crop");
11666
+ }
11667
+ };
11546
11668
  const toggleFileSelection = (file) => {
11547
11669
  const key = getFileKey(file);
11548
11670
  setSelectedFiles((prev) => {
@@ -11555,7 +11677,7 @@ const StrapiMediaPicker = ({
11555
11677
  };
11556
11678
  const handleConfirmMultiple = () => {
11557
11679
  if (selectedFiles.length === 0) return;
11558
- const assets = selectedFiles.map(mapStrapiFileToAsset);
11680
+ const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
11559
11681
  if (onSelectMultiple) {
11560
11682
  onSelectMultiple(assets);
11561
11683
  } else {
@@ -11573,19 +11695,26 @@ const StrapiMediaPicker = ({
11573
11695
  for (let i = 0; i < inputFiles.length; i++) {
11574
11696
  formData.append("files", inputFiles[i]);
11575
11697
  }
11698
+ if (currentFolderId) {
11699
+ formData.append("fileInfo", JSON.stringify({ folder: currentFolderId }));
11700
+ }
11576
11701
  const res = await post("/upload", formData);
11577
11702
  const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
11578
11703
  await loadLibrary();
11579
11704
  if (uploadedList.length > 0) {
11580
- if (multiple) {
11581
- const assets = uploadedList.map(mapStrapiFileToAsset);
11582
- if (onSelectMultiple) {
11583
- onSelectMultiple(assets);
11705
+ if (!modalOpen) {
11706
+ if (multiple) {
11707
+ const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
11708
+ if (onSelectMultiple) {
11709
+ onSelectMultiple(assets);
11710
+ } else {
11711
+ assets.forEach((a) => onChange(a));
11712
+ }
11584
11713
  } else {
11585
- assets.forEach((a) => onChange(a));
11714
+ onChange(mapStrapiFileToAsset(uploadedList[0]));
11586
11715
  }
11587
- setSelectedFiles([]);
11588
- setModalOpen(false);
11716
+ } else if (multiple) {
11717
+ setSelectedFiles((prev) => [...prev, ...uploadedList]);
11589
11718
  } else {
11590
11719
  onChange(mapStrapiFileToAsset(uploadedList[0]));
11591
11720
  setModalOpen(false);
@@ -11598,6 +11727,175 @@ const StrapiMediaPicker = ({
11598
11727
  if (fileInputRef.current) fileInputRef.current.value = "";
11599
11728
  }
11600
11729
  };
11730
+ const handleCreateFolder = async () => {
11731
+ const trimmed = newFolderName.trim();
11732
+ if (!trimmed) return;
11733
+ try {
11734
+ const res = await post("/content-input/media/folder", {
11735
+ name: trimmed,
11736
+ parent: currentFolderId
11737
+ });
11738
+ const created = res?.data?.data || res?.data;
11739
+ setNewFolderName("");
11740
+ setCreatingFolder(false);
11741
+ await loadLibrary();
11742
+ if (created?.id) {
11743
+ setCurrentFolderId(Number(created.id));
11744
+ }
11745
+ } catch {
11746
+ }
11747
+ };
11748
+ const handleSaveDetails = async () => {
11749
+ if (!editingFile?.id) return;
11750
+ setSavingDetails(true);
11751
+ try {
11752
+ const res = await put(`/content-input/media/${editingFile.id}`, {
11753
+ name: editName.trim() || editingFile.name,
11754
+ alternativeText: editAlt,
11755
+ caption: editCaption,
11756
+ folder: editFolderId
11757
+ });
11758
+ const updated = res?.data?.data || res?.data;
11759
+ await loadLibrary();
11760
+ if (updated) {
11761
+ setEditingFile(updated);
11762
+ }
11763
+ } catch {
11764
+ } finally {
11765
+ setSavingDetails(false);
11766
+ }
11767
+ };
11768
+ const handleDeleteAsset = async (file, e) => {
11769
+ if (e) {
11770
+ e.preventDefault();
11771
+ e.stopPropagation();
11772
+ }
11773
+ if (!file?.id) return;
11774
+ const confirmMsg = tr ? `"${file.name}" dosyasını Strapi Medya Kütüphanesinden kalıcı olarak silmek istediğinize emin misiniz?` : `Are you sure you want to permanently delete "${file.name}" from the Strapi Media Library?`;
11775
+ if (typeof window !== "undefined" && !window.confirm(confirmMsg)) return;
11776
+ try {
11777
+ await del(`/content-input/media/${file.id}`);
11778
+ setSelectedFiles((prev) => prev.filter((f) => getFileKey(f) !== getFileKey(file)));
11779
+ if (editingFile?.id === file.id) {
11780
+ setEditingFile(null);
11781
+ }
11782
+ await loadLibrary();
11783
+ } catch {
11784
+ }
11785
+ };
11786
+ const handleExecuteCrop = async (mode) => {
11787
+ if (!editingFile?.id) return;
11788
+ setCroppingBusy(true);
11789
+ setCropError(null);
11790
+ try {
11791
+ const res = await post("/content-input/media/crop", {
11792
+ id: editingFile.id,
11793
+ mode,
11794
+ x: Math.round(cropRect.x),
11795
+ y: Math.round(cropRect.y),
11796
+ width: Math.round(cropRect.width),
11797
+ height: Math.round(cropRect.height),
11798
+ rotate: cropRotate,
11799
+ name: editName.trim() || editingFile.name,
11800
+ alternativeText: editAlt,
11801
+ caption: editCaption
11802
+ });
11803
+ const resultFile = res?.data?.data || res?.data;
11804
+ await loadLibrary();
11805
+ if (resultFile) {
11806
+ const mapped = mapStrapiFileToAsset(resultFile, true);
11807
+ if (multiple && onSelectMultiple) {
11808
+ onSelectMultiple([mapped]);
11809
+ } else {
11810
+ onChange(mapped);
11811
+ }
11812
+ setEditingFile(null);
11813
+ setModalOpen(false);
11814
+ }
11815
+ } catch (err) {
11816
+ setCropError(err?.message || (tr ? "Kırpma işlemi başarısız oldu" : "Crop operation failed"));
11817
+ } finally {
11818
+ setCroppingBusy(false);
11819
+ }
11820
+ };
11821
+ const applyAspectPreset = (ratio) => {
11822
+ setAspectPreset(ratio);
11823
+ if (!ratio || !naturalSize.width || !naturalSize.height) return;
11824
+ let newW = naturalSize.width;
11825
+ let newH = Math.round(newW / ratio);
11826
+ if (newH > naturalSize.height) {
11827
+ newH = naturalSize.height;
11828
+ newW = Math.round(newH * ratio);
11829
+ }
11830
+ const newX = Math.max(0, Math.round((naturalSize.width - newW) / 2));
11831
+ const newY = Math.max(0, Math.round((naturalSize.height - newH) / 2));
11832
+ setCropRect({ x: newX, y: newY, width: newW, height: newH });
11833
+ };
11834
+ const startCropDrag = (e, dragType) => {
11835
+ e.preventDefault();
11836
+ e.stopPropagation();
11837
+ const container = cropBoxRef.current;
11838
+ if (!container || !naturalSize.width || !naturalSize.height) return;
11839
+ const bounds = container.getBoundingClientRect();
11840
+ if (!bounds.width || !bounds.height) return;
11841
+ const scaleX = naturalSize.width / bounds.width;
11842
+ const scaleY = naturalSize.height / bounds.height;
11843
+ const startClientX = e.clientX;
11844
+ const startClientY = e.clientY;
11845
+ const initial = { ...cropRect };
11846
+ const onMove = (ev) => {
11847
+ const dx = (ev.clientX - startClientX) * scaleX;
11848
+ const dy = (ev.clientY - startClientY) * scaleY;
11849
+ if (dragType === "move") {
11850
+ const nextX = Math.max(
11851
+ 0,
11852
+ Math.min(naturalSize.width - initial.width, Math.round(initial.x + dx))
11853
+ );
11854
+ const nextY = Math.max(
11855
+ 0,
11856
+ Math.min(naturalSize.height - initial.height, Math.round(initial.y + dy))
11857
+ );
11858
+ setCropRect({ ...initial, x: nextX, y: nextY });
11859
+ return;
11860
+ }
11861
+ let x = initial.x;
11862
+ let y = initial.y;
11863
+ let w = initial.width;
11864
+ let h = initial.height;
11865
+ if (dragType.includes("e")) {
11866
+ w = Math.max(20, Math.min(naturalSize.width - x, Math.round(initial.width + dx)));
11867
+ }
11868
+ if (dragType.includes("s")) {
11869
+ h = Math.max(20, Math.min(naturalSize.height - y, Math.round(initial.height + dy)));
11870
+ }
11871
+ if (dragType.includes("w")) {
11872
+ const maxDx = initial.width - 20;
11873
+ const clampedDx = Math.max(-initial.x, Math.min(maxDx, Math.round(dx)));
11874
+ x = initial.x + clampedDx;
11875
+ w = initial.width - clampedDx;
11876
+ }
11877
+ if (dragType.includes("n")) {
11878
+ const maxDy = initial.height - 20;
11879
+ const clampedDy = Math.max(-initial.y, Math.min(maxDy, Math.round(dy)));
11880
+ y = initial.y + clampedDy;
11881
+ h = initial.height - clampedDy;
11882
+ }
11883
+ if (aspectPreset) {
11884
+ h = Math.round(w / aspectPreset);
11885
+ if (y + h > naturalSize.height) {
11886
+ h = naturalSize.height - y;
11887
+ w = Math.round(h * aspectPreset);
11888
+ }
11889
+ }
11890
+ setCropRect({ x, y, width: Math.max(16, w), height: Math.max(16, h) });
11891
+ };
11892
+ const onUp = () => {
11893
+ window.removeEventListener("mousemove", onMove);
11894
+ window.removeEventListener("mouseup", onUp);
11895
+ };
11896
+ window.addEventListener("mousemove", onMove);
11897
+ window.addEventListener("mouseup", onUp);
11898
+ };
11601
11899
  const handleUrlApply = () => {
11602
11900
  const trimmed = urlInput.trim();
11603
11901
  if (!trimmed) {
@@ -11633,9 +11931,39 @@ const StrapiMediaPicker = ({
11633
11931
  };
11634
11932
  const previewUrl = value?.target_url || value?.url || "";
11635
11933
  const q = search.trim().toLowerCase();
11636
- const filteredFiles = files.filter(
11637
- (f) => !q || (f.name || "").toLowerCase().includes(q) || (f.ext || "").toLowerCase().includes(q) || (f.mime || "").toLowerCase().includes(q)
11638
- );
11934
+ const visibleFolders = folders.filter((fld) => {
11935
+ const parentId = fld.parent?.id ?? fld.parent ?? null;
11936
+ return parentId === currentFolderId;
11937
+ });
11938
+ const currentFolderObj = currentFolderId !== null ? folders.find((f) => Number(f.id) === currentFolderId) : null;
11939
+ const filteredFiles = files.filter((f) => {
11940
+ if (!q && currentFolderId !== null) {
11941
+ const fileFolderId = f.folder?.id ?? f.folder ?? null;
11942
+ if (Number(fileFolderId) !== currentFolderId) return false;
11943
+ }
11944
+ if (typeFilter === "image" && !f.mime?.startsWith("image/")) return false;
11945
+ if (typeFilter === "video" && !f.mime?.startsWith("video/")) return false;
11946
+ if (typeFilter === "audio" && !f.mime?.startsWith("audio/")) return false;
11947
+ if (typeFilter === "doc" && (f.mime?.startsWith("image/") || f.mime?.startsWith("video/") || f.mime?.startsWith("audio/"))) {
11948
+ return false;
11949
+ }
11950
+ if (!q) return true;
11951
+ return (f.name || "").toLowerCase().includes(q) || (f.alternativeText || "").toLowerCase().includes(q) || (f.caption || "").toLowerCase().includes(q) || (f.ext || "").toLowerCase().includes(q) || (f.mime || "").toLowerCase().includes(q);
11952
+ }).sort((a, b) => {
11953
+ if (sortBy === "oldest") {
11954
+ return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime();
11955
+ }
11956
+ if (sortBy === "nameAsc") {
11957
+ return String(a.name || "").localeCompare(String(b.name || ""));
11958
+ }
11959
+ if (sortBy === "nameDesc") {
11960
+ return String(b.name || "").localeCompare(String(a.name || ""));
11961
+ }
11962
+ if (sortBy === "sizeDesc") {
11963
+ return (Number(b.size) || 0) - (Number(a.size) || 0);
11964
+ }
11965
+ return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime();
11966
+ });
11639
11967
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
11640
11968
  effectiveLabel && /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 12, fontWeight: 600, color: "#475569" }, children: effectiveLabel }),
11641
11969
  previewUrl ? /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11681,7 +12009,7 @@ const StrapiMediaPicker = ({
11681
12009
  children: value?.filename || t("common.image", "Image")
11682
12010
  }
11683
12011
  ),
11684
- /* @__PURE__ */ jsxRuntime.jsx(
12012
+ /* @__PURE__ */ jsxRuntime.jsxs(
11685
12013
  "div",
11686
12014
  {
11687
12015
  style: {
@@ -11691,10 +12019,33 @@ const StrapiMediaPicker = ({
11691
12019
  textOverflow: "ellipsis",
11692
12020
  whiteSpace: "nowrap"
11693
12021
  },
11694
- children: previewUrl
12022
+ children: [
12023
+ value?.width && value?.height ? `${value.width}×${value.height} · ` : "",
12024
+ previewUrl
12025
+ ]
11695
12026
  }
11696
12027
  )
11697
12028
  ] }),
12029
+ /* @__PURE__ */ jsxRuntime.jsx(
12030
+ "button",
12031
+ {
12032
+ type: "button",
12033
+ onClick: handleOpenCropCurrent,
12034
+ title: tr ? "Görseli Kırp / Düzenle" : "Crop / Edit Image",
12035
+ style: {
12036
+ border: "1px solid #cbd5e1",
12037
+ borderRadius: 4,
12038
+ background: "#ffffff",
12039
+ color: "#2669a0",
12040
+ cursor: "pointer",
12041
+ padding: 4,
12042
+ display: "inline-flex",
12043
+ alignItems: "center",
12044
+ justifyContent: "center"
12045
+ },
12046
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "crop", size: 15, color: "#2669a0" })
12047
+ }
12048
+ ),
11698
12049
  /* @__PURE__ */ jsxRuntime.jsx(
11699
12050
  "button",
11700
12051
  {
@@ -11743,6 +12094,44 @@ const StrapiMediaPicker = ({
11743
12094
  }
11744
12095
  }
11745
12096
  ),
12097
+ /* @__PURE__ */ jsxRuntime.jsx(
12098
+ "input",
12099
+ {
12100
+ ref: fileInputRef,
12101
+ type: "file",
12102
+ multiple,
12103
+ onChange: handleFileUpload,
12104
+ style: { display: "none" }
12105
+ }
12106
+ ),
12107
+ /* @__PURE__ */ jsxRuntime.jsx(
12108
+ "button",
12109
+ {
12110
+ type: "button",
12111
+ disabled: uploading,
12112
+ onClick: (e) => {
12113
+ e.preventDefault();
12114
+ e.stopPropagation();
12115
+ fileInputRef.current?.click();
12116
+ },
12117
+ title: t("media.uploadNew", "Upload New File(s)"),
12118
+ style: {
12119
+ display: "inline-flex",
12120
+ alignItems: "center",
12121
+ justifyContent: "center",
12122
+ padding: "6px 9px",
12123
+ fontSize: 12,
12124
+ fontWeight: 600,
12125
+ background: "#ffffff",
12126
+ color: "#2669a0",
12127
+ border: "1px solid #cbd5e1",
12128
+ borderRadius: 5,
12129
+ cursor: uploading ? "wait" : "pointer",
12130
+ whiteSpace: "nowrap"
12131
+ },
12132
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 16, color: "#2669a0" })
12133
+ }
12134
+ ),
11746
12135
  /* @__PURE__ */ jsxRuntime.jsxs(
11747
12136
  "button",
11748
12137
  {
@@ -11777,27 +12166,31 @@ const StrapiMediaPicker = ({
11777
12166
  style: {
11778
12167
  position: "fixed",
11779
12168
  inset: 0,
11780
- background: "rgba(15, 23, 42, 0.6)",
11781
- zIndex: 11e3,
12169
+ background: "rgba(15, 23, 42, 0.65)",
12170
+ zIndex: 310,
11782
12171
  display: "flex",
11783
12172
  alignItems: "center",
11784
12173
  justifyContent: "center",
11785
- padding: 24
12174
+ padding: 20
11786
12175
  },
11787
12176
  onClick: (e) => {
11788
12177
  e.stopPropagation();
11789
- setModalOpen(false);
12178
+ if (editingFile) {
12179
+ setEditingFile(null);
12180
+ } else {
12181
+ setModalOpen(false);
12182
+ }
11790
12183
  },
11791
12184
  children: /* @__PURE__ */ jsxRuntime.jsxs(
11792
12185
  "div",
11793
12186
  {
11794
12187
  style: {
11795
12188
  width: "100%",
11796
- maxWidth: 780,
11797
- maxHeight: "84vh",
12189
+ maxWidth: 960,
12190
+ height: "min(720px, 90vh)",
11798
12191
  background: "#fff",
11799
- borderRadius: 8,
11800
- boxShadow: "0 24px 48px rgba(0,0,0,0.3)",
12192
+ borderRadius: 10,
12193
+ boxShadow: "0 24px 56px rgba(0,0,0,0.35)",
11801
12194
  display: "flex",
11802
12195
  flexDirection: "column",
11803
12196
  overflow: "hidden"
@@ -11814,86 +12207,125 @@ const StrapiMediaPicker = ({
11814
12207
  padding: "12px 18px",
11815
12208
  borderBottom: "1px solid #e2e8f0",
11816
12209
  background: "#f8fafc",
11817
- gap: 10
12210
+ gap: 10,
12211
+ flexWrap: "wrap"
11818
12212
  },
11819
12213
  children: [
11820
12214
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
11821
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
11822
- /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { fontSize: 14, color: "#0f172a" }, children: [
11823
- t("media.libraryTitle", "Strapi Media Library"),
11824
- " (",
11825
- files.length,
11826
- " ",
11827
- t("media.filesCount", "files"),
11828
- ")"
11829
- ] })
11830
- ] }),
11831
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
11832
- /* @__PURE__ */ jsxRuntime.jsxs(
12215
+ editingFile ? /* @__PURE__ */ jsxRuntime.jsxs(
11833
12216
  "button",
11834
12217
  {
11835
12218
  type: "button",
11836
- onClick: () => loadLibrary().finally(() => setLoading(false)),
11837
- title: t("media.refresh", "Refresh"),
12219
+ onClick: () => setEditingFile(null),
11838
12220
  style: {
11839
12221
  display: "inline-flex",
11840
12222
  alignItems: "center",
11841
12223
  gap: 4,
11842
- padding: "6px 10px",
12224
+ padding: "4px 8px",
12225
+ borderRadius: 5,
12226
+ border: "1px solid #cbd5e1",
11843
12227
  background: "#ffffff",
11844
12228
  color: "#334155",
11845
- border: "1px solid #cbd5e1",
11846
- borderRadius: 5,
11847
12229
  fontSize: 12,
11848
12230
  fontWeight: 600,
11849
12231
  cursor: "pointer"
11850
12232
  },
11851
12233
  children: [
11852
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "refresh", size: 15 }),
11853
- t("media.refresh", "Refresh")
12234
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "arrow_back", size: 15 }),
12235
+ tr ? "Kütüphaneye Dön" : "Back to Library"
11854
12236
  ]
11855
12237
  }
11856
- ),
12238
+ ) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
12239
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { style: { fontSize: 14, color: "#0f172a" }, children: editingFile ? `${tr ? "Görsel Düzenle & Kırp" : "Edit & Crop Asset"}: ${editingFile.name}` : `${t("media.libraryTitle", "Strapi Media Library")} (${filteredFiles.length} ${t(
12240
+ "media.filesCount",
12241
+ "files"
12242
+ )})` })
12243
+ ] }),
12244
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
12245
+ !editingFile && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12246
+ /* @__PURE__ */ jsxRuntime.jsxs(
12247
+ "button",
12248
+ {
12249
+ type: "button",
12250
+ onClick: () => setCreatingFolder((v) => !v),
12251
+ style: {
12252
+ display: "inline-flex",
12253
+ alignItems: "center",
12254
+ gap: 4,
12255
+ padding: "6px 10px",
12256
+ background: "#ffffff",
12257
+ color: "#334155",
12258
+ border: "1px solid #cbd5e1",
12259
+ borderRadius: 5,
12260
+ fontSize: 12,
12261
+ fontWeight: 600,
12262
+ cursor: "pointer"
12263
+ },
12264
+ children: [
12265
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "create_new_folder", size: 15, color: "#2669a0" }),
12266
+ tr ? "Yeni Klasör" : "New Folder"
12267
+ ]
12268
+ }
12269
+ ),
12270
+ /* @__PURE__ */ jsxRuntime.jsxs(
12271
+ "button",
12272
+ {
12273
+ type: "button",
12274
+ onClick: () => loadLibrary().finally(() => setLoading(false)),
12275
+ title: t("media.refresh", "Refresh"),
12276
+ style: {
12277
+ display: "inline-flex",
12278
+ alignItems: "center",
12279
+ gap: 4,
12280
+ padding: "6px 10px",
12281
+ background: "#ffffff",
12282
+ color: "#334155",
12283
+ border: "1px solid #cbd5e1",
12284
+ borderRadius: 5,
12285
+ fontSize: 12,
12286
+ fontWeight: 600,
12287
+ cursor: "pointer"
12288
+ },
12289
+ children: [
12290
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "refresh", size: 15 }),
12291
+ t("media.refresh", "Refresh")
12292
+ ]
12293
+ }
12294
+ ),
12295
+ /* @__PURE__ */ jsxRuntime.jsxs(
12296
+ "button",
12297
+ {
12298
+ type: "button",
12299
+ disabled: uploading,
12300
+ onClick: () => fileInputRef.current?.click(),
12301
+ style: {
12302
+ display: "inline-flex",
12303
+ alignItems: "center",
12304
+ gap: 5,
12305
+ padding: "6px 12px",
12306
+ background: "#2669a0",
12307
+ color: "#fff",
12308
+ border: "none",
12309
+ borderRadius: 5,
12310
+ fontSize: 12,
12311
+ fontWeight: 600,
12312
+ cursor: "pointer"
12313
+ },
12314
+ children: [
12315
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
12316
+ uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File(s)")
12317
+ ]
12318
+ }
12319
+ )
12320
+ ] }),
11857
12321
  /* @__PURE__ */ jsxRuntime.jsx(
11858
- "input",
11859
- {
11860
- ref: fileInputRef,
11861
- type: "file",
11862
- multiple: true,
11863
- onChange: handleFileUpload,
11864
- style: { display: "none" }
11865
- }
11866
- ),
11867
- /* @__PURE__ */ jsxRuntime.jsxs(
11868
12322
  "button",
11869
12323
  {
11870
12324
  type: "button",
11871
- disabled: uploading,
11872
- onClick: () => fileInputRef.current?.click(),
11873
- style: {
11874
- display: "inline-flex",
11875
- alignItems: "center",
11876
- gap: 5,
11877
- padding: "6px 12px",
11878
- background: "#2669a0",
11879
- color: "#fff",
11880
- border: "none",
11881
- borderRadius: 5,
11882
- fontSize: 12,
11883
- fontWeight: 600,
11884
- cursor: "pointer"
12325
+ onClick: () => {
12326
+ setEditingFile(null);
12327
+ setModalOpen(false);
11885
12328
  },
11886
- children: [
11887
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
11888
- uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File")
11889
- ]
11890
- }
11891
- ),
11892
- /* @__PURE__ */ jsxRuntime.jsx(
11893
- "button",
11894
- {
11895
- type: "button",
11896
- onClick: () => setModalOpen(false),
11897
12329
  style: {
11898
12330
  border: "none",
11899
12331
  background: "transparent",
@@ -11908,329 +12340,1258 @@ const StrapiMediaPicker = ({
11908
12340
  ]
11909
12341
  }
11910
12342
  ),
11911
- /* @__PURE__ */ jsxRuntime.jsxs(
11912
- "div",
11913
- {
11914
- style: {
11915
- padding: "10px 18px",
11916
- borderBottom: "1px solid #f1f5f9",
11917
- display: "flex",
11918
- alignItems: "center",
11919
- gap: 8
11920
- },
11921
- children: [
11922
- /* @__PURE__ */ jsxRuntime.jsx(
11923
- "input",
11924
- {
11925
- type: "text",
11926
- value: search,
11927
- onChange: (e) => setSearch(e.target.value),
11928
- placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
11929
- style: {
11930
- flex: 1,
11931
- padding: "7px 10px",
11932
- fontSize: 12,
11933
- border: "1px solid #cbd5e1",
11934
- borderRadius: 5
11935
- }
11936
- }
11937
- ),
11938
- multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11939
- /* @__PURE__ */ jsxRuntime.jsx(
11940
- "button",
12343
+ editingFile ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flex: 1, minHeight: 0, overflow: "hidden" }, children: [
12344
+ /* @__PURE__ */ jsxRuntime.jsxs(
12345
+ "div",
12346
+ {
12347
+ style: {
12348
+ flex: 1,
12349
+ background: "repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%) 50% / 20px 20px",
12350
+ display: "flex",
12351
+ flexDirection: "column",
12352
+ minWidth: 0,
12353
+ borderRight: "1px solid #e2e8f0"
12354
+ },
12355
+ children: [
12356
+ editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxRuntime.jsxs(
12357
+ "div",
11941
12358
  {
11942
- type: "button",
11943
- onClick: () => {
11944
- const existingKeys = new Set(selectedFiles.map(getFileKey));
11945
- const additions = filteredFiles.filter(
11946
- (f) => !existingKeys.has(getFileKey(f))
11947
- );
11948
- setSelectedFiles([...selectedFiles, ...additions]);
11949
- },
11950
12359
  style: {
11951
- padding: "6px 10px",
11952
- fontSize: 11,
11953
- fontWeight: 600,
11954
- border: "1px solid #cbd5e1",
11955
- borderRadius: 5,
12360
+ display: "flex",
12361
+ alignItems: "center",
12362
+ justifyContent: "space-between",
12363
+ padding: "8px 14px",
11956
12364
  background: "#ffffff",
11957
- color: "#334155",
11958
- cursor: "pointer",
11959
- whiteSpace: "nowrap"
12365
+ borderBottom: "1px solid #e2e8f0",
12366
+ gap: 8,
12367
+ flexWrap: "wrap"
11960
12368
  },
11961
- children: t("selectAllVisible", "Select All")
12369
+ children: [
12370
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
12371
+ /* @__PURE__ */ jsxRuntime.jsx(
12372
+ "span",
12373
+ {
12374
+ style: {
12375
+ fontSize: 11,
12376
+ fontWeight: 700,
12377
+ color: "#475569",
12378
+ marginRight: 4
12379
+ },
12380
+ children: tr ? "En-Boy Oranı:" : "Aspect Ratio:"
12381
+ }
12382
+ ),
12383
+ ASPECT_PRESETS.map((preset) => {
12384
+ const active = aspectPreset === preset.ratio;
12385
+ return /* @__PURE__ */ jsxRuntime.jsx(
12386
+ "button",
12387
+ {
12388
+ type: "button",
12389
+ onClick: () => applyAspectPreset(preset.ratio),
12390
+ style: {
12391
+ padding: "4px 8px",
12392
+ fontSize: 11,
12393
+ fontWeight: 600,
12394
+ borderRadius: 4,
12395
+ border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
12396
+ background: active ? "#2669a0" : "#ffffff",
12397
+ color: active ? "#ffffff" : "#334155",
12398
+ cursor: "pointer"
12399
+ },
12400
+ children: preset.label === "Free" ? tr ? "Serbest" : "Free" : preset.label
12401
+ },
12402
+ preset.label
12403
+ );
12404
+ })
12405
+ ] }),
12406
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
12407
+ /* @__PURE__ */ jsxRuntime.jsxs(
12408
+ "button",
12409
+ {
12410
+ type: "button",
12411
+ onClick: () => setCropRotate((r) => (r - 90 + 360) % 360),
12412
+ title: tr ? "Sola Döndür (-90°)" : "Rotate Left (-90°)",
12413
+ style: {
12414
+ display: "inline-flex",
12415
+ alignItems: "center",
12416
+ gap: 3,
12417
+ padding: "4px 8px",
12418
+ fontSize: 11,
12419
+ fontWeight: 600,
12420
+ border: "1px solid #cbd5e1",
12421
+ borderRadius: 4,
12422
+ background: "#fff",
12423
+ color: "#334155",
12424
+ cursor: "pointer"
12425
+ },
12426
+ children: [
12427
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "rotate_left", size: 15 }),
12428
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-90°" })
12429
+ ]
12430
+ }
12431
+ ),
12432
+ /* @__PURE__ */ jsxRuntime.jsxs(
12433
+ "button",
12434
+ {
12435
+ type: "button",
12436
+ onClick: () => setCropRotate((r) => (r + 90) % 360),
12437
+ title: tr ? "Sağa Döndür (+90°)" : "Rotate Right (+90°)",
12438
+ style: {
12439
+ display: "inline-flex",
12440
+ alignItems: "center",
12441
+ gap: 3,
12442
+ padding: "4px 8px",
12443
+ fontSize: 11,
12444
+ fontWeight: 600,
12445
+ border: "1px solid #cbd5e1",
12446
+ borderRadius: 4,
12447
+ background: "#fff",
12448
+ color: "#334155",
12449
+ cursor: "pointer"
12450
+ },
12451
+ children: [
12452
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "rotate_right", size: 15 }),
12453
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "+90°" })
12454
+ ]
12455
+ }
12456
+ ),
12457
+ /* @__PURE__ */ jsxRuntime.jsx(
12458
+ "button",
12459
+ {
12460
+ type: "button",
12461
+ onClick: () => {
12462
+ setCropRotate(0);
12463
+ setAspectPreset(null);
12464
+ setCropRect({
12465
+ x: 0,
12466
+ y: 0,
12467
+ width: naturalSize.width,
12468
+ height: naturalSize.height
12469
+ });
12470
+ },
12471
+ style: {
12472
+ padding: "4px 8px",
12473
+ fontSize: 11,
12474
+ fontWeight: 600,
12475
+ border: "1px solid #cbd5e1",
12476
+ borderRadius: 4,
12477
+ background: "#fff",
12478
+ color: "#64748b",
12479
+ cursor: "pointer"
12480
+ },
12481
+ children: tr ? "Sıfırla" : "Reset"
12482
+ }
12483
+ )
12484
+ ] })
12485
+ ]
11962
12486
  }
11963
12487
  ),
11964
- selectedFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
11965
- "button",
12488
+ /* @__PURE__ */ jsxRuntime.jsx(
12489
+ "div",
11966
12490
  {
11967
- type: "button",
11968
- onClick: () => setSelectedFiles([]),
11969
12491
  style: {
11970
- padding: "6px 10px",
11971
- fontSize: 11,
11972
- fontWeight: 600,
11973
- border: "1px solid #fecaca",
11974
- borderRadius: 5,
11975
- background: "#fef2f2",
11976
- color: "#dc2626",
11977
- cursor: "pointer",
11978
- whiteSpace: "nowrap"
12492
+ flex: 1,
12493
+ display: "flex",
12494
+ alignItems: "center",
12495
+ justifyContent: "center",
12496
+ padding: 24,
12497
+ overflow: "hidden",
12498
+ position: "relative"
12499
+ },
12500
+ children: editingFile.mime?.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsxs(
12501
+ "div",
12502
+ {
12503
+ ref: cropBoxRef,
12504
+ style: {
12505
+ position: "relative",
12506
+ display: "inline-block",
12507
+ maxWidth: "100%",
12508
+ maxHeight: "100%",
12509
+ boxShadow: "0 8px 24px rgba(15, 23, 42, 0.2)",
12510
+ userSelect: "none"
12511
+ },
12512
+ children: [
12513
+ /* @__PURE__ */ jsxRuntime.jsx(
12514
+ "img",
12515
+ {
12516
+ ref: cropImgRef,
12517
+ src: editingFile.url,
12518
+ alt: editingFile.name,
12519
+ onLoad: (e) => {
12520
+ const img = e.currentTarget;
12521
+ const nw = img.naturalWidth || editingFile.width || 800;
12522
+ const nh = img.naturalHeight || editingFile.height || 600;
12523
+ setNaturalSize({ width: nw, height: nh });
12524
+ setCropRect({ x: 0, y: 0, width: nw, height: nh });
12525
+ },
12526
+ style: {
12527
+ display: "block",
12528
+ maxWidth: "540px",
12529
+ maxHeight: "440px",
12530
+ width: "auto",
12531
+ height: "auto",
12532
+ transform: cropRotate ? `rotate(${cropRotate}deg)` : void 0,
12533
+ pointerEvents: "none"
12534
+ }
12535
+ }
12536
+ ),
12537
+ naturalSize.width > 0 && naturalSize.height > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
12538
+ "div",
12539
+ {
12540
+ onMouseDown: (e) => startCropDrag(e, "move"),
12541
+ style: {
12542
+ position: "absolute",
12543
+ left: `${cropRect.x / naturalSize.width * 100}%`,
12544
+ top: `${cropRect.y / naturalSize.height * 100}%`,
12545
+ width: `${cropRect.width / naturalSize.width * 100}%`,
12546
+ height: `${cropRect.height / naturalSize.height * 100}%`,
12547
+ border: "2px dashed #38bdf8",
12548
+ boxShadow: "0 0 0 9999px rgba(15, 23, 42, 0.55)",
12549
+ cursor: "move",
12550
+ boxSizing: "border-box"
12551
+ },
12552
+ children: [
12553
+ /* @__PURE__ */ jsxRuntime.jsxs(
12554
+ "div",
12555
+ {
12556
+ style: {
12557
+ position: "absolute",
12558
+ top: 6,
12559
+ left: 6,
12560
+ background: "rgba(15, 23, 42, 0.85)",
12561
+ color: "#ffffff",
12562
+ fontSize: 10,
12563
+ fontWeight: 700,
12564
+ padding: "2px 6px",
12565
+ borderRadius: 4,
12566
+ pointerEvents: "none",
12567
+ whiteSpace: "nowrap"
12568
+ },
12569
+ children: [
12570
+ Math.round(cropRect.width),
12571
+ " × ",
12572
+ Math.round(cropRect.height),
12573
+ " px"
12574
+ ]
12575
+ }
12576
+ ),
12577
+ [
12578
+ { pos: "nw", top: -6, left: -6, cursor: "nwse-resize" },
12579
+ { pos: "ne", top: -6, right: -6, cursor: "nesw-resize" },
12580
+ { pos: "sw", bottom: -6, left: -6, cursor: "nesw-resize" },
12581
+ { pos: "se", bottom: -6, right: -6, cursor: "nwse-resize" }
12582
+ ].map((h) => /* @__PURE__ */ jsxRuntime.jsx(
12583
+ "div",
12584
+ {
12585
+ onMouseDown: (e) => startCropDrag(e, h.pos),
12586
+ style: {
12587
+ position: "absolute",
12588
+ top: "top" in h ? h.top : void 0,
12589
+ bottom: "bottom" in h ? h.bottom : void 0,
12590
+ left: "left" in h ? h.left : void 0,
12591
+ right: "right" in h ? h.right : void 0,
12592
+ width: 12,
12593
+ height: 12,
12594
+ background: "#ffffff",
12595
+ border: "2px solid #0284c7",
12596
+ borderRadius: 2,
12597
+ cursor: h.cursor
12598
+ }
12599
+ },
12600
+ h.pos
12601
+ ))
12602
+ ]
12603
+ }
12604
+ )
12605
+ ]
12606
+ }
12607
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", color: "#475569" }, children: [
12608
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 56, color: "#64748b" }),
12609
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 8, fontWeight: 600 }, children: editingFile.name })
12610
+ ] })
12611
+ }
12612
+ )
12613
+ ]
12614
+ }
12615
+ ),
12616
+ /* @__PURE__ */ jsxRuntime.jsxs(
12617
+ "div",
12618
+ {
12619
+ style: {
12620
+ width: 320,
12621
+ background: "#ffffff",
12622
+ display: "flex",
12623
+ flexDirection: "column",
12624
+ overflowY: "auto",
12625
+ padding: 16,
12626
+ gap: 14
12627
+ },
12628
+ children: [
12629
+ editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxRuntime.jsxs(
12630
+ "div",
12631
+ {
12632
+ style: {
12633
+ padding: 12,
12634
+ borderRadius: 8,
12635
+ background: "#f8fafc",
12636
+ border: "1px solid #cbd5e1",
12637
+ display: "flex",
12638
+ flexDirection: "column",
12639
+ gap: 10
12640
+ },
12641
+ children: [
12642
+ /* @__PURE__ */ jsxRuntime.jsxs(
12643
+ "div",
12644
+ {
12645
+ style: {
12646
+ fontSize: 11,
12647
+ fontWeight: 700,
12648
+ color: "#1e3a8a",
12649
+ textTransform: "uppercase",
12650
+ display: "flex",
12651
+ alignItems: "center",
12652
+ gap: 5
12653
+ },
12654
+ children: [
12655
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "crop", size: 15, color: "#2669a0" }),
12656
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Kırpma Boyutları (Sharp)" : "Crop Coordinates (Sharp)" })
12657
+ ]
12658
+ }
12659
+ ),
12660
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
12661
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12662
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Genişlik (W px)" : "Width (W px)" }),
12663
+ /* @__PURE__ */ jsxRuntime.jsx(
12664
+ "input",
12665
+ {
12666
+ type: "number",
12667
+ min: 16,
12668
+ max: naturalSize.width || 1e4,
12669
+ value: Math.round(cropRect.width),
12670
+ onChange: (e) => setCropRect((prev) => ({
12671
+ ...prev,
12672
+ width: Math.max(16, Number(e.target.value) || 16)
12673
+ })),
12674
+ style: {
12675
+ width: "100%",
12676
+ padding: "5px 8px",
12677
+ fontSize: 12,
12678
+ border: "1px solid #cbd5e1",
12679
+ borderRadius: 4
12680
+ }
12681
+ }
12682
+ )
12683
+ ] }),
12684
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12685
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Yükseklik (H px)" : "Height (H px)" }),
12686
+ /* @__PURE__ */ jsxRuntime.jsx(
12687
+ "input",
12688
+ {
12689
+ type: "number",
12690
+ min: 16,
12691
+ max: naturalSize.height || 1e4,
12692
+ value: Math.round(cropRect.height),
12693
+ onChange: (e) => setCropRect((prev) => ({
12694
+ ...prev,
12695
+ height: Math.max(16, Number(e.target.value) || 16)
12696
+ })),
12697
+ style: {
12698
+ width: "100%",
12699
+ padding: "5px 8px",
12700
+ fontSize: 12,
12701
+ border: "1px solid #cbd5e1",
12702
+ borderRadius: 4
12703
+ }
12704
+ }
12705
+ )
12706
+ ] }),
12707
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12708
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "X (Sol / Left px)" }),
12709
+ /* @__PURE__ */ jsxRuntime.jsx(
12710
+ "input",
12711
+ {
12712
+ type: "number",
12713
+ min: 0,
12714
+ value: Math.round(cropRect.x),
12715
+ onChange: (e) => setCropRect((prev) => ({
12716
+ ...prev,
12717
+ x: Math.max(0, Number(e.target.value) || 0)
12718
+ })),
12719
+ style: {
12720
+ width: "100%",
12721
+ padding: "5px 8px",
12722
+ fontSize: 12,
12723
+ border: "1px solid #cbd5e1",
12724
+ borderRadius: 4
12725
+ }
12726
+ }
12727
+ )
12728
+ ] }),
12729
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12730
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "Y (Üst / Top px)" }),
12731
+ /* @__PURE__ */ jsxRuntime.jsx(
12732
+ "input",
12733
+ {
12734
+ type: "number",
12735
+ min: 0,
12736
+ value: Math.round(cropRect.y),
12737
+ onChange: (e) => setCropRect((prev) => ({
12738
+ ...prev,
12739
+ y: Math.max(0, Number(e.target.value) || 0)
12740
+ })),
12741
+ style: {
12742
+ width: "100%",
12743
+ padding: "5px 8px",
12744
+ fontSize: 12,
12745
+ border: "1px solid #cbd5e1",
12746
+ borderRadius: 4
12747
+ }
12748
+ }
12749
+ )
12750
+ ] })
12751
+ ] }),
12752
+ cropError && /* @__PURE__ */ jsxRuntime.jsx(
12753
+ "div",
12754
+ {
12755
+ style: {
12756
+ padding: "6px 8px",
12757
+ borderRadius: 4,
12758
+ background: "#fef2f2",
12759
+ color: "#dc2626",
12760
+ fontSize: 11
12761
+ },
12762
+ children: cropError
12763
+ }
12764
+ ),
12765
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
12766
+ /* @__PURE__ */ jsxRuntime.jsxs(
12767
+ "button",
12768
+ {
12769
+ type: "button",
12770
+ disabled: croppingBusy,
12771
+ onClick: () => handleExecuteCrop("duplicate"),
12772
+ style: {
12773
+ padding: "8px 12px",
12774
+ fontSize: 12,
12775
+ fontWeight: 700,
12776
+ borderRadius: 5,
12777
+ border: "none",
12778
+ background: "#2669a0",
12779
+ color: "#ffffff",
12780
+ cursor: croppingBusy ? "wait" : "pointer",
12781
+ display: "flex",
12782
+ alignItems: "center",
12783
+ justifyContent: "center",
12784
+ gap: 6
12785
+ },
12786
+ children: [
12787
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "content_copy", size: 15, color: "#fff" }),
12788
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: croppingBusy ? tr ? "İşleniyor..." : "Processing..." : tr ? "Kopyasını Oluştur & Kırp" : "Duplicate & Crop Asset" })
12789
+ ]
12790
+ }
12791
+ ),
12792
+ /* @__PURE__ */ jsxRuntime.jsxs(
12793
+ "button",
12794
+ {
12795
+ type: "button",
12796
+ disabled: croppingBusy,
12797
+ onClick: () => handleExecuteCrop("replace"),
12798
+ style: {
12799
+ padding: "7px 12px",
12800
+ fontSize: 12,
12801
+ fontWeight: 600,
12802
+ borderRadius: 5,
12803
+ border: "1px solid #2669a0",
12804
+ background: "#eff6ff",
12805
+ color: "#1e3a8a",
12806
+ cursor: croppingBusy ? "wait" : "pointer",
12807
+ display: "flex",
12808
+ alignItems: "center",
12809
+ justifyContent: "center",
12810
+ gap: 6
12811
+ },
12812
+ children: [
12813
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "crop", size: 15, color: "#1e3a8a" }),
12814
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Orijinal Görseli Kırp (Üzerine Yaz)" : "Crop Original Asset" })
12815
+ ]
12816
+ }
12817
+ )
12818
+ ] })
12819
+ ]
12820
+ }
12821
+ ),
12822
+ /* @__PURE__ */ jsxRuntime.jsxs(
12823
+ "div",
12824
+ {
12825
+ style: {
12826
+ display: "flex",
12827
+ flexDirection: "column",
12828
+ gap: 8,
12829
+ borderTop: "1px solid #e2e8f0",
12830
+ paddingTop: 12
12831
+ },
12832
+ children: [
12833
+ /* @__PURE__ */ jsxRuntime.jsx(
12834
+ "div",
12835
+ {
12836
+ style: {
12837
+ fontSize: 11,
12838
+ fontWeight: 700,
12839
+ color: "#334155",
12840
+ textTransform: "uppercase"
12841
+ },
12842
+ children: tr ? "Dosya Bilgileri (Metadata)" : "Asset Metadata"
12843
+ }
12844
+ ),
12845
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12846
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Dosya Adı" : "File Name" }),
12847
+ /* @__PURE__ */ jsxRuntime.jsx(
12848
+ "input",
12849
+ {
12850
+ type: "text",
12851
+ value: editName,
12852
+ onChange: (e) => setEditName(e.target.value),
12853
+ style: {
12854
+ width: "100%",
12855
+ padding: "6px 8px",
12856
+ fontSize: 12,
12857
+ border: "1px solid #cbd5e1",
12858
+ borderRadius: 4,
12859
+ marginTop: 2
12860
+ }
12861
+ }
12862
+ )
12863
+ ] }),
12864
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12865
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Alternatif Metin (Alt Text / SEO)" : "Alternative Text (Alt / SEO)" }),
12866
+ /* @__PURE__ */ jsxRuntime.jsx(
12867
+ "input",
12868
+ {
12869
+ type: "text",
12870
+ value: editAlt,
12871
+ onChange: (e) => setEditAlt(e.target.value),
12872
+ style: {
12873
+ width: "100%",
12874
+ padding: "6px 8px",
12875
+ fontSize: 12,
12876
+ border: "1px solid #cbd5e1",
12877
+ borderRadius: 4,
12878
+ marginTop: 2
12879
+ }
12880
+ }
12881
+ )
12882
+ ] }),
12883
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12884
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Altyazı (Caption)" : "Caption" }),
12885
+ /* @__PURE__ */ jsxRuntime.jsx(
12886
+ "input",
12887
+ {
12888
+ type: "text",
12889
+ value: editCaption,
12890
+ onChange: (e) => setEditCaption(e.target.value),
12891
+ style: {
12892
+ width: "100%",
12893
+ padding: "6px 8px",
12894
+ fontSize: 12,
12895
+ border: "1px solid #cbd5e1",
12896
+ borderRadius: 4,
12897
+ marginTop: 2
12898
+ }
12899
+ }
12900
+ )
12901
+ ] }),
12902
+ folders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12903
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Klasör Konumu" : "Folder Location" }),
12904
+ /* @__PURE__ */ jsxRuntime.jsxs(
12905
+ "select",
12906
+ {
12907
+ value: editFolderId ?? "",
12908
+ onChange: (e) => setEditFolderId(e.target.value ? Number(e.target.value) : null),
12909
+ style: {
12910
+ width: "100%",
12911
+ padding: "6px 8px",
12912
+ fontSize: 12,
12913
+ border: "1px solid #cbd5e1",
12914
+ borderRadius: 4,
12915
+ marginTop: 2,
12916
+ background: "#fff"
12917
+ },
12918
+ children: [
12919
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: tr ? "Ana Dizin (Root)" : "Media Library Root" }),
12920
+ folders.map((fld) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: fld.id, children: fld.name }, fld.id))
12921
+ ]
12922
+ }
12923
+ )
12924
+ ] }),
12925
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 6, marginTop: 4 }, children: [
12926
+ /* @__PURE__ */ jsxRuntime.jsx(
12927
+ "button",
12928
+ {
12929
+ type: "button",
12930
+ disabled: savingDetails,
12931
+ onClick: handleSaveDetails,
12932
+ style: {
12933
+ flex: 1,
12934
+ padding: "7px 10px",
12935
+ fontSize: 12,
12936
+ fontWeight: 600,
12937
+ borderRadius: 5,
12938
+ border: "1px solid #cbd5e1",
12939
+ background: "#f8fafc",
12940
+ color: "#0f172a",
12941
+ cursor: "pointer"
12942
+ },
12943
+ children: savingDetails ? tr ? "Kaydediliyor..." : "Saving..." : tr ? "Bilgileri Kaydet" : "Save Metadata"
12944
+ }
12945
+ ),
12946
+ /* @__PURE__ */ jsxRuntime.jsx(
12947
+ "button",
12948
+ {
12949
+ type: "button",
12950
+ onClick: (e) => handleDeleteAsset(editingFile, e),
12951
+ title: tr ? "Dosyayı Kütüphaneden Sil" : "Delete from Media Library",
12952
+ style: {
12953
+ padding: "7px 10px",
12954
+ fontSize: 12,
12955
+ fontWeight: 600,
12956
+ borderRadius: 5,
12957
+ border: "1px solid #fecaca",
12958
+ background: "#fef2f2",
12959
+ color: "#dc2626",
12960
+ cursor: "pointer"
12961
+ },
12962
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete_outline", size: 16, color: "#dc2626" })
12963
+ }
12964
+ )
12965
+ ] })
12966
+ ]
12967
+ }
12968
+ )
12969
+ ]
12970
+ }
12971
+ )
12972
+ ] }) : (
12973
+ /* VIEW 2: MEDIA LIBRARY BROWSER (Folders, Filters, Sort, Multi-Select, Item Actions) */
12974
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12975
+ creatingFolder && /* @__PURE__ */ jsxRuntime.jsxs(
12976
+ "div",
12977
+ {
12978
+ style: {
12979
+ padding: "8px 18px",
12980
+ background: "#eff6ff",
12981
+ borderBottom: "1px solid #bfdbfe",
12982
+ display: "flex",
12983
+ alignItems: "center",
12984
+ gap: 8
12985
+ },
12986
+ children: [
12987
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "folder", size: 16, color: "#2669a0" }),
12988
+ /* @__PURE__ */ jsxRuntime.jsx(
12989
+ "input",
12990
+ {
12991
+ type: "text",
12992
+ value: newFolderName,
12993
+ onChange: (e) => setNewFolderName(e.target.value),
12994
+ onKeyDown: (e) => {
12995
+ if (e.key === "Enter") {
12996
+ e.preventDefault();
12997
+ handleCreateFolder();
12998
+ }
12999
+ },
13000
+ placeholder: tr ? "Yeni klasör adı yazın..." : "Enter new folder name...",
13001
+ style: {
13002
+ flex: 1,
13003
+ padding: "5px 10px",
13004
+ fontSize: 12,
13005
+ border: "1px solid #93c5fd",
13006
+ borderRadius: 4,
13007
+ background: "#fff"
13008
+ }
13009
+ }
13010
+ ),
13011
+ /* @__PURE__ */ jsxRuntime.jsx(
13012
+ "button",
13013
+ {
13014
+ type: "button",
13015
+ onClick: handleCreateFolder,
13016
+ style: {
13017
+ padding: "5px 12px",
13018
+ fontSize: 12,
13019
+ fontWeight: 600,
13020
+ background: "#2669a0",
13021
+ color: "#fff",
13022
+ border: "none",
13023
+ borderRadius: 4,
13024
+ cursor: "pointer"
13025
+ },
13026
+ children: tr ? "Oluştur" : "Create"
13027
+ }
13028
+ ),
13029
+ /* @__PURE__ */ jsxRuntime.jsx(
13030
+ "button",
13031
+ {
13032
+ type: "button",
13033
+ onClick: () => setCreatingFolder(false),
13034
+ style: {
13035
+ padding: "5px 10px",
13036
+ fontSize: 12,
13037
+ border: "1px solid #cbd5e1",
13038
+ background: "#fff",
13039
+ borderRadius: 4,
13040
+ cursor: "pointer"
13041
+ },
13042
+ children: tr ? "İptal" : "Cancel"
13043
+ }
13044
+ )
13045
+ ]
13046
+ }
13047
+ ),
13048
+ /* @__PURE__ */ jsxRuntime.jsxs(
13049
+ "div",
13050
+ {
13051
+ style: {
13052
+ padding: "10px 18px",
13053
+ borderBottom: "1px solid #f1f5f9",
13054
+ display: "flex",
13055
+ alignItems: "center",
13056
+ gap: 8,
13057
+ flexWrap: "wrap"
13058
+ },
13059
+ children: [
13060
+ /* @__PURE__ */ jsxRuntime.jsx(
13061
+ "input",
13062
+ {
13063
+ type: "text",
13064
+ value: search,
13065
+ onChange: (e) => setSearch(e.target.value),
13066
+ placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
13067
+ style: {
13068
+ flex: 1,
13069
+ minWidth: 180,
13070
+ padding: "7px 10px",
13071
+ fontSize: 12,
13072
+ border: "1px solid #cbd5e1",
13073
+ borderRadius: 5
13074
+ }
13075
+ }
13076
+ ),
13077
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 4 }, children: [
13078
+ { key: "all", label: tr ? "Tümü" : "All" },
13079
+ { key: "image", label: tr ? "Görsel" : "Images" },
13080
+ { key: "video", label: tr ? "Video" : "Videos" },
13081
+ { key: "doc", label: tr ? "Belge" : "Docs" }
13082
+ ].map((tf) => {
13083
+ const active = typeFilter === tf.key;
13084
+ return /* @__PURE__ */ jsxRuntime.jsx(
13085
+ "button",
13086
+ {
13087
+ type: "button",
13088
+ onClick: () => setTypeFilter(tf.key),
13089
+ style: {
13090
+ padding: "5px 9px",
13091
+ fontSize: 11,
13092
+ fontWeight: 600,
13093
+ borderRadius: 5,
13094
+ border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
13095
+ background: active ? "#eff6ff" : "#ffffff",
13096
+ color: active ? "#2669a0" : "#475569",
13097
+ cursor: "pointer"
13098
+ },
13099
+ children: tf.label
13100
+ },
13101
+ tf.key
13102
+ );
13103
+ }) }),
13104
+ /* @__PURE__ */ jsxRuntime.jsxs(
13105
+ "select",
13106
+ {
13107
+ value: sortBy,
13108
+ onChange: (e) => setSortBy(e.target.value),
13109
+ style: {
13110
+ padding: "6px 8px",
13111
+ fontSize: 11,
13112
+ fontWeight: 600,
13113
+ border: "1px solid #cbd5e1",
13114
+ borderRadius: 5,
13115
+ background: "#ffffff",
13116
+ color: "#334155"
13117
+ },
13118
+ children: [
13119
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "newest", children: tr ? "En Yeni" : "Newest first" }),
13120
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "oldest", children: tr ? "En Eski" : "Oldest first" }),
13121
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "nameAsc", children: tr ? "Ad (A - Z)" : "Name (A - Z)" }),
13122
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "nameDesc", children: tr ? "Ad (Z - A)" : "Name (Z - A)" }),
13123
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "sizeDesc", children: tr ? "Boyut (Büyükten)" : "Size (Largest)" })
13124
+ ]
13125
+ }
13126
+ ),
13127
+ multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13128
+ /* @__PURE__ */ jsxRuntime.jsx(
13129
+ "button",
13130
+ {
13131
+ type: "button",
13132
+ onClick: () => {
13133
+ const existingKeys = new Set(selectedFiles.map(getFileKey));
13134
+ const additions = filteredFiles.filter(
13135
+ (f) => !existingKeys.has(getFileKey(f))
13136
+ );
13137
+ setSelectedFiles([...selectedFiles, ...additions]);
13138
+ },
13139
+ style: {
13140
+ padding: "6px 10px",
13141
+ fontSize: 11,
13142
+ fontWeight: 600,
13143
+ border: "1px solid #cbd5e1",
13144
+ borderRadius: 5,
13145
+ background: "#ffffff",
13146
+ color: "#334155",
13147
+ cursor: "pointer",
13148
+ whiteSpace: "nowrap"
13149
+ },
13150
+ children: t("selectAllVisible", "Select All")
13151
+ }
13152
+ ),
13153
+ selectedFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
13154
+ "button",
13155
+ {
13156
+ type: "button",
13157
+ onClick: () => setSelectedFiles([]),
13158
+ style: {
13159
+ padding: "6px 10px",
13160
+ fontSize: 11,
13161
+ fontWeight: 600,
13162
+ border: "1px solid #fecaca",
13163
+ borderRadius: 5,
13164
+ background: "#fef2f2",
13165
+ color: "#dc2626",
13166
+ cursor: "pointer",
13167
+ whiteSpace: "nowrap"
13168
+ },
13169
+ children: t("clearSelection", "Clear Selection")
13170
+ }
13171
+ )
13172
+ ] })
13173
+ ]
13174
+ }
13175
+ ),
13176
+ (folders.length > 0 || currentFolderId !== null) && /* @__PURE__ */ jsxRuntime.jsxs(
13177
+ "div",
13178
+ {
13179
+ style: {
13180
+ padding: "8px 18px",
13181
+ borderBottom: "1px solid #f1f5f9",
13182
+ background: "#f8fafc",
13183
+ display: "flex",
13184
+ alignItems: "center",
13185
+ gap: 6,
13186
+ flexWrap: "wrap"
13187
+ },
13188
+ children: [
13189
+ /* @__PURE__ */ jsxRuntime.jsxs(
13190
+ "button",
13191
+ {
13192
+ type: "button",
13193
+ onClick: () => setCurrentFolderId(null),
13194
+ style: {
13195
+ display: "inline-flex",
13196
+ alignItems: "center",
13197
+ gap: 4,
13198
+ padding: "4px 8px",
13199
+ fontSize: 11,
13200
+ fontWeight: 700,
13201
+ borderRadius: 4,
13202
+ border: currentFolderId === null ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
13203
+ background: currentFolderId === null ? "#2669a0" : "#ffffff",
13204
+ color: currentFolderId === null ? "#ffffff" : "#334155",
13205
+ cursor: "pointer"
13206
+ },
13207
+ children: [
13208
+ /* @__PURE__ */ jsxRuntime.jsx(
13209
+ index.MaterialIcon,
13210
+ {
13211
+ name: "folder",
13212
+ size: 14,
13213
+ color: currentFolderId === null ? "#ffffff" : "#2669a0"
13214
+ }
13215
+ ),
13216
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Ana Dizin" : "Media Library" })
13217
+ ]
13218
+ }
13219
+ ),
13220
+ currentFolderObj && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13221
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#94a3b8", fontSize: 12 }, children: "/" }),
13222
+ /* @__PURE__ */ jsxRuntime.jsx(
13223
+ "span",
13224
+ {
13225
+ style: {
13226
+ fontSize: 12,
13227
+ fontWeight: 700,
13228
+ color: "#1e3a8a",
13229
+ padding: "3px 8px",
13230
+ background: "#dbeafe",
13231
+ borderRadius: 4
13232
+ },
13233
+ children: currentFolderObj.name
13234
+ }
13235
+ )
13236
+ ] }),
13237
+ visibleFolders.map((fld) => /* @__PURE__ */ jsxRuntime.jsxs(
13238
+ "button",
13239
+ {
13240
+ type: "button",
13241
+ onClick: () => setCurrentFolderId(Number(fld.id)),
13242
+ style: {
13243
+ display: "inline-flex",
13244
+ alignItems: "center",
13245
+ gap: 5,
13246
+ padding: "4px 10px",
13247
+ fontSize: 11,
13248
+ fontWeight: 600,
13249
+ borderRadius: 4,
13250
+ border: "1px solid #cbd5e1",
13251
+ background: "#ffffff",
13252
+ color: "#1e293b",
13253
+ cursor: "pointer"
13254
+ },
13255
+ children: [
13256
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "folder", size: 14, color: "#f59e0b" }),
13257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: fld.name })
13258
+ ]
13259
+ },
13260
+ fld.id
13261
+ ))
13262
+ ]
13263
+ }
13264
+ ),
13265
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
13266
+ "div",
13267
+ {
13268
+ style: {
13269
+ textAlign: "center",
13270
+ padding: 32,
13271
+ color: "#64748b",
13272
+ fontSize: 13
13273
+ },
13274
+ children: t("media.loadingFiles", "Loading media files...")
13275
+ }
13276
+ ) : filteredFiles.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
13277
+ "div",
13278
+ {
13279
+ style: {
13280
+ textAlign: "center",
13281
+ padding: 32,
13282
+ color: "#64748b",
13283
+ fontSize: 13
13284
+ },
13285
+ children: t(
13286
+ "media.noMatchingFiles",
13287
+ "No matching files found in the media library. Use the Upload New File button above to upload from your computer."
13288
+ )
13289
+ }
13290
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
13291
+ "div",
13292
+ {
13293
+ style: {
13294
+ display: "grid",
13295
+ gridTemplateColumns: "repeat(auto-fill, minmax(160px, 1fr))",
13296
+ gap: 12
13297
+ },
13298
+ children: filteredFiles.map((file) => {
13299
+ const fileKey = getFileKey(file);
13300
+ const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
13301
+ const isMultiSelected = multiIndex !== -1;
13302
+ const isCurrent = multiple ? isMultiSelected : Boolean(
13303
+ previewUrl && (file.url === previewUrl.split("?")[0] || file.name === value?.filename)
13304
+ );
13305
+ const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
13306
+ return /* @__PURE__ */ jsxRuntime.jsxs(
13307
+ "div",
13308
+ {
13309
+ onClick: () => {
13310
+ if (multiple) {
13311
+ toggleFileSelection(file);
13312
+ } else {
13313
+ onChange(mapStrapiFileToAsset(file));
13314
+ setModalOpen(false);
13315
+ }
13316
+ },
13317
+ onDoubleClick: () => {
13318
+ if (multiple) {
13319
+ const asset = mapStrapiFileToAsset(file);
13320
+ const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
13321
+ if (onSelectMultiple) {
13322
+ onSelectMultiple(listToCommit);
13323
+ } else {
13324
+ listToCommit.forEach((a) => onChange(a));
13325
+ }
13326
+ setSelectedFiles([]);
13327
+ setModalOpen(false);
13328
+ }
13329
+ },
13330
+ style: {
13331
+ border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
13332
+ borderRadius: 6,
13333
+ overflow: "hidden",
13334
+ cursor: "pointer",
13335
+ background: isCurrent ? "#eff6ff" : "#fff",
13336
+ boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
13337
+ userSelect: "none",
13338
+ display: "flex",
13339
+ flexDirection: "column"
13340
+ },
13341
+ children: [
13342
+ /* @__PURE__ */ jsxRuntime.jsxs(
13343
+ "div",
13344
+ {
13345
+ style: {
13346
+ height: 112,
13347
+ background: "#f1f5f9",
13348
+ display: "flex",
13349
+ alignItems: "center",
13350
+ justifyContent: "center",
13351
+ position: "relative"
13352
+ },
13353
+ children: [
13354
+ file.mime?.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsx(
13355
+ "img",
13356
+ {
13357
+ src: thumbSrc,
13358
+ alt: file.name,
13359
+ style: { width: "100%", height: "100%", objectFit: "cover" }
13360
+ }
13361
+ ) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
13362
+ multiple ? /* @__PURE__ */ jsxRuntime.jsx(
13363
+ "span",
13364
+ {
13365
+ style: {
13366
+ position: "absolute",
13367
+ top: 6,
13368
+ left: 6,
13369
+ minWidth: 22,
13370
+ height: 22,
13371
+ padding: isMultiSelected ? "0 6px" : 0,
13372
+ borderRadius: 11,
13373
+ background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.9)",
13374
+ border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
13375
+ color: "#ffffff",
13376
+ fontSize: 10,
13377
+ fontWeight: 700,
13378
+ display: "inline-flex",
13379
+ alignItems: "center",
13380
+ justifyContent: "center",
13381
+ boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
13382
+ },
13383
+ children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
13384
+ }
13385
+ ) : isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
13386
+ "span",
13387
+ {
13388
+ style: {
13389
+ position: "absolute",
13390
+ top: 5,
13391
+ left: 5,
13392
+ background: "#2669a0",
13393
+ color: "#fff",
13394
+ fontSize: 9,
13395
+ fontWeight: 700,
13396
+ padding: "2px 6px",
13397
+ borderRadius: 4
13398
+ },
13399
+ children: t("media.selectedBadge", "SELECTED")
13400
+ }
13401
+ ),
13402
+ /* @__PURE__ */ jsxRuntime.jsxs(
13403
+ "div",
13404
+ {
13405
+ style: {
13406
+ position: "absolute",
13407
+ top: 5,
13408
+ right: 5,
13409
+ display: "flex",
13410
+ gap: 4
13411
+ },
13412
+ onClick: (e) => e.stopPropagation(),
13413
+ children: [
13414
+ /* @__PURE__ */ jsxRuntime.jsx(
13415
+ "button",
13416
+ {
13417
+ type: "button",
13418
+ onClick: (e) => {
13419
+ e.stopPropagation();
13420
+ openEditorForFile(file, "crop");
13421
+ },
13422
+ title: file.mime?.startsWith("image/") ? tr ? "Görseli Kırp & Düzenle" : "Crop & Edit Image" : tr ? "Dosya Bilgilerini Düzenle" : "Edit File Details",
13423
+ style: {
13424
+ width: 24,
13425
+ height: 24,
13426
+ borderRadius: 4,
13427
+ border: "1px solid rgba(15,23,42,0.15)",
13428
+ background: "rgba(255,255,255,0.92)",
13429
+ color: "#1e293b",
13430
+ display: "inline-flex",
13431
+ alignItems: "center",
13432
+ justifyContent: "center",
13433
+ cursor: "pointer",
13434
+ padding: 0
13435
+ },
13436
+ children: /* @__PURE__ */ jsxRuntime.jsx(
13437
+ index.MaterialIcon,
13438
+ {
13439
+ name: file.mime?.startsWith("image/") ? "crop" : "edit",
13440
+ size: 14,
13441
+ color: "#2669a0"
13442
+ }
13443
+ )
13444
+ }
13445
+ ),
13446
+ /* @__PURE__ */ jsxRuntime.jsx(
13447
+ "button",
13448
+ {
13449
+ type: "button",
13450
+ onClick: (e) => handleDeleteAsset(file, e),
13451
+ title: tr ? "Kütüphaneden Sil" : "Delete from Library",
13452
+ style: {
13453
+ width: 24,
13454
+ height: 24,
13455
+ borderRadius: 4,
13456
+ border: "1px solid rgba(15,23,42,0.15)",
13457
+ background: "rgba(255,255,255,0.92)",
13458
+ color: "#dc2626",
13459
+ display: "inline-flex",
13460
+ alignItems: "center",
13461
+ justifyContent: "center",
13462
+ cursor: "pointer",
13463
+ padding: 0
13464
+ },
13465
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "delete_outline", size: 14, color: "#dc2626" })
13466
+ }
13467
+ )
13468
+ ]
13469
+ }
13470
+ ),
13471
+ file.ext && /* @__PURE__ */ jsxRuntime.jsx(
13472
+ "span",
13473
+ {
13474
+ style: {
13475
+ position: "absolute",
13476
+ bottom: 4,
13477
+ right: 4,
13478
+ background: "rgba(15,23,42,0.75)",
13479
+ color: "#fff",
13480
+ fontSize: 9,
13481
+ fontWeight: 700,
13482
+ padding: "1px 5px",
13483
+ borderRadius: 3,
13484
+ textTransform: "uppercase"
13485
+ },
13486
+ children: file.ext.replace(".", "")
13487
+ }
13488
+ )
13489
+ ]
13490
+ }
13491
+ ),
13492
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 8px" }, children: [
13493
+ /* @__PURE__ */ jsxRuntime.jsx(
13494
+ "div",
13495
+ {
13496
+ style: {
13497
+ fontSize: 11,
13498
+ fontWeight: 600,
13499
+ color: "#1e293b",
13500
+ overflow: "hidden",
13501
+ textOverflow: "ellipsis",
13502
+ whiteSpace: "nowrap"
13503
+ },
13504
+ title: file.name,
13505
+ children: file.name
13506
+ }
13507
+ ),
13508
+ (file.width || file.size) && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
13509
+ file.width && file.height ? `${file.width}×${file.height}` : "",
13510
+ file.width && file.size ? " · " : "",
13511
+ file.size ? `${Math.round(Number(file.size))} KB` : ""
13512
+ ] })
13513
+ ] })
13514
+ ]
11979
13515
  },
11980
- children: t("clearSelection", "Clear Selection")
11981
- }
11982
- )
11983
- ] })
11984
- ]
11985
- }
11986
- ),
11987
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
11988
- "div",
11989
- {
11990
- style: { textAlign: "center", padding: 32, color: "#64748b", fontSize: 13 },
11991
- children: t("media.loadingFiles", "Loading media files...")
11992
- }
11993
- ) : filteredFiles.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
11994
- "div",
11995
- {
11996
- style: { textAlign: "center", padding: 32, color: "#64748b", fontSize: 13 },
11997
- children: t(
11998
- "media.noMatchingFiles",
11999
- "No matching files found in the media library. Use the Upload New File button above to upload from your computer."
12000
- )
12001
- }
12002
- ) : /* @__PURE__ */ jsxRuntime.jsx(
12003
- "div",
12004
- {
12005
- style: {
12006
- display: "grid",
12007
- gridTemplateColumns: "repeat(auto-fill, minmax(145px, 1fr))",
12008
- gap: 12
12009
- },
12010
- children: filteredFiles.map((file) => {
12011
- const fileKey = getFileKey(file);
12012
- const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
12013
- const isMultiSelected = multiIndex !== -1;
12014
- const isCurrent = multiple ? isMultiSelected : Boolean(
12015
- previewUrl && (file.url === previewUrl || file.name === value?.filename)
12016
- );
12017
- const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
12018
- return /* @__PURE__ */ jsxRuntime.jsxs(
12019
- "div",
12020
- {
12021
- onClick: () => {
12022
- if (multiple) {
12023
- toggleFileSelection(file);
12024
- } else {
12025
- onChange(mapStrapiFileToAsset(file));
12026
- setModalOpen(false);
12027
- }
12028
- },
12029
- onDoubleClick: () => {
12030
- if (multiple) {
12031
- const asset = mapStrapiFileToAsset(file);
12032
- const listToCommit = selectedFiles.length > 0 ? selectedFiles.map(mapStrapiFileToAsset) : [asset];
12033
- if (onSelectMultiple) {
12034
- onSelectMultiple(listToCommit);
12035
- } else {
12036
- listToCommit.forEach((a) => onChange(a));
13516
+ fileKey
13517
+ );
13518
+ })
13519
+ }
13520
+ ) }),
13521
+ /* @__PURE__ */ jsxRuntime.jsxs(
13522
+ "div",
13523
+ {
13524
+ style: {
13525
+ display: "flex",
13526
+ alignItems: "center",
13527
+ justifyContent: "space-between",
13528
+ padding: "12px 18px",
13529
+ borderTop: "1px solid #e2e8f0",
13530
+ background: "#f8fafc",
13531
+ gap: 12
13532
+ },
13533
+ children: [
13534
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: multiple ? selectedFiles.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
13535
+ selectedFiles.length,
13536
+ " ",
13537
+ t("selectedCountLabel", "selected")
13538
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Seçmek için görsele tıklayın; kırpmak veya düzenlemek için sağ üstteki Kırp ikonunu kullanın." : "Click an image to select it, or click the Crop icon on any card to crop/edit." }) }),
13539
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
13540
+ /* @__PURE__ */ jsxRuntime.jsx(
13541
+ "button",
13542
+ {
13543
+ type: "button",
13544
+ onClick: () => {
13545
+ setSelectedFiles([]);
13546
+ setModalOpen(false);
13547
+ },
13548
+ style: {
13549
+ padding: "7px 14px",
13550
+ fontSize: 12,
13551
+ fontWeight: 600,
13552
+ border: "1px solid #cbd5e1",
13553
+ borderRadius: 5,
13554
+ background: "#ffffff",
13555
+ color: "#475569",
13556
+ cursor: "pointer"
13557
+ },
13558
+ children: t("cancel", "Cancel")
12037
13559
  }
12038
- setSelectedFiles([]);
12039
- setModalOpen(false);
12040
- }
12041
- },
12042
- style: {
12043
- border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
12044
- borderRadius: 6,
12045
- overflow: "hidden",
12046
- cursor: "pointer",
12047
- background: isCurrent ? "#eff6ff" : "#fff",
12048
- boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
12049
- userSelect: "none"
12050
- },
12051
- children: [
12052
- /* @__PURE__ */ jsxRuntime.jsxs(
12053
- "div",
13560
+ ),
13561
+ multiple && /* @__PURE__ */ jsxRuntime.jsxs(
13562
+ "button",
12054
13563
  {
13564
+ type: "button",
13565
+ disabled: selectedFiles.length === 0,
13566
+ onClick: handleConfirmMultiple,
12055
13567
  style: {
12056
- height: 100,
12057
- background: "#f1f5f9",
12058
- display: "flex",
13568
+ display: "inline-flex",
12059
13569
  alignItems: "center",
12060
- justifyContent: "center",
12061
- position: "relative"
13570
+ gap: 6,
13571
+ padding: "7px 16px",
13572
+ fontSize: 12,
13573
+ fontWeight: 700,
13574
+ border: "none",
13575
+ borderRadius: 5,
13576
+ background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
13577
+ color: "#ffffff",
13578
+ cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
12062
13579
  },
12063
13580
  children: [
12064
- file.mime?.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsx(
12065
- "img",
12066
- {
12067
- src: thumbSrc,
12068
- alt: file.name,
12069
- style: { width: "100%", height: "100%", objectFit: "cover" }
12070
- }
12071
- ) : /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
12072
- multiple ? /* @__PURE__ */ jsxRuntime.jsx(
12073
- "span",
12074
- {
12075
- style: {
12076
- position: "absolute",
12077
- top: 6,
12078
- left: 6,
12079
- minWidth: 22,
12080
- height: 22,
12081
- padding: isMultiSelected ? "0 6px" : 0,
12082
- borderRadius: 11,
12083
- background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.88)",
12084
- border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
12085
- color: "#ffffff",
12086
- fontSize: 10,
12087
- fontWeight: 700,
12088
- display: "inline-flex",
12089
- alignItems: "center",
12090
- justifyContent: "center",
12091
- boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
12092
- },
12093
- children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
12094
- }
12095
- ) : isCurrent && /* @__PURE__ */ jsxRuntime.jsx(
12096
- "span",
12097
- {
12098
- style: {
12099
- position: "absolute",
12100
- top: 5,
12101
- left: 5,
12102
- background: "#2669a0",
12103
- color: "#fff",
12104
- fontSize: 9,
12105
- fontWeight: 700,
12106
- padding: "2px 6px",
12107
- borderRadius: 4
12108
- },
12109
- children: t("media.selectedBadge", "SELECTED")
12110
- }
12111
- ),
12112
- file.ext && /* @__PURE__ */ jsxRuntime.jsx(
12113
- "span",
12114
- {
12115
- style: {
12116
- position: "absolute",
12117
- bottom: 4,
12118
- right: 4,
12119
- background: "rgba(15,23,42,0.75)",
12120
- color: "#fff",
12121
- fontSize: 9,
12122
- fontWeight: 700,
12123
- padding: "1px 5px",
12124
- borderRadius: 3,
12125
- textTransform: "uppercase"
12126
- },
12127
- children: file.ext.replace(".", "")
12128
- }
12129
- )
13581
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
13582
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
13583
+ t("addSelectedMedia", "Add Selected"),
13584
+ " ",
13585
+ selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
13586
+ ] })
12130
13587
  ]
12131
13588
  }
12132
- ),
12133
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "6px 8px" }, children: [
12134
- /* @__PURE__ */ jsxRuntime.jsx(
12135
- "div",
12136
- {
12137
- style: {
12138
- fontSize: 11,
12139
- fontWeight: 600,
12140
- color: "#1e293b",
12141
- overflow: "hidden",
12142
- textOverflow: "ellipsis",
12143
- whiteSpace: "nowrap"
12144
- },
12145
- title: file.name,
12146
- children: file.name
12147
- }
12148
- ),
12149
- (file.width || file.size) && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
12150
- file.width && file.height ? `${file.width}×${file.height}` : "",
12151
- file.width && file.size ? " · " : "",
12152
- file.size ? `${Math.round(Number(file.size))} KB` : ""
12153
- ] })
12154
- ] })
12155
- ]
12156
- },
12157
- fileKey
12158
- );
12159
- })
12160
- }
12161
- ) }),
12162
- multiple && /* @__PURE__ */ jsxRuntime.jsxs(
12163
- "div",
12164
- {
12165
- style: {
12166
- display: "flex",
12167
- alignItems: "center",
12168
- justifyContent: "space-between",
12169
- padding: "12px 18px",
12170
- borderTop: "1px solid #e2e8f0",
12171
- background: "#f8fafc",
12172
- gap: 12
12173
- },
12174
- children: [
12175
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: selectedFiles.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
12176
- selectedFiles.length,
12177
- " ",
12178
- t("selectedCountLabel", "selected")
12179
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) }),
12180
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
12181
- /* @__PURE__ */ jsxRuntime.jsx(
12182
- "button",
12183
- {
12184
- type: "button",
12185
- onClick: () => {
12186
- setSelectedFiles([]);
12187
- setModalOpen(false);
12188
- },
12189
- style: {
12190
- padding: "7px 14px",
12191
- fontSize: 12,
12192
- fontWeight: 600,
12193
- border: "1px solid #cbd5e1",
12194
- borderRadius: 5,
12195
- background: "#ffffff",
12196
- color: "#475569",
12197
- cursor: "pointer"
12198
- },
12199
- children: t("cancel", "Cancel")
12200
- }
12201
- ),
12202
- /* @__PURE__ */ jsxRuntime.jsxs(
12203
- "button",
12204
- {
12205
- type: "button",
12206
- disabled: selectedFiles.length === 0,
12207
- onClick: handleConfirmMultiple,
12208
- style: {
12209
- display: "inline-flex",
12210
- alignItems: "center",
12211
- gap: 6,
12212
- padding: "7px 16px",
12213
- fontSize: 12,
12214
- fontWeight: 700,
12215
- border: "none",
12216
- borderRadius: 5,
12217
- background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
12218
- color: "#ffffff",
12219
- cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
12220
- },
12221
- children: [
12222
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
12223
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
12224
- t("addSelectedMedia", "Add Selected"),
12225
- " ",
12226
- selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
12227
- ] })
12228
- ]
12229
- }
12230
- )
12231
- ] })
12232
- ]
12233
- }
13589
+ )
13590
+ ] })
13591
+ ]
13592
+ }
13593
+ )
13594
+ ] })
12234
13595
  )
12235
13596
  ]
12236
13597
  }
@@ -16340,6 +17701,9 @@ const VisualEditorModal = ({ open, onClose }) => {
16340
17701
  React.useEffect(() => {
16341
17702
  if (!open) return;
16342
17703
  const onKeyDown = (e) => {
17704
+ if (typeof document !== "undefined" && document.querySelector('[role="dialog"], [data-radix-popper-content-wrapper]')) {
17705
+ return;
17706
+ }
16343
17707
  const target = e.target;
16344
17708
  const isInput = target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable);
16345
17709
  if (e.key === "Escape") {
@@ -16498,7 +17862,7 @@ const VisualEditorModal = ({ open, onClose }) => {
16498
17862
  style: {
16499
17863
  position: "fixed",
16500
17864
  inset: 0,
16501
- zIndex: 9999,
17865
+ zIndex: 200,
16502
17866
  background: "#f8fafc",
16503
17867
  display: "flex",
16504
17868
  flexDirection: "column",
@@ -16752,7 +18116,7 @@ const CIContextMenu = () => {
16752
18116
  position: "fixed",
16753
18117
  left: pos.left,
16754
18118
  top: pos.top,
16755
- zIndex: 10500,
18119
+ zIndex: 250,
16756
18120
  minWidth: 235,
16757
18121
  background: "#ffffff",
16758
18122
  border: "1px solid #cbd5e1",
@@ -18319,7 +19683,7 @@ const InnerContentBuilder = ({
18319
19683
  position: "fixed",
18320
19684
  inset: 0,
18321
19685
  background: "rgba(15, 23, 42, 0.5)",
18322
- zIndex: 10200,
19686
+ zIndex: 230,
18323
19687
  display: "flex",
18324
19688
  alignItems: "center",
18325
19689
  justifyContent: "center",
@@ -18443,7 +19807,7 @@ const InnerContentBuilder = ({
18443
19807
  position: "fixed",
18444
19808
  inset: 0,
18445
19809
  background: "rgba(15, 23, 42, 0.5)",
18446
- zIndex: 10200,
19810
+ zIndex: 230,
18447
19811
  display: "flex",
18448
19812
  alignItems: "center",
18449
19813
  justifyContent: "center",