@ozguraltan/strapi-content-input 1.0.8 → 1.0.10

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.
@@ -2,8 +2,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React, { useState, useMemo, useRef, createContext, useContext, useEffect } from "react";
3
3
  import { createPortal } from "react-dom";
4
4
  import cloneDeep from "lodash/cloneDeep";
5
- import { M as MaterialIcon } from "./index-BIwC3VPC.mjs";
6
- import { useFetchClient } from "@strapi/strapi/admin";
5
+ import { M as MaterialIcon } from "./index-DV8S3QWG.mjs";
6
+ import { Swiper, SwiperSlide } from "swiper/react";
7
+ import { Navigation, Pagination, Autoplay, Mousewheel, EffectFade, EffectCube, EffectCoverflow, EffectFlip } from "swiper/modules";
8
+ import { useFetchClient, useStrapiApp } from "@strapi/strapi/admin";
7
9
  const ROW_PRESETS = [
8
10
  {
9
11
  id: "12",
@@ -2313,6 +2315,7 @@ function buildRichSampleRows() {
2313
2315
  }
2314
2316
  ];
2315
2317
  }
2318
+ const SWIPER_BUNDLE_CSS = '/**\n * Swiper 14.4.0\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n * https://swiperjs.com\n *\n * Copyright 2014-2026 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: October 30, 2026\n */\n\n:root{--swiper-theme-color:#007aff}:host{display:block;margin-left:auto;margin-right:auto;position:relative;z-index:1}.swiper{display:block;list-style:none;margin-left:auto;margin-right:auto;overflow:hidden;padding:0;position:relative;z-index:1}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{box-sizing:initial;display:flex;height:100%;position:relative;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function,initial);width:100%;z-index:1}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{display:block;flex-shrink:0;height:100%;position:relative;transition-property:transform;width:100%}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{backface-visibility:hidden;transform:translateZ(0)}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px;.swiper-cube-shadow,.swiper-slide{transform-style:preserve-3d}}.swiper-css-mode{>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;&::-webkit-scrollbar{display:none}}>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}&.swiper-horizontal{>.swiper-wrapper{scroll-snap-type:x mandatory}>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-slides-offset-before);scroll-margin-inline-start:var(--swiper-slides-offset-before)}>.swiper-wrapper>.swiper-slide:last-child{margin-inline-end:var(--swiper-slides-offset-after)}}&.swiper-vertical{>.swiper-wrapper{scroll-snap-type:y mandatory}>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-slides-offset-before);scroll-margin-block-start:var(--swiper-slides-offset-before)}>.swiper-wrapper>.swiper-slide:last-child{margin-block-end:var(--swiper-slides-offset-after)}}&.swiper-free-mode{>.swiper-wrapper{scroll-snap-type:none}>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}}&.swiper-centered{>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}}&.swiper-centered.swiper-horizontal{>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}}&.swiper-centered.swiper-vertical{>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}>.swiper-wrapper:before{height:var(--swiper-centered-offset-after);min-width:1px;width:100%}}}.swiper-3d{.swiper-slide-shadow,.swiper-slide-shadow-bottom,.swiper-slide-shadow-left,.swiper-slide-shadow-right,.swiper-slide-shadow-top{height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%;z-index:10}.swiper-slide-shadow{background:#00000026}.swiper-slide-shadow-left{background-image:linear-gradient(270deg,#00000080,#0000)}.swiper-slide-shadow-right{background-image:linear-gradient(90deg,#00000080,#0000)}.swiper-slide-shadow-top{background-image:linear-gradient(0deg,#00000080,#0000)}.swiper-slide-shadow-bottom{background-image:linear-gradient(180deg,#00000080,#0000)}}.swiper-lazy-preloader{border:4px solid var(--swiper-preloader-color,var(--swiper-theme-color));border-radius:50%;border-top:4px solid #0000;box-sizing:border-box;height:42px;left:50%;margin-left:-21px;margin-top:-21px;position:absolute;top:50%;transform-origin:50%;width:42px;z-index:10}.swiper-watch-progress .swiper-slide-visible,.swiper:not(.swiper-watch-progress){.swiper-lazy-preloader{animation:swiper-preloader-spin 1s linear infinite}}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.swiper-virtual .swiper-slide{-webkit-backface-visibility:hidden;transform:translateZ(0)}.swiper-virtual.swiper-css-mode{.swiper-wrapper:after{content:"";left:0;pointer-events:none;position:absolute;top:0}}.swiper-virtual.swiper-css-mode.swiper-horizontal{.swiper-wrapper:after{height:1px;width:var(--swiper-virtual-size)}}.swiper-virtual.swiper-css-mode.swiper-vertical{.swiper-wrapper:after{height:var(--swiper-virtual-size);width:1px}}:root{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{align-items:center;color:var(--swiper-navigation-color,var(--swiper-theme-color));cursor:pointer;display:flex;height:var(--swiper-navigation-size);justify-content:center;position:absolute;width:var(--swiper-navigation-size);z-index:10;&.swiper-button-disabled{cursor:auto;opacity:.35;pointer-events:none}&.swiper-button-hidden{cursor:auto;opacity:0;pointer-events:none}.swiper-navigation-disabled &{display:none!important}::slotted(svg),svg{height:100%;object-fit:contain;transform-origin:center;width:100%;fill:currentColor;pointer-events:none}}.swiper-button-lock{display:none}.swiper-button-next,.swiper-button-prev{margin-top:calc(0px - var(--swiper-navigation-size)/2);top:var(--swiper-navigation-top-offset,50%)}.swiper-button-prev{left:var(--swiper-navigation-sides-offset,4px);right:auto;.swiper-navigation-icon,::slotted(.swiper-navigation-icon){transform:rotate(180deg)}}.swiper-button-next{left:auto;right:var(--swiper-navigation-sides-offset,4px)}.swiper-horizontal{.swiper-button-next,.swiper-button-prev,~.swiper-button-next,~.swiper-button-prev{margin-left:0;margin-top:calc(0px - var(--swiper-navigation-size)/2);top:var(--swiper-navigation-top-offset,50%)}&.swiper-rtl .swiper-button-next,&.swiper-rtl~.swiper-button-next,&~.swiper-button-prev,.swiper-button-prev{left:var(--swiper-navigation-sides-offset,4px);right:auto}&.swiper-rtl .swiper-button-prev,&.swiper-rtl~.swiper-button-prev,&~.swiper-button-next,.swiper-button-next{left:auto;right:var(--swiper-navigation-sides-offset,4px)}&.swiper-rtl .swiper-button-next,&.swiper-rtl~.swiper-button-next,&~.swiper-button-prev,.swiper-button-prev{.swiper-navigation-icon,::slotted(.swiper-navigation-icon){transform:rotate(180deg)}}&.swiper-rtl .swiper-button-prev,&.swiper-rtl~.swiper-button-prev{.swiper-navigation-icon,::slotted(.swiper-navigation-icon){transform:rotate(0deg)}}}.swiper-vertical{.swiper-button-next,.swiper-button-prev,~.swiper-button-next,~.swiper-button-prev{left:var(--swiper-navigation-top-offset,50%);margin-left:calc(0px - var(--swiper-navigation-size)/2);margin-top:0;right:auto}.swiper-button-prev,~.swiper-button-prev{bottom:auto;top:var(--swiper-navigation-sides-offset,4px);.swiper-navigation-icon,::slotted(.swiper-navigation-icon){transform:rotate(-90deg)}}.swiper-button-next,~.swiper-button-next{bottom:var(--swiper-navigation-sides-offset,4px);top:auto;.swiper-navigation-icon,::slotted(.swiper-navigation-icon){transform:rotate(90deg)}}}.swiper-pagination{position:absolute;text-align:center;transform:translateZ(0);transition:opacity .3s;z-index:10;&.swiper-pagination-hidden{opacity:0}&.swiper-pagination-disabled,.swiper-pagination-disabled>&{display:none!important}}.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:var(--swiper-pagination-bottom,8px);left:0;top:var(--swiper-pagination-top,auto);width:100%}.swiper-pagination-bullets-dynamic{font-size:0;overflow:hidden;.swiper-pagination-bullet{position:relative;transform:scale(.33)}.swiper-pagination-bullet-active,.swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullet-active-prev{transform:scale(.66)}.swiper-pagination-bullet-active-prev-prev{transform:scale(.33)}.swiper-pagination-bullet-active-next{transform:scale(.66)}.swiper-pagination-bullet-active-next-next{transform:scale(.33)}}.swiper-pagination-bullet{background:var(--swiper-pagination-bullet-inactive-color,#000);border-radius:var(--swiper-pagination-bullet-border-radius,50%);display:inline-block;height:var(--swiper-pagination-bullet-height,var(--swiper-pagination-bullet-size,8px));opacity:var(--swiper-pagination-bullet-inactive-opacity,.2);width:var(--swiper-pagination-bullet-width,var(--swiper-pagination-bullet-size,8px));button&{appearance:none;border:none;box-shadow:none;margin:0;padding:0}.swiper-pagination-clickable &{cursor:pointer}&:only-child{display:none!important}}.swiper-pagination-bullet-active{background:var(--swiper-pagination-color,var(--swiper-theme-color));opacity:var(--swiper-pagination-bullet-opacity,1)}.swiper-pagination-vertical.swiper-pagination-bullets,.swiper-vertical>.swiper-pagination-bullets{left:var(--swiper-pagination-left,auto);right:var(--swiper-pagination-right,8px);top:50%;transform:translate3d(0,-50%,0);.swiper-pagination-bullet{display:block;margin:var(--swiper-pagination-bullet-vertical-gap,6px) 0}&.swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px;.swiper-pagination-bullet{display:inline-block;transition:transform .2s,top .2s}}}.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-horizontal.swiper-pagination-bullets{.swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap,4px)}&.swiper-pagination-bullets-dynamic{left:50%;transform:translateX(-50%);white-space:nowrap;.swiper-pagination-bullet{transition:transform .2s,left .2s}}}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:transform .2s,right .2s}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color,inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color,#00000040);position:absolute;.swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color,var(--swiper-theme-color));height:100%;left:0;position:absolute;top:0;transform:scale(0);transform-origin:left top;width:100%}.swiper-rtl & .swiper-pagination-progressbar-fill{transform-origin:right top}&.swiper-pagination-horizontal,&.swiper-pagination-vertical.swiper-pagination-progressbar-opposite,.swiper-horizontal>&,.swiper-vertical>&.swiper-pagination-progressbar-opposite{height:var(--swiper-pagination-progressbar-size,4px);left:0;top:0;width:100%}&.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite,&.swiper-pagination-vertical,.swiper-horizontal>&.swiper-pagination-progressbar-opposite,.swiper-vertical>&{height:100%;left:0;top:0;width:var(--swiper-pagination-progressbar-size,4px)}}.swiper-pagination-lock{display:none}.swiper-scrollbar{background:var(--swiper-scrollbar-bg-color,#0000001a);border-radius:var(--swiper-scrollbar-border-radius,10px);position:relative;touch-action:none;&.swiper-scrollbar-disabled,.swiper-scrollbar-disabled>&{display:none!important}&.swiper-scrollbar-horizontal,.swiper-horizontal>&{bottom:var(--swiper-scrollbar-bottom,4px);height:var(--swiper-scrollbar-size,4px);left:var(--swiper-scrollbar-sides-offset,1%);position:absolute;top:var(--swiper-scrollbar-top,auto);width:calc(100% - var(--swiper-scrollbar-sides-offset, 1%)*2);z-index:50}&.swiper-scrollbar-vertical,.swiper-vertical>&{height:calc(100% - var(--swiper-scrollbar-sides-offset, 1%)*2);left:var(--swiper-scrollbar-left,auto);position:absolute;right:var(--swiper-scrollbar-right,4px);top:var(--swiper-scrollbar-sides-offset,1%);width:var(--swiper-scrollbar-size,4px);z-index:50}}.swiper-scrollbar-drag{background:var(--swiper-scrollbar-drag-bg-color,#00000080);border-radius:var(--swiper-scrollbar-border-radius,10px);height:100%;left:0;position:relative;top:0;width:100%}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{align-items:center;display:flex;height:100%;justify-content:center;text-align:center;width:100%;>canvas,>img,>svg{max-height:100%;max-width:100%;object-fit:contain}}.swiper-slide-zoomed{cursor:move;touch-action:none}.swiper .swiper-notification{left:0;opacity:0;pointer-events:none;position:absolute;top:0;z-index:-1000}.swiper-free-mode>.swiper-wrapper{margin:0 auto;transition-timing-function:ease-out}.swiper-grid>.swiper-wrapper{flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{flex-direction:column;flex-wrap:wrap}.swiper-fade{&.swiper-free-mode{.swiper-slide{transition-timing-function:ease-out}}.swiper-slide{pointer-events:none;transition-property:opacity;.swiper-slide{pointer-events:none}}.swiper-slide-active{pointer-events:auto;& .swiper-slide-active{pointer-events:auto}}}.swiper.swiper-cube{overflow:visible}.swiper-cube{.swiper-slide{backface-visibility:hidden;height:100%;pointer-events:none;transform-origin:0 0;visibility:hidden;width:100%;z-index:1;.swiper-slide{pointer-events:none}}&.swiper-rtl .swiper-slide{transform-origin:100% 0}.swiper-slide-active{&,& .swiper-slide-active{pointer-events:auto}}.swiper-slide-active,.swiper-slide-next,.swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-cube-shadow{bottom:0;height:100%;left:0;opacity:.6;position:absolute;width:100%;z-index:0;&:before{background:#000;bottom:0;content:"";filter:blur(50px);left:0;position:absolute;right:0;top:0}}}.swiper-cube{.swiper-slide-next+.swiper-slide{pointer-events:auto;visibility:visible}}.swiper-cube{.swiper-slide-shadow-cube.swiper-slide-shadow-bottom,.swiper-slide-shadow-cube.swiper-slide-shadow-left,.swiper-slide-shadow-cube.swiper-slide-shadow-right,.swiper-slide-shadow-cube.swiper-slide-shadow-top{backface-visibility:hidden;z-index:0}}.swiper.swiper-flip{overflow:visible}.swiper-flip{.swiper-slide{backface-visibility:hidden;pointer-events:none;z-index:1;.swiper-slide{pointer-events:none}}.swiper-slide-active{&,& .swiper-slide-active{pointer-events:auto}}}.swiper-flip{.swiper-slide-shadow-flip.swiper-slide-shadow-bottom,.swiper-slide-shadow-flip.swiper-slide-shadow-left,.swiper-slide-shadow-flip.swiper-slide-shadow-right,.swiper-slide-shadow-flip.swiper-slide-shadow-top{backface-visibility:hidden;z-index:0}}.swiper-creative{.swiper-slide{backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}}.swiper.swiper-cards{overflow:visible}.swiper-cards{.swiper-slide{backface-visibility:hidden;overflow:hidden;transform-origin:center bottom}}';
2316
2319
  const BREAKPOINTS = [
2317
2320
  { infix: "", minWidth: null },
2318
2321
  { infix: "-sm", minWidth: 560 },
@@ -2715,6 +2718,49 @@ ${bpCss}
2715
2718
  .ci-canvas--clean .ci-block__empty {
2716
2719
  display: none !important;
2717
2720
  }
2721
+
2722
+ /* Official Swiper.js Bundle Styles */
2723
+ ${SWIPER_BUNDLE_CSS}
2724
+
2725
+ .ci-swiper {
2726
+ width: 100%;
2727
+ border-radius: 6px;
2728
+ overflow: hidden;
2729
+ background: #0f172a;
2730
+ user-select: none;
2731
+ }
2732
+ .ci-swiper .swiper-slide {
2733
+ height: auto;
2734
+ overflow: hidden;
2735
+ user-select: none;
2736
+ }
2737
+ .ci-swiper .swiper-slide img {
2738
+ -webkit-user-drag: none;
2739
+ user-select: none;
2740
+ }
2741
+ .ci-swiper .swiper-button-prev,
2742
+ .ci-swiper .swiper-button-next {
2743
+ width: 34px;
2744
+ height: 34px;
2745
+ border-radius: 50%;
2746
+ background: rgba(255, 255, 255, 0.88);
2747
+ color: #0f172a;
2748
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
2749
+ }
2750
+ .ci-swiper .swiper-button-prev::after,
2751
+ .ci-swiper .swiper-button-next::after {
2752
+ font-size: 14px;
2753
+ font-weight: 800;
2754
+ }
2755
+ .ci-swiper .swiper-pagination-bullet {
2756
+ background: rgba(255, 255, 255, 0.7);
2757
+ opacity: 1;
2758
+ }
2759
+ .ci-swiper .swiper-pagination-bullet-active {
2760
+ background: #38bdf8;
2761
+ width: 18px;
2762
+ border-radius: 4px;
2763
+ }
2718
2764
  `;
2719
2765
  }
2720
2766
  const STYLE_TAG_ID = "strapi-ci-canvas-styles";
@@ -3183,6 +3229,9 @@ const RichHtmlEditor = ({
3183
3229
  const tr = locale === "tr";
3184
3230
  const effectivePlaceholder = placeholder || (tr ? "Metin içeriğinizi buraya yazın..." : "Type your text content here...");
3185
3231
  const { get, post } = useFetchClient();
3232
+ const components = useStrapiApp("RichHtmlEditor", (state) => state.components);
3233
+ const NativeMediaLibraryDialog = components?.["media-library"];
3234
+ const [nativePickerOpen, setNativePickerOpen] = useState(false);
3186
3235
  const [sourceMode, setSourceMode] = useState(false);
3187
3236
  const editorRef = useRef(null);
3188
3237
  const isFocusedRef = useRef(false);
@@ -3292,9 +3341,14 @@ const RichHtmlEditor = ({
3292
3341
  setLinkDownload(false);
3293
3342
  setLinkDownloadName("");
3294
3343
  }
3295
- setShowMediaBrowser(openWithMedia);
3296
- if (openWithMedia) {
3297
- loadMediaLibrary();
3344
+ if (openWithMedia && NativeMediaLibraryDialog) {
3345
+ setShowMediaBrowser(false);
3346
+ setNativePickerOpen(true);
3347
+ } else {
3348
+ setShowMediaBrowser(openWithMedia);
3349
+ if (openWithMedia) {
3350
+ loadMediaLibrary();
3351
+ }
3298
3352
  }
3299
3353
  setLinkModalOpen(true);
3300
3354
  };
@@ -3782,7 +3836,7 @@ const RichHtmlEditor = ({
3782
3836
  position: "fixed",
3783
3837
  inset: 0,
3784
3838
  background: "rgba(15, 23, 42, 0.55)",
3785
- zIndex: 11e3,
3839
+ zIndex: 260,
3786
3840
  display: "flex",
3787
3841
  alignItems: "center",
3788
3842
  justifyContent: "center",
@@ -3907,6 +3961,10 @@ const RichHtmlEditor = ({
3907
3961
  {
3908
3962
  type: "button",
3909
3963
  onClick: () => {
3964
+ if (NativeMediaLibraryDialog) {
3965
+ setNativePickerOpen(true);
3966
+ return;
3967
+ }
3910
3968
  const next = !showMediaBrowser;
3911
3969
  setShowMediaBrowser(next);
3912
3970
  if (next && mediaFiles.length === 0) {
@@ -4383,6 +4441,20 @@ const RichHtmlEditor = ({
4383
4441
  }
4384
4442
  ),
4385
4443
  document.body
4444
+ ),
4445
+ nativePickerOpen && NativeMediaLibraryDialog && /* @__PURE__ */ jsx(
4446
+ NativeMediaLibraryDialog,
4447
+ {
4448
+ allowedTypes: ["files", "images", "videos", "audios"],
4449
+ multiple: false,
4450
+ onClose: () => setNativePickerOpen(false),
4451
+ onSelectAssets: (selectedAssets) => {
4452
+ if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
4453
+ selectMediaFileForLink(selectedAssets[0]);
4454
+ }
4455
+ setNativePickerOpen(false);
4456
+ }
4457
+ }
4386
4458
  )
4387
4459
  ]
4388
4460
  }
@@ -5353,7 +5425,7 @@ const TabAccordionEditor = ({ widget, onChange }) => {
5353
5425
  style: {
5354
5426
  position: "fixed",
5355
5427
  inset: 0,
5356
- zIndex: 10030,
5428
+ zIndex: 215,
5357
5429
  background: "rgba(15, 23, 42, 0.65)",
5358
5430
  display: "flex",
5359
5431
  alignItems: "center",
@@ -6905,6 +6977,24 @@ function resolveYoutubeVideoId(raw) {
6905
6977
  if (extracted === "dQw4w9WgXcQ") return "M7lc1UVf-VE";
6906
6978
  return extracted;
6907
6979
  }
6980
+ function buildSharpImageUrl(rawUrl, imageSettings) {
6981
+ if (!rawUrl) return "";
6982
+ if (!imageSettings || !imageSettings.process) return rawUrl;
6983
+ const proc = String(imageSettings.process).toLowerCase();
6984
+ if (proc !== "fit" && proc !== "widen") return rawUrl;
6985
+ const w = Number(imageSettings.cWidth) || 0;
6986
+ const h = Number(imageSettings.cHeight) || 0;
6987
+ if (w <= 0 && h <= 0) return rawUrl;
6988
+ if (rawUrl.includes("/api/content-input/image") || rawUrl.includes("/content-input/image")) {
6989
+ return rawUrl;
6990
+ }
6991
+ const params = new URLSearchParams();
6992
+ params.set("src", rawUrl);
6993
+ params.set("process", proc);
6994
+ if (w > 0) params.set("w", String(w));
6995
+ if (proc === "fit" && h > 0) params.set("h", String(h));
6996
+ return `/api/content-input/image?${params.toString()}`;
6997
+ }
6908
6998
  const WidgetPreview = ({
6909
6999
  widget,
6910
7000
  isEditing,
@@ -6930,25 +7020,6 @@ const WidgetPreview = ({
6930
7020
  const galleryKind = options?.kind || (options?.type === "grid" ? "gridGallery" : "swiper");
6931
7021
  const swiperSettings = options?.settings || {};
6932
7022
  const autoplayConfig = swiperSettings?.autoplay;
6933
- const isAutoplayActive = id === "gallery" && galleryKind === "swiper" && Boolean(autoplayConfig) && galleryImages.length > 1;
6934
- useEffect(() => {
6935
- if (!isAutoplayActive) return;
6936
- const delay = typeof autoplayConfig === "object" && Number(autoplayConfig.delay) >= 500 ? Number(autoplayConfig.delay) : 4e3;
6937
- const reverse = typeof autoplayConfig === "object" && Boolean(autoplayConfig.reverseDirection);
6938
- const stopOnLast = typeof autoplayConfig === "object" && Boolean(autoplayConfig.stopOnLastSlide);
6939
- const timer = setInterval(() => {
6940
- setGalleryIndex((prev) => {
6941
- if (stopOnLast && !reverse && prev >= galleryImages.length - 1) {
6942
- return prev;
6943
- }
6944
- if (reverse) {
6945
- return (prev - 1 + galleryImages.length) % galleryImages.length;
6946
- }
6947
- return (prev + 1) % galleryImages.length;
6948
- });
6949
- }, delay);
6950
- return () => clearInterval(timer);
6951
- }, [isAutoplayActive, autoplayConfig, galleryImages.length]);
6952
7023
  if (id === "HtmlEditor") {
6953
7024
  const html = typeof data === "string" ? data : data?.content || `<p>${t("widgets.htmlEditor.placeholder")}</p>`;
6954
7025
  const explicitBg = options?.backgroundColor || options?.styleOptions?.backgroundColor || "transparent";
@@ -7154,7 +7225,7 @@ const WidgetPreview = ({
7154
7225
  const imgProcess = imageSettings.process || "";
7155
7226
  const customW = Number(imageSettings.cWidth) || 0;
7156
7227
  const customH = Number(imageSettings.cHeight) || 0;
7157
- const imgObjectFit = imgProcess === "fit" ? "contain" : "cover";
7228
+ const imgObjectFit = "cover";
7158
7229
  if (images.length === 0) {
7159
7230
  return /* @__PURE__ */ jsxs(
7160
7231
  "div",
@@ -7192,7 +7263,7 @@ const WidgetPreview = ({
7192
7263
  position: "fixed",
7193
7264
  inset: 0,
7194
7265
  background: "rgba(15, 23, 42, 0.86)",
7195
- zIndex: 11500,
7266
+ zIndex: 280,
7196
7267
  display: "flex",
7197
7268
  alignItems: "center",
7198
7269
  justifyContent: "center",
@@ -7385,7 +7456,7 @@ const WidgetPreview = ({
7385
7456
  children: /* @__PURE__ */ jsx(
7386
7457
  "img",
7387
7458
  {
7388
- src: img.target_url || img.url,
7459
+ src: buildSharpImageUrl(img.target_url || img.url, imageSettings),
7389
7460
  alt: img.caption || `${t("widgets.gallery.label")} ${i + 1}`,
7390
7461
  style: {
7391
7462
  width: "100%",
@@ -7409,42 +7480,69 @@ const WidgetPreview = ({
7409
7480
  const spaceBetween = Math.max(0, Number(swiperSettings?.spaceBetween) ?? 12);
7410
7481
  const showNav = swiperSettings?.navigation !== false;
7411
7482
  const showPagination = swiperSettings?.pagination !== false;
7412
- const grabCursor = Boolean(swiperSettings?.grabCursor);
7413
- const safeIdx = images.length > 0 ? galleryIndex % images.length : 0;
7414
- const visibleSlides = Array.from({ length: slidesPerView }, (_, offset) => {
7415
- const itemIndex = (safeIdx + offset) % images.length;
7416
- return { item: images[itemIndex], index: itemIndex };
7417
- });
7418
- const containerHeight = customH > 0 ? Math.min(customH, 380) : 220;
7483
+ const grabCursor = Boolean(swiperSettings?.grabCursor ?? true);
7484
+ const isLoop = Boolean(swiperSettings?.loop) && images.length > slidesPerView;
7485
+ const isMousewheel = Boolean(swiperSettings?.mousewheel);
7486
+ images.length > 0 ? galleryIndex % images.length : 0;
7487
+ const slideAspectRatio = imgProcess === "fit" && customW > 0 && customH > 0 ? `${customW} / ${customH}` : slidesPerView > 1 ? "4 / 3" : "16 / 9";
7488
+ const resolvedAutoplay = Boolean(autoplayConfig ?? options?.autoplay) ? {
7489
+ delay: typeof autoplayConfig === "object" && Number(autoplayConfig.delay) >= 500 ? Number(autoplayConfig.delay) : 4e3,
7490
+ disableOnInteraction: typeof autoplayConfig === "object" ? Boolean(autoplayConfig.disableOnInteraction) : false,
7491
+ stopOnLastSlide: typeof autoplayConfig === "object" ? Boolean(autoplayConfig.stopOnLastSlide) : false,
7492
+ reverseDirection: typeof autoplayConfig === "object" ? Boolean(autoplayConfig.reverseDirection) : false
7493
+ } : false;
7494
+ const swiperKey = [
7495
+ effect,
7496
+ slidesPerView,
7497
+ spaceBetween,
7498
+ isLoop ? "loop" : "noloop",
7499
+ showNav ? "nav" : "nonav",
7500
+ showPagination ? "pag" : "nopag",
7501
+ isMousewheel ? "mw" : "nomw",
7502
+ grabCursor ? "grab" : "nograb",
7503
+ resolvedAutoplay ? `ap-${resolvedAutoplay.delay}-${resolvedAutoplay.reverseDirection}` : "noap"
7504
+ ].join("|");
7419
7505
  return /* @__PURE__ */ jsxs(Fragment, { children: [
7420
7506
  /* @__PURE__ */ jsxs(
7421
7507
  "div",
7422
7508
  {
7423
7509
  style: {
7424
7510
  position: "relative",
7511
+ width: "100%",
7425
7512
  borderRadius: 6,
7426
7513
  overflow: "hidden",
7427
- background: "#0f172a",
7428
- height: containerHeight,
7429
- maxWidth: customW > 0 ? `${customW}px` : void 0,
7430
- cursor: grabCursor ? "grab" : isPopupEnabled ? "zoom-in" : "default"
7514
+ background: "#0f172a"
7431
7515
  },
7432
7516
  children: [
7433
7517
  /* @__PURE__ */ jsx(
7434
- "div",
7518
+ Swiper,
7435
7519
  {
7436
- style: {
7437
- display: "grid",
7438
- gridTemplateColumns: `repeat(${slidesPerView}, 1fr)`,
7439
- gap: spaceBetween,
7440
- width: "100%",
7441
- height: "100%",
7442
- padding: slidesPerView > 1 && spaceBetween > 0 ? 4 : 0,
7443
- boxSizing: "border-box"
7444
- },
7445
- children: visibleSlides.map(({ item, index }) => {
7446
- const slideUrl = item?.target_url || item?.url || "";
7447
- return /* @__PURE__ */ jsx(
7520
+ className: "ci-swiper",
7521
+ modules: [
7522
+ Navigation,
7523
+ Pagination,
7524
+ Autoplay,
7525
+ Mousewheel,
7526
+ EffectFade,
7527
+ EffectCube,
7528
+ EffectCoverflow,
7529
+ EffectFlip
7530
+ ],
7531
+ effect,
7532
+ slidesPerView,
7533
+ spaceBetween,
7534
+ loop: isLoop,
7535
+ grabCursor,
7536
+ mousewheel: isMousewheel ? { forceToAxis: false } : false,
7537
+ navigation: showNav && images.length > 1,
7538
+ pagination: showPagination && images.length > 1 ? { clickable: true } : false,
7539
+ autoplay: images.length > 1 ? resolvedAutoplay : false,
7540
+ onSlideChange: (s) => setGalleryIndex(s.realIndex ?? s.activeIndex ?? 0),
7541
+ style: { width: "100%" },
7542
+ children: images.map((item, index) => {
7543
+ const rawSlideUrl = item?.target_url || item?.url || "";
7544
+ const slideUrl = buildSharpImageUrl(rawSlideUrl, imageSettings);
7545
+ return /* @__PURE__ */ jsx(SwiperSlide, { children: /* @__PURE__ */ jsxs(
7448
7546
  "div",
7449
7547
  {
7450
7548
  onClick: (e) => {
@@ -7456,30 +7554,62 @@ const WidgetPreview = ({
7456
7554
  style: {
7457
7555
  position: "relative",
7458
7556
  width: "100%",
7459
- height: "100%",
7557
+ aspectRatio: slideAspectRatio,
7460
7558
  overflow: "hidden",
7461
7559
  borderRadius: slidesPerView > 1 ? 4 : 0,
7462
- background: "#1e293b"
7560
+ background: "#1e293b",
7561
+ cursor: grabCursor ? "grab" : isPopupEnabled ? "zoom-in" : "default"
7463
7562
  },
7464
- children: slideUrl && /* @__PURE__ */ jsx(
7465
- "img",
7466
- {
7467
- src: slideUrl,
7468
- alt: item?.caption || t("widgets.gallery.label"),
7469
- style: {
7470
- width: "100%",
7471
- height: "100%",
7472
- objectFit: imgObjectFit,
7473
- display: "block",
7474
- transition: "opacity 0.25s ease, transform 0.25s ease"
7563
+ children: [
7564
+ slideUrl && /* @__PURE__ */ jsx(
7565
+ "img",
7566
+ {
7567
+ src: slideUrl,
7568
+ alt: item?.caption || t("widgets.gallery.label"),
7569
+ draggable: false,
7570
+ style: {
7571
+ width: "100%",
7572
+ height: "100%",
7573
+ objectFit: imgObjectFit,
7574
+ display: "block",
7575
+ userSelect: "none"
7576
+ }
7475
7577
  }
7476
- }
7477
- )
7478
- },
7479
- `${index}-${offsetKey(index)}`
7480
- );
7578
+ ),
7579
+ item?.caption && /* @__PURE__ */ jsxs(
7580
+ "div",
7581
+ {
7582
+ style: {
7583
+ position: "absolute",
7584
+ left: 8,
7585
+ right: 8,
7586
+ bottom: showPagination ? 26 : 8,
7587
+ display: "flex",
7588
+ alignItems: "center",
7589
+ justifyContent: "space-between",
7590
+ color: "#fff",
7591
+ background: "rgba(15, 23, 42, 0.68)",
7592
+ padding: "4px 8px",
7593
+ borderRadius: 4,
7594
+ fontSize: 11,
7595
+ pointerEvents: "none"
7596
+ },
7597
+ children: [
7598
+ /* @__PURE__ */ jsx("span", { children: item.caption }),
7599
+ /* @__PURE__ */ jsxs("span", { style: { fontWeight: 600 }, children: [
7600
+ index + 1,
7601
+ " / ",
7602
+ images.length
7603
+ ] })
7604
+ ]
7605
+ }
7606
+ )
7607
+ ]
7608
+ }
7609
+ ) }, `${index}-${rawSlideUrl}`);
7481
7610
  })
7482
- }
7611
+ },
7612
+ swiperKey
7483
7613
  ),
7484
7614
  /* @__PURE__ */ jsx(
7485
7615
  "div",
@@ -7488,6 +7618,7 @@ const WidgetPreview = ({
7488
7618
  position: "absolute",
7489
7619
  top: 8,
7490
7620
  left: 8,
7621
+ zIndex: 10,
7491
7622
  display: "flex",
7492
7623
  alignItems: "center",
7493
7624
  gap: 6,
@@ -7512,121 +7643,7 @@ const WidgetPreview = ({
7512
7643
  }
7513
7644
  )
7514
7645
  }
7515
- ),
7516
- /* @__PURE__ */ jsxs(
7517
- "div",
7518
- {
7519
- style: {
7520
- position: "absolute",
7521
- left: 10,
7522
- bottom: showPagination ? 22 : 10,
7523
- right: 10,
7524
- display: "flex",
7525
- alignItems: "center",
7526
- justifyContent: "space-between",
7527
- color: "#fff",
7528
- background: "rgba(15, 23, 42, 0.65)",
7529
- padding: "5px 10px",
7530
- borderRadius: 4,
7531
- fontSize: 12,
7532
- pointerEvents: "none"
7533
- },
7534
- children: [
7535
- /* @__PURE__ */ jsx("span", { children: images[safeIdx]?.caption || images[safeIdx]?.filename || t("widgets.gallery.label") }),
7536
- /* @__PURE__ */ jsxs("span", { style: { fontWeight: 600 }, children: [
7537
- safeIdx + 1,
7538
- " / ",
7539
- images.length
7540
- ] })
7541
- ]
7542
- }
7543
- ),
7544
- showPagination && images.length > 1 && /* @__PURE__ */ jsx(
7545
- "div",
7546
- {
7547
- style: {
7548
- position: "absolute",
7549
- bottom: 6,
7550
- left: 0,
7551
- right: 0,
7552
- display: "flex",
7553
- alignItems: "center",
7554
- justifyContent: "center",
7555
- gap: 5
7556
- },
7557
- children: images.map((_, dotIdx) => /* @__PURE__ */ jsx(
7558
- "button",
7559
- {
7560
- type: "button",
7561
- onClick: (e) => {
7562
- e.stopPropagation();
7563
- setGalleryIndex(dotIdx);
7564
- },
7565
- style: {
7566
- width: dotIdx === safeIdx ? 16 : 6,
7567
- height: 6,
7568
- borderRadius: 3,
7569
- border: "none",
7570
- padding: 0,
7571
- background: dotIdx === safeIdx ? "#38bdf8" : "rgba(255,255,255,0.55)",
7572
- cursor: "pointer",
7573
- transition: "all 0.2s ease"
7574
- }
7575
- },
7576
- dotIdx
7577
- ))
7578
- }
7579
- ),
7580
- showNav && images.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
7581
- /* @__PURE__ */ jsx(
7582
- "button",
7583
- {
7584
- type: "button",
7585
- onClick: (e) => {
7586
- e.stopPropagation();
7587
- setGalleryIndex((prev) => (prev - 1 + images.length) % images.length);
7588
- },
7589
- style: {
7590
- position: "absolute",
7591
- top: "50%",
7592
- left: 8,
7593
- transform: "translateY(-50%)",
7594
- width: 28,
7595
- height: 28,
7596
- borderRadius: "50%",
7597
- border: "none",
7598
- background: "rgba(255,255,255,0.85)",
7599
- cursor: "pointer",
7600
- fontWeight: 700
7601
- },
7602
- children: "‹"
7603
- }
7604
- ),
7605
- /* @__PURE__ */ jsx(
7606
- "button",
7607
- {
7608
- type: "button",
7609
- onClick: (e) => {
7610
- e.stopPropagation();
7611
- setGalleryIndex((prev) => (prev + 1) % images.length);
7612
- },
7613
- style: {
7614
- position: "absolute",
7615
- top: "50%",
7616
- right: 8,
7617
- transform: "translateY(-50%)",
7618
- width: 28,
7619
- height: 28,
7620
- borderRadius: "50%",
7621
- border: "none",
7622
- background: "rgba(255,255,255,0.85)",
7623
- cursor: "pointer",
7624
- fontWeight: 700
7625
- },
7626
- children: "›"
7627
- }
7628
- )
7629
- ] })
7646
+ )
7630
7647
  ]
7631
7648
  }
7632
7649
  ),
@@ -7891,7 +7908,7 @@ const WidgetPreview = ({
7891
7908
  position: "fixed",
7892
7909
  inset: 0,
7893
7910
  background: "rgba(15, 23, 42, 0.82)",
7894
- zIndex: 11500,
7911
+ zIndex: 280,
7895
7912
  display: "flex",
7896
7913
  alignItems: "center",
7897
7914
  justifyContent: "center",
@@ -8674,9 +8691,6 @@ const WidgetPreview = ({
8674
8691
  /* @__PURE__ */ jsx("strong", { children: id })
8675
8692
  ] });
8676
8693
  };
8677
- function offsetKey(index) {
8678
- return String(index);
8679
- }
8680
8694
  function resolveEffectiveResponsiveValue(arr, bpIndex) {
8681
8695
  for (let i = bpIndex; i >= 0; i--) {
8682
8696
  if (arr[i]) return arr[i];
@@ -11471,11 +11485,17 @@ const UnitInput = ({
11471
11485
  function getFileKey(file) {
11472
11486
  return String(file?.id ?? file?.documentId ?? file?.url ?? file?.name ?? "");
11473
11487
  }
11474
- function mapStrapiFileToAsset(file) {
11475
- const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${f.url} ${f.width}w`).join(", ") : "";
11488
+ function mapStrapiFileToAsset(file, cacheBust) {
11489
+ const appendBust = (u) => {
11490
+ if (!u || !cacheBust) return u;
11491
+ const sep = u.includes("?") ? "&" : "?";
11492
+ return `${u}${sep}v=${Date.now()}`;
11493
+ };
11494
+ const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
11495
+ const finalUrl = appendBust(file.url || "");
11476
11496
  return {
11477
- target_url: file.url || "",
11478
- url: file.url || "",
11497
+ target_url: finalUrl,
11498
+ url: finalUrl,
11479
11499
  filename: file.name || file.filename || "media",
11480
11500
  mime_type: file.mime || file.mime_type || "application/octet-stream",
11481
11501
  size: file.size || 0,
@@ -11485,6 +11505,14 @@ function mapStrapiFileToAsset(file) {
11485
11505
  srcset: srcset || void 0
11486
11506
  };
11487
11507
  }
11508
+ const ASPECT_PRESETS = [
11509
+ { label: "Free", ratio: null },
11510
+ { label: "1:1", ratio: 1 },
11511
+ { label: "16:9", ratio: 16 / 9 },
11512
+ { label: "4:3", ratio: 4 / 3 },
11513
+ { label: "3:2", ratio: 3 / 2 },
11514
+ { label: "4:5", ratio: 4 / 5 }
11515
+ ];
11488
11516
  const StrapiMediaPicker = ({
11489
11517
  value,
11490
11518
  onChange,
@@ -11492,16 +11520,43 @@ const StrapiMediaPicker = ({
11492
11520
  multiple = false,
11493
11521
  onSelectMultiple
11494
11522
  }) => {
11495
- const { t } = useEditorTranslator();
11496
- const { get, post } = useFetchClient();
11523
+ const { t, locale } = useEditorTranslator();
11524
+ const tr = locale === "tr";
11525
+ const { get, post, put, del } = useFetchClient();
11497
11526
  const [modalOpen, setModalOpen] = useState(false);
11498
11527
  const [files, setFiles] = useState([]);
11528
+ const [folders, setFolders] = useState([]);
11529
+ const [currentFolderId, setCurrentFolderId] = useState(null);
11499
11530
  const [selectedFiles, setSelectedFiles] = useState([]);
11500
11531
  const [loading, setLoading] = useState(false);
11501
11532
  const [uploading, setUploading] = useState(false);
11502
11533
  const [search, setSearch] = useState("");
11503
- const [urlInput, setUrlInput] = useState(value?.target_url || value?.url || "");
11534
+ const [typeFilter, setTypeFilter] = useState("all");
11535
+ const [sortBy, setSortBy] = useState(
11536
+ "newest"
11537
+ );
11538
+ const [creatingFolder, setCreatingFolder] = useState(false);
11539
+ const [newFolderName, setNewFolderName] = useState("");
11540
+ const [editingFile, setEditingFile] = useState(null);
11541
+ const [editTab, setEditTab] = useState("crop");
11542
+ const [editName, setEditName] = useState("");
11543
+ const [editAlt, setEditAlt] = useState("");
11544
+ const [editCaption, setEditCaption] = useState("");
11545
+ const [editFolderId, setEditFolderId] = useState(null);
11546
+ const [savingDetails, setSavingDetails] = useState(false);
11547
+ const [naturalSize, setNaturalSize] = useState({
11548
+ width: 0,
11549
+ height: 0
11550
+ });
11551
+ const [cropRect, setCropRect] = useState({ x: 0, y: 0, width: 100, height: 100 });
11552
+ const [cropRotate, setCropRotate] = useState(0);
11553
+ const [aspectPreset, setAspectPreset] = useState(null);
11554
+ const [croppingBusy, setCroppingBusy] = useState(false);
11555
+ const [cropError, setCropError] = useState(null);
11556
+ const cropImgRef = useRef(null);
11557
+ const cropBoxRef = useRef(null);
11504
11558
  const fileInputRef = useRef(null);
11559
+ const [urlInput, setUrlInput] = useState(value?.target_url || value?.url || "");
11505
11560
  const effectiveLabel = label !== void 0 ? label : t("media.selectImage", "Select Image");
11506
11561
  useEffect(() => {
11507
11562
  setUrlInput(value?.target_url || value?.url || "");
@@ -11511,33 +11566,71 @@ const StrapiMediaPicker = ({
11511
11566
  try {
11512
11567
  const res = await get("/content-input/media");
11513
11568
  const primaryList = Array.isArray(res?.data?.data) ? res.data.data : Array.isArray(res?.data) ? res.data : null;
11569
+ const folderList = Array.isArray(res?.data?.folders) ? res.data.folders : [];
11570
+ if (folderList.length > 0) {
11571
+ setFolders(folderList);
11572
+ }
11514
11573
  if (primaryList) {
11515
11574
  setFiles(primaryList);
11516
- return;
11575
+ setLoading(false);
11576
+ return primaryList;
11517
11577
  }
11518
11578
  } catch {
11519
11579
  }
11520
11580
  try {
11521
- const fallbackRes = await get("/upload/files?pageSize=100&page=1");
11581
+ const fallbackRes = await get("/upload/files?pageSize=200&page=1");
11522
11582
  const fallbackList = Array.isArray(fallbackRes?.data?.results) ? fallbackRes.data.results : Array.isArray(fallbackRes?.data) ? fallbackRes.data : [];
11523
11583
  setFiles(fallbackList);
11584
+ return fallbackList;
11524
11585
  } catch {
11525
11586
  setFiles([]);
11587
+ return [];
11526
11588
  } finally {
11527
11589
  setLoading(false);
11528
11590
  }
11529
11591
  };
11530
- useEffect(() => {
11531
- if (!modalOpen) return;
11532
- setLoading(false);
11533
- }, [files, modalOpen]);
11592
+ const openEditorForFile = (file, initialTab = "crop") => {
11593
+ setEditingFile(file);
11594
+ setEditTab(file?.mime?.startsWith("image/") ? initialTab : "details");
11595
+ setEditName(file?.name || "");
11596
+ setEditAlt(file?.alternativeText || "");
11597
+ setEditCaption(file?.caption || "");
11598
+ setEditFolderId(file?.folder?.id ?? file?.folder ?? null);
11599
+ setCropRotate(0);
11600
+ setAspectPreset(null);
11601
+ setCropError(null);
11602
+ const w = Number(file?.width) || 800;
11603
+ const h = Number(file?.height) || 600;
11604
+ setNaturalSize({ width: w, height: h });
11605
+ setCropRect({
11606
+ x: 0,
11607
+ y: 0,
11608
+ width: w,
11609
+ height: h
11610
+ });
11611
+ };
11534
11612
  const handleOpenModal = (e) => {
11535
11613
  e.preventDefault();
11536
11614
  e.stopPropagation();
11537
11615
  setSelectedFiles([]);
11616
+ setEditingFile(null);
11538
11617
  setModalOpen(true);
11539
11618
  loadLibrary().finally(() => setLoading(false));
11540
11619
  };
11620
+ const handleOpenCropCurrent = async (e) => {
11621
+ e.preventDefault();
11622
+ e.stopPropagation();
11623
+ const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
11624
+ if (!currentUrl) return;
11625
+ setModalOpen(true);
11626
+ const loaded = files.length > 0 ? files : await loadLibrary();
11627
+ const match = loaded.find(
11628
+ (f) => f.url && f.url.split("?")[0] === currentUrl || value?.filename && f.name === value.filename
11629
+ );
11630
+ if (match) {
11631
+ openEditorForFile(match, "crop");
11632
+ }
11633
+ };
11541
11634
  const toggleFileSelection = (file) => {
11542
11635
  const key = getFileKey(file);
11543
11636
  setSelectedFiles((prev) => {
@@ -11550,7 +11643,7 @@ const StrapiMediaPicker = ({
11550
11643
  };
11551
11644
  const handleConfirmMultiple = () => {
11552
11645
  if (selectedFiles.length === 0) return;
11553
- const assets = selectedFiles.map(mapStrapiFileToAsset);
11646
+ const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
11554
11647
  if (onSelectMultiple) {
11555
11648
  onSelectMultiple(assets);
11556
11649
  } else {
@@ -11568,19 +11661,26 @@ const StrapiMediaPicker = ({
11568
11661
  for (let i = 0; i < inputFiles.length; i++) {
11569
11662
  formData.append("files", inputFiles[i]);
11570
11663
  }
11664
+ if (currentFolderId) {
11665
+ formData.append("fileInfo", JSON.stringify({ folder: currentFolderId }));
11666
+ }
11571
11667
  const res = await post("/upload", formData);
11572
11668
  const uploadedList = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
11573
11669
  await loadLibrary();
11574
11670
  if (uploadedList.length > 0) {
11575
- if (multiple) {
11576
- const assets = uploadedList.map(mapStrapiFileToAsset);
11577
- if (onSelectMultiple) {
11578
- onSelectMultiple(assets);
11671
+ if (!modalOpen) {
11672
+ if (multiple) {
11673
+ const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
11674
+ if (onSelectMultiple) {
11675
+ onSelectMultiple(assets);
11676
+ } else {
11677
+ assets.forEach((a) => onChange(a));
11678
+ }
11579
11679
  } else {
11580
- assets.forEach((a) => onChange(a));
11680
+ onChange(mapStrapiFileToAsset(uploadedList[0]));
11581
11681
  }
11582
- setSelectedFiles([]);
11583
- setModalOpen(false);
11682
+ } else if (multiple) {
11683
+ setSelectedFiles((prev) => [...prev, ...uploadedList]);
11584
11684
  } else {
11585
11685
  onChange(mapStrapiFileToAsset(uploadedList[0]));
11586
11686
  setModalOpen(false);
@@ -11593,6 +11693,175 @@ const StrapiMediaPicker = ({
11593
11693
  if (fileInputRef.current) fileInputRef.current.value = "";
11594
11694
  }
11595
11695
  };
11696
+ const handleCreateFolder = async () => {
11697
+ const trimmed = newFolderName.trim();
11698
+ if (!trimmed) return;
11699
+ try {
11700
+ const res = await post("/content-input/media/folder", {
11701
+ name: trimmed,
11702
+ parent: currentFolderId
11703
+ });
11704
+ const created = res?.data?.data || res?.data;
11705
+ setNewFolderName("");
11706
+ setCreatingFolder(false);
11707
+ await loadLibrary();
11708
+ if (created?.id) {
11709
+ setCurrentFolderId(Number(created.id));
11710
+ }
11711
+ } catch {
11712
+ }
11713
+ };
11714
+ const handleSaveDetails = async () => {
11715
+ if (!editingFile?.id) return;
11716
+ setSavingDetails(true);
11717
+ try {
11718
+ const res = await put(`/content-input/media/${editingFile.id}`, {
11719
+ name: editName.trim() || editingFile.name,
11720
+ alternativeText: editAlt,
11721
+ caption: editCaption,
11722
+ folder: editFolderId
11723
+ });
11724
+ const updated = res?.data?.data || res?.data;
11725
+ await loadLibrary();
11726
+ if (updated) {
11727
+ setEditingFile(updated);
11728
+ }
11729
+ } catch {
11730
+ } finally {
11731
+ setSavingDetails(false);
11732
+ }
11733
+ };
11734
+ const handleDeleteAsset = async (file, e) => {
11735
+ if (e) {
11736
+ e.preventDefault();
11737
+ e.stopPropagation();
11738
+ }
11739
+ if (!file?.id) return;
11740
+ 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?`;
11741
+ if (typeof window !== "undefined" && !window.confirm(confirmMsg)) return;
11742
+ try {
11743
+ await del(`/content-input/media/${file.id}`);
11744
+ setSelectedFiles((prev) => prev.filter((f) => getFileKey(f) !== getFileKey(file)));
11745
+ if (editingFile?.id === file.id) {
11746
+ setEditingFile(null);
11747
+ }
11748
+ await loadLibrary();
11749
+ } catch {
11750
+ }
11751
+ };
11752
+ const handleExecuteCrop = async (mode) => {
11753
+ if (!editingFile?.id) return;
11754
+ setCroppingBusy(true);
11755
+ setCropError(null);
11756
+ try {
11757
+ const res = await post("/content-input/media/crop", {
11758
+ id: editingFile.id,
11759
+ mode,
11760
+ x: Math.round(cropRect.x),
11761
+ y: Math.round(cropRect.y),
11762
+ width: Math.round(cropRect.width),
11763
+ height: Math.round(cropRect.height),
11764
+ rotate: cropRotate,
11765
+ name: editName.trim() || editingFile.name,
11766
+ alternativeText: editAlt,
11767
+ caption: editCaption
11768
+ });
11769
+ const resultFile = res?.data?.data || res?.data;
11770
+ await loadLibrary();
11771
+ if (resultFile) {
11772
+ const mapped = mapStrapiFileToAsset(resultFile, true);
11773
+ if (multiple && onSelectMultiple) {
11774
+ onSelectMultiple([mapped]);
11775
+ } else {
11776
+ onChange(mapped);
11777
+ }
11778
+ setEditingFile(null);
11779
+ setModalOpen(false);
11780
+ }
11781
+ } catch (err) {
11782
+ setCropError(err?.message || (tr ? "Kırpma işlemi başarısız oldu" : "Crop operation failed"));
11783
+ } finally {
11784
+ setCroppingBusy(false);
11785
+ }
11786
+ };
11787
+ const applyAspectPreset = (ratio) => {
11788
+ setAspectPreset(ratio);
11789
+ if (!ratio || !naturalSize.width || !naturalSize.height) return;
11790
+ let newW = naturalSize.width;
11791
+ let newH = Math.round(newW / ratio);
11792
+ if (newH > naturalSize.height) {
11793
+ newH = naturalSize.height;
11794
+ newW = Math.round(newH * ratio);
11795
+ }
11796
+ const newX = Math.max(0, Math.round((naturalSize.width - newW) / 2));
11797
+ const newY = Math.max(0, Math.round((naturalSize.height - newH) / 2));
11798
+ setCropRect({ x: newX, y: newY, width: newW, height: newH });
11799
+ };
11800
+ const startCropDrag = (e, dragType) => {
11801
+ e.preventDefault();
11802
+ e.stopPropagation();
11803
+ const container = cropBoxRef.current;
11804
+ if (!container || !naturalSize.width || !naturalSize.height) return;
11805
+ const bounds = container.getBoundingClientRect();
11806
+ if (!bounds.width || !bounds.height) return;
11807
+ const scaleX = naturalSize.width / bounds.width;
11808
+ const scaleY = naturalSize.height / bounds.height;
11809
+ const startClientX = e.clientX;
11810
+ const startClientY = e.clientY;
11811
+ const initial = { ...cropRect };
11812
+ const onMove = (ev) => {
11813
+ const dx = (ev.clientX - startClientX) * scaleX;
11814
+ const dy = (ev.clientY - startClientY) * scaleY;
11815
+ if (dragType === "move") {
11816
+ const nextX = Math.max(
11817
+ 0,
11818
+ Math.min(naturalSize.width - initial.width, Math.round(initial.x + dx))
11819
+ );
11820
+ const nextY = Math.max(
11821
+ 0,
11822
+ Math.min(naturalSize.height - initial.height, Math.round(initial.y + dy))
11823
+ );
11824
+ setCropRect({ ...initial, x: nextX, y: nextY });
11825
+ return;
11826
+ }
11827
+ let x = initial.x;
11828
+ let y = initial.y;
11829
+ let w = initial.width;
11830
+ let h = initial.height;
11831
+ if (dragType.includes("e")) {
11832
+ w = Math.max(20, Math.min(naturalSize.width - x, Math.round(initial.width + dx)));
11833
+ }
11834
+ if (dragType.includes("s")) {
11835
+ h = Math.max(20, Math.min(naturalSize.height - y, Math.round(initial.height + dy)));
11836
+ }
11837
+ if (dragType.includes("w")) {
11838
+ const maxDx = initial.width - 20;
11839
+ const clampedDx = Math.max(-initial.x, Math.min(maxDx, Math.round(dx)));
11840
+ x = initial.x + clampedDx;
11841
+ w = initial.width - clampedDx;
11842
+ }
11843
+ if (dragType.includes("n")) {
11844
+ const maxDy = initial.height - 20;
11845
+ const clampedDy = Math.max(-initial.y, Math.min(maxDy, Math.round(dy)));
11846
+ y = initial.y + clampedDy;
11847
+ h = initial.height - clampedDy;
11848
+ }
11849
+ if (aspectPreset) {
11850
+ h = Math.round(w / aspectPreset);
11851
+ if (y + h > naturalSize.height) {
11852
+ h = naturalSize.height - y;
11853
+ w = Math.round(h * aspectPreset);
11854
+ }
11855
+ }
11856
+ setCropRect({ x, y, width: Math.max(16, w), height: Math.max(16, h) });
11857
+ };
11858
+ const onUp = () => {
11859
+ window.removeEventListener("mousemove", onMove);
11860
+ window.removeEventListener("mouseup", onUp);
11861
+ };
11862
+ window.addEventListener("mousemove", onMove);
11863
+ window.addEventListener("mouseup", onUp);
11864
+ };
11596
11865
  const handleUrlApply = () => {
11597
11866
  const trimmed = urlInput.trim();
11598
11867
  if (!trimmed) {
@@ -11628,9 +11897,39 @@ const StrapiMediaPicker = ({
11628
11897
  };
11629
11898
  const previewUrl = value?.target_url || value?.url || "";
11630
11899
  const q = search.trim().toLowerCase();
11631
- const filteredFiles = files.filter(
11632
- (f) => !q || (f.name || "").toLowerCase().includes(q) || (f.ext || "").toLowerCase().includes(q) || (f.mime || "").toLowerCase().includes(q)
11633
- );
11900
+ const visibleFolders = folders.filter((fld) => {
11901
+ const parentId = fld.parent?.id ?? fld.parent ?? null;
11902
+ return parentId === currentFolderId;
11903
+ });
11904
+ const currentFolderObj = currentFolderId !== null ? folders.find((f) => Number(f.id) === currentFolderId) : null;
11905
+ const filteredFiles = files.filter((f) => {
11906
+ if (!q && currentFolderId !== null) {
11907
+ const fileFolderId = f.folder?.id ?? f.folder ?? null;
11908
+ if (Number(fileFolderId) !== currentFolderId) return false;
11909
+ }
11910
+ if (typeFilter === "image" && !f.mime?.startsWith("image/")) return false;
11911
+ if (typeFilter === "video" && !f.mime?.startsWith("video/")) return false;
11912
+ if (typeFilter === "audio" && !f.mime?.startsWith("audio/")) return false;
11913
+ if (typeFilter === "doc" && (f.mime?.startsWith("image/") || f.mime?.startsWith("video/") || f.mime?.startsWith("audio/"))) {
11914
+ return false;
11915
+ }
11916
+ if (!q) return true;
11917
+ 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);
11918
+ }).sort((a, b) => {
11919
+ if (sortBy === "oldest") {
11920
+ return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime();
11921
+ }
11922
+ if (sortBy === "nameAsc") {
11923
+ return String(a.name || "").localeCompare(String(b.name || ""));
11924
+ }
11925
+ if (sortBy === "nameDesc") {
11926
+ return String(b.name || "").localeCompare(String(a.name || ""));
11927
+ }
11928
+ if (sortBy === "sizeDesc") {
11929
+ return (Number(b.size) || 0) - (Number(a.size) || 0);
11930
+ }
11931
+ return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime();
11932
+ });
11634
11933
  return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
11635
11934
  effectiveLabel && /* @__PURE__ */ jsx("label", { style: { fontSize: 12, fontWeight: 600, color: "#475569" }, children: effectiveLabel }),
11636
11935
  previewUrl ? /* @__PURE__ */ jsxs(
@@ -11676,7 +11975,7 @@ const StrapiMediaPicker = ({
11676
11975
  children: value?.filename || t("common.image", "Image")
11677
11976
  }
11678
11977
  ),
11679
- /* @__PURE__ */ jsx(
11978
+ /* @__PURE__ */ jsxs(
11680
11979
  "div",
11681
11980
  {
11682
11981
  style: {
@@ -11686,7 +11985,10 @@ const StrapiMediaPicker = ({
11686
11985
  textOverflow: "ellipsis",
11687
11986
  whiteSpace: "nowrap"
11688
11987
  },
11689
- children: previewUrl
11988
+ children: [
11989
+ value?.width && value?.height ? `${value.width}×${value.height} · ` : "",
11990
+ previewUrl
11991
+ ]
11690
11992
  }
11691
11993
  )
11692
11994
  ] }),
@@ -11694,18 +11996,38 @@ const StrapiMediaPicker = ({
11694
11996
  "button",
11695
11997
  {
11696
11998
  type: "button",
11697
- onClick: (e) => {
11698
- e.stopPropagation();
11699
- onChange(null);
11700
- },
11701
- title: t("media.removeImage", "Remove Image"),
11999
+ onClick: handleOpenCropCurrent,
12000
+ title: tr ? "Görseli Kırp / Düzenle" : "Crop / Edit Image",
11702
12001
  style: {
11703
- border: "none",
11704
- background: "transparent",
11705
- color: "#dc2626",
12002
+ border: "1px solid #cbd5e1",
12003
+ borderRadius: 4,
12004
+ background: "#ffffff",
12005
+ color: "#2669a0",
11706
12006
  cursor: "pointer",
11707
- padding: 4
11708
- },
12007
+ padding: 4,
12008
+ display: "inline-flex",
12009
+ alignItems: "center",
12010
+ justifyContent: "center"
12011
+ },
12012
+ children: /* @__PURE__ */ jsx(MaterialIcon, { name: "crop", size: 15, color: "#2669a0" })
12013
+ }
12014
+ ),
12015
+ /* @__PURE__ */ jsx(
12016
+ "button",
12017
+ {
12018
+ type: "button",
12019
+ onClick: (e) => {
12020
+ e.stopPropagation();
12021
+ onChange(null);
12022
+ },
12023
+ title: t("media.removeImage", "Remove Image"),
12024
+ style: {
12025
+ border: "none",
12026
+ background: "transparent",
12027
+ color: "#dc2626",
12028
+ cursor: "pointer",
12029
+ padding: 4
12030
+ },
11709
12031
  children: /* @__PURE__ */ jsx(MaterialIcon, { name: "delete_outline", size: 16 })
11710
12032
  }
11711
12033
  )
@@ -11738,6 +12060,44 @@ const StrapiMediaPicker = ({
11738
12060
  }
11739
12061
  }
11740
12062
  ),
12063
+ /* @__PURE__ */ jsx(
12064
+ "input",
12065
+ {
12066
+ ref: fileInputRef,
12067
+ type: "file",
12068
+ multiple,
12069
+ onChange: handleFileUpload,
12070
+ style: { display: "none" }
12071
+ }
12072
+ ),
12073
+ /* @__PURE__ */ jsx(
12074
+ "button",
12075
+ {
12076
+ type: "button",
12077
+ disabled: uploading,
12078
+ onClick: (e) => {
12079
+ e.preventDefault();
12080
+ e.stopPropagation();
12081
+ fileInputRef.current?.click();
12082
+ },
12083
+ title: t("media.uploadNew", "Upload New File(s)"),
12084
+ style: {
12085
+ display: "inline-flex",
12086
+ alignItems: "center",
12087
+ justifyContent: "center",
12088
+ padding: "6px 9px",
12089
+ fontSize: 12,
12090
+ fontWeight: 600,
12091
+ background: "#ffffff",
12092
+ color: "#2669a0",
12093
+ border: "1px solid #cbd5e1",
12094
+ borderRadius: 5,
12095
+ cursor: uploading ? "wait" : "pointer",
12096
+ whiteSpace: "nowrap"
12097
+ },
12098
+ children: /* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 16, color: "#2669a0" })
12099
+ }
12100
+ ),
11741
12101
  /* @__PURE__ */ jsxs(
11742
12102
  "button",
11743
12103
  {
@@ -11772,27 +12132,31 @@ const StrapiMediaPicker = ({
11772
12132
  style: {
11773
12133
  position: "fixed",
11774
12134
  inset: 0,
11775
- background: "rgba(15, 23, 42, 0.6)",
11776
- zIndex: 11e3,
12135
+ background: "rgba(15, 23, 42, 0.65)",
12136
+ zIndex: 310,
11777
12137
  display: "flex",
11778
12138
  alignItems: "center",
11779
12139
  justifyContent: "center",
11780
- padding: 24
12140
+ padding: 20
11781
12141
  },
11782
12142
  onClick: (e) => {
11783
12143
  e.stopPropagation();
11784
- setModalOpen(false);
12144
+ if (editingFile) {
12145
+ setEditingFile(null);
12146
+ } else {
12147
+ setModalOpen(false);
12148
+ }
11785
12149
  },
11786
12150
  children: /* @__PURE__ */ jsxs(
11787
12151
  "div",
11788
12152
  {
11789
12153
  style: {
11790
12154
  width: "100%",
11791
- maxWidth: 780,
11792
- maxHeight: "84vh",
12155
+ maxWidth: 960,
12156
+ height: "min(720px, 90vh)",
11793
12157
  background: "#fff",
11794
- borderRadius: 8,
11795
- boxShadow: "0 24px 48px rgba(0,0,0,0.3)",
12158
+ borderRadius: 10,
12159
+ boxShadow: "0 24px 56px rgba(0,0,0,0.35)",
11796
12160
  display: "flex",
11797
12161
  flexDirection: "column",
11798
12162
  overflow: "hidden"
@@ -11809,86 +12173,125 @@ const StrapiMediaPicker = ({
11809
12173
  padding: "12px 18px",
11810
12174
  borderBottom: "1px solid #e2e8f0",
11811
12175
  background: "#f8fafc",
11812
- gap: 10
12176
+ gap: 10,
12177
+ flexWrap: "wrap"
11813
12178
  },
11814
12179
  children: [
11815
12180
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
11816
- /* @__PURE__ */ jsx(MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
11817
- /* @__PURE__ */ jsxs("strong", { style: { fontSize: 14, color: "#0f172a" }, children: [
11818
- t("media.libraryTitle", "Strapi Media Library"),
11819
- " (",
11820
- files.length,
11821
- " ",
11822
- t("media.filesCount", "files"),
11823
- ")"
11824
- ] })
11825
- ] }),
11826
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
11827
- /* @__PURE__ */ jsxs(
12181
+ editingFile ? /* @__PURE__ */ jsxs(
11828
12182
  "button",
11829
12183
  {
11830
12184
  type: "button",
11831
- onClick: () => loadLibrary().finally(() => setLoading(false)),
11832
- title: t("media.refresh", "Refresh"),
12185
+ onClick: () => setEditingFile(null),
11833
12186
  style: {
11834
12187
  display: "inline-flex",
11835
12188
  alignItems: "center",
11836
12189
  gap: 4,
11837
- padding: "6px 10px",
12190
+ padding: "4px 8px",
12191
+ borderRadius: 5,
12192
+ border: "1px solid #cbd5e1",
11838
12193
  background: "#ffffff",
11839
12194
  color: "#334155",
11840
- border: "1px solid #cbd5e1",
11841
- borderRadius: 5,
11842
12195
  fontSize: 12,
11843
12196
  fontWeight: 600,
11844
12197
  cursor: "pointer"
11845
12198
  },
11846
12199
  children: [
11847
- /* @__PURE__ */ jsx(MaterialIcon, { name: "refresh", size: 15 }),
11848
- t("media.refresh", "Refresh")
12200
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "arrow_back", size: 15 }),
12201
+ tr ? "Kütüphaneye Dön" : "Back to Library"
11849
12202
  ]
11850
12203
  }
11851
- ),
12204
+ ) : /* @__PURE__ */ jsx(MaterialIcon, { name: "collections", size: 18, color: "#2669a0" }),
12205
+ /* @__PURE__ */ 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(
12206
+ "media.filesCount",
12207
+ "files"
12208
+ )})` })
12209
+ ] }),
12210
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
12211
+ !editingFile && /* @__PURE__ */ jsxs(Fragment, { children: [
12212
+ /* @__PURE__ */ jsxs(
12213
+ "button",
12214
+ {
12215
+ type: "button",
12216
+ onClick: () => setCreatingFolder((v) => !v),
12217
+ style: {
12218
+ display: "inline-flex",
12219
+ alignItems: "center",
12220
+ gap: 4,
12221
+ padding: "6px 10px",
12222
+ background: "#ffffff",
12223
+ color: "#334155",
12224
+ border: "1px solid #cbd5e1",
12225
+ borderRadius: 5,
12226
+ fontSize: 12,
12227
+ fontWeight: 600,
12228
+ cursor: "pointer"
12229
+ },
12230
+ children: [
12231
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "create_new_folder", size: 15, color: "#2669a0" }),
12232
+ tr ? "Yeni Klasör" : "New Folder"
12233
+ ]
12234
+ }
12235
+ ),
12236
+ /* @__PURE__ */ jsxs(
12237
+ "button",
12238
+ {
12239
+ type: "button",
12240
+ onClick: () => loadLibrary().finally(() => setLoading(false)),
12241
+ title: t("media.refresh", "Refresh"),
12242
+ style: {
12243
+ display: "inline-flex",
12244
+ alignItems: "center",
12245
+ gap: 4,
12246
+ padding: "6px 10px",
12247
+ background: "#ffffff",
12248
+ color: "#334155",
12249
+ border: "1px solid #cbd5e1",
12250
+ borderRadius: 5,
12251
+ fontSize: 12,
12252
+ fontWeight: 600,
12253
+ cursor: "pointer"
12254
+ },
12255
+ children: [
12256
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "refresh", size: 15 }),
12257
+ t("media.refresh", "Refresh")
12258
+ ]
12259
+ }
12260
+ ),
12261
+ /* @__PURE__ */ jsxs(
12262
+ "button",
12263
+ {
12264
+ type: "button",
12265
+ disabled: uploading,
12266
+ onClick: () => fileInputRef.current?.click(),
12267
+ style: {
12268
+ display: "inline-flex",
12269
+ alignItems: "center",
12270
+ gap: 5,
12271
+ padding: "6px 12px",
12272
+ background: "#2669a0",
12273
+ color: "#fff",
12274
+ border: "none",
12275
+ borderRadius: 5,
12276
+ fontSize: 12,
12277
+ fontWeight: 600,
12278
+ cursor: "pointer"
12279
+ },
12280
+ children: [
12281
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
12282
+ uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File(s)")
12283
+ ]
12284
+ }
12285
+ )
12286
+ ] }),
11852
12287
  /* @__PURE__ */ jsx(
11853
- "input",
11854
- {
11855
- ref: fileInputRef,
11856
- type: "file",
11857
- multiple: true,
11858
- onChange: handleFileUpload,
11859
- style: { display: "none" }
11860
- }
11861
- ),
11862
- /* @__PURE__ */ jsxs(
11863
12288
  "button",
11864
12289
  {
11865
12290
  type: "button",
11866
- disabled: uploading,
11867
- onClick: () => fileInputRef.current?.click(),
11868
- style: {
11869
- display: "inline-flex",
11870
- alignItems: "center",
11871
- gap: 5,
11872
- padding: "6px 12px",
11873
- background: "#2669a0",
11874
- color: "#fff",
11875
- border: "none",
11876
- borderRadius: 5,
11877
- fontSize: 12,
11878
- fontWeight: 600,
11879
- cursor: "pointer"
12291
+ onClick: () => {
12292
+ setEditingFile(null);
12293
+ setModalOpen(false);
11880
12294
  },
11881
- children: [
11882
- /* @__PURE__ */ jsx(MaterialIcon, { name: "upload_file", size: 15, color: "#fff" }),
11883
- uploading ? t("media.uploading", "Uploading...") : t("media.uploadNew", "Upload New File")
11884
- ]
11885
- }
11886
- ),
11887
- /* @__PURE__ */ jsx(
11888
- "button",
11889
- {
11890
- type: "button",
11891
- onClick: () => setModalOpen(false),
11892
12295
  style: {
11893
12296
  border: "none",
11894
12297
  background: "transparent",
@@ -11903,329 +12306,1258 @@ const StrapiMediaPicker = ({
11903
12306
  ]
11904
12307
  }
11905
12308
  ),
11906
- /* @__PURE__ */ jsxs(
11907
- "div",
11908
- {
11909
- style: {
11910
- padding: "10px 18px",
11911
- borderBottom: "1px solid #f1f5f9",
11912
- display: "flex",
11913
- alignItems: "center",
11914
- gap: 8
11915
- },
11916
- children: [
11917
- /* @__PURE__ */ jsx(
11918
- "input",
11919
- {
11920
- type: "text",
11921
- value: search,
11922
- onChange: (e) => setSearch(e.target.value),
11923
- placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
11924
- style: {
11925
- flex: 1,
11926
- padding: "7px 10px",
11927
- fontSize: 12,
11928
- border: "1px solid #cbd5e1",
11929
- borderRadius: 5
11930
- }
11931
- }
11932
- ),
11933
- multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
11934
- /* @__PURE__ */ jsx(
11935
- "button",
12309
+ editingFile ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", flex: 1, minHeight: 0, overflow: "hidden" }, children: [
12310
+ /* @__PURE__ */ jsxs(
12311
+ "div",
12312
+ {
12313
+ style: {
12314
+ flex: 1,
12315
+ background: "repeating-conic-gradient(#e2e8f0 0% 25%, #f8fafc 0% 50%) 50% / 20px 20px",
12316
+ display: "flex",
12317
+ flexDirection: "column",
12318
+ minWidth: 0,
12319
+ borderRight: "1px solid #e2e8f0"
12320
+ },
12321
+ children: [
12322
+ editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxs(
12323
+ "div",
11936
12324
  {
11937
- type: "button",
11938
- onClick: () => {
11939
- const existingKeys = new Set(selectedFiles.map(getFileKey));
11940
- const additions = filteredFiles.filter(
11941
- (f) => !existingKeys.has(getFileKey(f))
11942
- );
11943
- setSelectedFiles([...selectedFiles, ...additions]);
11944
- },
11945
12325
  style: {
11946
- padding: "6px 10px",
11947
- fontSize: 11,
11948
- fontWeight: 600,
11949
- border: "1px solid #cbd5e1",
11950
- borderRadius: 5,
12326
+ display: "flex",
12327
+ alignItems: "center",
12328
+ justifyContent: "space-between",
12329
+ padding: "8px 14px",
11951
12330
  background: "#ffffff",
11952
- color: "#334155",
11953
- cursor: "pointer",
11954
- whiteSpace: "nowrap"
12331
+ borderBottom: "1px solid #e2e8f0",
12332
+ gap: 8,
12333
+ flexWrap: "wrap"
11955
12334
  },
11956
- children: t("selectAllVisible", "Select All")
11957
- }
11958
- ),
11959
- selectedFiles.length > 0 && /* @__PURE__ */ jsx(
11960
- "button",
11961
- {
11962
- type: "button",
11963
- onClick: () => setSelectedFiles([]),
11964
- style: {
11965
- padding: "6px 10px",
11966
- fontSize: 11,
11967
- fontWeight: 600,
11968
- border: "1px solid #fecaca",
11969
- borderRadius: 5,
11970
- background: "#fef2f2",
11971
- color: "#dc2626",
11972
- cursor: "pointer",
11973
- whiteSpace: "nowrap"
12335
+ children: [
12336
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
12337
+ /* @__PURE__ */ jsx(
12338
+ "span",
12339
+ {
12340
+ style: {
12341
+ fontSize: 11,
12342
+ fontWeight: 700,
12343
+ color: "#475569",
12344
+ marginRight: 4
12345
+ },
12346
+ children: tr ? "En-Boy Oranı:" : "Aspect Ratio:"
12347
+ }
12348
+ ),
12349
+ ASPECT_PRESETS.map((preset) => {
12350
+ const active = aspectPreset === preset.ratio;
12351
+ return /* @__PURE__ */ jsx(
12352
+ "button",
12353
+ {
12354
+ type: "button",
12355
+ onClick: () => applyAspectPreset(preset.ratio),
12356
+ style: {
12357
+ padding: "4px 8px",
12358
+ fontSize: 11,
12359
+ fontWeight: 600,
12360
+ borderRadius: 4,
12361
+ border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
12362
+ background: active ? "#2669a0" : "#ffffff",
12363
+ color: active ? "#ffffff" : "#334155",
12364
+ cursor: "pointer"
12365
+ },
12366
+ children: preset.label === "Free" ? tr ? "Serbest" : "Free" : preset.label
12367
+ },
12368
+ preset.label
12369
+ );
12370
+ })
12371
+ ] }),
12372
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
12373
+ /* @__PURE__ */ jsxs(
12374
+ "button",
12375
+ {
12376
+ type: "button",
12377
+ onClick: () => setCropRotate((r) => (r - 90 + 360) % 360),
12378
+ title: tr ? "Sola Döndür (-90°)" : "Rotate Left (-90°)",
12379
+ style: {
12380
+ display: "inline-flex",
12381
+ alignItems: "center",
12382
+ gap: 3,
12383
+ padding: "4px 8px",
12384
+ fontSize: 11,
12385
+ fontWeight: 600,
12386
+ border: "1px solid #cbd5e1",
12387
+ borderRadius: 4,
12388
+ background: "#fff",
12389
+ color: "#334155",
12390
+ cursor: "pointer"
12391
+ },
12392
+ children: [
12393
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "rotate_left", size: 15 }),
12394
+ /* @__PURE__ */ jsx("span", { children: "-90°" })
12395
+ ]
12396
+ }
12397
+ ),
12398
+ /* @__PURE__ */ jsxs(
12399
+ "button",
12400
+ {
12401
+ type: "button",
12402
+ onClick: () => setCropRotate((r) => (r + 90) % 360),
12403
+ title: tr ? "Sağa Döndür (+90°)" : "Rotate Right (+90°)",
12404
+ style: {
12405
+ display: "inline-flex",
12406
+ alignItems: "center",
12407
+ gap: 3,
12408
+ padding: "4px 8px",
12409
+ fontSize: 11,
12410
+ fontWeight: 600,
12411
+ border: "1px solid #cbd5e1",
12412
+ borderRadius: 4,
12413
+ background: "#fff",
12414
+ color: "#334155",
12415
+ cursor: "pointer"
12416
+ },
12417
+ children: [
12418
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "rotate_right", size: 15 }),
12419
+ /* @__PURE__ */ jsx("span", { children: "+90°" })
12420
+ ]
12421
+ }
12422
+ ),
12423
+ /* @__PURE__ */ jsx(
12424
+ "button",
12425
+ {
12426
+ type: "button",
12427
+ onClick: () => {
12428
+ setCropRotate(0);
12429
+ setAspectPreset(null);
12430
+ setCropRect({
12431
+ x: 0,
12432
+ y: 0,
12433
+ width: naturalSize.width,
12434
+ height: naturalSize.height
12435
+ });
12436
+ },
12437
+ style: {
12438
+ padding: "4px 8px",
12439
+ fontSize: 11,
12440
+ fontWeight: 600,
12441
+ border: "1px solid #cbd5e1",
12442
+ borderRadius: 4,
12443
+ background: "#fff",
12444
+ color: "#64748b",
12445
+ cursor: "pointer"
12446
+ },
12447
+ children: tr ? "Sıfırla" : "Reset"
12448
+ }
12449
+ )
12450
+ ] })
12451
+ ]
12452
+ }
12453
+ ),
12454
+ /* @__PURE__ */ jsx(
12455
+ "div",
12456
+ {
12457
+ style: {
12458
+ flex: 1,
12459
+ display: "flex",
12460
+ alignItems: "center",
12461
+ justifyContent: "center",
12462
+ padding: 24,
12463
+ overflow: "hidden",
12464
+ position: "relative"
12465
+ },
12466
+ children: editingFile.mime?.startsWith("image/") ? /* @__PURE__ */ jsxs(
12467
+ "div",
12468
+ {
12469
+ ref: cropBoxRef,
12470
+ style: {
12471
+ position: "relative",
12472
+ display: "inline-block",
12473
+ maxWidth: "100%",
12474
+ maxHeight: "100%",
12475
+ boxShadow: "0 8px 24px rgba(15, 23, 42, 0.2)",
12476
+ userSelect: "none"
12477
+ },
12478
+ children: [
12479
+ /* @__PURE__ */ jsx(
12480
+ "img",
12481
+ {
12482
+ ref: cropImgRef,
12483
+ src: editingFile.url,
12484
+ alt: editingFile.name,
12485
+ onLoad: (e) => {
12486
+ const img = e.currentTarget;
12487
+ const nw = img.naturalWidth || editingFile.width || 800;
12488
+ const nh = img.naturalHeight || editingFile.height || 600;
12489
+ setNaturalSize({ width: nw, height: nh });
12490
+ setCropRect({ x: 0, y: 0, width: nw, height: nh });
12491
+ },
12492
+ style: {
12493
+ display: "block",
12494
+ maxWidth: "540px",
12495
+ maxHeight: "440px",
12496
+ width: "auto",
12497
+ height: "auto",
12498
+ transform: cropRotate ? `rotate(${cropRotate}deg)` : void 0,
12499
+ pointerEvents: "none"
12500
+ }
12501
+ }
12502
+ ),
12503
+ naturalSize.width > 0 && naturalSize.height > 0 && /* @__PURE__ */ jsxs(
12504
+ "div",
12505
+ {
12506
+ onMouseDown: (e) => startCropDrag(e, "move"),
12507
+ style: {
12508
+ position: "absolute",
12509
+ left: `${cropRect.x / naturalSize.width * 100}%`,
12510
+ top: `${cropRect.y / naturalSize.height * 100}%`,
12511
+ width: `${cropRect.width / naturalSize.width * 100}%`,
12512
+ height: `${cropRect.height / naturalSize.height * 100}%`,
12513
+ border: "2px dashed #38bdf8",
12514
+ boxShadow: "0 0 0 9999px rgba(15, 23, 42, 0.55)",
12515
+ cursor: "move",
12516
+ boxSizing: "border-box"
12517
+ },
12518
+ children: [
12519
+ /* @__PURE__ */ jsxs(
12520
+ "div",
12521
+ {
12522
+ style: {
12523
+ position: "absolute",
12524
+ top: 6,
12525
+ left: 6,
12526
+ background: "rgba(15, 23, 42, 0.85)",
12527
+ color: "#ffffff",
12528
+ fontSize: 10,
12529
+ fontWeight: 700,
12530
+ padding: "2px 6px",
12531
+ borderRadius: 4,
12532
+ pointerEvents: "none",
12533
+ whiteSpace: "nowrap"
12534
+ },
12535
+ children: [
12536
+ Math.round(cropRect.width),
12537
+ " × ",
12538
+ Math.round(cropRect.height),
12539
+ " px"
12540
+ ]
12541
+ }
12542
+ ),
12543
+ [
12544
+ { pos: "nw", top: -6, left: -6, cursor: "nwse-resize" },
12545
+ { pos: "ne", top: -6, right: -6, cursor: "nesw-resize" },
12546
+ { pos: "sw", bottom: -6, left: -6, cursor: "nesw-resize" },
12547
+ { pos: "se", bottom: -6, right: -6, cursor: "nwse-resize" }
12548
+ ].map((h) => /* @__PURE__ */ jsx(
12549
+ "div",
12550
+ {
12551
+ onMouseDown: (e) => startCropDrag(e, h.pos),
12552
+ style: {
12553
+ position: "absolute",
12554
+ top: "top" in h ? h.top : void 0,
12555
+ bottom: "bottom" in h ? h.bottom : void 0,
12556
+ left: "left" in h ? h.left : void 0,
12557
+ right: "right" in h ? h.right : void 0,
12558
+ width: 12,
12559
+ height: 12,
12560
+ background: "#ffffff",
12561
+ border: "2px solid #0284c7",
12562
+ borderRadius: 2,
12563
+ cursor: h.cursor
12564
+ }
12565
+ },
12566
+ h.pos
12567
+ ))
12568
+ ]
12569
+ }
12570
+ )
12571
+ ]
12572
+ }
12573
+ ) : /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", color: "#475569" }, children: [
12574
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "description", size: 56, color: "#64748b" }),
12575
+ /* @__PURE__ */ jsx("div", { style: { marginTop: 8, fontWeight: 600 }, children: editingFile.name })
12576
+ ] })
12577
+ }
12578
+ )
12579
+ ]
12580
+ }
12581
+ ),
12582
+ /* @__PURE__ */ jsxs(
12583
+ "div",
12584
+ {
12585
+ style: {
12586
+ width: 320,
12587
+ background: "#ffffff",
12588
+ display: "flex",
12589
+ flexDirection: "column",
12590
+ overflowY: "auto",
12591
+ padding: 16,
12592
+ gap: 14
12593
+ },
12594
+ children: [
12595
+ editingFile.mime?.startsWith("image/") && /* @__PURE__ */ jsxs(
12596
+ "div",
12597
+ {
12598
+ style: {
12599
+ padding: 12,
12600
+ borderRadius: 8,
12601
+ background: "#f8fafc",
12602
+ border: "1px solid #cbd5e1",
12603
+ display: "flex",
12604
+ flexDirection: "column",
12605
+ gap: 10
12606
+ },
12607
+ children: [
12608
+ /* @__PURE__ */ jsxs(
12609
+ "div",
12610
+ {
12611
+ style: {
12612
+ fontSize: 11,
12613
+ fontWeight: 700,
12614
+ color: "#1e3a8a",
12615
+ textTransform: "uppercase",
12616
+ display: "flex",
12617
+ alignItems: "center",
12618
+ gap: 5
12619
+ },
12620
+ children: [
12621
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "crop", size: 15, color: "#2669a0" }),
12622
+ /* @__PURE__ */ jsx("span", { children: tr ? "Kırpma Boyutları (Sharp)" : "Crop Coordinates (Sharp)" })
12623
+ ]
12624
+ }
12625
+ ),
12626
+ /* @__PURE__ */ jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
12627
+ /* @__PURE__ */ jsxs("div", { children: [
12628
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Genişlik (W px)" : "Width (W px)" }),
12629
+ /* @__PURE__ */ jsx(
12630
+ "input",
12631
+ {
12632
+ type: "number",
12633
+ min: 16,
12634
+ max: naturalSize.width || 1e4,
12635
+ value: Math.round(cropRect.width),
12636
+ onChange: (e) => setCropRect((prev) => ({
12637
+ ...prev,
12638
+ width: Math.max(16, Number(e.target.value) || 16)
12639
+ })),
12640
+ style: {
12641
+ width: "100%",
12642
+ padding: "5px 8px",
12643
+ fontSize: 12,
12644
+ border: "1px solid #cbd5e1",
12645
+ borderRadius: 4
12646
+ }
12647
+ }
12648
+ )
12649
+ ] }),
12650
+ /* @__PURE__ */ jsxs("div", { children: [
12651
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: tr ? "Yükseklik (H px)" : "Height (H px)" }),
12652
+ /* @__PURE__ */ jsx(
12653
+ "input",
12654
+ {
12655
+ type: "number",
12656
+ min: 16,
12657
+ max: naturalSize.height || 1e4,
12658
+ value: Math.round(cropRect.height),
12659
+ onChange: (e) => setCropRect((prev) => ({
12660
+ ...prev,
12661
+ height: Math.max(16, Number(e.target.value) || 16)
12662
+ })),
12663
+ style: {
12664
+ width: "100%",
12665
+ padding: "5px 8px",
12666
+ fontSize: 12,
12667
+ border: "1px solid #cbd5e1",
12668
+ borderRadius: 4
12669
+ }
12670
+ }
12671
+ )
12672
+ ] }),
12673
+ /* @__PURE__ */ jsxs("div", { children: [
12674
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "X (Sol / Left px)" }),
12675
+ /* @__PURE__ */ jsx(
12676
+ "input",
12677
+ {
12678
+ type: "number",
12679
+ min: 0,
12680
+ value: Math.round(cropRect.x),
12681
+ onChange: (e) => setCropRect((prev) => ({
12682
+ ...prev,
12683
+ x: Math.max(0, Number(e.target.value) || 0)
12684
+ })),
12685
+ style: {
12686
+ width: "100%",
12687
+ padding: "5px 8px",
12688
+ fontSize: 12,
12689
+ border: "1px solid #cbd5e1",
12690
+ borderRadius: 4
12691
+ }
12692
+ }
12693
+ )
12694
+ ] }),
12695
+ /* @__PURE__ */ jsxs("div", { children: [
12696
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 10, fontWeight: 600, color: "#64748b" }, children: "Y (Üst / Top px)" }),
12697
+ /* @__PURE__ */ jsx(
12698
+ "input",
12699
+ {
12700
+ type: "number",
12701
+ min: 0,
12702
+ value: Math.round(cropRect.y),
12703
+ onChange: (e) => setCropRect((prev) => ({
12704
+ ...prev,
12705
+ y: Math.max(0, Number(e.target.value) || 0)
12706
+ })),
12707
+ style: {
12708
+ width: "100%",
12709
+ padding: "5px 8px",
12710
+ fontSize: 12,
12711
+ border: "1px solid #cbd5e1",
12712
+ borderRadius: 4
12713
+ }
12714
+ }
12715
+ )
12716
+ ] })
12717
+ ] }),
12718
+ cropError && /* @__PURE__ */ jsx(
12719
+ "div",
12720
+ {
12721
+ style: {
12722
+ padding: "6px 8px",
12723
+ borderRadius: 4,
12724
+ background: "#fef2f2",
12725
+ color: "#dc2626",
12726
+ fontSize: 11
12727
+ },
12728
+ children: cropError
12729
+ }
12730
+ ),
12731
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
12732
+ /* @__PURE__ */ jsxs(
12733
+ "button",
12734
+ {
12735
+ type: "button",
12736
+ disabled: croppingBusy,
12737
+ onClick: () => handleExecuteCrop("duplicate"),
12738
+ style: {
12739
+ padding: "8px 12px",
12740
+ fontSize: 12,
12741
+ fontWeight: 700,
12742
+ borderRadius: 5,
12743
+ border: "none",
12744
+ background: "#2669a0",
12745
+ color: "#ffffff",
12746
+ cursor: croppingBusy ? "wait" : "pointer",
12747
+ display: "flex",
12748
+ alignItems: "center",
12749
+ justifyContent: "center",
12750
+ gap: 6
12751
+ },
12752
+ children: [
12753
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "content_copy", size: 15, color: "#fff" }),
12754
+ /* @__PURE__ */ jsx("span", { children: croppingBusy ? tr ? "İşleniyor..." : "Processing..." : tr ? "Kopyasını Oluştur & Kırp" : "Duplicate & Crop Asset" })
12755
+ ]
12756
+ }
12757
+ ),
12758
+ /* @__PURE__ */ jsxs(
12759
+ "button",
12760
+ {
12761
+ type: "button",
12762
+ disabled: croppingBusy,
12763
+ onClick: () => handleExecuteCrop("replace"),
12764
+ style: {
12765
+ padding: "7px 12px",
12766
+ fontSize: 12,
12767
+ fontWeight: 600,
12768
+ borderRadius: 5,
12769
+ border: "1px solid #2669a0",
12770
+ background: "#eff6ff",
12771
+ color: "#1e3a8a",
12772
+ cursor: croppingBusy ? "wait" : "pointer",
12773
+ display: "flex",
12774
+ alignItems: "center",
12775
+ justifyContent: "center",
12776
+ gap: 6
12777
+ },
12778
+ children: [
12779
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "crop", size: 15, color: "#1e3a8a" }),
12780
+ /* @__PURE__ */ jsx("span", { children: tr ? "Orijinal Görseli Kırp (Üzerine Yaz)" : "Crop Original Asset" })
12781
+ ]
12782
+ }
12783
+ )
12784
+ ] })
12785
+ ]
12786
+ }
12787
+ ),
12788
+ /* @__PURE__ */ jsxs(
12789
+ "div",
12790
+ {
12791
+ style: {
12792
+ display: "flex",
12793
+ flexDirection: "column",
12794
+ gap: 8,
12795
+ borderTop: "1px solid #e2e8f0",
12796
+ paddingTop: 12
12797
+ },
12798
+ children: [
12799
+ /* @__PURE__ */ jsx(
12800
+ "div",
12801
+ {
12802
+ style: {
12803
+ fontSize: 11,
12804
+ fontWeight: 700,
12805
+ color: "#334155",
12806
+ textTransform: "uppercase"
12807
+ },
12808
+ children: tr ? "Dosya Bilgileri (Metadata)" : "Asset Metadata"
12809
+ }
12810
+ ),
12811
+ /* @__PURE__ */ jsxs("div", { children: [
12812
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Dosya Adı" : "File Name" }),
12813
+ /* @__PURE__ */ jsx(
12814
+ "input",
12815
+ {
12816
+ type: "text",
12817
+ value: editName,
12818
+ onChange: (e) => setEditName(e.target.value),
12819
+ style: {
12820
+ width: "100%",
12821
+ padding: "6px 8px",
12822
+ fontSize: 12,
12823
+ border: "1px solid #cbd5e1",
12824
+ borderRadius: 4,
12825
+ marginTop: 2
12826
+ }
12827
+ }
12828
+ )
12829
+ ] }),
12830
+ /* @__PURE__ */ jsxs("div", { children: [
12831
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Alternatif Metin (Alt Text / SEO)" : "Alternative Text (Alt / SEO)" }),
12832
+ /* @__PURE__ */ jsx(
12833
+ "input",
12834
+ {
12835
+ type: "text",
12836
+ value: editAlt,
12837
+ onChange: (e) => setEditAlt(e.target.value),
12838
+ style: {
12839
+ width: "100%",
12840
+ padding: "6px 8px",
12841
+ fontSize: 12,
12842
+ border: "1px solid #cbd5e1",
12843
+ borderRadius: 4,
12844
+ marginTop: 2
12845
+ }
12846
+ }
12847
+ )
12848
+ ] }),
12849
+ /* @__PURE__ */ jsxs("div", { children: [
12850
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Altyazı (Caption)" : "Caption" }),
12851
+ /* @__PURE__ */ jsx(
12852
+ "input",
12853
+ {
12854
+ type: "text",
12855
+ value: editCaption,
12856
+ onChange: (e) => setEditCaption(e.target.value),
12857
+ style: {
12858
+ width: "100%",
12859
+ padding: "6px 8px",
12860
+ fontSize: 12,
12861
+ border: "1px solid #cbd5e1",
12862
+ borderRadius: 4,
12863
+ marginTop: 2
12864
+ }
12865
+ }
12866
+ )
12867
+ ] }),
12868
+ folders.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
12869
+ /* @__PURE__ */ jsx("label", { style: { fontSize: 11, fontWeight: 600, color: "#475569" }, children: tr ? "Klasör Konumu" : "Folder Location" }),
12870
+ /* @__PURE__ */ jsxs(
12871
+ "select",
12872
+ {
12873
+ value: editFolderId ?? "",
12874
+ onChange: (e) => setEditFolderId(e.target.value ? Number(e.target.value) : null),
12875
+ style: {
12876
+ width: "100%",
12877
+ padding: "6px 8px",
12878
+ fontSize: 12,
12879
+ border: "1px solid #cbd5e1",
12880
+ borderRadius: 4,
12881
+ marginTop: 2,
12882
+ background: "#fff"
12883
+ },
12884
+ children: [
12885
+ /* @__PURE__ */ jsx("option", { value: "", children: tr ? "Ana Dizin (Root)" : "Media Library Root" }),
12886
+ folders.map((fld) => /* @__PURE__ */ jsx("option", { value: fld.id, children: fld.name }, fld.id))
12887
+ ]
12888
+ }
12889
+ )
12890
+ ] }),
12891
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 6, marginTop: 4 }, children: [
12892
+ /* @__PURE__ */ jsx(
12893
+ "button",
12894
+ {
12895
+ type: "button",
12896
+ disabled: savingDetails,
12897
+ onClick: handleSaveDetails,
12898
+ style: {
12899
+ flex: 1,
12900
+ padding: "7px 10px",
12901
+ fontSize: 12,
12902
+ fontWeight: 600,
12903
+ borderRadius: 5,
12904
+ border: "1px solid #cbd5e1",
12905
+ background: "#f8fafc",
12906
+ color: "#0f172a",
12907
+ cursor: "pointer"
12908
+ },
12909
+ children: savingDetails ? tr ? "Kaydediliyor..." : "Saving..." : tr ? "Bilgileri Kaydet" : "Save Metadata"
12910
+ }
12911
+ ),
12912
+ /* @__PURE__ */ jsx(
12913
+ "button",
12914
+ {
12915
+ type: "button",
12916
+ onClick: (e) => handleDeleteAsset(editingFile, e),
12917
+ title: tr ? "Dosyayı Kütüphaneden Sil" : "Delete from Media Library",
12918
+ style: {
12919
+ padding: "7px 10px",
12920
+ fontSize: 12,
12921
+ fontWeight: 600,
12922
+ borderRadius: 5,
12923
+ border: "1px solid #fecaca",
12924
+ background: "#fef2f2",
12925
+ color: "#dc2626",
12926
+ cursor: "pointer"
12927
+ },
12928
+ children: /* @__PURE__ */ jsx(MaterialIcon, { name: "delete_outline", size: 16, color: "#dc2626" })
12929
+ }
12930
+ )
12931
+ ] })
12932
+ ]
12933
+ }
12934
+ )
12935
+ ]
12936
+ }
12937
+ )
12938
+ ] }) : (
12939
+ /* VIEW 2: MEDIA LIBRARY BROWSER (Folders, Filters, Sort, Multi-Select, Item Actions) */
12940
+ /* @__PURE__ */ jsxs(Fragment, { children: [
12941
+ creatingFolder && /* @__PURE__ */ jsxs(
12942
+ "div",
12943
+ {
12944
+ style: {
12945
+ padding: "8px 18px",
12946
+ background: "#eff6ff",
12947
+ borderBottom: "1px solid #bfdbfe",
12948
+ display: "flex",
12949
+ alignItems: "center",
12950
+ gap: 8
12951
+ },
12952
+ children: [
12953
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "folder", size: 16, color: "#2669a0" }),
12954
+ /* @__PURE__ */ jsx(
12955
+ "input",
12956
+ {
12957
+ type: "text",
12958
+ value: newFolderName,
12959
+ onChange: (e) => setNewFolderName(e.target.value),
12960
+ onKeyDown: (e) => {
12961
+ if (e.key === "Enter") {
12962
+ e.preventDefault();
12963
+ handleCreateFolder();
12964
+ }
12965
+ },
12966
+ placeholder: tr ? "Yeni klasör adı yazın..." : "Enter new folder name...",
12967
+ style: {
12968
+ flex: 1,
12969
+ padding: "5px 10px",
12970
+ fontSize: 12,
12971
+ border: "1px solid #93c5fd",
12972
+ borderRadius: 4,
12973
+ background: "#fff"
12974
+ }
12975
+ }
12976
+ ),
12977
+ /* @__PURE__ */ jsx(
12978
+ "button",
12979
+ {
12980
+ type: "button",
12981
+ onClick: handleCreateFolder,
12982
+ style: {
12983
+ padding: "5px 12px",
12984
+ fontSize: 12,
12985
+ fontWeight: 600,
12986
+ background: "#2669a0",
12987
+ color: "#fff",
12988
+ border: "none",
12989
+ borderRadius: 4,
12990
+ cursor: "pointer"
12991
+ },
12992
+ children: tr ? "Oluştur" : "Create"
12993
+ }
12994
+ ),
12995
+ /* @__PURE__ */ jsx(
12996
+ "button",
12997
+ {
12998
+ type: "button",
12999
+ onClick: () => setCreatingFolder(false),
13000
+ style: {
13001
+ padding: "5px 10px",
13002
+ fontSize: 12,
13003
+ border: "1px solid #cbd5e1",
13004
+ background: "#fff",
13005
+ borderRadius: 4,
13006
+ cursor: "pointer"
13007
+ },
13008
+ children: tr ? "İptal" : "Cancel"
13009
+ }
13010
+ )
13011
+ ]
13012
+ }
13013
+ ),
13014
+ /* @__PURE__ */ jsxs(
13015
+ "div",
13016
+ {
13017
+ style: {
13018
+ padding: "10px 18px",
13019
+ borderBottom: "1px solid #f1f5f9",
13020
+ display: "flex",
13021
+ alignItems: "center",
13022
+ gap: 8,
13023
+ flexWrap: "wrap"
13024
+ },
13025
+ children: [
13026
+ /* @__PURE__ */ jsx(
13027
+ "input",
13028
+ {
13029
+ type: "text",
13030
+ value: search,
13031
+ onChange: (e) => setSearch(e.target.value),
13032
+ placeholder: t("media.searchPlaceholder", "Search file name or extension..."),
13033
+ style: {
13034
+ flex: 1,
13035
+ minWidth: 180,
13036
+ padding: "7px 10px",
13037
+ fontSize: 12,
13038
+ border: "1px solid #cbd5e1",
13039
+ borderRadius: 5
13040
+ }
13041
+ }
13042
+ ),
13043
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4 }, children: [
13044
+ { key: "all", label: tr ? "Tümü" : "All" },
13045
+ { key: "image", label: tr ? "Görsel" : "Images" },
13046
+ { key: "video", label: tr ? "Video" : "Videos" },
13047
+ { key: "doc", label: tr ? "Belge" : "Docs" }
13048
+ ].map((tf) => {
13049
+ const active = typeFilter === tf.key;
13050
+ return /* @__PURE__ */ jsx(
13051
+ "button",
13052
+ {
13053
+ type: "button",
13054
+ onClick: () => setTypeFilter(tf.key),
13055
+ style: {
13056
+ padding: "5px 9px",
13057
+ fontSize: 11,
13058
+ fontWeight: 600,
13059
+ borderRadius: 5,
13060
+ border: active ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
13061
+ background: active ? "#eff6ff" : "#ffffff",
13062
+ color: active ? "#2669a0" : "#475569",
13063
+ cursor: "pointer"
13064
+ },
13065
+ children: tf.label
13066
+ },
13067
+ tf.key
13068
+ );
13069
+ }) }),
13070
+ /* @__PURE__ */ jsxs(
13071
+ "select",
13072
+ {
13073
+ value: sortBy,
13074
+ onChange: (e) => setSortBy(e.target.value),
13075
+ style: {
13076
+ padding: "6px 8px",
13077
+ fontSize: 11,
13078
+ fontWeight: 600,
13079
+ border: "1px solid #cbd5e1",
13080
+ borderRadius: 5,
13081
+ background: "#ffffff",
13082
+ color: "#334155"
13083
+ },
13084
+ children: [
13085
+ /* @__PURE__ */ jsx("option", { value: "newest", children: tr ? "En Yeni" : "Newest first" }),
13086
+ /* @__PURE__ */ jsx("option", { value: "oldest", children: tr ? "En Eski" : "Oldest first" }),
13087
+ /* @__PURE__ */ jsx("option", { value: "nameAsc", children: tr ? "Ad (A - Z)" : "Name (A - Z)" }),
13088
+ /* @__PURE__ */ jsx("option", { value: "nameDesc", children: tr ? "Ad (Z - A)" : "Name (Z - A)" }),
13089
+ /* @__PURE__ */ jsx("option", { value: "sizeDesc", children: tr ? "Boyut (Büyükten)" : "Size (Largest)" })
13090
+ ]
13091
+ }
13092
+ ),
13093
+ multiple && filteredFiles.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
13094
+ /* @__PURE__ */ jsx(
13095
+ "button",
13096
+ {
13097
+ type: "button",
13098
+ onClick: () => {
13099
+ const existingKeys = new Set(selectedFiles.map(getFileKey));
13100
+ const additions = filteredFiles.filter(
13101
+ (f) => !existingKeys.has(getFileKey(f))
13102
+ );
13103
+ setSelectedFiles([...selectedFiles, ...additions]);
13104
+ },
13105
+ style: {
13106
+ padding: "6px 10px",
13107
+ fontSize: 11,
13108
+ fontWeight: 600,
13109
+ border: "1px solid #cbd5e1",
13110
+ borderRadius: 5,
13111
+ background: "#ffffff",
13112
+ color: "#334155",
13113
+ cursor: "pointer",
13114
+ whiteSpace: "nowrap"
13115
+ },
13116
+ children: t("selectAllVisible", "Select All")
13117
+ }
13118
+ ),
13119
+ selectedFiles.length > 0 && /* @__PURE__ */ jsx(
13120
+ "button",
13121
+ {
13122
+ type: "button",
13123
+ onClick: () => setSelectedFiles([]),
13124
+ style: {
13125
+ padding: "6px 10px",
13126
+ fontSize: 11,
13127
+ fontWeight: 600,
13128
+ border: "1px solid #fecaca",
13129
+ borderRadius: 5,
13130
+ background: "#fef2f2",
13131
+ color: "#dc2626",
13132
+ cursor: "pointer",
13133
+ whiteSpace: "nowrap"
13134
+ },
13135
+ children: t("clearSelection", "Clear Selection")
13136
+ }
13137
+ )
13138
+ ] })
13139
+ ]
13140
+ }
13141
+ ),
13142
+ (folders.length > 0 || currentFolderId !== null) && /* @__PURE__ */ jsxs(
13143
+ "div",
13144
+ {
13145
+ style: {
13146
+ padding: "8px 18px",
13147
+ borderBottom: "1px solid #f1f5f9",
13148
+ background: "#f8fafc",
13149
+ display: "flex",
13150
+ alignItems: "center",
13151
+ gap: 6,
13152
+ flexWrap: "wrap"
13153
+ },
13154
+ children: [
13155
+ /* @__PURE__ */ jsxs(
13156
+ "button",
13157
+ {
13158
+ type: "button",
13159
+ onClick: () => setCurrentFolderId(null),
13160
+ style: {
13161
+ display: "inline-flex",
13162
+ alignItems: "center",
13163
+ gap: 4,
13164
+ padding: "4px 8px",
13165
+ fontSize: 11,
13166
+ fontWeight: 700,
13167
+ borderRadius: 4,
13168
+ border: currentFolderId === null ? "1.5px solid #2669a0" : "1px solid #cbd5e1",
13169
+ background: currentFolderId === null ? "#2669a0" : "#ffffff",
13170
+ color: currentFolderId === null ? "#ffffff" : "#334155",
13171
+ cursor: "pointer"
13172
+ },
13173
+ children: [
13174
+ /* @__PURE__ */ jsx(
13175
+ MaterialIcon,
13176
+ {
13177
+ name: "folder",
13178
+ size: 14,
13179
+ color: currentFolderId === null ? "#ffffff" : "#2669a0"
13180
+ }
13181
+ ),
13182
+ /* @__PURE__ */ jsx("span", { children: tr ? "Ana Dizin" : "Media Library" })
13183
+ ]
13184
+ }
13185
+ ),
13186
+ currentFolderObj && /* @__PURE__ */ jsxs(Fragment, { children: [
13187
+ /* @__PURE__ */ jsx("span", { style: { color: "#94a3b8", fontSize: 12 }, children: "/" }),
13188
+ /* @__PURE__ */ jsx(
13189
+ "span",
13190
+ {
13191
+ style: {
13192
+ fontSize: 12,
13193
+ fontWeight: 700,
13194
+ color: "#1e3a8a",
13195
+ padding: "3px 8px",
13196
+ background: "#dbeafe",
13197
+ borderRadius: 4
13198
+ },
13199
+ children: currentFolderObj.name
13200
+ }
13201
+ )
13202
+ ] }),
13203
+ visibleFolders.map((fld) => /* @__PURE__ */ jsxs(
13204
+ "button",
13205
+ {
13206
+ type: "button",
13207
+ onClick: () => setCurrentFolderId(Number(fld.id)),
13208
+ style: {
13209
+ display: "inline-flex",
13210
+ alignItems: "center",
13211
+ gap: 5,
13212
+ padding: "4px 10px",
13213
+ fontSize: 11,
13214
+ fontWeight: 600,
13215
+ borderRadius: 4,
13216
+ border: "1px solid #cbd5e1",
13217
+ background: "#ffffff",
13218
+ color: "#1e293b",
13219
+ cursor: "pointer"
13220
+ },
13221
+ children: [
13222
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "folder", size: 14, color: "#f59e0b" }),
13223
+ /* @__PURE__ */ jsx("span", { children: fld.name })
13224
+ ]
13225
+ },
13226
+ fld.id
13227
+ ))
13228
+ ]
13229
+ }
13230
+ ),
13231
+ /* @__PURE__ */ jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsx(
13232
+ "div",
13233
+ {
13234
+ style: {
13235
+ textAlign: "center",
13236
+ padding: 32,
13237
+ color: "#64748b",
13238
+ fontSize: 13
13239
+ },
13240
+ children: t("media.loadingFiles", "Loading media files...")
13241
+ }
13242
+ ) : filteredFiles.length === 0 ? /* @__PURE__ */ jsx(
13243
+ "div",
13244
+ {
13245
+ style: {
13246
+ textAlign: "center",
13247
+ padding: 32,
13248
+ color: "#64748b",
13249
+ fontSize: 13
13250
+ },
13251
+ children: t(
13252
+ "media.noMatchingFiles",
13253
+ "No matching files found in the media library. Use the Upload New File button above to upload from your computer."
13254
+ )
13255
+ }
13256
+ ) : /* @__PURE__ */ jsx(
13257
+ "div",
13258
+ {
13259
+ style: {
13260
+ display: "grid",
13261
+ gridTemplateColumns: "repeat(auto-fill, minmax(160px, 1fr))",
13262
+ gap: 12
13263
+ },
13264
+ children: filteredFiles.map((file) => {
13265
+ const fileKey = getFileKey(file);
13266
+ const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
13267
+ const isMultiSelected = multiIndex !== -1;
13268
+ const isCurrent = multiple ? isMultiSelected : Boolean(
13269
+ previewUrl && (file.url === previewUrl.split("?")[0] || file.name === value?.filename)
13270
+ );
13271
+ const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
13272
+ return /* @__PURE__ */ jsxs(
13273
+ "div",
13274
+ {
13275
+ onClick: () => {
13276
+ if (multiple) {
13277
+ toggleFileSelection(file);
13278
+ } else {
13279
+ onChange(mapStrapiFileToAsset(file));
13280
+ setModalOpen(false);
13281
+ }
13282
+ },
13283
+ onDoubleClick: () => {
13284
+ if (multiple) {
13285
+ const asset = mapStrapiFileToAsset(file);
13286
+ const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
13287
+ if (onSelectMultiple) {
13288
+ onSelectMultiple(listToCommit);
13289
+ } else {
13290
+ listToCommit.forEach((a) => onChange(a));
13291
+ }
13292
+ setSelectedFiles([]);
13293
+ setModalOpen(false);
13294
+ }
13295
+ },
13296
+ style: {
13297
+ border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
13298
+ borderRadius: 6,
13299
+ overflow: "hidden",
13300
+ cursor: "pointer",
13301
+ background: isCurrent ? "#eff6ff" : "#fff",
13302
+ boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
13303
+ userSelect: "none",
13304
+ display: "flex",
13305
+ flexDirection: "column"
13306
+ },
13307
+ children: [
13308
+ /* @__PURE__ */ jsxs(
13309
+ "div",
13310
+ {
13311
+ style: {
13312
+ height: 112,
13313
+ background: "#f1f5f9",
13314
+ display: "flex",
13315
+ alignItems: "center",
13316
+ justifyContent: "center",
13317
+ position: "relative"
13318
+ },
13319
+ children: [
13320
+ file.mime?.startsWith("image/") ? /* @__PURE__ */ jsx(
13321
+ "img",
13322
+ {
13323
+ src: thumbSrc,
13324
+ alt: file.name,
13325
+ style: { width: "100%", height: "100%", objectFit: "cover" }
13326
+ }
13327
+ ) : /* @__PURE__ */ jsx(MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
13328
+ multiple ? /* @__PURE__ */ jsx(
13329
+ "span",
13330
+ {
13331
+ style: {
13332
+ position: "absolute",
13333
+ top: 6,
13334
+ left: 6,
13335
+ minWidth: 22,
13336
+ height: 22,
13337
+ padding: isMultiSelected ? "0 6px" : 0,
13338
+ borderRadius: 11,
13339
+ background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.9)",
13340
+ border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
13341
+ color: "#ffffff",
13342
+ fontSize: 10,
13343
+ fontWeight: 700,
13344
+ display: "inline-flex",
13345
+ alignItems: "center",
13346
+ justifyContent: "center",
13347
+ boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
13348
+ },
13349
+ children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
13350
+ }
13351
+ ) : isCurrent && /* @__PURE__ */ jsx(
13352
+ "span",
13353
+ {
13354
+ style: {
13355
+ position: "absolute",
13356
+ top: 5,
13357
+ left: 5,
13358
+ background: "#2669a0",
13359
+ color: "#fff",
13360
+ fontSize: 9,
13361
+ fontWeight: 700,
13362
+ padding: "2px 6px",
13363
+ borderRadius: 4
13364
+ },
13365
+ children: t("media.selectedBadge", "SELECTED")
13366
+ }
13367
+ ),
13368
+ /* @__PURE__ */ jsxs(
13369
+ "div",
13370
+ {
13371
+ style: {
13372
+ position: "absolute",
13373
+ top: 5,
13374
+ right: 5,
13375
+ display: "flex",
13376
+ gap: 4
13377
+ },
13378
+ onClick: (e) => e.stopPropagation(),
13379
+ children: [
13380
+ /* @__PURE__ */ jsx(
13381
+ "button",
13382
+ {
13383
+ type: "button",
13384
+ onClick: (e) => {
13385
+ e.stopPropagation();
13386
+ openEditorForFile(file, "crop");
13387
+ },
13388
+ title: file.mime?.startsWith("image/") ? tr ? "Görseli Kırp & Düzenle" : "Crop & Edit Image" : tr ? "Dosya Bilgilerini Düzenle" : "Edit File Details",
13389
+ style: {
13390
+ width: 24,
13391
+ height: 24,
13392
+ borderRadius: 4,
13393
+ border: "1px solid rgba(15,23,42,0.15)",
13394
+ background: "rgba(255,255,255,0.92)",
13395
+ color: "#1e293b",
13396
+ display: "inline-flex",
13397
+ alignItems: "center",
13398
+ justifyContent: "center",
13399
+ cursor: "pointer",
13400
+ padding: 0
13401
+ },
13402
+ children: /* @__PURE__ */ jsx(
13403
+ MaterialIcon,
13404
+ {
13405
+ name: file.mime?.startsWith("image/") ? "crop" : "edit",
13406
+ size: 14,
13407
+ color: "#2669a0"
13408
+ }
13409
+ )
13410
+ }
13411
+ ),
13412
+ /* @__PURE__ */ jsx(
13413
+ "button",
13414
+ {
13415
+ type: "button",
13416
+ onClick: (e) => handleDeleteAsset(file, e),
13417
+ title: tr ? "Kütüphaneden Sil" : "Delete from Library",
13418
+ style: {
13419
+ width: 24,
13420
+ height: 24,
13421
+ borderRadius: 4,
13422
+ border: "1px solid rgba(15,23,42,0.15)",
13423
+ background: "rgba(255,255,255,0.92)",
13424
+ color: "#dc2626",
13425
+ display: "inline-flex",
13426
+ alignItems: "center",
13427
+ justifyContent: "center",
13428
+ cursor: "pointer",
13429
+ padding: 0
13430
+ },
13431
+ children: /* @__PURE__ */ jsx(MaterialIcon, { name: "delete_outline", size: 14, color: "#dc2626" })
13432
+ }
13433
+ )
13434
+ ]
13435
+ }
13436
+ ),
13437
+ file.ext && /* @__PURE__ */ jsx(
13438
+ "span",
13439
+ {
13440
+ style: {
13441
+ position: "absolute",
13442
+ bottom: 4,
13443
+ right: 4,
13444
+ background: "rgba(15,23,42,0.75)",
13445
+ color: "#fff",
13446
+ fontSize: 9,
13447
+ fontWeight: 700,
13448
+ padding: "1px 5px",
13449
+ borderRadius: 3,
13450
+ textTransform: "uppercase"
13451
+ },
13452
+ children: file.ext.replace(".", "")
13453
+ }
13454
+ )
13455
+ ]
13456
+ }
13457
+ ),
13458
+ /* @__PURE__ */ jsxs("div", { style: { padding: "6px 8px" }, children: [
13459
+ /* @__PURE__ */ jsx(
13460
+ "div",
13461
+ {
13462
+ style: {
13463
+ fontSize: 11,
13464
+ fontWeight: 600,
13465
+ color: "#1e293b",
13466
+ overflow: "hidden",
13467
+ textOverflow: "ellipsis",
13468
+ whiteSpace: "nowrap"
13469
+ },
13470
+ title: file.name,
13471
+ children: file.name
13472
+ }
13473
+ ),
13474
+ (file.width || file.size) && /* @__PURE__ */ jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
13475
+ file.width && file.height ? `${file.width}×${file.height}` : "",
13476
+ file.width && file.size ? " · " : "",
13477
+ file.size ? `${Math.round(Number(file.size))} KB` : ""
13478
+ ] })
13479
+ ] })
13480
+ ]
11974
13481
  },
11975
- children: t("clearSelection", "Clear Selection")
11976
- }
11977
- )
11978
- ] })
11979
- ]
11980
- }
11981
- ),
11982
- /* @__PURE__ */ jsx("div", { style: { padding: 18, overflowY: "auto", flex: 1 }, children: loading ? /* @__PURE__ */ jsx(
11983
- "div",
11984
- {
11985
- style: { textAlign: "center", padding: 32, color: "#64748b", fontSize: 13 },
11986
- children: t("media.loadingFiles", "Loading media files...")
11987
- }
11988
- ) : filteredFiles.length === 0 ? /* @__PURE__ */ jsx(
11989
- "div",
11990
- {
11991
- style: { textAlign: "center", padding: 32, color: "#64748b", fontSize: 13 },
11992
- children: t(
11993
- "media.noMatchingFiles",
11994
- "No matching files found in the media library. Use the Upload New File button above to upload from your computer."
11995
- )
11996
- }
11997
- ) : /* @__PURE__ */ jsx(
11998
- "div",
11999
- {
12000
- style: {
12001
- display: "grid",
12002
- gridTemplateColumns: "repeat(auto-fill, minmax(145px, 1fr))",
12003
- gap: 12
12004
- },
12005
- children: filteredFiles.map((file) => {
12006
- const fileKey = getFileKey(file);
12007
- const multiIndex = multiple ? selectedFiles.findIndex((f) => getFileKey(f) === fileKey) : -1;
12008
- const isMultiSelected = multiIndex !== -1;
12009
- const isCurrent = multiple ? isMultiSelected : Boolean(
12010
- previewUrl && (file.url === previewUrl || file.name === value?.filename)
12011
- );
12012
- const thumbSrc = file.formats?.thumbnail?.url || file.formats?.small?.url || file.url || "";
12013
- return /* @__PURE__ */ jsxs(
12014
- "div",
12015
- {
12016
- onClick: () => {
12017
- if (multiple) {
12018
- toggleFileSelection(file);
12019
- } else {
12020
- onChange(mapStrapiFileToAsset(file));
12021
- setModalOpen(false);
12022
- }
12023
- },
12024
- onDoubleClick: () => {
12025
- if (multiple) {
12026
- const asset = mapStrapiFileToAsset(file);
12027
- const listToCommit = selectedFiles.length > 0 ? selectedFiles.map(mapStrapiFileToAsset) : [asset];
12028
- if (onSelectMultiple) {
12029
- onSelectMultiple(listToCommit);
12030
- } else {
12031
- listToCommit.forEach((a) => onChange(a));
13482
+ fileKey
13483
+ );
13484
+ })
13485
+ }
13486
+ ) }),
13487
+ /* @__PURE__ */ jsxs(
13488
+ "div",
13489
+ {
13490
+ style: {
13491
+ display: "flex",
13492
+ alignItems: "center",
13493
+ justifyContent: "space-between",
13494
+ padding: "12px 18px",
13495
+ borderTop: "1px solid #e2e8f0",
13496
+ background: "#f8fafc",
13497
+ gap: 12
13498
+ },
13499
+ children: [
13500
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: multiple ? selectedFiles.length > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
13501
+ selectedFiles.length,
13502
+ " ",
13503
+ t("selectedCountLabel", "selected")
13504
+ ] }) : /* @__PURE__ */ jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) : /* @__PURE__ */ 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." }) }),
13505
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
13506
+ /* @__PURE__ */ jsx(
13507
+ "button",
13508
+ {
13509
+ type: "button",
13510
+ onClick: () => {
13511
+ setSelectedFiles([]);
13512
+ setModalOpen(false);
13513
+ },
13514
+ style: {
13515
+ padding: "7px 14px",
13516
+ fontSize: 12,
13517
+ fontWeight: 600,
13518
+ border: "1px solid #cbd5e1",
13519
+ borderRadius: 5,
13520
+ background: "#ffffff",
13521
+ color: "#475569",
13522
+ cursor: "pointer"
13523
+ },
13524
+ children: t("cancel", "Cancel")
12032
13525
  }
12033
- setSelectedFiles([]);
12034
- setModalOpen(false);
12035
- }
12036
- },
12037
- style: {
12038
- border: isCurrent ? "2px solid #2669a0" : "1px solid #e2e8f0",
12039
- borderRadius: 6,
12040
- overflow: "hidden",
12041
- cursor: "pointer",
12042
- background: isCurrent ? "#eff6ff" : "#fff",
12043
- boxShadow: isCurrent ? "0 0 0 2px rgba(38, 105, 160, 0.16)" : "0 1px 3px rgba(0,0,0,0.04)",
12044
- userSelect: "none"
12045
- },
12046
- children: [
12047
- /* @__PURE__ */ jsxs(
12048
- "div",
13526
+ ),
13527
+ multiple && /* @__PURE__ */ jsxs(
13528
+ "button",
12049
13529
  {
13530
+ type: "button",
13531
+ disabled: selectedFiles.length === 0,
13532
+ onClick: handleConfirmMultiple,
12050
13533
  style: {
12051
- height: 100,
12052
- background: "#f1f5f9",
12053
- display: "flex",
13534
+ display: "inline-flex",
12054
13535
  alignItems: "center",
12055
- justifyContent: "center",
12056
- position: "relative"
13536
+ gap: 6,
13537
+ padding: "7px 16px",
13538
+ fontSize: 12,
13539
+ fontWeight: 700,
13540
+ border: "none",
13541
+ borderRadius: 5,
13542
+ background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
13543
+ color: "#ffffff",
13544
+ cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
12057
13545
  },
12058
13546
  children: [
12059
- file.mime?.startsWith("image/") ? /* @__PURE__ */ jsx(
12060
- "img",
12061
- {
12062
- src: thumbSrc,
12063
- alt: file.name,
12064
- style: { width: "100%", height: "100%", objectFit: "cover" }
12065
- }
12066
- ) : /* @__PURE__ */ jsx(MaterialIcon, { name: "description", size: 30, color: "#64748b" }),
12067
- multiple ? /* @__PURE__ */ jsx(
12068
- "span",
12069
- {
12070
- style: {
12071
- position: "absolute",
12072
- top: 6,
12073
- left: 6,
12074
- minWidth: 22,
12075
- height: 22,
12076
- padding: isMultiSelected ? "0 6px" : 0,
12077
- borderRadius: 11,
12078
- background: isMultiSelected ? "#2669a0" : "rgba(255, 255, 255, 0.88)",
12079
- border: isMultiSelected ? "1.5px solid #ffffff" : "1.5px solid #94a3b8",
12080
- color: "#ffffff",
12081
- fontSize: 10,
12082
- fontWeight: 700,
12083
- display: "inline-flex",
12084
- alignItems: "center",
12085
- justifyContent: "center",
12086
- boxShadow: "0 1px 3px rgba(0,0,0,0.2)"
12087
- },
12088
- children: isMultiSelected ? `✓ ${multiIndex + 1}` : ""
12089
- }
12090
- ) : isCurrent && /* @__PURE__ */ jsx(
12091
- "span",
12092
- {
12093
- style: {
12094
- position: "absolute",
12095
- top: 5,
12096
- left: 5,
12097
- background: "#2669a0",
12098
- color: "#fff",
12099
- fontSize: 9,
12100
- fontWeight: 700,
12101
- padding: "2px 6px",
12102
- borderRadius: 4
12103
- },
12104
- children: t("media.selectedBadge", "SELECTED")
12105
- }
12106
- ),
12107
- file.ext && /* @__PURE__ */ jsx(
12108
- "span",
12109
- {
12110
- style: {
12111
- position: "absolute",
12112
- bottom: 4,
12113
- right: 4,
12114
- background: "rgba(15,23,42,0.75)",
12115
- color: "#fff",
12116
- fontSize: 9,
12117
- fontWeight: 700,
12118
- padding: "1px 5px",
12119
- borderRadius: 3,
12120
- textTransform: "uppercase"
12121
- },
12122
- children: file.ext.replace(".", "")
12123
- }
12124
- )
13547
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
13548
+ /* @__PURE__ */ jsxs("span", { children: [
13549
+ t("addSelectedMedia", "Add Selected"),
13550
+ " ",
13551
+ selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
13552
+ ] })
12125
13553
  ]
12126
13554
  }
12127
- ),
12128
- /* @__PURE__ */ jsxs("div", { style: { padding: "6px 8px" }, children: [
12129
- /* @__PURE__ */ jsx(
12130
- "div",
12131
- {
12132
- style: {
12133
- fontSize: 11,
12134
- fontWeight: 600,
12135
- color: "#1e293b",
12136
- overflow: "hidden",
12137
- textOverflow: "ellipsis",
12138
- whiteSpace: "nowrap"
12139
- },
12140
- title: file.name,
12141
- children: file.name
12142
- }
12143
- ),
12144
- (file.width || file.size) && /* @__PURE__ */ jsxs("div", { style: { fontSize: 10, color: "#64748b", marginTop: 2 }, children: [
12145
- file.width && file.height ? `${file.width}×${file.height}` : "",
12146
- file.width && file.size ? " · " : "",
12147
- file.size ? `${Math.round(Number(file.size))} KB` : ""
12148
- ] })
12149
- ] })
12150
- ]
12151
- },
12152
- fileKey
12153
- );
12154
- })
12155
- }
12156
- ) }),
12157
- multiple && /* @__PURE__ */ jsxs(
12158
- "div",
12159
- {
12160
- style: {
12161
- display: "flex",
12162
- alignItems: "center",
12163
- justifyContent: "space-between",
12164
- padding: "12px 18px",
12165
- borderTop: "1px solid #e2e8f0",
12166
- background: "#f8fafc",
12167
- gap: 12
12168
- },
12169
- children: [
12170
- /* @__PURE__ */ jsx("div", { style: { fontSize: 12, color: "#475569", fontWeight: 500 }, children: selectedFiles.length > 0 ? /* @__PURE__ */ jsxs("span", { style: { color: "#0f172a", fontWeight: 700 }, children: [
12171
- selectedFiles.length,
12172
- " ",
12173
- t("selectedCountLabel", "selected")
12174
- ] }) : /* @__PURE__ */ jsx("span", { children: t("multiSelectHint", "Click multiple images to select them in order") }) }),
12175
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
12176
- /* @__PURE__ */ jsx(
12177
- "button",
12178
- {
12179
- type: "button",
12180
- onClick: () => {
12181
- setSelectedFiles([]);
12182
- setModalOpen(false);
12183
- },
12184
- style: {
12185
- padding: "7px 14px",
12186
- fontSize: 12,
12187
- fontWeight: 600,
12188
- border: "1px solid #cbd5e1",
12189
- borderRadius: 5,
12190
- background: "#ffffff",
12191
- color: "#475569",
12192
- cursor: "pointer"
12193
- },
12194
- children: t("cancel", "Cancel")
12195
- }
12196
- ),
12197
- /* @__PURE__ */ jsxs(
12198
- "button",
12199
- {
12200
- type: "button",
12201
- disabled: selectedFiles.length === 0,
12202
- onClick: handleConfirmMultiple,
12203
- style: {
12204
- display: "inline-flex",
12205
- alignItems: "center",
12206
- gap: 6,
12207
- padding: "7px 16px",
12208
- fontSize: 12,
12209
- fontWeight: 700,
12210
- border: "none",
12211
- borderRadius: 5,
12212
- background: selectedFiles.length > 0 ? "#2669a0" : "#94a3b8",
12213
- color: "#ffffff",
12214
- cursor: selectedFiles.length > 0 ? "pointer" : "not-allowed"
12215
- },
12216
- children: [
12217
- /* @__PURE__ */ jsx(MaterialIcon, { name: "check", size: 16, color: "#ffffff" }),
12218
- /* @__PURE__ */ jsxs("span", { children: [
12219
- t("addSelectedMedia", "Add Selected"),
12220
- " ",
12221
- selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""
12222
- ] })
12223
- ]
12224
- }
12225
- )
12226
- ] })
12227
- ]
12228
- }
13555
+ )
13556
+ ] })
13557
+ ]
13558
+ }
13559
+ )
13560
+ ] })
12229
13561
  )
12230
13562
  ]
12231
13563
  }
@@ -16335,6 +17667,9 @@ const VisualEditorModal = ({ open, onClose }) => {
16335
17667
  useEffect(() => {
16336
17668
  if (!open) return;
16337
17669
  const onKeyDown = (e) => {
17670
+ if (typeof document !== "undefined" && document.querySelector('[role="dialog"], [data-radix-popper-content-wrapper]')) {
17671
+ return;
17672
+ }
16338
17673
  const target = e.target;
16339
17674
  const isInput = target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable);
16340
17675
  if (e.key === "Escape") {
@@ -16493,7 +17828,7 @@ const VisualEditorModal = ({ open, onClose }) => {
16493
17828
  style: {
16494
17829
  position: "fixed",
16495
17830
  inset: 0,
16496
- zIndex: 9999,
17831
+ zIndex: 200,
16497
17832
  background: "#f8fafc",
16498
17833
  display: "flex",
16499
17834
  flexDirection: "column",
@@ -16747,7 +18082,7 @@ const CIContextMenu = () => {
16747
18082
  position: "fixed",
16748
18083
  left: pos.left,
16749
18084
  top: pos.top,
16750
- zIndex: 10500,
18085
+ zIndex: 250,
16751
18086
  minWidth: 235,
16752
18087
  background: "#ffffff",
16753
18088
  border: "1px solid #cbd5e1",
@@ -18314,7 +19649,7 @@ const InnerContentBuilder = ({
18314
19649
  position: "fixed",
18315
19650
  inset: 0,
18316
19651
  background: "rgba(15, 23, 42, 0.5)",
18317
- zIndex: 10200,
19652
+ zIndex: 230,
18318
19653
  display: "flex",
18319
19654
  alignItems: "center",
18320
19655
  justifyContent: "center",
@@ -18438,7 +19773,7 @@ const InnerContentBuilder = ({
18438
19773
  position: "fixed",
18439
19774
  inset: 0,
18440
19775
  background: "rgba(15, 23, 42, 0.5)",
18441
- zIndex: 10200,
19776
+ zIndex: 230,
18442
19777
  display: "flex",
18443
19778
  alignItems: "center",
18444
19779
  justifyContent: "center",