@swisper.ai/web-chat-ui 0.2.15 → 0.3.1
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.
- package/README.md +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts +10 -10
- package/dist/components/chat-thinking-process/chat-thinking-process.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts +5 -2
- package/dist/components/chat-thinking-process/chat-thinking-process.stories.d.ts.map +1 -1
- package/dist/components/chat-thinking-process/index.d.ts +1 -1
- package/dist/components/chat-thinking-process/index.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +272 -276
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chat-thinking-process/chat-thinking-process.json +17 -11
- package/src/components/chat-thinking-process/chat-thinking-process.stories.tsx +50 -26
- package/src/components/chat-thinking-process/chat-thinking-process.tsx +54 -60
- package/src/components/chat-thinking-process/index.ts +1 -0
- package/src/docs/agent.stories.tsx +1 -1
package/dist/index.es.js
CHANGED
|
@@ -2663,7 +2663,7 @@ var bo = F(function({ children: e, className: t, defaultOpen: n = !1, isStreamin
|
|
|
2663
2663
|
"data-slot": "chat-thinking-process",
|
|
2664
2664
|
"data-testid": "chat-thinking-process",
|
|
2665
2665
|
"data-streaming": r,
|
|
2666
|
-
className: N("group/thinking-process", "flex flex-col", t),
|
|
2666
|
+
className: N("group/thinking-process", "flex flex-col py-6", t),
|
|
2667
2667
|
children: e
|
|
2668
2668
|
})
|
|
2669
2669
|
});
|
|
@@ -2673,7 +2673,7 @@ function xo({ children: e, className: t, ...n }) {
|
|
|
2673
2673
|
return /* @__PURE__ */ W(u, {
|
|
2674
2674
|
"data-slot": "chat-thinking-process-trigger",
|
|
2675
2675
|
"data-testid": "chat-thinking-process-trigger",
|
|
2676
|
-
className: N("flex w-full items-center gap-
|
|
2676
|
+
className: N("flex w-full items-center gap-8", "cursor-pointer text-left", t),
|
|
2677
2677
|
...n,
|
|
2678
2678
|
children: [e, /* @__PURE__ */ U("style", { children: "\n @keyframes shimmer {\n 100% {\n mask-position: left;\n }\n }\n " })]
|
|
2679
2679
|
});
|
|
@@ -2682,7 +2682,7 @@ function So({ children: e, className: t, ...n }) {
|
|
|
2682
2682
|
return /* @__PURE__ */ U("span", {
|
|
2683
2683
|
"data-slot": "chat-thinking-process-trigger-icon",
|
|
2684
2684
|
"data-testid": "chat-thinking-process-trigger-icon",
|
|
2685
|
-
className: N("inline-flex shrink-0 items-center justify-center", t),
|
|
2685
|
+
className: N("inline-flex size-20 shrink-0 items-center justify-center", "text-layout-foreground-light", "[&>svg]:size-20", t),
|
|
2686
2686
|
...n,
|
|
2687
2687
|
children: e
|
|
2688
2688
|
});
|
|
@@ -2690,10 +2690,10 @@ function So({ children: e, className: t, ...n }) {
|
|
|
2690
2690
|
function Co({ children: e, className: t, ...n }) {
|
|
2691
2691
|
return /* @__PURE__ */ U(M, {
|
|
2692
2692
|
asChild: !0,
|
|
2693
|
-
variant: "body-
|
|
2693
|
+
variant: "body-small-low",
|
|
2694
2694
|
"data-slot": "chat-thinking-process-trigger-label",
|
|
2695
2695
|
"data-testid": "chat-thinking-process-trigger-label",
|
|
2696
|
-
className: N("text-
|
|
2696
|
+
className: N("text-layout-foreground-light", "group-data-[streaming=true]/thinking-process:mask-[linear-gradient(-60deg,#000_30%,rgba(0,0,0,0.2),#192029_70%)]", "group-data-[streaming=true]/thinking-process:mask-size-[300%_100%]", "group-data-[streaming=true]/thinking-process:mask-right", "group-data-[streaming=true]/thinking-process:animate-[shimmer_3.2s_infinite]", t),
|
|
2697
2697
|
children: /* @__PURE__ */ U("span", {
|
|
2698
2698
|
...n,
|
|
2699
2699
|
children: e
|
|
@@ -2704,12 +2704,12 @@ function wo({ className: e, ...t }) {
|
|
|
2704
2704
|
return /* @__PURE__ */ U(c, {
|
|
2705
2705
|
"data-slot": "chat-thinking-process-trigger-arrow",
|
|
2706
2706
|
"data-testid": "chat-thinking-process-trigger-arrow",
|
|
2707
|
-
className: N("items-center justify-center text-
|
|
2707
|
+
className: N("items-center justify-center text-layout-foreground-light", "size-16", e),
|
|
2708
2708
|
...t
|
|
2709
2709
|
});
|
|
2710
2710
|
}
|
|
2711
|
-
function To({ children: e, className: t, itemsClassName: n,
|
|
2712
|
-
let { lastItemContent:
|
|
2711
|
+
function To({ children: e, className: t, itemsClassName: n, previewClassName: r, hasLastMessagePreview: i = !0, ...a }) {
|
|
2712
|
+
let { lastItemContent: o, lastItemIndex: s } = B(() => {
|
|
2713
2713
|
let t = he.Children.toArray(e);
|
|
2714
2714
|
return {
|
|
2715
2715
|
lastItemContent: t.at(-1),
|
|
@@ -2719,38 +2719,21 @@ function To({ children: e, className: t, itemsClassName: n, rowClassName: r, mar
|
|
|
2719
2719
|
return /* @__PURE__ */ W("div", {
|
|
2720
2720
|
"data-slot": "chat-thinking-process-content",
|
|
2721
2721
|
"data-testid": "chat-thinking-process-content",
|
|
2722
|
-
"data-preview":
|
|
2723
|
-
className: N("
|
|
2724
|
-
children: [
|
|
2722
|
+
"data-preview": i,
|
|
2723
|
+
className: N("pl-[28px]", t),
|
|
2724
|
+
children: [i && o && /* @__PURE__ */ U(nn, {
|
|
2725
2725
|
mode: "wait",
|
|
2726
2726
|
children: /* @__PURE__ */ U(Eo, {
|
|
2727
|
-
contentId:
|
|
2728
|
-
className:
|
|
2729
|
-
children:
|
|
2727
|
+
contentId: s,
|
|
2728
|
+
className: r,
|
|
2729
|
+
children: o
|
|
2730
2730
|
})
|
|
2731
2731
|
}), /* @__PURE__ */ U(l, {
|
|
2732
2732
|
"data-slot": "chat-thinking-process-content-items",
|
|
2733
2733
|
"data-testid": "chat-thinking-process-content-items",
|
|
2734
|
-
className: N("flex flex-col", n),
|
|
2735
|
-
...
|
|
2736
|
-
children:
|
|
2737
|
-
"data-slot": "chat-thinking-process-content-row",
|
|
2738
|
-
className: N("relative flex gap-8 text-text-secondary text-sm last:pb-0", "pl-8", "last:[&>div:first-child>span:last-child]:hidden", r),
|
|
2739
|
-
children: [/* @__PURE__ */ W("div", {
|
|
2740
|
-
className: "relative flex w-8 shrink-0 flex-col items-center self-stretch",
|
|
2741
|
-
"aria-hidden": !0,
|
|
2742
|
-
children: [/* @__PURE__ */ U("span", {
|
|
2743
|
-
"data-slot": "chat-thinking-process-content-marker",
|
|
2744
|
-
className: N("mt-[7px] size-[6px] shrink-0 rounded-full bg-text-secondary", i)
|
|
2745
|
-
}), /* @__PURE__ */ U("span", {
|
|
2746
|
-
"data-slot": "chat-thinking-process-content-connector",
|
|
2747
|
-
className: N("absolute top-[16px] bottom-[-4px] left-1/2 w-px -translate-x-1/2 bg-component-divider", a)
|
|
2748
|
-
})]
|
|
2749
|
-
}), /* @__PURE__ */ U("div", {
|
|
2750
|
-
className: "min-w-0 flex-1 pb-8",
|
|
2751
|
-
children: e
|
|
2752
|
-
})]
|
|
2753
|
-
}))
|
|
2734
|
+
className: N("flex flex-col gap-4 pt-2", n),
|
|
2735
|
+
...a,
|
|
2736
|
+
children: e
|
|
2754
2737
|
})]
|
|
2755
2738
|
});
|
|
2756
2739
|
}
|
|
@@ -2765,29 +2748,42 @@ function Eo({ children: e, className: t, contentId: n }) {
|
|
|
2765
2748
|
duration: .25,
|
|
2766
2749
|
ease: "easeOut"
|
|
2767
2750
|
},
|
|
2768
|
-
className: N("group-data-[streaming=false]/thinking-process:hidden", "group-data-[state=open]/thinking-process:hidden", "
|
|
2751
|
+
className: N("group-data-[streaming=false]/thinking-process:hidden", "group-data-[state=open]/thinking-process:hidden", "pt-2", t),
|
|
2769
2752
|
children: e
|
|
2770
2753
|
}, n);
|
|
2771
2754
|
}
|
|
2772
2755
|
function Do({ children: e, className: t, ...n }) {
|
|
2773
|
-
return /* @__PURE__ */ U(
|
|
2756
|
+
return /* @__PURE__ */ U(M, {
|
|
2757
|
+
asChild: !0,
|
|
2758
|
+
variant: "body-small-low",
|
|
2774
2759
|
"data-slot": "chat-thinking-process-content-item",
|
|
2775
2760
|
"data-testid": "chat-thinking-process-content-item",
|
|
2776
|
-
className: N("
|
|
2761
|
+
className: N("flex items-center gap-4 italic text-layout-foreground-subtle", t),
|
|
2762
|
+
children: /* @__PURE__ */ U("div", {
|
|
2763
|
+
...n,
|
|
2764
|
+
children: e
|
|
2765
|
+
})
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
function Oo({ children: e, className: t, ...n }) {
|
|
2769
|
+
return /* @__PURE__ */ U("span", {
|
|
2770
|
+
"data-slot": "chat-thinking-process-content-item-icon",
|
|
2771
|
+
"data-testid": "chat-thinking-process-content-item-icon",
|
|
2772
|
+
className: N("inline-flex h-[14px] shrink-0 items-center justify-center", "[&>img]:h-full [&>img]:w-auto", "[&>svg]:size-[14px]", t),
|
|
2777
2773
|
...n,
|
|
2778
2774
|
children: e
|
|
2779
2775
|
});
|
|
2780
2776
|
}
|
|
2781
2777
|
//#endregion
|
|
2782
2778
|
//#region src/components/deprecated-empty-state.ts
|
|
2783
|
-
var
|
|
2779
|
+
var ko = f, Ao = h, jo = g, Mo = m, No = p, Po = {
|
|
2784
2780
|
paragraph: "editor-paragraph",
|
|
2785
2781
|
text: {
|
|
2786
2782
|
bold: "editor-text-bold",
|
|
2787
2783
|
italic: "editor-text-italic",
|
|
2788
2784
|
underline: "editor-text-underline"
|
|
2789
2785
|
}
|
|
2790
|
-
},
|
|
2786
|
+
}, Fo = class e extends rt {
|
|
2791
2787
|
__src;
|
|
2792
2788
|
__altText;
|
|
2793
2789
|
static getType() {
|
|
@@ -2825,7 +2821,7 @@ var Oo = f, ko = h, Ao = g, jo = m, Mo = p, No = {
|
|
|
2825
2821
|
return { img: () => ({
|
|
2826
2822
|
conversion: (e) => {
|
|
2827
2823
|
let t = e.getAttribute("src") || "", n = e.getAttribute("alt") || "";
|
|
2828
|
-
return t ? { node:
|
|
2824
|
+
return t ? { node: Io(t, n) } : null;
|
|
2829
2825
|
},
|
|
2830
2826
|
priority: 0
|
|
2831
2827
|
}) };
|
|
@@ -2840,21 +2836,21 @@ var Oo = f, ko = h, Ao = g, jo = m, Mo = p, No = {
|
|
|
2840
2836
|
};
|
|
2841
2837
|
}
|
|
2842
2838
|
static importJSON(e) {
|
|
2843
|
-
return
|
|
2839
|
+
return Io(e.src, e.altText);
|
|
2844
2840
|
}
|
|
2845
2841
|
isInline() {
|
|
2846
2842
|
return !1;
|
|
2847
2843
|
}
|
|
2848
2844
|
};
|
|
2849
|
-
function
|
|
2850
|
-
return new
|
|
2845
|
+
function Io(e, t) {
|
|
2846
|
+
return new Fo(e, t);
|
|
2851
2847
|
}
|
|
2852
|
-
function
|
|
2853
|
-
return e instanceof
|
|
2848
|
+
function Lo(e) {
|
|
2849
|
+
return e instanceof Fo;
|
|
2854
2850
|
}
|
|
2855
2851
|
//#endregion
|
|
2856
2852
|
//#region src/components/rich-text-area/transformers.ts
|
|
2857
|
-
function
|
|
2853
|
+
function Ro(e) {
|
|
2858
2854
|
let t = /font-size\s*:\s*([^;]+)/i, n = /font-family\s*:\s*([^;]+)/i, r = /(?<![\w-])color\s*:\s*([^;]+)/i, i = t.exec(e), a = n.exec(e), o = r.exec(e);
|
|
2859
2855
|
return {
|
|
2860
2856
|
fontSize: i ? i[1].trim() : null,
|
|
@@ -2862,7 +2858,7 @@ function Lo(e) {
|
|
|
2862
2858
|
color: o ? o[1].trim() : null
|
|
2863
2859
|
};
|
|
2864
2860
|
}
|
|
2865
|
-
var
|
|
2861
|
+
var zo = {
|
|
2866
2862
|
type: "text-match",
|
|
2867
2863
|
trigger: "",
|
|
2868
2864
|
regExp: /./,
|
|
@@ -2870,14 +2866,14 @@ var Ro = {
|
|
|
2870
2866
|
dependencies: [],
|
|
2871
2867
|
export: (e) => {
|
|
2872
2868
|
if (!Y(e)) return null;
|
|
2873
|
-
let t = e.getStyle() ?? "", n = e.getTextContent(), r =
|
|
2869
|
+
let t = e.getStyle() ?? "", n = e.getTextContent(), r = Ro(t);
|
|
2874
2870
|
if (r.fontSize || r.fontFamily || r.color) {
|
|
2875
2871
|
let e = "";
|
|
2876
2872
|
return r.fontSize && (e += `font-size: ${r.fontSize};`), r.fontFamily && (e += `font-family: ${r.fontFamily};`), r.color && (e += `color: ${r.color};`), `<span style="${e}">${n}</span>`;
|
|
2877
2873
|
}
|
|
2878
2874
|
return null;
|
|
2879
2875
|
}
|
|
2880
|
-
},
|
|
2876
|
+
}, Bo = {
|
|
2881
2877
|
type: "text-match",
|
|
2882
2878
|
trigger: "",
|
|
2883
2879
|
regExp: /<span\s+style="([^"]+)">(.+?)<\/span>/,
|
|
@@ -2887,7 +2883,7 @@ var Ro = {
|
|
|
2887
2883
|
let [, n, r] = t, i = Ke(r);
|
|
2888
2884
|
return i.setFormat(e.getFormat()), i.setStyle(n), e.replace(i), i;
|
|
2889
2885
|
}
|
|
2890
|
-
},
|
|
2886
|
+
}, Vo = {
|
|
2891
2887
|
type: "text-match",
|
|
2892
2888
|
trigger: "",
|
|
2893
2889
|
regExp: /<ins>(.*?)<\/ins>/,
|
|
@@ -2898,15 +2894,15 @@ var Ro = {
|
|
|
2898
2894
|
return n.setFormat(e.getFormat()), n.hasFormat("underline") || n.toggleFormat("underline"), e.replace(n), n;
|
|
2899
2895
|
},
|
|
2900
2896
|
export: (e) => !Y(e) || !e.hasFormat("underline") ? null : `<ins>${e.getTextContent()}</ins>`
|
|
2901
|
-
},
|
|
2897
|
+
}, Ho = (e) => {
|
|
2902
2898
|
let t = /text-align:\s*(\w+)/i.exec(e);
|
|
2903
2899
|
return t ? t[1].trim() : null;
|
|
2904
|
-
},
|
|
2900
|
+
}, Uo = {
|
|
2905
2901
|
type: "element",
|
|
2906
2902
|
dependencies: [],
|
|
2907
2903
|
regExp: /<div\s+style="([^"]+)">(.*?)<\/div>/,
|
|
2908
2904
|
replace: (e, t, n) => {
|
|
2909
|
-
let r =
|
|
2905
|
+
let r = Ho(n[1]);
|
|
2910
2906
|
if (!r) return !1;
|
|
2911
2907
|
if (!n[2]) return;
|
|
2912
2908
|
let i = t[0];
|
|
@@ -2917,39 +2913,39 @@ var Ro = {
|
|
|
2917
2913
|
let n = e.getFormatType();
|
|
2918
2914
|
return !n || n === "left" ? null : `<div style="text-align: ${n}">${t(e)}</div>`;
|
|
2919
2915
|
}
|
|
2920
|
-
},
|
|
2916
|
+
}, Wo = {
|
|
2921
2917
|
type: "text-match",
|
|
2922
2918
|
trigger: "",
|
|
2923
2919
|
regExp: /./,
|
|
2924
2920
|
importRegExp: /./,
|
|
2925
|
-
dependencies: [
|
|
2926
|
-
export: (e) =>
|
|
2927
|
-
},
|
|
2921
|
+
dependencies: [Fo],
|
|
2922
|
+
export: (e) => Lo(e) ? `<img src="${e.__src}" alt="${e.__altText}" />` : null
|
|
2923
|
+
}, Go = {
|
|
2928
2924
|
type: "text-match",
|
|
2929
2925
|
trigger: "",
|
|
2930
2926
|
regExp: /<img\s+src="([^"]+)"\s+alt="([^"]*)"[^>]*\/?>/,
|
|
2931
2927
|
importRegExp: /<img\s+src="([^"]+)"\s+alt="([^"]*)"[^>]*\/?>/,
|
|
2932
|
-
dependencies: [
|
|
2928
|
+
dependencies: [Fo],
|
|
2933
2929
|
replace: (e, t) => {
|
|
2934
|
-
let [, n, r] = t, i =
|
|
2930
|
+
let [, n, r] = t, i = Io(n, r);
|
|
2935
2931
|
e.replace(i);
|
|
2936
2932
|
}
|
|
2937
|
-
},
|
|
2938
|
-
...He,
|
|
2939
|
-
Ro,
|
|
2940
|
-
Bo,
|
|
2941
|
-
Ho,
|
|
2942
|
-
Uo
|
|
2943
|
-
], Ko = [
|
|
2933
|
+
}, Ko = [
|
|
2944
2934
|
...He,
|
|
2945
2935
|
zo,
|
|
2946
|
-
|
|
2947
|
-
|
|
2936
|
+
Vo,
|
|
2937
|
+
Uo,
|
|
2948
2938
|
Wo
|
|
2939
|
+
], qo = [
|
|
2940
|
+
...He,
|
|
2941
|
+
Bo,
|
|
2942
|
+
Vo,
|
|
2943
|
+
Uo,
|
|
2944
|
+
Go
|
|
2949
2945
|
];
|
|
2950
2946
|
//#endregion
|
|
2951
2947
|
//#region src/components/rich-text-area/html-config.ts
|
|
2952
|
-
function
|
|
2948
|
+
function Jo(e) {
|
|
2953
2949
|
let t = e.nodeName.toLowerCase();
|
|
2954
2950
|
if (t !== "h1" && t !== "h2" && t !== "h3" && t !== "h4" && t !== "h5" && t !== "h6") return null;
|
|
2955
2951
|
let n = Fe(t), r = e.getAttribute("style") ?? "";
|
|
@@ -2959,22 +2955,22 @@ function qo(e) {
|
|
|
2959
2955
|
}
|
|
2960
2956
|
return { node: n };
|
|
2961
2957
|
}
|
|
2962
|
-
function
|
|
2958
|
+
function Yo(e) {
|
|
2963
2959
|
if (e.getAttribute("__lexicallisttype") === "check" || e.classList.contains("contains-task-list")) return !0;
|
|
2964
2960
|
for (let t of e.childNodes) if (pt(t) && t.hasAttribute("aria-checked")) return !0;
|
|
2965
2961
|
return !1;
|
|
2966
2962
|
}
|
|
2967
|
-
function
|
|
2963
|
+
function Xo(e) {
|
|
2968
2964
|
let t = e.nodeName.toLowerCase(), n = null;
|
|
2969
2965
|
if (t === "ol") {
|
|
2970
2966
|
let t = e.start;
|
|
2971
2967
|
n = De("number", t);
|
|
2972
|
-
} else t === "ul" && (n =
|
|
2968
|
+
} else t === "ul" && (n = Yo(e) ? De("check") : De("bullet"));
|
|
2973
2969
|
if (!n) return null;
|
|
2974
2970
|
let r = e.getAttribute("style") ?? "";
|
|
2975
2971
|
return n.setStyle(r), { node: n };
|
|
2976
2972
|
}
|
|
2977
|
-
function
|
|
2973
|
+
function Zo(e) {
|
|
2978
2974
|
if (e.classList.contains("task-list-item")) {
|
|
2979
2975
|
for (let t of e.children) if (t.tagName === "INPUT") {
|
|
2980
2976
|
let n = t;
|
|
@@ -2988,8 +2984,8 @@ function Xo(e) {
|
|
|
2988
2984
|
return n.setStyle(r), { node: n };
|
|
2989
2985
|
}
|
|
2990
2986
|
var Z = 4;
|
|
2991
|
-
function
|
|
2992
|
-
let { color: t, fontSize: n, fontFamily: r } =
|
|
2987
|
+
function Qo(e) {
|
|
2988
|
+
let { color: t, fontSize: n, fontFamily: r } = Ro(e.getAttribute("style") ?? "");
|
|
2993
2989
|
if (!t && !n && !r) return null;
|
|
2994
2990
|
let i = e.style;
|
|
2995
2991
|
return {
|
|
@@ -3003,59 +2999,59 @@ function Zo(e) {
|
|
|
3003
2999
|
node: null
|
|
3004
3000
|
};
|
|
3005
3001
|
}
|
|
3006
|
-
var
|
|
3002
|
+
var $o = {
|
|
3007
3003
|
h1: () => ({
|
|
3008
|
-
conversion:
|
|
3004
|
+
conversion: Jo,
|
|
3009
3005
|
priority: Z
|
|
3010
3006
|
}),
|
|
3011
3007
|
h2: () => ({
|
|
3012
|
-
conversion:
|
|
3008
|
+
conversion: Jo,
|
|
3013
3009
|
priority: Z
|
|
3014
3010
|
}),
|
|
3015
3011
|
h3: () => ({
|
|
3016
|
-
conversion:
|
|
3012
|
+
conversion: Jo,
|
|
3017
3013
|
priority: Z
|
|
3018
3014
|
}),
|
|
3019
3015
|
h4: () => ({
|
|
3020
|
-
conversion:
|
|
3016
|
+
conversion: Jo,
|
|
3021
3017
|
priority: Z
|
|
3022
3018
|
}),
|
|
3023
3019
|
h5: () => ({
|
|
3024
|
-
conversion:
|
|
3020
|
+
conversion: Jo,
|
|
3025
3021
|
priority: Z
|
|
3026
3022
|
}),
|
|
3027
3023
|
h6: () => ({
|
|
3028
|
-
conversion:
|
|
3024
|
+
conversion: Jo,
|
|
3029
3025
|
priority: Z
|
|
3030
3026
|
}),
|
|
3031
3027
|
ul: () => ({
|
|
3032
|
-
conversion:
|
|
3028
|
+
conversion: Xo,
|
|
3033
3029
|
priority: Z
|
|
3034
3030
|
}),
|
|
3035
3031
|
ol: () => ({
|
|
3036
|
-
conversion:
|
|
3032
|
+
conversion: Xo,
|
|
3037
3033
|
priority: Z
|
|
3038
3034
|
}),
|
|
3039
3035
|
li: () => ({
|
|
3040
|
-
conversion:
|
|
3036
|
+
conversion: Zo,
|
|
3041
3037
|
priority: Z
|
|
3042
3038
|
}),
|
|
3043
3039
|
span: () => ({
|
|
3044
|
-
conversion:
|
|
3040
|
+
conversion: Qo,
|
|
3045
3041
|
priority: Z
|
|
3046
3042
|
})
|
|
3047
3043
|
};
|
|
3048
|
-
function
|
|
3044
|
+
function es(e) {
|
|
3049
3045
|
return (t, n) => {
|
|
3050
3046
|
let r = e.prototype.exportDOM.call(n, t), i = n.getStyle();
|
|
3051
3047
|
return r.element && i && r.element.setAttribute("style", i), r;
|
|
3052
3048
|
};
|
|
3053
3049
|
}
|
|
3054
|
-
var
|
|
3055
|
-
[Ie,
|
|
3056
|
-
[ke,
|
|
3057
|
-
[Oe,
|
|
3058
|
-
]),
|
|
3050
|
+
var ts = /* @__PURE__ */ new Map([
|
|
3051
|
+
[Ie, es(Ie)],
|
|
3052
|
+
[ke, es(ke)],
|
|
3053
|
+
[Oe, es(Oe)]
|
|
3054
|
+
]), ns = class e extends it {
|
|
3059
3055
|
static getType() {
|
|
3060
3056
|
return "div-block";
|
|
3061
3057
|
}
|
|
@@ -3072,7 +3068,7 @@ var es = /* @__PURE__ */ new Map([
|
|
|
3072
3068
|
}
|
|
3073
3069
|
static importDOM() {
|
|
3074
3070
|
return { div: () => ({
|
|
3075
|
-
conversion:
|
|
3071
|
+
conversion: rs,
|
|
3076
3072
|
priority: 4
|
|
3077
3073
|
}) };
|
|
3078
3074
|
}
|
|
@@ -3084,7 +3080,7 @@ var es = /* @__PURE__ */ new Map([
|
|
|
3084
3080
|
} : e;
|
|
3085
3081
|
}
|
|
3086
3082
|
static importJSON(e) {
|
|
3087
|
-
let t =
|
|
3083
|
+
let t = is().updateFromJSON(e);
|
|
3088
3084
|
return e.style !== void 0 && t.setStyle(e.style), t;
|
|
3089
3085
|
}
|
|
3090
3086
|
updateFromJSON(e) {
|
|
@@ -3103,26 +3099,26 @@ var es = /* @__PURE__ */ new Map([
|
|
|
3103
3099
|
return !1;
|
|
3104
3100
|
}
|
|
3105
3101
|
};
|
|
3106
|
-
function
|
|
3107
|
-
let t =
|
|
3102
|
+
function rs(e) {
|
|
3103
|
+
let t = is(), n = e.getAttribute("style") ?? "";
|
|
3108
3104
|
if (t.setStyle(n), e.style) {
|
|
3109
3105
|
let n = e.style.textAlign;
|
|
3110
3106
|
(n === "left" || n === "right" || n === "center" || n === "justify" || n === "start" || n === "end") && t.setFormat(n), mt(e, t);
|
|
3111
3107
|
}
|
|
3112
3108
|
return { node: t };
|
|
3113
3109
|
}
|
|
3114
|
-
function
|
|
3115
|
-
return new
|
|
3110
|
+
function is() {
|
|
3111
|
+
return new ns();
|
|
3116
3112
|
}
|
|
3117
3113
|
//#endregion
|
|
3118
3114
|
//#region src/components/rich-text-area/plugins/value-plugin.tsx
|
|
3119
|
-
var
|
|
3120
|
-
function
|
|
3115
|
+
var as = 50;
|
|
3116
|
+
function os({ onChange: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
3121
3117
|
let r = I((r, i, a) => {
|
|
3122
3118
|
if (!a.has("focus") && e) try {
|
|
3123
3119
|
r.read(() => {
|
|
3124
|
-
let r = t === "html" ? ln(i) : Be(
|
|
3125
|
-
n && (n.current.push(r), n.current.splice(0, n.current.length -
|
|
3120
|
+
let r = t === "html" ? ln(i) : Be(Ko);
|
|
3121
|
+
n && (n.current.push(r), n.current.splice(0, n.current.length - as)), e(r);
|
|
3126
3122
|
});
|
|
3127
3123
|
} catch {}
|
|
3128
3124
|
}, [
|
|
@@ -3138,7 +3134,7 @@ function Q() {
|
|
|
3138
3134
|
let [e] = Re();
|
|
3139
3135
|
return e;
|
|
3140
3136
|
}
|
|
3141
|
-
function
|
|
3137
|
+
function ss() {
|
|
3142
3138
|
let [e] = Re();
|
|
3143
3139
|
return I(() => {
|
|
3144
3140
|
let t = "";
|
|
@@ -3149,7 +3145,7 @@ function os() {
|
|
|
3149
3145
|
}
|
|
3150
3146
|
//#endregion
|
|
3151
3147
|
//#region src/components/rich-text-area/plugins/disabled-plugin.tsx
|
|
3152
|
-
function
|
|
3148
|
+
function cs({ isDisabled: e }) {
|
|
3153
3149
|
let t = Q();
|
|
3154
3150
|
return R(() => {
|
|
3155
3151
|
t.setEditable(!e);
|
|
@@ -3157,7 +3153,7 @@ function ss({ isDisabled: e }) {
|
|
|
3157
3153
|
}
|
|
3158
3154
|
//#endregion
|
|
3159
3155
|
//#region src/components/rich-text-area/plugins/controlled-plugin.tsx
|
|
3160
|
-
function
|
|
3156
|
+
function ls({ controlledRef: e }) {
|
|
3161
3157
|
let t = V(null);
|
|
3162
3158
|
return be(e, () => ({ focus: () => {
|
|
3163
3159
|
Promise.resolve().then(() => {
|
|
@@ -3167,11 +3163,11 @@ function cs({ controlledRef: e }) {
|
|
|
3167
3163
|
}
|
|
3168
3164
|
//#endregion
|
|
3169
3165
|
//#region src/components/rich-text-area/utils/index.ts
|
|
3170
|
-
function
|
|
3166
|
+
function us(e) {
|
|
3171
3167
|
let t = e.getRootElement();
|
|
3172
3168
|
t && (t.scrollTop = t.scrollHeight);
|
|
3173
3169
|
}
|
|
3174
|
-
function
|
|
3170
|
+
function ds() {
|
|
3175
3171
|
let e = K().getLastDescendant();
|
|
3176
3172
|
if (e && Y(e)) {
|
|
3177
3173
|
let t = Ge(), n = e.getTextContentSize();
|
|
@@ -3185,7 +3181,7 @@ function us() {
|
|
|
3185
3181
|
}
|
|
3186
3182
|
}
|
|
3187
3183
|
}
|
|
3188
|
-
function
|
|
3184
|
+
function fs(e, t) {
|
|
3189
3185
|
let n = new DOMParser().parseFromString(t, "text/html");
|
|
3190
3186
|
return un(e, n).map((e) => {
|
|
3191
3187
|
if (Y(e)) {
|
|
@@ -3195,12 +3191,12 @@ function ds(e, t) {
|
|
|
3195
3191
|
return e;
|
|
3196
3192
|
});
|
|
3197
3193
|
}
|
|
3198
|
-
function
|
|
3194
|
+
function ps(e, t) {
|
|
3199
3195
|
let n = K();
|
|
3200
|
-
n.clear(),
|
|
3196
|
+
n.clear(), fs(e, t).forEach((e) => n.append(e));
|
|
3201
3197
|
}
|
|
3202
|
-
function
|
|
3203
|
-
let n = q(), r =
|
|
3198
|
+
function ms(e, t) {
|
|
3199
|
+
let n = q(), r = fs(e, t);
|
|
3204
3200
|
if (J(n)) n.insertNodes(r);
|
|
3205
3201
|
else {
|
|
3206
3202
|
let e = K();
|
|
@@ -3209,7 +3205,7 @@ function ps(e, t) {
|
|
|
3209
3205
|
}
|
|
3210
3206
|
//#endregion
|
|
3211
3207
|
//#region src/components/rich-text-area/plugins/controlled-value-plugin.tsx
|
|
3212
|
-
function
|
|
3208
|
+
function hs({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
3213
3209
|
let r = Q(), i = V(), a = V(!!e?.trim()), o = pe("desktop");
|
|
3214
3210
|
return R(() => {
|
|
3215
3211
|
if (!r || e === i.current) return;
|
|
@@ -3219,20 +3215,20 @@ function ms({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3219
3215
|
}
|
|
3220
3216
|
let s = "";
|
|
3221
3217
|
if (r.getEditorState().read(() => {
|
|
3222
|
-
s = t === "html" ? ln(r) : Be(
|
|
3218
|
+
s = t === "html" ? ln(r) : Be(Ko);
|
|
3223
3219
|
}), e !== void 0 && e !== s) {
|
|
3224
3220
|
if (e === "") {
|
|
3225
3221
|
r.update(() => {
|
|
3226
|
-
Ue(lt), t === "html" ? K().clear() : ze("",
|
|
3222
|
+
Ue(lt), t === "html" ? K().clear() : ze("", qo), ds();
|
|
3227
3223
|
}, { discrete: !0 }), Promise.resolve().then(() => {
|
|
3228
3224
|
o ? r.focus() : r.blur();
|
|
3229
3225
|
});
|
|
3230
3226
|
return;
|
|
3231
3227
|
}
|
|
3232
3228
|
r.update(() => {
|
|
3233
|
-
Ue(lt), t === "html" ?
|
|
3229
|
+
Ue(lt), t === "html" ? ps(r, e) : ze(e, qo), ds();
|
|
3234
3230
|
}), a.current && (a.current = !1, Promise.resolve().then(() => {
|
|
3235
|
-
requestAnimationFrame(() =>
|
|
3231
|
+
requestAnimationFrame(() => us(r));
|
|
3236
3232
|
})), o && Promise.resolve().then(() => {
|
|
3237
3233
|
r.focus();
|
|
3238
3234
|
});
|
|
@@ -3247,7 +3243,7 @@ function ms({ value: e, source: t = "markdown", emittedValuesRef: n }) {
|
|
|
3247
3243
|
}
|
|
3248
3244
|
//#endregion
|
|
3249
3245
|
//#region src/components/rich-text-area/plugins/blur-plugin.tsx
|
|
3250
|
-
function
|
|
3246
|
+
function gs({ onBlur: e }) {
|
|
3251
3247
|
let t = Q();
|
|
3252
3248
|
return R(() => {
|
|
3253
3249
|
if (!e) return;
|
|
@@ -3263,7 +3259,7 @@ function hs({ onBlur: e }) {
|
|
|
3263
3259
|
}
|
|
3264
3260
|
//#endregion
|
|
3265
3261
|
//#region src/components/rich-text-area/plugins/focus-plugin.tsx
|
|
3266
|
-
function
|
|
3262
|
+
function _s({ onFocusChange: e }) {
|
|
3267
3263
|
let t = Q();
|
|
3268
3264
|
return R(() => {
|
|
3269
3265
|
if (!e) return;
|
|
@@ -3282,66 +3278,66 @@ function gs({ onFocusChange: e }) {
|
|
|
3282
3278
|
}
|
|
3283
3279
|
//#endregion
|
|
3284
3280
|
//#region src/components/rich-text-area/plugins/image-drop-plugin.tsx
|
|
3285
|
-
var
|
|
3281
|
+
var vs = dt("INSERT_IMAGE_COMMAND"), ys = "helvetiq:insert-image", bs = class extends CustomEvent {
|
|
3286
3282
|
constructor(e) {
|
|
3287
|
-
super(
|
|
3283
|
+
super(ys, { detail: e });
|
|
3288
3284
|
}
|
|
3289
3285
|
};
|
|
3290
|
-
function
|
|
3286
|
+
function xs() {
|
|
3291
3287
|
let e = Q();
|
|
3292
|
-
return R(() => e.registerCommand(
|
|
3293
|
-
let e =
|
|
3288
|
+
return R(() => e.registerCommand(vs, (t) => (e.update(() => {
|
|
3289
|
+
let e = Io(t.src, t.altText);
|
|
3294
3290
|
Je([e]);
|
|
3295
3291
|
}), !0), tt), [e]), R(() => {
|
|
3296
3292
|
if (!e.getRootElement()) return;
|
|
3297
3293
|
function t(t) {
|
|
3298
3294
|
let n = t;
|
|
3299
|
-
e.dispatchCommand(
|
|
3295
|
+
e.dispatchCommand(vs, n.detail);
|
|
3300
3296
|
}
|
|
3301
|
-
return document.addEventListener(
|
|
3302
|
-
document.removeEventListener(
|
|
3297
|
+
return document.addEventListener(ys, t), () => {
|
|
3298
|
+
document.removeEventListener(ys, t);
|
|
3303
3299
|
};
|
|
3304
3300
|
}, [e]), null;
|
|
3305
3301
|
}
|
|
3306
3302
|
//#endregion
|
|
3307
3303
|
//#region src/components/rich-text-area/plugins/html-paste-plugin.tsx
|
|
3308
|
-
var
|
|
3304
|
+
var Ss = dt("PASTE_HTML_COMMAND"), Cs = dt("INSERT_HTML_COMMAND"), ws = "helvetiq:paste-html", Ts = "helvetiq:insert-html", Es = class extends CustomEvent {
|
|
3309
3305
|
constructor(e) {
|
|
3310
|
-
super(
|
|
3306
|
+
super(ws, { detail: e });
|
|
3311
3307
|
}
|
|
3312
|
-
},
|
|
3308
|
+
}, Ds = class extends CustomEvent {
|
|
3313
3309
|
constructor(e) {
|
|
3314
|
-
super(
|
|
3310
|
+
super(Ts, { detail: e });
|
|
3315
3311
|
}
|
|
3316
3312
|
};
|
|
3317
|
-
function
|
|
3313
|
+
function Os() {
|
|
3318
3314
|
let e = Q();
|
|
3319
|
-
return R(() => e.registerCommand(
|
|
3315
|
+
return R(() => e.registerCommand(Ss, (t) => (e.update(() => {
|
|
3320
3316
|
let n = K();
|
|
3321
3317
|
n.clear();
|
|
3322
3318
|
let r = new DOMParser().parseFromString(t.html, "text/html"), i = un(e, r);
|
|
3323
3319
|
n.append(...i);
|
|
3324
|
-
}), !0), tt), [e]), R(() => e.registerCommand(
|
|
3320
|
+
}), !0), tt), [e]), R(() => e.registerCommand(Cs, (t) => (e.update(() => {
|
|
3325
3321
|
let n = new DOMParser().parseFromString(t.html, "text/html"), r = un(e, n);
|
|
3326
3322
|
Je(r);
|
|
3327
3323
|
}), !0), tt), [e]), R(() => {
|
|
3328
3324
|
if (!e.getRootElement()) return;
|
|
3329
3325
|
function t(t) {
|
|
3330
3326
|
let n = t;
|
|
3331
|
-
e.dispatchCommand(
|
|
3327
|
+
e.dispatchCommand(Ss, n.detail);
|
|
3332
3328
|
}
|
|
3333
3329
|
function n(t) {
|
|
3334
3330
|
let n = t;
|
|
3335
|
-
e.dispatchCommand(
|
|
3331
|
+
e.dispatchCommand(Cs, n.detail);
|
|
3336
3332
|
}
|
|
3337
|
-
return document.addEventListener(
|
|
3338
|
-
document.removeEventListener(
|
|
3333
|
+
return document.addEventListener(ws, t), document.addEventListener(Ts, n), () => {
|
|
3334
|
+
document.removeEventListener(ws, t), document.removeEventListener(Ts, n);
|
|
3339
3335
|
};
|
|
3340
3336
|
}, [e]), null;
|
|
3341
3337
|
}
|
|
3342
3338
|
//#endregion
|
|
3343
3339
|
//#region src/components/rich-text-area/plugins/markdown-plain-paste-plugin.tsx
|
|
3344
|
-
function
|
|
3340
|
+
function ks() {
|
|
3345
3341
|
let e = Q();
|
|
3346
3342
|
return R(() => e.registerCommand(st, (t) => {
|
|
3347
3343
|
let { clipboardData: n } = t;
|
|
@@ -3363,10 +3359,10 @@ function Os() {
|
|
|
3363
3359
|
}
|
|
3364
3360
|
//#endregion
|
|
3365
3361
|
//#region src/components/rich-text-area/plugins/file-attachment-plugin.tsx
|
|
3366
|
-
var
|
|
3367
|
-
function
|
|
3362
|
+
var As = dt("ATTACH_FILE_COMMAND");
|
|
3363
|
+
function js({ acceptedFiles: e = [], isMultiple: t = !1, onFileAttach: n }) {
|
|
3368
3364
|
let r = Q(), i = V(null);
|
|
3369
|
-
R(() => r.registerCommand(
|
|
3365
|
+
R(() => r.registerCommand(As, () => (i.current?.click(), !0), tt), [r]);
|
|
3370
3366
|
function a(e) {
|
|
3371
3367
|
let r = Array.from(e.target.files ?? []);
|
|
3372
3368
|
if (t) n?.(r);
|
|
@@ -3388,18 +3384,18 @@ function As({ acceptedFiles: e = [], isMultiple: t = !1, onFileAttach: n }) {
|
|
|
3388
3384
|
}
|
|
3389
3385
|
//#endregion
|
|
3390
3386
|
//#region src/components/rich-text-area/styled.tsx
|
|
3391
|
-
var
|
|
3387
|
+
var Ms = F(({ className: e, children: t, ...n }, r) => /* @__PURE__ */ U("div", {
|
|
3392
3388
|
ref: r,
|
|
3393
3389
|
className: N("w-full resize-none border-none outline-none bg-transparent font-[inherit] text-[inherit] flex items-center [&_.editor-paragraph]:m-0 [&_.editor-paragraph]:min-h-[26px] [&_.editor-text-bold]:font-bold [&_.editor-text-italic]:italic [&_.editor-text-underline]:underline", e),
|
|
3394
3390
|
...n,
|
|
3395
3391
|
children: t
|
|
3396
3392
|
}));
|
|
3397
|
-
|
|
3393
|
+
Ms.displayName = "Wrapper";
|
|
3398
3394
|
//#endregion
|
|
3399
3395
|
//#region src/components/rich-text-area/rich-text-area.tsx
|
|
3400
|
-
var
|
|
3396
|
+
var Ns = {
|
|
3401
3397
|
namespace: "helvetiq",
|
|
3402
|
-
theme:
|
|
3398
|
+
theme: Po,
|
|
3403
3399
|
editable: !0,
|
|
3404
3400
|
nodes: [
|
|
3405
3401
|
ke,
|
|
@@ -3408,25 +3404,25 @@ var Ms = {
|
|
|
3408
3404
|
Le,
|
|
3409
3405
|
Se,
|
|
3410
3406
|
we,
|
|
3411
|
-
|
|
3412
|
-
|
|
3407
|
+
Fo,
|
|
3408
|
+
ns,
|
|
3413
3409
|
sn,
|
|
3414
3410
|
on,
|
|
3415
3411
|
cn
|
|
3416
3412
|
],
|
|
3417
3413
|
html: {
|
|
3418
|
-
import:
|
|
3419
|
-
export:
|
|
3414
|
+
import: $o,
|
|
3415
|
+
export: ts
|
|
3420
3416
|
},
|
|
3421
3417
|
onError: (e) => {
|
|
3422
3418
|
console.error("Lexical error:", e);
|
|
3423
3419
|
}
|
|
3424
3420
|
};
|
|
3425
|
-
function
|
|
3421
|
+
function Ps({ children: e, name: t, value: n, source: r = "markdown", className: i, containerClassName: a, placeholderClassName: o, placeholder: s = "", isDisabled: c = !1, onChange: l, onBlur: u, onKeyDown: d, onFocusChange: f, forwardedRef: p, ...m }) {
|
|
3426
3422
|
let h = V([]);
|
|
3427
3423
|
return /* @__PURE__ */ U(Ae, {
|
|
3428
|
-
initialConfig:
|
|
3429
|
-
children: /* @__PURE__ */ W(
|
|
3424
|
+
initialConfig: Ns,
|
|
3425
|
+
children: /* @__PURE__ */ W(Ms, {
|
|
3430
3426
|
"data-slot": "rich-text-area",
|
|
3431
3427
|
"data-testid": "rich-text-area",
|
|
3432
3428
|
"aria-disabled": c,
|
|
@@ -3457,36 +3453,36 @@ function Ns({ children: e, name: t, value: n, source: r = "markdown", className:
|
|
|
3457
3453
|
}),
|
|
3458
3454
|
ErrorBoundary: Me
|
|
3459
3455
|
}),
|
|
3460
|
-
/* @__PURE__ */ U(
|
|
3461
|
-
/* @__PURE__ */ U(
|
|
3456
|
+
/* @__PURE__ */ U(cs, { isDisabled: c }),
|
|
3457
|
+
/* @__PURE__ */ U(hs, {
|
|
3462
3458
|
value: n,
|
|
3463
3459
|
source: r,
|
|
3464
3460
|
emittedValuesRef: h
|
|
3465
3461
|
}),
|
|
3466
|
-
/* @__PURE__ */ U(
|
|
3462
|
+
/* @__PURE__ */ U(os, {
|
|
3467
3463
|
onChange: l,
|
|
3468
3464
|
source: r,
|
|
3469
3465
|
emittedValuesRef: h
|
|
3470
3466
|
}),
|
|
3471
|
-
/* @__PURE__ */ U(
|
|
3467
|
+
/* @__PURE__ */ U(gs, { onBlur: u }),
|
|
3472
3468
|
/* @__PURE__ */ U(Ne, {}),
|
|
3473
|
-
/* @__PURE__ */ U(
|
|
3474
|
-
/* @__PURE__ */ U(
|
|
3469
|
+
/* @__PURE__ */ U(ls, { controlledRef: p ?? null }),
|
|
3470
|
+
/* @__PURE__ */ U(_s, { onFocusChange: f }),
|
|
3475
3471
|
/* @__PURE__ */ U(an, {}),
|
|
3476
|
-
r === "markdown" && /* @__PURE__ */ U(
|
|
3472
|
+
r === "markdown" && /* @__PURE__ */ U(ks, {}),
|
|
3477
3473
|
e
|
|
3478
3474
|
]
|
|
3479
3475
|
})
|
|
3480
3476
|
});
|
|
3481
3477
|
}
|
|
3482
|
-
var
|
|
3478
|
+
var Fs = F((e, t) => /* @__PURE__ */ U(Ps, {
|
|
3483
3479
|
...e,
|
|
3484
3480
|
forwardedRef: t
|
|
3485
3481
|
}));
|
|
3486
|
-
|
|
3482
|
+
Fs.displayName = "RichTextArea";
|
|
3487
3483
|
//#endregion
|
|
3488
3484
|
//#region src/components/rich-text-field/constants.ts
|
|
3489
|
-
var
|
|
3485
|
+
var Is = "Arial, sans-serif", Ls = [
|
|
3490
3486
|
{
|
|
3491
3487
|
value: "Arial, sans-serif",
|
|
3492
3488
|
label: "Arial"
|
|
@@ -3523,7 +3519,7 @@ var Fs = "Arial, sans-serif", Is = [
|
|
|
3523
3519
|
value: "\"Brush Script MT\", cursive",
|
|
3524
3520
|
label: "Brush Script MT"
|
|
3525
3521
|
}
|
|
3526
|
-
],
|
|
3522
|
+
], Rs = Is, zs = [
|
|
3527
3523
|
{
|
|
3528
3524
|
label: "10",
|
|
3529
3525
|
value: "10"
|
|
@@ -3552,10 +3548,10 @@ var Fs = "Arial, sans-serif", Is = [
|
|
|
3552
3548
|
label: "48",
|
|
3553
3549
|
value: "48"
|
|
3554
3550
|
}
|
|
3555
|
-
],
|
|
3551
|
+
], Bs = "left", Vs = "#000000";
|
|
3556
3552
|
//#endregion
|
|
3557
3553
|
//#region src/components/rich-text-field/components/toolbar-select.tsx
|
|
3558
|
-
function
|
|
3554
|
+
function Hs({ className: e, selectItemClassName: t, ...n }) {
|
|
3559
3555
|
return /* @__PURE__ */ U(A, {
|
|
3560
3556
|
fullWidth: !1,
|
|
3561
3557
|
size: "small",
|
|
@@ -3566,10 +3562,10 @@ function Vs({ className: e, selectItemClassName: t, ...n }) {
|
|
|
3566
3562
|
}
|
|
3567
3563
|
//#endregion
|
|
3568
3564
|
//#region src/components/rich-text-field/components/alignment-select.tsx
|
|
3569
|
-
function
|
|
3565
|
+
function Us(e) {
|
|
3570
3566
|
return e === "center" || e === "right" ? e : e === "end" ? "right" : "left";
|
|
3571
3567
|
}
|
|
3572
|
-
var
|
|
3568
|
+
var Ws = {
|
|
3573
3569
|
left: {
|
|
3574
3570
|
label: "Left",
|
|
3575
3571
|
icon: /* @__PURE__ */ U(kt, { fontSize: "inherit" })
|
|
@@ -3583,8 +3579,8 @@ var Us = {
|
|
|
3583
3579
|
icon: /* @__PURE__ */ U(At, { fontSize: "inherit" })
|
|
3584
3580
|
}
|
|
3585
3581
|
};
|
|
3586
|
-
function
|
|
3587
|
-
let t = Q(), [n, r] = H(
|
|
3582
|
+
function Gs({ className: e }) {
|
|
3583
|
+
let t = Q(), [n, r] = H(Bs), i = B(() => Object.entries(Ws).map(([e, { label: t, icon: n }]) => ({
|
|
3588
3584
|
value: e,
|
|
3589
3585
|
label: t,
|
|
3590
3586
|
icon: n
|
|
@@ -3592,7 +3588,7 @@ function Ws({ className: e }) {
|
|
|
3592
3588
|
let e = q();
|
|
3593
3589
|
if (J(e)) {
|
|
3594
3590
|
let t = e.anchor.getNode(), n = t.getParent(), i = Ye(t) ? t : n;
|
|
3595
|
-
Ye(i) && r(
|
|
3591
|
+
Ye(i) && r(Us(i.getFormatType() || "left"));
|
|
3596
3592
|
}
|
|
3597
3593
|
}, []);
|
|
3598
3594
|
R(() => pn(t.registerUpdateListener(({ editorState: e }) => {
|
|
@@ -3603,7 +3599,7 @@ function Ws({ className: e }) {
|
|
|
3603
3599
|
function o(e) {
|
|
3604
3600
|
t.dispatchCommand(at, e);
|
|
3605
3601
|
}
|
|
3606
|
-
return /* @__PURE__ */ U(
|
|
3602
|
+
return /* @__PURE__ */ U(Hs, {
|
|
3607
3603
|
shouldShowOnlyIcon: !0,
|
|
3608
3604
|
options: i,
|
|
3609
3605
|
value: n,
|
|
@@ -3626,10 +3622,10 @@ function $({ className: e, children: t, isActive: n, isDisabled: r = !1, ...i })
|
|
|
3626
3622
|
}
|
|
3627
3623
|
//#endregion
|
|
3628
3624
|
//#region src/components/rich-text-field/components/attachment-button.tsx
|
|
3629
|
-
function
|
|
3625
|
+
function Ks(e) {
|
|
3630
3626
|
let t = Q();
|
|
3631
3627
|
function n() {
|
|
3632
|
-
t.dispatchCommand(
|
|
3628
|
+
t.dispatchCommand(As, void 0);
|
|
3633
3629
|
}
|
|
3634
3630
|
return /* @__PURE__ */ U($, {
|
|
3635
3631
|
"data-testid": "attachment-button",
|
|
@@ -3641,76 +3637,76 @@ function Gs(e) {
|
|
|
3641
3637
|
}
|
|
3642
3638
|
//#endregion
|
|
3643
3639
|
//#region src/components/rich-text-field/utils.ts
|
|
3644
|
-
function
|
|
3640
|
+
function qs(e) {
|
|
3645
3641
|
let t;
|
|
3646
3642
|
for (let n of vn(e, { silent: !0 })) n.type === "declaration" && n.value && (t ||= {}, t[n.property] = n.value);
|
|
3647
|
-
return t ||
|
|
3648
|
-
}
|
|
3649
|
-
var qs = Object.freeze({});
|
|
3650
|
-
function Js(e) {
|
|
3651
|
-
return typeof e == "string" ? Ks(e) : qs;
|
|
3643
|
+
return t || Js;
|
|
3652
3644
|
}
|
|
3645
|
+
var Js = Object.freeze({});
|
|
3653
3646
|
function Ys(e) {
|
|
3647
|
+
return typeof e == "string" ? qs(e) : Js;
|
|
3648
|
+
}
|
|
3649
|
+
function Xs(e) {
|
|
3654
3650
|
let t = [];
|
|
3655
3651
|
for (let [n, r] of Object.entries(e)) n && r && t.push(`${n}: ${r};`);
|
|
3656
3652
|
return t.sort().join(" ");
|
|
3657
3653
|
}
|
|
3658
|
-
function
|
|
3654
|
+
function Zs(e, t) {
|
|
3659
3655
|
return e === t || !e && !t;
|
|
3660
3656
|
}
|
|
3661
|
-
function
|
|
3657
|
+
function Qs(e, t) {
|
|
3662
3658
|
if (e === t) return !0;
|
|
3663
|
-
for (let n in e) if (!(n in t &&
|
|
3659
|
+
for (let n in e) if (!(n in t && Zs(e[n], t[n]))) return !1;
|
|
3664
3660
|
for (let n in t) if (!(n in e)) return !1;
|
|
3665
3661
|
return !0;
|
|
3666
3662
|
}
|
|
3667
|
-
var
|
|
3668
|
-
isEqual:
|
|
3669
|
-
parse:
|
|
3670
|
-
unparse:
|
|
3663
|
+
var $s = ft("style", {
|
|
3664
|
+
isEqual: Qs,
|
|
3665
|
+
parse: Ys,
|
|
3666
|
+
unparse: Xs
|
|
3671
3667
|
});
|
|
3672
|
-
function $s(e, t) {
|
|
3673
|
-
return $e(e, Qs, t);
|
|
3674
|
-
}
|
|
3675
3668
|
function ec(e, t) {
|
|
3676
|
-
return e
|
|
3669
|
+
return $e(e, $s, t);
|
|
3670
|
+
}
|
|
3671
|
+
function tc(e, t) {
|
|
3672
|
+
return e === Js || e === t ? t : {
|
|
3677
3673
|
...e,
|
|
3678
3674
|
...t
|
|
3679
3675
|
};
|
|
3680
3676
|
}
|
|
3681
3677
|
dt("PATCH_TEXT_STYLE_COMMAND");
|
|
3682
|
-
function
|
|
3678
|
+
function nc(e) {
|
|
3683
3679
|
let t = q();
|
|
3684
3680
|
if (!t) {
|
|
3685
3681
|
let e = qe();
|
|
3686
3682
|
if (!e) return !1;
|
|
3687
3683
|
t = e.clone(), Qe(t);
|
|
3688
3684
|
}
|
|
3689
|
-
let n = typeof e == "function" ? e : (t) =>
|
|
3685
|
+
let n = typeof e == "function" ? e : (t) => tc(t, e);
|
|
3690
3686
|
if (J(t) && t.isCollapsed()) {
|
|
3691
3687
|
let e = t.focus.getNode();
|
|
3692
|
-
Y(e) &&
|
|
3693
|
-
} else mn((e) =>
|
|
3688
|
+
Y(e) && ec(e, n);
|
|
3689
|
+
} else mn((e) => ec(e, n));
|
|
3694
3690
|
return !0;
|
|
3695
3691
|
}
|
|
3696
|
-
function
|
|
3692
|
+
function rc(e) {
|
|
3697
3693
|
let t = e.anchor, n = e.focus, r = e.anchor.getNode(), i = e.focus.getNode();
|
|
3698
3694
|
return r === i ? r : e.isBackward() ? gn(n) ? r : i : gn(t) ? r : i;
|
|
3699
3695
|
}
|
|
3700
|
-
var
|
|
3696
|
+
var ic = (e, t, n, r) => {
|
|
3701
3697
|
e.update(() => {
|
|
3702
3698
|
if (r && Ue(lt), e.isEditable()) {
|
|
3703
3699
|
let e = q();
|
|
3704
3700
|
e !== null && _n(e, { "font-size": t + "px" });
|
|
3705
3701
|
}
|
|
3706
3702
|
});
|
|
3707
|
-
},
|
|
3708
|
-
function
|
|
3709
|
-
let e = L(
|
|
3703
|
+
}, ac = (e) => e.startsWith("http") ? e : `https://${e}`, oc = P(null);
|
|
3704
|
+
function sc() {
|
|
3705
|
+
let e = L(oc);
|
|
3710
3706
|
if (!e) throw Error("\"useRichTextFieldContext\" must be used within a RichTextFieldContextProvider");
|
|
3711
3707
|
return e;
|
|
3712
3708
|
}
|
|
3713
|
-
function
|
|
3709
|
+
function cc(e) {
|
|
3714
3710
|
let t = e.trim(), n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t);
|
|
3715
3711
|
if (n) {
|
|
3716
3712
|
let e = n[1];
|
|
@@ -3725,18 +3721,18 @@ function sc(e) {
|
|
|
3725
3721
|
let e = (e) => Math.max(0, Math.min(255, e)), [t, n, i] = r.slice(1, 4).map((t) => e(Number.parseInt(t, 10))), a = (e) => e.toString(16).padStart(2, "0");
|
|
3726
3722
|
return `#${a(t)}${a(n)}${a(i)}`;
|
|
3727
3723
|
}
|
|
3728
|
-
return
|
|
3724
|
+
return Vs;
|
|
3729
3725
|
}
|
|
3730
|
-
function
|
|
3731
|
-
let t = Q(), [n, r] = H(
|
|
3726
|
+
function lc({ children: e }) {
|
|
3727
|
+
let t = Q(), [n, r] = H(Rs), [i, a] = H("16"), [o, s] = H(!1), [c, l] = H(!1), [u, d] = H(!1), [f, p] = H(Vs), [m, h] = H(!1), g = I(() => {
|
|
3732
3728
|
let e = q();
|
|
3733
3729
|
if (J(e)) {
|
|
3734
|
-
r(hn(e, "font-family",
|
|
3730
|
+
r(hn(e, "font-family", Rs));
|
|
3735
3731
|
let t = hn(e, "font-size", "16px");
|
|
3736
3732
|
a(t ? t.replace("px", "") : "16"), s(e.hasFormat("bold")), l(e.hasFormat("italic")), d(e.hasFormat("underline"));
|
|
3737
3733
|
let n = hn(e, "color", "#000000") || "#000000";
|
|
3738
|
-
p(
|
|
3739
|
-
let i =
|
|
3734
|
+
p(cc(n));
|
|
3735
|
+
let i = rc(e), o = i.getParent(), c = Ce(o) || Ce(i);
|
|
3740
3736
|
h(c);
|
|
3741
3737
|
}
|
|
3742
3738
|
}, []);
|
|
@@ -3752,7 +3748,7 @@ function cc({ children: e }) {
|
|
|
3752
3748
|
t !== null && _n(t, { "font-family": e });
|
|
3753
3749
|
});
|
|
3754
3750
|
}, [t]), v = I((e) => {
|
|
3755
|
-
|
|
3751
|
+
ic(t, e, null, !1);
|
|
3756
3752
|
}, [t]), y = I(() => {
|
|
3757
3753
|
t.dispatchCommand(ot, "bold");
|
|
3758
3754
|
}, [t]), b = I(() => {
|
|
@@ -3766,7 +3762,7 @@ function cc({ children: e }) {
|
|
|
3766
3762
|
t !== null && _n(t, { color: e });
|
|
3767
3763
|
});
|
|
3768
3764
|
}, [t]), C = I(() => {
|
|
3769
|
-
m ? (h(!1), t.dispatchCommand(Te, null)) : (h(!0), t.dispatchCommand(Te,
|
|
3765
|
+
m ? (h(!1), t.dispatchCommand(Te, null)) : (h(!0), t.dispatchCommand(Te, ac("https://")));
|
|
3770
3766
|
}, [m, h]), ee = B(() => ({
|
|
3771
3767
|
fontFamily: n,
|
|
3772
3768
|
fontSize: i,
|
|
@@ -3798,15 +3794,15 @@ function cc({ children: e }) {
|
|
|
3798
3794
|
x,
|
|
3799
3795
|
C
|
|
3800
3796
|
]);
|
|
3801
|
-
return /* @__PURE__ */ U(
|
|
3797
|
+
return /* @__PURE__ */ U(oc.Provider, {
|
|
3802
3798
|
value: ee,
|
|
3803
3799
|
children: e
|
|
3804
3800
|
});
|
|
3805
3801
|
}
|
|
3806
3802
|
//#endregion
|
|
3807
3803
|
//#region src/components/rich-text-field/components/bold-button.tsx
|
|
3808
|
-
function
|
|
3809
|
-
let { isBold: t, onBold: n } =
|
|
3804
|
+
function uc({ ...e }) {
|
|
3805
|
+
let { isBold: t, onBold: n } = sc();
|
|
3810
3806
|
return /* @__PURE__ */ U($, {
|
|
3811
3807
|
"data-testid": "bold-button",
|
|
3812
3808
|
"aria-label": "Format Bold",
|
|
@@ -3818,12 +3814,12 @@ function lc({ ...e }) {
|
|
|
3818
3814
|
}
|
|
3819
3815
|
//#endregion
|
|
3820
3816
|
//#region src/components/rich-text-field/components/clean-format-button.tsx
|
|
3821
|
-
function
|
|
3817
|
+
function dc({ ...e }) {
|
|
3822
3818
|
let t = Q(), n = I(() => {
|
|
3823
3819
|
t.update(() => {
|
|
3824
3820
|
let e = q();
|
|
3825
3821
|
if (J(e)) {
|
|
3826
|
-
|
|
3822
|
+
nc(() => Js);
|
|
3827
3823
|
for (let t of e.extract()) Y(t) && (t.setFormat(0), t.setStyle(""), fn(t).setFormat(""));
|
|
3828
3824
|
}
|
|
3829
3825
|
});
|
|
@@ -3838,7 +3834,7 @@ function uc({ ...e }) {
|
|
|
3838
3834
|
}
|
|
3839
3835
|
//#endregion
|
|
3840
3836
|
//#region src/components/rich-text-field/components/image-button.tsx
|
|
3841
|
-
function
|
|
3837
|
+
function fc({ ...e }) {
|
|
3842
3838
|
return /* @__PURE__ */ U($, {
|
|
3843
3839
|
"data-testid": "image-button",
|
|
3844
3840
|
"aria-label": "Add Image",
|
|
@@ -3848,8 +3844,8 @@ function dc({ ...e }) {
|
|
|
3848
3844
|
}
|
|
3849
3845
|
//#endregion
|
|
3850
3846
|
//#region src/components/rich-text-field/components/italic-button.tsx
|
|
3851
|
-
function
|
|
3852
|
-
let { isItalic: t, onItalic: n } =
|
|
3847
|
+
function pc({ ...e }) {
|
|
3848
|
+
let { isItalic: t, onItalic: n } = sc();
|
|
3853
3849
|
return /* @__PURE__ */ U($, {
|
|
3854
3850
|
"data-testid": "italic-button",
|
|
3855
3851
|
"aria-label": "Format Italics",
|
|
@@ -3861,7 +3857,7 @@ function fc({ ...e }) {
|
|
|
3861
3857
|
}
|
|
3862
3858
|
//#endregion
|
|
3863
3859
|
//#region src/components/rich-text-field/components/link-button.tsx
|
|
3864
|
-
function
|
|
3860
|
+
function mc({ isActive: e, ...t }) {
|
|
3865
3861
|
return /* @__PURE__ */ U($, {
|
|
3866
3862
|
"data-testid": "link-button",
|
|
3867
3863
|
"aria-label": "Add Link",
|
|
@@ -3871,9 +3867,9 @@ function pc({ isActive: e, ...t }) {
|
|
|
3871
3867
|
}
|
|
3872
3868
|
//#endregion
|
|
3873
3869
|
//#region src/components/rich-text-field/components/size-select.tsx
|
|
3874
|
-
function
|
|
3875
|
-
let { fontSize: t, onFontSize: n } =
|
|
3876
|
-
return /* @__PURE__ */ U(
|
|
3870
|
+
function hc({ className: e }) {
|
|
3871
|
+
let { fontSize: t, onFontSize: n } = sc(), r = B(() => [...zs], []);
|
|
3872
|
+
return /* @__PURE__ */ U(Hs, {
|
|
3877
3873
|
"data-testid": "size-select",
|
|
3878
3874
|
options: r,
|
|
3879
3875
|
value: t,
|
|
@@ -3883,8 +3879,8 @@ function mc({ className: e }) {
|
|
|
3883
3879
|
}
|
|
3884
3880
|
//#endregion
|
|
3885
3881
|
//#region src/components/rich-text-field/components/text-color-button.tsx
|
|
3886
|
-
function
|
|
3887
|
-
let { textColor: n, onTextColor: r } =
|
|
3882
|
+
function gc({ wrapperClassName: e, ...t }) {
|
|
3883
|
+
let { textColor: n, onTextColor: r } = sc(), i = n === Vs;
|
|
3888
3884
|
function a(e) {
|
|
3889
3885
|
r(e.target.value);
|
|
3890
3886
|
}
|
|
@@ -3918,9 +3914,9 @@ function hc({ wrapperClassName: e, ...t }) {
|
|
|
3918
3914
|
}
|
|
3919
3915
|
//#endregion
|
|
3920
3916
|
//#region src/components/rich-text-field/components/typography-select.tsx
|
|
3921
|
-
function
|
|
3922
|
-
let { fontFamily: t, onFontFamily: n } =
|
|
3923
|
-
return /* @__PURE__ */ U(
|
|
3917
|
+
function _c({ className: e }) {
|
|
3918
|
+
let { fontFamily: t, onFontFamily: n } = sc(), r = B(() => [...Ls], []);
|
|
3919
|
+
return /* @__PURE__ */ U(Hs, {
|
|
3924
3920
|
"data-testid": "typography-select",
|
|
3925
3921
|
options: r,
|
|
3926
3922
|
value: t,
|
|
@@ -3930,8 +3926,8 @@ function gc({ className: e }) {
|
|
|
3930
3926
|
}
|
|
3931
3927
|
//#endregion
|
|
3932
3928
|
//#region src/components/rich-text-field/components/underline-button.tsx
|
|
3933
|
-
function
|
|
3934
|
-
let { isUnderline: t, onUnderline: n } =
|
|
3929
|
+
function vc({ ...e }) {
|
|
3930
|
+
let { isUnderline: t, onUnderline: n } = sc();
|
|
3935
3931
|
return /* @__PURE__ */ U($, {
|
|
3936
3932
|
"data-testid": "underline-button",
|
|
3937
3933
|
"aria-label": "Format Underline",
|
|
@@ -3943,24 +3939,24 @@ function _c({ ...e }) {
|
|
|
3943
3939
|
}
|
|
3944
3940
|
//#endregion
|
|
3945
3941
|
//#region src/components/rich-text-field/components/formatting-toolbar-plugin.tsx
|
|
3946
|
-
var
|
|
3947
|
-
/* @__PURE__ */ U(gc, {}),
|
|
3948
|
-
/* @__PURE__ */ U(mc, {}),
|
|
3949
|
-
/* @__PURE__ */ U(d, { orientation: "vertical" }),
|
|
3950
|
-
/* @__PURE__ */ U(lc, {}),
|
|
3951
|
-
/* @__PURE__ */ U(fc, {}),
|
|
3942
|
+
var yc = ({ hasAttachments: e }) => /* @__PURE__ */ W(xe, { children: [
|
|
3952
3943
|
/* @__PURE__ */ U(_c, {}),
|
|
3953
3944
|
/* @__PURE__ */ U(hc, {}),
|
|
3954
3945
|
/* @__PURE__ */ U(d, { orientation: "vertical" }),
|
|
3955
|
-
/* @__PURE__ */ U(
|
|
3956
|
-
/* @__PURE__ */ U(
|
|
3957
|
-
/* @__PURE__ */ U(
|
|
3946
|
+
/* @__PURE__ */ U(uc, {}),
|
|
3947
|
+
/* @__PURE__ */ U(pc, {}),
|
|
3948
|
+
/* @__PURE__ */ U(vc, {}),
|
|
3949
|
+
/* @__PURE__ */ U(gc, {}),
|
|
3950
|
+
/* @__PURE__ */ U(d, { orientation: "vertical" }),
|
|
3951
|
+
/* @__PURE__ */ U(mc, { isDisabled: !0 }),
|
|
3952
|
+
/* @__PURE__ */ U(Ks, { isDisabled: !e }),
|
|
3953
|
+
/* @__PURE__ */ U(fc, { isDisabled: !0 }),
|
|
3958
3954
|
/* @__PURE__ */ U(d, { orientation: "vertical" }),
|
|
3959
|
-
/* @__PURE__ */ U(
|
|
3955
|
+
/* @__PURE__ */ U(Gs, {}),
|
|
3960
3956
|
/* @__PURE__ */ U(d, { orientation: "vertical" }),
|
|
3961
|
-
/* @__PURE__ */ U(
|
|
3957
|
+
/* @__PURE__ */ U(dc, {})
|
|
3962
3958
|
] });
|
|
3963
|
-
function
|
|
3959
|
+
function bc({ className: e, children: t = yc, hasAttachments: n = !1 }) {
|
|
3964
3960
|
return /* @__PURE__ */ U("div", {
|
|
3965
3961
|
"data-testid": "formatting-toolbar",
|
|
3966
3962
|
"data-slot": "rich-text-field-toolbar",
|
|
@@ -3970,9 +3966,9 @@ function yc({ className: e, children: t = vc, hasAttachments: n = !1 }) {
|
|
|
3970
3966
|
}
|
|
3971
3967
|
//#endregion
|
|
3972
3968
|
//#region src/components/rich-text-field/rich-text-field.tsx
|
|
3973
|
-
var
|
|
3969
|
+
var xc = F(({ children: e, className: t, placeholderClassName: n, containerClassName: r, toolbarPlacement: i = "top", toolbarChildren: a, toolbarClassName: o, isMultipleAttachments: s, enableAttachments: c, acceptedFiles: l, onFileAttach: u, ...d }, f) => {
|
|
3974
3970
|
let p = i === "top";
|
|
3975
|
-
return /* @__PURE__ */ W(
|
|
3971
|
+
return /* @__PURE__ */ W(Fs, {
|
|
3976
3972
|
ref: f,
|
|
3977
3973
|
"data-testid": "rich-text-field",
|
|
3978
3974
|
"data-slot": "rich-text-field",
|
|
@@ -3981,21 +3977,21 @@ var bc = F(({ children: e, className: t, placeholderClassName: n, containerClass
|
|
|
3981
3977
|
containerClassName: N("h-rich-text-field-height", "rounded-rich-text-field-toolbar", p ? "pt-rich-text-field-toolbar-height" : "pb-rich-text-field-toolbar-height", r),
|
|
3982
3978
|
className: N("p-rich-text-field-editor-padding", "bg-rich-text-field-background", "size-full", t),
|
|
3983
3979
|
...d,
|
|
3984
|
-
children: [/* @__PURE__ */ U(
|
|
3980
|
+
children: [/* @__PURE__ */ U(lc, { children: /* @__PURE__ */ U(bc, {
|
|
3985
3981
|
hasAttachments: c,
|
|
3986
3982
|
className: N("absolute right-0 w-full", p ? "top-0" : "bottom-0", o),
|
|
3987
3983
|
children: a
|
|
3988
|
-
}) }), /* @__PURE__ */ U(
|
|
3984
|
+
}) }), /* @__PURE__ */ U(js, {
|
|
3989
3985
|
acceptedFiles: l,
|
|
3990
3986
|
onFileAttach: u,
|
|
3991
3987
|
isMultiple: s
|
|
3992
3988
|
})]
|
|
3993
3989
|
});
|
|
3994
3990
|
});
|
|
3995
|
-
|
|
3991
|
+
xc.displayName = "RichTextField";
|
|
3996
3992
|
//#endregion
|
|
3997
3993
|
//#region src/components/topmenu/topmenu.tsx
|
|
3998
|
-
var
|
|
3994
|
+
var Sc = yn("flex shrink-0 items-center justify-end", {
|
|
3999
3995
|
variants: {
|
|
4000
3996
|
size: {
|
|
4001
3997
|
md: ["px-[4px]", "rounded-overlay-tools-wrapper bg-overlay-tools-background-base"],
|
|
@@ -4020,7 +4016,7 @@ var xc = yn("flex shrink-0 items-center justify-end", {
|
|
|
4020
4016
|
hasBorder: !0
|
|
4021
4017
|
}
|
|
4022
4018
|
});
|
|
4023
|
-
function
|
|
4019
|
+
function Cc({ className: e, children: t, ...n }) {
|
|
4024
4020
|
return /* @__PURE__ */ U("div", {
|
|
4025
4021
|
"data-slot": "topmenu",
|
|
4026
4022
|
role: "group",
|
|
@@ -4029,11 +4025,11 @@ function Sc({ className: e, children: t, ...n }) {
|
|
|
4029
4025
|
children: t
|
|
4030
4026
|
});
|
|
4031
4027
|
}
|
|
4032
|
-
function
|
|
4028
|
+
function wc({ className: e, size: t, hasBorder: n, children: r, ...i }) {
|
|
4033
4029
|
return /* @__PURE__ */ U("div", {
|
|
4034
4030
|
"data-slot": "topmenu-actions",
|
|
4035
4031
|
"data-size": t ?? "lg",
|
|
4036
|
-
className: N(
|
|
4032
|
+
className: N(Sc({
|
|
4037
4033
|
size: t,
|
|
4038
4034
|
hasBorder: n
|
|
4039
4035
|
}), e),
|
|
@@ -4043,42 +4039,42 @@ function Cc({ className: e, size: t, hasBorder: n, children: r, ...i }) {
|
|
|
4043
4039
|
}
|
|
4044
4040
|
//#endregion
|
|
4045
4041
|
//#region src/domain/actions/constants.ts
|
|
4046
|
-
var
|
|
4042
|
+
var Tc = "swisper";
|
|
4047
4043
|
//#endregion
|
|
4048
4044
|
//#region src/domain/actions/utils/index.ts
|
|
4049
|
-
function
|
|
4050
|
-
let n = `${
|
|
4045
|
+
function Ec(e, t) {
|
|
4046
|
+
let n = `${Tc}://action/${e}`;
|
|
4051
4047
|
return t ? `${n}?${new URLSearchParams(t).toString()}` : n;
|
|
4052
4048
|
}
|
|
4053
|
-
function
|
|
4054
|
-
return `[${t}](${
|
|
4049
|
+
function Dc({ action: e, label: t, params: n }) {
|
|
4050
|
+
return `[${t}](${Ec(e, n)})`;
|
|
4055
4051
|
}
|
|
4056
|
-
function
|
|
4052
|
+
function Oc(e) {
|
|
4057
4053
|
if (!e?.startsWith("swisper://")) return !1;
|
|
4058
4054
|
let t = new URL(e);
|
|
4059
4055
|
return t.protocol === "swisper:" && t.hostname === "action" && t.pathname.startsWith("/") && t.pathname.split("/").length === 2;
|
|
4060
4056
|
}
|
|
4061
|
-
function
|
|
4057
|
+
function kc(e) {
|
|
4062
4058
|
let t;
|
|
4063
4059
|
try {
|
|
4064
4060
|
t = new URL(e);
|
|
4065
4061
|
} catch {
|
|
4066
4062
|
return null;
|
|
4067
4063
|
}
|
|
4068
|
-
return
|
|
4064
|
+
return Oc(e) ? {
|
|
4069
4065
|
option: t.pathname.replace("/", ""),
|
|
4070
4066
|
payload: Object.fromEntries(t.searchParams.entries())
|
|
4071
4067
|
} : null;
|
|
4072
4068
|
}
|
|
4073
|
-
function
|
|
4069
|
+
function Ac(e) {
|
|
4074
4070
|
for (let t of e) if (t.type === "text" && typeof t.value == "string") return t.value;
|
|
4075
4071
|
return null;
|
|
4076
4072
|
}
|
|
4077
|
-
function
|
|
4073
|
+
function jc(e) {
|
|
4078
4074
|
let t = Sn().use(xn).use(bn).parse(e), n = null;
|
|
4079
4075
|
return Cn(t, (e) => {
|
|
4080
4076
|
if (e.type !== "link") return;
|
|
4081
|
-
let t =
|
|
4077
|
+
let t = kc(e.url), r = Ac(e.children);
|
|
4082
4078
|
if (t && r) {
|
|
4083
4079
|
n = {
|
|
4084
4080
|
label: r,
|
|
@@ -4092,23 +4088,23 @@ function Ac(e) {
|
|
|
4092
4088
|
}
|
|
4093
4089
|
//#endregion
|
|
4094
4090
|
//#region src/domain/actions/hooks/index.ts
|
|
4095
|
-
function
|
|
4096
|
-
return B(() => e.map((e) =>
|
|
4091
|
+
function Mc(e) {
|
|
4092
|
+
return B(() => e.map((e) => jc(e) || { label: e }).filter((e) => e !== null), [e]);
|
|
4097
4093
|
}
|
|
4098
4094
|
//#endregion
|
|
4099
4095
|
//#region src/hooks/use-chat-stream-message.ts
|
|
4100
|
-
function
|
|
4096
|
+
function Nc(e) {
|
|
4101
4097
|
return JSON.parse(e);
|
|
4102
4098
|
}
|
|
4103
|
-
function
|
|
4099
|
+
function Pc(e) {
|
|
4104
4100
|
return e instanceof Error ? e.name === "AbortError" || e.name === "TimeoutError" : !1;
|
|
4105
4101
|
}
|
|
4106
|
-
function
|
|
4102
|
+
function Fc(e, t) {
|
|
4107
4103
|
return e instanceof Error ? e : Error(t);
|
|
4108
4104
|
}
|
|
4109
|
-
function
|
|
4105
|
+
function Ic() {
|
|
4110
4106
|
return { streamMessage: I(async ({ stream: e, abortController: t, timeout: n = 2e4, tokenParser: r, onChunkReceived: i, onAbort: a, onFinish: o, onError: s }) => {
|
|
4111
|
-
let c = r ??
|
|
4107
|
+
let c = r ?? Nc, l, u = !1, d = () => {
|
|
4112
4108
|
l !== void 0 && (clearTimeout(l), l = void 0);
|
|
4113
4109
|
}, f = (e) => {
|
|
4114
4110
|
u || (u = !0, d(), a?.(e));
|
|
@@ -4135,7 +4131,7 @@ function Fc() {
|
|
|
4135
4131
|
}
|
|
4136
4132
|
});
|
|
4137
4133
|
for (t?.signal.addEventListener("abort", () => {
|
|
4138
|
-
let e =
|
|
4134
|
+
let e = Fc(t.signal.reason, "Stream aborted");
|
|
4139
4135
|
f(e);
|
|
4140
4136
|
}, { once: !0 }), p(); !u;) {
|
|
4141
4137
|
let { value: t, done: n } = await e.read(), i = r.decode(t, { stream: !0 });
|
|
@@ -4144,8 +4140,8 @@ function Fc() {
|
|
|
4144
4140
|
d(), !u && !t?.signal.aborted && o?.(n);
|
|
4145
4141
|
} catch (e) {
|
|
4146
4142
|
let n = e;
|
|
4147
|
-
if (u || t?.signal.aborted ||
|
|
4148
|
-
u || f(
|
|
4143
|
+
if (u || t?.signal.aborted || Pc(n)) {
|
|
4144
|
+
u || f(Fc(n, "Stream aborted"));
|
|
4149
4145
|
return;
|
|
4150
4146
|
}
|
|
4151
4147
|
t?.abort(n), console.error("Error while reading stream:", n), s?.(n);
|
|
@@ -4154,7 +4150,7 @@ function Fc() {
|
|
|
4154
4150
|
}
|
|
4155
4151
|
//#endregion
|
|
4156
4152
|
//#region src/hooks/use-on-chat-changed.ts
|
|
4157
|
-
function
|
|
4153
|
+
function Lc(e) {
|
|
4158
4154
|
let { chatId: t, isNewChat: n } = ci(), r = V(n), i = V(t), a = V(e);
|
|
4159
4155
|
a.current = e, r.current = n, R(() => {
|
|
4160
4156
|
i.current !== t && (a.current({
|
|
@@ -4166,19 +4162,19 @@ function Ic(e) {
|
|
|
4166
4162
|
}
|
|
4167
4163
|
//#endregion
|
|
4168
4164
|
//#region src/hooks/use-current-chat-id.ts
|
|
4169
|
-
function
|
|
4165
|
+
function Rc() {
|
|
4170
4166
|
let { chatId: e } = ci();
|
|
4171
4167
|
return e;
|
|
4172
4168
|
}
|
|
4173
4169
|
//#endregion
|
|
4174
4170
|
//#region src/hooks/use-is-current-chat-new.ts
|
|
4175
|
-
function
|
|
4171
|
+
function zc() {
|
|
4176
4172
|
let { isNewChat: e } = ci();
|
|
4177
4173
|
return e;
|
|
4178
4174
|
}
|
|
4179
4175
|
//#endregion
|
|
4180
4176
|
//#region src/hooks/use-loaded-chat-ids.ts
|
|
4181
|
-
function
|
|
4177
|
+
function Bc() {
|
|
4182
4178
|
let { loadedChatIdsRef: e } = ci();
|
|
4183
4179
|
return {
|
|
4184
4180
|
getIsChatLoaded: I((t) => e.current?.has(t) ?? !1, []),
|
|
@@ -4192,7 +4188,7 @@ function zc() {
|
|
|
4192
4188
|
}
|
|
4193
4189
|
//#endregion
|
|
4194
4190
|
//#region src/hooks/use-chat-prompt-placeholder.ts
|
|
4195
|
-
function
|
|
4191
|
+
function Vc() {
|
|
4196
4192
|
let { promptPlaceholder: e, setPromptPlaceholder: t, clearPromptPlaceholder: n } = ci();
|
|
4197
4193
|
return {
|
|
4198
4194
|
promptPlaceholder: e,
|
|
@@ -4201,6 +4197,6 @@ function Bc() {
|
|
|
4201
4197
|
};
|
|
4202
4198
|
}
|
|
4203
4199
|
//#endregion
|
|
4204
|
-
export {
|
|
4200
|
+
export { ps as $replaceEditorHTMLContent, ms as $replaceEditorSelectionHTMLContent, ds as $setSelectionToEnd, Gs as AlignmentSelect, Ks as AttachmentButton, uc as BoldButton, Tc as CHAT_ACTION_PROTOCOL, lo as CanvasShell, po as CanvasShellCloseTrigger, _o as CanvasShellContent, vo as CanvasShellFooter, mo as CanvasShellFullScreenTrigger, uo as CanvasShellHeader, ho as CanvasShellOptionsButton, fo as CanvasShellTitle, ro as ChatArtifact, co as ChatArtifactActions, so as ChatArtifactCaption, ao as ChatArtifactContent, io as ChatArtifactIcon, oo as ChatArtifactTitle, Jn as ChatCard, Nn as ChatCardActionButton, Mn as ChatCardActions, Gn as ChatCardAttribute, Kn as ChatCardAttributeLabel, qn as ChatCardAttributeValue, Wn as ChatCardAttributes, In as ChatCardBody, Pn as ChatCardCollapsibleButton, $n as ChatCardContainer, Ln as ChatCardContent, zn as ChatCardFooter, Hn as ChatCardFooterActions, Bn as ChatCardFooterNotes, Vn as ChatCardFooterPrice, Un as ChatCardForm, Dn as ChatCardHeader, kn as ChatCardHeaderContent, On as ChatCardIcon, Fn as ChatCardMedia, Rn as ChatCardPreview, jn as ChatCardSubTitle, An as ChatCardTitle, ar as ChatContainer, sr as ChatContainerPrompt, cr as ChatContainerWelcome, mi as ChatConversationProvider, Dr as ChatInput, kr as ChatInputTextarea, Mr as ChatList, Ir as ChatListEmptyState, Lr as ChatListError, Vr as ChatListItem, Br as ChatListItems, Rr as ChatListLoadMore, Fr as ChatListSkeleton, ri as ChatMessage, ai as ChatMessageActions, wi as ChatMessageAttachmentCard, Oi as ChatMessageAttachmentCardActions, Ti as ChatMessageAttachmentCardContent, Ai as ChatMessageAttachmentCardIcon, Di as ChatMessageAttachmentCardPreview, Ei as ChatMessageAttachmentCardTitle, ii as ChatMessageContent, xi as ChatMessageListGroup, Li as ChatMessageResponse, Ri as ChatMessageToolbar, Bi as ChatMessageToolbarActionButton, zi as ChatMessageToolbarActions, Vi as ChatMessageToolbarTimestamp, vi as ChatMessages, yi as ChatMessagesList, Ci as ChatMessagesScrollButton, Xi as ChatNotificationCard, ia as ChatNotificationCardActions, oa as ChatNotificationCardButtons, ua as ChatNotificationCardCloseButton, da as ChatNotificationCardContent, ma as ChatNotificationCardContentActions, pa as ChatNotificationCardContentDescription, fa as ChatNotificationCardContentTitle, la as ChatNotificationCardDeleteButton, _a as ChatNotificationCardDescription, ha as ChatNotificationCardExpandButton, Zi as ChatNotificationCardHead, Qi as ChatNotificationCardHeader, $i as ChatNotificationCardHeaderIcon, ra as ChatNotificationCardHeaderStatus, ea as ChatNotificationCardHeaderTitle, ta as ChatNotificationCardHeaderTitleLabel, ga as ChatNotificationCardIcon, sa as ChatNotificationCardReadActionButton, ca as ChatNotificationCardSnoozeButton, va as ChatNotificationCardTimeStamp, aa as ChatNotificationCardTimestamp, ya as ChatNotificationPopup, xa as ChatNotificationPopupContent, ba as ChatNotificationPopupTrigger, Yr as ChatPromptBox, ti as ChatPromptBoxActionsLeft, ni as ChatPromptBoxActionsRight, $r as ChatPromptBoxContent, ei as ChatPromptBoxInput, Qr as ChatPromptBoxToolbar, li as ChatProvider, Sa as ChatReplies, Ca as ChatReply, wa as ChatReplyLabel, Ta as ChatReplyValue, ka as ChatSuggestion, Na as ChatSuggestionAction, Ma as ChatSuggestionActions, ja as ChatSuggestionLabel, Aa as ChatSuggestionLabelIcon, Oa as ChatSuggestions, bo as ChatThinkingProcess, To as ChatThinkingProcessContent, Do as ChatThinkingProcessContentItem, Oo as ChatThinkingProcessContentItemIcon, xo as ChatThinkingProcessTrigger, wo as ChatThinkingProcessTriggerArrow, So as ChatThinkingProcessTriggerIcon, Co as ChatThinkingProcessTriggerLabel, Xa as ChatThread, eo as ChatThreadAnswer, no as ChatThreadErrorState, Qa as ChatThreadGroup, Ja as ChatThreadProvider, $a as ChatThreadQuestion, dc as CleanFormatButton, Qn as EditableChatCardContextProvider, ko as EmptyState, No as EmptyStateActionRow, Mo as EmptyStateDescription, Ao as EmptyStateIcon, jo as EmptyStateTitle, bc as FormattingToolbarPlugin, Os as HtmlPastePlugin, Cs as INSERT_HTML_COMMAND, Ts as INSERT_HTML_EVENT, vs as INSERT_IMAGE_COMMAND, ys as INSERT_IMAGE_EVENT_NAME, bs as ImageAddedEvent, fc as ImageButton, xs as ImageDropPlugin, Ds as InsertHtmlEvent, pc as ItalicButton, mc as LinkButton, Fi as MarkdownViewer, yo as NewChatTrigger, Ss as PASTE_HTML_COMMAND, ws as PASTE_HTML_EVENT, Es as PasteHtmlEvent, Fs as RichTextArea, xc as RichTextField, hc as SizeSelect, gc as TextColorButton, $ as ToolbarButton, Cc as TopMenu, wc as TopMenuActions, _c as TypographySelect, vc as UnderlineButton, go as canvasShellContentPadding, Dc as createChatActionLink, jc as extractChatActionFromLink, qi as formatSnoozeDate, Mi as getAttachmentIcon, Hi as getSnoozeUntilDate, Oc as isChatActionURL, us as scrollRichTextAreaToBottom, Mc as useChatActions, ci as useChatContext, pi as useChatConversationContext, Tr as useChatInputContext, jr as useChatListContext, Bc as useChatLoadedIds, Yi as useChatNotificationCardContext, Vc as useChatPromptPlaceholder, Ic as useChatStreamMessage, Da as useChatSuggestionContext, Ua as useChatThread, tn as useChatThreadScrollable, Rc as useCurrentChatId, Yn as useEditChatCard, Zn as useEditableChatCardContext, zc as useIsCurrentChatNew, Lc as useOnChatChanged, Q as useRichTextAreaEditor, ss as useRichTextAreaSelectedText };
|
|
4205
4201
|
|
|
4206
4202
|
//# sourceMappingURL=index.es.js.map
|