@chaibuilder/sdk 4.0.0-beta.46 → 4.0.0-beta.48
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/dist/{2SSKDMRQ-B6pWs8Zk.js → 2SSKDMRQ-CLLNh3td.js} +2 -2
- package/dist/{2SSKDMRQ-B7Va8HeK.cjs → 2SSKDMRQ-DqwAKdGS.cjs} +1 -1
- package/dist/{AP7HFJJL-Xv13XYXE.cjs → AP7HFJJL-BA2SSB20.cjs} +1 -1
- package/dist/{AP7HFJJL-CNIRZpP-.js → AP7HFJJL-wgsmCJDJ.js} +1 -1
- package/dist/{IconPicker-CeAu6O-X.cjs → IconPicker-BQy4V5jA.cjs} +1 -1
- package/dist/{IconPicker-CGtjTiWr.js → IconPicker-DsT0ONLh.js} +1 -1
- package/dist/{WDYDFRGG-zZ8jN8rF.cjs → WDYDFRGG-DyEYv-Y5.cjs} +1 -1
- package/dist/{WDYDFRGG-5Lwxhw_-.js → WDYDFRGG-EEb06kwn.js} +2 -2
- package/dist/{actions-registery-BQ31lpix.cjs → actions-registery-2natwC9b.cjs} +1 -1
- package/dist/{actions-registery-B1VeX52Y.js → actions-registery-wRY05tEE.js} +1 -1
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-HtM97aRN.js → active-in-another-tab-DE2fn30l.js} +2 -2
- package/dist/{active-in-another-tab-C8FXtXk5.cjs → active-in-another-tab-p0hkvIFc.cjs} +1 -1
- package/dist/{add-new-language-page-x88_n8EW.js → add-new-language-page-CH7GtcqC.js} +3 -3
- package/dist/{add-new-language-page-gbvPI58M.cjs → add-new-language-page-f2wam593.cjs} +1 -1
- package/dist/{add-new-page-BMSePgKl.js → add-new-page-8d0Nn-zI.js} +2 -2
- package/dist/{add-new-page-CPB4yhqv.cjs → add-new-page-CV7A1XJQ.cjs} +1 -1
- package/dist/ai-panel-default-lang-BJLeTdw3.cjs +3 -0
- package/dist/ai-panel-default-lang-Dcm4e1o8.js +332 -0
- package/dist/ai-panel-other-lang-B48Y5C8z.js +147 -0
- package/dist/ai-panel-other-lang-Ch0RHXqZ.cjs +1 -0
- package/dist/ai-prompt-input-C1yoNntS.cjs +1 -0
- package/dist/{ai-prompt-input-bleYNRnH.js → ai-prompt-input-DhVfzVhy.js} +253 -258
- package/dist/{ai-translation-prompt-DvHdOZ6t.js → ai-translation-prompt-CUYVv2jG.js} +1 -1
- package/dist/{ai-translation-prompt-DGrNA2Od.cjs → ai-translation-prompt-mj26BpgQ.cjs} +1 -1
- package/dist/{change-password-modal-bce5bF3K.cjs → change-password-modal-DFupkIGx.cjs} +1 -1
- package/dist/{change-password-modal-C9afEHLW.js → change-password-modal-DiEQWZez.js} +10 -10
- package/dist/{code-editor-BVmpIZOt.cjs → code-editor-BiLiryYr.cjs} +1 -1
- package/dist/{code-editor-BfGHceIq.js → code-editor-CazbxsDv.js} +1 -1
- package/dist/{continue-editing-in-this-client-4bvChAL-.cjs → continue-editing-in-this-client-C3NoncEN.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-BFptv8tA.js → continue-editing-in-this-client-CpKDDW6u.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{css-import-modal-CEQccCmc.js → css-import-modal-BOQr_e6S.js} +1 -1
- package/dist/{css-import-modal-C9G5pbFd.cjs → css-import-modal-DFdZ471B.cjs} +1 -1
- package/dist/{delete-page-BOxoMgyl.cjs → delete-page-D8Vr-1aC.cjs} +1 -1
- package/dist/{delete-page-8h4dNP7d.js → delete-page-DIZhbU2t.js} +15 -15
- package/dist/{design-token-usage-CVPBTF21.js → design-token-usage-Co5Lj1HN.js} +1 -1
- package/dist/{design-token-usage-C5WfKLj-.cjs → design-token-usage-N5DLBdWf.cjs} +1 -1
- package/dist/{digital-asset-manager-83B0Y6L-.js → digital-asset-manager-CObQa_0R.js} +3 -3
- package/dist/{digital-asset-manager-JtBK07Ob.cjs → digital-asset-manager-uXP27Dou.cjs} +1 -1
- package/dist/{duplicate-page-DVqC24Rd.cjs → duplicate-page-DomSAvnp.cjs} +1 -1
- package/dist/{duplicate-page-DIa59iDe.js → duplicate-page-xpV-pRVU.js} +12 -12
- package/dist/{dynamic-page-selector-C9vYslOg.js → dynamic-page-selector-Bl5kYPWG.js} +2 -2
- package/dist/{dynamic-page-selector-YRCRqWlz.cjs → dynamic-page-selector-CYZv-SlK.cjs} +1 -1
- package/dist/{image-editor-CzxSXo-u.js → image-editor-CDFnNWAz.js} +1 -1
- package/dist/{image-editor-DQ8mQonU.cjs → image-editor-pOsT95KQ.cjs} +1 -1
- package/dist/{index-RwAuF_BE.js → index-BbkBlCE2.js} +297 -297
- package/dist/{index-DlTEPwjW.js → index-Cyz_Iww4.js} +828 -805
- package/dist/{index-DrzR7vXl.cjs → index-DonDtb8f.cjs} +8 -8
- package/dist/index-j-XsKW-V.cjs +5 -0
- package/dist/{json-diff-viewer-Bpsk0toO.cjs → json-diff-viewer-CoEViavL.cjs} +1 -1
- package/dist/{json-diff-viewer-is2P3TOV.js → json-diff-viewer-amjoEZ5K.js} +6 -6
- package/dist/{lang-panel-BI5OFsBY.cjs → lang-panel-BzWstLZ-.cjs} +1 -1
- package/dist/{lang-panel-DwiCJRs9.js → lang-panel-DPpIXFl4.js} +9 -9
- package/dist/{manage-design-tokens-D2Oz-jVp.js → manage-design-tokens-BVfEFOrN.js} +2 -2
- package/dist/{manage-design-tokens-sDi2Pdec.cjs → manage-design-tokens-CIiwBv2v.cjs} +1 -1
- package/dist/{manage-design-tokens-modal-ZR8PuhWC.js → manage-design-tokens-modal-CBOw_Dg6.js} +2 -2
- package/dist/{manage-design-tokens-modal-Gufu9nHL.cjs → manage-design-tokens-modal-m3D2luIa.cjs} +1 -1
- package/dist/{mark-as-template-muKJE1gk.cjs → mark-as-template-C2-S_aA2.cjs} +1 -1
- package/dist/{mark-as-template-C0Z2P_UF.js → mark-as-template-CQjchLk7.js} +2 -2
- package/dist/{models-D0RH2u4C.cjs → models-CQaC3EBW.cjs} +1 -1
- package/dist/{models-BCu-p_QK.js → models-DZ9C6CvE.js} +4 -5
- package/dist/{nested-path-selector-content-Ct80kFX-.js → nested-path-selector-content-BtsI3H0i.js} +1 -1
- package/dist/{nested-path-selector-content-DhNCvKp3.cjs → nested-path-selector-content-Dd3NzUE0.cjs} +1 -1
- package/dist/{no-language-page-content-BekrmPc5.js → no-language-page-content-BrDAjkdi.js} +2 -2
- package/dist/{no-language-page-content-zn3891M8.cjs → no-language-page-content-CggJC14_.cjs} +1 -1
- package/dist/{no-language-page-dialog-dHlAqLlU.js → no-language-page-dialog-DSbcLM8f.js} +2 -2
- package/dist/{no-language-page-dialog-wEXIlBuQ.cjs → no-language-page-dialog-Dkxdu99i.cjs} +1 -1
- package/dist/{page-creator-6L7ehzhL.js → page-creator-CR-FbJ7C.js} +33 -33
- package/dist/{page-creator-CN2phGn5.cjs → page-creator-DqKFL1sB.cjs} +1 -1
- package/dist/{page-lock-C--D8qD7.js → page-lock-CwzMBdD-.js} +2 -2
- package/dist/{page-lock-DllloCJE.cjs → page-lock-D4Anxwpy.cjs} +1 -1
- package/dist/{page-locked-dialog-BD8LHbdC.js → page-locked-dialog-Dv_unUwx.js} +11 -11
- package/dist/{page-locked-dialog-DzB8p0wl.cjs → page-locked-dialog-UrTgnXd6.cjs} +1 -1
- package/dist/{page-manager-new-uFcGaZZY.js → page-manager-new-DpCTazS0.js} +42 -42
- package/dist/{page-manager-new-DyjhsvPx.cjs → page-manager-new-DuqhyqMY.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-DK883UmG.js → page-manager-search-and-filter-B6F-ZvdQ.js} +87 -80
- package/dist/page-manager-search-and-filter-Yt0pjK_r.cjs +1 -0
- package/dist/{page-revisions-content-Bi2ehMnj.cjs → page-revisions-content-C2VMkAt4.cjs} +1 -1
- package/dist/{page-revisions-content-D3rIJj9X.js → page-revisions-content-CUPsMEVU.js} +16 -16
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +60 -1
- package/dist/pages.js +19 -19
- package/dist/{publish-pages-content-BQUHNRCX.cjs → publish-pages-content-BrjDksNY.cjs} +1 -1
- package/dist/{publish-pages-content-ByPf4lvE.js → publish-pages-content-CK0ahL2t.js} +32 -32
- package/dist/{rte-widget-modal-Tj_pS3ql.js → rte-widget-modal-DgEF73WC.js} +1 -1
- package/dist/{rte-widget-modal-BwE5wIZa.cjs → rte-widget-modal-Dktetdg4.cjs} +1 -1
- package/dist/{save-to-lib-CcUqS0s1.js → save-to-lib-Bs6-wr2u.js} +50 -50
- package/dist/{save-to-lib-Cyeqcelv.cjs → save-to-lib-CuVYPtm-.cjs} +1 -1
- package/dist/{selected-block-display-Benbb_OW.cjs → selected-block-display-BCcwnFzJ.cjs} +1 -1
- package/dist/{selected-block-display-C6LxDm0H.js → selected-block-display-D-lzXUfE.js} +2 -2
- package/dist/{seo-panel-1U9Q0Ato.js → seo-panel-By-TlhHK.js} +25 -25
- package/dist/{seo-panel-CCuvQpwV.cjs → seo-panel-DTqsu3I0.cjs} +1 -1
- package/dist/{shared-json-ld-DbzUITto.js → shared-json-ld-CMCwFEI0.js} +26 -26
- package/dist/{shared-json-ld-bj77fq_b.cjs → shared-json-ld-C_vaAxgT.cjs} +1 -1
- package/dist/{slug-input-BvIplRdd.cjs → slug-input-DCmvuN69.cjs} +1 -1
- package/dist/{slug-input-P-CLfUrw.js → slug-input-bhZSv9VS.js} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-R3HRgShm.cjs → take-over-request-BGvKpN5m.cjs} +1 -1
- package/dist/{take-over-request-Bwj_2nPR.js → take-over-request-f0dbfkLe.js} +5 -5
- package/dist/{translation-warning-modal-BdkToZwn.js → translation-warning-modal-D0-WNJnG.js} +1 -1
- package/dist/{translation-warning-modal-Bc2i-0YG.cjs → translation-warning-modal-_0YmCcU8.cjs} +1 -1
- package/dist/{unmark-as-template-BG882c_S.cjs → unmark-as-template-BE1BO8Z0.cjs} +1 -1
- package/dist/{unmark-as-template-DHDMooLZ.js → unmark-as-template-WE3WJ-RJ.js} +2 -2
- package/dist/{unpublish-page-C4e_gIX8.js → unpublish-page-B4A-GQEz.js} +8 -8
- package/dist/{unpublish-page-DudJ1znF.cjs → unpublish-page-DrZnWLVM.cjs} +1 -1
- package/dist/{unpublished-partials-modal-p_0N6V23.js → unpublished-partials-modal-CGK-4WJ3.js} +1 -1
- package/dist/{unpublished-partials-modal-i1oOnrgA.cjs → unpublished-partials-modal-KFXm1fG4.cjs} +1 -1
- package/dist/{web-preview-BA08d7DN.js → web-preview-BSmef-RL.js} +1 -1
- package/dist/{web-preview-MG0HZxgA.cjs → web-preview-ClV1a6hl.cjs} +1 -1
- package/package.json +1 -1
- package/dist/ai-panel-default-lang-DKGh1pbz.cjs +0 -3
- package/dist/ai-panel-default-lang-Dav6FRUY.js +0 -317
- package/dist/ai-panel-other-lang-CdFx2x23.js +0 -132
- package/dist/ai-panel-other-lang-DdDn2I8h.cjs +0 -1
- package/dist/ai-prompt-input-B8SFfk6N.cjs +0 -1
- package/dist/index-DXBHjFwY.cjs +0 -5
- package/dist/page-manager-search-and-filter-zfR5i_GU.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { B as M, z as f } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { X as b, Y as C, P as j } from "./index-
|
|
3
|
+
import { X as b, Y as C, P as j } from "./index-BbkBlCE2.js";
|
|
4
4
|
import { MagnifyingGlassIcon as x } from "@radix-ui/react-icons";
|
|
5
5
|
import H from "fuse.js";
|
|
6
6
|
import { useState as g, useMemo as d } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AP7HFJJL-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AP7HFJJL-BA2SSB20.cjs"),t=require("./index-j-XsKW-V.cjs");var s=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),a=t.getPreferredColorScheme(),l=t.createMemo(()=>{const c=o.theme||r.theme_preference||e.THEME_PREFERENCE;return c!=="system"?c:a()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:l,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:n})}})}})}})},u=s;exports.default=u;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as v, D as u, Q as i } from "./AP7HFJJL-
|
|
2
|
-
import {
|
|
1
|
+
import { c, T as l, P as m, a as v, D as u, Q as i } from "./AP7HFJJL-wgsmCJDJ.js";
|
|
2
|
+
import { v as d, w as f, x as e } from "./index-Cyz_Iww4.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var hu=Object.defineProperty;var mu=(e,t,r)=>t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ie=(e,t,r)=>mu(e,typeof t!="symbol"?t+"":t,r);const ut=require("./register-partial-type-ig9fUWIJ.cjs"),j=require("lodash-es"),yu=require("./_commonjsHelpers-DwGv2jUC.cjs"),vu=require("fs"),wu=require("path"),_u=require("os"),is=require("crypto"),Tu=require("drizzle-orm/postgres-js"),Eu=require("postgres"),g=require("drizzle-orm/pg-core"),h=require("drizzle-orm"),bu=require("./models-
|
|
1
|
+
"use strict";var hu=Object.defineProperty;var mu=(e,t,r)=>t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ie=(e,t,r)=>mu(e,typeof t!="symbol"?t+"":t,r);const ut=require("./register-partial-type-ig9fUWIJ.cjs"),j=require("lodash-es"),yu=require("./_commonjsHelpers-DwGv2jUC.cjs"),vu=require("fs"),wu=require("path"),_u=require("os"),is=require("crypto"),Tu=require("drizzle-orm/postgres-js"),Eu=require("postgres"),g=require("drizzle-orm/pg-core"),h=require("drizzle-orm"),bu=require("./models-CQaC3EBW.cjs"),v=require("zod"),Iu=require("./core-czmLeR0h.cjs"),Su=require("node:crypto");var ls="vercel.ai.error",Au=Symbol.for(ls),Ea,ba,H=class us extends(ba=Error,Ea=Au,ba){constructor({name:t,message:r,cause:n}){super(r),this[Ea]=!0,this.name=t,this.cause=n}static isInstance(t){return us.hasMarker(t,ls)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}},cs="AI_APICallError",ds=`vercel.ai.error.${cs}`,Nu=Symbol.for(ds),Ia,Sa,$e=class extends(Sa=H,Ia=Nu,Sa){constructor({message:e,url:t,requestBodyValues:r,statusCode:n,responseHeaders:a,responseBody:o,cause:s,isRetryable:i=n!=null&&(n===408||n===409||n===429||n>=500),data:l}){super({name:cs,message:e,cause:s}),this[Ia]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=n,this.responseHeaders=a,this.responseBody=o,this.isRetryable=i,this.data=l}static isInstance(e){return H.hasMarker(e,ds)}},ps="AI_EmptyResponseBodyError",fs=`vercel.ai.error.${ps}`,xu=Symbol.for(fs),Aa,Na,Ou=class extends(Na=H,Aa=xu,Na){constructor({message:e="Empty response body"}={}){super({name:ps,message:e}),this[Aa]=!0}static isInstance(e){return H.hasMarker(e,fs)}};function Wt(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var gs="AI_InvalidArgumentError",hs=`vercel.ai.error.${gs}`,Ru=Symbol.for(hs),xa,Oa,Cu=class extends(Oa=H,xa=Ru,Oa){constructor({message:t,cause:r,argument:n}){super({name:gs,message:t,cause:r}),this[xa]=!0,this.argument=n}static isInstance(t){return H.hasMarker(t,hs)}},ms="AI_InvalidPromptError",ys=`vercel.ai.error.${ms}`,ku=Symbol.for(ys),Ra,Ca,Zt=class extends(Ca=H,Ra=ku,Ca){constructor({prompt:e,message:t,cause:r}){super({name:ms,message:`Invalid prompt: ${t}`,cause:r}),this[Ra]=!0,this.prompt=e}static isInstance(e){return H.hasMarker(e,ys)}},vs="AI_JSONParseError",ws=`vercel.ai.error.${vs}`,Pu=Symbol.for(ws),ka,Pa,Gr=class extends(Pa=H,ka=Pu,Pa){constructor({text:e,cause:t}){super({name:vs,message:`JSON parsing failed: Text: ${e}.
|
|
2
2
|
Error message: ${Wt(t)}`,cause:t}),this[ka]=!0,this.text=e}static isInstance(e){return H.hasMarker(e,ws)}},_s="AI_TypeValidationError",Ts=`vercel.ai.error.${_s}`,Du=Symbol.for(Ts),Da,za,Rt=class Fn extends(za=H,Da=Du,za){constructor({value:t,cause:r}){super({name:_s,message:`Type validation failed: Value: ${JSON.stringify(t)}.
|
|
3
3
|
Error message: ${Wt(r)}`,cause:r}),this[Da]=!0,this.value=t}static isInstance(t){return H.hasMarker(t,Ts)}static wrap({value:t,cause:r}){return Fn.isInstance(r)&&r.value===t?r:new Fn({value:t,cause:r})}};function E(e,t,r){function n(i,l){if(i._zod||Object.defineProperty(i,"_zod",{value:{def:l,constr:s,traits:new Set},enumerable:!1}),i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,l);const u=s.prototype,c=Object.keys(u);for(let d=0;d<c.length;d++){const p=c[d];p in i||(i[p]=u[p].bind(i))}}const a=(r==null?void 0:r.Parent)??Object;class o extends a{}Object.defineProperty(o,"name",{value:e});function s(i){var l;const u=r!=null&&r.Parent?new o:this;n(u,i),(l=u._zod).deferred??(l.deferred=[]);for(const c of u._zod.deferred)c();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:i=>{var l,u;return r!=null&&r.Parent&&i instanceof r.Parent?!0:(u=(l=i==null?void 0:i._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Vt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Es extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const bs={};function wt(e){return bs}function Is(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,a])=>t.indexOf(+n)===-1).map(([n,a])=>a)}function Ln(e,t){return typeof t=="bigint"?t.toString():t}function un(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wn(e){return e==null}function Xn(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function zu(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let a=(n.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(n)){const l=n.match(/\d?e-(\d?)/);l!=null&&l[1]&&(a=Number.parseInt(l[1]))}const o=r>a?r:a,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}const $a=Symbol("evaluating");function Y(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==$a)return n===void 0&&(n=$a,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function Pt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function bt(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ma(e){return JSON.stringify(e)}function $u(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ss="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Mu=un(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Ht(e){if(gr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(gr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function As(e){return Ht(e)?{...e}:Array.isArray(e)?[...e]:e}const Fu=new Set(["string","number","symbol"]);function Jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function It(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(n._zod.parent=e),n}function C(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Lu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Uu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ju(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=bt(e._zod.def,{get shape(){const s={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(s[i]=r.shape[i])}return Pt(this,"shape",s),s},checks:[]});return It(e,o)}function qu(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=bt(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete s[i]}return Pt(this,"shape",s),s},checks:[]});return It(e,o)}function Zu(e,t){if(!Ht(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const o=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const a=bt(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Pt(this,"shape",o),o}});return It(e,a)}function Gu(e,t){if(!Ht(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=bt(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Pt(this,"shape",n),n}});return It(e,r)}function Bu(e,t){const r=bt(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Pt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return It(e,r)}function Vu(e,t,r){const a=t._zod.def.checks;if(a&&a.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=bt(t._zod.def,{get shape(){const i=t._zod.def.shape,l={...i};if(r)for(const u in r){if(!(u in i))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=e?new e({type:"optional",innerType:i[u]}):i[u])}else for(const u in i)l[u]=e?new e({type:"optional",innerType:i[u]}):i[u];return Pt(this,"shape",l),l},checks:[]});return It(t,s)}function Hu(e,t,r){const n=bt(t._zod.def,{get shape(){const a=t._zod.def.shape,o={...a};if(r)for(const s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new e({type:"nonoptional",innerType:a[s]}))}else for(const s in a)o[s]=new e({type:"nonoptional",innerType:a[s]});return Pt(this,"shape",o),o}});return It(t,n)}function Gt(e,t=0){var r;if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(((r=e.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Bt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Fr(e){return typeof e=="string"?e:e==null?void 0:e.message}function _t(e,t,r){var a,o,s,i,l,u;const n={...e,path:e.path??[]};if(!e.message){const c=Fr((s=(o=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:o.error)==null?void 0:s.call(o,e))??Fr((i=t==null?void 0:t.error)==null?void 0:i.call(t,e))??Fr((l=r.customError)==null?void 0:l.call(r,e))??Fr((u=r.localeError)==null?void 0:u.call(r,e))??"Invalid input";n.message=c}return delete n.inst,delete n.continue,t!=null&&t.reportInput||delete n.input,n}function Qn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hr(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Ns=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ln,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xs=E("$ZodError",Ns),Os=E("$ZodError",Ns,{Parent:Error});function Ju(e,t=r=>r.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}function Yu(e,t=r=>r.message){const r={_errors:[]},n=a=>{for(const o of a.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>n({issues:s}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let s=r,i=0;for(;i<o.path.length;){const l=o.path[i];i===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(o))):s[l]=s[l]||{_errors:[]},s=s[l],i++}}};return n(e),r}const ea=e=>(t,r,n,a)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Vt;if(s.issues.length){const i=new((a==null?void 0:a.Err)??e)(s.issues.map(l=>_t(l,o,wt())));throw Ss(i,a==null?void 0:a.callee),i}return s.value},ta=e=>async(t,r,n,a)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const i=new((a==null?void 0:a.Err)??e)(s.issues.map(l=>_t(l,o,wt())));throw Ss(i,a==null?void 0:a.callee),i}return s.value},cn=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},a);if(o instanceof Promise)throw new Vt;return o.issues.length?{success:!1,error:new(e??xs)(o.issues.map(s=>_t(s,a,wt())))}:{success:!0,data:o.value}},Ku=cn(Os),dn=e=>async(t,r,n)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},a);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>_t(s,a,wt())))}:{success:!0,data:o.value}},Wu=dn(Os),Xu=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ea(e)(t,r,a)},Qu=e=>(t,r,n)=>ea(e)(t,r,n),ec=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ta(e)(t,r,a)},tc=e=>async(t,r,n)=>ta(e)(t,r,n),rc=e=>(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return cn(e)(t,r,a)},nc=e=>(t,r,n)=>cn(e)(t,r,n),ac=e=>async(t,r,n)=>{const a=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return dn(e)(t,r,a)},oc=e=>async(t,r,n)=>dn(e)(t,r,n),sc=/^[cC][^\s-]{8,}$/,ic=/^[0-9a-z]+$/,lc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uc=/^[0-9a-vA-V]{20}$/,cc=/^[A-Za-z0-9]{27}$/,dc=/^[a-zA-Z0-9_-]{21}$/,pc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fa=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function mc(){return new RegExp(hc,"u")}const yc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,wc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_c=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rs=/^[A-Za-z0-9_-]*$/,Ec=/^\+[1-9]\d{6,14}$/,Cs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",bc=new RegExp(`^${Cs}$`);function ks(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ic(e){return new RegExp(`^${ks(e)}$`)}function Sc(e){const t=ks({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Cs}T(?:${n})$`)}const Ac=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Nc=/^-?\d+$/,Ps=/^-?\d+(?:\.\d+)?$/,xc=/^(?:true|false)$/i,Oc=/^null$/i,Rc=/^[^A-Z]*$/,Cc=/^[^a-z]*$/,Me=E("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ds={number:"number",bigint:"bigint",object:"date"},zs=E("$ZodCheckLessThan",(e,t)=>{Me.init(e,t);const r=Ds[typeof t.value];e._zod.onattach.push(n=>{const a=n._zod.bag,o=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$s=E("$ZodCheckGreaterThan",(e,t)=>{Me.init(e,t);const r=Ds[typeof t.value];e._zod.onattach.push(n=>{const a=n._zod.bag,o=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kc=E("$ZodCheckMultipleOf",(e,t)=>{Me.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):zu(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Pc=E("$ZodCheckNumberFormat",(e,t)=>{var s;Me.init(e,t),t.format=t.format||"float64";const r=(s=t.format)==null?void 0:s.includes("int"),n=r?"int":"number",[a,o]=Uu[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=a,l.maximum=o,r&&(l.pattern=Nc)}),e._zod.check=i=>{const l=i.value;if(r){if(!Number.isInteger(l)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<a&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),l>o&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Dc=E("$ZodCheckMaxLength",(e,t)=>{var r;Me.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!Wn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const a=n.value;if(a.length<=t.maximum)return;const s=Qn(a);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),zc=E("$ZodCheckMinLength",(e,t)=>{var r;Me.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!Wn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const a=n.value;if(a.length>=t.minimum)return;const s=Qn(a);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),$c=E("$ZodCheckLengthEquals",(e,t)=>{var r;Me.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!Wn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=n=>{const a=n.value,o=a.length;if(o===t.length)return;const s=Qn(a),i=o>t.length;n.issues.push({origin:s,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=E("$ZodCheckStringFormat",(e,t)=>{var r,n;Me.init(e,t),e._zod.onattach.push(a=>{const o=a._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Mc=E("$ZodCheckRegex",(e,t)=>{pn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fc=E("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Rc),pn.init(e,t)}),Lc=E("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cc),pn.init(e,t)}),Uc=E("$ZodCheckIncludes",(e,t)=>{Me.init(e,t);const r=Jt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),jc=E("$ZodCheckStartsWith",(e,t)=>{Me.init(e,t);const r=new RegExp(`^${Jt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),qc=E("$ZodCheckEndsWith",(e,t)=>{Me.init(e,t);const r=new RegExp(`.*${Jt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Zc=E("$ZodCheckOverwrite",(e,t)=>{Me.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Gc{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
4
4
|
`).filter(s=>s),a=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(a)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const t=Function,r=this==null?void 0:this.args,a=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...r,a.join(`
|
|
@@ -12,7 +12,7 @@ import { drizzle as ec } from "drizzle-orm/postgres-js";
|
|
|
12
12
|
import tc from "postgres";
|
|
13
13
|
import { pgSequence as Cs, pgTable as Je, timestamp as xe, text as O, numeric as _r, uuid as J, foreignKey as et, jsonb as K, boolean as er, json as Ga, doublePrecision as rc, bigint as nc } from "drizzle-orm/pg-core";
|
|
14
14
|
import { sql as pa, and as Z, eq as T, inArray as Tt, isNotNull as Ba, isNull as ac, or as ks, like as oc, ilike as Va } from "drizzle-orm";
|
|
15
|
-
import { A as sc } from "./models-
|
|
15
|
+
import { A as sc } from "./models-DZ9C6CvE.js";
|
|
16
16
|
import { z as m } from "zod";
|
|
17
17
|
import { f as ic } from "./core-nSRy3D7z.js";
|
|
18
18
|
import { randomUUID as lc } from "node:crypto";
|
package/dist/actions.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./actions-registery-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./actions-registery-2natwC9b.cjs"),h=s=>async o=>{const{apiKey:t,userId:u}=s;try{const i=o,{action:r,data:e}=i,n=a.getChaiAction(r);return n?n.validate(e)?(n.setContext({appId:t,userId:u}),await n.execute(e)):{error:`Validation failed: ${n.getValidationErrors(e)}`,code:"INVALID_REQUEST_DATA",status:400}:{error:`Action ${r} not found`,code:"ACTION_NOT_FOUND",status:404}}catch(i){return console.log("Error in builderApiHandler:",i),i instanceof a.ActionError?{error:i.message,code:i.code,status:i.status||400}:{error:"Something went wrong.",status:500}}},l={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"};exports.ChaiActionsRegistry=a.actionsRegistery;exports.PublishChangesAction=a.PublishChangesAction;exports.db=a.db;exports.getAskAiSystemPrompt=a.getAskAiSystemPrompt;exports.safeQuery=a.safeQuery;exports.schema=a.schema;exports.LANGUAGES=l;exports.initChaiBuilderActionHandler=h;
|
package/dist/actions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as u, A as h } from "./actions-registery-
|
|
2
|
-
import { a as b, P as y, d as A, b as S, s as v, c as w } from "./actions-registery-
|
|
1
|
+
import { g as u, A as h } from "./actions-registery-wRY05tEE.js";
|
|
2
|
+
import { a as b, P as y, d as A, b as S, s as v, c as w } from "./actions-registery-wRY05tEE.js";
|
|
3
3
|
const c = (r) => async (s) => {
|
|
4
4
|
const { apiKey: o, userId: t } = r;
|
|
5
5
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { B as r } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { J as i, K as o, M as l, O as c, Q as d } from "./index-
|
|
4
|
-
import {
|
|
3
|
+
import { J as i, K as o, M as l, O as c, Q as d } from "./index-BbkBlCE2.js";
|
|
4
|
+
import { an as m, a as h, B as u, E as p, P as N } from "./index-Cyz_Iww4.js";
|
|
5
5
|
import { TableIcon as f, Edit as T } from "lucide-react";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
7
|
const b = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-DonDtb8f.cjs"),s=require("./index-j-XsKW-V.cjs"),n=require("lucide-react"),l=require("react-i18next"),o=()=>{const r=s.useSendRealtimeEvent(),{setPageStatus:i}=s.usePageLockStatus(),{t:a}=l.useTranslation();return e.jsx(s.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[e.jsx(n.TableIcon,{className:"h-6 w-6 text-green-500"}),e.jsx("span",{children:a("Active in Another Tab")})]})}),e.jsx(t.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:a("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e.jsx(t.CardFooter,{className:"flex justify-end gap-2",children:e.jsxs(c.Button,{variant:"default",onClick:()=>{r(s.EVENT.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),i(s.PAGE_STATUS.CHECKING)},className:"gap-2",children:[e.jsx(n.Edit,{className:"h-4 w-4"}),a("Continue Editing Here")]})})]})})};exports.default=o;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t, jsxs as g, Fragment as hn } from "react/jsx-runtime";
|
|
2
2
|
import { z as fn, D as H, B as gn } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as mn, n as xn, D as vn, e as pn, f as Sn, g as Nn, o as Fn, p as I, q as wn } from "./index-
|
|
4
|
-
import { p as An, r as Cn, S as Dn } from "./slug-input-
|
|
5
|
-
import { e as En, f as $n, g as Ln, h as kn, i as Tn, j as Z, k as Un, c as Bn, L as A } from "./index-
|
|
3
|
+
import { d as mn, n as xn, D as vn, e as pn, f as Sn, g as Nn, o as Fn, p as I, q as wn } from "./index-BbkBlCE2.js";
|
|
4
|
+
import { p as An, r as Cn, S as Dn } from "./slug-input-bhZSv9VS.js";
|
|
5
|
+
import { e as En, f as $n, g as Ln, h as kn, i as Tn, j as Z, k as Un, c as Bn, L as A } from "./index-Cyz_Iww4.js";
|
|
6
6
|
import { filter as Rn, find as Wn, startsWith as In } from "lodash-es";
|
|
7
7
|
import { Loader as qn } from "lucide-react";
|
|
8
8
|
import { useMemo as $, useState as L, useEffect as _ } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-DonDtb8f.cjs"),Y=require("./slug-input-DCmvuN69.cjs"),g=require("./index-j-XsKW-V.cjs"),j=require("lodash-es"),ds=require("lucide-react"),v=require("react"),U=require("react-i18next"),Z=({edit:c,lang:h,languages:a,name:u,setLang:t,setName:i,primaryPageObject:o})=>{const{t:s}=U.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N.Label,{htmlFor:"lang",children:s("Language")}),e.jsxs("select",{value:c?"":h,disabled:c||!a.length,onChange:l=>{const x=l.target.value;t(x),!c&&(j.startsWith(u,o==null?void 0:o.name)||u.length===0)&&i(`${o==null?void 0:o.name} - ${g.LANGUAGES[x]}`)},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",children:[e.jsx("option",{value:"",disabled:!0,children:c?g.LANGUAGES[h]||h:a.length?s("Choose language"):s("All available language page is created.")}),a.map(l=>e.jsx("option",{value:l,children:g.LANGUAGES[l]||l},l))]})]})},_=({lang:c,name:h,setName:a,parentHasSelectedLanguagePage:u})=>{const{t}=U.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N.Label,{htmlFor:"name",children:t("Page Name")}),e.jsx(k.Input,{id:"name",value:c?h:"",onChange:i=>a(i.target.value),required:!0,placeholder:t(c?"Enter page name":"Choose language to add slug"),disabled:!u||!c})]})},cs=({dynamic:c,isNonSlugPageType:h,isRootPage:a,lang:u,useLanguagePrefix:t,setUseLanguagePrefix:i,isHomePage:o,parentSlug:s,parentHasSelectedLanguagePage:l,slug:x,setSlug:d,setIsSlugValid:S,getSlug:f})=>{const{t:r}=U.useTranslation();return h?null:e.jsxs("div",{className:"space-y-1",children:[a&&u&&e.jsxs("div",{className:"flex items-center space-x-2 pb-1",children:[e.jsx("input",{type:"checkbox",id:"useLanguagePrefix",checked:t,onChange:A=>i(A.target.checked),className:"rounded border-gray-300"}),e.jsxs(N.Label,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",e.jsxs("span",{className:"font-mono text-gray-900",children:["/",u]}),") as slug prefix"]})]}),e.jsx(N.Label,{htmlFor:"slug",children:r("Slug")}),c?e.jsx(k.Alert,{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")}):e.jsx(Y.SlugInput,{disabled:!u||!l,value:x,onChange:d,placeholder:r(u?o&&t?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:s,onValidationChange:S,fullSlug:f()})]})},H=({parentHasSelectedLanguagePage:c,name:h,lang:a,slug:u,edit:t,id:i,primaryPageObject:o,pages:s,isNonSlugPageType:l,isHomePage:x,useLanguagePrefix:d,isSlugValid:S,isPending:f})=>{const{t:r}=U.useTranslation(),A=f||!h||!a||s.some(m=>(t?m.id!==i:!0)&&m.parent===(o==null?void 0:o.id)&&m.lang===a)||!l&&!(x&&d)&&(!S||!u);return e.jsx(N.DialogFooter,{children:c?e.jsxs(e.Fragment,{children:[e.jsx(k.Button,{type:"submit",disabled:A&&!o.dynamic,children:f?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"loader mr-2"}),r(t?"Updating...":"Adding...")]}):r(t?"Update":"Add new language page")}),s.some(m=>(t?m.id!==i:!0)&&m.parent===(o==null?void 0:o.id)&&m.lang===a)&&e.jsx("p",{className:"mt-2 text-xs text-red-500",children:r("A page for this language already exists.")})]}):a&&e.jsx(k.Alert,{variant:"destructive",children:e.jsxs("p",{className:"mx-auto w-5/6 text-center",children:[r("You need to create the")," ",e.jsx("span",{className:"font-medium",children:g.LANGUAGES[a]})," ",r("page in the parent to add here.")]})})})},rs=({onSubmit:c,edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s,parentHasSelectedLanguagePage:l,id:x,pages:d,isNonSlugPageType:S,isHomePage:f,useLanguagePrefix:r,slug:A,isSlugValid:m,isPending:p})=>e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(Z,{edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s}),e.jsx(_,{lang:a,name:t,setName:o,parentHasSelectedLanguagePage:l})]}),e.jsx(H,{parentHasSelectedLanguagePage:l,name:t,lang:a,slug:A,edit:h,id:x,primaryPageObject:s,pages:d,isNonSlugPageType:S,isHomePage:f,useLanguagePrefix:r,isSlugValid:m,isPending:p})]}),hs=({loading:c,onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,isNonSlugPageType:d,isRootPage:S,useLanguagePrefix:f,setUseLanguagePrefix:r,isHomePage:A,parentSlug:m,slug:p,setSlug:C,isSlugValid:T,setIsSlugValid:I,getSlug:M,isPending:$,id:q,pages:L})=>c?e.jsx("div",{className:"flex h-80 items-center justify-center",children:e.jsx(ds.Loader,{className:"animate-spin"})}):d?e.jsx(rs,{onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,id:q,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:f,slug:p,isSlugValid:T,isPending:$}):e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(Z,{edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l}),e.jsx(_,{lang:u,name:i,setName:s,parentHasSelectedLanguagePage:x}),e.jsx(cs,{dynamic:l==null?void 0:l.dynamic,isNonSlugPageType:d,isRootPage:S,lang:u,useLanguagePrefix:f,setUseLanguagePrefix:r,isHomePage:A,parentSlug:m,parentHasSelectedLanguagePage:x,slug:p,setSlug:C,isSlugValid:T,setIsSlugValid:I,getSlug:M})]}),e.jsx(H,{parentHasSelectedLanguagePage:x,name:i,lang:u,slug:p,edit:a,id:q,primaryPageObject:l,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:f,isSlugValid:T,isPending:$})]}),xs=({id:c,isOpen:h,onClose:a,primaryPage:u,edit:t=!1,preselectedLang:i})=>{const{data:o=[]}=g.useWebsitePrimaryPages(),s=v.useMemo(()=>o.find(n=>n.id===u),[o,u]),[l,x]=v.useState(""),[d,S]=v.useState(""),[f,r]=v.useState(""),[A,m]=v.useState(!0),[p,C]=v.useState(!0),{mutate:T,isPending:I}=g.useCreatePage(),{mutate:M,isPending:$}=g.useUpdatePage(),q=I||$,{data:L,isFetching:b}=g.useWebsiteSetting(),z=g.useFallbackLang(),{data:w,isFetching:y}=g.useLanguagePages(u),{data:F=[],isFetching:P}=g.useLanguagePages(s==null?void 0:s.parent),{data:J=[],isFetching:O}=g.usePageTypes(),{setSelectedLang:ss}=N.useLanguages(),{t:B}=U.useTranslation(),[,es]=g.useSearchParams(),[,ns]=N.useSidebarActivePanel(),ts=b||y||P||O,G=v.useMemo(()=>j.filter(L==null?void 0:L.languages,n=>!j.find(w,{lang:n})),[L,w]),W=v.useMemo(()=>J.find(n=>n.key===(s==null?void 0:s.pageType)),[J,s==null?void 0:s.pageType]),K=!(W!=null&&W.hasSlug),V=(s==null?void 0:s.slug)==="/";v.useEffect(()=>{if(!t&&s&&i&&(S(i),x(`${s.name} - ${g.LANGUAGES[i]}`)),!t||!s)return;const n=w==null?void 0:w.find(is=>is.id===c);if(!n)return;x(n.name),S(n.lang);const E=n.slug||"",{initSlug:R,prefix:us}=Y.parseSlugForEdit(E,s);r(R),C(us)},[t,c,w,s,i]),v.useEffect(()=>{if(i)S(i);else if((G==null?void 0:G.length)===1&&!t){const n=G[0];if(!n||!g.LANGUAGES[n])return;S(n),(!l||l===(s==null?void 0:s.name))&&x(`${s==null?void 0:s.name} - ${g.LANGUAGES[n]}`)}},[i,G,t,l,s]);const{parentSlug:Q,isRootPage:D}=v.useMemo(()=>{if(V||!d)return{parentSlug:void 0,isRootPage:!(s!=null&&s.parent)};if(!(s!=null&&s.parent))return{parentSlug:p?`/${d}`:void 0,isRootPage:!0};const n=F==null?void 0:F.find(E=>E.lang===d);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[s==null?void 0:s.parent,F,p,d,V]),os=v.useMemo(()=>D?!0:!!(F!=null&&F.some(n=>(n==null?void 0:n.lang)===d)),[d,F,D]),X=()=>{let n="";return D?n=`/${p?[d,f].filter(Boolean).join("/"):f}`:n=`${Y.removeSlugExtension(Q)}/${f}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},ls=n=>{const E=new URLSearchParams(window.location.search);z&&n===z?E.delete("lang"):E.set("lang",n),es(E),window.dispatchEvent(new PopStateEvent("popstate"))},as=n=>{n.preventDefault();const E={name:l,lang:d,primaryPage:s==null?void 0:s.id,slug:K?"":X(),pageType:s==null?void 0:s.pageType,...t&&{id:c}},R=()=>{!t&&d&&(ss(d),ls(d)),ns("outline"),a()};t?M(E,{onSuccess:R}):T(E,{onSuccess:R})};return e.jsx(N.Dialog,{open:h,onOpenChange:a,children:h&&e.jsxs(N.DialogContent,{className:"text-slate-600 sm:max-w-[425px]",children:[e.jsxs(N.DialogHeader,{children:[e.jsx(N.DialogTitle,{children:B(t?"Edit language":"Add new language page")}),e.jsx(N.DialogDescription,{className:"font-light",children:B("Enter the details for the language")})]}),e.jsx(hs,{id:c,pages:o,loading:ts,onSubmit:as,edit:t,lang:d,languages:G,name:l,setLang:S,setName:x,primaryPageObject:s,parentHasSelectedLanguagePage:os,isNonSlugPageType:K,isRootPage:D,useLanguagePrefix:p,setUseLanguagePrefix:C,isHomePage:V,parentSlug:Q,slug:f,setSlug:r,isSlugValid:A,setIsSlugValid:m,getSlug:X,isPending:q})]})})};exports.default=xs;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import { D as t, e as c, f as m, g as p, o as h } from "./index-
|
|
2
|
+
import { D as t, e as c, f as m, g as p, o as h } from "./index-BbkBlCE2.js";
|
|
3
3
|
import { Suspense as f, lazy as D } from "react";
|
|
4
4
|
import { useTranslation as u } from "react-i18next";
|
|
5
|
-
const x = D(() => import("./page-creator-
|
|
5
|
+
const x = D(() => import("./page-creator-CR-FbJ7C.js")), C = ({
|
|
6
6
|
addEditPage: o,
|
|
7
7
|
setAddEditPage: s,
|
|
8
8
|
closePanel: l
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DonDtb8f.cjs"),c=require("react"),a=require("react-i18next"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-DqKFL1sB.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,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),w=require("./index-DonDtb8f.cjs"),p=require("./selected-block-display-BCcwnFzJ.cjs"),Z=require("lucide-react"),T=require("react"),ee=require("sonner"),J=require("./index-j-XsKW-V.cjs"),X=require("./apply-binding-CBSjMYSk.cjs"),te=require("@tanstack/react-query"),ne=()=>{const{addPredefinedBlock:b}=w.useAddBlock(),W=w.useReplaceBlock(),S=w.useRemoveBlocks(),N=te.useQueryClient(),H=async(o,n)=>{if(!n)return;const t=X.getBlocksFromHTML(n);await b(t,o.parentId,o.position)},x=async(o,n)=>{if(!o.blockId||!n)return;const t=X.getBlocksFromHTML(n);await W(o.blockId,t)},B=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 T.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
|
+
`,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 x(r,i);break;case"REMOVE":await B(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=T.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-C1yoNntS.cjs"))),se=({t:b,fetch:W,input:S,messages:N,setInput:H,isLoading:x,setMessages:B,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=w.useSelectedBlock(),[,f]=w.useSelectedBlockIds(),e=w.useBlocksHtmlForAi(),A=ne(),R=async(r,i,a,l)=>{var _,K;if(!r||x)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};B(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};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,B),B(y=>(T.startTransition(()=>{var G,Q,z,U;const j=y.filter(V=>V.role==="assistant"&&!V.isReasoning&&!V.isTask),E=((G=j[j.length-1])==null?void 0:G.content)||"",C=Date.now();(Q=t.onSuccess)==null||Q.call(t,{content:E,model:v,timestamp:C}),(z=t.onComplete)==null||z.call(t,{success:!0,content:E,model:v,timestamp:C}),(U=t.onAIEvent)==null||U.call(t,{type:"completion",content:E,model:v,timestamp:C})}),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.")};B(I=>[...I,P]),T.startTransition(()=>{var j,E,C;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}),(E=t.onComplete)==null||E.call(t,{success:!1,error:I,model:v,timestamp:y}),(C=t.onAIEvent)==null||C.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(T.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:x}),c.jsx(T.Suspense,{fallback:c.jsx("div",{children:"Loading..."}),children:c.jsx(re,{input:S,setInput:H,onSend:R,onStop:m,isLoading:x,selectedLang:"",currentBlock:s||F,disabled:(S==null?void 0:S.length)===0,selectedModel:d,onModelChange:o})})]})]})};exports.default=se;
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { jsxs as R, Fragment as X, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { ab as Y, ac as Z, ad as tt, r as et, a as nt, ae as rt } from "./index-BbkBlCE2.js";
|
|
3
|
+
import { C as st, a as ot, b as at, R as it, c as ct, d as lt, T as ut, M as dt, e as mt, f as ft, h as pt, S as ht, i as gt } from "./selected-block-display-D-lzXUfE.js";
|
|
4
|
+
import { Bot as At } from "lucide-react";
|
|
5
|
+
import { useCallback as kt, Fragment as yt, Suspense as It, lazy as bt, startTransition as Q } from "react";
|
|
6
|
+
import { toast as St } from "sonner";
|
|
7
|
+
import { l as Ct, m as Et } from "./index-Cyz_Iww4.js";
|
|
8
|
+
import { g as U } from "./apply-binding-vAuN-TGV.js";
|
|
9
|
+
import { useQueryClient as vt } from "@tanstack/react-query";
|
|
10
|
+
const wt = () => {
|
|
11
|
+
const { addPredefinedBlock: I } = Y(), F = Z(), b = tt(), x = vt(), N = async (o, n) => {
|
|
12
|
+
if (!n) return;
|
|
13
|
+
const e = U(n);
|
|
14
|
+
await I(e, o.parentId, o.position);
|
|
15
|
+
}, w = async (o, n) => {
|
|
16
|
+
if (!o.blockId || !n) return;
|
|
17
|
+
const e = U(n);
|
|
18
|
+
await F(o.blockId, e);
|
|
19
|
+
}, C = async (o) => {
|
|
20
|
+
!o.ids || o.ids.length === 0 || await b(o.ids);
|
|
21
|
+
};
|
|
22
|
+
let d = null;
|
|
23
|
+
const H = (o, n) => {
|
|
24
|
+
const e = document.getElementById("canvas-iframe");
|
|
25
|
+
if (!e)
|
|
26
|
+
return null;
|
|
27
|
+
const l = e == null ? void 0 : e.contentDocument;
|
|
28
|
+
if (!l)
|
|
29
|
+
return null;
|
|
30
|
+
l.querySelectorAll("[data-stream-canvas]").forEach((f) => f.remove());
|
|
31
|
+
let s = null;
|
|
32
|
+
if (o && o !== "undefined" && (s = l.querySelector(`[data-block-id="${o}"]`)), s || (s = l.body), !s)
|
|
33
|
+
return null;
|
|
34
|
+
if (d = l.createElement("div"), d.setAttribute("data-stream-canvas", "true"), n !== void 0 && n >= 0 && s.children) {
|
|
35
|
+
const f = Math.min(n, s.children.length);
|
|
36
|
+
f < s.children.length ? s.insertBefore(d, s.children[f]) : s.appendChild(d);
|
|
37
|
+
} else
|
|
38
|
+
s.appendChild(d);
|
|
39
|
+
return d;
|
|
40
|
+
}, P = (o) => {
|
|
41
|
+
var s;
|
|
42
|
+
const n = document.getElementById("canvas-iframe");
|
|
43
|
+
if (!n)
|
|
44
|
+
return null;
|
|
45
|
+
const e = n == null ? void 0 : n.contentDocument;
|
|
46
|
+
if (!e)
|
|
47
|
+
return null;
|
|
48
|
+
e.querySelectorAll("[data-stream-canvas]").forEach((f) => f.remove());
|
|
49
|
+
const u = e.querySelector(`[data-block-id="${o}"]`);
|
|
50
|
+
return u ? (d = e.createElement("div"), d.setAttribute("data-stream-canvas", "true"), (s = u.parentNode) == null || s.insertBefore(d, u.nextSibling), u.style.display = "none", d) : null;
|
|
51
|
+
}, L = (o) => {
|
|
52
|
+
const n = document.getElementById("canvas-iframe");
|
|
53
|
+
(n == null ? void 0 : n.contentWindow) && o.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
54
|
+
}, B = (o, n, e) => {
|
|
55
|
+
const l = H(n, e);
|
|
56
|
+
l && (l.innerHTML = o, L(l));
|
|
57
|
+
}, T = (o, n) => {
|
|
58
|
+
const e = P(n);
|
|
59
|
+
e && (e.innerHTML = o, L(e));
|
|
60
|
+
}, O = (o) => {
|
|
61
|
+
const n = o.match(/^--ACTION=(.+)--$/);
|
|
62
|
+
if (!n) return null;
|
|
63
|
+
let l = n[1].replace(/--/g, "").split("|");
|
|
64
|
+
const s = { type: l[0] };
|
|
65
|
+
return l.forEach((f) => {
|
|
66
|
+
const t = f.trim();
|
|
67
|
+
if (t.startsWith("PARENT=")) {
|
|
68
|
+
const g = t.substring(7);
|
|
69
|
+
s.parentId = g === "undefined" ? void 0 : g;
|
|
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
|
+
}), s;
|
|
72
|
+
};
|
|
73
|
+
return kt(
|
|
74
|
+
async (o, n) => {
|
|
75
|
+
const e = new TextDecoder();
|
|
76
|
+
let l = "", u = "", s = !1, f = null;
|
|
77
|
+
const t = {
|
|
78
|
+
isInAction: !1,
|
|
79
|
+
currentAction: null,
|
|
80
|
+
htmlBuffer: "",
|
|
81
|
+
isCapturingHtml: !1
|
|
82
|
+
}, g = async (r) => {
|
|
83
|
+
const a = r.trim();
|
|
84
|
+
if (a === "--START--") {
|
|
85
|
+
s = !0;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (s) {
|
|
89
|
+
if (a === "--END--") {
|
|
90
|
+
t.currentAction && (t.htmlBuffer || t.currentAction.type === "REMOVE") && await M(t.currentAction, t.htmlBuffer), d && (d.remove(), d = null);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (a.startsWith("--THINKING=")) {
|
|
94
|
+
const i = a.substring(11);
|
|
95
|
+
n((c) => {
|
|
96
|
+
const p = [...c], h = p[p.length - 1];
|
|
97
|
+
if (h && h.role === "assistant" && h.isReasoning)
|
|
98
|
+
h.content = i, h.isStreaming = !1;
|
|
99
|
+
else {
|
|
100
|
+
const $ = {
|
|
101
|
+
id: Date.now().toString(),
|
|
102
|
+
role: "assistant",
|
|
103
|
+
content: i,
|
|
104
|
+
isReasoning: !0,
|
|
105
|
+
isStreaming: !1
|
|
106
|
+
};
|
|
107
|
+
p.push($);
|
|
108
|
+
}
|
|
109
|
+
return p;
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (a.startsWith("--TASK=")) {
|
|
114
|
+
const i = a.substring(7), c = `task-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, p = {
|
|
115
|
+
id: c,
|
|
116
|
+
role: "assistant",
|
|
117
|
+
content: i.replace(/--$/, ""),
|
|
118
|
+
isTask: !0,
|
|
119
|
+
isTaskLoading: !0,
|
|
120
|
+
isTaskCompleted: !1
|
|
121
|
+
};
|
|
122
|
+
f = c, n((h) => [...h, p]);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (a.startsWith("--MSG=")) {
|
|
126
|
+
const i = a.substring(6), c = {
|
|
127
|
+
id: Date.now().toString(),
|
|
128
|
+
role: "assistant",
|
|
129
|
+
content: i.replace(/--$/g, ""),
|
|
130
|
+
isReasoning: !1,
|
|
131
|
+
isStreaming: !1
|
|
132
|
+
};
|
|
133
|
+
n((p) => [...p, c]);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (a.startsWith("--ACTION=")) {
|
|
137
|
+
t.currentAction && (t.htmlBuffer || t.currentAction.type === "REMOVE") && await M(t.currentAction, t.htmlBuffer), t.currentAction = O(a), t.htmlBuffer = "", t.isInAction = !0;
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (a === "--ENDACTION--") {
|
|
141
|
+
t.currentAction && (t.htmlBuffer || t.currentAction.type === "REMOVE") && await M(t.currentAction, t.htmlBuffer), f && (n((i) => i.map((c) => c.isTask ? { ...c, isTaskCompleted: !0 } : c)), f = null), t.currentAction = null, t.htmlBuffer = "", t.isInAction = !1;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (a === "--HTML--") {
|
|
145
|
+
t.isCapturingHtml = !0;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (a === "--ENDHTML--") {
|
|
149
|
+
t.isCapturingHtml = !1;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (a.startsWith("--HTML--") && a.includes("--ENDHTML--")) {
|
|
153
|
+
const i = a.match(/^--HTML--(.+?)--ENDHTML--$/);
|
|
154
|
+
if (i && t.currentAction) {
|
|
155
|
+
const c = i[1];
|
|
156
|
+
t.htmlBuffer += c, t.currentAction.type === "ADD" ? B(t.htmlBuffer, t.currentAction.parentId, t.currentAction.position) : t.currentAction.type === "EDIT" && t.currentAction.blockId && T(t.htmlBuffer, t.currentAction.blockId);
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
t.isCapturingHtml && t.currentAction && (t.htmlBuffer += r + `
|
|
161
|
+
`, t.currentAction.type === "ADD" ? B(t.htmlBuffer, t.currentAction.parentId, t.currentAction.position) : t.currentAction.type === "EDIT" && t.currentAction.blockId && T(t.htmlBuffer, t.currentAction.blockId));
|
|
162
|
+
}
|
|
163
|
+
}, M = async (r, a) => {
|
|
164
|
+
try {
|
|
165
|
+
switch (r.type) {
|
|
166
|
+
case "ADD":
|
|
167
|
+
await N(r, a);
|
|
168
|
+
break;
|
|
169
|
+
case "EDIT":
|
|
170
|
+
await w(r, a);
|
|
171
|
+
break;
|
|
172
|
+
case "REMOVE":
|
|
173
|
+
await C(r);
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
n((i) => i.filter((c) => !c.isTask));
|
|
177
|
+
} catch (i) {
|
|
178
|
+
console.log(i);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
try {
|
|
182
|
+
for (; ; ) {
|
|
183
|
+
const { done: r, value: a } = await o.read();
|
|
184
|
+
if (r) break;
|
|
185
|
+
const i = e.decode(a, { stream: !0 });
|
|
186
|
+
l += i, u += i;
|
|
187
|
+
const c = u.split(`
|
|
188
|
+
`);
|
|
189
|
+
u = c.pop() || "";
|
|
190
|
+
for (const p of c)
|
|
191
|
+
await g(p);
|
|
192
|
+
}
|
|
193
|
+
u && await g(u), x.invalidateQueries({
|
|
194
|
+
queryKey: ["AI_USAGE"]
|
|
195
|
+
});
|
|
196
|
+
} catch (r) {
|
|
197
|
+
console.log(r);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
[b]
|
|
201
|
+
);
|
|
202
|
+
}, Bt = bt(() => import("./ai-prompt-input-DhVfzVhy.js")), Ft = ({
|
|
203
|
+
t: I,
|
|
204
|
+
fetch: F,
|
|
205
|
+
input: b,
|
|
206
|
+
messages: x,
|
|
207
|
+
setInput: N,
|
|
208
|
+
isLoading: w,
|
|
209
|
+
setMessages: C,
|
|
210
|
+
handleStop: d,
|
|
211
|
+
setIsLoading: H,
|
|
212
|
+
currentBlock: P,
|
|
213
|
+
fallbackLang: L,
|
|
214
|
+
setCurrentBlock: B,
|
|
215
|
+
setAbortController: T,
|
|
216
|
+
selectedModel: O,
|
|
217
|
+
onModelChange: o
|
|
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 = et(), [, f] = nt(), t = rt(), g = wt(), M = async (r, a, i, c) => {
|
|
220
|
+
var V, _;
|
|
221
|
+
if (!r || w) return;
|
|
222
|
+
B(s);
|
|
223
|
+
const p = t(s ? { blockId: s._id, additionalCoreBlocks: ["Icon"] } : { additionalCoreBlocks: ["Icon"] });
|
|
224
|
+
if (s && !p) {
|
|
225
|
+
St.error(I("Something went wrong. Please try again."));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const h = {
|
|
229
|
+
id: Date.now().toString(),
|
|
230
|
+
role: "user",
|
|
231
|
+
content: gt({
|
|
232
|
+
language: L,
|
|
233
|
+
userInput: a || r,
|
|
234
|
+
currentHtml: p
|
|
235
|
+
}),
|
|
236
|
+
userMessage: r
|
|
237
|
+
}, $ = {
|
|
238
|
+
id: (Date.now() + 1).toString(),
|
|
239
|
+
role: "assistant",
|
|
240
|
+
content: "",
|
|
241
|
+
isReasoning: !0,
|
|
242
|
+
isStreaming: !0
|
|
243
|
+
};
|
|
244
|
+
C((A) => [...A, h, $]), H(!0);
|
|
245
|
+
const J = new AbortController();
|
|
246
|
+
T(J);
|
|
247
|
+
const S = c || u;
|
|
248
|
+
(V = e.onAIEvent) == null || V.call(e, { type: "stream_start", model: S, timestamp: Date.now() });
|
|
249
|
+
try {
|
|
250
|
+
const A = {
|
|
251
|
+
messages: [h].map((k) => ({
|
|
252
|
+
role: k.role,
|
|
253
|
+
content: k.content
|
|
254
|
+
})),
|
|
255
|
+
model: c || u
|
|
256
|
+
};
|
|
257
|
+
i && (A.image = i);
|
|
258
|
+
const W = await F({ body: { action: "ASK_AI", data: A }, streamResponse: !0 });
|
|
259
|
+
if (!W.ok)
|
|
260
|
+
throw new Error(I("Failed to get AI response"));
|
|
261
|
+
const y = (_ = W.body) == null ? void 0 : _.getReader();
|
|
262
|
+
if (!y) throw new Error(I("Response body is not readable"));
|
|
263
|
+
await g(y, C), C((k) => (Q(() => {
|
|
264
|
+
var K, j, G, z;
|
|
265
|
+
const D = k.filter((q) => q.role === "assistant" && !q.isReasoning && !q.isTask), E = ((K = D[D.length - 1]) == null ? void 0 : K.content) || "", v = Date.now();
|
|
266
|
+
(j = e.onSuccess) == null || j.call(e, { content: E, model: S, timestamp: v }), (G = e.onComplete) == null || G.call(e, { success: !0, content: E, model: S, timestamp: v }), (z = e.onAIEvent) == null || z.call(e, {
|
|
267
|
+
type: "completion",
|
|
268
|
+
content: E,
|
|
269
|
+
model: S,
|
|
270
|
+
timestamp: v
|
|
271
|
+
});
|
|
272
|
+
}), k));
|
|
273
|
+
} catch (A) {
|
|
274
|
+
if (A.name !== "AbortError") {
|
|
275
|
+
const W = {
|
|
276
|
+
id: (Date.now() + 1).toString(),
|
|
277
|
+
role: "assistant",
|
|
278
|
+
content: I("Sorry, I encountered an error. Please try again.")
|
|
279
|
+
};
|
|
280
|
+
C((y) => [...y, W]), Q(() => {
|
|
281
|
+
var D, E, v;
|
|
282
|
+
const y = A instanceof Error ? A.message : String(A), k = Date.now();
|
|
283
|
+
(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 });
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
} finally {
|
|
287
|
+
N(""), H(!1), B(null), T(null);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
return /* @__PURE__ */ R(X, { children: [
|
|
291
|
+
/* @__PURE__ */ R(st, { className: "no-scrollbar", children: [
|
|
292
|
+
/* @__PURE__ */ R(ot, { className: "gap-2 px-0", children: [
|
|
293
|
+
x.length === 0 && /* @__PURE__ */ m(
|
|
294
|
+
at,
|
|
295
|
+
{
|
|
296
|
+
icon: /* @__PURE__ */ m(At, { size: 48, className: "text-gray-300" }),
|
|
297
|
+
title: "Start a conversation",
|
|
298
|
+
description: I("Start a conversation with the AI assistant to add/edit current page")
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
x.map(
|
|
302
|
+
(r) => r.role !== "system" && /* @__PURE__ */ m(yt, { children: r.isReasoning ? /* @__PURE__ */ R(it, { isStreaming: r.isStreaming, defaultOpen: !0, children: [
|
|
303
|
+
/* @__PURE__ */ m(ct, { className: "text-xs [&_p]:text-muted-foreground" }),
|
|
304
|
+
/* @__PURE__ */ m(lt, { className: "p-0 text-xs", children: r.content })
|
|
305
|
+
] }) : r.isTask && !r.isTaskCompleted ? /* @__PURE__ */ m(ut, { content: r.content, isLoading: r.isTaskLoading }) : /* @__PURE__ */ m(dt, { from: r.role, children: /* @__PURE__ */ m(mt, { className: "p-0", children: r.role === "assistant" ? /* @__PURE__ */ m(ft, { className: "p-0 text-xs", children: r.content }) : /* @__PURE__ */ m("div", { className: "p-0 text-xs", children: r.userMessage || r.content }) }) }) }, r.id)
|
|
306
|
+
)
|
|
307
|
+
] }),
|
|
308
|
+
/* @__PURE__ */ m(pt, {})
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ R("div", { className: "border-gray-200 pb-2", children: [
|
|
311
|
+
/* @__PURE__ */ m(ht, { onRemove: () => f([]), isLoading: w }),
|
|
312
|
+
/* @__PURE__ */ m(It, { fallback: /* @__PURE__ */ m("div", { children: "Loading..." }), children: /* @__PURE__ */ m(
|
|
313
|
+
Bt,
|
|
314
|
+
{
|
|
315
|
+
input: b,
|
|
316
|
+
setInput: N,
|
|
317
|
+
onSend: M,
|
|
318
|
+
onStop: d,
|
|
319
|
+
isLoading: w,
|
|
320
|
+
selectedLang: "",
|
|
321
|
+
currentBlock: s || P,
|
|
322
|
+
disabled: (b == null ? void 0 : b.length) === 0,
|
|
323
|
+
selectedModel: u,
|
|
324
|
+
onModelChange: o
|
|
325
|
+
}
|
|
326
|
+
) })
|
|
327
|
+
] })
|
|
328
|
+
] });
|
|
329
|
+
};
|
|
330
|
+
export {
|
|
331
|
+
Ft as default
|
|
332
|
+
};
|