treege 3.0.0-beta.72 → 3.0.0-beta.73

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.
@@ -33,6 +33,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
33
33
  defaultHttpInput: {
34
34
  fetchFailed: "فشل في جلب البيانات. يرجى التحقق من اتصالك بالشبكة.",
35
35
  httpError: "خطأ HTTP {status}: {statusText}",
36
+ invalidJson: "استجابة الخادم ليست JSON صالحة. تحقق من عنوان URL وعنوان URL الأساسي والمصادقة.",
36
37
  noDataAvailable: "لا توجد بيانات متاحة. قم بتكوين \"جلب عند التحميل\" أو أضف معامل بحث.",
37
38
  noResults: "لم يتم العثور على نتائج.",
38
39
  noUrlConfigured: "لم يتم تكوين رابط. يرجى إضافة عنوان URL في إعدادات HTTP.",
@@ -105,6 +106,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
105
106
  defaultHttpInput: {
106
107
  fetchFailed: "Fehler beim Abrufen der Daten. Bitte überprüfen Sie Ihre Netzwerkverbindung.",
107
108
  httpError: "HTTP-Fehler {status}: {statusText}",
109
+ invalidJson: "Die Serverantwort ist kein gültiges JSON. Überprüfen Sie die URL, die Basis-URL und die Authentifizierung.",
108
110
  noDataAvailable: "Keine Daten verfügbar. Konfigurieren Sie \"Beim Laden abrufen\" oder fügen Sie einen Suchparameter hinzu.",
109
111
  noResults: "Keine Ergebnisse gefunden.",
110
112
  noUrlConfigured: "Keine URL konfiguriert. Bitte fügen Sie eine URL in der HTTP-Konfiguration hinzu.",
@@ -177,6 +179,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
177
179
  defaultHttpInput: {
178
180
  fetchFailed: "Failed to fetch data. Please check your network connection.",
179
181
  httpError: "HTTP Error {status}: {statusText}",
182
+ invalidJson: "The server response is not valid JSON. Check the URL, base URL and authentication.",
180
183
  noDataAvailable: "No data available. Configure \"Fetch on mount\" or add a search parameter.",
181
184
  noResults: "No results found.",
182
185
  noUrlConfigured: "No URL configured. Please add a URL in the HTTP configuration.",
@@ -249,6 +252,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
249
252
  defaultHttpInput: {
250
253
  fetchFailed: "Error al obtener los datos. Por favor, verifique su conexión de red.",
251
254
  httpError: "Error HTTP {status}: {statusText}",
255
+ invalidJson: "La respuesta del servidor no es un JSON válido. Verifica la URL, la URL base y la autenticación.",
252
256
  noDataAvailable: "No hay datos disponibles. Configure \"Cargar al montar\" o agregue un parámetro de búsqueda.",
253
257
  noResults: "No se encontraron resultados.",
254
258
  noUrlConfigured: "No hay URL configurada. Por favor, agregue una URL en la configuración HTTP.",
@@ -321,6 +325,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
321
325
  defaultHttpInput: {
322
326
  fetchFailed: "Échec de la récupération des données. Veuillez vérifier votre connexion réseau.",
323
327
  httpError: "Erreur HTTP {status} : {statusText}",
328
+ invalidJson: "La réponse du serveur n'est pas un JSON valide. Vérifiez l'URL, le baseUrl et l'authentification.",
324
329
  noDataAvailable: "Aucune donnée disponible. Configurez \"Charger au montage\" ou ajoutez un paramètre de recherche.",
325
330
  noResults: "Aucun résultat trouvé.",
326
331
  noUrlConfigured: "Aucune URL configurée. Veuillez ajouter une URL dans la configuration HTTP.",
@@ -393,6 +398,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
393
398
  defaultHttpInput: {
394
399
  fetchFailed: "Impossibile recuperare i dati. Controlla la tua connessione di rete.",
395
400
  httpError: "Errore HTTP {status}: {statusText}",
401
+ invalidJson: "La risposta del server non è un JSON valido. Verifica l'URL, l'URL di base e l'autenticazione.",
396
402
  noDataAvailable: "Nessun dato disponibile. Configura \"Carica al montaggio\" o aggiungi un parametro di ricerca.",
397
403
  noResults: "Nessun risultato trovato.",
398
404
  noUrlConfigured: "Nessun URL configurato. Aggiungi un URL nella configurazione HTTP.",
@@ -434,7 +440,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
434
440
  invalidFormat: "Formato non valido",
435
441
  required: "Questo campo è obbligatorio"
436
442
  }
437
- }, g = {
443
+ }, ee = {
438
444
  common: {
439
445
  cancel: "Cancelar",
440
446
  clear: "Limpar",
@@ -465,6 +471,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
465
471
  defaultHttpInput: {
466
472
  fetchFailed: "Falha ao buscar dados. Por favor, verifique sua conexão de rede.",
467
473
  httpError: "Erro HTTP {status}: {statusText}",
474
+ invalidJson: "A resposta do servidor não é um JSON válido. Verifique a URL, a URL base e a autenticação.",
468
475
  noDataAvailable: "Nenhum dado disponível. Configure \"Buscar na montagem\" ou adicione um parâmetro de pesquisa.",
469
476
  noResults: "Nenhum resultado encontrado.",
470
477
  noUrlConfigured: "Nenhuma URL configurada. Por favor, adicione uma URL na configuração HTTP.",
@@ -506,28 +513,28 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
506
513
  invalidFormat: "Formato inválido",
507
514
  required: "Este campo é obrigatório"
508
515
  }
509
- }, _ = (e, t = "en") => e ? typeof e == "string" ? e : e[t] || e.en || Object.values(e).find(Boolean) || "" : "", v = {
516
+ }, g = (e, t = "en") => e ? typeof e == "string" ? e : e[t] || e.en || Object.values(e).find(Boolean) || "" : "", _ = {
510
517
  ar: u,
511
518
  de: d,
512
519
  en: f,
513
520
  es: p,
514
521
  fr: m,
515
522
  it: h,
516
- pt: g
517
- }, y = (e, t = "") => Object.keys(e).reduce((n, r) => {
523
+ pt: ee
524
+ }, v = (e, t = "") => Object.keys(e).reduce((n, r) => {
518
525
  let i = e[r], a = t ? `${t}.${r}` : r;
519
- return typeof i == "object" && i && !Array.isArray(i) ? Object.assign(n, y(i, a)) : n[a] = String(i), n;
520
- }, {}), b = (e) => y(v[e] || v.en), x = (e) => {
521
- let t = r(() => b(e), [e]);
522
- return r(() => (n) => n ? typeof n == "object" ? _(n, e) : n in t ? t[n] : n : "", [e, t]);
523
- }, ee = {
526
+ return typeof i == "object" && i && !Array.isArray(i) ? Object.assign(n, v(i, a)) : n[a] = String(i), n;
527
+ }, {}), y = (e) => v(_[e] || _.en), b = (e) => {
528
+ let t = r(() => y(e), [e]);
529
+ return r(() => (n) => n ? typeof n == "object" ? g(n, e) : n in t ? t[n] : n : "", [e, t]);
530
+ }, te = {
524
531
  AND: "AND",
525
532
  OR: "OR"
526
- }, S = {
533
+ }, x = {
527
534
  group: "group",
528
535
  input: "input",
529
536
  ui: "ui"
530
- }, C = {
537
+ }, S = {
531
538
  baseUrl: void 0,
532
539
  flow: null,
533
540
  formErrors: {},
@@ -538,22 +545,22 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
538
545
  language: "",
539
546
  optionsDisplayLimit: void 0,
540
547
  setFieldValue: () => {}
541
- }, w = e(null), te = ({ children: e, value: t }) => {
548
+ }, C = e(null), ne = ({ children: e, value: t }) => {
542
549
  let n = r(() => ({
543
- ...C,
550
+ ...S,
544
551
  ...t
545
552
  }), [t]);
546
- return /* @__PURE__ */ a(w.Provider, {
553
+ return /* @__PURE__ */ a(C.Provider, {
547
554
  value: n,
548
555
  children: e
549
556
  });
550
- }, T = () => {
551
- let e = t(w) ?? C, n = r(() => e.flow?.edges ?? [], [e.flow]);
557
+ }, w = () => {
558
+ let e = t(C) ?? S, n = r(() => e.flow?.edges ?? [], [e.flow]);
552
559
  return {
553
560
  ...e,
554
561
  edges: n
555
562
  };
556
- }, E = [
563
+ }, T = [
557
564
  "b",
558
565
  "i",
559
566
  "em",
@@ -562,14 +569,14 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
562
569
  "br",
563
570
  "p",
564
571
  "span"
565
- ], D = ["class"], O = (e, t = {}) => {
572
+ ], E = ["class"], D = (e, t = {}) => {
566
573
  if (e == null || e === "") return "";
567
574
  let n = String(e), { plainTextOnly: r = !0, allowedTags: i, allowedAttributes: a } = t;
568
575
  if (r) return o.sanitize(n, {
569
576
  ALLOWED_ATTR: [],
570
577
  ALLOWED_TAGS: []
571
578
  });
572
- let s = i ?? E, c = a ?? D;
579
+ let s = i ?? T, c = a ?? E;
573
580
  return o.sanitize(n, {
574
581
  ALLOW_DATA_ATTR: !1,
575
582
  ALLOW_UNKNOWN_PROTOCOLS: !1,
@@ -581,26 +588,26 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
581
588
  RETURN_DOM: !1,
582
589
  RETURN_DOM_FRAGMENT: !1
583
590
  });
584
- }, k = 100, A = (e, t = {}, n = 0, r = /* @__PURE__ */ new WeakSet()) => {
585
- if (n > k) return console.warn(`sanitizeHttpResponse: Maximum depth (${k}) exceeded.`), typeof e == "string" ? O(e, t) : "[Max Depth Exceeded]";
591
+ }, O = 100, k = (e, t = {}, n = 0, r = /* @__PURE__ */ new WeakSet()) => {
592
+ if (n > O) return console.warn(`sanitizeHttpResponse: Maximum depth (${O}) exceeded.`), typeof e == "string" ? D(e, t) : "[Max Depth Exceeded]";
586
593
  if (e == null) return e;
587
- if (typeof e == "string") return O(e, t);
588
- if (Array.isArray(e)) return e.map((e) => A(e, t, n + 1, r));
594
+ if (typeof e == "string") return D(e, t);
595
+ if (Array.isArray(e)) return e.map((e) => k(e, t, n + 1, r));
589
596
  if (typeof e == "object") {
590
597
  if (r.has(e)) return console.warn("sanitizeHttpResponse: Circular reference detected. Breaking cycle to prevent infinite recursion."), "[Circular Reference]";
591
598
  r.add(e);
592
599
  let i = {};
593
- for (let [a, o] of Object.entries(e)) i[a] = A(o, t, n + 1, r);
600
+ for (let [a, o] of Object.entries(e)) i[a] = k(o, t, n + 1, r);
594
601
  return r.delete(e), i;
595
602
  }
596
603
  return e;
597
- }, j = (e) => {
598
- let t = T(), n = x(e ?? t.language);
604
+ }, A = (e) => {
605
+ let t = w(), n = b(e ?? t.language);
599
606
  return r(() => (e) => {
600
607
  let t = n(e);
601
- return typeof e == "object" && e ? O(t) : t;
608
+ return typeof e == "object" && e ? D(t) : t;
602
609
  }, [n]);
603
- }, M = (...e) => {
610
+ }, j = (...e) => {
604
611
  let t = /* @__PURE__ */ new Map();
605
612
  return e.forEach((e) => {
606
613
  e && Object.entries(e).forEach(([e, n]) => {
@@ -610,19 +617,28 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
610
617
  });
611
618
  });
612
619
  }), Object.fromEntries(Array.from(t.values(), ({ key: e, value: t }) => [e, t]));
613
- }, N = (e, t, n) => e && Object.fromEntries(Object.entries(e).map(([e, r]) => [e, F(r, t, n)])), P = (e, t) => {
620
+ }, M = (e, t, n) => e && Object.fromEntries(Object.entries(e).map(([e, r]) => [e, P(r, t, n)])), N = (e, t) => {
614
621
  let n = Object.entries(t ?? {}).filter(([e]) => e);
615
622
  if (n.length === 0) return e;
616
623
  let r = n.map(([e, t]) => `${encodeURIComponent(e)}=${encodeURIComponent(t ?? "")}`).join("&");
617
624
  return r ? `${e}${e.includes("?") ? "&" : "?"}${r}` : e;
618
- }, ne = (e, t) => !(t && e) || /^(https?:)?\/\//i.test(e) ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`, re = async (e) => {
625
+ }, re = (e, t) => !(t && e) || /^(https?:)?\/\//i.test(e) ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`, ie = (e) => {
626
+ try {
627
+ return {
628
+ ok: !0,
629
+ value: JSON.parse(e)
630
+ };
631
+ } catch {
632
+ return { ok: !1 };
633
+ }
634
+ }, ae = async (e) => {
619
635
  try {
620
636
  let { url: t, method: n = "GET", headers: r, queryParams: i, body: a, signal: o } = e;
621
637
  if (!t || t.trim() === "") return {
622
638
  error: "No URL provided",
623
639
  success: !1
624
640
  };
625
- let s = P(t, i), c = M({ "Content-Type": "application/json" }, r), l = {
641
+ let s = N(t, i), c = j({ "Content-Type": "application/json" }, r), l = {
626
642
  headers: Object.fromEntries(Object.entries(c).filter(([, e]) => e)),
627
643
  method: n,
628
644
  signal: o
@@ -651,13 +667,13 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
651
667
  success: !1
652
668
  };
653
669
  }
654
- }, F = (e, t, n = {}) => {
670
+ }, P = (e, t, n = {}) => {
655
671
  if (!e) return "";
656
672
  let { encode: r = !1, json: i = !1 } = n;
657
673
  return e.replace(/\{\{([\w-]+)}}/g, (e, n) => {
658
674
  let a = t[n.trim()];
659
675
  if (a == null) return i ? "null" : "";
660
- let o = typeof a == "string" ? O(a) : a;
676
+ let o = typeof a == "string" ? D(a) : a;
661
677
  if (r) return encodeURIComponent(String(o));
662
678
  if (i) {
663
679
  if (typeof o == "string") return `"${o.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
@@ -666,10 +682,10 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
666
682
  }
667
683
  return String(o);
668
684
  });
669
- }, ie = (e, t) => e ? e.replace(/\{\{response\.([\w.-]+)}}/g, (e, n) => {
670
- let r = ae(t, n.trim());
685
+ }, oe = (e, t) => e ? e.replace(/\{\{response\.([\w.-]+)}}/g, (e, n) => {
686
+ let r = F(t, n.trim());
671
687
  return r == null ? "" : String(r);
672
- }) : "", ae = (e, t) => {
688
+ }) : "", F = (e, t) => {
673
689
  if (!(!e || typeof e != "object")) return t.split(".").reduce((e, t) => {
674
690
  if (!(typeof e != "object" || !e)) return e[t];
675
691
  }, e);
@@ -753,7 +769,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
753
769
  }, r.onerror = () => {
754
770
  n(/* @__PURE__ */ Error(`Failed to read file: ${e.name}`));
755
771
  }, r.readAsDataURL(e);
756
- }), oe = (e) => {
772
+ }), se = (e) => {
757
773
  let t = e.data.split(",")[1], n = atob(t), r = new ArrayBuffer(n.length), i = new Uint8Array(r);
758
774
  for (let e = 0; e < n.length; e++) i[e] = n.charCodeAt(e);
759
775
  let a = new Blob([r], { type: e.type });
@@ -761,13 +777,13 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
761
777
  lastModified: e.lastModified,
762
778
  type: e.type
763
779
  });
764
- }, se = (e) => Promise.all(e.map((e) => q(e))), ce = new Set([
780
+ }, ce = (e) => Promise.all(e.map((e) => q(e))), le = new Set([
765
781
  "text",
766
782
  "number",
767
783
  "password",
768
784
  "textarea",
769
785
  "time"
770
- ]), le = (e) => e.filter(s), J = (e) => {
786
+ ]), ue = (e) => e.filter(s), J = (e) => {
771
787
  if (e.data.name) return e.data.name;
772
788
  if (e.data.label) {
773
789
  if (e.data.label.en) return e.data.label.en;
@@ -775,10 +791,10 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
775
791
  if (t) return t;
776
792
  }
777
793
  return e.id;
778
- }, ue = (e, t) => _(e.data.label, t) || e.data.name || e.id, de = (e, t) => {
794
+ }, de = (e, t) => g(e.data.label, t) || e.data.name || e.id, fe = (e, t) => {
779
795
  let n = e.type ?? "text";
780
- return !e.placeholder?.[t] && ce.has(n) ? b(t)["renderer.defaultInputs.newAnswer"] ?? "" : _(e.placeholder, t);
781
- }, fe = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, pe = (e, t) => e ? t[e] != null : !1, Y = (e, t) => {
796
+ return !e.placeholder?.[t] && le.has(n) ? y(t)["renderer.defaultInputs.newAnswer"] ?? "" : g(e.placeholder, t);
797
+ }, pe = (e) => e == null || typeof e == "string" && e.trim() === "" ? !0 : Array.isArray(e) && e.length === 0, me = (e, t) => e ? t[e] != null : !1, Y = (e, t) => {
782
798
  let { defaultValue: n } = e.data;
783
799
  if (n) {
784
800
  if (n.type === "static" && n.staticValue !== void 0) return n.staticValue;
@@ -787,7 +803,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
787
803
  if (e !== void 0) return e;
788
804
  }
789
805
  }
790
- }, me = (e, t) => {
806
+ }, he = (e, t) => {
791
807
  let n = {};
792
808
  return t.forEach((t) => {
793
809
  if (e[t.id] !== void 0) {
@@ -801,7 +817,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
801
817
  let t = Y(e, n);
802
818
  t !== void 0 && (n[e.id] = t);
803
819
  }), n;
804
- }, he = (e, t) => {
820
+ }, ge = (e, t) => {
805
821
  let n = {};
806
822
  return t.forEach((t) => {
807
823
  let r = t.id, i = J(t);
@@ -850,7 +866,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
850
866
  } catch {
851
867
  return !1;
852
868
  }
853
- }, ge = (e, t, n) => {
869
+ }, _e = (e, t, n) => {
854
870
  let r = {};
855
871
  return e.forEach((e) => {
856
872
  let { defaultValue: i } = e.data;
@@ -907,7 +923,7 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
907
923
  colors: Q.light,
908
924
  setTheme: () => null,
909
925
  theme: "system"
910
- }), _e = ({ children: e, defaultTheme: t = "system", storageKey: o = "treege-theme", theme: s, ...c }) => {
926
+ }), ve = ({ children: e, defaultTheme: t = "system", storageKey: o = "treege-theme", theme: s, ...c }) => {
911
927
  let [l, u] = i(() => s || typeof window < "u" && localStorage.getItem(o) || t), d = s ?? l, f = Q[d === "system" ? typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : d], p = r(() => ({
912
928
  colors: f,
913
929
  setTheme: (e) => {
@@ -939,10 +955,10 @@ var s = (e) => e?.type === "input", c = (e) => e?.type === "ui", l = (e) => e?.t
939
955
  value: p,
940
956
  children: e
941
957
  });
942
- }, ve = () => {
958
+ }, ye = () => {
943
959
  let e = t($);
944
960
  if (e === void 0) throw Error("useTheme must be used within a ThemeProvider");
945
961
  return e;
946
962
  };
947
963
  //#endregion
948
- export { A, c as B, M as C, ne as D, N as E, x as F, b as I, _ as L, T as M, S as N, j as O, ee as P, l as R, re as S, F as T, G as _, ge as a, L as b, fe as c, de as d, J as f, oe as g, se as h, me as i, te as j, O as k, Y as l, q as m, ve as n, pe as o, ue as p, X as r, he as s, _e as t, le as u, K as v, ie as w, I as x, P as y, s as z };
964
+ export { D as A, s as B, j as C, re as D, M as E, te as F, b as I, y as L, ne as M, w as N, ie as O, x as P, g as R, ae as S, P as T, c as V, G as _, _e as a, L as b, pe as c, fe as d, J as f, se as g, ce as h, he as i, k as j, A as k, Y as l, q as m, ye as n, me as o, de as p, X as r, ge as s, ve as t, ue as u, K as v, oe as w, I as x, N as y, l as z };