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