@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
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 +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as t, jsxs as g, Fragment as hn } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { filter as fn, find as gn, startsWith as mn } from "lodash-es";
|
|
3
|
+
import { Loader as xn } from "lucide-react";
|
|
4
|
+
import { useMemo as $, useState as L, useEffect as Z } from "react";
|
|
5
|
+
import { useTranslation as T } from "react-i18next";
|
|
6
|
+
import { z as vn, D as H, B as pn } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
7
|
+
import { d as Sn, n as Nn, D as Fn, e as wn, f as An, g as Cn, o as Dn, p as I, q as En } from "./index-DPV6NiJ-.js";
|
|
8
|
+
import { p as $n, r as Ln, S as Tn } from "./slug-input-DQ4t3-Tt.js";
|
|
9
|
+
import { b as Un, c as kn, d as Bn, e as Rn, f as Wn, g as _, h as In, u as qn, L as A } from "./index-DqzFD1CG.js";
|
|
10
10
|
const b = ({
|
|
11
11
|
edit: c,
|
|
12
12
|
lang: h,
|
|
@@ -16,7 +16,7 @@ const b = ({
|
|
|
16
16
|
setName: d,
|
|
17
17
|
primaryPageObject: o
|
|
18
18
|
}) => {
|
|
19
|
-
const { t: n } =
|
|
19
|
+
const { t: n } = T();
|
|
20
20
|
return /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
21
21
|
/* @__PURE__ */ t(I, { htmlFor: "lang", children: n("Language") }),
|
|
22
22
|
/* @__PURE__ */ g(
|
|
@@ -26,7 +26,7 @@ const b = ({
|
|
|
26
26
|
disabled: c || !a.length,
|
|
27
27
|
onChange: (l) => {
|
|
28
28
|
const f = l.target.value;
|
|
29
|
-
s(f), !c && (
|
|
29
|
+
s(f), !c && (mn(i, o == null ? void 0 : o.name) || i.length === 0) && d(`${o == null ? void 0 : o.name} - ${A[f]}`);
|
|
30
30
|
},
|
|
31
31
|
className: "col-span-3 flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
32
32
|
children: [
|
|
@@ -37,11 +37,11 @@ const b = ({
|
|
|
37
37
|
)
|
|
38
38
|
] });
|
|
39
39
|
}, y = ({ lang: c, name: h, setName: a, parentHasSelectedLanguagePage: i }) => {
|
|
40
|
-
const { t: s } =
|
|
40
|
+
const { t: s } = T();
|
|
41
41
|
return /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
42
42
|
/* @__PURE__ */ t(I, { htmlFor: "name", children: s("Page Name") }),
|
|
43
43
|
/* @__PURE__ */ t(
|
|
44
|
-
|
|
44
|
+
vn,
|
|
45
45
|
{
|
|
46
46
|
id: "name",
|
|
47
47
|
value: c ? h : "",
|
|
@@ -67,7 +67,7 @@ const b = ({
|
|
|
67
67
|
setIsSlugValid: x,
|
|
68
68
|
getSlug: m
|
|
69
69
|
}) => {
|
|
70
|
-
const { t: r } =
|
|
70
|
+
const { t: r } = T();
|
|
71
71
|
return h ? null : /* @__PURE__ */ g("div", { className: "space-y-1", children: [
|
|
72
72
|
a && i && /* @__PURE__ */ g("div", { className: "flex items-center space-x-2 pb-1", children: [
|
|
73
73
|
/* @__PURE__ */ t(
|
|
@@ -91,7 +91,7 @@ const b = ({
|
|
|
91
91
|
] }),
|
|
92
92
|
/* @__PURE__ */ t(I, { htmlFor: "slug", children: r("Slug") }),
|
|
93
93
|
c ? /* @__PURE__ */ t(H, { variant: "default", className: "p-2 text-xs font-medium italic text-muted-foreground", children: r("This page will use dynamic slug as defined in primary page") }) : /* @__PURE__ */ t(
|
|
94
|
-
|
|
94
|
+
Tn,
|
|
95
95
|
{
|
|
96
96
|
disabled: !i || !l,
|
|
97
97
|
value: f,
|
|
@@ -118,9 +118,9 @@ const b = ({
|
|
|
118
118
|
isSlugValid: x,
|
|
119
119
|
isPending: m
|
|
120
120
|
}) => {
|
|
121
|
-
const { t: r } =
|
|
122
|
-
return /* @__PURE__ */ t(
|
|
123
|
-
/* @__PURE__ */ t(
|
|
121
|
+
const { t: r } = T(), p = m || !h || !a || n.some((v) => (s ? v.id !== d : !0) && v.parent === (o == null ? void 0 : o.id) && v.lang === a) || !l && !(f && u) && (!x || !i);
|
|
122
|
+
return /* @__PURE__ */ t(En, { children: c ? /* @__PURE__ */ g(hn, { children: [
|
|
123
|
+
/* @__PURE__ */ t(pn, { type: "submit", disabled: p && !o.dynamic, children: m ? /* @__PURE__ */ g("span", { className: "flex items-center gap-2", children: [
|
|
124
124
|
/* @__PURE__ */ t("span", { className: "loader mr-2" }),
|
|
125
125
|
r(s ? "Updating..." : "Adding...")
|
|
126
126
|
] }) : r(s ? "Update" : "Add new language page") }),
|
|
@@ -212,14 +212,14 @@ const b = ({
|
|
|
212
212
|
isHomePage: p,
|
|
213
213
|
parentSlug: v,
|
|
214
214
|
slug: S,
|
|
215
|
-
setSlug:
|
|
215
|
+
setSlug: U,
|
|
216
216
|
isSlugValid: E,
|
|
217
217
|
setIsSlugValid: q,
|
|
218
218
|
getSlug: G,
|
|
219
|
-
isPending:
|
|
219
|
+
isPending: k,
|
|
220
220
|
id: B,
|
|
221
221
|
pages: w
|
|
222
|
-
}) => c ? /* @__PURE__ */ t("div", { className: "flex h-80 items-center justify-center", children: /* @__PURE__ */ t(
|
|
222
|
+
}) => c ? /* @__PURE__ */ t("div", { className: "flex h-80 items-center justify-center", children: /* @__PURE__ */ t(xn, { className: "animate-spin" }) }) : u ? /* @__PURE__ */ t(
|
|
223
223
|
zn,
|
|
224
224
|
{
|
|
225
225
|
onSubmit: h,
|
|
@@ -238,7 +238,7 @@ const b = ({
|
|
|
238
238
|
useLanguagePrefix: m,
|
|
239
239
|
slug: S,
|
|
240
240
|
isSlugValid: E,
|
|
241
|
-
isPending:
|
|
241
|
+
isPending: k
|
|
242
242
|
}
|
|
243
243
|
) : /* @__PURE__ */ g("form", { onSubmit: h, children: [
|
|
244
244
|
/* @__PURE__ */ g("div", { className: "grid gap-4 py-4", children: [
|
|
@@ -276,7 +276,7 @@ const b = ({
|
|
|
276
276
|
parentSlug: v,
|
|
277
277
|
parentHasSelectedLanguagePage: f,
|
|
278
278
|
slug: S,
|
|
279
|
-
setSlug:
|
|
279
|
+
setSlug: U,
|
|
280
280
|
isSlugValid: E,
|
|
281
281
|
setIsSlugValid: q,
|
|
282
282
|
getSlug: G
|
|
@@ -298,7 +298,7 @@ const b = ({
|
|
|
298
298
|
isHomePage: p,
|
|
299
299
|
useLanguagePrefix: m,
|
|
300
300
|
isSlugValid: E,
|
|
301
|
-
isPending:
|
|
301
|
+
isPending: k
|
|
302
302
|
}
|
|
303
303
|
)
|
|
304
304
|
] }), bn = ({
|
|
@@ -309,20 +309,20 @@ const b = ({
|
|
|
309
309
|
edit: s = !1,
|
|
310
310
|
preselectedLang: d
|
|
311
311
|
}) => {
|
|
312
|
-
const { data: o = [] } =
|
|
312
|
+
const { data: o = [] } = Un(), n = $(() => o.find((e) => e.id === i), [o, i]), [l, f] = L(""), [u, x] = L(""), [m, r] = L(""), [p, v] = L(!0), [S, U] = L(!0), { mutate: E, isPending: q } = kn(), { mutate: G, isPending: k } = Bn(), B = q || k, { data: w, isFetching: j } = Rn(), Y = Wn(), { data: C, isFetching: O } = _(i), { data: F = [], isFetching: nn } = _(
|
|
313
313
|
n == null ? void 0 : n.parent
|
|
314
|
-
), { data: J = [], isFetching: en } =
|
|
314
|
+
), { data: J = [], isFetching: en } = In(), { setSelectedLang: sn } = Sn(), { t: z } = T(), [, tn] = qn(), [, on] = Nn(), ln = j || O || nn || en, D = $(() => fn(w == null ? void 0 : w.languages, (e) => !gn(C, { lang: e })), [w, C]), M = $(
|
|
315
315
|
() => J.find((e) => e.key === (n == null ? void 0 : n.pageType)),
|
|
316
316
|
[J, n == null ? void 0 : n.pageType]
|
|
317
317
|
), K = !(M != null && M.hasSlug), V = (n == null ? void 0 : n.slug) === "/";
|
|
318
|
-
|
|
318
|
+
Z(() => {
|
|
319
319
|
if (!s && n && d && (x(d), f(`${n.name} - ${A[d]}`)), !s || !n) return;
|
|
320
320
|
const e = C == null ? void 0 : C.find((rn) => rn.id === c);
|
|
321
321
|
if (!e) return;
|
|
322
322
|
f(e.name), x(e.lang);
|
|
323
|
-
const N = e.slug || "", { initSlug: W, prefix: cn } =
|
|
324
|
-
r(W),
|
|
325
|
-
}, [s, c, C, n, d]),
|
|
323
|
+
const N = e.slug || "", { initSlug: W, prefix: cn } = $n(N, n);
|
|
324
|
+
r(W), U(cn);
|
|
325
|
+
}, [s, c, C, n, d]), Z(() => {
|
|
326
326
|
if (d)
|
|
327
327
|
x(d);
|
|
328
328
|
else if ((D == null ? void 0 : D.length) === 1 && !s) {
|
|
@@ -343,7 +343,7 @@ const b = ({
|
|
|
343
343
|
return { parentSlug: e == null ? void 0 : e.slug, isRootPage: !1 };
|
|
344
344
|
}, [n == null ? void 0 : n.parent, F, S, u, V]), an = $(() => R ? !0 : !!(F != null && F.some((e) => (e == null ? void 0 : e.lang) === u)), [u, F, R]), X = () => {
|
|
345
345
|
let e = "";
|
|
346
|
-
return R ? e = `/${S ? [u, m].filter(Boolean).join("/") : m}` : e = `${
|
|
346
|
+
return R ? e = `/${S ? [u, m].filter(Boolean).join("/") : m}` : e = `${Ln(Q)}/${m}`, e.replace(/\/{2,}/g, "/").replace(/\/$/, "");
|
|
347
347
|
}, dn = (e) => {
|
|
348
348
|
const N = new URLSearchParams(window.location.search);
|
|
349
349
|
Y && e === Y ? N.delete("lang") : N.set("lang", e), tn(N), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
@@ -361,10 +361,10 @@ const b = ({
|
|
|
361
361
|
};
|
|
362
362
|
s ? G(N, { onSuccess: W }) : E(N, { onSuccess: W });
|
|
363
363
|
};
|
|
364
|
-
return /* @__PURE__ */ t(
|
|
365
|
-
/* @__PURE__ */ g(
|
|
366
|
-
/* @__PURE__ */ t(
|
|
367
|
-
/* @__PURE__ */ t(
|
|
364
|
+
return /* @__PURE__ */ t(Fn, { open: h, onOpenChange: a, children: h && /* @__PURE__ */ g(wn, { className: "text-slate-600 sm:max-w-[425px]", children: [
|
|
365
|
+
/* @__PURE__ */ g(An, { children: [
|
|
366
|
+
/* @__PURE__ */ t(Cn, { children: z(s ? "Edit language" : "Add new language page") }),
|
|
367
|
+
/* @__PURE__ */ t(Dn, { className: "font-light", children: z("Enter the details for the language") })
|
|
368
368
|
] }),
|
|
369
369
|
/* @__PURE__ */ t(
|
|
370
370
|
Mn,
|
|
@@ -384,7 +384,7 @@ const b = ({
|
|
|
384
384
|
isNonSlugPageType: K,
|
|
385
385
|
isRootPage: R,
|
|
386
386
|
useLanguagePrefix: S,
|
|
387
|
-
setUseLanguagePrefix:
|
|
387
|
+
setUseLanguagePrefix: U,
|
|
388
388
|
isHomePage: V,
|
|
389
389
|
parentSlug: Q,
|
|
390
390
|
slug: m,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("react"),a=require("react-i18next"),s=require("./index-D-r_K4yA.cjs"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-qL3-M8g3.cjs"))),x=({addEditPage:n,setAddEditPage:r,closePanel:l})=>{const{t:o}=a.useTranslation(),t=!!(n!=null&&n.id),i=!!n;return e.jsx(s.Dialog,{open:i,onOpenChange:()=>r(void 0),children:i&&e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{children:[o(t?"Edit":"Add New")," "]}),e.jsx(s.DialogDescription,{children:o(t?"Update your page name":"Enter details to create a new page")})]}),e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"min-h-40"}),children:e.jsx(u,{closePanel:l,addEditPage:n,close:()=>r(void 0)})})]})})};exports.default=x;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense as t, lazy as c } from "react";
|
|
3
|
+
import { useTranslation as m } from "react-i18next";
|
|
4
|
+
import { D as p, e as h, f, g as D, o as u } from "./index-DPV6NiJ-.js";
|
|
5
|
+
const x = c(() => import("./page-creator-BAIbU14q.js")), C = ({
|
|
6
|
+
addEditPage: o,
|
|
7
|
+
setAddEditPage: s,
|
|
8
|
+
closePanel: l
|
|
9
|
+
}) => {
|
|
10
|
+
const { t: n } = m(), a = !!(o != null && o.id), i = !!o;
|
|
11
|
+
return /* @__PURE__ */ e(p, { open: i, onOpenChange: () => s(void 0), children: i && /* @__PURE__ */ r(h, { className: "sm:max-w-[425px]", children: [
|
|
12
|
+
/* @__PURE__ */ r(f, { children: [
|
|
13
|
+
/* @__PURE__ */ r(D, { children: [
|
|
14
|
+
n(a ? "Edit" : "Add New"),
|
|
15
|
+
" "
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ e(u, { children: n(a ? "Update your page name" : "Enter details to create a new page") })
|
|
18
|
+
] }),
|
|
19
|
+
/* @__PURE__ */ e(t, { fallback: /* @__PURE__ */ e("div", { className: "min-h-40" }), children: /* @__PURE__ */ e(
|
|
20
|
+
x,
|
|
21
|
+
{
|
|
22
|
+
closePanel: l,
|
|
23
|
+
addEditPage: o,
|
|
24
|
+
close: () => s(void 0)
|
|
25
|
+
}
|
|
26
|
+
) })
|
|
27
|
+
] }) });
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
C as default
|
|
31
|
+
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsxs as R, Fragment as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { g as U } from "./apply-binding-vAuN-TGV.js";
|
|
1
|
+
import { jsxs as R, Fragment as J, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Bot as Y } from "lucide-react";
|
|
3
|
+
import { useCallback as Z, Fragment as tt, Suspense as et, lazy as nt, startTransition as z } from "react";
|
|
4
|
+
import { toast as rt } from "sonner";
|
|
5
|
+
import { U as st, V as ot, W as at, r as it, a as ct, X as lt } from "./index-DPV6NiJ-.js";
|
|
6
|
+
import { C as ut, a as dt, b as mt, R as ft, c as pt, d as ht, T as gt, M as At, e as kt, f as yt, h as It, S as bt, i as St } from "./selected-block-display-Ck1kkNEi.js";
|
|
7
|
+
import { i as Ct, j as Et } from "./index-DqzFD1CG.js";
|
|
9
8
|
import { useQueryClient as vt } from "@tanstack/react-query";
|
|
9
|
+
import { g as Q } from "./apply-binding-v_W4uR3U.js";
|
|
10
10
|
const wt = () => {
|
|
11
|
-
const { addPredefinedBlock: I } =
|
|
11
|
+
const { addPredefinedBlock: I } = st(), F = ot(), b = at(), x = vt(), N = async (o, n) => {
|
|
12
12
|
if (!n) return;
|
|
13
|
-
const e =
|
|
13
|
+
const e = Q(n);
|
|
14
14
|
await I(e, o.parentId, o.position);
|
|
15
15
|
}, w = async (o, n) => {
|
|
16
16
|
if (!o.blockId || !n) return;
|
|
17
|
-
const e =
|
|
17
|
+
const e = Q(n);
|
|
18
18
|
await F(o.blockId, e);
|
|
19
19
|
}, C = async (o) => {
|
|
20
20
|
!o.ids || o.ids.length === 0 || await b(o.ids);
|
|
@@ -70,7 +70,7 @@ const wt = () => {
|
|
|
70
70
|
} else t.startsWith("POS=") ? s.position = parseInt(t.substring(4)) : t.startsWith("ID=") ? s.blockId = t.substring(3) : t.startsWith("IDS=") && (s.ids = t.substring(4).split(",").map((g) => g.trim()));
|
|
71
71
|
}), s;
|
|
72
72
|
};
|
|
73
|
-
return
|
|
73
|
+
return Z(
|
|
74
74
|
async (o, n) => {
|
|
75
75
|
const e = new TextDecoder();
|
|
76
76
|
let l = "", u = "", s = !1, f = null;
|
|
@@ -199,7 +199,7 @@ const wt = () => {
|
|
|
199
199
|
},
|
|
200
200
|
[b]
|
|
201
201
|
);
|
|
202
|
-
}, Bt =
|
|
202
|
+
}, Bt = nt(() => import("./ai-prompt-input-BQi0VDJC.js")), Ft = ({
|
|
203
203
|
t: I,
|
|
204
204
|
fetch: F,
|
|
205
205
|
input: b,
|
|
@@ -216,19 +216,19 @@ const wt = () => {
|
|
|
216
216
|
selectedModel: O,
|
|
217
217
|
onModelChange: o
|
|
218
218
|
}) => {
|
|
219
|
-
const { models: n } = Ct(), e = Et(), l = n.find((r) => r.id === "google/gemini-3-flash") || n[0], u = O || l.id, s =
|
|
219
|
+
const { models: n } = Ct(), e = Et(), l = n.find((r) => r.id === "google/gemini-3-flash") || n[0], u = O || l.id, s = it(), [, f] = ct(), t = lt(), g = wt(), M = async (r, a, i, c) => {
|
|
220
220
|
var V, _;
|
|
221
221
|
if (!r || w) return;
|
|
222
222
|
B(s);
|
|
223
223
|
const p = t(s ? { blockId: s._id, additionalCoreBlocks: ["Icon"] } : { additionalCoreBlocks: ["Icon"] });
|
|
224
224
|
if (s && !p) {
|
|
225
|
-
|
|
225
|
+
rt.error(I("Something went wrong. Please try again."));
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
228
|
const h = {
|
|
229
229
|
id: Date.now().toString(),
|
|
230
230
|
role: "user",
|
|
231
|
-
content:
|
|
231
|
+
content: St({
|
|
232
232
|
language: L,
|
|
233
233
|
userInput: a || r,
|
|
234
234
|
currentHtml: p
|
|
@@ -242,8 +242,8 @@ const wt = () => {
|
|
|
242
242
|
isStreaming: !0
|
|
243
243
|
};
|
|
244
244
|
C((A) => [...A, h, $]), H(!0);
|
|
245
|
-
const
|
|
246
|
-
T(
|
|
245
|
+
const X = new AbortController();
|
|
246
|
+
T(X);
|
|
247
247
|
const S = c || u;
|
|
248
248
|
(V = e.onAIEvent) == null || V.call(e, { type: "stream_start", model: S, timestamp: Date.now() });
|
|
249
249
|
try {
|
|
@@ -261,10 +261,10 @@ const wt = () => {
|
|
|
261
261
|
throw new Error(I("Failed to get AI response"));
|
|
262
262
|
const y = (_ = W.body) == null ? void 0 : _.getReader();
|
|
263
263
|
if (!y) throw new Error(I("Response body is not readable"));
|
|
264
|
-
await g(y, C), C((k) => (
|
|
265
|
-
var
|
|
266
|
-
const D = k.filter((q) => q.role === "assistant" && !q.isReasoning && !q.isTask), E = ((
|
|
267
|
-
(
|
|
264
|
+
await g(y, C), C((k) => (z(() => {
|
|
265
|
+
var j, K, G, U;
|
|
266
|
+
const D = k.filter((q) => q.role === "assistant" && !q.isReasoning && !q.isTask), E = ((j = D[D.length - 1]) == null ? void 0 : j.content) || "", v = Date.now();
|
|
267
|
+
(K = e.onSuccess) == null || K.call(e, { content: E, model: S, timestamp: v }), (G = e.onComplete) == null || G.call(e, { success: !0, content: E, model: S, timestamp: v }), (U = e.onAIEvent) == null || U.call(e, {
|
|
268
268
|
type: "completion",
|
|
269
269
|
content: E,
|
|
270
270
|
model: S,
|
|
@@ -278,7 +278,7 @@ const wt = () => {
|
|
|
278
278
|
role: "assistant",
|
|
279
279
|
content: I("Sorry, I encountered an error. Please try again.")
|
|
280
280
|
};
|
|
281
|
-
C((y) => [...y, W]),
|
|
281
|
+
C((y) => [...y, W]), z(() => {
|
|
282
282
|
var D, E, v;
|
|
283
283
|
const y = A instanceof Error ? A.message : String(A), k = Date.now();
|
|
284
284
|
(D = e.onError) == null || D.call(e, { error: y, model: S, timestamp: k }), (E = e.onComplete) == null || E.call(e, { success: !1, error: y, model: S, timestamp: k }), (v = e.onAIEvent) == null || v.call(e, { type: "error", error: y, model: S, timestamp: k });
|
|
@@ -288,29 +288,29 @@ const wt = () => {
|
|
|
288
288
|
N(""), H(!1), B(null), T(null);
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
|
-
return /* @__PURE__ */ R(
|
|
292
|
-
/* @__PURE__ */ R(
|
|
293
|
-
/* @__PURE__ */ R(
|
|
291
|
+
return /* @__PURE__ */ R(J, { children: [
|
|
292
|
+
/* @__PURE__ */ R(ut, { className: "no-scrollbar", children: [
|
|
293
|
+
/* @__PURE__ */ R(dt, { className: "gap-2 px-0", children: [
|
|
294
294
|
x.length === 0 && /* @__PURE__ */ m(
|
|
295
|
-
|
|
295
|
+
mt,
|
|
296
296
|
{
|
|
297
|
-
icon: /* @__PURE__ */ m(
|
|
297
|
+
icon: /* @__PURE__ */ m(Y, { size: 48, className: "text-gray-300" }),
|
|
298
298
|
title: "Start a conversation",
|
|
299
299
|
description: I("Start a conversation with the AI assistant to add/edit current page")
|
|
300
300
|
}
|
|
301
301
|
),
|
|
302
302
|
x.map(
|
|
303
|
-
(r) => r.role !== "system" && /* @__PURE__ */ m(
|
|
304
|
-
/* @__PURE__ */ m(
|
|
305
|
-
/* @__PURE__ */ m(
|
|
306
|
-
] }) : r.isTask && !r.isTaskCompleted ? /* @__PURE__ */ m(
|
|
303
|
+
(r) => r.role !== "system" && /* @__PURE__ */ m(tt, { children: r.isReasoning ? /* @__PURE__ */ R(ft, { isStreaming: r.isStreaming, defaultOpen: !0, children: [
|
|
304
|
+
/* @__PURE__ */ m(pt, { className: "text-xs [&_p]:text-muted-foreground" }),
|
|
305
|
+
/* @__PURE__ */ m(ht, { className: "p-0 text-xs", children: r.content })
|
|
306
|
+
] }) : r.isTask && !r.isTaskCompleted ? /* @__PURE__ */ m(gt, { content: r.content, isLoading: r.isTaskLoading }) : /* @__PURE__ */ m(At, { from: r.role, children: /* @__PURE__ */ m(kt, { className: "p-0", children: r.role === "assistant" ? /* @__PURE__ */ m(yt, { className: "p-0 text-xs", children: r.content }) : /* @__PURE__ */ m("div", { className: "p-0 text-xs", children: r.userMessage || r.content }) }) }) }, r.id)
|
|
307
307
|
)
|
|
308
308
|
] }),
|
|
309
|
-
/* @__PURE__ */ m(
|
|
309
|
+
/* @__PURE__ */ m(It, {})
|
|
310
310
|
] }),
|
|
311
311
|
/* @__PURE__ */ R("div", { className: "border-gray-200 pb-2", children: [
|
|
312
|
-
/* @__PURE__ */ m(
|
|
313
|
-
/* @__PURE__ */ m(
|
|
312
|
+
/* @__PURE__ */ m(bt, { onRemove: () => f([]), isLoading: w }),
|
|
313
|
+
/* @__PURE__ */ m(et, { fallback: /* @__PURE__ */ m("div", { children: "Loading..." }), children: /* @__PURE__ */ m(
|
|
314
314
|
Bt,
|
|
315
315
|
{
|
|
316
316
|
input: b,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),Z=require("lucide-react"),C=require("react"),ee=require("sonner"),T=require("./index-D-r_K4yA.cjs"),p=require("./selected-block-display-DSow6N4b.cjs"),J=require("./index-BYrRPW_c.cjs"),te=require("@tanstack/react-query"),X=require("./apply-binding-Cjh1kqMO.cjs"),ne=()=>{const{addPredefinedBlock:b}=T.useAddBlock(),W=T.useReplaceBlock(),S=T.useRemoveBlocks(),N=te.useQueryClient(),H=async(o,n)=>{if(!n)return;const t=X.getBlocksFromHTML(n);await b(t,o.parentId,o.position)},w=async(o,n)=>{if(!o.blockId||!n)return;const t=X.getBlocksFromHTML(n);await W(o.blockId,t)},x=async o=>{!o.ids||o.ids.length===0||await S(o.ids)};let m=null;const q=(o,n)=>{const t=document.getElementById("canvas-iframe");if(!t)return null;const u=t==null?void 0:t.contentDocument;if(!u)return null;u.querySelectorAll("[data-stream-canvas]").forEach(f=>f.remove());let s=null;if(o&&o!=="undefined"&&(s=u.querySelector(`[data-block-id="${o}"]`)),s||(s=u.body),!s)return null;if(m=u.createElement("div"),m.setAttribute("data-stream-canvas","true"),n!==void 0&&n>=0&&s.children){const f=Math.min(n,s.children.length);f<s.children.length?s.insertBefore(m,s.children[f]):s.appendChild(m)}else s.appendChild(m);return m},F=o=>{var s;const n=document.getElementById("canvas-iframe");if(!n)return null;const t=n==null?void 0:n.contentDocument;if(!t)return null;t.querySelectorAll("[data-stream-canvas]").forEach(f=>f.remove());const d=t.querySelector(`[data-block-id="${o}"]`);return d?(m=t.createElement("div"),m.setAttribute("data-stream-canvas","true"),(s=d.parentNode)==null||s.insertBefore(m,d.nextSibling),d.style.display="none",m):null},L=o=>{const n=document.getElementById("canvas-iframe");(n==null?void 0:n.contentWindow)&&o.scrollIntoView({behavior:"smooth",block:"end"})},M=(o,n,t)=>{const u=q(n,t);u&&(u.innerHTML=o,L(u))},D=(o,n)=>{const t=F(n);t&&(t.innerHTML=o,L(t))},O=o=>{const n=o.match(/^--ACTION=(.+)--$/);if(!n)return null;let u=n[1].replace(/--/g,"").split("|");const s={type:u[0]};return u.forEach(f=>{const e=f.trim();if(e.startsWith("PARENT=")){const A=e.substring(7);s.parentId=A==="undefined"?void 0:A}else e.startsWith("POS=")?s.position=parseInt(e.substring(4)):e.startsWith("ID=")?s.blockId=e.substring(3):e.startsWith("IDS=")&&(s.ids=e.substring(4).split(",").map(A=>A.trim()))}),s};return C.useCallback(async(o,n)=>{const t=new TextDecoder;let u="",d="",s=!1,f=null;const e={isInAction:!1,currentAction:null,htmlBuffer:"",isCapturingHtml:!1},A=async r=>{const i=r.trim();if(i==="--START--"){s=!0;return}if(s){if(i==="--END--"){e.currentAction&&(e.htmlBuffer||e.currentAction.type==="REMOVE")&&await R(e.currentAction,e.htmlBuffer),m&&(m.remove(),m=null);return}if(i.startsWith("--THINKING=")){const a=i.substring(11);n(l=>{const h=[...l],g=h[h.length-1];if(g&&g.role==="assistant"&&g.isReasoning)g.content=a,g.isStreaming=!1;else{const $={id:Date.now().toString(),role:"assistant",content:a,isReasoning:!0,isStreaming:!1};h.push($)}return h});return}if(i.startsWith("--TASK=")){const a=i.substring(7),l=`task-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,h={id:l,role:"assistant",content:a.replace(/--$/,""),isTask:!0,isTaskLoading:!0,isTaskCompleted:!1};f=l,n(g=>[...g,h]);return}if(i.startsWith("--MSG=")){const a=i.substring(6),l={id:Date.now().toString(),role:"assistant",content:a.replace(/--$/g,""),isReasoning:!1,isStreaming:!1};n(h=>[...h,l]);return}if(i.startsWith("--ACTION=")){e.currentAction&&(e.htmlBuffer||e.currentAction.type==="REMOVE")&&await R(e.currentAction,e.htmlBuffer),e.currentAction=O(i),e.htmlBuffer="",e.isInAction=!0;return}if(i==="--ENDACTION--"){e.currentAction&&(e.htmlBuffer||e.currentAction.type==="REMOVE")&&await R(e.currentAction,e.htmlBuffer),f&&(n(a=>a.map(l=>l.isTask?{...l,isTaskCompleted:!0}:l)),f=null),e.currentAction=null,e.htmlBuffer="",e.isInAction=!1;return}if(i==="--HTML--"){e.isCapturingHtml=!0;return}if(i==="--ENDHTML--"){e.isCapturingHtml=!1;return}if(i.startsWith("--HTML--")&&i.includes("--ENDHTML--")){const a=i.match(/^--HTML--(.+?)--ENDHTML--$/);if(a&&e.currentAction){const l=a[1];e.htmlBuffer+=l,e.currentAction.type==="ADD"?M(e.htmlBuffer,e.currentAction.parentId,e.currentAction.position):e.currentAction.type==="EDIT"&&e.currentAction.blockId&&D(e.htmlBuffer,e.currentAction.blockId)}return}e.isCapturingHtml&&e.currentAction&&(e.htmlBuffer+=r+`
|
|
2
2
|
`,e.currentAction.type==="ADD"?M(e.htmlBuffer,e.currentAction.parentId,e.currentAction.position):e.currentAction.type==="EDIT"&&e.currentAction.blockId&&D(e.htmlBuffer,e.currentAction.blockId))}},R=async(r,i)=>{try{switch(r.type){case"ADD":await H(r,i);break;case"EDIT":await w(r,i);break;case"REMOVE":await x(r);break}n(a=>a.filter(l=>!l.isTask))}catch(a){console.log(a)}};try{for(;;){const{done:r,value:i}=await o.read();if(r)break;const a=t.decode(i,{stream:!0});u+=a,d+=a;const l=d.split(`
|
|
3
|
-
`);d=l.pop()||"";for(const h of l)await A(h)}d&&await A(d),N.invalidateQueries({queryKey:["AI_USAGE"]})}catch(r){console.log(r)}},[S])},re=C.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-
|
|
3
|
+
`);d=l.pop()||"";for(const h of l)await A(h)}d&&await A(d),N.invalidateQueries({queryKey:["AI_USAGE"]})}catch(r){console.log(r)}},[S])},re=C.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-BT5426AB.cjs"))),se=({t:b,fetch:W,input:S,messages:N,setInput:H,isLoading:w,setMessages:x,handleStop:m,setIsLoading:q,currentBlock:F,fallbackLang:L,setCurrentBlock:M,setAbortController:D,selectedModel:O,onModelChange:o})=>{const{models:n}=J.useAIModels(),t=J.useAIConfig(),u=n.find(r=>r.id==="google/gemini-3-flash")||n[0],d=O||u.id,s=T.useSelectedBlock(),[,f]=T.useSelectedBlockIds(),e=T.useBlocksHtmlForAi(),A=ne(),R=async(r,i,a,l)=>{var _,K;if(!r||w)return;M(s);const h=e(s?{blockId:s._id,additionalCoreBlocks:["Icon"]}:{additionalCoreBlocks:["Icon"]});if(s&&!h){ee.toast.error(b("Something went wrong. Please try again."));return}const g={id:Date.now().toString(),role:"user",content:p.getUserPrompt({language:L,userInput:i||r,currentHtml:h}),userMessage:r},$={id:(Date.now()+1).toString(),role:"assistant",content:"",isReasoning:!0,isStreaming:!0};x(k=>[...k,g,$]),q(!0);const Y=new AbortController;D(Y);const v=l||d;(_=t.onAIEvent)==null||_.call(t,{type:"stream_start",model:v,timestamp:Date.now()});try{const k={messages:[g].map(y=>({role:y.role,content:y.content})),model:l||d,context:t.context};a&&(k.image=a);const P=await W({body:{action:"ASK_AI",data:k},streamResponse:!0});if(!P.ok)throw new Error(b("Failed to get AI response"));const I=(K=P.body)==null?void 0:K.getReader();if(!I)throw new Error(b("Response body is not readable"));await A(I,x),x(y=>(C.startTransition(()=>{var G,Q,z,U;const j=y.filter(V=>V.role==="assistant"&&!V.isReasoning&&!V.isTask),B=((G=j[j.length-1])==null?void 0:G.content)||"",E=Date.now();(Q=t.onSuccess)==null||Q.call(t,{content:B,model:v,timestamp:E}),(z=t.onComplete)==null||z.call(t,{success:!0,content:B,model:v,timestamp:E}),(U=t.onAIEvent)==null||U.call(t,{type:"completion",content:B,model:v,timestamp:E})}),y))}catch(k){if(k.name!=="AbortError"){const P={id:(Date.now()+1).toString(),role:"assistant",content:b("Sorry, I encountered an error. Please try again.")};x(I=>[...I,P]),C.startTransition(()=>{var j,B,E;const I=k instanceof Error?k.message:String(k),y=Date.now();(j=t.onError)==null||j.call(t,{error:I,model:v,timestamp:y}),(B=t.onComplete)==null||B.call(t,{success:!1,error:I,model:v,timestamp:y}),(E=t.onAIEvent)==null||E.call(t,{type:"error",error:I,model:v,timestamp:y})})}}finally{H(""),q(!1),M(null),D(null)}};return c.jsxs(c.Fragment,{children:[c.jsxs(p.Conversation,{className:"no-scrollbar",children:[c.jsxs(p.ConversationContent,{className:"gap-2 px-0",children:[N.length===0&&c.jsx(p.ConversationEmptyState,{icon:c.jsx(Z.Bot,{size:48,className:"text-gray-300"}),title:"Start a conversation",description:b("Start a conversation with the AI assistant to add/edit current page")}),N.map(r=>r.role!=="system"&&c.jsx(C.Fragment,{children:r.isReasoning?c.jsxs(p.Reasoning,{isStreaming:r.isStreaming,defaultOpen:!0,children:[c.jsx(p.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),c.jsx(p.ReasoningContent,{className:"p-0 text-xs",children:r.content})]}):r.isTask&&!r.isTaskCompleted?c.jsx(p.TaskMessage,{content:r.content,isLoading:r.isTaskLoading}):c.jsx(p.Message,{from:r.role,children:c.jsx(p.MessageContent,{className:"p-0",children:r.role==="assistant"?c.jsx(p.MessageResponse,{className:"p-0 text-xs",children:r.content}):c.jsx("div",{className:"p-0 text-xs",children:r.userMessage||r.content})})})},r.id))]}),c.jsx(p.ConversationScrollButton,{})]}),c.jsxs("div",{className:"border-gray-200 pb-2",children:[c.jsx(p.SelectedBlockDisplay,{onRemove:()=>f([]),isLoading:w}),c.jsx(C.Suspense,{fallback:c.jsx("div",{children:"Loading..."}),children:c.jsx(re,{input:S,setInput:H,onSend:R,onStop:m,isLoading:w,selectedLang:"",currentBlock:s||F,disabled:(S==null?void 0:S.length)===0,selectedModel:d,onModelChange:o})})]})]})};exports.default=se;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as g, Fragment as L, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
const Ae =
|
|
9
|
-
fetch:
|
|
2
|
+
import { Bot as ee } from "lucide-react";
|
|
3
|
+
import { useRef as te, useEffect as se, Suspense as P, lazy as F, Fragment as oe, startTransition as j } from "react";
|
|
4
|
+
import { useTranslation as ne } from "react-i18next";
|
|
5
|
+
import { r as re, a as ae, s as le, t as ce } from "./index-DPV6NiJ-.js";
|
|
6
|
+
import { C as ie, a as de, b as me, R as ue, c as he, d as pe, T as Se, M as ye, e as Te, f as ke, S as ge, g as fe } from "./selected-block-display-Ck1kkNEi.js";
|
|
7
|
+
import { i as we, j as xe } from "./index-DqzFD1CG.js";
|
|
8
|
+
const Ae = F(() => import("./ai-translation-prompt-BN78s33t.js")), Me = F(() => import("./ai-prompt-input-BQi0VDJC.js")), Ce = ({
|
|
9
|
+
fetch: _,
|
|
10
10
|
input: m,
|
|
11
11
|
messages: f,
|
|
12
12
|
setInput: A,
|
|
@@ -23,11 +23,11 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
23
23
|
selectedModel: K,
|
|
24
24
|
onModelChange: V
|
|
25
25
|
}) => {
|
|
26
|
-
const { t: r } =
|
|
26
|
+
const { t: r } = ne(), { models: b } = we(), t = xe(), W = b.find((e) => e.id === "google/gemini-3-flash") || b[0], E = K || W.id, $ = te(null), p = re(), [, G] = ae(), R = le(), H = ce(), Q = () => {
|
|
27
27
|
var e;
|
|
28
28
|
(e = $.current) == null || e.scrollIntoView({ behavior: "smooth" });
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
se(() => {
|
|
31
31
|
Q();
|
|
32
32
|
}, [f, u]);
|
|
33
33
|
const v = async (e, B, X) => {
|
|
@@ -36,7 +36,7 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
36
36
|
const I = (e == null ? void 0 : e.toLowerCase()) === "translate", C = {
|
|
37
37
|
id: Date.now().toString(),
|
|
38
38
|
role: "user",
|
|
39
|
-
content:
|
|
39
|
+
content: fe({
|
|
40
40
|
fallbackLang: q,
|
|
41
41
|
userInput: B || e,
|
|
42
42
|
language: h,
|
|
@@ -61,7 +61,7 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
61
61
|
initiator: I ? "TRANSLATE_CONTENT" : "UPDATE_CONTENT",
|
|
62
62
|
model: n,
|
|
63
63
|
context: t.context
|
|
64
|
-
}, l = await
|
|
64
|
+
}, l = await _({ body: { action: "ASK_AI", data: a }, streamResponse: !0 });
|
|
65
65
|
if (!l.ok)
|
|
66
66
|
throw new Error(r("Failed to get AI response"));
|
|
67
67
|
const c = (O = l.body) == null ? void 0 : O.getReader(), S = new TextDecoder();
|
|
@@ -75,7 +75,7 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
75
75
|
o += k, M((i) => (i[i.length - 1].content = o, [...i]));
|
|
76
76
|
}
|
|
77
77
|
const y = JSON.parse(o == null ? void 0 : o.replace("```json", "").replace("```", ""));
|
|
78
|
-
H(y),
|
|
78
|
+
H(y), j(() => {
|
|
79
79
|
var T, k, i;
|
|
80
80
|
const d = Date.now();
|
|
81
81
|
(T = t.onSuccess) == null || T.call(t, { content: o, model: n, timestamp: d }), (k = t.onComplete) == null || k.call(t, { success: !0, content: o, model: n, timestamp: d }), (i = t.onAIEvent) == null || i.call(t, {
|
|
@@ -86,7 +86,7 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
} catch (a) {
|
|
89
|
-
x == null || x.abort(),
|
|
89
|
+
x == null || x.abort(), j(() => {
|
|
90
90
|
var S, o, y;
|
|
91
91
|
const l = a instanceof Error ? a.message : String(a), c = Date.now();
|
|
92
92
|
(S = t.onError) == null || S.call(t, { error: l, model: n, timestamp: c }), (o = t.onComplete) == null || o.call(t, { success: !1, error: l, model: n, timestamp: c }), (y = t.onAIEvent) == null || y.call(t, { type: "error", error: l, model: n, timestamp: c });
|
|
@@ -105,11 +105,11 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
105
105
|
onClick: v
|
|
106
106
|
}
|
|
107
107
|
) }) }),
|
|
108
|
-
/* @__PURE__ */ s(
|
|
108
|
+
/* @__PURE__ */ s(ie, { children: /* @__PURE__ */ g(de, { className: "gap-4 px-0", children: [
|
|
109
109
|
f.length === 0 && /* @__PURE__ */ s(
|
|
110
|
-
|
|
110
|
+
me,
|
|
111
111
|
{
|
|
112
|
-
icon: /* @__PURE__ */ s(
|
|
112
|
+
icon: /* @__PURE__ */ s(ee, { size: 48, className: "text-gray-300" }),
|
|
113
113
|
title: r("Start a conversation with the AI assistant to translate/edit your content"),
|
|
114
114
|
description: r(
|
|
115
115
|
"Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language."
|
|
@@ -117,14 +117,14 @@ const Ae = _(() => import("./ai-translation-prompt-1OUs1P7n.js")), Me = _(() =>
|
|
|
117
117
|
}
|
|
118
118
|
),
|
|
119
119
|
f.map(
|
|
120
|
-
(e) => e.role !== "system" && /* @__PURE__ */ s(
|
|
121
|
-
/* @__PURE__ */ s(
|
|
122
|
-
/* @__PURE__ */ s(
|
|
123
|
-
] }) : e.isTask ? /* @__PURE__ */ s(
|
|
120
|
+
(e) => e.role !== "system" && /* @__PURE__ */ s(oe, { children: e.isReasoning ? /* @__PURE__ */ g(ue, { isStreaming: e.isStreaming, defaultOpen: !0, children: [
|
|
121
|
+
/* @__PURE__ */ s(he, { className: "text-xs [&_p]:text-muted-foreground" }),
|
|
122
|
+
/* @__PURE__ */ s(pe, { className: "p-0 text-xs", children: e.content })
|
|
123
|
+
] }) : e.isTask ? /* @__PURE__ */ s(Se, { content: e.content, isLoading: e.isTaskLoading }) : /* @__PURE__ */ s(ye, { from: e.role, children: /* @__PURE__ */ s(Te, { className: "p-0", children: e.role === "assistant" ? /* @__PURE__ */ s(ke, { className: "p-0 text-xs", children: e.content }) : /* @__PURE__ */ s("div", { className: "p-0 text-xs", children: e.userMessage || e.content }) }) }) }, e.id)
|
|
124
124
|
)
|
|
125
125
|
] }) }),
|
|
126
126
|
/* @__PURE__ */ g("div", { className: "border-gray-200 pb-2", children: [
|
|
127
|
-
/* @__PURE__ */ s(
|
|
127
|
+
/* @__PURE__ */ s(ge, { onRemove: () => G([]), isLoading: u }),
|
|
128
128
|
/* @__PURE__ */ s(P, { fallback: /* @__PURE__ */ s("div", { children: r("Loading...") }), children: /* @__PURE__ */ s(
|
|
129
129
|
Me,
|
|
130
130
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),L=require("lucide-react"),r=require("react"),ee=require("react-i18next"),g=require("./index-D-r_K4yA.cjs"),n=require("./selected-block-display-DSow6N4b.cjs"),O=require("./index-BYrRPW_c.cjs"),te=r.lazy(()=>Promise.resolve().then(()=>require("./ai-translation-prompt-BQPaekp3.cjs"))),se=r.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-BT5426AB.cjs"))),ne=({fetch:_,input:x,messages:w,setInput:b,isLoading:m,handleStop:F,setMessages:A,setIsLoading:v,selectedLang:j,currentBlock:z,fallbackLang:U,abortController:R,setAbortController:J,setCurrentBlock:M,selectedModel:K,onModelChange:V})=>{const{t:l}=ee.useTranslation(),{models:N}=O.useAIModels(),s=O.useAIConfig(),W=N.find(e=>e.id==="google/gemini-3-flash")||N[0],E=K||W.id,G=r.useRef(null),p=g.useSelectedBlock(),[,H]=g.useSelectedBlockIds(),B=g.useI18nBlocks(),Q=g.useStreamMultipleBlocksProps(),X=()=>{var e;(e=G.current)==null||e.scrollIntoView({behavior:"smooth"})};r.useEffect(()=>{X()},[w,m]);const I=async(e,f,Y)=>{var C,D;p&&M(p);const q=(e==null?void 0:e.toLowerCase())==="translate",P={id:Date.now().toString(),role:"user",content:n.getTranslationUserPrompt({fallbackLang:U,userInput:f||e,language:j,blocks:q?B():B(j)}),userMessage:f||e||l("Translate the content")},Z={id:(Date.now()+1).toString(),role:"assistant",content:"Thinking...",isReasoning:!0,isStreaming:!0};v(!0);const $=new AbortController;J($),A(c=>[...c,P,Z]),v(!0);const a=Y||E;(C=s.onAIEvent)==null||C.call(s,{type:"stream_start",model:a,timestamp:Date.now()});try{const c={messages:[P],initiator:q?"TRANSLATE_CONTENT":"UPDATE_CONTENT",model:a,context:s.context},i=await _({body:{action:"ASK_AI",data:c},streamResponse:!0});if(!i.ok)throw new Error(l("Failed to get AI response"));const d=(D=i.body)==null?void 0:D.getReader(),y=new TextDecoder;let o="";if(!d)throw new Error(l("Response body is not readable"));for(;;){const{done:h,value:T}=await d.read();if(h)break;const k=y.decode(T,{stream:!0});o+=k,A(u=>(u[u.length-1].content=o,[...u]))}const S=JSON.parse(o==null?void 0:o.replace("```json","").replace("```",""));Q(S),r.startTransition(()=>{var T,k,u;const h=Date.now();(T=s.onSuccess)==null||T.call(s,{content:o,model:a,timestamp:h}),(k=s.onComplete)==null||k.call(s,{success:!0,content:o,model:a,timestamp:h}),(u=s.onAIEvent)==null||u.call(s,{type:"completion",content:o,model:a,timestamp:h})})}catch(c){R==null||R.abort(),r.startTransition(()=>{var y,o,S;const i=c instanceof Error?c.message:String(c),d=Date.now();(y=s.onError)==null||y.call(s,{error:i,model:a,timestamp:d}),(o=s.onComplete)==null||o.call(s,{success:!1,error:i,model:a,timestamp:d}),(S=s.onAIEvent)==null||S.call(s,{type:"error",error:i,model:a,timestamp:d})})}finally{v(!1),b(""),M(null)}};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"py-2",children:t.jsx(r.Suspense,{fallback:t.jsx("div",{children:l("Loading...")}),children:t.jsx(te,{isLoading:m,selectedBlock:p,selectedLang:j,onClick:I})})}),t.jsx(n.Conversation,{children:t.jsxs(n.ConversationContent,{className:"gap-4 px-0",children:[w.length===0&&t.jsx(n.ConversationEmptyState,{icon:t.jsx(L.Bot,{size:48,className:"text-gray-300"}),title:l("Start a conversation with the AI assistant to translate/edit your content"),description:l("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")}),w.map(e=>e.role!=="system"&&t.jsx(r.Fragment,{children:e.isReasoning?t.jsxs(n.Reasoning,{isStreaming:e.isStreaming,defaultOpen:!0,children:[t.jsx(n.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),t.jsx(n.ReasoningContent,{className:"p-0 text-xs",children:e.content})]}):e.isTask?t.jsx(n.TaskMessage,{content:e.content,isLoading:e.isTaskLoading}):t.jsx(n.Message,{from:e.role,children:t.jsx(n.MessageContent,{className:"p-0",children:e.role==="assistant"?t.jsx(n.MessageResponse,{className:"p-0 text-xs",children:e.content}):t.jsx("div",{className:"p-0 text-xs",children:e.userMessage||e.content})})})},e.id))]})}),t.jsxs("div",{className:"border-gray-200 pb-2",children:[t.jsx(n.SelectedBlockDisplay,{onRemove:()=>H([]),isLoading:m}),t.jsx(r.Suspense,{fallback:t.jsx("div",{children:l("Loading...")}),children:t.jsx(se,{input:x,setInput:b,onSend:I,onStop:F,isLoading:m,selectedLang:j,currentBlock:p||z,disabled:(x==null?void 0:x.length)===0,selectedModel:E,onModelChange:V})})]})]})};exports.default=ne;
|