@ozguraltan/strapi-content-input 1.0.21 → 1.0.23

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.
Files changed (29) hide show
  1. package/README.md +42 -13
  2. package/dist/admin/{AnalyticsHubPage-DsrcGI_Y.mjs → AnalyticsHubPage-Dvpx3KsP.mjs} +168 -55
  3. package/dist/admin/{AnalyticsHubPage-0p0Mx4AU.js → AnalyticsHubPage-K_trli5i.js} +186 -55
  4. package/dist/admin/{ContentInputField-CHXrzvE-.mjs → ContentInputField-C2kmtUwD.mjs} +328 -366
  5. package/dist/admin/{ContentInputField-7rWLSx_7.js → ContentInputField-CjxYYEps.js} +343 -381
  6. package/dist/admin/{SurveyWidgetEditor-BVN6X_3G.mjs → SurveyWidgetEditor-DMWOkHUt.mjs} +3271 -227
  7. package/dist/admin/{SurveyWidgetEditor-BmgYQaQS.js → SurveyWidgetEditor-DOYxWop9.js} +3247 -203
  8. package/dist/admin/{index-hFIuYqu5.mjs → index-AePRA0IB.mjs} +2 -2
  9. package/dist/admin/{index-CZAwXCFH.js → index-B9C8Qrfd.js} +2 -2
  10. package/dist/admin/index.js +1 -1
  11. package/dist/admin/index.mjs +1 -1
  12. package/dist/admin/src/components/common/CIImageSettingsControl.d.ts +17 -0
  13. package/dist/admin/src/components/widgets/CustomCardWidgetEditor.d.ts +1 -0
  14. package/dist/admin/src/components/widgets/HeroSliderStage.d.ts +3 -0
  15. package/dist/admin/src/components/widgets/SurveyLivePreviewPane.d.ts +9 -0
  16. package/dist/admin/src/components/widgets/SurveyWidgetEditor.d.ts +3 -1
  17. package/dist/admin/src/core/canvasClasses.d.ts +1 -0
  18. package/dist/admin/src/core/types.d.ts +12 -0
  19. package/dist/server/index.js +1359 -196
  20. package/dist/server/index.mjs +1341 -196
  21. package/dist/server/src/config/index.d.ts +4 -0
  22. package/dist/server/src/controllers/ci-image.d.ts +11 -2
  23. package/dist/server/src/controllers/index.d.ts +1 -0
  24. package/dist/server/src/index.d.ts +15 -1
  25. package/dist/server/src/services/ci-survey.d.ts +10 -1
  26. package/dist/server/src/services/index.d.ts +10 -1
  27. package/dist/server/src/utils/image-variants.d.ts +74 -0
  28. package/dist/server/src/utils/surveyEngine.d.ts +5 -0
  29. package/package.json +1 -1
@@ -3,7 +3,7 @@ const jsxRuntime = require("react/jsx-runtime");
3
3
  const React = require("react");
4
4
  const ReactDOM = require("react-dom");
5
5
  const admin = require("@strapi/strapi/admin");
6
- const index = require("./index-CZAwXCFH.js");
6
+ const index = require("./index-B9C8Qrfd.js");
7
7
  const cloneDeep = require("lodash/cloneDeep");
8
8
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
9
9
  const ReactDOM__default = /* @__PURE__ */ _interopDefault(ReactDOM);
@@ -2531,6 +2531,236 @@ function useEditorTranslator() {
2531
2531
  t: fallbackT
2532
2532
  };
2533
2533
  }
2534
+ const BP_INFIXES = ["", "-sm", "-md", "-lg", "-xl"];
2535
+ function extractResponsiveProp(lp, baseKey, camelKey) {
2536
+ if (!lp) return [null, null, null, null, null];
2537
+ const rawArr = lp[baseKey] ?? (camelKey ? lp[camelKey] : void 0);
2538
+ if (Array.isArray(rawArr)) {
2539
+ return BP_INFIXES.map((infix, idx) => {
2540
+ const explicitKey = `${baseKey}${infix}`;
2541
+ if (typeof lp[explicitKey] === "string" && lp[explicitKey]) {
2542
+ return lp[explicitKey];
2543
+ }
2544
+ const v = rawArr[idx];
2545
+ return typeof v === "string" && v ? v : null;
2546
+ });
2547
+ }
2548
+ return BP_INFIXES.map((infix, idx) => {
2549
+ const k = `${baseKey}${infix}`;
2550
+ if (typeof lp[k] === "string" && lp[k]) return lp[k];
2551
+ if (idx === 0 && camelKey && typeof lp[camelKey] === "string" && lp[camelKey]) {
2552
+ return lp[camelKey];
2553
+ }
2554
+ return null;
2555
+ });
2556
+ }
2557
+ function setResponsiveProp(lp, baseKey, bpIndex, value, camelKey) {
2558
+ const nextLp = { ...lp || {} };
2559
+ const arr = extractResponsiveProp(nextLp, baseKey, camelKey);
2560
+ const cleanVal = value && value.trim() ? value.trim() : null;
2561
+ arr[bpIndex] = cleanVal;
2562
+ const hasOtherValues = arr.some((v, i) => i !== bpIndex && v !== null);
2563
+ if (bpIndex !== 0 && !hasOtherValues && cleanVal !== null) {
2564
+ arr[0] = cleanVal;
2565
+ }
2566
+ nextLp[baseKey] = arr;
2567
+ if (camelKey) {
2568
+ nextLp[camelKey] = arr;
2569
+ }
2570
+ BP_INFIXES.forEach((infix, idx) => {
2571
+ if (idx === 0) return;
2572
+ const flatKey = `${baseKey}${infix}`;
2573
+ if (arr[idx]) {
2574
+ nextLp[flatKey] = arr[idx];
2575
+ } else {
2576
+ delete nextLp[flatKey];
2577
+ }
2578
+ });
2579
+ return nextLp;
2580
+ }
2581
+ function rowCanvasClasses(row = {}) {
2582
+ const classes = ["ci-grid"];
2583
+ const lp = row.layoutProps || {};
2584
+ if (lp.noGutters || lp["no-gutters"]) classes.push("ci-no-gutters");
2585
+ if (lp.fillHeight || lp["fill-height"]) classes.push("ci-fill-height");
2586
+ if (lp.reverse) classes.push("flex-row-reverse");
2587
+ if (lp.flexDirection === "column") classes.push("flex-column");
2588
+ const alignArr = extractResponsiveProp(lp, "align");
2589
+ const firstAlign = alignArr.find((v) => Boolean(v)) || null;
2590
+ if (!alignArr[0] && firstAlign) {
2591
+ classes.push(`ci-align-${firstAlign}`);
2592
+ }
2593
+ alignArr.forEach((val, idx) => {
2594
+ if (val && BP_INFIXES[idx] !== void 0) {
2595
+ classes.push(`ci-align${BP_INFIXES[idx]}-${val}`);
2596
+ }
2597
+ });
2598
+ const justifyArr = extractResponsiveProp(lp, "justify");
2599
+ const firstJustify = justifyArr.find((v) => Boolean(v)) || null;
2600
+ if (!justifyArr[0] && firstJustify) {
2601
+ classes.push(`ci-justify-${firstJustify}`);
2602
+ }
2603
+ justifyArr.forEach((val, idx) => {
2604
+ if (val && BP_INFIXES[idx] !== void 0) {
2605
+ classes.push(`ci-justify${BP_INFIXES[idx]}-${val}`);
2606
+ }
2607
+ });
2608
+ const textArr = extractResponsiveProp(lp, "text", "textAlign");
2609
+ if (row.textAlign && !textArr[0]) {
2610
+ textArr[0] = row.textAlign;
2611
+ }
2612
+ const firstText = textArr.find((v) => Boolean(v)) || null;
2613
+ if (!textArr[0] && firstText) {
2614
+ classes.push(`ci-text-${firstText}`);
2615
+ }
2616
+ textArr.forEach((val, idx) => {
2617
+ if (val && BP_INFIXES[idx] !== void 0) {
2618
+ classes.push(`ci-text${BP_INFIXES[idx]}-${val}`);
2619
+ }
2620
+ });
2621
+ if (Array.isArray(row.extraClasses)) {
2622
+ row.extraClasses.forEach((c) => {
2623
+ if (c && typeof c === "string") classes.push(c);
2624
+ });
2625
+ }
2626
+ return classes;
2627
+ }
2628
+ function blockCanvasClasses(block = {}) {
2629
+ const classes = ["ci-col"];
2630
+ const cols = Array.isArray(block.cols) && block.cols.length > 0 ? block.cols : [12, 12, 12, 12, 12];
2631
+ BP_INFIXES.forEach((infix, idx) => {
2632
+ const c = Math.max(1, Math.min(12, Number(cols[idx] ?? cols[0] ?? 12)));
2633
+ classes.push(`ci-col${infix}-${c}`);
2634
+ });
2635
+ if (Array.isArray(block.offset)) {
2636
+ BP_INFIXES.forEach((infix, idx) => {
2637
+ const off = Number(block.offset?.[idx] || 0);
2638
+ if (off > 0 && off <= 11) {
2639
+ classes.push(`ci-offset${infix}-${off}`);
2640
+ }
2641
+ });
2642
+ }
2643
+ const lp = block.layoutProps || {};
2644
+ const alignSelfArr = extractResponsiveProp(lp, "align-self", "alignSelf");
2645
+ const firstAlignSelf = alignSelfArr.find((v) => Boolean(v)) || null;
2646
+ if (!alignSelfArr[0] && firstAlignSelf) {
2647
+ classes.push(`ci-align-self-${firstAlignSelf}`);
2648
+ }
2649
+ alignSelfArr.forEach((val, idx) => {
2650
+ if (val && BP_INFIXES[idx] !== void 0) {
2651
+ classes.push(`ci-align-self${BP_INFIXES[idx]}-${val}`);
2652
+ }
2653
+ });
2654
+ const justifySelfArr = extractResponsiveProp(lp, "justify-self", "justifySelf");
2655
+ const firstJustifySelf = justifySelfArr.find((v) => Boolean(v)) || null;
2656
+ if (!justifySelfArr[0] && firstJustifySelf) {
2657
+ classes.push(`ci-justify-self-${firstJustifySelf}`);
2658
+ }
2659
+ justifySelfArr.forEach((val, idx) => {
2660
+ if (val && BP_INFIXES[idx] !== void 0) {
2661
+ classes.push(`ci-justify-self${BP_INFIXES[idx]}-${val}`);
2662
+ }
2663
+ });
2664
+ const textArr = extractResponsiveProp(lp, "text", "textAlign");
2665
+ const firstText = textArr.find((v) => Boolean(v)) || null;
2666
+ if (!textArr[0] && firstText) {
2667
+ classes.push(`ci-text-${firstText}`);
2668
+ }
2669
+ textArr.forEach((val, idx) => {
2670
+ if (val && BP_INFIXES[idx] !== void 0) {
2671
+ classes.push(`ci-text${BP_INFIXES[idx]}-${val}`);
2672
+ }
2673
+ });
2674
+ if (Array.isArray(block.extraClasses)) {
2675
+ block.extraClasses.forEach((c) => {
2676
+ if (c && typeof c === "string") classes.push(c);
2677
+ });
2678
+ }
2679
+ return classes;
2680
+ }
2681
+ function resolveCanvasMediaUrl(assetOrUrl, imageSettings) {
2682
+ if (!assetOrUrl) return "";
2683
+ const asset = typeof assetOrUrl === "object" ? assetOrUrl : null;
2684
+ const preferredUrl = typeof assetOrUrl === "string" ? assetOrUrl : asset?.optimized_url || asset?.target_url || asset?.url || asset?.src || "";
2685
+ const origUrl = typeof assetOrUrl === "string" ? assetOrUrl : asset?.original_url || asset?.url || asset?.target_url || preferredUrl;
2686
+ if (!preferredUrl && !origUrl) return "";
2687
+ const proc = String(imageSettings?.process || "").trim().toLowerCase();
2688
+ if (proc === "none" || proc === "no-process") {
2689
+ return origUrl || preferredUrl;
2690
+ }
2691
+ if (!proc || proc === "auto") {
2692
+ return preferredUrl || origUrl;
2693
+ }
2694
+ if (proc !== "fit" && proc !== "widen") {
2695
+ return preferredUrl || origUrl;
2696
+ }
2697
+ const w = Number(imageSettings?.cWidth) || 0;
2698
+ const h = proc === "fit" ? Number(imageSettings?.cHeight) || 0 : 0;
2699
+ const rotate = Number(imageSettings?.rotate) || 0;
2700
+ if (w <= 0 && h <= 0) {
2701
+ return preferredUrl || origUrl;
2702
+ }
2703
+ const formatKey = `ci_${proc}_${w}x${h}${rotate ? `_r${rotate}` : ""}`;
2704
+ const directVariantUrl = asset?.formats?.[formatKey]?.url;
2705
+ if (directVariantUrl) {
2706
+ return directVariantUrl;
2707
+ }
2708
+ const baseSrc = origUrl || preferredUrl;
2709
+ if (baseSrc.startsWith("data:") || baseSrc.startsWith("blob:") || /\.(svg|gif|mp4|webm|mov|pdf)(\?|#|$)/i.test(baseSrc) || baseSrc.includes("/api/content-input/image") || baseSrc.includes("/content-input/image")) {
2710
+ return baseSrc;
2711
+ }
2712
+ const params = new URLSearchParams();
2713
+ params.set("src", baseSrc);
2714
+ params.set("process", proc);
2715
+ if (w > 0) params.set("w", String(w));
2716
+ if (proc === "fit" && h > 0) params.set("h", String(h));
2717
+ if (rotate) params.set("rotate", String(rotate));
2718
+ return `/api/content-input/image?${params.toString()}`;
2719
+ }
2720
+ function nodeCanvasStyles(node) {
2721
+ const so = node?.styleOptions || {};
2722
+ const style = {};
2723
+ if (so.padding) style.padding = so.padding;
2724
+ if (so.margin) style.margin = so.margin;
2725
+ if (so.height) style.height = so.height;
2726
+ if (so.minHeight || so["min-height"]) {
2727
+ style.minHeight = so.minHeight || so["min-height"];
2728
+ }
2729
+ if (so.maxHeight || so["max-height"]) {
2730
+ style.maxHeight = so.maxHeight || so["max-height"];
2731
+ }
2732
+ if (so.fontSize || so["font-size"]) {
2733
+ style.fontSize = so.fontSize || so["font-size"];
2734
+ }
2735
+ if (so.backgroundColor || so["background-color"]) {
2736
+ style.backgroundColor = so.backgroundColor || so["background-color"];
2737
+ }
2738
+ if (so.color) style.color = so.color;
2739
+ if (so.border) style.border = so.border;
2740
+ if (so.borderTop || so["border-top"]) style.borderTop = so.borderTop || so["border-top"];
2741
+ if (so.borderRight || so["border-right"])
2742
+ style.borderRight = so.borderRight || so["border-right"];
2743
+ if (so.borderBottom || so["border-bottom"])
2744
+ style.borderBottom = so.borderBottom || so["border-bottom"];
2745
+ if (so.borderLeft || so["border-left"]) style.borderLeft = so.borderLeft || so["border-left"];
2746
+ if (so.outline) style.outline = so.outline;
2747
+ if (so.borderRadius || so["border-radius"]) {
2748
+ style.borderRadius = so.borderRadius || so["border-radius"];
2749
+ }
2750
+ const bgOpts = node?.bgOptions || {};
2751
+ const bgAsset = node?.bgImage || bgOpts?.bgImage;
2752
+ const bgUrl = resolveCanvasMediaUrl(bgAsset, bgOpts?.imageSettings);
2753
+ if (bgUrl) {
2754
+ style.backgroundImage = `url("${bgUrl}")`;
2755
+ style.backgroundSize = bgOpts["background-size"] || bgOpts.size || "cover";
2756
+ style.backgroundPosition = bgOpts["background-position"] || bgOpts.position || "center center";
2757
+ style.backgroundRepeat = bgOpts["background-repeat"] || bgOpts.repeat || "no-repeat";
2758
+ if (bgOpts["background-attachment"] || bgOpts.attachment) {
2759
+ style.backgroundAttachment = bgOpts["background-attachment"] || bgOpts.attachment;
2760
+ }
2761
+ }
2762
+ return style;
2763
+ }
2534
2764
  function clampNum(n, min, max) {
2535
2765
  if (Number.isNaN(n)) return min;
2536
2766
  return Math.max(min, Math.min(max, n));
@@ -3782,9 +4012,33 @@ function mapStrapiFileToAsset(file, cacheBust) {
3782
4012
  const sep = u.includes("?") ? "&" : "?";
3783
4013
  return `${u}${sep}v=${Date.now()}`;
3784
4014
  };
4015
+ const keepStandard = /* @__PURE__ */ new Set(["thumbnail", "small", "medium", "large"]);
4016
+ const compactFormats = {};
4017
+ let detectedOptimizedUrl = "";
4018
+ if (file?.formats && typeof file.formats === "object") {
4019
+ for (const [k, fmt] of Object.entries(file.formats)) {
4020
+ if (!fmt || typeof fmt !== "object" || typeof fmt.url !== "string" || !fmt.url) continue;
4021
+ if (!keepStandard.has(k) && !k.startsWith("ci_")) continue;
4022
+ compactFormats[k] = {
4023
+ url: fmt.url,
4024
+ ...fmt.width ? { width: Number(fmt.width) } : {},
4025
+ ...fmt.height ? { height: Number(fmt.height) } : {},
4026
+ ...fmt.mime ? { mime: String(fmt.mime) } : {},
4027
+ ...fmt.size ? { size: Number(fmt.size) } : {}
4028
+ };
4029
+ if (k.startsWith("ci_auto_") && !detectedOptimizedUrl) {
4030
+ detectedOptimizedUrl = fmt.url;
4031
+ }
4032
+ }
4033
+ }
3785
4034
  const srcset = file?.formats ? Object.values(file.formats).filter((f) => f && f.url && f.width).map((f) => `${appendBust(f.url)} ${f.width}w`).join(", ") : "";
3786
- const finalUrl = appendBust(file.url || "");
4035
+ const rawMasterUrl = file.url || "";
4036
+ const finalUrl = appendBust(rawMasterUrl);
3787
4037
  return {
4038
+ ...file.id !== void 0 ? { id: file.id } : {},
4039
+ ...file.hash ? { hash: file.hash } : {},
4040
+ original_url: rawMasterUrl,
4041
+ ...detectedOptimizedUrl ? { optimized_url: appendBust(detectedOptimizedUrl) } : {},
3788
4042
  target_url: finalUrl,
3789
4043
  url: finalUrl,
3790
4044
  filename: file.name || file.filename || "media",
@@ -3793,7 +4047,8 @@ function mapStrapiFileToAsset(file, cacheBust) {
3793
4047
  width: file.width || void 0,
3794
4048
  height: file.height || void 0,
3795
4049
  caption: file.caption || file.alternativeText || "",
3796
- srcset: srcset || void 0
4050
+ srcset: srcset || void 0,
4051
+ ...Object.keys(compactFormats).length > 0 ? { formats: compactFormats } : {}
3797
4052
  };
3798
4053
  }
3799
4054
  const ASPECT_PRESETS = [
@@ -3930,15 +4185,56 @@ const StrapiMediaPicker = ({
3930
4185
  setModalOpen(true);
3931
4186
  loadLibrary().finally(() => setLoading(false));
3932
4187
  };
4188
+ const isRasterCandidate = (asset) => {
4189
+ if (!asset) return false;
4190
+ const m = String(asset.mime_type || "").toLowerCase();
4191
+ const u = String(asset.original_url || asset.url || asset.target_url || "").split("?")[0].toLowerCase();
4192
+ if (m.includes("svg") || m.includes("gif") || m.startsWith("video/") || m.startsWith("audio/") || m.startsWith("application/")) {
4193
+ return false;
4194
+ }
4195
+ if (/\.(svg|gif|mp4|webm|mov|pdf|docx?|xlsx?|pptx?|zip)$/i.test(u)) return false;
4196
+ return m.startsWith("image/") || /\.(jpe?g|png|webp|avif|tiff?|bmp)$/i.test(u);
4197
+ };
4198
+ const emitSingleAsset = (asset) => {
4199
+ onChange(asset);
4200
+ if (asset && asset.id && isRasterCandidate(asset) && !asset.optimized_url) {
4201
+ post("/content-input/media/optimize", { asset }).then((res) => {
4202
+ const enriched = res?.data?.data || res?.data;
4203
+ if (enriched && (enriched.optimized_url || enriched.formats)) {
4204
+ onChange(enriched);
4205
+ }
4206
+ }).catch(() => {
4207
+ });
4208
+ }
4209
+ };
4210
+ const emitMultipleAssets = async (assets) => {
4211
+ if (!assets || assets.length === 0) return;
4212
+ let finalAssets = assets;
4213
+ if (assets.some((a) => a.id && isRasterCandidate(a))) {
4214
+ try {
4215
+ const res = await post("/content-input/media/optimize", { assets });
4216
+ const enrichedList = res?.data?.data || res?.data;
4217
+ if (Array.isArray(enrichedList) && enrichedList.length === assets.length) {
4218
+ finalAssets = enrichedList;
4219
+ }
4220
+ } catch {
4221
+ }
4222
+ }
4223
+ if (onSelectMultiple) {
4224
+ onSelectMultiple(finalAssets);
4225
+ } else {
4226
+ finalAssets.forEach((a) => onChange(a));
4227
+ }
4228
+ };
3933
4229
  const handleOpenCropCurrent = async (e) => {
3934
4230
  e.preventDefault();
3935
4231
  e.stopPropagation();
3936
- const currentUrl = (value?.target_url || value?.url || "").split("?")[0];
3937
- if (!currentUrl) return;
4232
+ const currentUrl = (value?.original_url || value?.target_url || value?.url || "").split("?")[0];
4233
+ if (!currentUrl && !value?.id) return;
3938
4234
  setModalOpen(true);
3939
4235
  const loaded = await loadLibrary();
3940
4236
  const match = loaded.find(
3941
- (f) => f.url && f.url.split("?")[0] === currentUrl || f.url && currentUrl.endsWith(f.url.split("?")[0]) || value?.filename && f.name === value.filename
4237
+ (f) => value?.id !== void 0 && Number(f.id) === Number(value.id) || value?.hash && f.hash === value.hash || f.url && currentUrl && f.url.split("?")[0] === currentUrl || f.url && currentUrl && currentUrl.endsWith(f.url.split("?")[0]) || value?.filename && f.name === value.filename
3942
4238
  );
3943
4239
  if (match) {
3944
4240
  openEditorForFile(match, "crop");
@@ -3957,13 +4253,9 @@ const StrapiMediaPicker = ({
3957
4253
  const handleConfirmMultiple = () => {
3958
4254
  if (selectedFiles.length === 0) return;
3959
4255
  const assets = selectedFiles.map((f) => mapStrapiFileToAsset(f));
3960
- if (onSelectMultiple) {
3961
- onSelectMultiple(assets);
3962
- } else {
3963
- assets.forEach((asset) => onChange(asset));
3964
- }
3965
4256
  setSelectedFiles([]);
3966
4257
  setModalOpen(false);
4258
+ void emitMultipleAssets(assets);
3967
4259
  };
3968
4260
  const handleFileUpload = async (e) => {
3969
4261
  const inputFiles = e.target.files;
@@ -3984,19 +4276,15 @@ const StrapiMediaPicker = ({
3984
4276
  if (!modalOpen) {
3985
4277
  if (multiple) {
3986
4278
  const assets = uploadedList.map((f) => mapStrapiFileToAsset(f));
3987
- if (onSelectMultiple) {
3988
- onSelectMultiple(assets);
3989
- } else {
3990
- assets.forEach((a) => onChange(a));
3991
- }
4279
+ await emitMultipleAssets(assets);
3992
4280
  } else {
3993
- onChange(mapStrapiFileToAsset(uploadedList[0]));
4281
+ emitSingleAsset(mapStrapiFileToAsset(uploadedList[0]));
3994
4282
  }
3995
4283
  } else if (multiple) {
3996
4284
  setSelectedFiles((prev) => [...prev, ...uploadedList]);
3997
4285
  } else {
3998
- onChange(mapStrapiFileToAsset(uploadedList[0]));
3999
4286
  setModalOpen(false);
4287
+ emitSingleAsset(mapStrapiFileToAsset(uploadedList[0]));
4000
4288
  }
4001
4289
  }
4002
4290
  } catch {
@@ -5618,21 +5906,17 @@ const StrapiMediaPicker = ({
5618
5906
  if (multiple) {
5619
5907
  toggleFileSelection(file);
5620
5908
  } else {
5621
- onChange(mapStrapiFileToAsset(file));
5622
5909
  setModalOpen(false);
5910
+ emitSingleAsset(mapStrapiFileToAsset(file));
5623
5911
  }
5624
5912
  },
5625
5913
  onDoubleClick: () => {
5626
5914
  if (multiple) {
5627
5915
  const asset = mapStrapiFileToAsset(file);
5628
5916
  const listToCommit = selectedFiles.length > 0 ? selectedFiles.map((f) => mapStrapiFileToAsset(f)) : [asset];
5629
- if (onSelectMultiple) {
5630
- onSelectMultiple(listToCommit);
5631
- } else {
5632
- listToCommit.forEach((a) => onChange(a));
5633
- }
5634
5917
  setSelectedFiles([]);
5635
5918
  setModalOpen(false);
5919
+ void emitMultipleAssets(listToCommit);
5636
5920
  }
5637
5921
  },
5638
5922
  style: {
@@ -6033,19 +6317,15 @@ const StrapiMediaPicker = ({
6033
6317
  multiple,
6034
6318
  onClose: () => setNativeDialogOpen(false),
6035
6319
  onSelectAssets: (selectedAssets) => {
6320
+ setNativeDialogOpen(false);
6036
6321
  if (Array.isArray(selectedAssets) && selectedAssets.length > 0) {
6037
6322
  const mapped = selectedAssets.map((f) => mapStrapiFileToAsset(f));
6038
6323
  if (multiple) {
6039
- if (onSelectMultiple) {
6040
- onSelectMultiple(mapped);
6041
- } else {
6042
- mapped.forEach((asset) => onChange(asset));
6043
- }
6324
+ void emitMultipleAssets(mapped);
6044
6325
  } else {
6045
- onChange(mapped[0]);
6326
+ emitSingleAsset(mapped[0]);
6046
6327
  }
6047
6328
  }
6048
- setNativeDialogOpen(false);
6049
6329
  }
6050
6330
  }
6051
6331
  )
@@ -7051,20 +7331,38 @@ const SurveyAnalyticsView = ({
7051
7331
  const qs = new URLSearchParams();
7052
7332
  qs.set("format", format);
7053
7333
  qs.set("locale", uiLocale);
7334
+ if (format === "xlsx") {
7335
+ qs.set("encoding", "base64");
7336
+ }
7054
7337
  if (dateFrom) qs.set("from", dateFrom);
7055
7338
  if (dateTo) qs.set("to", dateTo);
7056
7339
  const url = `/content-input/surveys/${encodeURIComponent(
7057
7340
  surveySlugOrId
7058
7341
  )}/export?${qs.toString()}`;
7059
7342
  const res = await get(url);
7060
- const rawData = typeof res?.data === "string" ? res.data : JSON.stringify(res?.data || {}, null, 2);
7061
- const blob = new Blob([rawData], {
7062
- type: format === "csv" ? "text/csv;charset=utf-8;" : "application/json;charset=utf-8;"
7063
- });
7343
+ const payload = res?.data;
7344
+ let blob;
7345
+ let downloadName = `${surveySlugOrId}-responses.${format}`;
7346
+ if (format === "xlsx" && payload?.base64) {
7347
+ const binStr = window.atob(String(payload.base64));
7348
+ const bytes = new Uint8Array(binStr.length);
7349
+ for (let i = 0; i < binStr.length; i++) {
7350
+ bytes[i] = binStr.charCodeAt(i);
7351
+ }
7352
+ if (payload.filename) downloadName = String(payload.filename);
7353
+ blob = new Blob([bytes], {
7354
+ type: payload.contentType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
7355
+ });
7356
+ } else {
7357
+ const rawData = typeof payload === "string" ? payload : JSON.stringify(payload || {}, null, 2);
7358
+ blob = new Blob([rawData], {
7359
+ type: format === "csv" ? "text/csv;charset=utf-8;" : "application/json;charset=utf-8;"
7360
+ });
7361
+ }
7064
7362
  const dlUrl = URL.createObjectURL(blob);
7065
7363
  const a = document.createElement("a");
7066
7364
  a.href = dlUrl;
7067
- a.download = `${surveySlugOrId}-responses.${format}`;
7365
+ a.download = downloadName;
7068
7366
  document.body.appendChild(a);
7069
7367
  a.click();
7070
7368
  document.body.removeChild(a);
@@ -7215,9 +7513,9 @@ const SurveyAnalyticsView = ({
7215
7513
  {
7216
7514
  type: "button",
7217
7515
  disabled: exporting !== null,
7218
- onClick: () => handleExport("csv"),
7516
+ onClick: () => handleExport("xlsx"),
7219
7517
  style: {
7220
- padding: "6px 12px",
7518
+ padding: "6px 13px",
7221
7519
  fontSize: 11,
7222
7520
  fontWeight: 700,
7223
7521
  borderRadius: 6,
@@ -7230,8 +7528,33 @@ const SurveyAnalyticsView = ({
7230
7528
  gap: 5
7231
7529
  },
7232
7530
  children: [
7233
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 14, color: "#fff" }),
7234
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: exporting === "csv" ? "..." : tr ? "CSV İndir (Excel)" : "Export CSV (Excel)" })
7531
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "table_view", size: 14, color: "#fff" }),
7532
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: exporting === "xlsx" ? "..." : tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
7533
+ ]
7534
+ }
7535
+ ),
7536
+ /* @__PURE__ */ jsxRuntime.jsxs(
7537
+ "button",
7538
+ {
7539
+ type: "button",
7540
+ disabled: exporting !== null,
7541
+ onClick: () => handleExport("csv"),
7542
+ style: {
7543
+ padding: "6px 11px",
7544
+ fontSize: 11,
7545
+ fontWeight: 700,
7546
+ borderRadius: 6,
7547
+ border: "1px solid #10b981",
7548
+ background: "#ecfdf5",
7549
+ color: "#065f46",
7550
+ cursor: "pointer",
7551
+ display: "inline-flex",
7552
+ alignItems: "center",
7553
+ gap: 5
7554
+ },
7555
+ children: [
7556
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "download", size: 14, color: "#059669" }),
7557
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: exporting === "csv" ? "..." : "CSV" })
7235
7558
  ]
7236
7559
  }
7237
7560
  ),
@@ -7911,6 +8234,11 @@ const SurveyAnalyticsView = ({
7911
8234
  },
7912
8235
  children: qs.distribution.map((bucket, bIdx) => {
7913
8236
  const scoreVal = bucket.value ?? bucket.score ?? bIdx;
8237
+ const pointLabel = pickTextForLocale(
8238
+ bucket.labels ?? qs.scaleLabels?.[String(scoreVal)],
8239
+ uiLocale,
8240
+ ""
8241
+ );
7914
8242
  const barColor = qs.type === "nps" ? scoreVal >= 9 ? "#10b981" : scoreVal >= 7 ? "#f59e0b" : "#ef4444" : "#f59e0b";
7915
8243
  return /* @__PURE__ */ jsxRuntime.jsxs(
7916
8244
  "div",
@@ -7938,7 +8266,7 @@ const SurveyAnalyticsView = ({
7938
8266
  background: barColor,
7939
8267
  borderRadius: "5px 5px 0 0"
7940
8268
  },
7941
- title: `${scoreVal}: ${bucket.count} (${bucket.percentage}%)`
8269
+ title: `${scoreVal}${pointLabel ? ` (${pointLabel})` : ""}: ${bucket.count} (${bucket.percentage}%)`
7942
8270
  }
7943
8271
  ),
7944
8272
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -7951,6 +8279,23 @@ const SurveyAnalyticsView = ({
7951
8279
  },
7952
8280
  children: qs.type === "star_rating" ? `${scoreVal}★` : scoreVal
7953
8281
  }
8282
+ ),
8283
+ pointLabel && /* @__PURE__ */ jsxRuntime.jsx(
8284
+ "span",
8285
+ {
8286
+ title: pointLabel,
8287
+ style: {
8288
+ fontSize: 9.5,
8289
+ fontWeight: 600,
8290
+ color: "#475569",
8291
+ maxWidth: "100%",
8292
+ overflow: "hidden",
8293
+ textOverflow: "ellipsis",
8294
+ whiteSpace: "nowrap",
8295
+ textAlign: "center"
8296
+ },
8297
+ children: pointLabel
8298
+ }
7954
8299
  )
7955
8300
  ]
7956
8301
  },
@@ -8288,136 +8633,2479 @@ const SurveyAnalyticsView = ({
8288
8633
  }) })
8289
8634
  ] });
8290
8635
  };
8291
- const inputStyle = {
8292
- width: "100%",
8293
- padding: "6px 9px",
8294
- fontSize: 12,
8295
- border: "1px solid #cbd5e1",
8296
- borderRadius: 5,
8297
- background: "#fff",
8298
- color: "#1e293b"
8299
- };
8300
- const labelStyle = {
8301
- display: "block",
8302
- fontSize: 11,
8303
- fontWeight: 600,
8304
- color: "#475569",
8305
- marginBottom: 4
8306
- };
8307
- function slugifyKey(input) {
8308
- const map = {
8309
- ç: "c",
8310
- Ç: "c",
8311
- ğ: "g",
8312
- Ğ: "g",
8313
- ı: "i",
8314
- İ: "i",
8315
- ö: "o",
8316
- Ö: "o",
8317
- ş: "s",
8318
- Ş: "s",
8319
- ü: "u",
8320
- Ü: "u"
8321
- };
8322
- return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
8636
+ function isEmptyVal(val) {
8637
+ if (val === null || val === void 0) return true;
8638
+ if (typeof val === "string") return val.trim() === "";
8639
+ if (Array.isArray(val)) return val.length === 0;
8640
+ if (typeof val === "object") return Object.keys(val).length === 0;
8641
+ return false;
8323
8642
  }
8324
- const QUESTION_TYPES_CATALOG = [
8325
- { type: "single_choice", labelTr: "Tekli Seçim (Radio)", labelEn: "Single Choice", hasOptions: true },
8326
- { type: "multiple_choice", labelTr: "Çoklu Seçim (Checkbox)", labelEn: "Multiple Choice", hasOptions: true },
8327
- { type: "dropdown", labelTr: "Açılır Liste (Dropdown)", labelEn: "Dropdown", hasOptions: true },
8328
- { type: "image_choice", labelTr: "Görsel Kart Seçimi", labelEn: "Image Choice", hasOptions: true },
8329
- { type: "nps", labelTr: "NPS Ölçeği (0–10)", labelEn: "NPS Score (0–10)" },
8330
- { type: "star_rating", labelTr: "Yıldız Derece (1–5)", labelEn: "Star Rating" },
8331
- { type: "likert_scale", labelTr: "Likert Ölçeği (1–5 / 1–7)", labelEn: "Likert Scale" },
8332
- { type: "matrix_single", labelTr: "Matris Değerlendirme Tablosu", labelEn: "Matrix Grid" },
8333
- { type: "ranking", labelTr: "Sürükle-Bırak Öncelik Sıralama", labelEn: "Drag Ranking", hasOptions: true },
8334
- { type: "short_text", labelTr: "Kısa Metin Yanıtı", labelEn: "Short Text" },
8335
- { type: "long_text", labelTr: "Açık Uçlu Uzun Yorum", labelEn: "Open-Ended Long Text" },
8336
- { type: "consent", labelTr: "KVKK / Gizlilik Onayı", labelEn: "Consent Switch" },
8337
- { type: "statement", labelTr: "Bilgi / Açıklama Metni", labelEn: "Info Statement" }
8338
- ];
8339
- function createBlankSurveyDraft(locale = "en") {
8340
- const tr = locale === "tr";
8341
- const ts = Date.now().toString(36).slice(-4);
8342
- return {
8343
- title: tr ? "Yeni Müşteri Geri Bildirim Anketi" : "New Customer Feedback Survey",
8344
- titleI18n: {
8345
- en: "New Customer Feedback Survey",
8346
- tr: "Yeni Müşteri Geri Bildirim Anketi"
8347
- },
8348
- slug: `survey_${ts}`,
8349
- description: {
8350
- tr: "Görüşleriniz hizmet kalitemizi geliştirmemize yardımcı olur.",
8351
- en: "Your feedback helps us improve our service quality."
8352
- },
8353
- status: "published",
8354
- displayMode: "single_page",
8355
- submissionPolicy: "one_per_voter",
8356
- anonymizeIp: true,
8357
- showPublicResults: "after_vote",
8358
- allowBackNavigation: true,
8359
- showProgressBar: true,
8360
- useRecaptcha: false,
8361
- steps: [
8362
- {
8363
- id: "step_1",
8364
- title: { tr: "1. Bölüm", en: "Step 1" }
8365
- }
8366
- ],
8367
- questions: [
8368
- {
8369
- key: "nps_score",
8370
- stepId: "step_1",
8371
- type: "nps",
8372
- required: true,
8373
- title: {
8374
- tr: "Bizi çevrenize önerme olasılığınız nedir?",
8375
- en: "How likely are you to recommend us?"
8376
- },
8377
- lowLabel: { tr: "0 — Hiç Olası Değil", en: "0 — Not likely" },
8378
- highLabel: { tr: "10 — Kesinlikle Öneririm", en: "10 — Extremely likely" }
8379
- },
8380
- {
8381
- key: "favorite_aspect",
8382
- stepId: "step_1",
8383
- type: "single_choice",
8384
- required: true,
8385
- allowOther: true,
8386
- title: {
8387
- tr: "En beğendiğiniz yönümüz hangisi?",
8388
- en: "Which aspect do you value the most?"
8389
- },
8390
- options: [
8391
- { id: "speed", labels: { tr: "Hız ve Performans", en: "Speed & Performance" } },
8392
- { id: "ease_of_use", labels: { tr: "Kullanım Kolaylığı", en: "Ease of Use" } },
8393
- { id: "support", labels: { tr: "Teknik Destek", en: "Technical Support" } }
8394
- ]
8395
- }
8396
- ],
8397
- settings: {
8398
- submitLabel: { tr: "Anketi Gönder", en: "Submit Survey" },
8399
- thankYouTitle: { tr: "Teşekkür Ederiz!", en: "Thank You!" },
8400
- thankYouMessage: {
8401
- tr: "Yanıtlarınız başarıyla kaydedildi.",
8402
- en: "Your response has been recorded."
8403
- }
8643
+ function evalSingleRule(rule, answers) {
8644
+ const targetVal = answers ? answers[rule.questionKey] : void 0;
8645
+ const op = String(rule.operator || "equals");
8646
+ if (op === "is_answered") return !isEmptyVal(targetVal);
8647
+ if (op === "is_empty") return isEmptyVal(targetVal);
8648
+ const cmp = rule.value;
8649
+ if (op === "equals") {
8650
+ if (Array.isArray(targetVal)) return targetVal.map(String).includes(String(cmp));
8651
+ return String(targetVal ?? "") === String(cmp ?? "");
8652
+ }
8653
+ if (op === "not_equals") {
8654
+ if (Array.isArray(targetVal)) return !targetVal.map(String).includes(String(cmp));
8655
+ return String(targetVal ?? "") !== String(cmp ?? "");
8656
+ }
8657
+ if (op === "includes" || op === "contains" || op === "in") {
8658
+ if (op === "in") {
8659
+ const allowed = String(cmp ?? "").split(",").map((s) => s.trim()).filter(Boolean);
8660
+ return allowed.includes(String(targetVal ?? ""));
8404
8661
  }
8405
- };
8662
+ if (Array.isArray(targetVal)) return targetVal.map(String).includes(String(cmp));
8663
+ return String(targetVal ?? "").includes(String(cmp ?? ""));
8664
+ }
8665
+ if (op === "not_includes") {
8666
+ if (Array.isArray(targetVal)) return !targetVal.map(String).includes(String(cmp));
8667
+ return !String(targetVal ?? "").includes(String(cmp ?? ""));
8668
+ }
8669
+ const numTarget = Number(targetVal);
8670
+ const numCmp = Number(cmp);
8671
+ if (isEmptyVal(targetVal) || Number.isNaN(numTarget) || Number.isNaN(numCmp)) {
8672
+ return false;
8673
+ }
8674
+ if (op === "gt") return numTarget > numCmp;
8675
+ if (op === "gte") return numTarget >= numCmp;
8676
+ if (op === "lt") return numTarget < numCmp;
8677
+ if (op === "lte") return numTarget <= numCmp;
8678
+ return true;
8406
8679
  }
8407
- function buildQuestionFromType(type, stepId, existingKeys = []) {
8408
- let idx = existingKeys.length + 1;
8409
- let key = `q_${type}_${idx}`;
8410
- while (existingKeys.includes(key)) {
8411
- idx += 1;
8412
- key = `q_${type}_${idx}`;
8680
+ function evaluateConditions(conditions, answers) {
8681
+ if (!conditions || !Array.isArray(conditions.rules) || conditions.rules.length === 0) {
8682
+ return true;
8413
8683
  }
8414
- const base = {
8415
- key,
8416
- stepId,
8417
- type,
8418
- required: type !== "statement" && type !== "long_text",
8419
- title: {
8420
- tr: `Yeni Soru (${type})`,
8684
+ if (conditions.match === "any") {
8685
+ return conditions.rules.some((r) => evalSingleRule(r, answers));
8686
+ }
8687
+ return conditions.rules.every((r) => evalSingleRule(r, answers));
8688
+ }
8689
+ function isQuestionVisibleInDraft(q, draft, answers) {
8690
+ if (draft.displayMode === "multi_step" && q.stepId && Array.isArray(draft.steps)) {
8691
+ const parentStep = draft.steps.find((s) => s.id === q.stepId);
8692
+ if (parentStep?.conditions && !evaluateConditions(parentStep.conditions, answers)) {
8693
+ return false;
8694
+ }
8695
+ }
8696
+ return evaluateConditions(q.conditions, answers);
8697
+ }
8698
+ function validateTextRules(val, validationStr, label, tr) {
8699
+ const errs = [];
8700
+ const str = String(val ?? "");
8701
+ const trimmed = str.trim();
8702
+ const rules = validationStr.split("|").map((r) => r.trim()).filter(Boolean);
8703
+ for (const rawRule of rules) {
8704
+ const colonIdx = rawRule.indexOf(":");
8705
+ const ruleName = (colonIdx >= 0 ? rawRule.slice(0, colonIdx) : rawRule).toLowerCase();
8706
+ const param = colonIdx >= 0 ? rawRule.slice(colonIdx + 1) : "";
8707
+ if (ruleName === "required") {
8708
+ if (!trimmed) {
8709
+ errs.push(tr ? `${label} alanı zorunludur.` : `${label} is required.`);
8710
+ }
8711
+ continue;
8712
+ }
8713
+ if (!trimmed) continue;
8714
+ if (ruleName === "email") {
8715
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmed)) {
8716
+ errs.push(tr ? "Geçerli bir e-posta adresi giriniz." : "Please enter a valid email address.");
8717
+ }
8718
+ } else if (ruleName === "phone") {
8719
+ const digits = trimmed.replace(/\D/g, "");
8720
+ if (digits.length < 7 || !/^[+\d\s().-]+$/.test(trimmed)) {
8721
+ errs.push(tr ? "Geçerli bir telefon numarası giriniz." : "Please enter a valid phone number.");
8722
+ }
8723
+ } else if (ruleName === "url") {
8724
+ if (!/^https?:\/\/.+/i.test(trimmed)) {
8725
+ errs.push(tr ? "Geçerli bir URL (http/https) giriniz." : "Please enter a valid http/https URL.");
8726
+ }
8727
+ } else if (ruleName === "numeric") {
8728
+ if (Number.isNaN(Number(trimmed))) {
8729
+ errs.push(tr ? "Sayısal bir değer giriniz." : "Please enter a numeric value.");
8730
+ }
8731
+ } else if (ruleName === "integer") {
8732
+ if (!/^-?\d+$/.test(trimmed)) {
8733
+ errs.push(tr ? "Tam sayı giriniz." : "Please enter a whole integer.");
8734
+ }
8735
+ } else if (ruleName === "min") {
8736
+ const n = Number(param);
8737
+ if (!Number.isNaN(n) && trimmed.length < n) {
8738
+ errs.push(
8739
+ tr ? `En az ${n} karakter girmelisiniz.` : `Must be at least ${n} characters.`
8740
+ );
8741
+ }
8742
+ } else if (ruleName === "max") {
8743
+ const n = Number(param);
8744
+ if (!Number.isNaN(n) && trimmed.length > n) {
8745
+ errs.push(
8746
+ tr ? `En fazla ${n} karakter girebilirsiniz.` : `May not exceed ${n} characters.`
8747
+ );
8748
+ }
8749
+ } else if (ruleName === "min_value") {
8750
+ const n = Number(param);
8751
+ if (!Number.isNaN(n) && Number(trimmed) < n) {
8752
+ errs.push(tr ? `Değer en az ${n} olmalıdır.` : `Minimum value is ${n}.`);
8753
+ }
8754
+ } else if (ruleName === "max_value") {
8755
+ const n = Number(param);
8756
+ if (!Number.isNaN(n) && Number(trimmed) > n) {
8757
+ errs.push(tr ? `Değer en fazla ${n} olabilir.` : `Maximum value is ${n}.`);
8758
+ }
8759
+ } else if (ruleName === "between") {
8760
+ const [minS, maxS] = param.split(",");
8761
+ const minN = Number(minS);
8762
+ const maxN = Number(maxS);
8763
+ const numV = Number(trimmed);
8764
+ if (!Number.isNaN(minN) && !Number.isNaN(maxN)) {
8765
+ if (!Number.isNaN(numV)) {
8766
+ if (numV < minN || numV > maxN) {
8767
+ errs.push(
8768
+ tr ? `Değer ${minN} ile ${maxN} arasında olmalıdır.` : `Value must be between ${minN} and ${maxN}.`
8769
+ );
8770
+ }
8771
+ } else if (trimmed.length < minN || trimmed.length > maxN) {
8772
+ errs.push(
8773
+ tr ? `Uzunluk ${minN} ile ${maxN} karakter arasında olmalıdır.` : `Length must be between ${minN} and ${maxN} characters.`
8774
+ );
8775
+ }
8776
+ }
8777
+ } else if (ruleName === "regex" && param) {
8778
+ try {
8779
+ const re = new RegExp(param);
8780
+ if (!re.test(trimmed)) {
8781
+ errs.push(tr ? `${label} formatı geçersiz.` : `${label} format is invalid.`);
8782
+ }
8783
+ } catch {
8784
+ }
8785
+ }
8786
+ }
8787
+ return errs;
8788
+ }
8789
+ function buildInitialAnswers(draft) {
8790
+ const init = {};
8791
+ for (const q of draft.questions || []) {
8792
+ if (!q || !q.key || q.type === "statement") continue;
8793
+ if (q.type === "multiple_choice" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1) {
8794
+ init[q.key] = [];
8795
+ } else if (q.type === "ranking") {
8796
+ init[q.key] = Array.isArray(q.options) ? q.options.map((o) => o.id) : [];
8797
+ } else if (q.type === "matrix_single") {
8798
+ init[q.key] = {};
8799
+ } else if (q.type === "consent") {
8800
+ init[q.key] = false;
8801
+ } else if (q.type === "short_text" || q.type === "long_text") {
8802
+ init[q.key] = "";
8803
+ } else {
8804
+ init[q.key] = null;
8805
+ }
8806
+ }
8807
+ return init;
8808
+ }
8809
+ function shuffleCopy(items, seed) {
8810
+ const arr = [...items];
8811
+ let s = seed + 1;
8812
+ for (let i = arr.length - 1; i > 0; i--) {
8813
+ s = s * 16807 % 2147483647;
8814
+ const j = s % (i + 1);
8815
+ [arr[i], arr[j]] = [arr[j], arr[i]];
8816
+ }
8817
+ return arr;
8818
+ }
8819
+ const SurveyLivePreviewPane = ({
8820
+ draft,
8821
+ uiLocale,
8822
+ strapiLocales
8823
+ }) => {
8824
+ const [testLocale, setTestLocale] = React.useState(uiLocale || "en");
8825
+ const [device, setDevice] = React.useState("desktop");
8826
+ const [showInspector, setShowInspector] = React.useState(true);
8827
+ const [shuffleSeed, setShuffleSeed] = React.useState(1);
8828
+ const [answers, setAnswers] = React.useState(() => buildInitialAnswers(draft));
8829
+ const [otherTexts, setOtherTexts] = React.useState({});
8830
+ const [errors, setErrors] = React.useState({});
8831
+ const [generalError, setGeneralError] = React.useState("");
8832
+ const [currentStepIdx, setCurrentStepIdx] = React.useState(0);
8833
+ const [submitted, setSubmitted] = React.useState(false);
8834
+ const [peekResults, setPeekResults] = React.useState(false);
8835
+ const [mockCaptchaChecked, setMockCaptchaChecked] = React.useState(false);
8836
+ const [hoverStar, setHoverStar] = React.useState({});
8837
+ const [elapsedMs, setElapsedMs] = React.useState(0);
8838
+ const startTimeRef = React.useRef(Date.now());
8839
+ const rankDragRef = React.useRef(null);
8840
+ const trUi = String(uiLocale || "en").toLowerCase().startsWith("tr");
8841
+ const trTest = String(testLocale || "en").toLowerCase().startsWith("tr");
8842
+ React.useEffect(() => {
8843
+ setAnswers((prev) => {
8844
+ const defaults = buildInitialAnswers(draft);
8845
+ const merged = { ...defaults };
8846
+ for (const [k, v] of Object.entries(prev)) {
8847
+ if (k in defaults) {
8848
+ if (Array.isArray(defaults[k]) && Array.isArray(v)) {
8849
+ const qDef = (draft.questions || []).find((q) => q.key === k);
8850
+ if (qDef?.type === "ranking" && Array.isArray(qDef.options)) {
8851
+ const validIds = new Set(qDef.options.map((o) => o.id));
8852
+ const kept = v.filter((id) => validIds.has(id));
8853
+ const added = qDef.options.map((o) => o.id).filter((id) => !kept.includes(id));
8854
+ merged[k] = [...kept, ...added];
8855
+ } else {
8856
+ merged[k] = v;
8857
+ }
8858
+ } else {
8859
+ merged[k] = v;
8860
+ }
8861
+ }
8862
+ }
8863
+ return merged;
8864
+ });
8865
+ }, [draft]);
8866
+ const resetFlow = () => {
8867
+ setAnswers(buildInitialAnswers(draft));
8868
+ setOtherTexts({});
8869
+ setErrors({});
8870
+ setGeneralError("");
8871
+ setCurrentStepIdx(0);
8872
+ setSubmitted(false);
8873
+ setPeekResults(false);
8874
+ setMockCaptchaChecked(false);
8875
+ setShuffleSeed((s) => s + 1);
8876
+ startTimeRef.current = Date.now();
8877
+ setElapsedMs(0);
8878
+ };
8879
+ const isQuickPoll = draft.displayMode === "quick_poll";
8880
+ const isMultiStep = draft.displayMode === "multi_step";
8881
+ const visibleSteps = React.useMemo(() => {
8882
+ const rawSteps = Array.isArray(draft.steps) ? draft.steps : [];
8883
+ if (!isMultiStep || rawSteps.length === 0) {
8884
+ return [{ id: "__default__", title: draft.titleI18n || draft.title || "" }];
8885
+ }
8886
+ const filtered = rawSteps.filter((s) => evaluateConditions(s.conditions, answers));
8887
+ return filtered.length > 0 ? filtered : [rawSteps[0]];
8888
+ }, [draft.steps, draft.titleI18n, draft.title, isMultiStep, answers]);
8889
+ const safeStepIdx = Math.min(currentStepIdx, Math.max(0, visibleSteps.length - 1));
8890
+ const activeStep = visibleSteps[safeStepIdx];
8891
+ const activeQuestions = React.useMemo(() => {
8892
+ const all = Array.isArray(draft.questions) ? draft.questions : [];
8893
+ if (!isMultiStep || !activeStep || activeStep.id === "__default__") {
8894
+ return all.filter((q) => isQuestionVisibleInDraft(q, draft, answers));
8895
+ }
8896
+ const knownStepIds = new Set((draft.steps || []).map((s) => s.id));
8897
+ const isFirst = safeStepIdx === 0;
8898
+ return all.filter((q) => {
8899
+ const belongs = q.stepId === activeStep.id || isFirst && (!q.stepId || !knownStepIds.has(q.stepId));
8900
+ return belongs && isQuestionVisibleInDraft(q, draft, answers);
8901
+ });
8902
+ }, [draft, isMultiStep, activeStep, safeStepIdx, answers]);
8903
+ const stepProgressPct = React.useMemo(() => {
8904
+ if (visibleSteps.length <= 1) return 100;
8905
+ return Math.round((safeStepIdx + 1) / visibleSteps.length * 100);
8906
+ }, [safeStepIdx, visibleSteps.length]);
8907
+ const setAnswer = (key, value) => {
8908
+ setAnswers((prev) => ({ ...prev, [key]: value }));
8909
+ if (errors[key]) {
8910
+ setErrors((prev) => {
8911
+ const next = { ...prev };
8912
+ delete next[key];
8913
+ return next;
8914
+ });
8915
+ }
8916
+ if (generalError) setGeneralError("");
8917
+ };
8918
+ const validateTargetQuestions = (qs) => {
8919
+ const nextErrs = {};
8920
+ for (const q of qs) {
8921
+ if (!q || !q.key || q.type === "statement") continue;
8922
+ if (!isQuestionVisibleInDraft(q, draft, answers)) continue;
8923
+ const val = answers[q.key];
8924
+ const empty = isEmptyVal(val);
8925
+ const qLabel = pickTextForLocale(q.title, testLocale, q.key);
8926
+ const qErrs = [];
8927
+ if (q.type === "consent") {
8928
+ if (q.required !== false && val !== true) {
8929
+ qErrs.push(trTest ? `${qLabel} onaylanmalıdır.` : `${qLabel} must be accepted.`);
8930
+ }
8931
+ } else if (q.type === "matrix_single") {
8932
+ const mRows = Array.isArray(q.matrixRows) ? q.matrixRows : [];
8933
+ if (q.required) {
8934
+ const objVal = val && typeof val === "object" && !Array.isArray(val) ? val : {};
8935
+ const missing = mRows.some((r) => isEmptyVal(objVal[r.id]));
8936
+ if (missing) {
8937
+ qErrs.push(
8938
+ trTest ? `Lütfen "${qLabel}" tablosundaki tüm satırları yanıtlayınız.` : `Please answer all rows in "${qLabel}".`
8939
+ );
8940
+ }
8941
+ }
8942
+ } else if (q.type === "multiple_choice" || q.type === "image_choice" && (q.maxSelections ?? 1) > 1) {
8943
+ const arr = Array.isArray(val) ? val : [];
8944
+ if (q.required && arr.length === 0) {
8945
+ qErrs.push(
8946
+ trTest ? "Lütfen en az bir seçenek işaretleyiniz." : "Please select at least one option."
8947
+ );
8948
+ } else if (arr.length > 0) {
8949
+ if (q.minSelections && arr.length < q.minSelections) {
8950
+ qErrs.push(
8951
+ trTest ? `En az ${q.minSelections} seçenek işaretlemelisiniz.` : `Please select at least ${q.minSelections} options.`
8952
+ );
8953
+ }
8954
+ if (q.maxSelections && arr.length > q.maxSelections) {
8955
+ qErrs.push(
8956
+ trTest ? `En fazla ${q.maxSelections} seçenek işaretleyebilirsiniz.` : `You may select at most ${q.maxSelections} options.`
8957
+ );
8958
+ }
8959
+ }
8960
+ if (q.allowOther && arr.includes("__other__") && !String(otherTexts[q.key] || "").trim()) {
8961
+ qErrs.push(
8962
+ trTest ? 'Lütfen "Diğer" seçeneği için açıklama giriniz.' : 'Please specify your "Other" choice.'
8963
+ );
8964
+ }
8965
+ } else if (q.type === "single_choice" || q.type === "dropdown" || q.type === "image_choice") {
8966
+ if (q.required && empty) {
8967
+ qErrs.push(trTest ? "Lütfen bir seçim yapınız." : "Please choose an option.");
8968
+ }
8969
+ if (q.allowOther && val === "__other__" && !String(otherTexts[q.key] || "").trim()) {
8970
+ qErrs.push(
8971
+ trTest ? 'Lütfen "Diğer" seçeneği için açıklama giriniz.' : 'Please specify your "Other" choice.'
8972
+ );
8973
+ }
8974
+ } else if (q.type === "nps") {
8975
+ if (q.required && empty) {
8976
+ qErrs.push(
8977
+ trTest ? "Lütfen 0 ile 10 arasında bir puan seçiniz." : "Please choose a score from 0 to 10."
8978
+ );
8979
+ }
8980
+ } else if (q.type === "star_rating") {
8981
+ if (q.required && empty) {
8982
+ qErrs.push(trTest ? "Lütfen derecelendirme yapınız." : "Please provide a rating.");
8983
+ }
8984
+ } else if (q.type === "likert_scale") {
8985
+ if (q.required && empty) {
8986
+ qErrs.push(
8987
+ trTest ? "Lütfen ölçekten bir değer seçiniz." : "Please select a value on the scale."
8988
+ );
8989
+ }
8990
+ } else if (q.type === "ranking") {
8991
+ if (q.required && (!Array.isArray(val) || val.length === 0)) {
8992
+ qErrs.push(trTest ? "Lütfen sıralamayı tamamlayınız." : "Please rank the options.");
8993
+ }
8994
+ } else if (q.type === "short_text" || q.type === "long_text") {
8995
+ const parts = [];
8996
+ if (q.required) parts.push("required");
8997
+ if (q.validation) parts.push(q.validation);
8998
+ if (parts.length > 0) {
8999
+ qErrs.push(...validateTextRules(val, parts.join("|"), qLabel, trTest));
9000
+ }
9001
+ }
9002
+ if (qErrs.length > 0) {
9003
+ nextErrs[q.key] = qErrs;
9004
+ }
9005
+ }
9006
+ setErrors(nextErrs);
9007
+ if (Object.keys(nextErrs).length > 0) {
9008
+ setGeneralError(
9009
+ trTest ? "Lütfen devam etmeden önce işaretli alanları kontrol ediniz." : "Please check the highlighted fields before continuing."
9010
+ );
9011
+ return false;
9012
+ }
9013
+ setGeneralError("");
9014
+ return true;
9015
+ };
9016
+ const isLastStep = !isMultiStep || safeStepIdx >= visibleSteps.length - 1;
9017
+ const handleNextOrSubmit = (e) => {
9018
+ e.preventDefault();
9019
+ if (!validateTargetQuestions(activeQuestions)) return;
9020
+ if (!isLastStep) {
9021
+ setCurrentStepIdx(safeStepIdx + 1);
9022
+ return;
9023
+ }
9024
+ const allVisible = (draft.questions || []).filter(
9025
+ (q) => isQuestionVisibleInDraft(q, draft, answers)
9026
+ );
9027
+ if (!validateTargetQuestions(allVisible)) return;
9028
+ if (draft.useRecaptcha && !mockCaptchaChecked) {
9029
+ setGeneralError(
9030
+ trTest ? "Lütfen reCAPTCHA doğrulama kutusunu işaretleyiniz." : "Please check the reCAPTCHA verification box."
9031
+ );
9032
+ return;
9033
+ }
9034
+ setElapsedMs(Date.now() - startTimeRef.current);
9035
+ setSubmitted(true);
9036
+ };
9037
+ const getRenderedOptions = (q) => {
9038
+ const opts = Array.isArray(q.options) ? q.options : [];
9039
+ if (!q.shuffleOptions) return opts;
9040
+ const keyNum = q.key.split("").reduce((acc, ch) => acc + ch.charCodeAt(0), 0);
9041
+ return shuffleCopy(opts, shuffleSeed + keyNum);
9042
+ };
9043
+ const moveRankOption = (qKey, fromIdx, toIdx) => {
9044
+ const cur = Array.isArray(answers[qKey]) ? [...answers[qKey]] : [];
9045
+ if (toIdx < 0 || toIdx >= cur.length || fromIdx === toIdx) return;
9046
+ const [moved] = cur.splice(fromIdx, 1);
9047
+ cur.splice(toIdx, 0, moved);
9048
+ setAnswer(qKey, cur);
9049
+ };
9050
+ const frameMaxWidth = device === "mobile" ? 390 : device === "tablet" ? 720 : 900;
9051
+ const resolvedSurveyTitle = pickTextForLocale(draft.titleI18n, testLocale, draft.title || "");
9052
+ const resolvedSurveyDesc = pickTextForLocale(draft.description, testLocale, "");
9053
+ const submitBtnText = pickTextForLocale(
9054
+ draft.settings?.submitLabel,
9055
+ testLocale,
9056
+ trTest ? "Anketi Gönder" : "Submit Survey"
9057
+ );
9058
+ const thankYouTitle = pickTextForLocale(
9059
+ draft.settings?.thankYouTitle,
9060
+ testLocale,
9061
+ trTest ? "Teşekkür Ederiz!" : "Thank You!"
9062
+ );
9063
+ const thankYouMessage = pickTextForLocale(
9064
+ draft.settings?.thankYouMessage,
9065
+ testLocale,
9066
+ trTest ? "Yanıtlarınız başarıyla kaydedildi." : "Your response has been recorded."
9067
+ );
9068
+ const visibleCount = (draft.questions || []).filter(
9069
+ (q) => isQuestionVisibleInDraft(q, draft, answers)
9070
+ ).length;
9071
+ const hiddenCount = Math.max(0, (draft.questions || []).length - visibleCount);
9072
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9073
+ "div",
9074
+ {
9075
+ style: {
9076
+ flex: 1,
9077
+ display: "flex",
9078
+ flexDirection: "column",
9079
+ overflow: "hidden",
9080
+ background: "#e2e8f0"
9081
+ },
9082
+ children: [
9083
+ /* @__PURE__ */ jsxRuntime.jsxs(
9084
+ "div",
9085
+ {
9086
+ style: {
9087
+ background: "#ffffff",
9088
+ borderBottom: "1px solid #cbd5e1",
9089
+ padding: "10px 18px",
9090
+ display: "flex",
9091
+ alignItems: "center",
9092
+ justifyContent: "space-between",
9093
+ flexWrap: "wrap",
9094
+ gap: 10
9095
+ },
9096
+ children: [
9097
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" }, children: [
9098
+ /* @__PURE__ */ jsxRuntime.jsxs(
9099
+ "span",
9100
+ {
9101
+ style: {
9102
+ display: "inline-flex",
9103
+ alignItems: "center",
9104
+ gap: 6,
9105
+ padding: "4px 10px",
9106
+ borderRadius: 20,
9107
+ background: "#ecfdf5",
9108
+ border: "1px solid #a7f3d0",
9109
+ color: "#065f46",
9110
+ fontSize: 11,
9111
+ fontWeight: 700
9112
+ },
9113
+ children: [
9114
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "science", size: 14, color: "#059669" }),
9115
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trUi ? "Canlı Akış Simülatörü (Gerçek DB verisini etkilemez)" : "Live Flow Simulator (Does not write to live DB)" })
9116
+ ]
9117
+ }
9118
+ ),
9119
+ /* @__PURE__ */ jsxRuntime.jsx(
9120
+ "div",
9121
+ {
9122
+ style: {
9123
+ display: "inline-flex",
9124
+ borderRadius: 7,
9125
+ overflow: "hidden",
9126
+ border: "1px solid #cbd5e1",
9127
+ background: "#f8fafc"
9128
+ },
9129
+ children: [
9130
+ { id: "desktop", icon: "desktop_windows", label: trUi ? "Masaüstü" : "Desktop" },
9131
+ { id: "tablet", icon: "tablet_mac", label: "Tablet" },
9132
+ { id: "mobile", icon: "smartphone", label: trUi ? "Mobil" : "Mobile" }
9133
+ ].map((vp) => {
9134
+ const active = device === vp.id;
9135
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9136
+ "button",
9137
+ {
9138
+ type: "button",
9139
+ onClick: () => setDevice(vp.id),
9140
+ style: {
9141
+ padding: "5px 10px",
9142
+ border: "none",
9143
+ background: active ? "#1e3a8a" : "transparent",
9144
+ color: active ? "#ffffff" : "#475569",
9145
+ fontSize: 11,
9146
+ fontWeight: 700,
9147
+ cursor: "pointer",
9148
+ display: "inline-flex",
9149
+ alignItems: "center",
9150
+ gap: 5
9151
+ },
9152
+ children: [
9153
+ /* @__PURE__ */ jsxRuntime.jsx(
9154
+ index.MaterialIcon,
9155
+ {
9156
+ name: vp.icon,
9157
+ size: 14,
9158
+ color: active ? "#ffffff" : "#64748b"
9159
+ }
9160
+ ),
9161
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: vp.label })
9162
+ ]
9163
+ },
9164
+ vp.id
9165
+ );
9166
+ })
9167
+ }
9168
+ ),
9169
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "inline-flex", alignItems: "center", gap: 5 }, children: [
9170
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 11, fontWeight: 700, color: "#475569" }, children: trUi ? "Test Dili:" : "Test Locale:" }),
9171
+ /* @__PURE__ */ jsxRuntime.jsx(
9172
+ "div",
9173
+ {
9174
+ style: {
9175
+ display: "inline-flex",
9176
+ borderRadius: 6,
9177
+ overflow: "hidden",
9178
+ border: "1px solid #cbd5e1"
9179
+ },
9180
+ children: strapiLocales.map((loc) => {
9181
+ const active = testLocale === loc.code;
9182
+ return /* @__PURE__ */ jsxRuntime.jsx(
9183
+ "button",
9184
+ {
9185
+ type: "button",
9186
+ onClick: () => setTestLocale(loc.code),
9187
+ style: {
9188
+ padding: "4px 9px",
9189
+ border: "none",
9190
+ background: active ? "#2563eb" : "#ffffff",
9191
+ color: active ? "#ffffff" : "#334155",
9192
+ fontSize: 10.5,
9193
+ fontWeight: 800,
9194
+ cursor: "pointer"
9195
+ },
9196
+ children: loc.code.toUpperCase()
9197
+ },
9198
+ loc.code
9199
+ );
9200
+ })
9201
+ }
9202
+ )
9203
+ ] })
9204
+ ] }),
9205
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
9206
+ /* @__PURE__ */ jsxRuntime.jsxs(
9207
+ "button",
9208
+ {
9209
+ type: "button",
9210
+ onClick: resetFlow,
9211
+ style: {
9212
+ padding: "6px 12px",
9213
+ borderRadius: 6,
9214
+ border: "1px solid #cbd5e1",
9215
+ background: "#ffffff",
9216
+ color: "#0f172a",
9217
+ fontSize: 11.5,
9218
+ fontWeight: 700,
9219
+ cursor: "pointer",
9220
+ display: "inline-flex",
9221
+ alignItems: "center",
9222
+ gap: 5
9223
+ },
9224
+ children: [
9225
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "refresh", size: 15, color: "#2563eb" }),
9226
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trUi ? "Akışı Baştan Başlat" : "Reset Flow" })
9227
+ ]
9228
+ }
9229
+ ),
9230
+ /* @__PURE__ */ jsxRuntime.jsxs(
9231
+ "button",
9232
+ {
9233
+ type: "button",
9234
+ onClick: () => setShowInspector((v) => !v),
9235
+ style: {
9236
+ padding: "6px 12px",
9237
+ borderRadius: 6,
9238
+ border: showInspector ? "1px solid #2563eb" : "1px solid #cbd5e1",
9239
+ background: showInspector ? "#eff6ff" : "#ffffff",
9240
+ color: showInspector ? "#1d4ed8" : "#475569",
9241
+ fontSize: 11.5,
9242
+ fontWeight: 700,
9243
+ cursor: "pointer",
9244
+ display: "inline-flex",
9245
+ alignItems: "center",
9246
+ gap: 5
9247
+ },
9248
+ children: [
9249
+ /* @__PURE__ */ jsxRuntime.jsx(
9250
+ index.MaterialIcon,
9251
+ {
9252
+ name: "account_tree",
9253
+ size: 15,
9254
+ color: showInspector ? "#2563eb" : "#64748b"
9255
+ }
9256
+ ),
9257
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
9258
+ trUi ? "Koşul & Yanıt Müfettişi" : "Logic & Payload Inspector",
9259
+ hiddenCount > 0 ? ` (${hiddenCount} ${trUi ? "gizli" : "hidden"})` : ""
9260
+ ] })
9261
+ ]
9262
+ }
9263
+ )
9264
+ ] })
9265
+ ]
9266
+ }
9267
+ ),
9268
+ /* @__PURE__ */ jsxRuntime.jsxs(
9269
+ "div",
9270
+ {
9271
+ style: {
9272
+ flex: 1,
9273
+ display: "grid",
9274
+ gridTemplateColumns: showInspector ? "minmax(0, 1fr) 330px" : "minmax(0, 1fr)",
9275
+ overflow: "hidden"
9276
+ },
9277
+ children: [
9278
+ /* @__PURE__ */ jsxRuntime.jsxs(
9279
+ "div",
9280
+ {
9281
+ style: {
9282
+ overflowY: "auto",
9283
+ padding: device === "mobile" ? "20px 12px 40px" : "28px 24px 48px",
9284
+ display: "flex",
9285
+ flexDirection: "column",
9286
+ alignItems: "center"
9287
+ },
9288
+ children: [
9289
+ draft.status && draft.status !== "published" && /* @__PURE__ */ jsxRuntime.jsxs(
9290
+ "div",
9291
+ {
9292
+ style: {
9293
+ width: "100%",
9294
+ maxWidth: frameMaxWidth,
9295
+ marginBottom: 12,
9296
+ padding: "8px 14px",
9297
+ borderRadius: 10,
9298
+ background: "#fef3c7",
9299
+ border: "1px solid #fcd34d",
9300
+ color: "#92400e",
9301
+ fontSize: 11.5,
9302
+ fontWeight: 600,
9303
+ display: "flex",
9304
+ alignItems: "center",
9305
+ gap: 8
9306
+ },
9307
+ children: [
9308
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "info", size: 16, color: "#d97706" }),
9309
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trUi ? `Bilgi: Anket durumu şu an "${draft.status.toUpperCase()}" olarak seçili (vitrinde kapalı görünür), ancak önizleme modunda tüm soru akışını test edebilirsiniz.` : `Note: Survey status is currently "${draft.status.toUpperCase()}" (closed on storefront), but full interactive testing is unlocked here.` })
9310
+ ]
9311
+ }
9312
+ ),
9313
+ /* @__PURE__ */ jsxRuntime.jsxs(
9314
+ "div",
9315
+ {
9316
+ style: {
9317
+ width: "100%",
9318
+ maxWidth: frameMaxWidth,
9319
+ transition: "max-width 0.22s ease",
9320
+ background: "#ffffff",
9321
+ color: "#0f172a",
9322
+ borderRadius: device === "mobile" ? 22 : 16,
9323
+ border: device === "mobile" ? "6px solid #1e293b" : "1px solid #cbd5e1",
9324
+ boxShadow: "0 14px 36px rgba(15, 23, 42, 0.12)",
9325
+ padding: isQuickPoll || device === "mobile" ? 20 : 28
9326
+ },
9327
+ children: [
9328
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 18 }, children: [
9329
+ /* @__PURE__ */ jsxRuntime.jsxs(
9330
+ "div",
9331
+ {
9332
+ style: {
9333
+ display: "flex",
9334
+ alignItems: "center",
9335
+ justifyContent: "space-between",
9336
+ flexWrap: "wrap",
9337
+ gap: 8,
9338
+ marginBottom: 8
9339
+ },
9340
+ children: [
9341
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
9342
+ /* @__PURE__ */ jsxRuntime.jsx(
9343
+ "span",
9344
+ {
9345
+ style: {
9346
+ fontSize: 10,
9347
+ fontWeight: 800,
9348
+ textTransform: "uppercase",
9349
+ letterSpacing: "0.04em",
9350
+ padding: "3px 9px",
9351
+ borderRadius: 12,
9352
+ background: isQuickPoll ? "#f3e8ff" : isMultiStep ? "#e0e7ff" : "#dbeafe",
9353
+ color: isQuickPoll ? "#6b21a8" : isMultiStep ? "#3730a3" : "#1e40af"
9354
+ },
9355
+ children: isQuickPoll ? trTest ? "Hızlı Oylama" : "Quick Poll" : isMultiStep ? trTest ? "Çok Adımlı Anket" : "Multi-Step Survey" : trTest ? "Anket" : "Survey"
9356
+ }
9357
+ ),
9358
+ /* @__PURE__ */ jsxRuntime.jsxs(
9359
+ "span",
9360
+ {
9361
+ style: {
9362
+ fontSize: 10.5,
9363
+ fontWeight: 600,
9364
+ padding: "3px 9px",
9365
+ borderRadius: 12,
9366
+ background: "#f1f5f9",
9367
+ color: "#475569"
9368
+ },
9369
+ children: [
9370
+ visibleCount,
9371
+ " ",
9372
+ trTest ? "Aktif Soru" : visibleCount === 1 ? "Question" : "Questions"
9373
+ ]
9374
+ }
9375
+ )
9376
+ ] }),
9377
+ draft.showPublicResults === "always" && !submitted && /* @__PURE__ */ jsxRuntime.jsx(
9378
+ "button",
9379
+ {
9380
+ type: "button",
9381
+ onClick: () => setPeekResults((p) => !p),
9382
+ style: {
9383
+ border: "none",
9384
+ background: "transparent",
9385
+ color: "#2563eb",
9386
+ fontSize: 12,
9387
+ fontWeight: 700,
9388
+ cursor: "pointer"
9389
+ },
9390
+ children: peekResults ? trTest ? "← Oy Kullanma Ekranına Dön" : "← Back to Voting" : trTest ? "Canlı Sonuçları Gör 📊" : "View Live Results 📊"
9391
+ }
9392
+ )
9393
+ ]
9394
+ }
9395
+ ),
9396
+ resolvedSurveyTitle && /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { margin: 0, fontSize: 20, fontWeight: 800, color: "#0f172a" }, children: resolvedSurveyTitle }),
9397
+ resolvedSurveyDesc && /* @__PURE__ */ jsxRuntime.jsx(
9398
+ "p",
9399
+ {
9400
+ style: {
9401
+ margin: "6px 0 0",
9402
+ fontSize: 13.5,
9403
+ lineHeight: 1.5,
9404
+ color: "#475569"
9405
+ },
9406
+ children: resolvedSurveyDesc
9407
+ }
9408
+ )
9409
+ ] }),
9410
+ submitted ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
9411
+ /* @__PURE__ */ jsxRuntime.jsxs(
9412
+ "div",
9413
+ {
9414
+ style: {
9415
+ padding: 18,
9416
+ borderRadius: 12,
9417
+ background: "#ecfdf5",
9418
+ border: "1px solid #6ee7b7",
9419
+ color: "#065f46"
9420
+ },
9421
+ children: [
9422
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6 }, children: [
9423
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "check_circle", size: 22, color: "#059669" }),
9424
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 16, fontWeight: 800 }, children: thankYouTitle })
9425
+ ] }),
9426
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 13.5, lineHeight: 1.5 }, children: thankYouMessage }),
9427
+ /* @__PURE__ */ jsxRuntime.jsx(
9428
+ "div",
9429
+ {
9430
+ style: {
9431
+ marginTop: 10,
9432
+ fontSize: 11.5,
9433
+ color: "#047857",
9434
+ fontWeight: 600
9435
+ },
9436
+ children: trTest ? `Tamamlama süresi: ${(elapsedMs / 1e3).toFixed(1)} sn • Dil: ${testLocale.toUpperCase()}` : `Completion time: ${(elapsedMs / 1e3).toFixed(1)}s • Locale: ${testLocale.toUpperCase()}`
9437
+ }
9438
+ )
9439
+ ]
9440
+ }
9441
+ ),
9442
+ draft.showPublicResults !== "never" && /* @__PURE__ */ jsxRuntime.jsxs(
9443
+ "div",
9444
+ {
9445
+ style: {
9446
+ padding: 16,
9447
+ borderRadius: 12,
9448
+ border: "1px solid #e2e8f0",
9449
+ background: "#f8fafc",
9450
+ display: "flex",
9451
+ flexDirection: "column",
9452
+ gap: 14
9453
+ },
9454
+ children: [
9455
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 12.5, fontWeight: 800, color: "#1e293b" }, children: [
9456
+ "📊",
9457
+ " ",
9458
+ trTest ? "Oy Sonrası Katılımcıya Gösterilen Sonuç Ekranı (Simülasyon)" : "Post-Vote Public Results View (Simulated)"
9459
+ ] }),
9460
+ (draft.questions || []).filter(
9461
+ (q) => q.type !== "statement" && q.type !== "consent" && isQuestionVisibleInDraft(q, draft, answers)
9462
+ ).map((q) => {
9463
+ const qT = pickTextForLocale(q.title, testLocale, q.key);
9464
+ const ans = answers[q.key];
9465
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9466
+ "div",
9467
+ {
9468
+ style: {
9469
+ padding: 12,
9470
+ borderRadius: 8,
9471
+ background: "#ffffff",
9472
+ border: "1px solid #e2e8f0"
9473
+ },
9474
+ children: [
9475
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12.5, fontWeight: 700, color: "#0f172a" }, children: qT }),
9476
+ Array.isArray(q.options) && q.options.length > 0 && q.type !== "ranking" ? /* @__PURE__ */ jsxRuntime.jsx(
9477
+ "div",
9478
+ {
9479
+ style: {
9480
+ display: "flex",
9481
+ flexDirection: "column",
9482
+ gap: 6,
9483
+ marginTop: 8
9484
+ },
9485
+ children: q.options.map((opt, idx) => {
9486
+ const selected = Array.isArray(ans) ? ans.includes(opt.id) : ans === opt.id;
9487
+ const demoPct = selected ? Math.min(82, 48 + idx * 13 % 30) : Math.max(8, 28 - idx * 9 % 20);
9488
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9489
+ /* @__PURE__ */ jsxRuntime.jsxs(
9490
+ "div",
9491
+ {
9492
+ style: {
9493
+ display: "flex",
9494
+ justifyContent: "space-between",
9495
+ fontSize: 11.5,
9496
+ marginBottom: 3
9497
+ },
9498
+ children: [
9499
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontWeight: selected ? 700 : 500 }, children: [
9500
+ pickTextForLocale(opt.labels, testLocale, opt.id),
9501
+ selected ? trTest ? " (Seçiminiz)" : " (Your pick)" : ""
9502
+ ] }),
9503
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontWeight: 700, color: "#2563eb" }, children: [
9504
+ demoPct,
9505
+ "%"
9506
+ ] })
9507
+ ]
9508
+ }
9509
+ ),
9510
+ /* @__PURE__ */ jsxRuntime.jsx(
9511
+ "div",
9512
+ {
9513
+ style: {
9514
+ height: 7,
9515
+ borderRadius: 4,
9516
+ background: "#e2e8f0",
9517
+ overflow: "hidden"
9518
+ },
9519
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9520
+ "div",
9521
+ {
9522
+ style: {
9523
+ width: `${demoPct}%`,
9524
+ height: "100%",
9525
+ background: selected ? "#2563eb" : "#94a3b8"
9526
+ }
9527
+ }
9528
+ )
9529
+ }
9530
+ )
9531
+ ] }, opt.id);
9532
+ })
9533
+ }
9534
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 12, color: "#334155", marginTop: 4 }, children: [
9535
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: trTest ? "Yanıtınız:" : "Your answer:" }),
9536
+ " ",
9537
+ typeof ans === "object" ? JSON.stringify(ans) : String(ans ?? "—")
9538
+ ] })
9539
+ ]
9540
+ },
9541
+ `res-${q.key}`
9542
+ );
9543
+ })
9544
+ ]
9545
+ }
9546
+ ),
9547
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
9548
+ "button",
9549
+ {
9550
+ type: "button",
9551
+ onClick: resetFlow,
9552
+ style: {
9553
+ padding: "9px 18px",
9554
+ borderRadius: 8,
9555
+ border: "none",
9556
+ background: "#2563eb",
9557
+ color: "#ffffff",
9558
+ fontSize: 12.5,
9559
+ fontWeight: 700,
9560
+ cursor: "pointer",
9561
+ display: "inline-flex",
9562
+ alignItems: "center",
9563
+ gap: 6
9564
+ },
9565
+ children: [
9566
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "replay", size: 16, color: "#fff" }),
9567
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trTest ? "Akışı Tekrar Test Et" : "Test Flow Again" })
9568
+ ]
9569
+ }
9570
+ ) })
9571
+ ] }) : peekResults ? /* @__PURE__ */ jsxRuntime.jsx(
9572
+ "div",
9573
+ {
9574
+ style: {
9575
+ padding: 16,
9576
+ borderRadius: 10,
9577
+ background: "#f8fafc",
9578
+ border: "1px solid #e2e8f0",
9579
+ fontSize: 13,
9580
+ color: "#334155"
9581
+ },
9582
+ children: trTest ? "Canlı sonuç önizlemesi açık (`showPublicResults = always`). Oy kullanma ekranına dönmek için sağ üstteki bağlantıya tıklayın." : "Public results preview is active (`showPublicResults = always`). Click the top-right link to return to the form."
9583
+ }
9584
+ ) : (
9585
+ /* Interactive Form Flow */
9586
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleNextOrSubmit, children: [
9587
+ isMultiStep && visibleSteps.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 22 }, children: [
9588
+ /* @__PURE__ */ jsxRuntime.jsxs(
9589
+ "div",
9590
+ {
9591
+ style: {
9592
+ display: "flex",
9593
+ alignItems: "center",
9594
+ justifyContent: "space-between",
9595
+ flexWrap: "wrap",
9596
+ gap: 8,
9597
+ marginBottom: 8
9598
+ },
9599
+ children: [
9600
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: visibleSteps.map((st, sIdx) => {
9601
+ const isCurrent = sIdx === safeStepIdx;
9602
+ const isCompleted = sIdx < safeStepIdx;
9603
+ const canJumpBack = isCompleted && draft.allowBackNavigation !== false;
9604
+ const stLabel = pickTextForLocale(
9605
+ st.title,
9606
+ testLocale,
9607
+ `${sIdx + 1}. ${trTest ? "Adım" : "Step"}`
9608
+ );
9609
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9610
+ "button",
9611
+ {
9612
+ type: "button",
9613
+ onClick: () => canJumpBack ? setCurrentStepIdx(sIdx) : void 0,
9614
+ style: {
9615
+ padding: "5px 11px",
9616
+ borderRadius: 16,
9617
+ border: isCurrent ? "1.5px solid #2563eb" : isCompleted ? "1px solid #86efac" : "1px solid #cbd5e1",
9618
+ background: isCurrent ? "#2563eb" : isCompleted ? "#dcfce7" : "#f8fafc",
9619
+ color: isCurrent ? "#ffffff" : isCompleted ? "#166534" : "#64748b",
9620
+ fontSize: 11.5,
9621
+ fontWeight: 700,
9622
+ cursor: canJumpBack ? "pointer" : "default"
9623
+ },
9624
+ children: [
9625
+ isCompleted ? "✓ " : `${sIdx + 1}. `,
9626
+ stLabel
9627
+ ]
9628
+ },
9629
+ st.id
9630
+ );
9631
+ }) }),
9632
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: 11.5, fontWeight: 700, color: "#475569" }, children: [
9633
+ safeStepIdx + 1,
9634
+ " / ",
9635
+ visibleSteps.length,
9636
+ " (",
9637
+ stepProgressPct,
9638
+ "%)"
9639
+ ] })
9640
+ ]
9641
+ }
9642
+ ),
9643
+ draft.showProgressBar !== false && /* @__PURE__ */ jsxRuntime.jsx(
9644
+ "div",
9645
+ {
9646
+ style: {
9647
+ height: 8,
9648
+ borderRadius: 6,
9649
+ background: "#e2e8f0",
9650
+ overflow: "hidden"
9651
+ },
9652
+ children: /* @__PURE__ */ jsxRuntime.jsx(
9653
+ "div",
9654
+ {
9655
+ style: {
9656
+ width: `${stepProgressPct}%`,
9657
+ height: "100%",
9658
+ background: "linear-gradient(90deg, #2563eb, #3b82f6)",
9659
+ transition: "width 0.25s ease"
9660
+ }
9661
+ }
9662
+ )
9663
+ }
9664
+ ),
9665
+ activeStep && pickTextForLocale(activeStep.description, testLocale, "") && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 6 }, children: pickTextForLocale(activeStep.description, testLocale, "") })
9666
+ ] }),
9667
+ generalError && /* @__PURE__ */ jsxRuntime.jsx(
9668
+ "div",
9669
+ {
9670
+ style: {
9671
+ marginBottom: 16,
9672
+ padding: "10px 14px",
9673
+ borderRadius: 8,
9674
+ background: "#fef2f2",
9675
+ border: "1px solid #fecaca",
9676
+ color: "#991b1b",
9677
+ fontSize: 12.5,
9678
+ fontWeight: 600
9679
+ },
9680
+ children: generalError
9681
+ }
9682
+ ),
9683
+ activeQuestions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
9684
+ "div",
9685
+ {
9686
+ style: {
9687
+ padding: 24,
9688
+ borderRadius: 10,
9689
+ border: "1px dashed #cbd5e1",
9690
+ textAlign: "center",
9691
+ color: "#64748b",
9692
+ fontSize: 13,
9693
+ marginBottom: 18
9694
+ },
9695
+ children: trTest ? "Bu adımda (veya mevcut koşullara göre) görüntülenecek soru bulunmuyor." : "No visible questions in this step under current conditions."
9696
+ }
9697
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 20 }, children: activeQuestions.map((q) => {
9698
+ const qTitle = pickTextForLocale(q.title, testLocale, q.key);
9699
+ const qDesc = pickTextForLocale(q.description, testLocale, "");
9700
+ const qPlaceholder = pickTextForLocale(q.placeholder, testLocale, "");
9701
+ const qErrs = errors[q.key] || [];
9702
+ const hasErr = qErrs.length > 0;
9703
+ const val = answers[q.key];
9704
+ if (q.type === "statement") {
9705
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9706
+ "div",
9707
+ {
9708
+ style: {
9709
+ padding: "14px 16px",
9710
+ borderRadius: 10,
9711
+ background: "#eff6ff",
9712
+ borderLeft: "4px solid #2563eb",
9713
+ color: "#1e3a8a"
9714
+ },
9715
+ children: [
9716
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 14, fontWeight: 700 }, children: qTitle }),
9717
+ qDesc && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12.5, marginTop: 4, color: "#1e40af" }, children: qDesc })
9718
+ ]
9719
+ },
9720
+ q.key
9721
+ );
9722
+ }
9723
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9724
+ "div",
9725
+ {
9726
+ style: {
9727
+ padding: 16,
9728
+ borderRadius: 12,
9729
+ border: hasErr ? "1.5px solid #ef4444" : "1px solid #e2e8f0",
9730
+ background: hasErr ? "#fffafa" : "#ffffff"
9731
+ },
9732
+ children: [
9733
+ q.type !== "consent" && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 10 }, children: [
9734
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 14.5, fontWeight: 700, color: "#0f172a" }, children: [
9735
+ qTitle,
9736
+ " ",
9737
+ q.required && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626" }, children: "*" })
9738
+ ] }),
9739
+ qDesc && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 3 }, children: qDesc })
9740
+ ] }),
9741
+ q.type === "single_choice" && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
9742
+ /* @__PURE__ */ jsxRuntime.jsxs(
9743
+ "div",
9744
+ {
9745
+ style: {
9746
+ display: "flex",
9747
+ flexDirection: q.inline ? "row" : "column",
9748
+ flexWrap: "wrap",
9749
+ gap: 8
9750
+ },
9751
+ children: [
9752
+ getRenderedOptions(q).map((opt) => {
9753
+ const checked = val === opt.id;
9754
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9755
+ "label",
9756
+ {
9757
+ style: {
9758
+ display: "inline-flex",
9759
+ alignItems: "center",
9760
+ gap: 9,
9761
+ padding: "9px 12px",
9762
+ borderRadius: 8,
9763
+ border: checked ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
9764
+ background: checked ? "#eff6ff" : "#f8fafc",
9765
+ color: "#0f172a",
9766
+ fontSize: 13,
9767
+ fontWeight: checked ? 700 : 500,
9768
+ cursor: "pointer"
9769
+ },
9770
+ children: [
9771
+ /* @__PURE__ */ jsxRuntime.jsx(
9772
+ "input",
9773
+ {
9774
+ type: "radio",
9775
+ name: `prev-${q.key}`,
9776
+ checked,
9777
+ onChange: () => setAnswer(q.key, opt.id)
9778
+ }
9779
+ ),
9780
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(opt.labels, testLocale, opt.id) })
9781
+ ]
9782
+ },
9783
+ opt.id
9784
+ );
9785
+ }),
9786
+ q.allowOther && /* @__PURE__ */ jsxRuntime.jsxs(
9787
+ "label",
9788
+ {
9789
+ style: {
9790
+ display: "inline-flex",
9791
+ alignItems: "center",
9792
+ gap: 9,
9793
+ padding: "9px 12px",
9794
+ borderRadius: 8,
9795
+ border: val === "__other__" ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
9796
+ background: val === "__other__" ? "#eff6ff" : "#f8fafc",
9797
+ color: "#0f172a",
9798
+ fontSize: 13,
9799
+ fontWeight: val === "__other__" ? 700 : 500,
9800
+ cursor: "pointer"
9801
+ },
9802
+ children: [
9803
+ /* @__PURE__ */ jsxRuntime.jsx(
9804
+ "input",
9805
+ {
9806
+ type: "radio",
9807
+ name: `prev-${q.key}`,
9808
+ checked: val === "__other__",
9809
+ onChange: () => setAnswer(q.key, "__other__")
9810
+ }
9811
+ ),
9812
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(
9813
+ q.otherLabel,
9814
+ testLocale,
9815
+ trTest ? "Diğer (Belirtiniz)" : "Other (Please specify)"
9816
+ ) })
9817
+ ]
9818
+ }
9819
+ )
9820
+ ]
9821
+ }
9822
+ ),
9823
+ q.allowOther && val === "__other__" && /* @__PURE__ */ jsxRuntime.jsx(
9824
+ "input",
9825
+ {
9826
+ type: "text",
9827
+ value: otherTexts[q.key] || "",
9828
+ onChange: (e) => setOtherTexts((prev) => ({
9829
+ ...prev,
9830
+ [q.key]: e.target.value
9831
+ })),
9832
+ placeholder: trTest ? "Lütfen açıklayınız..." : "Please specify...",
9833
+ style: {
9834
+ width: "100%",
9835
+ padding: "8px 11px",
9836
+ borderRadius: 7,
9837
+ border: "1px solid #cbd5e1",
9838
+ background: "#ffffff",
9839
+ color: "#0f172a",
9840
+ fontSize: 13
9841
+ }
9842
+ }
9843
+ )
9844
+ ] }),
9845
+ q.type === "multiple_choice" && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
9846
+ (q.minSelections || q.maxSelections) && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: 11, color: "#64748b" }, children: [
9847
+ q.minSelections ? `${trTest ? "Min:" : "Min:"} ${q.minSelections} ` : "",
9848
+ q.maxSelections ? `${trTest ? "Maks:" : "Max:"} ${q.maxSelections}` : ""
9849
+ ] }),
9850
+ getRenderedOptions(q).map((opt) => {
9851
+ const arr = Array.isArray(val) ? val : [];
9852
+ const checked = arr.includes(opt.id);
9853
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9854
+ "label",
9855
+ {
9856
+ style: {
9857
+ display: "flex",
9858
+ alignItems: "center",
9859
+ gap: 9,
9860
+ padding: "9px 12px",
9861
+ borderRadius: 8,
9862
+ border: checked ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
9863
+ background: checked ? "#eff6ff" : "#f8fafc",
9864
+ color: "#0f172a",
9865
+ fontSize: 13,
9866
+ fontWeight: checked ? 700 : 500,
9867
+ cursor: "pointer"
9868
+ },
9869
+ children: [
9870
+ /* @__PURE__ */ jsxRuntime.jsx(
9871
+ "input",
9872
+ {
9873
+ type: "checkbox",
9874
+ checked,
9875
+ onChange: () => {
9876
+ const next = checked ? arr.filter((x) => x !== opt.id) : [...arr, opt.id];
9877
+ setAnswer(q.key, next);
9878
+ }
9879
+ }
9880
+ ),
9881
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(opt.labels, testLocale, opt.id) })
9882
+ ]
9883
+ },
9884
+ opt.id
9885
+ );
9886
+ }),
9887
+ q.allowOther && (() => {
9888
+ const arr = Array.isArray(val) ? val : [];
9889
+ const checked = arr.includes("__other__");
9890
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9891
+ /* @__PURE__ */ jsxRuntime.jsxs(
9892
+ "label",
9893
+ {
9894
+ style: {
9895
+ display: "flex",
9896
+ alignItems: "center",
9897
+ gap: 9,
9898
+ padding: "9px 12px",
9899
+ borderRadius: 8,
9900
+ border: checked ? "1.5px solid #2563eb" : "1px solid #cbd5e1",
9901
+ background: checked ? "#eff6ff" : "#f8fafc",
9902
+ color: "#0f172a",
9903
+ fontSize: 13,
9904
+ fontWeight: checked ? 700 : 500,
9905
+ cursor: "pointer"
9906
+ },
9907
+ children: [
9908
+ /* @__PURE__ */ jsxRuntime.jsx(
9909
+ "input",
9910
+ {
9911
+ type: "checkbox",
9912
+ checked,
9913
+ onChange: () => {
9914
+ const next = checked ? arr.filter((x) => x !== "__other__") : [...arr, "__other__"];
9915
+ setAnswer(q.key, next);
9916
+ }
9917
+ }
9918
+ ),
9919
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(
9920
+ q.otherLabel,
9921
+ testLocale,
9922
+ trTest ? "Diğer (Belirtiniz)" : "Other (Please specify)"
9923
+ ) })
9924
+ ]
9925
+ }
9926
+ ),
9927
+ checked && /* @__PURE__ */ jsxRuntime.jsx(
9928
+ "input",
9929
+ {
9930
+ type: "text",
9931
+ value: otherTexts[q.key] || "",
9932
+ onChange: (e) => setOtherTexts((prev) => ({
9933
+ ...prev,
9934
+ [q.key]: e.target.value
9935
+ })),
9936
+ placeholder: trTest ? "Lütfen açıklayınız..." : "Please specify...",
9937
+ style: {
9938
+ width: "100%",
9939
+ padding: "8px 11px",
9940
+ borderRadius: 7,
9941
+ border: "1px solid #cbd5e1",
9942
+ background: "#ffffff",
9943
+ color: "#0f172a",
9944
+ fontSize: 13
9945
+ }
9946
+ }
9947
+ )
9948
+ ] });
9949
+ })()
9950
+ ] }),
9951
+ q.type === "dropdown" && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
9952
+ /* @__PURE__ */ jsxRuntime.jsxs(
9953
+ "select",
9954
+ {
9955
+ value: val ?? "",
9956
+ onChange: (e) => setAnswer(q.key, e.target.value || null),
9957
+ style: {
9958
+ width: "100%",
9959
+ padding: "9px 12px",
9960
+ borderRadius: 8,
9961
+ border: "1px solid #cbd5e1",
9962
+ background: "#ffffff",
9963
+ color: "#0f172a",
9964
+ fontSize: 13
9965
+ },
9966
+ children: [
9967
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: qPlaceholder || (trTest ? "Seçiniz..." : "Select an option...") }),
9968
+ getRenderedOptions(q).map((opt) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: opt.id, children: pickTextForLocale(opt.labels, testLocale, opt.id) }, opt.id)),
9969
+ q.allowOther && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "__other__", children: pickTextForLocale(
9970
+ q.otherLabel,
9971
+ testLocale,
9972
+ trTest ? "Diğer" : "Other"
9973
+ ) })
9974
+ ]
9975
+ }
9976
+ ),
9977
+ q.allowOther && val === "__other__" && /* @__PURE__ */ jsxRuntime.jsx(
9978
+ "input",
9979
+ {
9980
+ type: "text",
9981
+ value: otherTexts[q.key] || "",
9982
+ onChange: (e) => setOtherTexts((prev) => ({
9983
+ ...prev,
9984
+ [q.key]: e.target.value
9985
+ })),
9986
+ placeholder: trTest ? "Lütfen açıklayınız..." : "Please specify...",
9987
+ style: {
9988
+ width: "100%",
9989
+ padding: "8px 11px",
9990
+ borderRadius: 7,
9991
+ border: "1px solid #cbd5e1",
9992
+ background: "#ffffff",
9993
+ color: "#0f172a",
9994
+ fontSize: 13
9995
+ }
9996
+ }
9997
+ )
9998
+ ] }),
9999
+ q.type === "image_choice" && (() => {
10000
+ const isMultiImg = (q.maxSelections ?? 1) > 1;
10001
+ return /* @__PURE__ */ jsxRuntime.jsx(
10002
+ "div",
10003
+ {
10004
+ style: {
10005
+ display: "grid",
10006
+ gridTemplateColumns: device === "mobile" ? "1fr" : "repeat(auto-fill, minmax(180px, 1fr))",
10007
+ gap: 10
10008
+ },
10009
+ children: getRenderedOptions(q).map((opt) => {
10010
+ const selected = isMultiImg ? Array.isArray(val) && val.includes(opt.id) : val === opt.id;
10011
+ const imgUrl = opt.image ? resolveCanvasMediaUrl(opt.image) : "";
10012
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10013
+ "div",
10014
+ {
10015
+ onClick: () => {
10016
+ if (isMultiImg) {
10017
+ const arr = Array.isArray(val) ? val : [];
10018
+ const next = selected ? arr.filter((x) => x !== opt.id) : [...arr, opt.id];
10019
+ setAnswer(q.key, next);
10020
+ } else {
10021
+ setAnswer(q.key, opt.id);
10022
+ }
10023
+ },
10024
+ style: {
10025
+ borderRadius: 10,
10026
+ overflow: "hidden",
10027
+ border: selected ? "2px solid #2563eb" : "1px solid #cbd5e1",
10028
+ background: selected ? "#eff6ff" : "#f8fafc",
10029
+ cursor: "pointer",
10030
+ transition: "all 0.15s ease"
10031
+ },
10032
+ children: [
10033
+ imgUrl ? /* @__PURE__ */ jsxRuntime.jsx(
10034
+ "img",
10035
+ {
10036
+ src: imgUrl,
10037
+ alt: pickTextForLocale(opt.labels, testLocale, opt.id),
10038
+ style: {
10039
+ width: "100%",
10040
+ height: 120,
10041
+ objectFit: "cover",
10042
+ display: "block"
10043
+ }
10044
+ }
10045
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
10046
+ "div",
10047
+ {
10048
+ style: {
10049
+ height: 100,
10050
+ display: "flex",
10051
+ alignItems: "center",
10052
+ justifyContent: "center",
10053
+ background: "#e2e8f0",
10054
+ color: "#64748b",
10055
+ fontSize: 11
10056
+ },
10057
+ children: /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "image", size: 24, color: "#94a3b8" })
10058
+ }
10059
+ ),
10060
+ /* @__PURE__ */ jsxRuntime.jsxs(
10061
+ "div",
10062
+ {
10063
+ style: {
10064
+ padding: "9px 10px",
10065
+ fontSize: 12.5,
10066
+ fontWeight: selected ? 700 : 600,
10067
+ color: "#0f172a",
10068
+ display: "flex",
10069
+ alignItems: "center",
10070
+ justifyContent: "space-between",
10071
+ gap: 6
10072
+ },
10073
+ children: [
10074
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(opt.labels, testLocale, opt.id) }),
10075
+ selected && /* @__PURE__ */ jsxRuntime.jsx(
10076
+ index.MaterialIcon,
10077
+ {
10078
+ name: "check_circle",
10079
+ size: 16,
10080
+ color: "#2563eb"
10081
+ }
10082
+ )
10083
+ ]
10084
+ }
10085
+ )
10086
+ ]
10087
+ },
10088
+ opt.id
10089
+ );
10090
+ })
10091
+ }
10092
+ );
10093
+ })(),
10094
+ q.type === "nps" && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10095
+ /* @__PURE__ */ jsxRuntime.jsx(
10096
+ "div",
10097
+ {
10098
+ style: {
10099
+ display: "grid",
10100
+ gridTemplateColumns: device === "mobile" ? "repeat(6, 1fr)" : "repeat(11, minmax(0, 1fr))",
10101
+ gap: 5
10102
+ },
10103
+ children: Array.from({ length: 11 }, (_, score) => {
10104
+ const selected = val === score;
10105
+ const accent = score <= 6 ? "#dc2626" : score <= 8 ? "#d97706" : "#059669";
10106
+ return /* @__PURE__ */ jsxRuntime.jsx(
10107
+ "button",
10108
+ {
10109
+ type: "button",
10110
+ onClick: () => setAnswer(q.key, score),
10111
+ style: {
10112
+ padding: "10px 0",
10113
+ borderRadius: 8,
10114
+ border: selected ? `2px solid ${accent}` : "1px solid #cbd5e1",
10115
+ background: selected ? accent : "#f8fafc",
10116
+ color: selected ? "#ffffff" : "#0f172a",
10117
+ fontSize: 13,
10118
+ fontWeight: 800,
10119
+ cursor: "pointer"
10120
+ },
10121
+ children: score
10122
+ },
10123
+ score
10124
+ );
10125
+ })
10126
+ }
10127
+ ),
10128
+ /* @__PURE__ */ jsxRuntime.jsxs(
10129
+ "div",
10130
+ {
10131
+ style: {
10132
+ display: "flex",
10133
+ justifyContent: "space-between",
10134
+ fontSize: 11,
10135
+ color: "#64748b",
10136
+ marginTop: 6
10137
+ },
10138
+ children: [
10139
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(
10140
+ q.lowLabel,
10141
+ testLocale,
10142
+ trTest ? "0 — Hiç Olası Değil" : "0 — Not likely"
10143
+ ) }),
10144
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(
10145
+ q.highLabel,
10146
+ testLocale,
10147
+ trTest ? "10 — Kesinlikle Öneririm" : "10 — Extremely likely"
10148
+ ) })
10149
+ ]
10150
+ }
10151
+ )
10152
+ ] }),
10153
+ q.type === "star_rating" && (() => {
10154
+ const maxStars = Math.min(10, Math.max(3, Number(q.maxStars) || 5));
10155
+ const activeRating = hoverStar[q.key] || Number(val) || 0;
10156
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
10157
+ Array.from({ length: maxStars }, (_, idx) => {
10158
+ const starVal = idx + 1;
10159
+ const lit = starVal <= activeRating;
10160
+ return /* @__PURE__ */ jsxRuntime.jsx(
10161
+ "button",
10162
+ {
10163
+ type: "button",
10164
+ onMouseEnter: () => setHoverStar((p) => ({ ...p, [q.key]: starVal })),
10165
+ onMouseLeave: () => setHoverStar((p) => ({ ...p, [q.key]: 0 })),
10166
+ onClick: () => setAnswer(q.key, starVal),
10167
+ style: {
10168
+ border: "none",
10169
+ background: "transparent",
10170
+ fontSize: 28,
10171
+ lineHeight: 1,
10172
+ color: lit ? "#f59e0b" : "#cbd5e1",
10173
+ cursor: "pointer",
10174
+ padding: "2px 4px"
10175
+ },
10176
+ children: "★"
10177
+ },
10178
+ starVal
10179
+ );
10180
+ }),
10181
+ val ? /* @__PURE__ */ jsxRuntime.jsxs(
10182
+ "span",
10183
+ {
10184
+ style: {
10185
+ marginLeft: 6,
10186
+ fontSize: 12,
10187
+ fontWeight: 700,
10188
+ padding: "2px 8px",
10189
+ borderRadius: 10,
10190
+ background: "#fef3c7",
10191
+ color: "#92400e"
10192
+ },
10193
+ children: [
10194
+ val,
10195
+ " / ",
10196
+ maxStars
10197
+ ]
10198
+ }
10199
+ ) : null
10200
+ ] });
10201
+ })(),
10202
+ q.type === "likert_scale" && (() => {
10203
+ const minS = Number(q.scaleMin) || 1;
10204
+ const maxS = Math.max(minS + 1, Number(q.scaleMax) || 5);
10205
+ const points = [];
10206
+ for (let s = minS; s <= maxS; s++) points.push(s);
10207
+ const hasCustomScaleLabels = Boolean(q.scaleLabels) && points.some(
10208
+ (pt) => pickTextForLocale(
10209
+ q.scaleLabels?.[String(pt)],
10210
+ testLocale,
10211
+ ""
10212
+ ).trim() !== ""
10213
+ );
10214
+ if (hasCustomScaleLabels) {
10215
+ return /* @__PURE__ */ jsxRuntime.jsx(
10216
+ "div",
10217
+ {
10218
+ style: {
10219
+ display: "grid",
10220
+ gridTemplateColumns: device === "mobile" ? "1fr" : `repeat(${points.length}, minmax(0, 1fr))`,
10221
+ gap: 8
10222
+ },
10223
+ children: points.map((pt) => {
10224
+ const selected = val === pt;
10225
+ const ptLabel = pickTextForLocale(
10226
+ q.scaleLabels?.[String(pt)],
10227
+ testLocale,
10228
+ ""
10229
+ );
10230
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10231
+ "button",
10232
+ {
10233
+ type: "button",
10234
+ onClick: () => setAnswer(q.key, pt),
10235
+ style: {
10236
+ padding: device === "mobile" ? "10px 12px" : "11px 8px",
10237
+ borderRadius: 10,
10238
+ border: selected ? "2px solid #2563eb" : "1px solid #cbd5e1",
10239
+ background: selected ? "#eff6ff" : "#f8fafc",
10240
+ color: "#0f172a",
10241
+ cursor: "pointer",
10242
+ display: "flex",
10243
+ flexDirection: device === "mobile" ? "row" : "column",
10244
+ alignItems: "center",
10245
+ justifyContent: device === "mobile" ? "flex-start" : "center",
10246
+ gap: device === "mobile" ? 10 : 6,
10247
+ textAlign: device === "mobile" ? "left" : "center"
10248
+ },
10249
+ children: [
10250
+ /* @__PURE__ */ jsxRuntime.jsx(
10251
+ "span",
10252
+ {
10253
+ style: {
10254
+ width: 26,
10255
+ height: 26,
10256
+ borderRadius: "50%",
10257
+ background: selected ? "#2563eb" : "#e2e8f0",
10258
+ color: selected ? "#ffffff" : "#1e293b",
10259
+ fontSize: 12.5,
10260
+ fontWeight: 800,
10261
+ display: "inline-flex",
10262
+ alignItems: "center",
10263
+ justifyContent: "center",
10264
+ flexShrink: 0
10265
+ },
10266
+ children: pt
10267
+ }
10268
+ ),
10269
+ ptLabel && /* @__PURE__ */ jsxRuntime.jsx(
10270
+ "span",
10271
+ {
10272
+ style: {
10273
+ fontSize: 11.5,
10274
+ fontWeight: selected ? 700 : 600,
10275
+ lineHeight: 1.3,
10276
+ color: selected ? "#1e3a8a" : "#334155"
10277
+ },
10278
+ children: ptLabel
10279
+ }
10280
+ )
10281
+ ]
10282
+ },
10283
+ pt
10284
+ );
10285
+ })
10286
+ }
10287
+ );
10288
+ }
10289
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10290
+ /* @__PURE__ */ jsxRuntime.jsx(
10291
+ "div",
10292
+ {
10293
+ style: {
10294
+ display: "grid",
10295
+ gridTemplateColumns: `repeat(${points.length}, minmax(0, 1fr))`,
10296
+ gap: 6
10297
+ },
10298
+ children: points.map((pt) => {
10299
+ const selected = val === pt;
10300
+ return /* @__PURE__ */ jsxRuntime.jsx(
10301
+ "button",
10302
+ {
10303
+ type: "button",
10304
+ onClick: () => setAnswer(q.key, pt),
10305
+ style: {
10306
+ padding: "10px 0",
10307
+ borderRadius: 8,
10308
+ border: selected ? "2px solid #2563eb" : "1px solid #cbd5e1",
10309
+ background: selected ? "#2563eb" : "#f8fafc",
10310
+ color: selected ? "#ffffff" : "#0f172a",
10311
+ fontSize: 13,
10312
+ fontWeight: 700,
10313
+ cursor: "pointer"
10314
+ },
10315
+ children: pt
10316
+ },
10317
+ pt
10318
+ );
10319
+ })
10320
+ }
10321
+ ),
10322
+ /* @__PURE__ */ jsxRuntime.jsxs(
10323
+ "div",
10324
+ {
10325
+ style: {
10326
+ display: "flex",
10327
+ justifyContent: "space-between",
10328
+ fontSize: 11,
10329
+ color: "#64748b",
10330
+ marginTop: 6
10331
+ },
10332
+ children: [
10333
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(q.lowLabel, testLocale, "") }),
10334
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: pickTextForLocale(q.highLabel, testLocale, "") })
10335
+ ]
10336
+ }
10337
+ )
10338
+ ] });
10339
+ })(),
10340
+ q.type === "matrix_single" && (() => {
10341
+ const mRows = Array.isArray(q.matrixRows) ? q.matrixRows : [];
10342
+ const mCols = Array.isArray(q.matrixColumns) ? q.matrixColumns : [];
10343
+ const matrixAns = val && typeof val === "object" && !Array.isArray(val) ? val : {};
10344
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
10345
+ "table",
10346
+ {
10347
+ style: {
10348
+ width: "100%",
10349
+ borderCollapse: "collapse",
10350
+ fontSize: 12.5
10351
+ },
10352
+ children: [
10353
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
10354
+ /* @__PURE__ */ jsxRuntime.jsx(
10355
+ "th",
10356
+ {
10357
+ style: {
10358
+ textAlign: "left",
10359
+ padding: "8px 10px",
10360
+ borderBottom: "1px solid #cbd5e1",
10361
+ color: "#475569"
10362
+ }
10363
+ }
10364
+ ),
10365
+ mCols.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
10366
+ "th",
10367
+ {
10368
+ style: {
10369
+ textAlign: "center",
10370
+ padding: "8px 10px",
10371
+ borderBottom: "1px solid #cbd5e1",
10372
+ color: "#334155",
10373
+ fontWeight: 700
10374
+ },
10375
+ children: pickTextForLocale(col.labels, testLocale, col.id)
10376
+ },
10377
+ col.id
10378
+ ))
10379
+ ] }) }),
10380
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { children: mRows.map((row, rIdx) => /* @__PURE__ */ jsxRuntime.jsxs(
10381
+ "tr",
10382
+ {
10383
+ style: {
10384
+ background: rIdx % 2 === 0 ? "#f8fafc" : "#ffffff"
10385
+ },
10386
+ children: [
10387
+ /* @__PURE__ */ jsxRuntime.jsx(
10388
+ "td",
10389
+ {
10390
+ style: {
10391
+ padding: "9px 10px",
10392
+ fontWeight: 600,
10393
+ color: "#0f172a",
10394
+ borderBottom: "1px solid #f1f5f9"
10395
+ },
10396
+ children: pickTextForLocale(row.labels, testLocale, row.id)
10397
+ }
10398
+ ),
10399
+ mCols.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
10400
+ "td",
10401
+ {
10402
+ style: {
10403
+ textAlign: "center",
10404
+ padding: "9px 10px",
10405
+ borderBottom: "1px solid #f1f5f9"
10406
+ },
10407
+ children: /* @__PURE__ */ jsxRuntime.jsx(
10408
+ "input",
10409
+ {
10410
+ type: "radio",
10411
+ name: `mtx-${q.key}-${row.id}`,
10412
+ checked: matrixAns[row.id] === col.id,
10413
+ onChange: () => setAnswer(q.key, {
10414
+ ...matrixAns,
10415
+ [row.id]: col.id
10416
+ }),
10417
+ style: { cursor: "pointer" }
10418
+ }
10419
+ )
10420
+ },
10421
+ col.id
10422
+ ))
10423
+ ]
10424
+ },
10425
+ row.id
10426
+ )) })
10427
+ ]
10428
+ }
10429
+ ) });
10430
+ })(),
10431
+ q.type === "ranking" && (() => {
10432
+ const optsMap = new Map(
10433
+ (q.options || []).map((o) => [o.id, o])
10434
+ );
10435
+ const orderedIds = Array.isArray(val) && val.length > 0 ? val.filter((id) => optsMap.has(id)) : (q.options || []).map((o) => o.id);
10436
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
10437
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, color: "#64748b" }, children: trTest ? "Öncelik sırasını değiştirmek için sürükleyin veya ↑/↓ oklarını kullanın:" : "Drag items or use ↑/↓ buttons to set priority order:" }),
10438
+ orderedIds.map((optId, idx) => {
10439
+ const opt = optsMap.get(optId);
10440
+ if (!opt) return null;
10441
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10442
+ "div",
10443
+ {
10444
+ draggable: true,
10445
+ onDragStart: () => {
10446
+ rankDragRef.current = { qKey: q.key, index: idx };
10447
+ },
10448
+ onDragOver: (e) => {
10449
+ if (rankDragRef.current?.qKey === q.key) {
10450
+ e.preventDefault();
10451
+ }
10452
+ },
10453
+ onDrop: (e) => {
10454
+ e.preventDefault();
10455
+ if (rankDragRef.current?.qKey === q.key) {
10456
+ moveRankOption(q.key, rankDragRef.current.index, idx);
10457
+ rankDragRef.current = null;
10458
+ }
10459
+ },
10460
+ style: {
10461
+ display: "flex",
10462
+ alignItems: "center",
10463
+ justifyContent: "space-between",
10464
+ padding: "8px 12px",
10465
+ borderRadius: 8,
10466
+ border: "1px solid #cbd5e1",
10467
+ background: "#f8fafc",
10468
+ cursor: "grab"
10469
+ },
10470
+ children: [
10471
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
10472
+ /* @__PURE__ */ jsxRuntime.jsxs(
10473
+ "span",
10474
+ {
10475
+ style: {
10476
+ width: 24,
10477
+ height: 24,
10478
+ borderRadius: "50%",
10479
+ background: idx === 0 ? "#2563eb" : "#e2e8f0",
10480
+ color: idx === 0 ? "#ffffff" : "#334155",
10481
+ fontSize: 11.5,
10482
+ fontWeight: 800,
10483
+ display: "inline-flex",
10484
+ alignItems: "center",
10485
+ justifyContent: "center"
10486
+ },
10487
+ children: [
10488
+ "#",
10489
+ idx + 1
10490
+ ]
10491
+ }
10492
+ ),
10493
+ /* @__PURE__ */ jsxRuntime.jsx(
10494
+ "span",
10495
+ {
10496
+ style: {
10497
+ fontSize: 13,
10498
+ fontWeight: 600,
10499
+ color: "#0f172a"
10500
+ },
10501
+ children: pickTextForLocale(opt.labels, testLocale, opt.id)
10502
+ }
10503
+ )
10504
+ ] }),
10505
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 4 }, children: [
10506
+ /* @__PURE__ */ jsxRuntime.jsx(
10507
+ "button",
10508
+ {
10509
+ type: "button",
10510
+ disabled: idx === 0,
10511
+ onClick: () => moveRankOption(q.key, idx, idx - 1),
10512
+ style: {
10513
+ padding: "3px 7px",
10514
+ borderRadius: 5,
10515
+ border: "1px solid #cbd5e1",
10516
+ background: "#ffffff",
10517
+ color: idx === 0 ? "#cbd5e1" : "#334155",
10518
+ cursor: idx === 0 ? "default" : "pointer",
10519
+ fontSize: 12
10520
+ },
10521
+ children: "↑"
10522
+ }
10523
+ ),
10524
+ /* @__PURE__ */ jsxRuntime.jsx(
10525
+ "button",
10526
+ {
10527
+ type: "button",
10528
+ disabled: idx === orderedIds.length - 1,
10529
+ onClick: () => moveRankOption(q.key, idx, idx + 1),
10530
+ style: {
10531
+ padding: "3px 7px",
10532
+ borderRadius: 5,
10533
+ border: "1px solid #cbd5e1",
10534
+ background: "#ffffff",
10535
+ color: idx === orderedIds.length - 1 ? "#cbd5e1" : "#334155",
10536
+ cursor: idx === orderedIds.length - 1 ? "default" : "pointer",
10537
+ fontSize: 12
10538
+ },
10539
+ children: "↓"
10540
+ }
10541
+ )
10542
+ ] })
10543
+ ]
10544
+ },
10545
+ optId
10546
+ );
10547
+ })
10548
+ ] });
10549
+ })(),
10550
+ q.type === "short_text" && /* @__PURE__ */ jsxRuntime.jsx(
10551
+ "input",
10552
+ {
10553
+ type: "text",
10554
+ value: val ?? "",
10555
+ onChange: (e) => setAnswer(q.key, e.target.value),
10556
+ placeholder: qPlaceholder || (trTest ? "Yanıtınızı yazınız..." : "Type your answer..."),
10557
+ style: {
10558
+ width: "100%",
10559
+ padding: "9px 12px",
10560
+ borderRadius: 8,
10561
+ border: "1px solid #cbd5e1",
10562
+ background: "#ffffff",
10563
+ color: "#0f172a",
10564
+ fontSize: 13
10565
+ }
10566
+ }
10567
+ ),
10568
+ q.type === "long_text" && /* @__PURE__ */ jsxRuntime.jsx(
10569
+ "textarea",
10570
+ {
10571
+ rows: 3,
10572
+ value: val ?? "",
10573
+ onChange: (e) => setAnswer(q.key, e.target.value),
10574
+ placeholder: qPlaceholder || (trTest ? "Detaylı görüşlerinizi yazınız..." : "Share your detailed feedback..."),
10575
+ style: {
10576
+ width: "100%",
10577
+ padding: "9px 12px",
10578
+ borderRadius: 8,
10579
+ border: "1px solid #cbd5e1",
10580
+ background: "#ffffff",
10581
+ color: "#0f172a",
10582
+ fontSize: 13,
10583
+ resize: "vertical"
10584
+ }
10585
+ }
10586
+ ),
10587
+ q.type === "consent" && /* @__PURE__ */ jsxRuntime.jsxs(
10588
+ "label",
10589
+ {
10590
+ style: {
10591
+ display: "flex",
10592
+ alignItems: "flex-start",
10593
+ gap: 10,
10594
+ cursor: "pointer",
10595
+ fontSize: 13,
10596
+ color: "#0f172a"
10597
+ },
10598
+ children: [
10599
+ /* @__PURE__ */ jsxRuntime.jsx(
10600
+ "input",
10601
+ {
10602
+ type: "checkbox",
10603
+ checked: Boolean(val),
10604
+ onChange: (e) => setAnswer(q.key, e.target.checked),
10605
+ style: { marginTop: 3 }
10606
+ }
10607
+ ),
10608
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10609
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontWeight: 700 }, children: [
10610
+ qTitle,
10611
+ " ",
10612
+ q.required !== false && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#dc2626" }, children: "*" })
10613
+ ] }),
10614
+ qDesc && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 12, color: "#64748b", marginTop: 2 }, children: qDesc })
10615
+ ] })
10616
+ ]
10617
+ }
10618
+ ),
10619
+ hasErr && /* @__PURE__ */ jsxRuntime.jsx(
10620
+ "div",
10621
+ {
10622
+ style: {
10623
+ marginTop: 8,
10624
+ display: "flex",
10625
+ flexDirection: "column",
10626
+ gap: 2
10627
+ },
10628
+ children: qErrs.map((errText, eIdx) => /* @__PURE__ */ jsxRuntime.jsxs(
10629
+ "span",
10630
+ {
10631
+ style: { fontSize: 11.5, fontWeight: 600, color: "#dc2626" },
10632
+ children: [
10633
+ "• ",
10634
+ errText
10635
+ ]
10636
+ },
10637
+ eIdx
10638
+ ))
10639
+ }
10640
+ )
10641
+ ]
10642
+ },
10643
+ q.key
10644
+ );
10645
+ }) }),
10646
+ isLastStep && draft.useRecaptcha && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 18 }, children: /* @__PURE__ */ jsxRuntime.jsxs(
10647
+ "label",
10648
+ {
10649
+ style: {
10650
+ display: "inline-flex",
10651
+ alignItems: "center",
10652
+ gap: 10,
10653
+ padding: "10px 14px",
10654
+ borderRadius: 6,
10655
+ border: "1px solid #cbd5e1",
10656
+ background: "#f8fafc",
10657
+ cursor: "pointer",
10658
+ fontSize: 12.5,
10659
+ fontWeight: 600,
10660
+ color: "#0f172a"
10661
+ },
10662
+ children: [
10663
+ /* @__PURE__ */ jsxRuntime.jsx(
10664
+ "input",
10665
+ {
10666
+ type: "checkbox",
10667
+ checked: mockCaptchaChecked,
10668
+ onChange: (e) => {
10669
+ setMockCaptchaChecked(e.target.checked);
10670
+ if (generalError) setGeneralError("");
10671
+ }
10672
+ }
10673
+ ),
10674
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trTest ? "Ben robot değilim (reCAPTCHA v2 Simülasyonu)" : "I'm not a robot (reCAPTCHA v2 Simulation)" })
10675
+ ]
10676
+ }
10677
+ ) }),
10678
+ /* @__PURE__ */ jsxRuntime.jsxs(
10679
+ "div",
10680
+ {
10681
+ style: {
10682
+ marginTop: 22,
10683
+ paddingTop: 16,
10684
+ borderTop: "1px solid #e2e8f0",
10685
+ display: "flex",
10686
+ alignItems: "center",
10687
+ justifyContent: "space-between",
10688
+ gap: 10
10689
+ },
10690
+ children: [
10691
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: isMultiStep && safeStepIdx > 0 && draft.allowBackNavigation !== false && /* @__PURE__ */ jsxRuntime.jsxs(
10692
+ "button",
10693
+ {
10694
+ type: "button",
10695
+ onClick: () => {
10696
+ setErrors({});
10697
+ setGeneralError("");
10698
+ setCurrentStepIdx(Math.max(0, safeStepIdx - 1));
10699
+ },
10700
+ style: {
10701
+ padding: "9px 16px",
10702
+ borderRadius: 8,
10703
+ border: "1px solid #cbd5e1",
10704
+ background: "#ffffff",
10705
+ color: "#334155",
10706
+ fontSize: 13,
10707
+ fontWeight: 700,
10708
+ cursor: "pointer"
10709
+ },
10710
+ children: [
10711
+ "← ",
10712
+ trTest ? "Önceki Adım" : "Previous"
10713
+ ]
10714
+ }
10715
+ ) }),
10716
+ /* @__PURE__ */ jsxRuntime.jsx(
10717
+ "button",
10718
+ {
10719
+ type: "submit",
10720
+ style: {
10721
+ padding: "10px 22px",
10722
+ borderRadius: 8,
10723
+ border: "none",
10724
+ background: "#2563eb",
10725
+ color: "#ffffff",
10726
+ fontSize: 13.5,
10727
+ fontWeight: 700,
10728
+ cursor: "pointer",
10729
+ boxShadow: "0 4px 12px rgba(37, 99, 235, 0.25)"
10730
+ },
10731
+ children: isLastStep ? submitBtnText : `${trTest ? "Sonraki Adım" : "Next Step"} →`
10732
+ }
10733
+ )
10734
+ ]
10735
+ }
10736
+ )
10737
+ ] })
10738
+ )
10739
+ ]
10740
+ }
10741
+ )
10742
+ ]
10743
+ }
10744
+ ),
10745
+ showInspector && /* @__PURE__ */ jsxRuntime.jsxs(
10746
+ "div",
10747
+ {
10748
+ style: {
10749
+ background: "#ffffff",
10750
+ borderLeft: "1px solid #cbd5e1",
10751
+ overflowY: "auto",
10752
+ padding: 16,
10753
+ display: "flex",
10754
+ flexDirection: "column",
10755
+ gap: 16
10756
+ },
10757
+ children: [
10758
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10759
+ /* @__PURE__ */ jsxRuntime.jsxs(
10760
+ "div",
10761
+ {
10762
+ style: {
10763
+ fontSize: 12,
10764
+ fontWeight: 800,
10765
+ color: "#0f172a",
10766
+ marginBottom: 8,
10767
+ display: "flex",
10768
+ alignItems: "center",
10769
+ gap: 6
10770
+ },
10771
+ children: [
10772
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "call_split", size: 16, color: "#2563eb" }),
10773
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trUi ? "Koşullu Akış & Görünürlük Durumu" : "Skip Logic & Question Visibility" })
10774
+ ]
10775
+ }
10776
+ ),
10777
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: (draft.questions || []).map((q, idx) => {
10778
+ const vis = isQuestionVisibleInDraft(q, draft, answers);
10779
+ const hasRules = q.conditions && Array.isArray(q.conditions.rules) && q.conditions.rules.length > 0;
10780
+ return /* @__PURE__ */ jsxRuntime.jsxs(
10781
+ "div",
10782
+ {
10783
+ style: {
10784
+ padding: "8px 10px",
10785
+ borderRadius: 8,
10786
+ border: vis ? "1px solid #bbf7d0" : "1px solid #fde68a",
10787
+ background: vis ? "#f0fdf4" : "#fffbeb",
10788
+ fontSize: 11
10789
+ },
10790
+ children: [
10791
+ /* @__PURE__ */ jsxRuntime.jsxs(
10792
+ "div",
10793
+ {
10794
+ style: {
10795
+ display: "flex",
10796
+ alignItems: "center",
10797
+ justifyContent: "space-between",
10798
+ gap: 6
10799
+ },
10800
+ children: [
10801
+ /* @__PURE__ */ jsxRuntime.jsxs("code", { style: { fontWeight: 700, color: "#0f172a" }, children: [
10802
+ idx + 1,
10803
+ ". ",
10804
+ q.key
10805
+ ] }),
10806
+ /* @__PURE__ */ jsxRuntime.jsx(
10807
+ "span",
10808
+ {
10809
+ style: {
10810
+ fontSize: 10,
10811
+ fontWeight: 800,
10812
+ padding: "1px 6px",
10813
+ borderRadius: 8,
10814
+ background: vis ? "#dcfce7" : "#fef3c7",
10815
+ color: vis ? "#166534" : "#92400e"
10816
+ },
10817
+ children: vis ? trUi ? "Görünür" : "Visible" : trUi ? "Gizli (Koşul)" : "Hidden"
10818
+ }
10819
+ )
10820
+ ]
10821
+ }
10822
+ ),
10823
+ hasRules && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: 4, color: "#64748b", fontSize: 10.5 }, children: q.conditions.rules.map((r, rI) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10824
+ "↳ ",
10825
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: r.questionKey }),
10826
+ " ",
10827
+ r.operator,
10828
+ " ",
10829
+ r.value !== void 0 && r.value !== "" ? /* @__PURE__ */ jsxRuntime.jsx("code", { children: String(r.value) }) : null
10830
+ ] }, rI)) })
10831
+ ]
10832
+ },
10833
+ `insp-${q.key || idx}`
10834
+ );
10835
+ }) })
10836
+ ] }),
10837
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
10838
+ /* @__PURE__ */ jsxRuntime.jsxs(
10839
+ "div",
10840
+ {
10841
+ style: {
10842
+ fontSize: 12,
10843
+ fontWeight: 800,
10844
+ color: "#0f172a",
10845
+ marginBottom: 8,
10846
+ display: "flex",
10847
+ alignItems: "center",
10848
+ gap: 6
10849
+ },
10850
+ children: [
10851
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "data_object", size: 16, color: "#059669" }),
10852
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: trUi ? "Canlı Yanıt Paketi (JSON)" : "Live Submission Payload" })
10853
+ ]
10854
+ }
10855
+ ),
10856
+ /* @__PURE__ */ jsxRuntime.jsx(
10857
+ "pre",
10858
+ {
10859
+ style: {
10860
+ margin: 0,
10861
+ padding: 10,
10862
+ borderRadius: 8,
10863
+ background: "#0f172a",
10864
+ color: "#e2e8f0",
10865
+ fontSize: 10.5,
10866
+ lineHeight: 1.45,
10867
+ overflowX: "auto",
10868
+ maxHeight: 280
10869
+ },
10870
+ children: JSON.stringify(
10871
+ {
10872
+ locale: testLocale,
10873
+ displayMode: draft.displayMode || "single_page",
10874
+ answers,
10875
+ ...Object.keys(otherTexts).length > 0 ? { otherTexts } : {}
10876
+ },
10877
+ null,
10878
+ 2
10879
+ )
10880
+ }
10881
+ )
10882
+ ] })
10883
+ ]
10884
+ }
10885
+ )
10886
+ ]
10887
+ }
10888
+ )
10889
+ ]
10890
+ }
10891
+ );
10892
+ };
10893
+ const inputStyle = {
10894
+ width: "100%",
10895
+ padding: "6px 9px",
10896
+ fontSize: 12,
10897
+ border: "1px solid #cbd5e1",
10898
+ borderRadius: 5,
10899
+ background: "#fff",
10900
+ color: "#1e293b"
10901
+ };
10902
+ const labelStyle = {
10903
+ display: "block",
10904
+ fontSize: 11,
10905
+ fontWeight: 600,
10906
+ color: "#475569",
10907
+ marginBottom: 4
10908
+ };
10909
+ function slugifyKey(input) {
10910
+ const map = {
10911
+ ç: "c",
10912
+ Ç: "c",
10913
+ ğ: "g",
10914
+ Ğ: "g",
10915
+ ı: "i",
10916
+ İ: "i",
10917
+ ö: "o",
10918
+ Ö: "o",
10919
+ ş: "s",
10920
+ Ş: "s",
10921
+ ü: "u",
10922
+ Ü: "u"
10923
+ };
10924
+ return String(input || "").replace(/[çÇğĞıİöÖşŞüÜ]/g, (ch) => map[ch] || ch).toLowerCase().replace(/[^a-z0-9_]+/g, "_").replace(/^_+|_+$/g, "");
10925
+ }
10926
+ const LIKERT_SCALE_PRESETS = [
10927
+ {
10928
+ id: "agreement",
10929
+ labelTr: "Katılım (Katılmıyorum–Katılıyorum)",
10930
+ labelEn: "Agreement (Disagree–Agree)",
10931
+ scale5: {
10932
+ "1": { tr: "Kesinlikle Katılmıyorum", en: "Strongly Disagree" },
10933
+ "2": { tr: "Katılmıyorum", en: "Disagree" },
10934
+ "3": { tr: "Kararsızım", en: "Neutral" },
10935
+ "4": { tr: "Katılıyorum", en: "Agree" },
10936
+ "5": { tr: "Kesinlikle Katılıyorum", en: "Strongly Agree" }
10937
+ },
10938
+ scale7: {
10939
+ "1": { tr: "Kesinlikle Katılmıyorum", en: "Strongly Disagree" },
10940
+ "2": { tr: "Katılmıyorum", en: "Disagree" },
10941
+ "3": { tr: "Kısmen Katılmıyorum", en: "Somewhat Disagree" },
10942
+ "4": { tr: "Kararsızım", en: "Neutral" },
10943
+ "5": { tr: "Kısmen Katılıyorum", en: "Somewhat Agree" },
10944
+ "6": { tr: "Katılıyorum", en: "Agree" },
10945
+ "7": { tr: "Kesinlikle Katılıyorum", en: "Strongly Agree" }
10946
+ }
10947
+ },
10948
+ {
10949
+ id: "satisfaction",
10950
+ labelTr: "Memnuniyet",
10951
+ labelEn: "Satisfaction",
10952
+ scale5: {
10953
+ "1": { tr: "Hiç Memnun Değilim", en: "Very Dissatisfied" },
10954
+ "2": { tr: "Memnun Değilim", en: "Dissatisfied" },
10955
+ "3": { tr: "Kararsızım", en: "Neutral" },
10956
+ "4": { tr: "Memnunum", en: "Satisfied" },
10957
+ "5": { tr: "Çok Memnunum", en: "Very Satisfied" }
10958
+ },
10959
+ scale7: {
10960
+ "1": { tr: "Hiç Memnun Değilim", en: "Very Dissatisfied" },
10961
+ "2": { tr: "Memnun Değilim", en: "Dissatisfied" },
10962
+ "3": { tr: "Kısmen Memnun Değilim", en: "Somewhat Dissatisfied" },
10963
+ "4": { tr: "Kararsızım", en: "Neutral" },
10964
+ "5": { tr: "Kısmen Memnunum", en: "Somewhat Satisfied" },
10965
+ "6": { tr: "Memnunum", en: "Satisfied" },
10966
+ "7": { tr: "Çok Memnunum", en: "Very Satisfied" }
10967
+ }
10968
+ },
10969
+ {
10970
+ id: "quality",
10971
+ labelTr: "Kalite (Çok Kötü–Mükemmel)",
10972
+ labelEn: "Quality (Poor–Excellent)",
10973
+ scale5: {
10974
+ "1": { tr: "Çok Kötü", en: "Poor" },
10975
+ "2": { tr: "Zayıf", en: "Fair" },
10976
+ "3": { tr: "Orta", en: "Good" },
10977
+ "4": { tr: "İyi", en: "Very Good" },
10978
+ "5": { tr: "Mükemmel", en: "Excellent" }
10979
+ },
10980
+ scale7: {
10981
+ "1": { tr: "Çok Kötü", en: "Terrible" },
10982
+ "2": { tr: "Kötü", en: "Poor" },
10983
+ "3": { tr: "Zayıf", en: "Below Average" },
10984
+ "4": { tr: "Orta", en: "Average" },
10985
+ "5": { tr: "İyi", en: "Good" },
10986
+ "6": { tr: "Çok İyi", en: "Very Good" },
10987
+ "7": { tr: "Mükemmel", en: "Excellent" }
10988
+ }
10989
+ },
10990
+ {
10991
+ id: "frequency",
10992
+ labelTr: "Sıklık (Hiç–Her Zaman)",
10993
+ labelEn: "Frequency (Never–Always)",
10994
+ scale5: {
10995
+ "1": { tr: "Hiçbir Zaman", en: "Never" },
10996
+ "2": { tr: "Nadiren", en: "Rarely" },
10997
+ "3": { tr: "Bazen", en: "Sometimes" },
10998
+ "4": { tr: "Sık Sık", en: "Often" },
10999
+ "5": { tr: "Her Zaman", en: "Always" }
11000
+ },
11001
+ scale7: {
11002
+ "1": { tr: "Hiçbir Zaman", en: "Never" },
11003
+ "2": { tr: "Çok Nadir", en: "Very Rarely" },
11004
+ "3": { tr: "Nadiren", en: "Rarely" },
11005
+ "4": { tr: "Bazen", en: "Sometimes" },
11006
+ "5": { tr: "Sıkça", en: "Frequently" },
11007
+ "6": { tr: "Çoğu Zaman", en: "Very Frequently" },
11008
+ "7": { tr: "Her Zaman", en: "Always" }
11009
+ }
11010
+ }
11011
+ ];
11012
+ const QUESTION_TYPES_CATALOG = [
11013
+ { type: "single_choice", labelTr: "Tekli Seçim (Radio)", labelEn: "Single Choice", hasOptions: true },
11014
+ { type: "multiple_choice", labelTr: "Çoklu Seçim (Checkbox)", labelEn: "Multiple Choice", hasOptions: true },
11015
+ { type: "dropdown", labelTr: "Açılır Liste (Dropdown)", labelEn: "Dropdown", hasOptions: true },
11016
+ { type: "image_choice", labelTr: "Görsel Kart Seçimi", labelEn: "Image Choice", hasOptions: true },
11017
+ { type: "nps", labelTr: "NPS Ölçeği (0–10)", labelEn: "NPS Score (0–10)" },
11018
+ { type: "star_rating", labelTr: "Yıldız Derece (1–5)", labelEn: "Star Rating" },
11019
+ { type: "likert_scale", labelTr: "Likert Ölçeği (1–5 / 1–7)", labelEn: "Likert Scale" },
11020
+ { type: "matrix_single", labelTr: "Matris Değerlendirme Tablosu", labelEn: "Matrix Grid" },
11021
+ { type: "ranking", labelTr: "Sürükle-Bırak Öncelik Sıralama", labelEn: "Drag Ranking", hasOptions: true },
11022
+ { type: "short_text", labelTr: "Kısa Metin Yanıtı", labelEn: "Short Text" },
11023
+ { type: "long_text", labelTr: "Açık Uçlu Uzun Yorum", labelEn: "Open-Ended Long Text" },
11024
+ { type: "consent", labelTr: "KVKK / Gizlilik Onayı", labelEn: "Consent Switch" },
11025
+ { type: "statement", labelTr: "Bilgi / Açıklama Metni", labelEn: "Info Statement" }
11026
+ ];
11027
+ function createBlankSurveyDraft(locale = "en") {
11028
+ const tr = locale === "tr";
11029
+ const ts = Date.now().toString(36).slice(-4);
11030
+ return {
11031
+ title: tr ? "Yeni Müşteri Geri Bildirim Anketi" : "New Customer Feedback Survey",
11032
+ titleI18n: {
11033
+ en: "New Customer Feedback Survey",
11034
+ tr: "Yeni Müşteri Geri Bildirim Anketi"
11035
+ },
11036
+ slug: `survey_${ts}`,
11037
+ description: {
11038
+ tr: "Görüşleriniz hizmet kalitemizi geliştirmemize yardımcı olur.",
11039
+ en: "Your feedback helps us improve our service quality."
11040
+ },
11041
+ status: "published",
11042
+ displayMode: "single_page",
11043
+ submissionPolicy: "one_per_voter",
11044
+ anonymizeIp: true,
11045
+ showPublicResults: "after_vote",
11046
+ allowBackNavigation: true,
11047
+ showProgressBar: true,
11048
+ useRecaptcha: false,
11049
+ steps: [
11050
+ {
11051
+ id: "step_1",
11052
+ title: { tr: "1. Bölüm", en: "Step 1" }
11053
+ }
11054
+ ],
11055
+ questions: [
11056
+ {
11057
+ key: "nps_score",
11058
+ stepId: "step_1",
11059
+ type: "nps",
11060
+ required: true,
11061
+ title: {
11062
+ tr: "Bizi çevrenize önerme olasılığınız nedir?",
11063
+ en: "How likely are you to recommend us?"
11064
+ },
11065
+ lowLabel: { tr: "0 — Hiç Olası Değil", en: "0 — Not likely" },
11066
+ highLabel: { tr: "10 — Kesinlikle Öneririm", en: "10 — Extremely likely" }
11067
+ },
11068
+ {
11069
+ key: "favorite_aspect",
11070
+ stepId: "step_1",
11071
+ type: "single_choice",
11072
+ required: true,
11073
+ allowOther: true,
11074
+ title: {
11075
+ tr: "En beğendiğiniz yönümüz hangisi?",
11076
+ en: "Which aspect do you value the most?"
11077
+ },
11078
+ options: [
11079
+ { id: "speed", labels: { tr: "Hız ve Performans", en: "Speed & Performance" } },
11080
+ { id: "ease_of_use", labels: { tr: "Kullanım Kolaylığı", en: "Ease of Use" } },
11081
+ { id: "support", labels: { tr: "Teknik Destek", en: "Technical Support" } }
11082
+ ]
11083
+ }
11084
+ ],
11085
+ settings: {
11086
+ submitLabel: { tr: "Anketi Gönder", en: "Submit Survey" },
11087
+ thankYouTitle: { tr: "Teşekkür Ederiz!", en: "Thank You!" },
11088
+ thankYouMessage: {
11089
+ tr: "Yanıtlarınız başarıyla kaydedildi.",
11090
+ en: "Your response has been recorded."
11091
+ }
11092
+ }
11093
+ };
11094
+ }
11095
+ function buildQuestionFromType(type, stepId, existingKeys = []) {
11096
+ let idx = existingKeys.length + 1;
11097
+ let key = `q_${type}_${idx}`;
11098
+ while (existingKeys.includes(key)) {
11099
+ idx += 1;
11100
+ key = `q_${type}_${idx}`;
11101
+ }
11102
+ const base = {
11103
+ key,
11104
+ stepId,
11105
+ type,
11106
+ required: type !== "statement" && type !== "long_text",
11107
+ title: {
11108
+ tr: `Yeni Soru (${type})`,
8421
11109
  en: `New Question (${type})`
8422
11110
  }
8423
11111
  };
@@ -8646,6 +11334,37 @@ const SurveyStudioModal = ({
8646
11334
  children: statusMsg
8647
11335
  }
8648
11336
  ),
11337
+ /* @__PURE__ */ jsxRuntime.jsxs(
11338
+ "button",
11339
+ {
11340
+ type: "button",
11341
+ onClick: () => setTab(tab === "preview" ? "builder" : "preview"),
11342
+ style: {
11343
+ padding: "8px 14px",
11344
+ borderRadius: 6,
11345
+ border: tab === "preview" ? "1px solid #34d399" : "1px solid rgba(255,255,255,0.32)",
11346
+ background: tab === "preview" ? "#059669" : "rgba(255,255,255,0.12)",
11347
+ color: "#ffffff",
11348
+ fontSize: 12,
11349
+ fontWeight: 700,
11350
+ cursor: "pointer",
11351
+ display: "inline-flex",
11352
+ alignItems: "center",
11353
+ gap: 6
11354
+ },
11355
+ children: [
11356
+ /* @__PURE__ */ jsxRuntime.jsx(
11357
+ index.MaterialIcon,
11358
+ {
11359
+ name: tab === "preview" ? "edit_note" : "play_circle",
11360
+ size: 16,
11361
+ color: "#fff"
11362
+ }
11363
+ ),
11364
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tab === "preview" ? tr ? "Tasarıma Dön" : "Back to Builder" : tr ? "Akışı Önizle & Test Et" : "Preview & Test Flow" })
11365
+ ]
11366
+ }
11367
+ ),
8649
11368
  /* @__PURE__ */ jsxRuntime.jsxs(
8650
11369
  "button",
8651
11370
  {
@@ -8708,17 +11427,22 @@ const SurveyStudioModal = ({
8708
11427
  {
8709
11428
  id: "builder",
8710
11429
  icon: "view_quilt",
8711
- label: tr ? "1. Adımlar, Sorular & Koşullu Mantık (Sürükle-Bırak)" : "1. Steps, Questions & Skip Logic (Drag & Drop)"
11430
+ label: tr ? "1. Adımlar, Sorular & Koşullu Mantık" : "1. Steps, Questions & Skip Logic"
11431
+ },
11432
+ {
11433
+ id: "preview",
11434
+ icon: "play_circle",
11435
+ label: tr ? "2. Önizleme & Canlı Akış Testi" : "2. Live Flow Preview & Simulator"
8712
11436
  },
8713
11437
  {
8714
11438
  id: "settings",
8715
11439
  icon: "tune",
8716
- label: tr ? "2. Yayın, Kota, Tekil Oy & Sonuç Ayarları" : "2. Lifecycle, Quota, Duplicate Guard & Results"
11440
+ label: tr ? "3. Yayın, Kota, Tekil Oy & Sonuç Ayarları" : "3. Lifecycle, Quota, Duplicate Guard & Results"
8717
11441
  },
8718
11442
  {
8719
11443
  id: "analytics",
8720
11444
  icon: "bar_chart",
8721
- label: tr ? "3. Canlı Raporlama, Grafikler & CSV Dışa Aktar" : "3. Live Analytics, Charts & CSV Export"
11445
+ label: tr ? "4. Canlı Raporlama, Grafikler & Excel (.xlsx)" : "4. Live Analytics, Charts & Excel (.xlsx)"
8722
11446
  }
8723
11447
  ].map((tItem) => {
8724
11448
  const active = tab === tItem.id;
@@ -9688,25 +12412,302 @@ const SurveyStudioModal = ({
9688
12412
  }
9689
12413
  )
9690
12414
  ] }),
9691
- activeQ.type === "likert_scale" && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9692
- /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle, children: tr ? "Likert Aralığı" : "Likert Range" }),
9693
- /* @__PURE__ */ jsxRuntime.jsxs(
9694
- "select",
9695
- {
9696
- value: activeQ.scaleMax || 5,
9697
- onChange: (e) => updateActiveQuestion({
9698
- scaleMin: 1,
9699
- scaleMax: Number(e.target.value)
9700
- }),
9701
- style: { ...inputStyle, width: 160 },
9702
- children: [
9703
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: 5, children: "1 – 5" }),
9704
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: 7, children: "1 – 7" })
9705
- ]
12415
+ activeQ.type === "likert_scale" && (() => {
12416
+ const maxPt = Number(activeQ.scaleMax) === 7 ? 7 : 5;
12417
+ const hasPerPointLabels = Boolean(
12418
+ activeQ.scaleLabels && typeof activeQ.scaleLabels === "object" && Object.keys(activeQ.scaleLabels).length > 0
12419
+ );
12420
+ const applyLikertPreset = (presetId, targetMax = maxPt) => {
12421
+ const preset = LIKERT_SCALE_PRESETS.find((p) => p.id === presetId) || LIKERT_SCALE_PRESETS[0];
12422
+ const srcMap = targetMax === 7 ? preset.scale7 : preset.scale5;
12423
+ const nextScaleLabels = {};
12424
+ for (let pt = 1; pt <= targetMax; pt++) {
12425
+ const keyStr = String(pt);
12426
+ const pair = srcMap[keyStr] || { tr: keyStr, en: keyStr };
12427
+ const locRecord = {};
12428
+ for (const loc of strapiLocales) {
12429
+ const short = loc.code.toLowerCase().split(/[-_]/)[0];
12430
+ locRecord[loc.code] = short === "tr" ? pair.tr : pair.en;
12431
+ }
12432
+ nextScaleLabels[keyStr] = locRecord;
9706
12433
  }
9707
- )
9708
- ] }),
9709
- (activeQ.type === "likert_scale" || activeQ.type === "nps") && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12434
+ updateActiveQuestion({
12435
+ scaleMin: 1,
12436
+ scaleMax: targetMax,
12437
+ scaleLabels: nextScaleLabels,
12438
+ lowLabel: nextScaleLabels["1"],
12439
+ highLabel: nextScaleLabels[String(targetMax)]
12440
+ });
12441
+ };
12442
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
12443
+ /* @__PURE__ */ jsxRuntime.jsxs(
12444
+ "div",
12445
+ {
12446
+ style: {
12447
+ display: "flex",
12448
+ flexWrap: "wrap",
12449
+ alignItems: "flex-end",
12450
+ justifyContent: "space-between",
12451
+ gap: 10
12452
+ },
12453
+ children: [
12454
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12455
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle, children: tr ? "Likert Aralığı" : "Likert Range" }),
12456
+ /* @__PURE__ */ jsxRuntime.jsxs(
12457
+ "select",
12458
+ {
12459
+ value: maxPt,
12460
+ onChange: (e) => {
12461
+ const nextMax = Number(e.target.value) === 7 ? 7 : 5;
12462
+ if (hasPerPointLabels) {
12463
+ const curMap = activeQ.scaleLabels || {};
12464
+ const resized = {};
12465
+ const fallbackPreset = nextMax === 7 ? LIKERT_SCALE_PRESETS[0].scale7 : LIKERT_SCALE_PRESETS[0].scale5;
12466
+ for (let pt = 1; pt <= nextMax; pt++) {
12467
+ const k = String(pt);
12468
+ if (curMap[k]) {
12469
+ resized[k] = normalizeLocalizedRecord(
12470
+ curMap[k],
12471
+ strapiLocales
12472
+ );
12473
+ } else {
12474
+ const pair = fallbackPreset[k];
12475
+ const locRec = {};
12476
+ for (const loc of strapiLocales) {
12477
+ locRec[loc.code] = loc.code.toLowerCase().startsWith("tr") ? pair.tr : pair.en;
12478
+ }
12479
+ resized[k] = locRec;
12480
+ }
12481
+ }
12482
+ updateActiveQuestion({
12483
+ scaleMin: 1,
12484
+ scaleMax: nextMax,
12485
+ scaleLabels: resized,
12486
+ lowLabel: resized["1"],
12487
+ highLabel: resized[String(nextMax)]
12488
+ });
12489
+ } else {
12490
+ updateActiveQuestion({
12491
+ scaleMin: 1,
12492
+ scaleMax: nextMax
12493
+ });
12494
+ }
12495
+ },
12496
+ style: { ...inputStyle, width: 150 },
12497
+ children: [
12498
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: 5, children: "1 – 5" }),
12499
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: 7, children: "1 – 7" })
12500
+ ]
12501
+ }
12502
+ )
12503
+ ] }),
12504
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
12505
+ /* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle, children: tr ? "Etiketleme Modu" : "Labeling Mode" }),
12506
+ /* @__PURE__ */ jsxRuntime.jsxs(
12507
+ "div",
12508
+ {
12509
+ style: {
12510
+ display: "inline-flex",
12511
+ borderRadius: 6,
12512
+ overflow: "hidden",
12513
+ border: "1px solid #cbd5e1"
12514
+ },
12515
+ children: [
12516
+ /* @__PURE__ */ jsxRuntime.jsx(
12517
+ "button",
12518
+ {
12519
+ type: "button",
12520
+ onClick: () => updateActiveQuestion({ scaleLabels: void 0 }),
12521
+ style: {
12522
+ padding: "6px 10px",
12523
+ border: "none",
12524
+ background: !hasPerPointLabels ? "#2563eb" : "#ffffff",
12525
+ color: !hasPerPointLabels ? "#ffffff" : "#475569",
12526
+ fontSize: 11,
12527
+ fontWeight: 700,
12528
+ cursor: "pointer"
12529
+ },
12530
+ children: tr ? `Sadece Uç Etiketler (1 & ${maxPt})` : `Endpoints Only (1 & ${maxPt})`
12531
+ }
12532
+ ),
12533
+ /* @__PURE__ */ jsxRuntime.jsx(
12534
+ "button",
12535
+ {
12536
+ type: "button",
12537
+ onClick: () => {
12538
+ if (!hasPerPointLabels) {
12539
+ applyLikertPreset("agreement", maxPt);
12540
+ }
12541
+ },
12542
+ style: {
12543
+ padding: "6px 10px",
12544
+ border: "none",
12545
+ background: hasPerPointLabels ? "#2563eb" : "#ffffff",
12546
+ color: hasPerPointLabels ? "#ffffff" : "#475569",
12547
+ fontSize: 11,
12548
+ fontWeight: 700,
12549
+ cursor: "pointer"
12550
+ },
12551
+ children: tr ? `Her Puana Özel Etiket (1–${maxPt})` : `Per-Score Labels (1–${maxPt})`
12552
+ }
12553
+ )
12554
+ ]
12555
+ }
12556
+ )
12557
+ ] })
12558
+ ]
12559
+ }
12560
+ ),
12561
+ hasPerPointLabels && /* @__PURE__ */ jsxRuntime.jsxs(
12562
+ "div",
12563
+ {
12564
+ style: {
12565
+ padding: 10,
12566
+ borderRadius: 8,
12567
+ background: "#ffffff",
12568
+ border: "1px solid #cbd5e1",
12569
+ display: "flex",
12570
+ flexDirection: "column",
12571
+ gap: 8
12572
+ },
12573
+ children: [
12574
+ /* @__PURE__ */ jsxRuntime.jsxs(
12575
+ "div",
12576
+ {
12577
+ style: {
12578
+ display: "flex",
12579
+ alignItems: "center",
12580
+ justifyContent: "space-between",
12581
+ flexWrap: "wrap",
12582
+ gap: 6
12583
+ },
12584
+ children: [
12585
+ /* @__PURE__ */ jsxRuntime.jsx(
12586
+ "span",
12587
+ {
12588
+ style: {
12589
+ fontSize: 11,
12590
+ fontWeight: 700,
12591
+ color: "#1e3a8a"
12592
+ },
12593
+ children: tr ? `Hazır 1–${maxPt} Şablonları (Tek Tık Doldur):` : `Quick 1–${maxPt} Presets:`
12594
+ }
12595
+ ),
12596
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 5 }, children: LIKERT_SCALE_PRESETS.map((pr) => /* @__PURE__ */ jsxRuntime.jsx(
12597
+ "button",
12598
+ {
12599
+ type: "button",
12600
+ onClick: () => applyLikertPreset(pr.id, maxPt),
12601
+ style: {
12602
+ padding: "3px 8px",
12603
+ borderRadius: 5,
12604
+ border: "1px solid #bfdbfe",
12605
+ background: "#eff6ff",
12606
+ color: "#1d4ed8",
12607
+ fontSize: 10.5,
12608
+ fontWeight: 700,
12609
+ cursor: "pointer"
12610
+ },
12611
+ children: tr ? pr.labelTr : pr.labelEn
12612
+ },
12613
+ pr.id
12614
+ )) })
12615
+ ]
12616
+ }
12617
+ ),
12618
+ /* @__PURE__ */ jsxRuntime.jsxs(
12619
+ "div",
12620
+ {
12621
+ style: {
12622
+ display: "grid",
12623
+ gridTemplateColumns: `46px repeat(${strapiLocales.length}, minmax(0, 1fr))`,
12624
+ gap: 6,
12625
+ fontSize: 10.5,
12626
+ fontWeight: 700,
12627
+ color: "#64748b",
12628
+ padding: "0 2px"
12629
+ },
12630
+ children: [
12631
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Puan" : "Score" }),
12632
+ strapiLocales.map((loc) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
12633
+ loc.code.toUpperCase(),
12634
+ " ",
12635
+ tr ? "Etiketi" : "Label"
12636
+ ] }, `lh-${loc.code}`))
12637
+ ]
12638
+ }
12639
+ ),
12640
+ Array.from({ length: maxPt }, (_, idx) => {
12641
+ const pt = idx + 1;
12642
+ const ptKey = String(pt);
12643
+ const ptObj = normalizeLocalizedRecord(
12644
+ activeQ.scaleLabels?.[ptKey],
12645
+ strapiLocales
12646
+ );
12647
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12648
+ "div",
12649
+ {
12650
+ style: {
12651
+ display: "grid",
12652
+ gridTemplateColumns: `46px repeat(${strapiLocales.length}, minmax(0, 1fr))`,
12653
+ gap: 6,
12654
+ alignItems: "center"
12655
+ },
12656
+ children: [
12657
+ /* @__PURE__ */ jsxRuntime.jsx(
12658
+ "span",
12659
+ {
12660
+ style: {
12661
+ display: "inline-flex",
12662
+ alignItems: "center",
12663
+ justifyContent: "center",
12664
+ height: 28,
12665
+ borderRadius: 6,
12666
+ background: "#eff6ff",
12667
+ border: "1px solid #bfdbfe",
12668
+ color: "#1d4ed8",
12669
+ fontSize: 12,
12670
+ fontWeight: 800
12671
+ },
12672
+ children: pt
12673
+ }
12674
+ ),
12675
+ strapiLocales.map((loc) => /* @__PURE__ */ jsxRuntime.jsx(
12676
+ "input",
12677
+ {
12678
+ type: "text",
12679
+ value: ptObj[loc.code] || "",
12680
+ onChange: (e) => {
12681
+ const nextPtObj = {
12682
+ ...ptObj,
12683
+ [loc.code]: e.target.value
12684
+ };
12685
+ const nextScaleMap = {
12686
+ ...activeQ.scaleLabels || {},
12687
+ [ptKey]: nextPtObj
12688
+ };
12689
+ updateActiveQuestion({
12690
+ scaleLabels: nextScaleMap,
12691
+ ...pt === 1 ? { lowLabel: nextPtObj } : {},
12692
+ ...pt === maxPt ? { highLabel: nextPtObj } : {}
12693
+ });
12694
+ },
12695
+ placeholder: `${pt} (${loc.code.toUpperCase()})`,
12696
+ style: inputStyle
12697
+ },
12698
+ `linp-${ptKey}-${loc.code}`
12699
+ ))
12700
+ ]
12701
+ },
12702
+ `lrow-${ptKey}`
12703
+ );
12704
+ })
12705
+ ]
12706
+ }
12707
+ )
12708
+ ] });
12709
+ })(),
12710
+ (activeQ.type === "nps" || activeQ.type === "likert_scale" && !(activeQ.scaleLabels && Object.keys(activeQ.scaleLabels).length > 0)) && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9710
12711
  /* @__PURE__ */ jsxRuntime.jsx(
9711
12712
  "div",
9712
12713
  {
@@ -10535,6 +13536,14 @@ const SurveyStudioModal = ({
10535
13536
  ]
10536
13537
  }
10537
13538
  ),
13539
+ tab === "preview" && /* @__PURE__ */ jsxRuntime.jsx(
13540
+ SurveyLivePreviewPane,
13541
+ {
13542
+ draft,
13543
+ uiLocale,
13544
+ strapiLocales
13545
+ }
13546
+ ),
10538
13547
  tab === "analytics" && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, padding: 20, overflowY: "auto", background: "#f8fafc" }, children: /* @__PURE__ */ jsxRuntime.jsx(SurveyAnalyticsView, { surveySlugOrId: draft.slug, uiLocale }) })
10539
13548
  ]
10540
13549
  }
@@ -10707,15 +13716,15 @@ const SurveyWidgetEditor = ({ widget, onChange }) => {
10707
13716
  type: "button",
10708
13717
  onClick: () => {
10709
13718
  setStudioTarget(matchedSurvey || createBlankSurveyDraft(locale));
10710
- setStudioInitialTab("analytics");
13719
+ setStudioInitialTab("preview");
10711
13720
  setStudioOpen(true);
10712
13721
  },
10713
13722
  style: {
10714
13723
  padding: "7px 10px",
10715
13724
  borderRadius: 6,
10716
- border: "1px solid #059669",
10717
- background: "#ecfdf5",
10718
- color: "#065f46",
13725
+ border: "1px solid #2563eb",
13726
+ background: "#eff6ff",
13727
+ color: "#1d4ed8",
10719
13728
  fontSize: 11,
10720
13729
  fontWeight: 700,
10721
13730
  cursor: "pointer",
@@ -10725,34 +13734,63 @@ const SurveyWidgetEditor = ({ widget, onChange }) => {
10725
13734
  gap: 5
10726
13735
  },
10727
13736
  children: [
10728
- /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "bar_chart", size: 15, color: "#059669" }),
10729
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Raporları Gör" : "View Reports" })
13737
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "play_circle", size: 15, color: "#2563eb" }),
13738
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Akışı Önizle" : "Preview Flow" })
10730
13739
  ]
10731
13740
  }
10732
13741
  ),
10733
- /* @__PURE__ */ jsxRuntime.jsx(
13742
+ /* @__PURE__ */ jsxRuntime.jsxs(
10734
13743
  "button",
10735
13744
  {
10736
13745
  type: "button",
10737
13746
  onClick: () => {
10738
- setStudioTarget(createBlankSurveyDraft(locale));
10739
- setStudioInitialTab("builder");
13747
+ setStudioTarget(matchedSurvey || createBlankSurveyDraft(locale));
13748
+ setStudioInitialTab("analytics");
10740
13749
  setStudioOpen(true);
10741
13750
  },
10742
13751
  style: {
10743
13752
  padding: "7px 10px",
10744
13753
  borderRadius: 6,
10745
- border: "1px solid #cbd5e1",
10746
- background: "#ffffff",
10747
- color: "#334155",
13754
+ border: "1px solid #059669",
13755
+ background: "#ecfdf5",
13756
+ color: "#065f46",
10748
13757
  fontSize: 11,
10749
13758
  fontWeight: 700,
10750
- cursor: "pointer"
13759
+ cursor: "pointer",
13760
+ display: "inline-flex",
13761
+ alignItems: "center",
13762
+ justifyContent: "center",
13763
+ gap: 5
10751
13764
  },
10752
- children: tr ? "+ Yeni Anket Yarat" : "+ New Survey"
13765
+ children: [
13766
+ /* @__PURE__ */ jsxRuntime.jsx(index.MaterialIcon, { name: "bar_chart", size: 15, color: "#059669" }),
13767
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tr ? "Raporları Gör" : "View Reports" })
13768
+ ]
10753
13769
  }
10754
13770
  )
10755
- ] })
13771
+ ] }),
13772
+ /* @__PURE__ */ jsxRuntime.jsx(
13773
+ "button",
13774
+ {
13775
+ type: "button",
13776
+ onClick: () => {
13777
+ setStudioTarget(createBlankSurveyDraft(locale));
13778
+ setStudioInitialTab("builder");
13779
+ setStudioOpen(true);
13780
+ },
13781
+ style: {
13782
+ padding: "7px 10px",
13783
+ borderRadius: 6,
13784
+ border: "1px solid #cbd5e1",
13785
+ background: "#ffffff",
13786
+ color: "#334155",
13787
+ fontSize: 11,
13788
+ fontWeight: 700,
13789
+ cursor: "pointer"
13790
+ },
13791
+ children: tr ? "+ Yeni Anket Yarat" : "+ New Survey"
13792
+ }
13793
+ )
10756
13794
  ] }),
10757
13795
  /* @__PURE__ */ jsxRuntime.jsx(
10758
13796
  SurveyStudioModal,
@@ -10785,12 +13823,14 @@ exports.WIDGET_CATEGORIES = WIDGET_CATEGORIES;
10785
13823
  exports.WIDGET_DEFINITIONS = WIDGET_DEFINITIONS;
10786
13824
  exports.WIDTH_PRESETS = WIDTH_PRESETS;
10787
13825
  exports.ZOOM_OPTIONS = ZOOM_OPTIONS;
13826
+ exports.blockCanvasClasses = blockCanvasClasses;
10788
13827
  exports.copyToClipboard = copyToClipboard;
10789
13828
  exports.createBlankSurveyDraft = createBlankSurveyDraft;
10790
13829
  exports.createBlock = createBlock;
10791
13830
  exports.createRow = createRow;
10792
13831
  exports.createWidget = createWidget;
10793
13832
  exports.ensureIds = ensureIds;
13833
+ exports.extractResponsiveProp = extractResponsiveProp;
10794
13834
  exports.getClipboard = getClipboard;
10795
13835
  exports.getDevice = getDevice;
10796
13836
  exports.getDeviceLabel = getDeviceLabel;
@@ -10800,11 +13840,15 @@ exports.getRowPresetLabel = getRowPresetLabel;
10800
13840
  exports.getWidgetDefinition = getWidgetDefinition;
10801
13841
  exports.getWidgetDescription = getWidgetDescription;
10802
13842
  exports.getWidgetLabel = getWidgetLabel;
13843
+ exports.nodeCanvasStyles = nodeCanvasStyles;
10803
13844
  exports.normalizeLocalizedRecord = normalizeLocalizedRecord;
10804
13845
  exports.normalizeOptionListByLocales = normalizeOptionListByLocales;
10805
13846
  exports.persistLocale = persistLocale;
10806
13847
  exports.pickTextForLocale = pickTextForLocale;
10807
13848
  exports.resolveAdminMediaUrl = resolveAdminMediaUrl;
13849
+ exports.resolveCanvasMediaUrl = resolveCanvasMediaUrl;
13850
+ exports.rowCanvasClasses = rowCanvasClasses;
13851
+ exports.setResponsiveProp = setResponsiveProp;
10808
13852
  exports.uid = uid;
10809
13853
  exports.useColorCodes = useColorCodes;
10810
13854
  exports.useEditorContext = useEditorContext;