@ozguraltan/strapi-content-input 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import React, { useState, useMemo, useRef, createContext, useContext, useEffect, useCallback } from "react";
3
3
  import ReactDOM, { createPortal } from "react-dom";
4
+ import { M as MaterialIcon } from "./index-CStmbvTw.mjs";
4
5
  import { useFetchClient, useStrapiApp } from "@strapi/strapi/admin";
5
- import { M as MaterialIcon } from "./index-DSDcG4QW.mjs";
6
6
  import cloneDeep from "lodash/cloneDeep";
7
7
  const ROW_PRESETS = [
8
8
  {
@@ -7269,6 +7269,2411 @@ const ColorCodesModal = ({
7269
7269
  document.body
7270
7270
  );
7271
7271
  };
7272
+ const CORPORATE_COLOR_PRESETS = [
7273
+ { hex: "#1E3A8A", tr: "Kurumsal Lacivert", en: "Corporate Navy" },
7274
+ { hex: "#059669", tr: "Zümrüt Yeşili", en: "Executive Emerald" },
7275
+ { hex: "#4F46E5", tr: "Modern İndigo", en: "Modern Indigo" },
7276
+ { hex: "#0F766E", tr: "Okyanus Turkuaz", en: "Deep Teal" },
7277
+ { hex: "#B45309", tr: "Kehribar Altın", en: "Warm Amber" },
7278
+ { hex: "#BE123C", tr: "Koyu Yakut", en: "Crimson Rose" },
7279
+ { hex: "#0F172A", tr: "Antrasit Koyu", en: "Slate Charcoal" }
7280
+ ];
7281
+ const SLICE_PALETTE = [
7282
+ "#2563EB",
7283
+ "#059669",
7284
+ "#D97706",
7285
+ "#7C3AED",
7286
+ "#DB2777",
7287
+ "#0891B2",
7288
+ "#4F46E5",
7289
+ "#EA580C",
7290
+ "#65A30D",
7291
+ "#64748B"
7292
+ ];
7293
+ function normalizeHex(raw, fallback = "#1E3A8A") {
7294
+ const clean = String(raw || "").trim().replace(/^#/, "");
7295
+ if (/^[0-9a-fA-F]{6}$/.test(clean)) return `#${clean.toUpperCase()}`;
7296
+ if (/^[0-9a-fA-F]{3}$/.test(clean)) {
7297
+ return `#${clean[0]}${clean[0]}${clean[1]}${clean[1]}${clean[2]}${clean[2]}`.toUpperCase();
7298
+ }
7299
+ return fallback;
7300
+ }
7301
+ function hexWithAlpha(hex, alpha) {
7302
+ const h = normalizeHex(hex).slice(1);
7303
+ const r = parseInt(h.slice(0, 2), 16);
7304
+ const g = parseInt(h.slice(2, 4), 16);
7305
+ const b = parseInt(h.slice(4, 6), 16);
7306
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
7307
+ }
7308
+ function inferDefaultChartKind(qType, displayMode) {
7309
+ if (qType === "nps" || qType === "star_rating" || qType === "likert_scale" || qType === "matrix_single") {
7310
+ return "col";
7311
+ }
7312
+ if (qType === "single_choice" && displayMode === "quick_poll") {
7313
+ return "doughnut";
7314
+ }
7315
+ if (qType === "single_choice" || qType === "multiple_choice" || qType === "dropdown" || qType === "image_choice" || qType === "ranking") {
7316
+ return "bar";
7317
+ }
7318
+ return "none";
7319
+ }
7320
+ function isChartableQuestionType(qType) {
7321
+ return ![
7322
+ "short_text",
7323
+ "long_text",
7324
+ "statement",
7325
+ "consent"
7326
+ ].includes(qType);
7327
+ }
7328
+ function extractChartPreviewItems(qs, locale, tr) {
7329
+ const items = [];
7330
+ if (Array.isArray(qs.optionsBreakdown)) {
7331
+ for (const opt of qs.optionsBreakdown) {
7332
+ const isNa = opt.id === "__na__" || Boolean(opt.isNoOpinion);
7333
+ const lbl = opt.id === "__other__" ? tr ? "Diğer" : "Other" : pickTextForLocale(opt.labels, locale, opt.id);
7334
+ items.push({
7335
+ label: lbl,
7336
+ count: Number(opt.count || 0),
7337
+ pct: Number(opt.percentage || 0),
7338
+ isNoOpinion: isNa
7339
+ });
7340
+ }
7341
+ return items;
7342
+ }
7343
+ if (Array.isArray(qs.distribution)) {
7344
+ for (const d of qs.distribution) {
7345
+ const sub = d.labels ? pickTextForLocale(d.labels, locale, "") : "";
7346
+ items.push({
7347
+ label: sub ? `${d.value} - ${sub}` : String(d.value),
7348
+ count: Number(d.count || 0),
7349
+ pct: Number(d.percentage || 0)
7350
+ });
7351
+ }
7352
+ if (qs.allowNoOpinion || qs.noOpinionCount && qs.noOpinionCount > 0) {
7353
+ items.push({
7354
+ label: pickTextForLocale(
7355
+ qs.noOpinionLabels,
7356
+ locale,
7357
+ tr ? "Fikrim yok" : "No idea"
7358
+ ),
7359
+ count: Number(qs.noOpinionCount || 0),
7360
+ pct: Number(qs.noOpinionPercentage || 0),
7361
+ isNoOpinion: true
7362
+ });
7363
+ }
7364
+ return items;
7365
+ }
7366
+ if (Array.isArray(qs.rankingBreakdown)) {
7367
+ for (const rk of qs.rankingBreakdown) {
7368
+ items.push({
7369
+ label: pickTextForLocale(rk.labels, locale, rk.id),
7370
+ count: Number(rk.scorePercentage || 0),
7371
+ pct: Number(rk.scorePercentage || 0)
7372
+ });
7373
+ }
7374
+ return items;
7375
+ }
7376
+ if (qs.type === "matrix_single" && Array.isArray(qs.rowsBreakdown)) {
7377
+ for (const row of qs.rowsBreakdown) {
7378
+ const topCol = Array.isArray(row.columns) ? [...row.columns].sort((a, b) => (b.count || 0) - (a.count || 0))[0] : null;
7379
+ items.push({
7380
+ label: pickTextForLocale(row.labels, locale, row.rowId),
7381
+ count: Number(topCol?.count || row.total || 0),
7382
+ pct: Number(topCol?.percentage || 0)
7383
+ });
7384
+ }
7385
+ return items;
7386
+ }
7387
+ return items;
7388
+ }
7389
+ const ExcelReportStudioModal = ({
7390
+ open,
7391
+ onClose,
7392
+ surveySlugOrId,
7393
+ analytics,
7394
+ dateFrom,
7395
+ dateTo,
7396
+ uiLocale = "en"
7397
+ }) => {
7398
+ const tr = String(uiLocale).toLowerCase().startsWith("tr");
7399
+ const { get, post } = useFetchClient();
7400
+ const { activePalette, tokens } = useColorCodes();
7401
+ const surveyObj = analytics?.survey || {};
7402
+ const summary = analytics?.summary || {};
7403
+ const questionStats = Array.isArray(analytics?.questionStats) ? analytics.questionStats : [];
7404
+ const [reportTitle, setReportTitle] = useState("");
7405
+ const [executiveNote, setExecutiveNote] = useState("");
7406
+ const [themeColor, setThemeColor] = useState("#1E3A8A");
7407
+ const [includeTrendChart, setIncludeTrendChart] = useState(true);
7408
+ const [includeDataBars, setIncludeDataBars] = useState(true);
7409
+ const [includeRawSheet, setIncludeRawSheet] = useState(true);
7410
+ const [questionOverrides, setQuestionOverrides] = useState({});
7411
+ const [activeSheet, setActiveSheet] = useState(
7412
+ "dashboard"
7413
+ );
7414
+ const [selectedFormulaHint, setSelectedFormulaHint] = useState("");
7415
+ const [rawSampleRows, setRawSampleRows] = useState([]);
7416
+ const [loadingRawSample, setLoadingRawSample] = useState(false);
7417
+ const [downloading, setDownloading] = useState(false);
7418
+ const [errorMsg, setErrorMsg] = useState("");
7419
+ useEffect(() => {
7420
+ if (!open) return;
7421
+ const defaultTitle = pickTextForLocale(
7422
+ surveyObj.titleI18n,
7423
+ uiLocale,
7424
+ surveyObj.title || surveySlugOrId
7425
+ );
7426
+ setReportTitle(defaultTitle);
7427
+ setExecutiveNote("");
7428
+ const brandHex = activePalette?.semanticTokens?.primary?.hex;
7429
+ setThemeColor(normalizeHex(brandHex || "#1E3A8A"));
7430
+ setIncludeTrendChart(true);
7431
+ setIncludeDataBars(true);
7432
+ setIncludeRawSheet(true);
7433
+ setActiveSheet("dashboard");
7434
+ setErrorMsg("");
7435
+ const initOverrides = {};
7436
+ for (const qs of questionStats) {
7437
+ const qTitle = pickTextForLocale(qs.title, uiLocale, qs.key);
7438
+ initOverrides[qs.key] = {
7439
+ included: true,
7440
+ chartType: inferDefaultChartKind(qs.type, surveyObj.displayMode),
7441
+ customTitle: qTitle
7442
+ };
7443
+ }
7444
+ setQuestionOverrides(initOverrides);
7445
+ setSelectedFormulaHint(
7446
+ tr ? `='2_Ozet_Istatistik'!$B$6:$C$10 (Gerçek OOXML Hücre Bağlantılı Grafik)` : `='2_Summary_Stats'!$B$6:$C$10 (Live Cell-Linked Native OOXML Chart)`
7447
+ );
7448
+ }, [open, surveySlugOrId]);
7449
+ useEffect(() => {
7450
+ if (!includeRawSheet && activeSheet === "raw") {
7451
+ setActiveSheet("dashboard");
7452
+ }
7453
+ }, [includeRawSheet, activeSheet]);
7454
+ useEffect(() => {
7455
+ if (!open || activeSheet !== "raw" || !surveySlugOrId) return;
7456
+ let cancelled = false;
7457
+ (async () => {
7458
+ setLoadingRawSample(true);
7459
+ try {
7460
+ const res = await get(
7461
+ `/content-input/surveys/${encodeURIComponent(surveySlugOrId)}/responses?limit=25`
7462
+ );
7463
+ if (!cancelled) {
7464
+ setRawSampleRows(Array.isArray(res?.data) ? res.data : []);
7465
+ }
7466
+ } catch {
7467
+ if (!cancelled) setRawSampleRows([]);
7468
+ } finally {
7469
+ if (!cancelled) setLoadingRawSample(false);
7470
+ }
7471
+ })();
7472
+ return () => {
7473
+ cancelled = true;
7474
+ };
7475
+ }, [open, activeSheet, surveySlugOrId, get]);
7476
+ const paletteSwatches = useMemo(() => {
7477
+ const seen = /* @__PURE__ */ new Set();
7478
+ const list = [];
7479
+ for (const tok of tokens.slice(0, 6)) {
7480
+ if (["primary", "secondary", "accent", "success", "info"].includes(tok.key) || tok.isCustom) {
7481
+ const h = normalizeHex(tok.hex, "");
7482
+ if (h && !seen.has(h)) {
7483
+ seen.add(h);
7484
+ list.push({
7485
+ hex: h,
7486
+ label: `${pickTextForLocale(tok.labels, uiLocale, tok.key)} (Color Codes)`,
7487
+ isBrand: true
7488
+ });
7489
+ }
7490
+ }
7491
+ }
7492
+ for (const p of CORPORATE_COLOR_PRESETS) {
7493
+ const h = normalizeHex(p.hex);
7494
+ if (!seen.has(h)) {
7495
+ seen.add(h);
7496
+ list.push({ hex: h, label: tr ? p.tr : p.en });
7497
+ }
7498
+ }
7499
+ return list;
7500
+ }, [tokens, uiLocale, tr]);
7501
+ const updateQuestionOverride = (qKey, patch) => {
7502
+ setQuestionOverrides((prev) => {
7503
+ const cur = prev[qKey] || {
7504
+ included: true,
7505
+ chartType: "bar",
7506
+ customTitle: qKey
7507
+ };
7508
+ return {
7509
+ ...prev,
7510
+ [qKey]: { ...cur, ...patch }
7511
+ };
7512
+ });
7513
+ };
7514
+ const handleDownloadCustomXlsx = async () => {
7515
+ if (!surveySlugOrId) return;
7516
+ setDownloading(true);
7517
+ setErrorMsg("");
7518
+ try {
7519
+ const payload = {
7520
+ format: "xlsx",
7521
+ locale: uiLocale,
7522
+ encoding: "base64",
7523
+ ...dateFrom ? { from: dateFrom } : {},
7524
+ ...dateTo ? { to: dateTo } : {},
7525
+ reportTitle,
7526
+ executiveNote,
7527
+ themeColor: normalizeHex(themeColor),
7528
+ includeTrendChart,
7529
+ includeDataBars,
7530
+ includeRawSheet,
7531
+ questionOverrides
7532
+ };
7533
+ let filePayload = null;
7534
+ try {
7535
+ const res = await post(
7536
+ `/content-input/surveys/${encodeURIComponent(
7537
+ surveySlugOrId
7538
+ )}/export?encoding=base64&format=xlsx&locale=${encodeURIComponent(uiLocale)}`,
7539
+ payload
7540
+ );
7541
+ filePayload = res?.data;
7542
+ } catch {
7543
+ const qs = new URLSearchParams({
7544
+ format: "xlsx",
7545
+ locale: uiLocale,
7546
+ encoding: "base64"
7547
+ });
7548
+ if (dateFrom) qs.set("from", dateFrom);
7549
+ if (dateTo) qs.set("to", dateTo);
7550
+ const fallbackRes = await get(
7551
+ `/content-input/surveys/${encodeURIComponent(
7552
+ surveySlugOrId
7553
+ )}/export?${qs.toString()}`
7554
+ );
7555
+ filePayload = fallbackRes?.data;
7556
+ }
7557
+ if (!filePayload?.base64) {
7558
+ throw new Error(
7559
+ tr ? "Excel çıktısı oluşturulamadı. Strapi sunucusunu yeniden başlattığınızdan emin olun." : "Failed to generate Excel workbook. Ensure Strapi backend is up to date."
7560
+ );
7561
+ }
7562
+ const binStr = window.atob(String(filePayload.base64));
7563
+ const bytes = new Uint8Array(binStr.length);
7564
+ for (let i = 0; i < binStr.length; i++) {
7565
+ bytes[i] = binStr.charCodeAt(i);
7566
+ }
7567
+ const blob = new Blob([bytes], {
7568
+ type: filePayload.contentType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
7569
+ });
7570
+ const dlUrl = URL.createObjectURL(blob);
7571
+ const a = document.createElement("a");
7572
+ a.href = dlUrl;
7573
+ a.download = filePayload.filename || `${surveySlugOrId}-executive-report.xlsx`;
7574
+ document.body.appendChild(a);
7575
+ a.click();
7576
+ document.body.removeChild(a);
7577
+ URL.revokeObjectURL(dlUrl);
7578
+ } catch (err) {
7579
+ setErrorMsg(
7580
+ err?.message || (tr ? "Excel indirme sırasında hata oluştu." : "Excel export failed.")
7581
+ );
7582
+ } finally {
7583
+ setDownloading(false);
7584
+ }
7585
+ };
7586
+ if (!open || typeof document === "undefined") return null;
7587
+ const primaryHex = normalizeHex(themeColor);
7588
+ const statsSheetTabName = tr ? "2_Ozet_Istatistik" : "2_Summary_Stats";
7589
+ const rawSheetTabName = tr ? "3_Ham_Yanitlar" : "3_Raw_Responses";
7590
+ const dailyTrend = Array.isArray(
7591
+ summary.dailyTrend
7592
+ ) ? summary.dailyTrend : [];
7593
+ const npsInfo = summary.nps || { hasNps: false };
7594
+ const activeQuestionCharts = questionStats.filter((qs) => {
7595
+ const ov = questionOverrides[qs.key];
7596
+ const included = ov ? ov.included : true;
7597
+ const kind = ov ? ov.chartType : inferDefaultChartKind(qs.type, surveyObj.displayMode);
7598
+ return included && kind !== "none" && isChartableQuestionType(qs.type);
7599
+ });
7600
+ const includedQuestionTables = questionStats.filter((qs) => {
7601
+ const ov = questionOverrides[qs.key];
7602
+ return ov ? ov.included : true;
7603
+ });
7604
+ return createPortal(
7605
+ /* @__PURE__ */ jsx(
7606
+ "div",
7607
+ {
7608
+ onClick: onClose,
7609
+ style: {
7610
+ position: "fixed",
7611
+ inset: 0,
7612
+ zIndex: 10050,
7613
+ background: "rgba(15, 23, 42, 0.62)",
7614
+ backdropFilter: "blur(3px)",
7615
+ display: "flex",
7616
+ alignItems: "center",
7617
+ justifyContent: "center",
7618
+ padding: 20
7619
+ },
7620
+ children: /* @__PURE__ */ jsxs(
7621
+ "div",
7622
+ {
7623
+ onClick: (e) => e.stopPropagation(),
7624
+ style: {
7625
+ width: "min(1440px, 97vw)",
7626
+ height: "min(900px, 93vh)",
7627
+ background: "#ffffff",
7628
+ color: "#0f172a",
7629
+ colorScheme: "light",
7630
+ fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
7631
+ borderRadius: 16,
7632
+ boxShadow: "0 25px 60px rgba(15, 23, 42, 0.35)",
7633
+ border: "1px solid #cbd5e1",
7634
+ display: "flex",
7635
+ flexDirection: "column",
7636
+ overflow: "hidden"
7637
+ },
7638
+ children: [
7639
+ /* @__PURE__ */ jsxs(
7640
+ "div",
7641
+ {
7642
+ style: {
7643
+ padding: "13px 20px",
7644
+ background: "#0f172a",
7645
+ color: "#ffffff",
7646
+ display: "flex",
7647
+ alignItems: "center",
7648
+ justifyContent: "space-between",
7649
+ gap: 12,
7650
+ flexShrink: 0
7651
+ },
7652
+ children: [
7653
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 11 }, children: [
7654
+ /* @__PURE__ */ jsx(
7655
+ "div",
7656
+ {
7657
+ style: {
7658
+ width: 36,
7659
+ height: 36,
7660
+ borderRadius: 9,
7661
+ background: "#059669",
7662
+ display: "inline-flex",
7663
+ alignItems: "center",
7664
+ justifyContent: "center"
7665
+ },
7666
+ children: /* @__PURE__ */ jsx(MaterialIcon, { name: "bar_chart", size: 20, color: "#ffffff" })
7667
+ }
7668
+ ),
7669
+ /* @__PURE__ */ jsxs("div", { children: [
7670
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
7671
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 15, fontWeight: 800 }, children: tr ? "Excel Rapor Stüdyosu — Canlı Önizleme & Grafik Tasarımcısı" : "Excel Report Studio — Live Workbook Preview & Chart Designer" }),
7672
+ /* @__PURE__ */ jsx(
7673
+ "span",
7674
+ {
7675
+ style: {
7676
+ fontSize: 10,
7677
+ fontWeight: 800,
7678
+ padding: "2px 8px",
7679
+ borderRadius: 999,
7680
+ background: "rgba(16, 185, 129, 0.2)",
7681
+ color: "#6ee7b7",
7682
+ border: "1px solid rgba(16, 185, 129, 0.35)"
7683
+ },
7684
+ children: tr ? "Gerçek OOXML Grafik • Sıfır zlib" : "Native OOXML Charts • Zero zlib"
7685
+ }
7686
+ )
7687
+ ] }),
7688
+ /* @__PURE__ */ jsx("div", { style: { fontSize: 11.5, color: "#94a3b8", marginTop: 1 }, children: tr ? "Başlıkları, kurumsal renk temasını ve soru bazlı Excel grafik tiplerini doküman üzerinde canlı görerek düzenleyin." : "Customize report titles, brand colors, and native Excel chart types with instant visual workbook preview." })
7689
+ ] })
7690
+ ] }),
7691
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
7692
+ /* @__PURE__ */ jsxs(
7693
+ "button",
7694
+ {
7695
+ type: "button",
7696
+ onClick: handleDownloadCustomXlsx,
7697
+ disabled: downloading,
7698
+ style: {
7699
+ padding: "8px 16px",
7700
+ borderRadius: 8,
7701
+ border: "1px solid #10b981",
7702
+ background: "#059669",
7703
+ color: "#ffffff",
7704
+ fontSize: 12.5,
7705
+ fontWeight: 800,
7706
+ cursor: downloading ? "wait" : "pointer",
7707
+ display: "inline-flex",
7708
+ alignItems: "center",
7709
+ gap: 7,
7710
+ boxShadow: "0 4px 12px rgba(5, 150, 105, 0.35)"
7711
+ },
7712
+ children: [
7713
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "download", size: 16, color: "#ffffff" }),
7714
+ /* @__PURE__ */ jsx("span", { children: downloading ? tr ? "Excel Hazırlanıyor..." : "Generating .xlsx..." : tr ? "Bu Tasarımla Excel (.xlsx) İndir" : "Download Custom Excel (.xlsx)" })
7715
+ ]
7716
+ }
7717
+ ),
7718
+ /* @__PURE__ */ jsxs(
7719
+ "button",
7720
+ {
7721
+ type: "button",
7722
+ onClick: onClose,
7723
+ style: {
7724
+ padding: "7px 12px",
7725
+ borderRadius: 8,
7726
+ border: "1px solid #334155",
7727
+ background: "#1e293b",
7728
+ color: "#cbd5e1",
7729
+ fontSize: 12,
7730
+ fontWeight: 700,
7731
+ cursor: "pointer"
7732
+ },
7733
+ children: [
7734
+ "✕ ",
7735
+ tr ? "Kapat" : "Close"
7736
+ ]
7737
+ }
7738
+ )
7739
+ ] })
7740
+ ]
7741
+ }
7742
+ ),
7743
+ errorMsg && /* @__PURE__ */ jsxs(
7744
+ "div",
7745
+ {
7746
+ style: {
7747
+ padding: "8px 20px",
7748
+ background: "#fef2f2",
7749
+ borderBottom: "1px solid #fecaca",
7750
+ color: "#dc2626",
7751
+ fontSize: 12,
7752
+ fontWeight: 700
7753
+ },
7754
+ children: [
7755
+ "⚠ ",
7756
+ errorMsg
7757
+ ]
7758
+ }
7759
+ ),
7760
+ /* @__PURE__ */ jsxs(
7761
+ "div",
7762
+ {
7763
+ style: {
7764
+ flex: 1,
7765
+ display: "grid",
7766
+ gridTemplateColumns: "380px 1fr",
7767
+ minHeight: 0,
7768
+ background: "#f1f5f9"
7769
+ },
7770
+ children: [
7771
+ /* @__PURE__ */ jsxs(
7772
+ "div",
7773
+ {
7774
+ style: {
7775
+ background: "#ffffff",
7776
+ borderRight: "1px solid #cbd5e1",
7777
+ overflowY: "auto",
7778
+ padding: 16,
7779
+ display: "flex",
7780
+ flexDirection: "column",
7781
+ gap: 16
7782
+ },
7783
+ children: [
7784
+ /* @__PURE__ */ jsxs(
7785
+ "div",
7786
+ {
7787
+ style: {
7788
+ padding: 13,
7789
+ borderRadius: 10,
7790
+ border: "1px solid #e2e8f0",
7791
+ background: "#f8fafc",
7792
+ display: "flex",
7793
+ flexDirection: "column",
7794
+ gap: 10
7795
+ },
7796
+ children: [
7797
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: 12, fontWeight: 800, color: "#0f172a" }, children: [
7798
+ "1. ",
7799
+ tr ? "Kapak Başlığı & Yönetici Notu" : "Report Banner & Executive Note"
7800
+ ] }),
7801
+ /* @__PURE__ */ jsxs("div", { children: [
7802
+ /* @__PURE__ */ jsx(
7803
+ "label",
7804
+ {
7805
+ style: {
7806
+ display: "block",
7807
+ fontSize: 11,
7808
+ fontWeight: 700,
7809
+ color: "#475569",
7810
+ marginBottom: 4
7811
+ },
7812
+ children: tr ? "Rapor Kapak Başlığı" : "Report Banner Title"
7813
+ }
7814
+ ),
7815
+ /* @__PURE__ */ jsx(
7816
+ "input",
7817
+ {
7818
+ type: "text",
7819
+ value: reportTitle,
7820
+ onChange: (e) => setReportTitle(e.target.value),
7821
+ placeholder: tr ? "Anket Yönetici Raporu..." : "Executive Survey Report...",
7822
+ style: {
7823
+ width: "100%",
7824
+ padding: "7px 10px",
7825
+ fontSize: 12,
7826
+ borderRadius: 6,
7827
+ border: "1px solid #cbd5e1",
7828
+ color: "#0f172a",
7829
+ background: "#ffffff"
7830
+ }
7831
+ }
7832
+ )
7833
+ ] }),
7834
+ /* @__PURE__ */ jsxs("div", { children: [
7835
+ /* @__PURE__ */ jsx(
7836
+ "label",
7837
+ {
7838
+ style: {
7839
+ display: "block",
7840
+ fontSize: 11,
7841
+ fontWeight: 700,
7842
+ color: "#475569",
7843
+ marginBottom: 4
7844
+ },
7845
+ children: tr ? "Yönetici Özeti / Değerlendirme Notu (İsteğe Bağlı)" : "Executive Summary Note (Optional)"
7846
+ }
7847
+ ),
7848
+ /* @__PURE__ */ jsx(
7849
+ "textarea",
7850
+ {
7851
+ rows: 2,
7852
+ value: executiveNote,
7853
+ onChange: (e) => setExecutiveNote(e.target.value),
7854
+ placeholder: tr ? "Örn: Q4 müşteri memnuniyeti hedeflerinin %12 üzerinde gerçekleşmiştir..." : "e.g. Q4 customer satisfaction exceeded target benchmarks by 12%...",
7855
+ style: {
7856
+ width: "100%",
7857
+ padding: "7px 10px",
7858
+ fontSize: 12,
7859
+ borderRadius: 6,
7860
+ border: "1px solid #cbd5e1",
7861
+ color: "#0f172a",
7862
+ background: "#ffffff",
7863
+ resize: "vertical"
7864
+ }
7865
+ }
7866
+ )
7867
+ ] })
7868
+ ]
7869
+ }
7870
+ ),
7871
+ /* @__PURE__ */ jsxs(
7872
+ "div",
7873
+ {
7874
+ style: {
7875
+ padding: 13,
7876
+ borderRadius: 10,
7877
+ border: "1px solid #e2e8f0",
7878
+ background: "#f8fafc",
7879
+ display: "flex",
7880
+ flexDirection: "column",
7881
+ gap: 9
7882
+ },
7883
+ children: [
7884
+ /* @__PURE__ */ jsxs(
7885
+ "div",
7886
+ {
7887
+ style: {
7888
+ display: "flex",
7889
+ alignItems: "center",
7890
+ justifyContent: "space-between"
7891
+ },
7892
+ children: [
7893
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 12, fontWeight: 800, color: "#0f172a" }, children: [
7894
+ "2. ",
7895
+ tr ? "Kurumsal Renk Teması" : "Brand Theme Color"
7896
+ ] }),
7897
+ activePalette?.name && /* @__PURE__ */ jsx("span", { style: { fontSize: 10, fontWeight: 700, color: "#64748b" }, children: activePalette.name })
7898
+ ]
7899
+ }
7900
+ ),
7901
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 7 }, children: paletteSwatches.map((sw) => {
7902
+ const selected = normalizeHex(themeColor) === sw.hex;
7903
+ return /* @__PURE__ */ jsx(
7904
+ "button",
7905
+ {
7906
+ type: "button",
7907
+ title: `${sw.label} (${sw.hex})`,
7908
+ onClick: () => setThemeColor(sw.hex),
7909
+ style: {
7910
+ width: 26,
7911
+ height: 26,
7912
+ borderRadius: 7,
7913
+ background: sw.hex,
7914
+ border: selected ? "2.5px solid #0f172a" : "1.5px solid rgba(15,23,42,0.18)",
7915
+ boxShadow: selected ? "0 0 0 2px #ffffff inset" : "none",
7916
+ cursor: "pointer",
7917
+ position: "relative"
7918
+ }
7919
+ },
7920
+ sw.hex
7921
+ );
7922
+ }) }),
7923
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, marginTop: 2 }, children: [
7924
+ /* @__PURE__ */ jsx(
7925
+ "input",
7926
+ {
7927
+ type: "color",
7928
+ value: primaryHex,
7929
+ onChange: (e) => setThemeColor(e.target.value.toUpperCase()),
7930
+ style: {
7931
+ width: 34,
7932
+ height: 30,
7933
+ padding: 1,
7934
+ border: "1px solid #cbd5e1",
7935
+ borderRadius: 6,
7936
+ background: "#fff",
7937
+ cursor: "pointer"
7938
+ }
7939
+ }
7940
+ ),
7941
+ /* @__PURE__ */ jsx(
7942
+ "input",
7943
+ {
7944
+ type: "text",
7945
+ value: themeColor,
7946
+ onChange: (e) => setThemeColor(e.target.value),
7947
+ style: {
7948
+ flex: 1,
7949
+ padding: "6px 9px",
7950
+ fontSize: 12,
7951
+ fontFamily: "monospace",
7952
+ fontWeight: 700,
7953
+ borderRadius: 6,
7954
+ border: "1px solid #cbd5e1",
7955
+ background: "#ffffff",
7956
+ color: "#0f172a"
7957
+ }
7958
+ }
7959
+ )
7960
+ ] })
7961
+ ]
7962
+ }
7963
+ ),
7964
+ /* @__PURE__ */ jsxs(
7965
+ "div",
7966
+ {
7967
+ style: {
7968
+ padding: 13,
7969
+ borderRadius: 10,
7970
+ border: "1px solid #e2e8f0",
7971
+ background: "#f8fafc",
7972
+ display: "flex",
7973
+ flexDirection: "column",
7974
+ gap: 8
7975
+ },
7976
+ children: [
7977
+ /* @__PURE__ */ jsxs("div", { style: { fontSize: 12, fontWeight: 800, color: "#0f172a" }, children: [
7978
+ "3. ",
7979
+ tr ? "Çalışma Kitabı Katmanları" : "Workbook Layers & Formatting"
7980
+ ] }),
7981
+ /* @__PURE__ */ jsxs(
7982
+ "label",
7983
+ {
7984
+ style: {
7985
+ display: "flex",
7986
+ alignItems: "center",
7987
+ gap: 8,
7988
+ fontSize: 12,
7989
+ color: "#1e293b",
7990
+ cursor: "pointer"
7991
+ },
7992
+ children: [
7993
+ /* @__PURE__ */ jsx(
7994
+ "input",
7995
+ {
7996
+ type: "checkbox",
7997
+ checked: includeTrendChart,
7998
+ onChange: (e) => setIncludeTrendChart(e.target.checked)
7999
+ }
8000
+ ),
8001
+ /* @__PURE__ */ jsx("span", { children: tr ? "30 Günlük Katılım Çizgi Grafiği (<c:lineChart>)" : "30-Day Daily Trend Line Chart (<c:lineChart>)" })
8002
+ ]
8003
+ }
8004
+ ),
8005
+ /* @__PURE__ */ jsxs(
8006
+ "label",
8007
+ {
8008
+ style: {
8009
+ display: "flex",
8010
+ alignItems: "center",
8011
+ gap: 8,
8012
+ fontSize: 12,
8013
+ color: "#1e293b",
8014
+ cursor: "pointer"
8015
+ },
8016
+ children: [
8017
+ /* @__PURE__ */ jsx(
8018
+ "input",
8019
+ {
8020
+ type: "checkbox",
8021
+ checked: includeDataBars,
8022
+ onChange: (e) => setIncludeDataBars(e.target.checked)
8023
+ }
8024
+ ),
8025
+ /* @__PURE__ */ jsx("span", { children: tr ? "Özet Sekmesinde Veri Çubukları (Data Bars) & Isı Haritası" : "Conditional Data Bars & Matrix Heatmap" })
8026
+ ]
8027
+ }
8028
+ ),
8029
+ /* @__PURE__ */ jsxs(
8030
+ "label",
8031
+ {
8032
+ style: {
8033
+ display: "flex",
8034
+ alignItems: "center",
8035
+ gap: 8,
8036
+ fontSize: 12,
8037
+ color: "#1e293b",
8038
+ cursor: "pointer"
8039
+ },
8040
+ children: [
8041
+ /* @__PURE__ */ jsx(
8042
+ "input",
8043
+ {
8044
+ type: "checkbox",
8045
+ checked: includeRawSheet,
8046
+ onChange: (e) => setIncludeRawSheet(e.target.checked)
8047
+ }
8048
+ ),
8049
+ /* @__PURE__ */ jsx("span", { children: tr ? "3. Sekme: Filtreli Ham Yanıtlar Tablosunu Ekle" : "Include Sheet 3: AutoFiltered Raw Responses" })
8050
+ ]
8051
+ }
8052
+ )
8053
+ ]
8054
+ }
8055
+ ),
8056
+ /* @__PURE__ */ jsxs(
8057
+ "div",
8058
+ {
8059
+ style: {
8060
+ padding: 13,
8061
+ borderRadius: 10,
8062
+ border: "1px solid #e2e8f0",
8063
+ background: "#f8fafc",
8064
+ display: "flex",
8065
+ flexDirection: "column",
8066
+ gap: 10
8067
+ },
8068
+ children: [
8069
+ /* @__PURE__ */ jsxs(
8070
+ "div",
8071
+ {
8072
+ style: {
8073
+ display: "flex",
8074
+ alignItems: "center",
8075
+ justifyContent: "space-between"
8076
+ },
8077
+ children: [
8078
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 12, fontWeight: 800, color: "#0f172a" }, children: [
8079
+ "4. ",
8080
+ tr ? "Soru Bazlı Grafik & Tablo Seçimi" : "Per-Question Charts & Tables"
8081
+ ] }),
8082
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 11, fontWeight: 700, color: "#059669" }, children: [
8083
+ activeQuestionCharts.length,
8084
+ " ",
8085
+ tr ? "grafik" : "charts"
8086
+ ] })
8087
+ ]
8088
+ }
8089
+ ),
8090
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionStats.map((qs, idx) => {
8091
+ const ov = questionOverrides[qs.key] || {
8092
+ included: true,
8093
+ chartType: inferDefaultChartKind(qs.type, surveyObj.displayMode),
8094
+ customTitle: pickTextForLocale(qs.title, uiLocale, qs.key)
8095
+ };
8096
+ const canChart = isChartableQuestionType(qs.type);
8097
+ return /* @__PURE__ */ jsxs(
8098
+ "div",
8099
+ {
8100
+ style: {
8101
+ padding: "9px 10px",
8102
+ borderRadius: 8,
8103
+ background: ov.included ? "#ffffff" : "#f1f5f9",
8104
+ border: ov.included ? "1px solid #cbd5e1" : "1px dashed #cbd5e1",
8105
+ opacity: ov.included ? 1 : 0.65,
8106
+ display: "flex",
8107
+ flexDirection: "column",
8108
+ gap: 6
8109
+ },
8110
+ children: [
8111
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
8112
+ /* @__PURE__ */ jsx(
8113
+ "input",
8114
+ {
8115
+ type: "checkbox",
8116
+ checked: ov.included,
8117
+ onChange: (e) => updateQuestionOverride(qs.key, { included: e.target.checked })
8118
+ }
8119
+ ),
8120
+ /* @__PURE__ */ jsxs(
8121
+ "span",
8122
+ {
8123
+ style: {
8124
+ fontSize: 10.5,
8125
+ fontWeight: 800,
8126
+ color: "#64748b",
8127
+ flexShrink: 0
8128
+ },
8129
+ children: [
8130
+ "S",
8131
+ idx + 1
8132
+ ]
8133
+ }
8134
+ ),
8135
+ /* @__PURE__ */ jsx(
8136
+ "input",
8137
+ {
8138
+ type: "text",
8139
+ value: ov.customTitle,
8140
+ disabled: !ov.included,
8141
+ onChange: (e) => updateQuestionOverride(qs.key, { customTitle: e.target.value }),
8142
+ style: {
8143
+ flex: 1,
8144
+ minWidth: 0,
8145
+ padding: "3px 6px",
8146
+ fontSize: 11.5,
8147
+ fontWeight: 700,
8148
+ borderRadius: 5,
8149
+ border: "1px solid #e2e8f0",
8150
+ color: "#0f172a",
8151
+ background: ov.included ? "#fff" : "transparent"
8152
+ }
8153
+ }
8154
+ )
8155
+ ] }),
8156
+ ov.included && canChart && /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 4, paddingLeft: 20 }, children: [
8157
+ { id: "bar", tr: "Yatay Bar", en: "Bar" },
8158
+ { id: "col", tr: "Dikey Sütun", en: "Column" },
8159
+ { id: "doughnut", tr: "Halka", en: "Doughnut" },
8160
+ { id: "none", tr: "Sadece Tablo", en: "Table Only" }
8161
+ ].map((opt) => {
8162
+ const active = ov.chartType === opt.id;
8163
+ return /* @__PURE__ */ jsx(
8164
+ "button",
8165
+ {
8166
+ type: "button",
8167
+ onClick: () => updateQuestionOverride(qs.key, { chartType: opt.id }),
8168
+ style: {
8169
+ flex: 1,
8170
+ padding: "3px 4px",
8171
+ fontSize: 10,
8172
+ fontWeight: 700,
8173
+ borderRadius: 5,
8174
+ border: active ? `1px solid ${primaryHex}` : "1px solid #cbd5e1",
8175
+ background: active ? primaryHex : "#f8fafc",
8176
+ color: active ? "#ffffff" : "#475569",
8177
+ cursor: "pointer"
8178
+ },
8179
+ children: tr ? opt.tr : opt.en
8180
+ },
8181
+ opt.id
8182
+ );
8183
+ }) })
8184
+ ]
8185
+ },
8186
+ qs.key
8187
+ );
8188
+ }) })
8189
+ ]
8190
+ }
8191
+ )
8192
+ ]
8193
+ }
8194
+ ),
8195
+ /* @__PURE__ */ jsxs(
8196
+ "div",
8197
+ {
8198
+ style: {
8199
+ display: "flex",
8200
+ flexDirection: "column",
8201
+ minWidth: 0,
8202
+ minHeight: 0,
8203
+ background: "#e2e8f0"
8204
+ },
8205
+ children: [
8206
+ /* @__PURE__ */ jsxs(
8207
+ "div",
8208
+ {
8209
+ style: {
8210
+ padding: "6px 14px",
8211
+ background: "#f8fafc",
8212
+ borderBottom: "1px solid #cbd5e1",
8213
+ display: "flex",
8214
+ alignItems: "center",
8215
+ gap: 10,
8216
+ fontSize: 11.5,
8217
+ flexShrink: 0
8218
+ },
8219
+ children: [
8220
+ /* @__PURE__ */ jsx(
8221
+ "span",
8222
+ {
8223
+ style: {
8224
+ padding: "2px 8px",
8225
+ borderRadius: 4,
8226
+ background: "#e2e8f0",
8227
+ fontFamily: "monospace",
8228
+ fontWeight: 700,
8229
+ color: "#334155"
8230
+ },
8231
+ children: activeSheet === "dashboard" ? "B2" : activeSheet === "stats" ? "D6" : "A3"
8232
+ }
8233
+ ),
8234
+ /* @__PURE__ */ jsx(
8235
+ "span",
8236
+ {
8237
+ style: {
8238
+ fontStyle: "italic",
8239
+ fontWeight: 800,
8240
+ fontFamily: "serif",
8241
+ color: "#059669",
8242
+ fontSize: 13
8243
+ },
8244
+ children: "fx"
8245
+ }
8246
+ ),
8247
+ /* @__PURE__ */ jsx(
8248
+ "div",
8249
+ {
8250
+ style: {
8251
+ flex: 1,
8252
+ padding: "3px 10px",
8253
+ borderRadius: 4,
8254
+ background: "#ffffff",
8255
+ border: "1px solid #cbd5e1",
8256
+ fontFamily: "monospace",
8257
+ fontSize: 11,
8258
+ color: "#0f172a",
8259
+ overflow: "hidden",
8260
+ textOverflow: "ellipsis",
8261
+ whiteSpace: "nowrap"
8262
+ },
8263
+ children: selectedFormulaHint
8264
+ }
8265
+ )
8266
+ ]
8267
+ }
8268
+ ),
8269
+ /* @__PURE__ */ jsx(
8270
+ "div",
8271
+ {
8272
+ style: {
8273
+ flex: 1,
8274
+ overflow: "auto",
8275
+ padding: 18
8276
+ },
8277
+ children: /* @__PURE__ */ jsxs(
8278
+ "div",
8279
+ {
8280
+ style: {
8281
+ background: "#ffffff",
8282
+ borderRadius: 8,
8283
+ border: "1px solid #cbd5e1",
8284
+ boxShadow: "0 6px 20px rgba(15, 23, 42, 0.06)",
8285
+ overflow: "hidden"
8286
+ },
8287
+ children: [
8288
+ /* @__PURE__ */ jsxs(
8289
+ "div",
8290
+ {
8291
+ style: {
8292
+ display: "grid",
8293
+ gridTemplateColumns: "36px repeat(8, 1fr)",
8294
+ background: "#f1f5f9",
8295
+ borderBottom: "1px solid #cbd5e1",
8296
+ fontSize: 10.5,
8297
+ fontWeight: 700,
8298
+ color: "#64748b",
8299
+ textAlign: "center"
8300
+ },
8301
+ children: [
8302
+ /* @__PURE__ */ jsx("div", { style: { padding: "4px 0", borderRight: "1px solid #cbd5e1" }, children: "◢" }),
8303
+ ["A", "B", "C", "D", "E", "F", "G", "H"].map((col) => /* @__PURE__ */ jsx(
8304
+ "div",
8305
+ {
8306
+ style: { padding: "4px 0", borderRight: "1px solid #e2e8f0" },
8307
+ children: col
8308
+ },
8309
+ col
8310
+ ))
8311
+ ]
8312
+ }
8313
+ ),
8314
+ activeSheet === "dashboard" && /* @__PURE__ */ jsxs("div", { style: { padding: 20, display: "flex", flexDirection: "column", gap: 16 }, children: [
8315
+ /* @__PURE__ */ jsxs(
8316
+ "div",
8317
+ {
8318
+ style: {
8319
+ borderRadius: 8,
8320
+ overflow: "hidden",
8321
+ border: `1px solid ${primaryHex}`
8322
+ },
8323
+ children: [
8324
+ /* @__PURE__ */ jsxs(
8325
+ "div",
8326
+ {
8327
+ style: {
8328
+ background: primaryHex,
8329
+ padding: "12px 16px",
8330
+ display: "flex",
8331
+ alignItems: "center",
8332
+ justifyContent: "space-between",
8333
+ gap: 12
8334
+ },
8335
+ children: [
8336
+ /* @__PURE__ */ jsx(
8337
+ "input",
8338
+ {
8339
+ type: "text",
8340
+ value: reportTitle,
8341
+ onChange: (e) => setReportTitle(e.target.value),
8342
+ title: tr ? "Başlığı doğrudan doküman üzerinde düzenlemek için tıklayın" : "Click to edit banner title directly",
8343
+ style: {
8344
+ flex: 1,
8345
+ background: "transparent",
8346
+ border: "1px dashed rgba(255,255,255,0.35)",
8347
+ borderRadius: 5,
8348
+ padding: "4px 8px",
8349
+ color: "#ffffff",
8350
+ fontSize: 16,
8351
+ fontWeight: 800,
8352
+ outline: "none"
8353
+ }
8354
+ }
8355
+ ),
8356
+ /* @__PURE__ */ jsxs(
8357
+ "span",
8358
+ {
8359
+ style: {
8360
+ fontSize: 10.5,
8361
+ fontWeight: 700,
8362
+ color: "rgba(255,255,255,0.85)",
8363
+ whiteSpace: "nowrap"
8364
+ },
8365
+ children: [
8366
+ "✏️ ",
8367
+ tr ? "Canlı Başlık" : "Editable Title"
8368
+ ]
8369
+ }
8370
+ )
8371
+ ]
8372
+ }
8373
+ ),
8374
+ /* @__PURE__ */ jsxs(
8375
+ "div",
8376
+ {
8377
+ style: {
8378
+ background: hexWithAlpha(primaryHex, 0.12),
8379
+ padding: "7px 16px",
8380
+ fontSize: 11.5,
8381
+ fontWeight: 600,
8382
+ color: "#1e293b",
8383
+ display: "flex",
8384
+ justifyContent: "space-between",
8385
+ flexWrap: "wrap",
8386
+ gap: 8
8387
+ },
8388
+ children: [
8389
+ /* @__PURE__ */ jsxs("span", { children: [
8390
+ "Slug: ",
8391
+ /* @__PURE__ */ jsx("strong", { children: surveyObj.slug || surveySlugOrId }),
8392
+ dateFrom || dateTo ? ` • ${tr ? "Filtre" : "Filter"}: ${dateFrom || "..."} → ${dateTo || "..."}` : ""
8393
+ ] }),
8394
+ /* @__PURE__ */ jsxs("span", { children: [
8395
+ tr ? "Dışa Aktarım" : "Exported",
8396
+ ":",
8397
+ " ",
8398
+ (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
8399
+ ] })
8400
+ ]
8401
+ }
8402
+ )
8403
+ ]
8404
+ }
8405
+ ),
8406
+ /* @__PURE__ */ jsxs(
8407
+ "div",
8408
+ {
8409
+ style: {
8410
+ display: "grid",
8411
+ gridTemplateColumns: "repeat(4, 1fr)",
8412
+ gap: 12
8413
+ },
8414
+ children: [
8415
+ /* @__PURE__ */ jsxs(
8416
+ "div",
8417
+ {
8418
+ style: {
8419
+ padding: "12px 14px",
8420
+ borderRadius: 8,
8421
+ background: hexWithAlpha(primaryHex, 0.06),
8422
+ border: `1px solid ${hexWithAlpha(primaryHex, 0.25)}`
8423
+ },
8424
+ children: [
8425
+ /* @__PURE__ */ jsx(
8426
+ "div",
8427
+ {
8428
+ style: {
8429
+ fontSize: 10,
8430
+ fontWeight: 800,
8431
+ color: "#64748b",
8432
+ textTransform: "uppercase"
8433
+ },
8434
+ children: tr ? "TOPLAM YANIT" : "TOTAL RESPONSES"
8435
+ }
8436
+ ),
8437
+ /* @__PURE__ */ jsx(
8438
+ "div",
8439
+ {
8440
+ style: {
8441
+ fontSize: 22,
8442
+ fontWeight: 800,
8443
+ color: primaryHex,
8444
+ marginTop: 4
8445
+ },
8446
+ children: summary.totalResponses ?? 0
8447
+ }
8448
+ )
8449
+ ]
8450
+ }
8451
+ ),
8452
+ /* @__PURE__ */ jsxs(
8453
+ "div",
8454
+ {
8455
+ style: {
8456
+ padding: "12px 14px",
8457
+ borderRadius: 8,
8458
+ background: hexWithAlpha(primaryHex, 0.06),
8459
+ border: `1px solid ${hexWithAlpha(primaryHex, 0.25)}`
8460
+ },
8461
+ children: [
8462
+ /* @__PURE__ */ jsx(
8463
+ "div",
8464
+ {
8465
+ style: {
8466
+ fontSize: 10,
8467
+ fontWeight: 800,
8468
+ color: "#64748b",
8469
+ textTransform: "uppercase"
8470
+ },
8471
+ children: tr ? "ORT. / MEDYAN SÜRE" : "AVG / MEDIAN TIME"
8472
+ }
8473
+ ),
8474
+ /* @__PURE__ */ jsxs(
8475
+ "div",
8476
+ {
8477
+ style: {
8478
+ fontSize: 20,
8479
+ fontWeight: 800,
8480
+ color: "#0f172a",
8481
+ marginTop: 4
8482
+ },
8483
+ children: [
8484
+ summary.avgDurationSeconds ?? 0,
8485
+ "s",
8486
+ " ",
8487
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 12, color: "#64748b", fontWeight: 600 }, children: [
8488
+ "/ ",
8489
+ summary.medianDurationSeconds ?? 0,
8490
+ "s"
8491
+ ] })
8492
+ ]
8493
+ }
8494
+ )
8495
+ ]
8496
+ }
8497
+ ),
8498
+ /* @__PURE__ */ jsxs(
8499
+ "div",
8500
+ {
8501
+ style: {
8502
+ padding: "12px 14px",
8503
+ borderRadius: 8,
8504
+ background: npsInfo.hasNps ? (npsInfo.score ?? 0) >= 30 ? "#ecfdf5" : (npsInfo.score ?? 0) >= 0 ? "#fffbeb" : "#fef2f2" : "#f8fafc",
8505
+ border: npsInfo.hasNps ? (npsInfo.score ?? 0) >= 30 ? "1px solid #86efac" : (npsInfo.score ?? 0) >= 0 ? "1px solid #fde68a" : "1px solid #fecaca" : "1px solid #e2e8f0"
8506
+ },
8507
+ children: [
8508
+ /* @__PURE__ */ jsx(
8509
+ "div",
8510
+ {
8511
+ style: {
8512
+ fontSize: 10,
8513
+ fontWeight: 800,
8514
+ color: "#64748b",
8515
+ textTransform: "uppercase"
8516
+ },
8517
+ children: "NET PROMOTER SCORE"
8518
+ }
8519
+ ),
8520
+ /* @__PURE__ */ jsx(
8521
+ "div",
8522
+ {
8523
+ style: {
8524
+ fontSize: 22,
8525
+ fontWeight: 800,
8526
+ color: npsInfo.hasNps ? (npsInfo.score ?? 0) >= 30 ? "#047857" : (npsInfo.score ?? 0) >= 0 ? "#b45309" : "#b91c1c" : "#94a3b8",
8527
+ marginTop: 4
8528
+ },
8529
+ children: npsInfo.hasNps ? `${(npsInfo.score ?? 0) > 0 ? "+" : ""}${npsInfo.score ?? 0}` : "—"
8530
+ }
8531
+ )
8532
+ ]
8533
+ }
8534
+ ),
8535
+ /* @__PURE__ */ jsxs(
8536
+ "div",
8537
+ {
8538
+ style: {
8539
+ padding: "12px 14px",
8540
+ borderRadius: 8,
8541
+ background: hexWithAlpha(primaryHex, 0.06),
8542
+ border: `1px solid ${hexWithAlpha(primaryHex, 0.25)}`
8543
+ },
8544
+ children: [
8545
+ /* @__PURE__ */ jsx(
8546
+ "div",
8547
+ {
8548
+ style: {
8549
+ fontSize: 10,
8550
+ fontWeight: 800,
8551
+ color: "#64748b",
8552
+ textTransform: "uppercase"
8553
+ },
8554
+ children: tr ? "DİL DAĞILIMI" : "LOCALE MIX"
8555
+ }
8556
+ ),
8557
+ /* @__PURE__ */ jsx(
8558
+ "div",
8559
+ {
8560
+ style: {
8561
+ fontSize: 13,
8562
+ fontWeight: 800,
8563
+ color: "#0f172a",
8564
+ marginTop: 7
8565
+ },
8566
+ children: Array.isArray(summary.localeBreakdown) && summary.localeBreakdown.length > 0 ? summary.localeBreakdown.slice(0, 3).map(
8567
+ (l) => `${String(l.locale).toUpperCase()}: ${l.percentage}%`
8568
+ ).join(" • ") : "—"
8569
+ }
8570
+ )
8571
+ ]
8572
+ }
8573
+ )
8574
+ ]
8575
+ }
8576
+ ),
8577
+ executiveNote.trim() && /* @__PURE__ */ jsxs(
8578
+ "div",
8579
+ {
8580
+ style: {
8581
+ padding: "10px 14px",
8582
+ borderRadius: 7,
8583
+ background: "#fffbeb",
8584
+ borderLeft: `4px solid ${primaryHex}`,
8585
+ borderTop: "1px solid #fde68a",
8586
+ borderRight: "1px solid #fde68a",
8587
+ borderBottom: "1px solid #fde68a",
8588
+ fontSize: 12,
8589
+ color: "#1e293b"
8590
+ },
8591
+ children: [
8592
+ /* @__PURE__ */ jsx("strong", { style: { color: primaryHex }, children: tr ? "Yönetici Notu: " : "Executive Note: " }),
8593
+ executiveNote
8594
+ ]
8595
+ }
8596
+ ),
8597
+ includeTrendChart && dailyTrend.length > 0 && /* @__PURE__ */ jsxs(
8598
+ "div",
8599
+ {
8600
+ onClick: () => setSelectedFormulaHint(
8601
+ `='${statsSheetTabName}'!$B$4:$C$${3 + dailyTrend.length} (<c:lineChart>)`
8602
+ ),
8603
+ style: {
8604
+ padding: "14px 16px",
8605
+ borderRadius: 8,
8606
+ border: "1px solid #cbd5e1",
8607
+ background: "#ffffff",
8608
+ cursor: "pointer"
8609
+ },
8610
+ children: [
8611
+ /* @__PURE__ */ jsxs(
8612
+ "div",
8613
+ {
8614
+ style: {
8615
+ display: "flex",
8616
+ justifyContent: "space-between",
8617
+ alignItems: "center",
8618
+ marginBottom: 8
8619
+ },
8620
+ children: [
8621
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 12.5, fontWeight: 800, color: "#0f172a" }, children: [
8622
+ "📈",
8623
+ " ",
8624
+ tr ? "Son 30 Günlük Yanıt Eğilimi (Excel <c:lineChart>)" : "30-Day Participation Trend (Excel <c:lineChart>)"
8625
+ ] }),
8626
+ /* @__PURE__ */ jsx(
8627
+ "span",
8628
+ {
8629
+ style: {
8630
+ fontSize: 10,
8631
+ fontFamily: "monospace",
8632
+ color: "#64748b"
8633
+ },
8634
+ children: statsSheetTabName
8635
+ }
8636
+ )
8637
+ ]
8638
+ }
8639
+ ),
8640
+ (() => {
8641
+ const w = 760;
8642
+ const h = 110;
8643
+ const padX = 24;
8644
+ const padY = 14;
8645
+ const maxC = Math.max(1, ...dailyTrend.map((d) => d.count));
8646
+ const pts = dailyTrend.map((d, i) => {
8647
+ const x = padX + i / Math.max(1, dailyTrend.length - 1) * (w - padX * 2);
8648
+ const y = h - padY - d.count / maxC * (h - padY * 2);
8649
+ return { x, y, ...d };
8650
+ });
8651
+ const poly = pts.map((p) => `${p.x},${p.y}`).join(" ");
8652
+ return /* @__PURE__ */ jsxs(
8653
+ "svg",
8654
+ {
8655
+ viewBox: `0 0 ${w} ${h}`,
8656
+ style: { width: "100%", height: 110, display: "block" },
8657
+ children: [
8658
+ /* @__PURE__ */ jsx(
8659
+ "line",
8660
+ {
8661
+ x1: padX,
8662
+ y1: h - padY,
8663
+ x2: w - padX,
8664
+ y2: h - padY,
8665
+ stroke: "#cbd5e1",
8666
+ strokeWidth: 1
8667
+ }
8668
+ ),
8669
+ /* @__PURE__ */ jsx(
8670
+ "polyline",
8671
+ {
8672
+ fill: "none",
8673
+ stroke: primaryHex,
8674
+ strokeWidth: 2.5,
8675
+ points: poly
8676
+ }
8677
+ ),
8678
+ pts.map((p, idx) => /* @__PURE__ */ jsx(
8679
+ "circle",
8680
+ {
8681
+ cx: p.x,
8682
+ cy: p.y,
8683
+ r: 3,
8684
+ fill: "#ffffff",
8685
+ stroke: primaryHex,
8686
+ strokeWidth: 2
8687
+ },
8688
+ idx
8689
+ ))
8690
+ ]
8691
+ }
8692
+ );
8693
+ })()
8694
+ ]
8695
+ }
8696
+ ),
8697
+ /* @__PURE__ */ jsx(
8698
+ "div",
8699
+ {
8700
+ style: {
8701
+ display: "grid",
8702
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
8703
+ gap: 14
8704
+ },
8705
+ children: activeQuestionCharts.map((qs, cIdx) => {
8706
+ const ov = questionOverrides[qs.key] || {
8707
+ chartType: inferDefaultChartKind(qs.type, surveyObj.displayMode),
8708
+ customTitle: pickTextForLocale(qs.title, uiLocale, qs.key)
8709
+ };
8710
+ const items = extractChartPreviewItems(qs, uiLocale, tr);
8711
+ const maxVal = Math.max(1, ...items.map((it) => it.count));
8712
+ const totalVal = Math.max(
8713
+ 1,
8714
+ items.reduce((acc, it) => acc + it.count, 0)
8715
+ );
8716
+ const rowStart = 8 + cIdx * 7;
8717
+ const rowEnd = rowStart + Math.max(1, items.length - 1);
8718
+ const formulaStr = `='${statsSheetTabName}'!$B$${rowStart}:$C$${rowEnd}`;
8719
+ return /* @__PURE__ */ jsxs(
8720
+ "div",
8721
+ {
8722
+ onClick: () => setSelectedFormulaHint(formulaStr),
8723
+ style: {
8724
+ padding: 14,
8725
+ borderRadius: 9,
8726
+ border: "1px solid #cbd5e1",
8727
+ background: "#ffffff",
8728
+ display: "flex",
8729
+ flexDirection: "column",
8730
+ gap: 10,
8731
+ boxShadow: "0 2px 6px rgba(15,23,42,0.04)"
8732
+ },
8733
+ children: [
8734
+ /* @__PURE__ */ jsxs(
8735
+ "div",
8736
+ {
8737
+ style: {
8738
+ display: "flex",
8739
+ alignItems: "center",
8740
+ justifyContent: "space-between",
8741
+ gap: 6,
8742
+ borderBottom: "1px solid #f1f5f9",
8743
+ paddingBottom: 6
8744
+ },
8745
+ children: [
8746
+ /* @__PURE__ */ jsx(
8747
+ "input",
8748
+ {
8749
+ type: "text",
8750
+ value: ov.customTitle,
8751
+ onChange: (e) => updateQuestionOverride(qs.key, {
8752
+ customTitle: e.target.value
8753
+ }),
8754
+ style: {
8755
+ flex: 1,
8756
+ minWidth: 0,
8757
+ border: "1px solid transparent",
8758
+ borderRadius: 4,
8759
+ padding: "2px 4px",
8760
+ fontSize: 12,
8761
+ fontWeight: 800,
8762
+ background: "#ffffff",
8763
+ color: "#0f172a"
8764
+ }
8765
+ }
8766
+ ),
8767
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 3, flexShrink: 0 }, children: ["bar", "col", "doughnut"].map(
8768
+ (kind) => /* @__PURE__ */ jsx(
8769
+ "button",
8770
+ {
8771
+ type: "button",
8772
+ onClick: (e) => {
8773
+ e.stopPropagation();
8774
+ updateQuestionOverride(qs.key, { chartType: kind });
8775
+ },
8776
+ style: {
8777
+ padding: "2px 6px",
8778
+ fontSize: 9.5,
8779
+ fontWeight: 800,
8780
+ borderRadius: 4,
8781
+ border: ov.chartType === kind ? `1px solid ${primaryHex}` : "1px solid #e2e8f0",
8782
+ background: ov.chartType === kind ? primaryHex : "#f8fafc",
8783
+ color: ov.chartType === kind ? "#ffffff" : "#64748b",
8784
+ cursor: "pointer"
8785
+ },
8786
+ children: kind === "bar" ? "▬" : kind === "col" ? "▮" : "◕"
8787
+ },
8788
+ kind
8789
+ )
8790
+ ) })
8791
+ ]
8792
+ }
8793
+ ),
8794
+ ov.chartType === "bar" && /* @__PURE__ */ jsx(
8795
+ "div",
8796
+ {
8797
+ style: {
8798
+ display: "flex",
8799
+ flexDirection: "column",
8800
+ gap: 6
8801
+ },
8802
+ children: items.slice(0, 7).map((it, i) => /* @__PURE__ */ jsxs(
8803
+ "div",
8804
+ {
8805
+ style: {
8806
+ display: "grid",
8807
+ gridTemplateColumns: "120px 1fr 48px",
8808
+ alignItems: "center",
8809
+ gap: 8,
8810
+ fontSize: 11
8811
+ },
8812
+ children: [
8813
+ /* @__PURE__ */ jsx(
8814
+ "span",
8815
+ {
8816
+ title: it.label,
8817
+ style: {
8818
+ overflow: "hidden",
8819
+ textOverflow: "ellipsis",
8820
+ whiteSpace: "nowrap",
8821
+ color: it.isNoOpinion ? "#64748b" : "#334155",
8822
+ fontStyle: it.isNoOpinion ? "italic" : "normal",
8823
+ fontWeight: 600
8824
+ },
8825
+ children: it.label
8826
+ }
8827
+ ),
8828
+ /* @__PURE__ */ jsx(
8829
+ "div",
8830
+ {
8831
+ style: {
8832
+ height: 14,
8833
+ borderRadius: 3,
8834
+ background: "#f1f5f9",
8835
+ overflow: "hidden"
8836
+ },
8837
+ children: /* @__PURE__ */ jsx(
8838
+ "div",
8839
+ {
8840
+ style: {
8841
+ width: `${Math.max(
8842
+ 2,
8843
+ it.count / maxVal * 100
8844
+ )}%`,
8845
+ height: "100%",
8846
+ background: it.isNoOpinion ? "#94a3b8" : primaryHex,
8847
+ borderRadius: 3
8848
+ }
8849
+ }
8850
+ )
8851
+ }
8852
+ ),
8853
+ /* @__PURE__ */ jsx(
8854
+ "span",
8855
+ {
8856
+ style: {
8857
+ textAlign: "right",
8858
+ fontWeight: 700,
8859
+ color: "#0f172a"
8860
+ },
8861
+ children: it.count
8862
+ }
8863
+ )
8864
+ ]
8865
+ },
8866
+ i
8867
+ ))
8868
+ }
8869
+ ),
8870
+ ov.chartType === "col" && /* @__PURE__ */ jsx(
8871
+ "div",
8872
+ {
8873
+ style: {
8874
+ height: 145,
8875
+ display: "flex",
8876
+ alignItems: "flex-end",
8877
+ justifyContent: "space-around",
8878
+ gap: 6,
8879
+ padding: "12px 6px 4px",
8880
+ borderBottom: "1px solid #cbd5e1"
8881
+ },
8882
+ children: items.slice(0, 11).map((it, i) => {
8883
+ const barH = Math.max(
8884
+ 4,
8885
+ Math.round(it.count / maxVal * 96)
8886
+ );
8887
+ return /* @__PURE__ */ jsxs(
8888
+ "div",
8889
+ {
8890
+ style: {
8891
+ flex: 1,
8892
+ minWidth: 0,
8893
+ display: "flex",
8894
+ flexDirection: "column",
8895
+ alignItems: "center",
8896
+ gap: 4
8897
+ },
8898
+ children: [
8899
+ /* @__PURE__ */ jsx(
8900
+ "span",
8901
+ {
8902
+ style: {
8903
+ fontSize: 9.5,
8904
+ fontWeight: 700,
8905
+ color: "#475569"
8906
+ },
8907
+ children: it.count
8908
+ }
8909
+ ),
8910
+ /* @__PURE__ */ jsx(
8911
+ "div",
8912
+ {
8913
+ style: {
8914
+ width: "72%",
8915
+ maxWidth: 28,
8916
+ height: barH,
8917
+ background: it.isNoOpinion ? "#94a3b8" : primaryHex,
8918
+ borderRadius: "3px 3px 0 0"
8919
+ }
8920
+ }
8921
+ ),
8922
+ /* @__PURE__ */ jsx(
8923
+ "span",
8924
+ {
8925
+ title: it.label,
8926
+ style: {
8927
+ fontSize: 9.5,
8928
+ color: "#64748b",
8929
+ maxWidth: "100%",
8930
+ overflow: "hidden",
8931
+ textOverflow: "ellipsis",
8932
+ whiteSpace: "nowrap"
8933
+ },
8934
+ children: it.label
8935
+ }
8936
+ )
8937
+ ]
8938
+ },
8939
+ i
8940
+ );
8941
+ })
8942
+ }
8943
+ ),
8944
+ ov.chartType === "doughnut" && /* @__PURE__ */ jsxs(
8945
+ "div",
8946
+ {
8947
+ style: {
8948
+ display: "flex",
8949
+ alignItems: "center",
8950
+ gap: 14,
8951
+ padding: "4px 0"
8952
+ },
8953
+ children: [
8954
+ (() => {
8955
+ const r = 42;
8956
+ const circ = 2 * Math.PI * r;
8957
+ let accOffset = 0;
8958
+ return /* @__PURE__ */ jsxs(
8959
+ "svg",
8960
+ {
8961
+ width: 110,
8962
+ height: 110,
8963
+ viewBox: "0 0 110 110",
8964
+ style: { flexShrink: 0 },
8965
+ children: [
8966
+ /* @__PURE__ */ jsx(
8967
+ "circle",
8968
+ {
8969
+ cx: 55,
8970
+ cy: 55,
8971
+ r,
8972
+ fill: "none",
8973
+ stroke: "#f1f5f9",
8974
+ strokeWidth: 18
8975
+ }
8976
+ ),
8977
+ items.slice(0, 8).map((it, idx) => {
8978
+ const frac = it.count / totalVal;
8979
+ const dash = frac * circ;
8980
+ const strokeOffset = -accOffset;
8981
+ accOffset += dash;
8982
+ const color = it.isNoOpinion ? "#94a3b8" : idx === 0 ? primaryHex : SLICE_PALETTE[idx % SLICE_PALETTE.length];
8983
+ return /* @__PURE__ */ jsx(
8984
+ "circle",
8985
+ {
8986
+ cx: 55,
8987
+ cy: 55,
8988
+ r,
8989
+ fill: "none",
8990
+ stroke: color,
8991
+ strokeWidth: 18,
8992
+ strokeDasharray: `${dash} ${circ - dash}`,
8993
+ strokeDashoffset: strokeOffset,
8994
+ transform: "rotate(-90 55 55)"
8995
+ },
8996
+ idx
8997
+ );
8998
+ })
8999
+ ]
9000
+ }
9001
+ );
9002
+ })(),
9003
+ /* @__PURE__ */ jsx(
9004
+ "div",
9005
+ {
9006
+ style: {
9007
+ flex: 1,
9008
+ minWidth: 0,
9009
+ display: "flex",
9010
+ flexDirection: "column",
9011
+ gap: 4
9012
+ },
9013
+ children: items.slice(0, 6).map((it, idx) => {
9014
+ const color = it.isNoOpinion ? "#94a3b8" : idx === 0 ? primaryHex : SLICE_PALETTE[idx % SLICE_PALETTE.length];
9015
+ return /* @__PURE__ */ jsxs(
9016
+ "div",
9017
+ {
9018
+ style: {
9019
+ display: "flex",
9020
+ alignItems: "center",
9021
+ gap: 6,
9022
+ fontSize: 10.5
9023
+ },
9024
+ children: [
9025
+ /* @__PURE__ */ jsx(
9026
+ "span",
9027
+ {
9028
+ style: {
9029
+ width: 9,
9030
+ height: 9,
9031
+ borderRadius: 2,
9032
+ background: color,
9033
+ flexShrink: 0
9034
+ }
9035
+ }
9036
+ ),
9037
+ /* @__PURE__ */ jsx(
9038
+ "span",
9039
+ {
9040
+ style: {
9041
+ flex: 1,
9042
+ overflow: "hidden",
9043
+ textOverflow: "ellipsis",
9044
+ whiteSpace: "nowrap",
9045
+ color: "#334155"
9046
+ },
9047
+ children: it.label
9048
+ }
9049
+ ),
9050
+ /* @__PURE__ */ jsxs("strong", { style: { color: "#0f172a" }, children: [
9051
+ it.pct,
9052
+ "%"
9053
+ ] })
9054
+ ]
9055
+ },
9056
+ idx
9057
+ );
9058
+ })
9059
+ }
9060
+ )
9061
+ ]
9062
+ }
9063
+ ),
9064
+ /* @__PURE__ */ jsxs(
9065
+ "div",
9066
+ {
9067
+ style: {
9068
+ fontSize: 9.5,
9069
+ fontFamily: "monospace",
9070
+ color: "#94a3b8",
9071
+ display: "flex",
9072
+ justifyContent: "space-between"
9073
+ },
9074
+ children: [
9075
+ /* @__PURE__ */ jsxs("span", { children: [
9076
+ "OOXML <c:",
9077
+ ov.chartType,
9078
+ "Chart>"
9079
+ ] }),
9080
+ /* @__PURE__ */ jsx("span", { children: formulaStr })
9081
+ ]
9082
+ }
9083
+ )
9084
+ ]
9085
+ },
9086
+ qs.key
9087
+ );
9088
+ })
9089
+ }
9090
+ )
9091
+ ] }),
9092
+ activeSheet === "stats" && /* @__PURE__ */ jsxs("div", { style: { padding: 18, display: "flex", flexDirection: "column", gap: 16 }, children: [
9093
+ /* @__PURE__ */ jsxs(
9094
+ "div",
9095
+ {
9096
+ style: {
9097
+ background: primaryHex,
9098
+ color: "#ffffff",
9099
+ padding: "10px 14px",
9100
+ borderRadius: 6,
9101
+ fontSize: 13.5,
9102
+ fontWeight: 800
9103
+ },
9104
+ children: [
9105
+ reportTitle,
9106
+ " —",
9107
+ " ",
9108
+ tr ? "Soru Bazlı İstatistik Özeti (Grafik Veri Kaynağı)" : "Question Statistical Summary (Live Chart Source)"
9109
+ ]
9110
+ }
9111
+ ),
9112
+ includedQuestionTables.map((qs, qIdx) => {
9113
+ const ov = questionOverrides[qs.key];
9114
+ const qTitle = ov?.customTitle || pickTextForLocale(qs.title, uiLocale, qs.key);
9115
+ const items = extractChartPreviewItems(qs, uiLocale, tr);
9116
+ return /* @__PURE__ */ jsxs(
9117
+ "div",
9118
+ {
9119
+ style: {
9120
+ border: "1px solid #cbd5e1",
9121
+ borderRadius: 7,
9122
+ overflow: "hidden"
9123
+ },
9124
+ children: [
9125
+ /* @__PURE__ */ jsxs(
9126
+ "div",
9127
+ {
9128
+ style: {
9129
+ padding: "7px 12px",
9130
+ background: hexWithAlpha(primaryHex, 0.1),
9131
+ borderBottom: "1px solid #cbd5e1",
9132
+ fontSize: 12,
9133
+ fontWeight: 800,
9134
+ color: primaryHex,
9135
+ display: "flex",
9136
+ justifyContent: "space-between"
9137
+ },
9138
+ children: [
9139
+ /* @__PURE__ */ jsxs("span", { children: [
9140
+ "S",
9141
+ qIdx + 1,
9142
+ ". ",
9143
+ qTitle,
9144
+ " (",
9145
+ qs.key,
9146
+ ")"
9147
+ ] }),
9148
+ /* @__PURE__ */ jsxs("span", { style: { fontSize: 11, color: "#475569" }, children: [
9149
+ tr ? "Yanıt:" : "Answered:",
9150
+ " ",
9151
+ qs.answeredCount ?? 0
9152
+ ] })
9153
+ ]
9154
+ }
9155
+ ),
9156
+ /* @__PURE__ */ jsxs(
9157
+ "table",
9158
+ {
9159
+ style: {
9160
+ width: "100%",
9161
+ borderCollapse: "collapse",
9162
+ fontSize: 11.5,
9163
+ color: "#0f172a"
9164
+ },
9165
+ children: [
9166
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs(
9167
+ "tr",
9168
+ {
9169
+ style: {
9170
+ background: primaryHex,
9171
+ color: "#ffffff",
9172
+ textAlign: "left"
9173
+ },
9174
+ children: [
9175
+ /* @__PURE__ */ jsx(
9176
+ "th",
9177
+ {
9178
+ style: {
9179
+ padding: "6px 10px",
9180
+ width: "52%",
9181
+ color: "#ffffff",
9182
+ fontWeight: 700
9183
+ },
9184
+ children: tr ? "Seçenek / Kriter" : "Option / Metric"
9185
+ }
9186
+ ),
9187
+ /* @__PURE__ */ jsx(
9188
+ "th",
9189
+ {
9190
+ style: {
9191
+ padding: "6px 10px",
9192
+ textAlign: "right",
9193
+ color: "#ffffff",
9194
+ fontWeight: 700
9195
+ },
9196
+ children: tr ? "Adet / Puan" : "Count / Score"
9197
+ }
9198
+ ),
9199
+ /* @__PURE__ */ jsx(
9200
+ "th",
9201
+ {
9202
+ style: {
9203
+ padding: "6px 10px",
9204
+ width: "28%",
9205
+ color: "#ffffff",
9206
+ fontWeight: 700
9207
+ },
9208
+ children: tr ? "Oran (%)" : "Share (%)"
9209
+ }
9210
+ )
9211
+ ]
9212
+ }
9213
+ ) }),
9214
+ /* @__PURE__ */ jsx("tbody", { children: items.map((it, rIdx) => {
9215
+ const rowFg = it.isNoOpinion ? "#64748b" : "#0f172a";
9216
+ return /* @__PURE__ */ jsxs(
9217
+ "tr",
9218
+ {
9219
+ style: {
9220
+ background: it.isNoOpinion ? "#f1f5f9" : rIdx % 2 === 1 ? "#f8fafc" : "#ffffff",
9221
+ fontStyle: it.isNoOpinion ? "italic" : "normal",
9222
+ color: rowFg,
9223
+ borderBottom: "1px solid #e2e8f0"
9224
+ },
9225
+ children: [
9226
+ /* @__PURE__ */ jsx(
9227
+ "td",
9228
+ {
9229
+ style: {
9230
+ padding: "6px 10px",
9231
+ fontWeight: 600,
9232
+ color: rowFg
9233
+ },
9234
+ children: it.label
9235
+ }
9236
+ ),
9237
+ /* @__PURE__ */ jsx(
9238
+ "td",
9239
+ {
9240
+ style: {
9241
+ padding: "6px 10px",
9242
+ textAlign: "right",
9243
+ fontFamily: "monospace",
9244
+ fontWeight: 700,
9245
+ color: rowFg
9246
+ },
9247
+ children: it.count
9248
+ }
9249
+ ),
9250
+ /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", color: rowFg }, children: /* @__PURE__ */ jsxs(
9251
+ "div",
9252
+ {
9253
+ style: {
9254
+ position: "relative",
9255
+ height: 18,
9256
+ borderRadius: 3,
9257
+ background: includeDataBars ? "#f1f5f9" : "transparent",
9258
+ display: "flex",
9259
+ alignItems: "center",
9260
+ justifyContent: "flex-end",
9261
+ padding: "0 6px",
9262
+ overflow: "hidden"
9263
+ },
9264
+ children: [
9265
+ includeDataBars && /* @__PURE__ */ jsx(
9266
+ "div",
9267
+ {
9268
+ style: {
9269
+ position: "absolute",
9270
+ left: 0,
9271
+ top: 0,
9272
+ bottom: 0,
9273
+ width: `${Math.min(100, Math.max(0, it.pct))}%`,
9274
+ background: hexWithAlpha(primaryHex, 0.24)
9275
+ }
9276
+ }
9277
+ ),
9278
+ /* @__PURE__ */ jsxs(
9279
+ "span",
9280
+ {
9281
+ style: {
9282
+ position: "relative",
9283
+ fontFamily: "monospace",
9284
+ fontWeight: 700,
9285
+ fontSize: 11,
9286
+ color: rowFg
9287
+ },
9288
+ children: [
9289
+ it.pct.toFixed(1),
9290
+ "%"
9291
+ ]
9292
+ }
9293
+ )
9294
+ ]
9295
+ }
9296
+ ) })
9297
+ ]
9298
+ },
9299
+ rIdx
9300
+ );
9301
+ }) })
9302
+ ]
9303
+ }
9304
+ )
9305
+ ]
9306
+ },
9307
+ qs.key
9308
+ );
9309
+ })
9310
+ ] }),
9311
+ activeSheet === "raw" && /* @__PURE__ */ jsxs("div", { style: { padding: 18, display: "flex", flexDirection: "column", gap: 12 }, children: [
9312
+ /* @__PURE__ */ jsxs(
9313
+ "div",
9314
+ {
9315
+ style: {
9316
+ background: primaryHex,
9317
+ color: "#ffffff",
9318
+ padding: "10px 14px",
9319
+ borderRadius: 6,
9320
+ fontSize: 13,
9321
+ fontWeight: 800,
9322
+ display: "flex",
9323
+ justifyContent: "space-between"
9324
+ },
9325
+ children: [
9326
+ /* @__PURE__ */ jsxs("span", { children: [
9327
+ reportTitle,
9328
+ " —",
9329
+ " ",
9330
+ tr ? "Ham Yanıt Kayıtları (Üst Satır Dondurulmuş + AutoFilter)" : "Raw Response Records (Frozen Header + AutoFilter)"
9331
+ ] }),
9332
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 11, opacity: 0.9 }, children: 'ySplit="3" • autoFilter' })
9333
+ ]
9334
+ }
9335
+ ),
9336
+ loadingRawSample ? /* @__PURE__ */ jsx("div", { style: { padding: 24, textAlign: "center", color: "#64748b" }, children: tr ? "Örnek yanıt satırları yükleniyor..." : "Loading sample rows..." }) : rawSampleRows.length === 0 ? /* @__PURE__ */ jsx(
9337
+ "div",
9338
+ {
9339
+ style: {
9340
+ padding: 24,
9341
+ textAlign: "center",
9342
+ color: "#64748b",
9343
+ background: "#f8fafc",
9344
+ borderRadius: 6,
9345
+ border: "1px dashed #cbd5e1",
9346
+ fontSize: 12
9347
+ },
9348
+ children: tr ? "Henüz görüntülenecek ham yanıt kaydı bulunmuyor." : "No raw response records available yet."
9349
+ }
9350
+ ) : /* @__PURE__ */ jsx(
9351
+ "div",
9352
+ {
9353
+ style: {
9354
+ overflowX: "auto",
9355
+ border: "1px solid #cbd5e1",
9356
+ borderRadius: 6,
9357
+ background: "#ffffff"
9358
+ },
9359
+ children: (() => {
9360
+ const previewQuestions = (Array.isArray(surveyObj.questions) ? surveyObj.questions : []).filter((q) => q && q.type !== "statement").slice(0, 4);
9361
+ const formatPreviewAnswer = (q, rawVal) => {
9362
+ if (rawVal === void 0 || rawVal === null || rawVal === "") {
9363
+ return { text: "—", isNa: false };
9364
+ }
9365
+ if (rawVal === "__na__" || Array.isArray(rawVal) && rawVal.length === 1 && rawVal[0] === "__na__") {
9366
+ return {
9367
+ text: pickTextForLocale(
9368
+ q.noOpinionLabel,
9369
+ uiLocale,
9370
+ tr ? "Fikrim yok" : "No idea"
9371
+ ),
9372
+ isNa: true
9373
+ };
9374
+ }
9375
+ if (typeof rawVal === "boolean") {
9376
+ return {
9377
+ text: rawVal ? tr ? "Evet" : "Yes" : tr ? "Hayır" : "No",
9378
+ isNa: false
9379
+ };
9380
+ }
9381
+ if (Array.isArray(q.options) && q.options.length > 0) {
9382
+ if (Array.isArray(rawVal)) {
9383
+ const mapped = rawVal.map((id) => {
9384
+ const found2 = q.options.find((o) => o.id === id);
9385
+ return found2 ? pickTextForLocale(found2.labels, uiLocale, id) : id;
9386
+ });
9387
+ return { text: mapped.join("; "), isNa: false };
9388
+ }
9389
+ const found = q.options.find(
9390
+ (o) => o.id === String(rawVal)
9391
+ );
9392
+ return {
9393
+ text: found ? pickTextForLocale(found.labels, uiLocale, String(rawVal)) : String(rawVal),
9394
+ isNa: false
9395
+ };
9396
+ }
9397
+ if (typeof rawVal === "object") {
9398
+ return { text: JSON.stringify(rawVal), isNa: false };
9399
+ }
9400
+ return { text: String(rawVal), isNa: false };
9401
+ };
9402
+ return /* @__PURE__ */ jsxs(
9403
+ "table",
9404
+ {
9405
+ style: {
9406
+ width: "100%",
9407
+ borderCollapse: "collapse",
9408
+ fontSize: 11.5,
9409
+ color: "#0f172a"
9410
+ },
9411
+ children: [
9412
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { style: { background: primaryHex, color: "#ffffff" }, children: [
9413
+ tr ? "Yanıt ID ▼" : "Response ID ▼",
9414
+ tr ? "Tarih ▼" : "Submitted At ▼",
9415
+ tr ? "Dil ▼" : "Locale ▼",
9416
+ tr ? "Süre (sn) ▼" : "Duration (s) ▼",
9417
+ "NPS ▼",
9418
+ tr ? "NPS Kategorisi ▼" : "NPS Category ▼",
9419
+ ...previewQuestions.map(
9420
+ (q) => `${pickTextForLocale(q.title, uiLocale, q.key).slice(
9421
+ 0,
9422
+ 26
9423
+ )} ▼`
9424
+ )
9425
+ ].map((h, i) => /* @__PURE__ */ jsx(
9426
+ "th",
9427
+ {
9428
+ style: {
9429
+ padding: "7px 10px",
9430
+ textAlign: "left",
9431
+ whiteSpace: "nowrap",
9432
+ color: "#ffffff",
9433
+ fontWeight: 700
9434
+ },
9435
+ children: h
9436
+ },
9437
+ i
9438
+ )) }) }),
9439
+ /* @__PURE__ */ jsx("tbody", { children: rawSampleRows.slice(0, 15).map((r, rIdx) => {
9440
+ const cat = String(r.npsCategory || "");
9441
+ const catStyle = cat === "promoter" ? { bg: "#dcfce7", fg: "#166534" } : cat === "passive" ? { bg: "#fef3c7", fg: "#92400e" } : cat === "detractor" ? { bg: "#fee2e2", fg: "#991b1b" } : null;
9442
+ return /* @__PURE__ */ jsxs(
9443
+ "tr",
9444
+ {
9445
+ style: {
9446
+ background: rIdx % 2 === 1 ? "#f8fafc" : "#ffffff",
9447
+ color: "#0f172a",
9448
+ borderBottom: "1px solid #e2e8f0"
9449
+ },
9450
+ children: [
9451
+ /* @__PURE__ */ jsxs(
9452
+ "td",
9453
+ {
9454
+ style: {
9455
+ padding: "6px 10px",
9456
+ fontFamily: "monospace",
9457
+ fontWeight: 700,
9458
+ color: "#334155",
9459
+ whiteSpace: "nowrap"
9460
+ },
9461
+ children: [
9462
+ "#",
9463
+ r.id || rIdx + 1
9464
+ ]
9465
+ }
9466
+ ),
9467
+ /* @__PURE__ */ jsx(
9468
+ "td",
9469
+ {
9470
+ style: {
9471
+ padding: "6px 10px",
9472
+ color: "#1e293b",
9473
+ whiteSpace: "nowrap"
9474
+ },
9475
+ children: String(r.submittedAt || r.createdAt || "").slice(0, 16).replace("T", " ")
9476
+ }
9477
+ ),
9478
+ /* @__PURE__ */ jsx(
9479
+ "td",
9480
+ {
9481
+ style: {
9482
+ padding: "6px 10px",
9483
+ fontWeight: 700,
9484
+ color: "#0f172a"
9485
+ },
9486
+ children: String(r.locale || "en").toUpperCase()
9487
+ }
9488
+ ),
9489
+ /* @__PURE__ */ jsx(
9490
+ "td",
9491
+ {
9492
+ style: {
9493
+ padding: "6px 10px",
9494
+ textAlign: "right",
9495
+ fontFamily: "monospace",
9496
+ color: "#1e293b"
9497
+ },
9498
+ children: r.durationSeconds ?? "—"
9499
+ }
9500
+ ),
9501
+ /* @__PURE__ */ jsx(
9502
+ "td",
9503
+ {
9504
+ style: {
9505
+ padding: "6px 10px",
9506
+ textAlign: "right",
9507
+ fontFamily: "monospace",
9508
+ fontWeight: 700,
9509
+ color: "#0f172a"
9510
+ },
9511
+ children: r.npsValue ?? "—"
9512
+ }
9513
+ ),
9514
+ /* @__PURE__ */ jsx("td", { style: { padding: "6px 10px", color: "#64748b" }, children: catStyle ? /* @__PURE__ */ jsx(
9515
+ "span",
9516
+ {
9517
+ style: {
9518
+ padding: "2px 8px",
9519
+ borderRadius: 4,
9520
+ background: catStyle.bg,
9521
+ color: catStyle.fg,
9522
+ fontWeight: 800,
9523
+ fontSize: 10.5,
9524
+ textTransform: "uppercase"
9525
+ },
9526
+ children: cat
9527
+ }
9528
+ ) : /* @__PURE__ */ jsx("span", { style: { color: "#64748b" }, children: "—" }) }),
9529
+ previewQuestions.map((q) => {
9530
+ const formatted = formatPreviewAnswer(
9531
+ q,
9532
+ r.answers?.[q.key]
9533
+ );
9534
+ return /* @__PURE__ */ jsx(
9535
+ "td",
9536
+ {
9537
+ title: formatted.text,
9538
+ style: {
9539
+ padding: "6px 10px",
9540
+ maxWidth: 200,
9541
+ overflow: "hidden",
9542
+ textOverflow: "ellipsis",
9543
+ whiteSpace: "nowrap",
9544
+ color: formatted.isNa ? "#64748b" : "#1e293b",
9545
+ fontStyle: formatted.isNa ? "italic" : "normal"
9546
+ },
9547
+ children: formatted.text
9548
+ },
9549
+ q.key
9550
+ );
9551
+ })
9552
+ ]
9553
+ },
9554
+ r.id || rIdx
9555
+ );
9556
+ }) })
9557
+ ]
9558
+ }
9559
+ );
9560
+ })()
9561
+ }
9562
+ )
9563
+ ] })
9564
+ ]
9565
+ }
9566
+ )
9567
+ }
9568
+ ),
9569
+ /* @__PURE__ */ jsxs(
9570
+ "div",
9571
+ {
9572
+ style: {
9573
+ padding: "0 14px",
9574
+ height: 38,
9575
+ background: "#f1f5f9",
9576
+ borderTop: "1px solid #cbd5e1",
9577
+ display: "flex",
9578
+ alignItems: "flex-end",
9579
+ justifyContent: "space-between",
9580
+ flexShrink: 0
9581
+ },
9582
+ children: [
9583
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", gap: 4 }, children: [
9584
+ /* @__PURE__ */ jsx(
9585
+ "button",
9586
+ {
9587
+ type: "button",
9588
+ onClick: () => setActiveSheet("dashboard"),
9589
+ style: {
9590
+ padding: "6px 14px",
9591
+ borderRadius: "6px 6px 0 0",
9592
+ border: "1px solid #cbd5e1",
9593
+ borderBottom: activeSheet === "dashboard" ? `3px solid ${primaryHex}` : "1px solid #cbd5e1",
9594
+ background: activeSheet === "dashboard" ? "#ffffff" : "#e2e8f0",
9595
+ color: activeSheet === "dashboard" ? primaryHex : "#475569",
9596
+ fontSize: 11.5,
9597
+ fontWeight: 800,
9598
+ cursor: "pointer"
9599
+ },
9600
+ children: "📊 1_Dashboard"
9601
+ }
9602
+ ),
9603
+ /* @__PURE__ */ jsxs(
9604
+ "button",
9605
+ {
9606
+ type: "button",
9607
+ onClick: () => setActiveSheet("stats"),
9608
+ style: {
9609
+ padding: "6px 14px",
9610
+ borderRadius: "6px 6px 0 0",
9611
+ border: "1px solid #cbd5e1",
9612
+ borderBottom: activeSheet === "stats" ? "3px solid #059669" : "1px solid #cbd5e1",
9613
+ background: activeSheet === "stats" ? "#ffffff" : "#e2e8f0",
9614
+ color: activeSheet === "stats" ? "#059669" : "#475569",
9615
+ fontSize: 11.5,
9616
+ fontWeight: 800,
9617
+ cursor: "pointer"
9618
+ },
9619
+ children: [
9620
+ "📈 ",
9621
+ statsSheetTabName
9622
+ ]
9623
+ }
9624
+ ),
9625
+ includeRawSheet && /* @__PURE__ */ jsxs(
9626
+ "button",
9627
+ {
9628
+ type: "button",
9629
+ onClick: () => setActiveSheet("raw"),
9630
+ style: {
9631
+ padding: "6px 14px",
9632
+ borderRadius: "6px 6px 0 0",
9633
+ border: "1px solid #cbd5e1",
9634
+ borderBottom: activeSheet === "raw" ? "3px solid #475569" : "1px solid #cbd5e1",
9635
+ background: activeSheet === "raw" ? "#ffffff" : "#e2e8f0",
9636
+ color: activeSheet === "raw" ? "#0f172a" : "#475569",
9637
+ fontSize: 11.5,
9638
+ fontWeight: 800,
9639
+ cursor: "pointer"
9640
+ },
9641
+ children: [
9642
+ "📋 ",
9643
+ rawSheetTabName
9644
+ ]
9645
+ }
9646
+ )
9647
+ ] }),
9648
+ /* @__PURE__ */ jsx(
9649
+ "div",
9650
+ {
9651
+ style: {
9652
+ alignSelf: "center",
9653
+ fontSize: 11,
9654
+ fontWeight: 700,
9655
+ color: "#64748b"
9656
+ },
9657
+ children: tr ? `Hazır • ${includeRawSheet ? 3 : 2} Çalışma Sayfası • ${activeQuestionCharts.length + (includeTrendChart ? 1 : 0)} Gerçek Grafik` : `Ready • ${includeRawSheet ? 3 : 2} Sheets • ${activeQuestionCharts.length + (includeTrendChart ? 1 : 0)} Native Charts`
9658
+ }
9659
+ )
9660
+ ]
9661
+ }
9662
+ )
9663
+ ]
9664
+ }
9665
+ )
9666
+ ]
9667
+ }
9668
+ )
9669
+ ]
9670
+ }
9671
+ )
9672
+ }
9673
+ ),
9674
+ document.body
9675
+ );
9676
+ };
7272
9677
  const QUESTION_TYPE_BADGES = {
7273
9678
  single_choice: { tr: "Tekli Seçim", en: "Single Choice", color: "#1d4ed8", bg: "#eff6ff" },
7274
9679
  multiple_choice: { tr: "Çoklu Seçim", en: "Multi Choice", color: "#7c3aed", bg: "#f5f3ff" },
@@ -7293,6 +9698,7 @@ const SurveyAnalyticsView = ({
7293
9698
  const { get } = useFetchClient();
7294
9699
  const [loading, setLoading] = useState(false);
7295
9700
  const [exporting, setExporting] = useState(null);
9701
+ const [excelStudioOpen, setExcelStudioOpen] = useState(false);
7296
9702
  const [analytics, setAnalytics] = useState(null);
7297
9703
  const [dateFrom, setDateFrom] = useState("");
7298
9704
  const [dateTo, setDateTo] = useState("");
@@ -7504,6 +9910,30 @@ const SurveyAnalyticsView = ({
7504
9910
  ]
7505
9911
  }
7506
9912
  ),
9913
+ /* @__PURE__ */ jsxs(
9914
+ "button",
9915
+ {
9916
+ type: "button",
9917
+ onClick: () => setExcelStudioOpen(true),
9918
+ style: {
9919
+ padding: "6px 13px",
9920
+ fontSize: 11,
9921
+ fontWeight: 700,
9922
+ borderRadius: 6,
9923
+ border: "1px solid #1e3a8a",
9924
+ background: "#1e3a8a",
9925
+ color: "#ffffff",
9926
+ cursor: "pointer",
9927
+ display: "inline-flex",
9928
+ alignItems: "center",
9929
+ gap: 5
9930
+ },
9931
+ children: [
9932
+ /* @__PURE__ */ jsx(MaterialIcon, { name: "bar_chart", size: 14, color: "#fff" }),
9933
+ /* @__PURE__ */ jsx("span", { children: tr ? "Excel Önizle & Düzenle" : "Customize & Preview .xlsx" })
9934
+ ]
9935
+ }
9936
+ ),
7507
9937
  /* @__PURE__ */ jsxs(
7508
9938
  "button",
7509
9939
  {
@@ -7525,7 +9955,7 @@ const SurveyAnalyticsView = ({
7525
9955
  },
7526
9956
  children: [
7527
9957
  /* @__PURE__ */ jsx(MaterialIcon, { name: "table_view", size: 14, color: "#fff" }),
7528
- /* @__PURE__ */ jsx("span", { children: exporting === "xlsx" ? "..." : tr ? "Excel İndir (.xlsx)" : "Export Excel (.xlsx)" })
9958
+ /* @__PURE__ */ jsx("span", { children: exporting === "xlsx" ? "..." : tr ? "Hızlı Excel (.xlsx)" : "Quick Excel (.xlsx)" })
7529
9959
  ]
7530
9960
  }
7531
9961
  ),
@@ -8686,7 +11116,19 @@ const SurveyAnalyticsView = ({
8686
11116
  },
8687
11117
  qs.key || qIdx
8688
11118
  );
8689
- }) })
11119
+ }) }),
11120
+ /* @__PURE__ */ jsx(
11121
+ ExcelReportStudioModal,
11122
+ {
11123
+ open: excelStudioOpen,
11124
+ onClose: () => setExcelStudioOpen(false),
11125
+ surveySlugOrId,
11126
+ analytics,
11127
+ dateFrom,
11128
+ dateTo,
11129
+ uiLocale
11130
+ }
11131
+ )
8690
11132
  ] });
8691
11133
  };
8692
11134
  function isEmptyVal(val) {