@oneclick.dev/cms-core-modules 0.0.88 → 0.0.90
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/{ContentEditor-CPc5OoYc.mjs → ContentEditor-B-lB0fES.mjs} +1 -1
- package/dist/{ContentEditor-BU5dE9P5.js → ContentEditor-BrhHT4t0.js} +1 -1
- package/dist/{Entries-CcEW98F5.js → Entries-DkRhOt95.js} +1 -1
- package/dist/{Entries-BkOPae4R.mjs → Entries-dLlCrXXe.mjs} +1 -1
- package/dist/{Overview-CA8wh_BI.js → Overview-37nilXzE.js} +1 -1
- package/dist/{Overview-D4MFwRI_.mjs → Overview-C--dq51X.mjs} +1 -1
- package/dist/{TableView-klOTPJKZ.js → TableView-DtcF-oQc.js} +2 -2
- package/dist/{TableView-Ei_w_-bn.mjs → TableView-YJ3BvQk7.mjs} +3 -3
- package/dist/View-C8oQG6gI.js +1 -0
- package/dist/{View-C4MBWRlA.mjs → View-CPMontPz.mjs} +9 -9
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +6 -6
- package/dist/interpolation-BBwG_ON6.mjs +65 -0
- package/dist/interpolation-CsOrww73.js +1 -0
- package/package.json +2 -2
- package/dist/View-BaFlMcM6.js +0 -1
- package/dist/interpolation-BHSqsh8Q.mjs +0 -65
- package/dist/interpolation-We8hT28L.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as ie, inject as se, ref as C, openBlock as D, createElementBlock as B, unref as k, Fragment as te, createElementVNode as y, createTextVNode as R, toDisplayString as Q, createCommentVNode as P, resolveComponent as T, withDirectives as yi, withKeys as Pt, isRef as ta, vModelText as tr, createBlock as z, withCtx as v, createVNode as p, normalizeClass as ae, reactive as qi, watch as Ze, renderList as ce, shallowRef as gc, onMounted as we, onBeforeUnmount as Bt, h as oi, getCurrentInstance as _c, watchEffect as cc, nextTick as mt, markRaw as nf, provide as he, customRef as hc, render as ou, toRaw as ga, computed as ue, toValue as mc, toRef as dt, normalizeStyle as ge, renderSlot as aa, normalizeProps as ft, mergeProps as Ft, resolveDynamicComponent as ba, withModifiers as _t, guardReactiveProps as of, vModelCheckbox as Fc, vShow as pc, onUnmounted as bc, createStaticVNode as yc, onActivated as kc, KeepAlive as wc } from "vue";
|
|
2
2
|
import { useModulePermissions as Js, useConfirmation as Gs, useModule as Ys, useFirebaseIntegration as rf, useModuleStorage as Dc, useModuleRoute as vc, useModuleBreadcrumbs as xc } from "@oneclick.dev/cms-kit";
|
|
3
|
-
import { i as un } from "./interpolation-
|
|
3
|
+
import { i as un } from "./interpolation-BBwG_ON6.mjs";
|
|
4
4
|
import { Link as sf, Loader2 as kr, ChevronDown as Un, Plus as no, Braces as Ec, ArrowUp as Cc, ArrowDown as Bc, Cog as Sc, List as jc, ListOrdered as qc, MousePointerClick as Ac, CornerDownLeft as Mc, Pilcrow as ru, icons as su, Heading1 as lf, Columns3 as Tc, Rows3 as Nc, LayoutPanelTop as Oc, Square as Lc, Minus as Ic, Maximize as Pc, ListCollapse as zc, Image as Rc, Clapperboard as $c, Smile as Hc, MapPin as Vc, ExternalLink as uf, SwatchBook as Wc, Copy as ts, Trash2 as df, RotateCcw as ff, ImageIcon as Uc, VideoIcon as Kc, ArrowLeft as gf, Unlink as Jc, Check as Gc, ChevronsUpDownIcon as _f, CheckIcon as cf, X as hf, Zap as Yc, Bold as Xc, Italic as Qc, Underline as Zc, Strikethrough as eh, AlignStartVertical as Sa, AlignCenterVertical as ja, AlignEndVertical as qa, MoveRight as th, MoveDown as ah, AlignHorizontalSpaceBetween as ih, AlignStartHorizontal as nh, AlignCenterHorizontal as oh, AlignEndHorizontal as rh, ImagePlus as sh, ChevronRight as lu, SendToBack as lh, Globe as uh } from "lucide-vue-next";
|
|
5
5
|
import { _ as De } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
6
6
|
import { c as uu } from "./utils-BVKy9S2J.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),Pe=require("@oneclick.dev/cms-kit"),xi=require("./interpolation-We8hT28L.js"),q=require("lucide-vue-next"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.js"),hl=require("./utils-D6CaKJbp.js"),ud=require("./index-4tjmIans.js"),r_=require("./google-D4N3gb01.js"),s_={class:"flex flex-wrap gap-1"},l_={key:0,class:"font-medium"},u_={key:1,class:"font-medium"},d_={key:2,class:"font-medium"},f_={key:3,class:"font-medium"},c_=o.defineComponent({__name:"Status",setup(a){const e=o.inject("status",o.ref(""));return(t,i)=>(o.openBlock(),o.createElementBlock("p",s_,[o.unref(e)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[i[0]||(i[0]=o.createElementVNode("span",{class:"opacity-70"},"Status:",-1)),i[1]||(i[1]=o.createTextVNode(" "+o.toDisplayString(" ")+" ",-1)),o.unref(e)==="new"?(o.openBlock(),o.createElementBlock("strong",l_,"New Draft")):o.createCommentVNode("",!0),o.unref(e)==="draft"?(o.openBlock(),o.createElementBlock("strong",u_,"Draft")):o.createCommentVNode("",!0),o.unref(e)==="archived"?(o.openBlock(),o.createElementBlock("strong",d_,"Archived")):o.unref(e)==="published"?(o.openBlock(),o.createElementBlock("strong",f_,"Published")):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0)]))}}),g_={class:"flex flex-col"},__={class:"flex justify-between items-center p-3 xl:p-4"},h_={class:"relative group min-w-[320px] @2xl:min-w-[500px] max-w-4xl"},m_={class:"pl-4 pr-6 py-2 -ml-1.5 -my-2 rounded text-2xl pointer-events-none opacity-0 select-none whitespace-nowrap overflow-hidden"},F_={class:"flex items-center justify-between gap-12 bg-input/30 pl-2 xl:pl-5 pr-3 xl:pr-4 py-3 xl:py-4 border-y"},p_={class:"flex gap-4 xl:gap-6 text-sm"},b_={key:0,class:"flex flex-wrap gap-1"},y_={class:"font-medium"},k_={key:1,class:"flex flex-wrap gap-1"},w_={class:"font-medium"},D_={class:"flex gap-2"},v_={class:"flex"},E_={key:0},x_={key:0},C_={key:0},B_=o.defineComponent({__name:"Header",props:{config:{type:Object,required:!0},createdAt:{type:Date,required:!0},updatedAt:{type:Date,required:!1},liveByLocale:{type:Array,default:()=>[]}},emits:["saveDraft","publishEntry","unpublishEntry","archiveEntry","unarchiveToDrafts","publishAllEntries","deleteEntry","previewEntry"],setup(a,{emit:e}){const t=e,i=o.inject("activeView",o.ref("edit")),n=o.inject("status",o.ref("")),r=o.inject("entryId",o.ref("")),s=o.inject("activeEntryVersion",o.ref("")),l=o.inject("isSaving",o.ref(!1)),u=o.inject("title",o.ref("")),d=o.ref(u.value);function f(){u.value=d.value}return(c,g)=>{const _=o.resolveComponent("SegmentedControlButton"),h=o.resolveComponent("SegmentedControl"),m=o.resolveComponent("Button"),F=o.resolveComponent("DropdownMenuTrigger"),p=o.resolveComponent("DropdownMenuItem"),b=o.resolveComponent("DropdownMenuGroup"),y=o.resolveComponent("DropdownMenuContent"),k=o.resolveComponent("DropdownMenu");return o.openBlock(),o.createElementBlock("div",g_,[o.createElementVNode("div",__,[o.createElementVNode("div",h_,[o.createElementVNode("p",m_,o.toDisplayString(o.unref(u)||"Please enter a title"),1),o.withDirectives(o.createElementVNode("input",{class:"absolute w-[calc(100%+1rem)] top-0 pl-4 pr-6 py-2 -ml-1.5 -my-2 rounded text-2xl group-hover:bg-input/30 focus:bg-input/50 focus-visible:outline-0 focus-visible:ring-1 focus-visible:ring-ring/50","onUpdate:modelValue":g[0]||(g[0]=w=>o.isRef(u)?u.value=w:null),onFocus:g[1]||(g[1]=w=>d.value=o.unref(u)),onKeydown:o.withKeys(f,["esc"]),placeholder:"Please enter a title"},null,544),[[o.vModelText,o.unref(u)]])]),o.createElementVNode("div",null,[o.unref(r)?(o.openBlock(),o.createBlock(h,{key:0,modelValue:o.unref(i),"onUpdate:modelValue":g[2]||(g[2]=w=>o.isRef(i)?i.value=w:null),"allow-empty":""},{default:o.withCtx(()=>[o.createVNode(_,{value:"edit"},{default:o.withCtx(()=>[...g[13]||(g[13]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"Edit",-1)])]),_:1}),o.createVNode(_,{value:"preview"},{default:o.withCtx(()=>[...g[14]||(g[14]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"Live Preview",-1)])]),_:1}),o.unref(r)!=="new"&&o.unref(s)?(o.openBlock(),o.createBlock(_,{key:0,value:"versions"},{default:o.withCtx(()=>[...g[15]||(g[15]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"Versions",-1)])]),_:1})):o.createCommentVNode("",!0),o.createVNode(_,{value:"api"},{default:o.withCtx(()=>[...g[16]||(g[16]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"API",-1)])]),_:1})]),_:1},8,["modelValue"])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",F_,[o.createElementVNode("div",p_,[o.createVNode(c_),o.unref(n)!=="new"&&a.updatedAt?(o.openBlock(),o.createElementBlock("p",b_,[g[17]||(g[17]=o.createElementVNode("span",{class:"opacity-70"},"Last Modified:",-1)),g[18]||(g[18]=o.createTextVNode()),o.createElementVNode("strong",y_,o.toDisplayString(new Date(a.updatedAt)?.toLocaleString()),1)])):o.createCommentVNode("",!0),o.unref(n)!=="new"&&a.createdAt?(o.openBlock(),o.createElementBlock("p",k_,[g[19]||(g[19]=o.createElementVNode("span",{class:"opacity-70"},"Created:",-1)),g[20]||(g[20]=o.createTextVNode()),o.createElementVNode("strong",w_,o.toDisplayString(new Date(a.createdAt)?.toLocaleString()),1)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",D_,[o.createVNode(m,{variant:"secondary",class:"border bg-white hover:bg-white dark:bg-transparent dark:hover:bg-muted/20",onClick:g[3]||(g[3]=w=>t("previewEntry"))},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Link),{class:"size-4"}),g[21]||(g[21]=o.createTextVNode(" Preview ",-1))]),_:1}),o.createElementVNode("div",v_,[o.unref(n)==="published"?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(m,{class:"rounded-r-none",onClick:g[4]||(g[4]=w=>t("publishEntry"))},{default:o.withCtx(()=>[o.unref(l)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(q.Loader2),{class:"size-4 animate-spin ml-2"}),g[22]||(g[22]=o.createElementVNode("span",null,"Publishing...",-1))],64)):(o.openBlock(),o.createElementBlock("span",E_,"Publish changes"))]),_:1}),g[25]||(g[25]=o.createElementVNode("div",{class:"w-[1px] h-full bg-muted/30"},null,-1)),o.createVNode(k,null,{default:o.withCtx(()=>[o.createVNode(F,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(m,{class:"rounded-l-none",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ChevronDown),{class:"size-4"})]),_:1})]),_:1}),o.createVNode(y,{class:"w-56"},{default:o.withCtx(()=>[o.createVNode(b,null,{default:o.withCtx(()=>[o.createVNode(p,{onClick:g[5]||(g[5]=w=>t("unpublishEntry"))},{default:o.withCtx(()=>[...g[23]||(g[23]=[o.createTextVNode("Unpublish (draft)",-1)])]),_:1}),o.createVNode(p,{onClick:g[6]||(g[6]=w=>t("archiveEntry"))},{default:o.withCtx(()=>[...g[24]||(g[24]=[o.createTextVNode("Archive",-1)])]),_:1})]),_:1})]),_:1})]),_:1})],64)):o.unref(n)==="archived"?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(m,{class:"rounded-r-none",onClick:g[7]||(g[7]=w=>t("unarchiveToDrafts"))},{default:o.withCtx(()=>[o.unref(l)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(q.Loader2),{class:"size-4 animate-spin ml-2"}),g[26]||(g[26]=o.createElementVNode("span",null,"Unarchiving...",-1))],64)):(o.openBlock(),o.createElementBlock("span",x_,"Unarchive (to Drafts)"))]),_:1}),g[29]||(g[29]=o.createElementVNode("div",{class:"w-[1px] h-full bg-muted/30"},null,-1)),o.createVNode(k,null,{default:o.withCtx(()=>[o.createVNode(F,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(m,{class:"rounded-l-none",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ChevronDown),{class:"size-4"})]),_:1})]),_:1}),o.createVNode(y,{class:"w-56"},{default:o.withCtx(()=>[o.createVNode(b,null,{default:o.withCtx(()=>[o.createVNode(p,{onClick:g[8]||(g[8]=w=>t("publishAllEntries"))},{default:o.withCtx(()=>[...g[27]||(g[27]=[o.createTextVNode("Publish all",-1)])]),_:1}),o.createVNode(p,{onClick:g[9]||(g[9]=w=>t("deleteEntry"))},{default:o.withCtx(()=>[...g[28]||(g[28]=[o.createTextVNode("Delete completely",-1)])]),_:1})]),_:1})]),_:1})]),_:1})],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:2},[o.createVNode(m,{class:o.normalizeClass({"rounded-r-none":o.unref(n)!=="new"||a.config?.supportedLanguages?.length===1}),onClick:g[10]||(g[10]=w=>t("saveDraft"))},{default:o.withCtx(()=>[o.unref(l)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(q.Loader2),{class:"size-4 animate-spin ml-2"}),g[30]||(g[30]=o.createElementVNode("span",null,"Saving...",-1))],64)):(o.openBlock(),o.createElementBlock("span",C_,"Save draft"))]),_:1},8,["class"]),g[33]||(g[33]=o.createElementVNode("div",{class:"w-[1px] h-full bg-muted/30"},null,-1)),o.unref(n)!=="new"||a.config?.supportedLanguages?.length===1?(o.openBlock(),o.createBlock(k,{key:0},{default:o.withCtx(()=>[o.createVNode(F,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(m,{class:"rounded-l-none",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ChevronDown),{class:"size-4"})]),_:1})]),_:1}),o.createVNode(y,{class:"w-56"},{default:o.withCtx(()=>[o.createVNode(b,null,{default:o.withCtx(()=>[o.createVNode(p,{onClick:g[11]||(g[11]=w=>t("publishEntry"))},{default:o.withCtx(()=>[...g[31]||(g[31]=[o.createTextVNode("Publish now",-1)])]),_:1}),a.liveByLocale?.length>0?(o.openBlock(),o.createBlock(p,{key:0,onClick:g[12]||(g[12]=w=>t("archiveEntry"))},{default:o.withCtx(()=>[...g[32]||(g[32]=[o.createTextVNode("Archive",-1)])]),_:1})):o.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1})):o.createCommentVNode("",!0)],64))])])])])}}}),S_={key:0,class:"border-b px-2 xl:px-4 py-4"},dd=o.defineComponent({__name:"ContentSettings",props:{customSettings:{type:Object,required:!0},inputValues:{type:Object,default:()=>({})}},setup(a){const e=o.inject("customSettingsOutput",o.ref(null)),t=i=>{e.value=i};return(i,n)=>{const r=o.resolveComponent("FormDisplayer");return a.customSettings?.layout?(o.openBlock(),o.createElementBlock("div",S_,[o.createVNode(r,{ref:"formDisplayer",settings:a.customSettings,inputValues:a.inputValues,onSetOutput:t},null,8,["settings","inputValues"])])):o.createCommentVNode("",!0)}}}),j_={class:"bg-muted/50"},N_={key:0,class:"flex items-center justify-between p-4"},q_={class:"flex gap-2"},A_={key:1,class:"grid gap-2 px-2 my-4"},T_={class:"relative flex items-center justify-between px-4 py-2 bg-white dark:bg-muted rounded-md border border-muted-foreground/20 z-2"},M_=["onClick"],V_={key:0,class:"flex items-center"},O_={class:"overflow-hidden"},L_={class:"grid gap-4 mb-2"},z_={class:"grid gap-3"},I_={class:"grid gap-3"},P_={class:"grid gap-1"},R_={key:0,class:"text-red-500 text-xs"},$_={class:"grid gap-3"},H_={class:"flex justify-between gap-2 w-full"},W_={class:"flex gap-2 ml-auto"},U_=o.defineComponent({__name:"ContentStructuredContentSections",setup(a){const{isAdmin:e}=Pe.useModulePermissions(),{confirm:t}=Pe.useConfirmation(),i=o.inject("structuredContentSections",o.ref([])),n=o.inject("structuredContentInput",o.ref(null)),r=o.inject("structuredContentOutput",o.ref(null)),s=o.ref(!1),l=o.ref("add"),u=o.ref(null),d=o.reactive({displayName:"",key:"",form:null}),f=o.ref([]);o.watch(()=>d.displayName,(y,k)=>{let w=k.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,""),D=y.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"");(d.key===w||d.key==="")&&(d.key=D)});const c=y=>{y||(d.displayName="",d.key="",d.form=null)},g=()=>{i.value.push({displayName:d.displayName,key:d.key,form:d.form?JSON.parse(JSON.stringify(d.form)):null}),s.value=!1,c(!1)},_=()=>{const y=i.value.findIndex(k=>k.key===u.value);if(y!==-1){if(d.key!==u.value){const k=f.value.indexOf(u.value);k!==-1&&f.value.splice(k,1,d.key),r.value&&typeof r.value=="object"&&u.value&&r.value.hasOwnProperty(u.value)&&(r.value[d.key]=r.value[u.value],delete r.value[u.value]),n.value=r.value?JSON.parse(JSON.stringify(r.value)):{}}i.value[y]={displayName:d.displayName,key:d.key,form:d.form?JSON.parse(JSON.stringify(d.form)):null}}s.value=!1,c(!1)},h=(y,k)=>{const w=y+k;if(w<0||w>=i.value.length)return;const D=i.value[y];i.value.splice(y,1),i.value.splice(w,0,D)},m=async()=>{if(!await t("Are you sure you want to delete this section? This action cannot be undone."))return;const k=i.value.findIndex(w=>w.key===u.value);k!==-1&&i.value.splice(k,1),s.value=!1,c(!1)},F=()=>{s.value=!0,l.value="add"},p=y=>{s.value=!0,l.value="edit",u.value=y.key,d.displayName=y.displayName,d.key=y.key,d.form=y.form?JSON.parse(JSON.stringify(y.form)):null},b=(y,k)=>{(!r.value||typeof r.value!="object")&&(r.value={}),r.value[y]=k};return(y,k)=>{const w=o.resolveComponent("Button"),D=o.resolveComponent("FormDisplayer"),v=o.resolveComponent("DialogTitle"),E=o.resolveComponent("DialogDescription"),x=o.resolveComponent("DialogHeader"),j=o.resolveComponent("Label"),A=o.resolveComponent("Input"),M=o.resolveComponent("FormBuilderSelect"),B=o.resolveComponent("DialogClose"),N=o.resolveComponent("DialogFooter"),H=o.resolveComponent("DialogContent"),S=o.resolveComponent("Dialog");return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",j_,[o.unref(e)()?(o.openBlock(),o.createElementBlock("div",N_,[o.createElementVNode("p",{class:o.normalizeClass({"opacity-40":!o.unref(i).length,"text-primary":o.unref(i).length})}," Structured content sections ("+o.toDisplayString(o.unref(i).length)+") ",3),o.createElementVNode("div",q_,[o.createVNode(w,{variant:"ghost",size:"icon",onClick:F},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Plus),{class:"size-4 text-primary"})]),_:1}),o.createVNode(w,{variant:"ghost",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Braces),{class:"size-4 text-primary"})]),_:1})])])):o.createCommentVNode("",!0),o.unref(i).length>0?(o.openBlock(),o.createElementBlock("div",A_,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(i),(C,W)=>(o.openBlock(),o.createElementBlock("div",{key:C.key},[o.createElementVNode("div",T_,[o.createElementVNode("p",{class:"select-none cursor-default hover:bg-background/15 px-3 py-1.5 rounded -ml-3",onClick:L=>o.unref(f).includes(C.key)?o.unref(f).splice(o.unref(f).indexOf(C.key),1):o.unref(f).push(C.key)},o.toDisplayString(C.displayName||C.key),9,M_),o.unref(e)()?(o.openBlock(),o.createElementBlock("div",V_,[o.createVNode(w,{variant:"ghost",size:"icon",disabled:W===0,onClick:L=>h(W,-1)},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ArrowUp),{class:"size-4"})]),_:1},8,["disabled","onClick"]),o.createVNode(w,{variant:"ghost",size:"icon",disabled:W===o.unref(i).length-1,onClick:L=>h(W,1)},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ArrowDown),{class:"size-4"})]),_:1},8,["disabled","onClick"]),o.createVNode(w,{variant:"ghost",size:"icon",onClick:L=>p(C)},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Cog),{class:"size-4"})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),o.createElementVNode("div",{class:o.normalizeClass(["relative grid transition-all duration-300 z-1 -translate-y-1",{"grid-rows-[1fr]":!o.unref(f).includes(C.key),"grid-rows-[0fr]":o.unref(f).includes(C.key)}])},[o.createElementVNode("div",O_,[o.createElementVNode("div",{class:o.normalizeClass(["px-2 bg-muted/80 dark:bg-background/80 border border-muted-foreground/20 rounded-b-md transition-all duration-300",{"pt-3 pb-2":!o.unref(f).includes(C.key)}])},[(o.openBlock(),o.createBlock(D,{key:`${C.key}-${JSON.stringify(C.form)}`,ref_for:!0,ref:"formDisplayer",settings:C.form,inputValues:o.unref(n)?.[C.key]||{},onSetOutput:L=>b(C.key,L),class:"bg-transparent"},null,8,["settings","inputValues","onSetOutput"]))],2)])],2)]))),128))])):o.createCommentVNode("",!0)]),o.createVNode(S,{open:o.unref(s),"onUpdate:open":[k[4]||(k[4]=C=>o.isRef(s)?s.value=C:null),c]},{default:o.withCtx(()=>[o.createVNode(H,{class:"sm:max-w-[425px]"},{default:o.withCtx(()=>[o.unref(l)==="add"?(o.openBlock(),o.createBlock(x,{key:0},{default:o.withCtx(()=>[o.createVNode(v,null,{default:o.withCtx(()=>[...k[5]||(k[5]=[o.createTextVNode("Add structured content section",-1)])]),_:1}),o.createVNode(E,null,{default:o.withCtx(()=>[...k[6]||(k[6]=[o.createTextVNode(" Add a new structured content section to this page. ",-1)])]),_:1})]),_:1})):(o.openBlock(),o.createBlock(x,{key:1},{default:o.withCtx(()=>[o.createVNode(v,null,{default:o.withCtx(()=>[...k[7]||(k[7]=[o.createTextVNode("Edit structured content section",-1)])]),_:1}),o.createVNode(E,null,{default:o.withCtx(()=>[...k[8]||(k[8]=[o.createTextVNode(" Edit the structured content section on this page. ",-1)])]),_:1})]),_:1})),o.createElementVNode("div",L_,[o.createElementVNode("div",z_,[o.createVNode(j,{for:"new-display-name"},{default:o.withCtx(()=>[...k[9]||(k[9]=[o.createTextVNode("Display Name (only visible in editor)",-1)])]),_:1}),o.createVNode(A,{id:"new-display-name",name:"new-display-name",modelValue:o.unref(d).displayName,"onUpdate:modelValue":k[0]||(k[0]=C=>o.unref(d).displayName=C)},null,8,["modelValue"])]),o.createElementVNode("div",I_,[o.createVNode(j,{for:"new-key"},{default:o.withCtx(()=>[...k[10]||(k[10]=[o.createTextVNode("Key (unique identifier)",-1)])]),_:1}),o.createElementVNode("div",P_,[o.createVNode(A,{id:"new-key",name:"new-key",modelValue:o.unref(d).key,"onUpdate:modelValue":k[1]||(k[1]=C=>o.unref(d).key=C)},null,8,["modelValue"]),o.unref(d).key!==o.unref(u)&&o.unref(i).find(C=>C.key===o.unref(d).key)?(o.openBlock(),o.createElementBlock("p",R_," A section with this key already exists. ")):o.createCommentVNode("",!0)])]),o.createElementVNode("div",$_,[o.createVNode(j,null,{default:o.withCtx(()=>[...k[11]||(k[11]=[o.createTextVNode("Form",-1)])]),_:1}),o.createVNode(M,{modelValue:o.unref(d).form,"onUpdate:modelValue":k[2]||(k[2]=C=>o.unref(d).form=C)},null,8,["modelValue"])])]),o.createVNode(N,null,{default:o.withCtx(()=>[o.createElementVNode("div",H_,[o.unref(l)==="edit"?(o.openBlock(),o.createBlock(w,{key:0,variant:"destructive",onClick:k[3]||(k[3]=C=>m())},{default:o.withCtx(()=>[...k[12]||(k[12]=[o.createTextVNode(" Delete Section ",-1)])]),_:1})):o.createCommentVNode("",!0),o.createElementVNode("div",W_,[o.createVNode(B,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(w,{variant:"outline"},{default:o.withCtx(()=>[...k[13]||(k[13]=[o.createTextVNode(" Cancel ",-1)])]),_:1})]),_:1}),o.unref(l)==="add"?(o.openBlock(),o.createBlock(w,{key:0,onClick:g,disabled:!o.unref(d).key||!o.unref(d).displayName||o.unref(i).find(C=>C.key===o.unref(d).key)},{default:o.withCtx(()=>[...k[14]||(k[14]=[o.createTextVNode(" Add Section ",-1)])]),_:1},8,["disabled"])):(o.openBlock(),o.createBlock(w,{key:1,onClick:_,disabled:!o.unref(d).key||!o.unref(d).displayName||o.unref(d).key!==o.unref(u)&&o.unref(i).find(C=>C.key===o.unref(d).key)},{default:o.withCtx(()=>[...k[15]||(k[15]=[o.createTextVNode(" Save Changes ",-1)])]),_:1},8,["disabled"]))])])]),_:1})]),_:1})]),_:1},8,["open"])],64)}}});function be(a){this.content=a}be.prototype={constructor:be,find:function(a){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===a)return e;return-1},get:function(a){var e=this.find(a);return e==-1?void 0:this.content[e+1]},update:function(a,e,t){var i=t&&t!=a?this.remove(t):this,n=i.find(a),r=i.content.slice();return n==-1?r.push(t||a,e):(r[n+1]=e,t&&(r[n]=t)),new be(r)},remove:function(a){var e=this.find(a);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new be(t)},addToStart:function(a,e){return new be([a,e].concat(this.remove(a).content))},addToEnd:function(a,e){var t=this.remove(a).content.slice();return t.push(a,e),new be(t)},addBefore:function(a,e,t){var i=this.remove(e),n=i.content.slice(),r=i.find(a);return n.splice(r==-1?n.length:r,0,e,t),new be(n)},forEach:function(a){for(var e=0;e<this.content.length;e+=2)a(this.content[e],this.content[e+1])},prepend:function(a){return a=be.from(a),a.size?new be(a.content.concat(this.subtract(a).content)):this},append:function(a){return a=be.from(a),a.size?new be(this.subtract(a).content.concat(a.content)):this},subtract:function(a){var e=this;a=be.from(a);for(var t=0;t<a.content.length;t+=2)e=e.remove(a.content[t]);return e},toObject:function(){var a={};return this.forEach(function(e,t){a[e]=t}),a},get size(){return this.content.length>>1}};be.from=function(a){if(a instanceof be)return a;var e=[];if(a)for(var t in a)e.push(t,a[t]);return new be(e)};function fd(a,e,t){for(let i=0;;i++){if(i==a.childCount||i==e.childCount)return a.childCount==e.childCount?null:t;let n=a.child(i),r=e.child(i);if(n==r){t+=n.nodeSize;continue}if(!n.sameMarkup(r))return t;if(n.isText&&n.text!=r.text){for(let s=0;n.text[s]==r.text[s];s++)t++;return t}if(n.content.size||r.content.size){let s=fd(n.content,r.content,t+1);if(s!=null)return s}t+=n.nodeSize}}function cd(a,e,t,i){for(let n=a.childCount,r=e.childCount;;){if(n==0||r==0)return n==r?null:{a:t,b:i};let s=a.child(--n),l=e.child(--r),u=s.nodeSize;if(s==l){t-=u,i-=u;continue}if(!s.sameMarkup(l))return{a:t,b:i};if(s.isText&&s.text!=l.text){let d=0,f=Math.min(s.text.length,l.text.length);for(;d<f&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,i--;return{a:t,b:i}}if(s.content.size||l.content.size){let d=cd(s.content,l.content,t-1,i-1);if(d)return d}t-=u,i-=u}}let V=class qe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,n=0,r){for(let s=0,l=0;l<t;s++){let u=this.content[s],d=l+u.nodeSize;if(d>e&&i(u,n+l,r||null,s)!==!1&&u.content.size){let f=l+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,t-f),i,n+f)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,n){let r="",s=!0;return this.nodesBetween(e,t,(l,u)=>{let d=l.isText?l.text.slice(Math.max(e,u)-u,t-u):l.isLeaf?n?typeof n=="function"?n(l):n:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&i&&(s?s=!1:r+=i),r+=d},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,n=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(i)&&(n[n.length-1]=t.withText(t.text+i.text),r=1);r<e.content.length;r++)n.push(e.content[r]);return new qe(n,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],n=0;if(t>e)for(let r=0,s=0;s<t;r++){let l=this.content[r],u=s+l.nodeSize;u>e&&((s<e||u>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),i.push(l),n+=l.nodeSize),s=u}return new qe(i,n)}cutByIndex(e,t){return e==t?qe.empty:e==0&&t==this.content.length?this:new qe(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let n=this.content.slice(),r=this.size+t.nodeSize-i.nodeSize;return n[e]=t,new qe(n,r)}addToStart(e){return new qe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new qe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let n=this.content[t];e(n,i,t),i+=n.nodeSize}}findDiffStart(e,t=0){return fd(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return cd(this,e,t,i)}findIndex(e){if(e==0)return Ui(0,e);if(e==this.size)return Ui(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,i=0;;t++){let n=this.child(t),r=i+n.nodeSize;if(r>=e)return r==e?Ui(t+1,r):Ui(t,i);i=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return qe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new qe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return qe.empty;let t,i=0;for(let n=0;n<e.length;n++){let r=e[n];i+=r.nodeSize,n&&r.isText&&e[n-1].sameMarkup(r)?(t||(t=e.slice(0,n)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new qe(t||e,i)}static from(e){if(!e)return qe.empty;if(e instanceof qe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new qe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};V.empty=new V([],0);const Vo={index:0,offset:0};function Ui(a,e){return Vo.index=a,Vo.offset=e,Vo}function kn(a,e){if(a===e)return!0;if(!(a&&typeof a=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(a);if(Array.isArray(e)!=t)return!1;if(t){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(!kn(a[i],e[i]))return!1}else{for(let i in a)if(!(i in e)||!kn(a[i],e[i]))return!1;for(let i in e)if(!(i in a))return!1}return!0}let ie=class hr{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let n=0;n<e.length;n++){let r=e[n];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,n));else{if(r.type.excludes(this.type))return e;!i&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,n)),t.push(this),i=!0),t&&t.push(r)}}return t||(t=e.slice()),i||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&kn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let n=i.create(t.attrs);return i.checkAttrs(n.attrs),n}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hr.none;if(e instanceof hr)return[e];let t=e.slice();return t.sort((i,n)=>i.type.rank-n.type.rank),t}};ie.none=[];let wn=class extends Error{},I=class Na{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=_d(this.content,e+this.openStart,t);return i&&new Na(i,this.openStart,this.openEnd)}removeBetween(e,t){return new Na(gd(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Na.empty;let i=t.openStart||0,n=t.openEnd||0;if(typeof i!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Na(V.fromJSON(e,t.content),i,n)}static maxOpen(e,t=!0){let i=0,n=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)i++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)n++;return new Na(e,i,n)}};I.empty=new I(V.empty,0,0);function gd(a,e,t){let{index:i,offset:n}=a.findIndex(e),r=a.maybeChild(i),{index:s,offset:l}=a.findIndex(t);if(n==e||r.isText){if(l!=t&&!a.child(s).isText)throw new RangeError("Removing non-flat range");return a.cut(0,e).append(a.cut(t))}if(i!=s)throw new RangeError("Removing non-flat range");return a.replaceChild(i,r.copy(gd(r.content,e-n-1,t-n-1)))}function _d(a,e,t,i){let{index:n,offset:r}=a.findIndex(e),s=a.maybeChild(n);if(r==e||s.isText)return i&&!i.canReplace(n,n,t)?null:a.cut(0,e).append(t).append(a.cut(e));let l=_d(s.content,e-r-1,t,s);return l&&a.replaceChild(n,s.copy(l))}function K_(a,e,t){if(t.openStart>a.depth)throw new wn("Inserted content deeper than insertion position");if(a.depth-t.openStart!=e.depth-t.openEnd)throw new wn("Inconsistent open depths");return hd(a,e,t,0)}function hd(a,e,t,i){let n=a.index(i),r=a.node(i);if(n==e.index(i)&&i<a.depth-t.openStart){let s=hd(a,e,t,i+1);return r.copy(r.content.replaceChild(n,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&a.depth==i&&e.depth==i){let s=a.parent,l=s.content;return Fa(s,l.cut(0,a.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J_(t,a);return Fa(r,Fd(a,s,l,e,i))}else return Fa(r,Dn(a,e,i))}function md(a,e){if(!e.type.compatibleContent(a.type))throw new wn("Cannot join "+e.type.name+" onto "+a.type.name)}function mr(a,e,t){let i=a.node(t);return md(i,e.node(t)),i}function ma(a,e){let t=e.length-1;t>=0&&a.isText&&a.sameMarkup(e[t])?e[t]=a.withText(e[t].text+a.text):e.push(a)}function ci(a,e,t,i){let n=(e||a).node(t),r=0,s=e?e.index(t):n.childCount;a&&(r=a.index(t),a.depth>t?r++:a.textOffset&&(ma(a.nodeAfter,i),r++));for(let l=r;l<s;l++)ma(n.child(l),i);e&&e.depth==t&&e.textOffset&&ma(e.nodeBefore,i)}function Fa(a,e){return a.type.checkContent(e),a.copy(e)}function Fd(a,e,t,i,n){let r=a.depth>n&&mr(a,e,n+1),s=i.depth>n&&mr(t,i,n+1),l=[];return ci(null,a,n,l),r&&s&&e.index(n)==t.index(n)?(md(r,s),ma(Fa(r,Fd(a,e,t,i,n+1)),l)):(r&&ma(Fa(r,Dn(a,e,n+1)),l),ci(e,t,n,l),s&&ma(Fa(s,Dn(t,i,n+1)),l)),ci(i,null,n,l),new V(l)}function Dn(a,e,t){let i=[];if(ci(null,a,t,i),a.depth>t){let n=mr(a,e,t+1);ma(Fa(n,Dn(a,e,t+1)),i)}return ci(e,null,t,i),new V(i)}function J_(a,e){let t=e.depth-a.openStart,n=e.node(t).copy(a.content);for(let r=t-1;r>=0;r--)n=e.node(r).copy(V.from(n));return{start:n.resolveNoCache(a.openStart+t),end:n.resolveNoCache(n.content.size-a.openEnd-t)}}class Ci{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],n=e.child(t);return i?e.child(t).cut(i):n}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let i=this.path[t*3],n=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)n+=i.child(r).nodeSize;return n}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ie.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),n=e.maybeChild(t);if(!i){let l=i;i=n,n=l}let r=i.marks;for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!n||!r[s].isInSet(n.marks))&&(r=r[s--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,n=e.parent.maybeChild(e.index());for(var r=0;r<i.length;r++)i[r].type.spec.inclusive===!1&&(!n||!i[r].isInSet(n.marks))&&(i=i[r--].removeFromSet(i));return i}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new vn(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let i=[],n=0,r=t;for(let s=e;;){let{index:l,offset:u}=s.content.findIndex(r),d=r-u;if(i.push(s,l,n+u),!d||(s=s.child(l),s.isText))break;r=d-1,n+=u+1}return new Ci(t,i,r)}static resolveCached(e,t){let i=ml.get(e);if(i)for(let r=0;r<i.elts.length;r++){let s=i.elts[r];if(s.pos==t)return s}else ml.set(e,i=new G_);let n=i.elts[i.i]=Ci.resolve(e,t);return i.i=(i.i+1)%Y_,n}}class G_{constructor(){this.elts=[],this.i=0}}const Y_=12,ml=new WeakMap;class vn{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const X_=Object.create(null);let Wt=class Fr{constructor(e,t,i,n=ie.none){this.type=e,this.attrs=t,this.marks=n,this.content=i||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,i,n=0){this.content.nodesBetween(e,t,i,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,i,n){return this.content.textBetween(e,t,i,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,i){return this.type==e&&kn(this.attrs,t||e.defaultAttrs||X_)&&ie.sameSet(this.marks,i||ie.none)}copy(e=null){return e==this.content?this:new Fr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fr(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,i=!1){if(e==t)return I.empty;let n=this.resolve(e),r=this.resolve(t),s=i?0:n.sharedDepth(t),l=n.start(s),d=n.node(s).content.cut(n.pos-l,r.pos-l);return new I(d,n.depth-s,r.depth-s)}replace(e,t,i){return K_(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:n}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(n==e||t.isText)return t;e-=n+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let n=this.content.child(t-1);return{node:n,index:t-1,offset:i-n.nodeSize}}resolve(e){return Ci.resolveCached(this,e)}resolveNoCache(e){return Ci.resolve(this,e)}rangeHasMark(e,t,i){let n=!1;return t>e&&this.nodesBetween(e,t,r=>(i.isInSet(r.marks)&&(n=!0),!n)),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),pd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,i=V.empty,n=0,r=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,n,r),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let u=n;u<r;u++)if(!this.type.allowsMarks(i.child(u).marks))return!1;return!0}canReplaceWith(e,t,i,n){if(n&&!this.type.allowsMarks(n))return!1;let r=this.contentMatchAt(e).matchType(i),s=r&&r.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ie.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!ie.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,i)}let n=V.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,n,i);return r.type.checkAttrs(r.attrs),r}};Wt.prototype.text=void 0;class En extends Wt{constructor(e,t,i,n){if(super(e,t,null,n),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new En(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new En(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function pd(a,e){for(let t=a.length-1;t>=0;t--)e=a[t].type.name+"("+e+")";return e}class ka{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new Q_(e,t);if(i.next==null)return ka.empty;let n=bd(i);i.next&&i.err("Unexpected trailing text");let r=o1(n1(n));return r1(r,i),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,i=e.childCount){let n=this;for(let r=t;n&&r<i;r++)n=n.matchType(e.child(r).type);return n}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let n=[this];function r(s,l){let u=s.matchFragment(e,i);if(u&&(!t||u.validEnd))return V.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:f,next:c}=s.next[d];if(!(f.isText||f.hasRequiredAttrs())&&n.indexOf(c)==-1){n.push(c);let g=r(c,l.concat(f));if(g)return g}}return null}return r(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let n=i.shift(),r=n.match;if(r.matchType(e)){let s=[];for(let l=n;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<r.next.length;s++){let{type:l,next:u}=r.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!n.type||u.validEnd)&&(i.push({match:l.contentMatch,type:l,via:n}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(i){e.push(i);for(let n=0;n<i.next.length;n++)e.indexOf(i.next[n].next)==-1&&t(i.next[n].next)}return t(this),e.map((i,n)=>{let r=n+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)r+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return r}).join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),Pe=require("@oneclick.dev/cms-kit"),xi=require("./interpolation-CsOrww73.js"),q=require("lucide-vue-next"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.js"),hl=require("./utils-D6CaKJbp.js"),ud=require("./index-4tjmIans.js"),r_=require("./google-D4N3gb01.js"),s_={class:"flex flex-wrap gap-1"},l_={key:0,class:"font-medium"},u_={key:1,class:"font-medium"},d_={key:2,class:"font-medium"},f_={key:3,class:"font-medium"},c_=o.defineComponent({__name:"Status",setup(a){const e=o.inject("status",o.ref(""));return(t,i)=>(o.openBlock(),o.createElementBlock("p",s_,[o.unref(e)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[i[0]||(i[0]=o.createElementVNode("span",{class:"opacity-70"},"Status:",-1)),i[1]||(i[1]=o.createTextVNode(" "+o.toDisplayString(" ")+" ",-1)),o.unref(e)==="new"?(o.openBlock(),o.createElementBlock("strong",l_,"New Draft")):o.createCommentVNode("",!0),o.unref(e)==="draft"?(o.openBlock(),o.createElementBlock("strong",u_,"Draft")):o.createCommentVNode("",!0),o.unref(e)==="archived"?(o.openBlock(),o.createElementBlock("strong",d_,"Archived")):o.unref(e)==="published"?(o.openBlock(),o.createElementBlock("strong",f_,"Published")):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0)]))}}),g_={class:"flex flex-col"},__={class:"flex justify-between items-center p-3 xl:p-4"},h_={class:"relative group min-w-[320px] @2xl:min-w-[500px] max-w-4xl"},m_={class:"pl-4 pr-6 py-2 -ml-1.5 -my-2 rounded text-2xl pointer-events-none opacity-0 select-none whitespace-nowrap overflow-hidden"},F_={class:"flex items-center justify-between gap-12 bg-input/30 pl-2 xl:pl-5 pr-3 xl:pr-4 py-3 xl:py-4 border-y"},p_={class:"flex gap-4 xl:gap-6 text-sm"},b_={key:0,class:"flex flex-wrap gap-1"},y_={class:"font-medium"},k_={key:1,class:"flex flex-wrap gap-1"},w_={class:"font-medium"},D_={class:"flex gap-2"},v_={class:"flex"},E_={key:0},x_={key:0},C_={key:0},B_=o.defineComponent({__name:"Header",props:{config:{type:Object,required:!0},createdAt:{type:Date,required:!0},updatedAt:{type:Date,required:!1},liveByLocale:{type:Array,default:()=>[]}},emits:["saveDraft","publishEntry","unpublishEntry","archiveEntry","unarchiveToDrafts","publishAllEntries","deleteEntry","previewEntry"],setup(a,{emit:e}){const t=e,i=o.inject("activeView",o.ref("edit")),n=o.inject("status",o.ref("")),r=o.inject("entryId",o.ref("")),s=o.inject("activeEntryVersion",o.ref("")),l=o.inject("isSaving",o.ref(!1)),u=o.inject("title",o.ref("")),d=o.ref(u.value);function f(){u.value=d.value}return(c,g)=>{const _=o.resolveComponent("SegmentedControlButton"),h=o.resolveComponent("SegmentedControl"),m=o.resolveComponent("Button"),F=o.resolveComponent("DropdownMenuTrigger"),p=o.resolveComponent("DropdownMenuItem"),b=o.resolveComponent("DropdownMenuGroup"),y=o.resolveComponent("DropdownMenuContent"),k=o.resolveComponent("DropdownMenu");return o.openBlock(),o.createElementBlock("div",g_,[o.createElementVNode("div",__,[o.createElementVNode("div",h_,[o.createElementVNode("p",m_,o.toDisplayString(o.unref(u)||"Please enter a title"),1),o.withDirectives(o.createElementVNode("input",{class:"absolute w-[calc(100%+1rem)] top-0 pl-4 pr-6 py-2 -ml-1.5 -my-2 rounded text-2xl group-hover:bg-input/30 focus:bg-input/50 focus-visible:outline-0 focus-visible:ring-1 focus-visible:ring-ring/50","onUpdate:modelValue":g[0]||(g[0]=w=>o.isRef(u)?u.value=w:null),onFocus:g[1]||(g[1]=w=>d.value=o.unref(u)),onKeydown:o.withKeys(f,["esc"]),placeholder:"Please enter a title"},null,544),[[o.vModelText,o.unref(u)]])]),o.createElementVNode("div",null,[o.unref(r)?(o.openBlock(),o.createBlock(h,{key:0,modelValue:o.unref(i),"onUpdate:modelValue":g[2]||(g[2]=w=>o.isRef(i)?i.value=w:null),"allow-empty":""},{default:o.withCtx(()=>[o.createVNode(_,{value:"edit"},{default:o.withCtx(()=>[...g[13]||(g[13]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"Edit",-1)])]),_:1}),o.createVNode(_,{value:"preview"},{default:o.withCtx(()=>[...g[14]||(g[14]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"Live Preview",-1)])]),_:1}),o.unref(r)!=="new"&&o.unref(s)?(o.openBlock(),o.createBlock(_,{key:0,value:"versions"},{default:o.withCtx(()=>[...g[15]||(g[15]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"Versions",-1)])]),_:1})):o.createCommentVNode("",!0),o.createVNode(_,{value:"api"},{default:o.withCtx(()=>[...g[16]||(g[16]=[o.createElementVNode("span",{class:"block whitespace-nowrap"},"API",-1)])]),_:1})]),_:1},8,["modelValue"])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",F_,[o.createElementVNode("div",p_,[o.createVNode(c_),o.unref(n)!=="new"&&a.updatedAt?(o.openBlock(),o.createElementBlock("p",b_,[g[17]||(g[17]=o.createElementVNode("span",{class:"opacity-70"},"Last Modified:",-1)),g[18]||(g[18]=o.createTextVNode()),o.createElementVNode("strong",y_,o.toDisplayString(new Date(a.updatedAt)?.toLocaleString()),1)])):o.createCommentVNode("",!0),o.unref(n)!=="new"&&a.createdAt?(o.openBlock(),o.createElementBlock("p",k_,[g[19]||(g[19]=o.createElementVNode("span",{class:"opacity-70"},"Created:",-1)),g[20]||(g[20]=o.createTextVNode()),o.createElementVNode("strong",w_,o.toDisplayString(new Date(a.createdAt)?.toLocaleString()),1)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",D_,[o.createVNode(m,{variant:"secondary",class:"border bg-white hover:bg-white dark:bg-transparent dark:hover:bg-muted/20",onClick:g[3]||(g[3]=w=>t("previewEntry"))},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Link),{class:"size-4"}),g[21]||(g[21]=o.createTextVNode(" Preview ",-1))]),_:1}),o.createElementVNode("div",v_,[o.unref(n)==="published"?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(m,{class:"rounded-r-none",onClick:g[4]||(g[4]=w=>t("publishEntry"))},{default:o.withCtx(()=>[o.unref(l)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(q.Loader2),{class:"size-4 animate-spin ml-2"}),g[22]||(g[22]=o.createElementVNode("span",null,"Publishing...",-1))],64)):(o.openBlock(),o.createElementBlock("span",E_,"Publish changes"))]),_:1}),g[25]||(g[25]=o.createElementVNode("div",{class:"w-[1px] h-full bg-muted/30"},null,-1)),o.createVNode(k,null,{default:o.withCtx(()=>[o.createVNode(F,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(m,{class:"rounded-l-none",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ChevronDown),{class:"size-4"})]),_:1})]),_:1}),o.createVNode(y,{class:"w-56"},{default:o.withCtx(()=>[o.createVNode(b,null,{default:o.withCtx(()=>[o.createVNode(p,{onClick:g[5]||(g[5]=w=>t("unpublishEntry"))},{default:o.withCtx(()=>[...g[23]||(g[23]=[o.createTextVNode("Unpublish (draft)",-1)])]),_:1}),o.createVNode(p,{onClick:g[6]||(g[6]=w=>t("archiveEntry"))},{default:o.withCtx(()=>[...g[24]||(g[24]=[o.createTextVNode("Archive",-1)])]),_:1})]),_:1})]),_:1})]),_:1})],64)):o.unref(n)==="archived"?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(m,{class:"rounded-r-none",onClick:g[7]||(g[7]=w=>t("unarchiveToDrafts"))},{default:o.withCtx(()=>[o.unref(l)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(q.Loader2),{class:"size-4 animate-spin ml-2"}),g[26]||(g[26]=o.createElementVNode("span",null,"Unarchiving...",-1))],64)):(o.openBlock(),o.createElementBlock("span",x_,"Unarchive (to Drafts)"))]),_:1}),g[29]||(g[29]=o.createElementVNode("div",{class:"w-[1px] h-full bg-muted/30"},null,-1)),o.createVNode(k,null,{default:o.withCtx(()=>[o.createVNode(F,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(m,{class:"rounded-l-none",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ChevronDown),{class:"size-4"})]),_:1})]),_:1}),o.createVNode(y,{class:"w-56"},{default:o.withCtx(()=>[o.createVNode(b,null,{default:o.withCtx(()=>[o.createVNode(p,{onClick:g[8]||(g[8]=w=>t("publishAllEntries"))},{default:o.withCtx(()=>[...g[27]||(g[27]=[o.createTextVNode("Publish all",-1)])]),_:1}),o.createVNode(p,{onClick:g[9]||(g[9]=w=>t("deleteEntry"))},{default:o.withCtx(()=>[...g[28]||(g[28]=[o.createTextVNode("Delete completely",-1)])]),_:1})]),_:1})]),_:1})]),_:1})],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:2},[o.createVNode(m,{class:o.normalizeClass({"rounded-r-none":o.unref(n)!=="new"||a.config?.supportedLanguages?.length===1}),onClick:g[10]||(g[10]=w=>t("saveDraft"))},{default:o.withCtx(()=>[o.unref(l)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(q.Loader2),{class:"size-4 animate-spin ml-2"}),g[30]||(g[30]=o.createElementVNode("span",null,"Saving...",-1))],64)):(o.openBlock(),o.createElementBlock("span",C_,"Save draft"))]),_:1},8,["class"]),g[33]||(g[33]=o.createElementVNode("div",{class:"w-[1px] h-full bg-muted/30"},null,-1)),o.unref(n)!=="new"||a.config?.supportedLanguages?.length===1?(o.openBlock(),o.createBlock(k,{key:0},{default:o.withCtx(()=>[o.createVNode(F,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(m,{class:"rounded-l-none",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ChevronDown),{class:"size-4"})]),_:1})]),_:1}),o.createVNode(y,{class:"w-56"},{default:o.withCtx(()=>[o.createVNode(b,null,{default:o.withCtx(()=>[o.createVNode(p,{onClick:g[11]||(g[11]=w=>t("publishEntry"))},{default:o.withCtx(()=>[...g[31]||(g[31]=[o.createTextVNode("Publish now",-1)])]),_:1}),a.liveByLocale?.length>0?(o.openBlock(),o.createBlock(p,{key:0,onClick:g[12]||(g[12]=w=>t("archiveEntry"))},{default:o.withCtx(()=>[...g[32]||(g[32]=[o.createTextVNode("Archive",-1)])]),_:1})):o.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1})):o.createCommentVNode("",!0)],64))])])])])}}}),S_={key:0,class:"border-b px-2 xl:px-4 py-4"},dd=o.defineComponent({__name:"ContentSettings",props:{customSettings:{type:Object,required:!0},inputValues:{type:Object,default:()=>({})}},setup(a){const e=o.inject("customSettingsOutput",o.ref(null)),t=i=>{e.value=i};return(i,n)=>{const r=o.resolveComponent("FormDisplayer");return a.customSettings?.layout?(o.openBlock(),o.createElementBlock("div",S_,[o.createVNode(r,{ref:"formDisplayer",settings:a.customSettings,inputValues:a.inputValues,onSetOutput:t},null,8,["settings","inputValues"])])):o.createCommentVNode("",!0)}}}),j_={class:"bg-muted/50"},N_={key:0,class:"flex items-center justify-between p-4"},q_={class:"flex gap-2"},A_={key:1,class:"grid gap-2 px-2 my-4"},T_={class:"relative flex items-center justify-between px-4 py-2 bg-white dark:bg-muted rounded-md border border-muted-foreground/20 z-2"},M_=["onClick"],V_={key:0,class:"flex items-center"},O_={class:"overflow-hidden"},L_={class:"grid gap-4 mb-2"},z_={class:"grid gap-3"},I_={class:"grid gap-3"},P_={class:"grid gap-1"},R_={key:0,class:"text-red-500 text-xs"},$_={class:"grid gap-3"},H_={class:"flex justify-between gap-2 w-full"},W_={class:"flex gap-2 ml-auto"},U_=o.defineComponent({__name:"ContentStructuredContentSections",setup(a){const{isAdmin:e}=Pe.useModulePermissions(),{confirm:t}=Pe.useConfirmation(),i=o.inject("structuredContentSections",o.ref([])),n=o.inject("structuredContentInput",o.ref(null)),r=o.inject("structuredContentOutput",o.ref(null)),s=o.ref(!1),l=o.ref("add"),u=o.ref(null),d=o.reactive({displayName:"",key:"",form:null}),f=o.ref([]);o.watch(()=>d.displayName,(y,k)=>{let w=k.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,""),D=y.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9\-]/g,"");(d.key===w||d.key==="")&&(d.key=D)});const c=y=>{y||(d.displayName="",d.key="",d.form=null)},g=()=>{i.value.push({displayName:d.displayName,key:d.key,form:d.form?JSON.parse(JSON.stringify(d.form)):null}),s.value=!1,c(!1)},_=()=>{const y=i.value.findIndex(k=>k.key===u.value);if(y!==-1){if(d.key!==u.value){const k=f.value.indexOf(u.value);k!==-1&&f.value.splice(k,1,d.key),r.value&&typeof r.value=="object"&&u.value&&r.value.hasOwnProperty(u.value)&&(r.value[d.key]=r.value[u.value],delete r.value[u.value]),n.value=r.value?JSON.parse(JSON.stringify(r.value)):{}}i.value[y]={displayName:d.displayName,key:d.key,form:d.form?JSON.parse(JSON.stringify(d.form)):null}}s.value=!1,c(!1)},h=(y,k)=>{const w=y+k;if(w<0||w>=i.value.length)return;const D=i.value[y];i.value.splice(y,1),i.value.splice(w,0,D)},m=async()=>{if(!await t("Are you sure you want to delete this section? This action cannot be undone."))return;const k=i.value.findIndex(w=>w.key===u.value);k!==-1&&i.value.splice(k,1),s.value=!1,c(!1)},F=()=>{s.value=!0,l.value="add"},p=y=>{s.value=!0,l.value="edit",u.value=y.key,d.displayName=y.displayName,d.key=y.key,d.form=y.form?JSON.parse(JSON.stringify(y.form)):null},b=(y,k)=>{(!r.value||typeof r.value!="object")&&(r.value={}),r.value[y]=k};return(y,k)=>{const w=o.resolveComponent("Button"),D=o.resolveComponent("FormDisplayer"),v=o.resolveComponent("DialogTitle"),E=o.resolveComponent("DialogDescription"),x=o.resolveComponent("DialogHeader"),j=o.resolveComponent("Label"),A=o.resolveComponent("Input"),M=o.resolveComponent("FormBuilderSelect"),B=o.resolveComponent("DialogClose"),N=o.resolveComponent("DialogFooter"),H=o.resolveComponent("DialogContent"),S=o.resolveComponent("Dialog");return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",j_,[o.unref(e)()?(o.openBlock(),o.createElementBlock("div",N_,[o.createElementVNode("p",{class:o.normalizeClass({"opacity-40":!o.unref(i).length,"text-primary":o.unref(i).length})}," Structured content sections ("+o.toDisplayString(o.unref(i).length)+") ",3),o.createElementVNode("div",q_,[o.createVNode(w,{variant:"ghost",size:"icon",onClick:F},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Plus),{class:"size-4 text-primary"})]),_:1}),o.createVNode(w,{variant:"ghost",size:"icon"},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Braces),{class:"size-4 text-primary"})]),_:1})])])):o.createCommentVNode("",!0),o.unref(i).length>0?(o.openBlock(),o.createElementBlock("div",A_,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(i),(C,W)=>(o.openBlock(),o.createElementBlock("div",{key:C.key},[o.createElementVNode("div",T_,[o.createElementVNode("p",{class:"select-none cursor-default hover:bg-background/15 px-3 py-1.5 rounded -ml-3",onClick:L=>o.unref(f).includes(C.key)?o.unref(f).splice(o.unref(f).indexOf(C.key),1):o.unref(f).push(C.key)},o.toDisplayString(C.displayName||C.key),9,M_),o.unref(e)()?(o.openBlock(),o.createElementBlock("div",V_,[o.createVNode(w,{variant:"ghost",size:"icon",disabled:W===0,onClick:L=>h(W,-1)},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ArrowUp),{class:"size-4"})]),_:1},8,["disabled","onClick"]),o.createVNode(w,{variant:"ghost",size:"icon",disabled:W===o.unref(i).length-1,onClick:L=>h(W,1)},{default:o.withCtx(()=>[o.createVNode(o.unref(q.ArrowDown),{class:"size-4"})]),_:1},8,["disabled","onClick"]),o.createVNode(w,{variant:"ghost",size:"icon",onClick:L=>p(C)},{default:o.withCtx(()=>[o.createVNode(o.unref(q.Cog),{class:"size-4"})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),o.createElementVNode("div",{class:o.normalizeClass(["relative grid transition-all duration-300 z-1 -translate-y-1",{"grid-rows-[1fr]":!o.unref(f).includes(C.key),"grid-rows-[0fr]":o.unref(f).includes(C.key)}])},[o.createElementVNode("div",O_,[o.createElementVNode("div",{class:o.normalizeClass(["px-2 bg-muted/80 dark:bg-background/80 border border-muted-foreground/20 rounded-b-md transition-all duration-300",{"pt-3 pb-2":!o.unref(f).includes(C.key)}])},[(o.openBlock(),o.createBlock(D,{key:`${C.key}-${JSON.stringify(C.form)}`,ref_for:!0,ref:"formDisplayer",settings:C.form,inputValues:o.unref(n)?.[C.key]||{},onSetOutput:L=>b(C.key,L),class:"bg-transparent"},null,8,["settings","inputValues","onSetOutput"]))],2)])],2)]))),128))])):o.createCommentVNode("",!0)]),o.createVNode(S,{open:o.unref(s),"onUpdate:open":[k[4]||(k[4]=C=>o.isRef(s)?s.value=C:null),c]},{default:o.withCtx(()=>[o.createVNode(H,{class:"sm:max-w-[425px]"},{default:o.withCtx(()=>[o.unref(l)==="add"?(o.openBlock(),o.createBlock(x,{key:0},{default:o.withCtx(()=>[o.createVNode(v,null,{default:o.withCtx(()=>[...k[5]||(k[5]=[o.createTextVNode("Add structured content section",-1)])]),_:1}),o.createVNode(E,null,{default:o.withCtx(()=>[...k[6]||(k[6]=[o.createTextVNode(" Add a new structured content section to this page. ",-1)])]),_:1})]),_:1})):(o.openBlock(),o.createBlock(x,{key:1},{default:o.withCtx(()=>[o.createVNode(v,null,{default:o.withCtx(()=>[...k[7]||(k[7]=[o.createTextVNode("Edit structured content section",-1)])]),_:1}),o.createVNode(E,null,{default:o.withCtx(()=>[...k[8]||(k[8]=[o.createTextVNode(" Edit the structured content section on this page. ",-1)])]),_:1})]),_:1})),o.createElementVNode("div",L_,[o.createElementVNode("div",z_,[o.createVNode(j,{for:"new-display-name"},{default:o.withCtx(()=>[...k[9]||(k[9]=[o.createTextVNode("Display Name (only visible in editor)",-1)])]),_:1}),o.createVNode(A,{id:"new-display-name",name:"new-display-name",modelValue:o.unref(d).displayName,"onUpdate:modelValue":k[0]||(k[0]=C=>o.unref(d).displayName=C)},null,8,["modelValue"])]),o.createElementVNode("div",I_,[o.createVNode(j,{for:"new-key"},{default:o.withCtx(()=>[...k[10]||(k[10]=[o.createTextVNode("Key (unique identifier)",-1)])]),_:1}),o.createElementVNode("div",P_,[o.createVNode(A,{id:"new-key",name:"new-key",modelValue:o.unref(d).key,"onUpdate:modelValue":k[1]||(k[1]=C=>o.unref(d).key=C)},null,8,["modelValue"]),o.unref(d).key!==o.unref(u)&&o.unref(i).find(C=>C.key===o.unref(d).key)?(o.openBlock(),o.createElementBlock("p",R_," A section with this key already exists. ")):o.createCommentVNode("",!0)])]),o.createElementVNode("div",$_,[o.createVNode(j,null,{default:o.withCtx(()=>[...k[11]||(k[11]=[o.createTextVNode("Form",-1)])]),_:1}),o.createVNode(M,{modelValue:o.unref(d).form,"onUpdate:modelValue":k[2]||(k[2]=C=>o.unref(d).form=C)},null,8,["modelValue"])])]),o.createVNode(N,null,{default:o.withCtx(()=>[o.createElementVNode("div",H_,[o.unref(l)==="edit"?(o.openBlock(),o.createBlock(w,{key:0,variant:"destructive",onClick:k[3]||(k[3]=C=>m())},{default:o.withCtx(()=>[...k[12]||(k[12]=[o.createTextVNode(" Delete Section ",-1)])]),_:1})):o.createCommentVNode("",!0),o.createElementVNode("div",W_,[o.createVNode(B,{"as-child":""},{default:o.withCtx(()=>[o.createVNode(w,{variant:"outline"},{default:o.withCtx(()=>[...k[13]||(k[13]=[o.createTextVNode(" Cancel ",-1)])]),_:1})]),_:1}),o.unref(l)==="add"?(o.openBlock(),o.createBlock(w,{key:0,onClick:g,disabled:!o.unref(d).key||!o.unref(d).displayName||o.unref(i).find(C=>C.key===o.unref(d).key)},{default:o.withCtx(()=>[...k[14]||(k[14]=[o.createTextVNode(" Add Section ",-1)])]),_:1},8,["disabled"])):(o.openBlock(),o.createBlock(w,{key:1,onClick:_,disabled:!o.unref(d).key||!o.unref(d).displayName||o.unref(d).key!==o.unref(u)&&o.unref(i).find(C=>C.key===o.unref(d).key)},{default:o.withCtx(()=>[...k[15]||(k[15]=[o.createTextVNode(" Save Changes ",-1)])]),_:1},8,["disabled"]))])])]),_:1})]),_:1})]),_:1},8,["open"])],64)}}});function be(a){this.content=a}be.prototype={constructor:be,find:function(a){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===a)return e;return-1},get:function(a){var e=this.find(a);return e==-1?void 0:this.content[e+1]},update:function(a,e,t){var i=t&&t!=a?this.remove(t):this,n=i.find(a),r=i.content.slice();return n==-1?r.push(t||a,e):(r[n+1]=e,t&&(r[n]=t)),new be(r)},remove:function(a){var e=this.find(a);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new be(t)},addToStart:function(a,e){return new be([a,e].concat(this.remove(a).content))},addToEnd:function(a,e){var t=this.remove(a).content.slice();return t.push(a,e),new be(t)},addBefore:function(a,e,t){var i=this.remove(e),n=i.content.slice(),r=i.find(a);return n.splice(r==-1?n.length:r,0,e,t),new be(n)},forEach:function(a){for(var e=0;e<this.content.length;e+=2)a(this.content[e],this.content[e+1])},prepend:function(a){return a=be.from(a),a.size?new be(a.content.concat(this.subtract(a).content)):this},append:function(a){return a=be.from(a),a.size?new be(this.subtract(a).content.concat(a.content)):this},subtract:function(a){var e=this;a=be.from(a);for(var t=0;t<a.content.length;t+=2)e=e.remove(a.content[t]);return e},toObject:function(){var a={};return this.forEach(function(e,t){a[e]=t}),a},get size(){return this.content.length>>1}};be.from=function(a){if(a instanceof be)return a;var e=[];if(a)for(var t in a)e.push(t,a[t]);return new be(e)};function fd(a,e,t){for(let i=0;;i++){if(i==a.childCount||i==e.childCount)return a.childCount==e.childCount?null:t;let n=a.child(i),r=e.child(i);if(n==r){t+=n.nodeSize;continue}if(!n.sameMarkup(r))return t;if(n.isText&&n.text!=r.text){for(let s=0;n.text[s]==r.text[s];s++)t++;return t}if(n.content.size||r.content.size){let s=fd(n.content,r.content,t+1);if(s!=null)return s}t+=n.nodeSize}}function cd(a,e,t,i){for(let n=a.childCount,r=e.childCount;;){if(n==0||r==0)return n==r?null:{a:t,b:i};let s=a.child(--n),l=e.child(--r),u=s.nodeSize;if(s==l){t-=u,i-=u;continue}if(!s.sameMarkup(l))return{a:t,b:i};if(s.isText&&s.text!=l.text){let d=0,f=Math.min(s.text.length,l.text.length);for(;d<f&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,i--;return{a:t,b:i}}if(s.content.size||l.content.size){let d=cd(s.content,l.content,t-1,i-1);if(d)return d}t-=u,i-=u}}let V=class qe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let i=0;i<e.length;i++)this.size+=e[i].nodeSize}nodesBetween(e,t,i,n=0,r){for(let s=0,l=0;l<t;s++){let u=this.content[s],d=l+u.nodeSize;if(d>e&&i(u,n+l,r||null,s)!==!1&&u.content.size){let f=l+1;u.nodesBetween(Math.max(0,e-f),Math.min(u.content.size,t-f),i,n+f)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,i,n){let r="",s=!0;return this.nodesBetween(e,t,(l,u)=>{let d=l.isText?l.text.slice(Math.max(e,u)-u,t-u):l.isLeaf?n?typeof n=="function"?n(l):n:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&i&&(s?s=!1:r+=i),r+=d},0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,i=e.firstChild,n=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(i)&&(n[n.length-1]=t.withText(t.text+i.text),r=1);r<e.content.length;r++)n.push(e.content[r]);return new qe(n,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let i=[],n=0;if(t>e)for(let r=0,s=0;s<t;r++){let l=this.content[r],u=s+l.nodeSize;u>e&&((s<e||u>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),i.push(l),n+=l.nodeSize),s=u}return new qe(i,n)}cutByIndex(e,t){return e==t?qe.empty:e==0&&t==this.content.length?this:new qe(this.content.slice(e,t))}replaceChild(e,t){let i=this.content[e];if(i==t)return this;let n=this.content.slice(),r=this.size+t.nodeSize-i.nodeSize;return n[e]=t,new qe(n,r)}addToStart(e){return new qe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new qe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,i=0;t<this.content.length;t++){let n=this.content[t];e(n,i,t),i+=n.nodeSize}}findDiffStart(e,t=0){return fd(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return cd(this,e,t,i)}findIndex(e){if(e==0)return Ui(0,e);if(e==this.size)return Ui(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,i=0;;t++){let n=this.child(t),r=i+n.nodeSize;if(r>=e)return r==e?Ui(t+1,r):Ui(t,i);i=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return qe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new qe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return qe.empty;let t,i=0;for(let n=0;n<e.length;n++){let r=e[n];i+=r.nodeSize,n&&r.isText&&e[n-1].sameMarkup(r)?(t||(t=e.slice(0,n)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new qe(t||e,i)}static from(e){if(!e)return qe.empty;if(e instanceof qe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new qe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};V.empty=new V([],0);const Vo={index:0,offset:0};function Ui(a,e){return Vo.index=a,Vo.offset=e,Vo}function kn(a,e){if(a===e)return!0;if(!(a&&typeof a=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(a);if(Array.isArray(e)!=t)return!1;if(t){if(a.length!=e.length)return!1;for(let i=0;i<a.length;i++)if(!kn(a[i],e[i]))return!1}else{for(let i in a)if(!(i in e)||!kn(a[i],e[i]))return!1;for(let i in e)if(!(i in a))return!1}return!0}let ie=class hr{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,i=!1;for(let n=0;n<e.length;n++){let r=e[n];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,n));else{if(r.type.excludes(this.type))return e;!i&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,n)),t.push(this),i=!0),t&&t.push(r)}}return t||(t=e.slice()),i||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&kn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let i=e.marks[t.type];if(!i)throw new RangeError(`There is no mark type ${t.type} in this schema`);let n=i.create(t.attrs);return i.checkAttrs(n.attrs),n}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!e[i].eq(t[i]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return hr.none;if(e instanceof hr)return[e];let t=e.slice();return t.sort((i,n)=>i.type.rank-n.type.rank),t}};ie.none=[];let wn=class extends Error{},I=class Na{constructor(e,t,i){this.content=e,this.openStart=t,this.openEnd=i}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let i=_d(this.content,e+this.openStart,t);return i&&new Na(i,this.openStart,this.openEnd)}removeBetween(e,t){return new Na(gd(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Na.empty;let i=t.openStart||0,n=t.openEnd||0;if(typeof i!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Na(V.fromJSON(e,t.content),i,n)}static maxOpen(e,t=!0){let i=0,n=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)i++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)n++;return new Na(e,i,n)}};I.empty=new I(V.empty,0,0);function gd(a,e,t){let{index:i,offset:n}=a.findIndex(e),r=a.maybeChild(i),{index:s,offset:l}=a.findIndex(t);if(n==e||r.isText){if(l!=t&&!a.child(s).isText)throw new RangeError("Removing non-flat range");return a.cut(0,e).append(a.cut(t))}if(i!=s)throw new RangeError("Removing non-flat range");return a.replaceChild(i,r.copy(gd(r.content,e-n-1,t-n-1)))}function _d(a,e,t,i){let{index:n,offset:r}=a.findIndex(e),s=a.maybeChild(n);if(r==e||s.isText)return i&&!i.canReplace(n,n,t)?null:a.cut(0,e).append(t).append(a.cut(e));let l=_d(s.content,e-r-1,t,s);return l&&a.replaceChild(n,s.copy(l))}function K_(a,e,t){if(t.openStart>a.depth)throw new wn("Inserted content deeper than insertion position");if(a.depth-t.openStart!=e.depth-t.openEnd)throw new wn("Inconsistent open depths");return hd(a,e,t,0)}function hd(a,e,t,i){let n=a.index(i),r=a.node(i);if(n==e.index(i)&&i<a.depth-t.openStart){let s=hd(a,e,t,i+1);return r.copy(r.content.replaceChild(n,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&a.depth==i&&e.depth==i){let s=a.parent,l=s.content;return Fa(s,l.cut(0,a.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J_(t,a);return Fa(r,Fd(a,s,l,e,i))}else return Fa(r,Dn(a,e,i))}function md(a,e){if(!e.type.compatibleContent(a.type))throw new wn("Cannot join "+e.type.name+" onto "+a.type.name)}function mr(a,e,t){let i=a.node(t);return md(i,e.node(t)),i}function ma(a,e){let t=e.length-1;t>=0&&a.isText&&a.sameMarkup(e[t])?e[t]=a.withText(e[t].text+a.text):e.push(a)}function ci(a,e,t,i){let n=(e||a).node(t),r=0,s=e?e.index(t):n.childCount;a&&(r=a.index(t),a.depth>t?r++:a.textOffset&&(ma(a.nodeAfter,i),r++));for(let l=r;l<s;l++)ma(n.child(l),i);e&&e.depth==t&&e.textOffset&&ma(e.nodeBefore,i)}function Fa(a,e){return a.type.checkContent(e),a.copy(e)}function Fd(a,e,t,i,n){let r=a.depth>n&&mr(a,e,n+1),s=i.depth>n&&mr(t,i,n+1),l=[];return ci(null,a,n,l),r&&s&&e.index(n)==t.index(n)?(md(r,s),ma(Fa(r,Fd(a,e,t,i,n+1)),l)):(r&&ma(Fa(r,Dn(a,e,n+1)),l),ci(e,t,n,l),s&&ma(Fa(s,Dn(t,i,n+1)),l)),ci(i,null,n,l),new V(l)}function Dn(a,e,t){let i=[];if(ci(null,a,t,i),a.depth>t){let n=mr(a,e,t+1);ma(Fa(n,Dn(a,e,t+1)),i)}return ci(e,null,t,i),new V(i)}function J_(a,e){let t=e.depth-a.openStart,n=e.node(t).copy(a.content);for(let r=t-1;r>=0;r--)n=e.node(r).copy(V.from(n));return{start:n.resolveNoCache(a.openStart+t),end:n.resolveNoCache(n.content.size-a.openEnd-t)}}class Ci{constructor(e,t,i){this.pos=e,this.path=t,this.parentOffset=i,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let i=this.pos-this.path[this.path.length-1],n=e.child(t);return i?e.child(t).cut(i):n}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let i=this.path[t*3],n=t==0?0:this.path[t*3-1]+1;for(let r=0;r<e;r++)n+=i.child(r).nodeSize;return n}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return ie.none;if(this.textOffset)return e.child(t).marks;let i=e.maybeChild(t-1),n=e.maybeChild(t);if(!i){let l=i;i=n,n=l}let r=i.marks;for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!n||!r[s].isInSet(n.marks))&&(r=r[s--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let i=t.marks,n=e.parent.maybeChild(e.index());for(var r=0;r<i.length;r++)i[r].type.spec.inclusive===!1&&(!n||!i[r].isInSet(n.marks))&&(i=i[r--].removeFromSet(i));return i}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let i=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);i>=0;i--)if(e.pos<=this.end(i)&&(!t||t(this.node(i))))return new vn(this,e,i);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let i=[],n=0,r=t;for(let s=e;;){let{index:l,offset:u}=s.content.findIndex(r),d=r-u;if(i.push(s,l,n+u),!d||(s=s.child(l),s.isText))break;r=d-1,n+=u+1}return new Ci(t,i,r)}static resolveCached(e,t){let i=ml.get(e);if(i)for(let r=0;r<i.elts.length;r++){let s=i.elts[r];if(s.pos==t)return s}else ml.set(e,i=new G_);let n=i.elts[i.i]=Ci.resolve(e,t);return i.i=(i.i+1)%Y_,n}}class G_{constructor(){this.elts=[],this.i=0}}const Y_=12,ml=new WeakMap;class vn{constructor(e,t,i){this.$from=e,this.$to=t,this.depth=i}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const X_=Object.create(null);let Wt=class Fr{constructor(e,t,i,n=ie.none){this.type=e,this.attrs=t,this.marks=n,this.content=i||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,i,n=0){this.content.nodesBetween(e,t,i,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,i,n){return this.content.textBetween(e,t,i,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,i){return this.type==e&&kn(this.attrs,t||e.defaultAttrs||X_)&&ie.sameSet(this.marks,i||ie.none)}copy(e=null){return e==this.content?this:new Fr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fr(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,i=!1){if(e==t)return I.empty;let n=this.resolve(e),r=this.resolve(t),s=i?0:n.sharedDepth(t),l=n.start(s),d=n.node(s).content.cut(n.pos-l,r.pos-l);return new I(d,n.depth-s,r.depth-s)}replace(e,t,i){return K_(this.resolve(e),this.resolve(t),i)}nodeAt(e){for(let t=this;;){let{index:i,offset:n}=t.content.findIndex(e);if(t=t.maybeChild(i),!t)return null;if(n==e||t.isText)return t;e-=n+1}}childAfter(e){let{index:t,offset:i}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:i}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:i}=this.content.findIndex(e);if(i<e)return{node:this.content.child(t),index:t,offset:i};let n=this.content.child(t-1);return{node:n,index:t-1,offset:i-n.nodeSize}}resolve(e){return Ci.resolveCached(this,e)}resolveNoCache(e){return Ci.resolve(this,e)}rangeHasMark(e,t,i){let n=!1;return t>e&&this.nodesBetween(e,t,r=>(i.isInSet(r.marks)&&(n=!0),!n)),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),pd(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,i=V.empty,n=0,r=i.childCount){let s=this.contentMatchAt(e).matchFragment(i,n,r),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let u=n;u<r;u++)if(!this.type.allowsMarks(i.child(u).marks))return!1;return!0}canReplaceWith(e,t,i,n){if(n&&!this.type.allowsMarks(n))return!1;let r=this.contentMatchAt(e).matchType(i),s=r&&r.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ie.none;for(let t=0;t<this.marks.length;t++){let i=this.marks[t];i.type.checkAttrs(i.attrs),e=i.addToSet(e)}if(!ie.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let i;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");i=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,i)}let n=V.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,n,i);return r.type.checkAttrs(r.attrs),r}};Wt.prototype.text=void 0;class En extends Wt{constructor(e,t,i,n){if(super(e,t,null,n),!i)throw new RangeError("Empty text nodes are not allowed");this.text=i}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):pd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new En(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new En(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function pd(a,e){for(let t=a.length-1;t>=0;t--)e=a[t].type.name+"("+e+")";return e}class ka{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let i=new Q_(e,t);if(i.next==null)return ka.empty;let n=bd(i);i.next&&i.err("Unexpected trailing text");let r=o1(n1(n));return r1(r,i),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,i=e.childCount){let n=this;for(let r=t;n&&r<i;r++)n=n.matchType(e.child(r).type);return n}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let i=0;i<e.next.length;i++)if(this.next[t].type==e.next[i].type)return!0;return!1}fillBefore(e,t=!1,i=0){let n=[this];function r(s,l){let u=s.matchFragment(e,i);if(u&&(!t||u.validEnd))return V.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:f,next:c}=s.next[d];if(!(f.isText||f.hasRequiredAttrs())&&n.indexOf(c)==-1){n.push(c);let g=r(c,l.concat(f));if(g)return g}}return null}return r(this,[])}findWrapping(e){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==e)return this.wrapCache[i+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),i=[{match:this,type:null,via:null}];for(;i.length;){let n=i.shift(),r=n.match;if(r.matchType(e)){let s=[];for(let l=n;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<r.next.length;s++){let{type:l,next:u}=r.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!n.type||u.validEnd)&&(i.push({match:l.contentMatch,type:l,via:n}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(i){e.push(i);for(let n=0;n<i.next.length;n++)e.indexOf(i.next[n].next)==-1&&t(i.next[n].next)}return t(this),e.map((i,n)=>{let r=n+(i.validEnd?"*":" ")+" ";for(let s=0;s<i.next.length;s++)r+=(s?", ":"")+i.next[s].type.name+"->"+e.indexOf(i.next[s].next);return r}).join(`
|
|
2
2
|
`)}}ka.empty=new ka(!0);class Q_{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function bd(a){let e=[];do e.push(Z_(a));while(a.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Z_(a){let e=[];do e.push(e1(a));while(a.next&&a.next!=")"&&a.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function e1(a){let e=i1(a);for(;;)if(a.eat("+"))e={type:"plus",expr:e};else if(a.eat("*"))e={type:"star",expr:e};else if(a.eat("?"))e={type:"opt",expr:e};else if(a.eat("{"))e=t1(a,e);else break;return e}function Fl(a){/\D/.test(a.next)&&a.err("Expected number, got '"+a.next+"'");let e=Number(a.next);return a.pos++,e}function t1(a,e){let t=Fl(a),i=t;return a.eat(",")&&(a.next!="}"?i=Fl(a):i=-1),a.eat("}")||a.err("Unclosed braced range"),{type:"range",min:t,max:i,expr:e}}function a1(a,e){let t=a.nodeTypes,i=t[e];if(i)return[i];let n=[];for(let r in t){let s=t[r];s.isInGroup(e)&&n.push(s)}return n.length==0&&a.err("No node type or group '"+e+"' found"),n}function i1(a){if(a.eat("(")){let e=bd(a);return a.eat(")")||a.err("Missing closing paren"),e}else if(/\W/.test(a.next))a.err("Unexpected token '"+a.next+"'");else{let e=a1(a,a.next).map(t=>(a.inline==null?a.inline=t.isInline:a.inline!=t.isInline&&a.err("Mixing inline and block content"),{type:"name",value:t}));return a.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function n1(a){let e=[[]];return n(r(a,0),t()),e;function t(){return e.push([])-1}function i(s,l,u){let d={term:u,to:l};return e[s].push(d),d}function n(s,l){s.forEach(u=>u.to=l)}function r(s,l){if(s.type=="choice")return s.exprs.reduce((u,d)=>u.concat(r(d,l)),[]);if(s.type=="seq")for(let u=0;;u++){let d=r(s.exprs[u],l);if(u==s.exprs.length-1)return d;n(d,l=t())}else if(s.type=="star"){let u=t();return i(l,u),n(r(s.expr,u),u),[i(u)]}else if(s.type=="plus"){let u=t();return n(r(s.expr,l),u),n(r(s.expr,u),u),[i(u)]}else{if(s.type=="opt")return[i(l)].concat(r(s.expr,l));if(s.type=="range"){let u=l;for(let d=0;d<s.min;d++){let f=t();n(r(s.expr,u),f),u=f}if(s.max==-1)n(r(s.expr,u),u);else for(let d=s.min;d<s.max;d++){let f=t();i(u,f),n(r(s.expr,u),f),u=f}return[i(u)]}else{if(s.type=="name")return[i(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function yd(a,e){return e-a}function pl(a,e){let t=[];return i(e),t.sort(yd);function i(n){let r=a[n];if(r.length==1&&!r[0].term)return i(r[0].to);t.push(n);for(let s=0;s<r.length;s++){let{term:l,to:u}=r[s];!l&&t.indexOf(u)==-1&&i(u)}}}function o1(a){let e=Object.create(null);return t(pl(a,0));function t(i){let n=[];i.forEach(s=>{a[s].forEach(({term:l,to:u})=>{if(!l)return;let d;for(let f=0;f<n.length;f++)n[f][0]==l&&(d=n[f][1]);pl(a,u).forEach(f=>{d||n.push([l,d=[]]),d.indexOf(f)==-1&&d.push(f)})})});let r=e[i.join(",")]=new ka(i.indexOf(a.length-1)>-1);for(let s=0;s<n.length;s++){let l=n[s][1].sort(yd);r.next.push({type:n[s][0],next:e[l.join(",")]||t(l)})}return r}}function r1(a,e){for(let t=0,i=[a];t<i.length;t++){let n=i[t],r=!n.validEnd,s=[];for(let l=0;l<n.next.length;l++){let{type:u,next:d}=n.next[l];s.push(u.name),r&&!(u.isText||u.hasRequiredAttrs())&&(r=!1),i.indexOf(d)==-1&&i.push(d)}r&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function kd(a){let e=Object.create(null);for(let t in a){let i=a[t];if(!i.hasDefault)return null;e[t]=i.default}return e}function wd(a,e){let t=Object.create(null);for(let i in a){let n=e&&e[i];if(n===void 0){let r=a[i];if(r.hasDefault)n=r.default;else throw new RangeError("No value supplied for attribute "+i)}t[i]=n}return t}function Dd(a,e,t,i){for(let n in e)if(!(n in a))throw new RangeError(`Unsupported attribute ${n} for ${t} of type ${n}`);for(let n in a){let r=a[n];r.validate&&r.validate(e[n])}}function vd(a,e){let t=Object.create(null);if(e)for(let i in e)t[i]=new l1(a,i,e[i]);return t}let bl=class Ed{constructor(e,t,i){this.name=e,this.schema=t,this.spec=i,this.markSet=null,this.groups=i.group?i.group.split(" "):[],this.attrs=vd(e,i.attrs),this.defaultAttrs=kd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(i.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ka.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:wd(this.attrs,e)}create(e=null,t,i){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Wt(this,this.computeAttrs(e),V.from(t),ie.setFrom(i))}createChecked(e=null,t,i){return t=V.from(t),this.checkContent(t),new Wt(this,this.computeAttrs(e),t,ie.setFrom(i))}createAndFill(e=null,t,i){if(e=this.computeAttrs(e),t=V.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let n=this.contentMatch.matchFragment(t),r=n&&n.fillBefore(V.empty,!0);return r?new Wt(this,e,t.append(r),ie.setFrom(i)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let i=0;i<e.childCount;i++)if(!this.allowsMarks(e.child(i).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Dd(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let i=0;i<e.length;i++)this.allowsMarkType(e[i].type)?t&&t.push(e[i]):t||(t=e.slice(0,i));return t?t.length?t:ie.none:e}static compile(e,t){let i=Object.create(null);e.forEach((r,s)=>i[r]=new Ed(r,t,s));let n=t.spec.topNode||"doc";if(!i[n])throw new RangeError("Schema is missing its top node type ('"+n+"')");if(!i.text)throw new RangeError("Every schema needs a 'text' type");for(let r in i.text.attrs)throw new RangeError("The text node type should not have attributes");return i}};function s1(a,e,t){let i=t.split("|");return n=>{let r=n===null?"null":typeof n;if(i.indexOf(r)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${a}, got ${r}`)}}class l1{constructor(e,t,i){this.hasDefault=Object.prototype.hasOwnProperty.call(i,"default"),this.default=i.default,this.validate=typeof i.validate=="string"?s1(e,t,i.validate):i.validate}get isRequired(){return!this.hasDefault}}class Fo{constructor(e,t,i,n){this.name=e,this.rank=t,this.schema=i,this.spec=n,this.attrs=vd(e,n.attrs),this.excluded=null;let r=kd(this.attrs);this.instance=r?new ie(this,r):null}create(e=null){return!e&&this.instance?this.instance:new ie(this,wd(this.attrs,e))}static compile(e,t){let i=Object.create(null),n=0;return e.forEach((r,s)=>i[r]=new Fo(r,n++,t,s)),i}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Dd(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class xd{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=be.from(e.nodes),t.marks=be.from(e.marks||{}),this.nodes=bl.compile(this.spec.nodes,this),this.marks=Fo.compile(this.spec.marks,this);let i=Object.create(null);for(let n in this.nodes){if(n in this.marks)throw new RangeError(n+" can not be both a node and a mark");let r=this.nodes[n],s=r.spec.content||"",l=r.spec.marks;if(r.contentMatch=i[s]||(i[s]=ka.parse(s,this.nodes)),r.inlineContent=r.contentMatch.inlineContent,r.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!r.isInline||!r.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=r}r.markSet=l=="_"?null:l?yl(this,l.split(" ")):l==""||!r.inlineContent?[]:null}for(let n in this.marks){let r=this.marks[n],s=r.spec.excludes;r.excluded=s==null?[r]:s==""?[]:yl(this,s.split(" "))}this.nodeFromJSON=n=>Wt.fromJSON(this,n),this.markFromJSON=n=>ie.fromJSON(this,n),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,i,n){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof bl){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,i,n)}text(e,t){let i=this.nodes.text;return new En(i,i.defaultAttrs,e,ie.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function yl(a,e){let t=[];for(let i=0;i<e.length;i++){let n=e[i],r=a.marks[n],s=r;if(r)t.push(r);else for(let l in a.marks){let u=a.marks[l];(n=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(n)>-1)&&t.push(s=u)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return t}function u1(a){return a.tag!=null}function d1(a){return a.style!=null}class Ut{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let i=this.matchedStyles=[];t.forEach(n=>{if(u1(n))this.tags.push(n);else if(d1(n)){let r=/[^=]*/.exec(n.style)[0];i.indexOf(r)<0&&i.push(r),this.styles.push(n)}}),this.normalizeLists=!this.tags.some(n=>{if(!/^(ul|ol)\b/.test(n.tag)||!n.node)return!1;let r=e.nodes[n.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let i=new wl(this,t,!1);return i.addAll(e,ie.none,t.from,t.to),i.finish()}parseSlice(e,t={}){let i=new wl(this,t,!0);return i.addAll(e,ie.none,t.from,t.to),I.maxOpen(i.finish())}matchTag(e,t,i){for(let n=i?this.tags.indexOf(i)+1:0;n<this.tags.length;n++){let r=this.tags[n];if(g1(e,r.tag)&&(r.namespace===void 0||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let s=r.getAttrs(e);if(s===!1)continue;r.attrs=s||void 0}return r}}}matchStyle(e,t,i,n){for(let r=n?this.styles.indexOf(n)+1:0;r<this.styles.length;r++){let s=this.styles[r],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!i.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let u=s.getAttrs(t);if(u===!1)continue;s.attrs=u||void 0}return s}}}static schemaRules(e){let t=[];function i(n){let r=n.priority==null?50:n.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<r)break}t.splice(s,0,n)}for(let n in e.marks){let r=e.marks[n].spec.parseDOM;r&&r.forEach(s=>{i(s=Dl(s)),s.mark||s.ignore||s.clearMark||(s.mark=n)})}for(let n in e.nodes){let r=e.nodes[n].spec.parseDOM;r&&r.forEach(s=>{i(s=Dl(s)),s.node||s.ignore||s.mark||(s.node=n)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ut(e,Ut.schemaRules(e)))}}const Cd={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},f1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Bd={ol:!0,ul:!0},Bi=1,pr=2,gi=4;function kl(a,e,t){return e!=null?(e?Bi:0)|(e==="full"?pr:0):a&&a.whitespace=="pre"?Bi|pr:t&~gi}class Ki{constructor(e,t,i,n,r,s){this.type=e,this.attrs=t,this.marks=i,this.solid=n,this.options=s,this.content=[],this.activeMarks=ie.none,this.match=r||(s&gi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(V.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let i=this.type.contentMatch,n;return(n=i.findWrapping(e.type))?(this.match=i,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Bi)){let i=this.content[this.content.length-1],n;if(i&&i.isText&&(n=/[ \t\r\n\u000c]+$/.exec(i.text))){let r=i;i.text.length==n[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-n[0].length))}}let t=V.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Cd.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class wl{constructor(e,t,i){this.parser=e,this.options=t,this.isOpen=i,this.open=0,this.localPreserveWS=!1;let n=t.topNode,r,s=kl(null,t.preserveWhitespace,0)|(i?gi:0);n?r=new Ki(n.type,n.attrs,ie.none,!0,t.topMatch||n.type.contentMatch,s):i?r=new Ki(null,null,ie.none,!0,null,s):r=new Ki(e.schema.topNodeType,null,ie.none,!0,null,s),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let i=e.nodeValue,n=this.top,r=n.options&pr?"full":this.localPreserveWS||(n.options&Bi)>0,{schema:s}=this.parser;if(r==="full"||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(i)){if(r)if(r==="full")i=i.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(s.linebreakReplacement&&/[\r\n]/.test(i)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=i.split(/\r?\n|\r/);for(let u=0;u<l.length;u++)u&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[u]&&this.insertNode(s.text(l[u]),t,!/\S/.test(l[u]));i=""}else i=i.replace(/\r?\n|\r/g," ");else if(i=i.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(i)&&this.open==this.nodes.length-1){let l=n.content[n.content.length-1],u=e.previousSibling;(!l||u&&u.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(i=i.slice(1))}i&&this.insertNode(s.text(i),t,!/\S/.test(i)),this.findInText(e)}else this.findInside(e)}addElement(e,t,i){let n=this.localPreserveWS,r=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Bd.hasOwnProperty(s)&&this.parser.normalizeLists&&c1(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,i));e:if(u?u.ignore:f1.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let d,f=this.needsBlock;if(Cd.hasOwnProperty(s))r.content.length&&r.content[0].isInline&&this.open&&(this.open--,r=this.top),d=!0,r.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let c=u&&u.skip?t:this.readStyles(e,t);c&&this.addAll(e,c),d&&this.sync(r),this.needsBlock=f}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,u,d,u.consuming===!1?l:void 0)}this.localPreserveWS=n}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let i=e.style;if(i&&i.length)for(let n=0;n<this.parser.matchedStyles.length;n++){let r=this.parser.matchedStyles[n],s=i.getPropertyValue(r);if(s)for(let l=void 0;;){let u=this.parser.matchStyle(r,s,this,l);if(!u)break;if(u.ignore)return null;if(u.clearMark?t=t.filter(d=>!u.clearMark(d)):t=t.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)l=u;else break}}return t}addElementByRule(e,t,i,n){let r,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),i,e.nodeName=="BR")||this.leafFallback(e,i);else{let u=this.enter(s,t.attrs||null,i,t.preserveWhitespace);u&&(r=!0,i=u)}else{let u=this.parser.schema.marks[t.mark];i=i.concat(u.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(n)this.addElement(e,i,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,i,!1));else{let u=e;typeof t.contentElement=="string"?u=e.querySelector(t.contentElement):typeof t.contentElement=="function"?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,i),this.findAround(e,u,!1)}r&&this.sync(l)&&this.open--}addAll(e,t,i,n){let r=i||0;for(let s=i?e.childNodes[i]:e.firstChild,l=n==null?null:e.childNodes[n];s!=l;s=s.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(s,t);this.findAtPoint(e,r)}findPlace(e,t,i){let n,r;for(let s=this.open,l=0;s>=0;s--){let u=this.nodes[s],d=u.findWrapping(e);if(d&&(!n||n.length>d.length+l)&&(n=d,r=u,!d.length))break;if(u.solid){if(i)break;l+=2}}if(!n)return null;this.sync(r);for(let s=0;s<n.length;s++)t=this.enterInner(n[s],null,t,!1);return t}insertNode(e,t,i){if(e.isInline&&this.needsBlock&&!this.top.type){let r=this.textblockFromContext();r&&(t=this.enterInner(r,null,t))}let n=this.findPlace(e,t,i);if(n){this.closeExtra();let r=this.top;r.match&&(r.match=r.match.matchType(e.type));let s=ie.none;for(let l of n.concat(e.marks))(r.type?r.type.allowsMarkType(l.type):vl(l.type,e.type))&&(s=l.addToSet(s));return r.content.push(e.mark(s)),!0}return!1}enter(e,t,i,n){let r=this.findPlace(e.create(t),i,!1);return r&&(r=this.enterInner(e,t,i,!0,n)),r}enterInner(e,t,i,n=!1,r){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=kl(e,r,s.options);s.options&gi&&s.content.length==0&&(l|=gi);let u=ie.none;return i=i.filter(d=>(s.type?s.type.allowsMarkType(d.type):vl(d.type,e))?(u=d.addToSet(u),!1):!0),this.nodes.push(new Ki(e,t,u,n,null,l)),this.open++,i}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Bi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let i=this.nodes[t].content;for(let n=i.length-1;n>=0;n--)e+=i[n].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==e&&this.find[i].offset==t&&(this.find[i].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,i){if(e!=t&&this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&t.compareDocumentPosition(this.find[n].node)&(i?2:4)&&(this.find[n].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),i=this.options.context,n=!this.isOpen&&(!i||i.parent.type==this.nodes[0].type),r=-(i?i.depth+1:0)+(n?0:1),s=(l,u)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;u>=r;u--)if(s(l-1,u))return!0;return!1}else{let f=u>0||u==0&&n?this.nodes[u].type:i&&u>=r?i.node(u-r).type:null;if(!f||f.name!=d&&!f.isInGroup(d))return!1;u--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(i&&i.isTextblock&&i.defaultAttrs)return i}for(let t in this.parser.schema.nodes){let i=this.parser.schema.nodes[t];if(i.isTextblock&&i.defaultAttrs)return i}}}function c1(a){for(let e=a.firstChild,t=null;e;e=e.nextSibling){let i=e.nodeType==1?e.nodeName.toLowerCase():null;i&&Bd.hasOwnProperty(i)&&t?(t.appendChild(e),e=t):i=="li"?t=e:i&&(t=null)}}function g1(a,e){return(a.matches||a.msMatchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector).call(a,e)}function Dl(a){let e={};for(let t in a)e[t]=a[t];return e}function vl(a,e){let t=e.schema.nodes;for(let i in t){let n=t[i];if(!n.allowsMarkType(a))continue;let r=[],s=l=>{r.push(l);for(let u=0;u<l.edgeCount;u++){let{type:d,next:f}=l.edge(u);if(d==e||r.indexOf(f)<0&&s(f))return!0}};if(s(n.contentMatch))return!0}}class xa{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},i){i||(i=Oo(t).createDocumentFragment());let n=i,r=[];return e.forEach(s=>{if(r.length||s.marks.length){let l=0,u=0;for(;l<r.length&&u<s.marks.length;){let d=s.marks[u];if(!this.marks[d.type.name]){u++;continue}if(!d.eq(r[l][0])||d.type.spec.spanning===!1)break;l++,u++}for(;l<r.length;)n=r.pop()[1];for(;u<s.marks.length;){let d=s.marks[u++],f=this.serializeMark(d,s.isInline,t);f&&(r.push([d,n]),n.appendChild(f.dom),n=f.contentDOM||f.dom)}}n.appendChild(this.serializeNodeInner(s,t))}),i}serializeNodeInner(e,t){let{dom:i,contentDOM:n}=dn(Oo(t),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,n)}return i}serializeNode(e,t={}){let i=this.serializeNodeInner(e,t);for(let n=e.marks.length-1;n>=0;n--){let r=this.serializeMark(e.marks[n],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(i),i=r.dom)}return i}serializeMark(e,t,i={}){let n=this.marks[e.type.name];return n&&dn(Oo(i),n(e,t),null,e.attrs)}static renderSpec(e,t,i=null,n){return dn(e,t,i,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xa(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=El(e.nodes);return t.text||(t.text=i=>i.text),t}static marksFromSchema(e){return El(e.marks)}}function El(a){let e={};for(let t in a){let i=a[t].spec.toDOM;i&&(e[t]=i)}return e}function Oo(a){return a.document||window.document}const xl=new WeakMap;function _1(a){let e=xl.get(a);return e===void 0&&xl.set(a,e=h1(a)),e}function h1(a){let e=null;function t(i){if(i&&typeof i=="object")if(Array.isArray(i))if(typeof i[0]=="string")e||(e=[]),e.push(i);else for(let n=0;n<i.length;n++)t(i[n]);else for(let n in i)t(i[n])}return t(a),e}function dn(a,e,t,i){if(typeof e=="string")return{dom:a.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let n=e[0],r;if(typeof n!="string")throw new RangeError("Invalid array passed to renderSpec");if(i&&(r=_1(i))&&r.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=n.indexOf(" ");s>0&&(t=n.slice(0,s),n=n.slice(s+1));let l,u=t?a.createElementNS(t,n):a.createElement(n),d=e[1],f=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){f=2;for(let c in d)if(d[c]!=null){let g=c.indexOf(" ");g>0?u.setAttributeNS(c.slice(0,g),c.slice(g+1),d[c]):c=="style"&&u.style?u.style.cssText=d[c]:u.setAttribute(c,d[c])}}for(let c=f;c<e.length;c++){let g=e[c];if(g===0){if(c<e.length-1||c>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:_,contentDOM:h}=dn(a,g,t,i);if(u.appendChild(_),h){if(l)throw new RangeError("Multiple content holes");l=h}}}return{dom:u,contentDOM:l}}const Sd=65535,jd=Math.pow(2,16);function m1(a,e){return a+e*jd}function Cl(a){return a&Sd}function F1(a){return(a-(a&Sd))/jd}const Nd=1,qd=2,fn=4,Ad=8;let br=class{constructor(e,t,i){this.pos=e,this.delInfo=t,this.recover=i}get deleted(){return(this.delInfo&Ad)>0}get deletedBefore(){return(this.delInfo&(Nd|fn))>0}get deletedAfter(){return(this.delInfo&(qd|fn))>0}get deletedAcross(){return(this.delInfo&fn)>0}},wa=class qa{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&qa.empty)return qa.empty}recover(e){let t=0,i=Cl(e);if(!this.inverted)for(let n=0;n<i;n++)t+=this.ranges[n*3+2]-this.ranges[n*3+1];return this.ranges[i*3]+t+F1(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,i){let n=0,r=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?n:0);if(u>e)break;let d=this.ranges[l+r],f=this.ranges[l+s],c=u+d;if(e<=c){let g=d?e==u?-1:e==c?1:t:t,_=u+n+(g<0?0:f);if(i)return _;let h=e==(t<0?u:c)?null:m1(l/3,e-u),m=e==u?qd:e==c?Nd:fn;return(t<0?e!=u:e!=c)&&(m|=Ad),new br(_,m,h)}n+=f-d}return i?e+n:new br(e+n,0,null)}touches(e,t){let i=0,n=Cl(t),r=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?i:0);if(u>e)break;let d=this.ranges[l+r],f=u+d;if(e<=f&&l==n*3)return!0;i+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,i=this.inverted?1:2;for(let n=0,r=0;n<this.ranges.length;n+=3){let s=this.ranges[n],l=s-(this.inverted?r:0),u=s+(this.inverted?0:r),d=this.ranges[n+t],f=this.ranges[n+i];e(l,l+d,u,u+f),r+=f-d}}invert(){return new qa(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?qa.empty:new qa(e<0?[0,-e,0]:[0,0,e])}};wa.empty=new wa([]);class Si{constructor(e,t,i=0,n=e?e.length:0){this.mirror=t,this.from=i,this.to=n,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Si(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,i=this._maps.length;t<e._maps.length;t++){let n=e.getMirror(t);this.appendMap(e._maps[t],n!=null&&n<t?i+n:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,i=this._maps.length+e._maps.length;t>=0;t--){let n=e.getMirror(t);this.appendMap(e._maps[t].invert(),n!=null&&n>t?i-n-1:void 0)}}invert(){let e=new Si;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let i=this.from;i<this.to;i++)e=this._maps[i].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,i){let n=0;for(let r=this.from;r<this.to;r++){let s=this._maps[r],l=s.mapResult(e,t);if(l.recover!=null){let u=this.getMirror(r);if(u!=null&&u>r&&u<this.to){r=u,e=this._maps[u].recover(l.recover);continue}}n|=l.delInfo,e=l.pos}return i?e:new br(e,n,null)}}const Lo=Object.create(null);let Se=class{getMap(){return wa.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let i=Lo[t.stepType];if(!i)throw new RangeError(`No step type ${t.stepType} defined`);return i.fromJSON(e,t)}static jsonID(e,t){if(e in Lo)throw new RangeError("Duplicate use of step JSON ID "+e);return Lo[e]=t,t.prototype.jsonID=e,t}},Te=class ai{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ai(e,null)}static fail(e){return new ai(null,e)}static fromReplace(e,t,i,n){try{return ai.ok(e.replace(t,i,n))}catch(r){if(r instanceof wn)return ai.fail(r.message);throw r}}};function ss(a,e,t){let i=[];for(let n=0;n<a.childCount;n++){let r=a.child(n);r.content.size&&(r=r.copy(ss(r.content,e,r))),r.isInline&&(r=e(r,t,n)),i.push(r)}return V.fromArray(i)}let ls=class ii extends Se{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=e.resolve(this.from),n=i.node(i.sharedDepth(this.to)),r=new I(ss(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),n),t.openStart,t.openEnd);return Te.fromReplace(e,this.from,this.to,r)}invert(){return new Ya(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new ii(t.pos,i.pos,this.mark)}merge(e){return e instanceof ii&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ii(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ii(t.from,t.to,e.markFromJSON(t.mark))}};Se.jsonID("addMark",ls);let Ya=class ni extends Se{constructor(e,t,i){super(),this.from=e,this.to=t,this.mark=i}apply(e){let t=e.slice(this.from,this.to),i=new I(ss(t.content,n=>n.mark(this.mark.removeFromSet(n.marks)),e),t.openStart,t.openEnd);return Te.fromReplace(e,this.from,this.to,i)}invert(){return new ls(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deleted&&i.deleted||t.pos>=i.pos?null:new ni(t.pos,i.pos,this.mark)}merge(e){return e instanceof ni&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ni(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ni(t.from,t.to,e.markFromJSON(t.mark))}};Se.jsonID("removeMark",Ya);let us=class oi extends Se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Te.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Te.fromReplace(e,this.pos,this.pos+1,new I(V.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let i=this.mark.addToSet(t.marks);if(i.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(i))return new oi(this.pos,t.marks[n]);return new oi(this.pos,this.mark)}}return new xn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new oi(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new oi(t.pos,e.markFromJSON(t.mark))}};Se.jsonID("addNodeMark",us);let xn=class yr extends Se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Te.fail("No node at mark step's position");let i=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Te.fromReplace(e,this.pos,this.pos+1,new I(V.from(i),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new us(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new yr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new yr(t.pos,e.markFromJSON(t.mark))}};Se.jsonID("removeNodeMark",xn);let rt=class la extends Se{constructor(e,t,i,n=!1){super(),this.from=e,this.to=t,this.slice=i,this.structure=n}apply(e){return this.structure&&kr(e,this.from,this.to)?Te.fail("Structure replace would overwrite content"):Te.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wa([this.from,this.to-this.from,this.slice.size])}invert(e){return new la(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1);return t.deletedAcross&&i.deletedAcross?null:new la(t.pos,Math.max(t.pos,i.pos),this.slice,this.structure)}merge(e){if(!(e instanceof la)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?I.empty:new I(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new la(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?I.empty:new I(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new la(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new la(t.from,t.to,I.fromJSON(e,t.slice),!!t.structure)}};Se.jsonID("replace",rt);let He=class cn extends Se{constructor(e,t,i,n,r,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=i,this.gapTo=n,this.slice=r,this.insert=s,this.structure=l}apply(e){if(this.structure&&(kr(e,this.from,this.gapFrom)||kr(e,this.gapTo,this.to)))return Te.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Te.fail("Gap is not a flat range");let i=this.slice.insertAt(this.insert,t.content);return i?Te.fromReplace(e,this.from,this.to,i):Te.fail("Content does not fit in gap")}getMap(){return new wa([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new cn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),i=e.mapResult(this.to,-1),n=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?i.pos:e.map(this.gapTo,1);return t.deletedAcross&&i.deletedAcross||n<t.pos||r>i.pos?null:new cn(t.pos,i.pos,n,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new cn(t.from,t.to,t.gapFrom,t.gapTo,I.fromJSON(e,t.slice),t.insert,!!t.structure)}};Se.jsonID("replaceAround",He);function kr(a,e,t){let i=a.resolve(e),n=t-e,r=i.depth;for(;n>0&&r>0&&i.indexAfter(r)==i.node(r).childCount;)r--,n--;if(n>0){let s=i.node(r).maybeChild(i.indexAfter(r));for(;n>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,n--}}return!1}function p1(a,e,t,i){let n=[],r=[],s,l;a.doc.nodesBetween(e,t,(u,d,f)=>{if(!u.isInline)return;let c=u.marks;if(!i.isInSet(c)&&f.type.allowsMarkType(i.type)){let g=Math.max(d,e),_=Math.min(d+u.nodeSize,t),h=i.addToSet(c);for(let m=0;m<c.length;m++)c[m].isInSet(h)||(s&&s.to==g&&s.mark.eq(c[m])?s.to=_:n.push(s=new Ya(g,_,c[m])));l&&l.to==g?l.to=_:r.push(l=new ls(g,_,i))}}),n.forEach(u=>a.step(u)),r.forEach(u=>a.step(u))}function b1(a,e,t,i){let n=[],r=0;a.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;r++;let u=null;if(i instanceof Fo){let d=s.marks,f;for(;f=i.isInSet(d);)(u||(u=[])).push(f),d=f.removeFromSet(d)}else i?i.isInSet(s.marks)&&(u=[i]):u=s.marks;if(u&&u.length){let d=Math.min(l+s.nodeSize,t);for(let f=0;f<u.length;f++){let c=u[f],g;for(let _=0;_<n.length;_++){let h=n[_];h.step==r-1&&c.eq(n[_].style)&&(g=h)}g?(g.to=d,g.step=r):n.push({style:c,from:Math.max(l,e),to:d,step:r})}}}),n.forEach(s=>a.step(new Ya(s.from,s.to,s.style)))}function ds(a,e,t,i=t.contentMatch,n=!0){let r=a.doc.nodeAt(e),s=[],l=e+1;for(let u=0;u<r.childCount;u++){let d=r.child(u),f=l+d.nodeSize,c=i.matchType(d.type);if(!c)s.push(new rt(l,f,I.empty));else{i=c;for(let g=0;g<d.marks.length;g++)t.allowsMarkType(d.marks[g].type)||a.step(new Ya(l,f,d.marks[g]));if(n&&d.isText&&t.whitespace!="pre"){let g,_=/\r?\n|\r/g,h;for(;g=_.exec(d.text);)h||(h=new I(V.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new rt(l+g.index,l+g.index+g[0].length,h))}}l=f}if(!i.validEnd){let u=i.fillBefore(V.empty,!0);a.replace(l,l,new I(u,0,0))}for(let u=s.length-1;u>=0;u--)a.step(s[u])}function y1(a,e,t){return(e==0||a.canReplace(e,a.childCount))&&(t==a.childCount||a.canReplace(0,t))}function Xa(a){let t=a.parent.content.cutByIndex(a.startIndex,a.endIndex);for(let i=a.depth,n=0,r=0;;--i){let s=a.$from.node(i),l=a.$from.index(i)+n,u=a.$to.indexAfter(i)-r;if(i<a.depth&&s.canReplace(l,u,t))return i;if(i==0||s.type.spec.isolating||!y1(s,l,u))break;l&&(n=1),u<s.childCount&&(r=1)}return null}function k1(a,e,t){let{$from:i,$to:n,depth:r}=e,s=i.before(r+1),l=n.after(r+1),u=s,d=l,f=V.empty,c=0;for(let h=r,m=!1;h>t;h--)m||i.index(h)>0?(m=!0,f=V.from(i.node(h).copy(f)),c++):u--;let g=V.empty,_=0;for(let h=r,m=!1;h>t;h--)m||n.after(h+1)<n.end(h)?(m=!0,g=V.from(n.node(h).copy(g)),_++):d++;a.step(new He(u,d,s,l,new I(f.append(g),c,_),f.size-c,!0))}function fs(a,e,t=null,i=a){let n=w1(a,e),r=n&&D1(i,e);return r?n.map(Bl).concat({type:e,attrs:t}).concat(r.map(Bl)):null}function Bl(a){return{type:a,attrs:null}}function w1(a,e){let{parent:t,startIndex:i,endIndex:n}=a,r=t.contentMatchAt(i).findWrapping(e);if(!r)return null;let s=r.length?r[0]:e;return t.canReplaceWith(i,n,s)?r:null}function D1(a,e){let{parent:t,startIndex:i,endIndex:n}=a,r=t.child(i),s=e.contentMatch.findWrapping(r.type);if(!s)return null;let u=(s.length?s[s.length-1]:e).contentMatch;for(let d=i;u&&d<n;d++)u=u.matchType(t.child(d).type);return!u||!u.validEnd?null:s}function v1(a,e,t){let i=V.empty;for(let s=t.length-1;s>=0;s--){if(i.size){let l=t[s].type.contentMatch.matchFragment(i);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=V.from(t[s].type.create(t[s].attrs,i))}let n=e.start,r=e.end;a.step(new He(n,r,n,r,new I(i,0,0),t.length,!0))}function E1(a,e,t,i,n){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let r=a.steps.length;a.doc.nodesBetween(e,t,(s,l)=>{let u=typeof n=="function"?n(s):n;if(s.isTextblock&&!s.hasMarkup(i,u)&&x1(a.doc,a.mapping.slice(r).map(l),i)){let d=null;if(i.schema.linebreakReplacement){let _=i.whitespace=="pre",h=!!i.contentMatch.matchType(i.schema.linebreakReplacement);_&&!h?d=!1:!_&&h&&(d=!0)}d===!1&&Md(a,s,l,r),ds(a,a.mapping.slice(r).map(l,1),i,void 0,d===null);let f=a.mapping.slice(r),c=f.map(l,1),g=f.map(l+s.nodeSize,1);return a.step(new He(c,g,c+1,g-1,new I(V.from(i.create(u,null,s.marks)),0,0),1,!0)),d===!0&&Td(a,s,l,r),!1}})}function Td(a,e,t,i){e.forEach((n,r)=>{if(n.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(n.text);){let u=a.mapping.slice(i).map(t+1+r+s.index);a.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Md(a,e,t,i){e.forEach((n,r)=>{if(n.type==n.type.schema.linebreakReplacement){let s=a.mapping.slice(i).map(t+1+r);a.replaceWith(s,s+1,e.type.schema.text(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),V=require("@oneclick.dev/cms-kit"),H=require("./interpolation-We8hT28L.js"),_=require("./index-ijdf0d9-.js"),O={class:"flex items-center gap-2"},W={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},G={key:0},Q={key:1},X={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},J={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},Y=["href"],Z=["href"],ee=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup(D){const r=e.inject("selection"),v=e.inject("collection"),b=D,{config:c}=V.useModule(),{navigateTo:a,params:E}=V.useModuleRoute(),{hasPermission:N}=V.useModulePermissions(),s=(l,t)=>{l?r.value.push(t):r.value=r.value.filter(i=>i!==t)},g=l=>{if(!v.value)return"about:blank";let t=c.domain?.trim(),i=v.value.defaultLanguageRoutePattern?.trim();if(!t||!i)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),i.startsWith("/")||(i="/"+i);const m=l.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return H.interpolateTemplateFromVariableContext(t+i,[{name:"slug",value:m},{name:"id",value:l.id},{name:"lang",value:c.defaultLanguage||"en"}])},y=l=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${l.id}`,x=e.computed(()=>b.entries?.map(l=>({...l,status:l.archived?"archived":l.liveByLocale&&l.liveByLocale.length>0?"published":"draft",publishProgress:{completed:l.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(l,t)=>{const i=e.resolveComponent("TableHead"),m=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),C=e.resolveComponent("Checkbox"),w=e.resolveComponent("TableCell"),T=e.resolveComponent("Button"),h=e.resolveComponent("TableBody"),$=e.resolveComponent("Table"),M=e.resolveComponent("Card");return e.openBlock(),e.createBlock(M,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode($,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,d=>(e.openBlock(),e.createBlock(m,{key:d.id,onClick:f=>e.unref(a)("collections/"+e.unref(E).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(w,{key:0},{default:e.withCtx(()=>[e.createVNode(C,{"model-value":e.unref(r)?.includes(d.id),"onUpdate:modelValue":f=>s(f,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(w,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",W,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",G,"Published")):(e.openBlock(),e.createElementBlock("span",Q,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",X,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",J,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(w,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:g(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,Y)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:y(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Z)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),te={class:"flex items-center space-x-2 mb-4"},oe={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},ne={class:"flex items-center space-x-2 mb-4"},le={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},se=e.defineComponent({__name:"FilterPopover",setup(D){const r=e.inject("filter"),v=e.ref(""),b=()=>{r.value={published:!0,draft:!0,archived:!1}};return(c,a)=>{const E=e.resolveComponent("Button"),N=e.resolveComponent("PopoverTrigger"),s=e.resolveComponent("Checkbox"),g=e.resolveComponent("PopoverContent"),y=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(y,null,{default:e.withCtx(()=>[e.createVNode(N,{asChild:""},{default:e.withCtx(()=>[e.createVNode(E,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),a[3]||(a[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(g,{class:"w-64"},{default:e.withCtx(()=>[a[5]||(a[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",te,[e.createVNode(s,{id:"chk_published_entries",modelValue:e.unref(r).published,"onUpdate:modelValue":a[0]||(a[0]=x=>e.unref(r).published=x)},null,8,["modelValue"]),e.createElementVNode("label",oe," Show published "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",ne,[e.createVNode(s,{id:"chk_draft_entries",modelValue:e.unref(r).draft,"onUpdate:modelValue":a[1]||(a[1]=x=>e.unref(r).draft=x)},null,8,["modelValue"]),e.createElementVNode("label",le," Show draft "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",re,[e.createVNode(s,{id:"chk_archived_entries",modelValue:e.unref(r).archived,"onUpdate:modelValue":a[2]||(a[2]=x=>e.unref(r).archived=x)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(v.value||"entries"),1)]),!e.unref(r).published||!e.unref(r).draft||e.unref(r).archived?(e.openBlock(),e.createBlock(E,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:b},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),a[4]||(a[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ie=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup(D,{emit:r}){const v=r,b=e.inject("entries"),c=e.inject("selection"),a=e.inject("config"),{hasPermission:E}=V.useModulePermissions(),{navigateTo:N}=V.useModuleRoute(),s=e.computed(()=>c.value?.length!==1?null:b.value?.find(l=>l.id===c.value[0])),g=l=>{let t=a.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",l.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",l.slug),window.open(t,"_blank")},y=async(l,t)=>{try{if(!["draft","published","archived"].includes(t))return;await V.useFirebaseIntegration(a.project).update(a.contentCollection,l.id,{status:t}),l.status=t,_.toast.success("Entry status changed")}catch{_.toast.error("Failed to change entry status")}},x=async l=>{try{if(!["draft","published","archived"].includes(l))return;const t=V.useFirebaseIntegration(a.project),i=[];c.value.forEach(async m=>{i.push(t.update(a.contentCollection,m,{status:l}))}),_.toast.promise(Promise.all(i),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const m=c.value.length;return c.value.forEach(u=>{b.value.find(C=>C.id==u).status=l}),c.value=[],`Entry status changed for ${m} entries`},error:m=>"Failed to change entry status"})}catch{_.toast.error("Failed to change entry status")}};return(l,t)=>{const i=e.resolveComponent("ContextMenuTrigger"),m=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),C=e.resolveComponent("ContextMenuContent"),w=e.resolveComponent("ContextMenuSeparator"),T=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),$=e.resolveComponent("ContextMenuSubContent"),M=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(C,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=f=>v("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&s.value?(e.openBlock(),e.createBlock(C,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=f=>e.unref(N)(s.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(w),e.unref(a).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=f=>g(s.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(w)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=f=>v("duplicateEntry",s.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=f=>y(s.value,"draft")),modelValue:s.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[5]||(t[5]=f=>y(s.value,"published")),modelValue:s.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[6]||(t[6]=f=>y(s.value,"archived")),modelValue:s.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=f=>v("deleteEntry",s.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(C,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=f=>x("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(h,{onClick:t[9]||(t[9]=f=>x("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(h,{onClick:t[10]||(t[10]=f=>x("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=f=>v("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ce={key:0,class:"relative flex flex-col flex-1"},de={class:"flex items-center justify-between gap-4 w-full my-4"},ue={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},pe={class:"flex items-center gap-4"},me={class:"text-lg whitespace-nowrap"},fe={class:"relative w-full max-w-sm items-center"},ve={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ge={class:"flex items-center gap-4"},Ce={class:"capitalize"},xe={class:"flex mb-4"},Ve=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup(D){const r=D,{hasPermission:v,isAdmin:b}=V.useModulePermissions(),{params:c,navigateTo:a}=V.useModuleRoute(),{confirm:E}=V.useConfirmation(),N=V.useFirebaseIntegration(r.config.project),s=e.ref(null),g=e.ref([]);V.useModuleBreadcrumbs(()=>[{text:s.value?.name??""}]);const y=async()=>{const n=await N.get(r.config.collectionsCollection,c.value.collectionId);n?s.value=n:(a("/"),_.toast.error("Collection not found"))},x=async()=>{const n=await N.find(r.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});g.value=n||[]},l=e.ref(1),t=e.ref([]),i=e.ref(""),m=e.ref(10),u=n=>{if(!n)return 0;if(typeof n?.toDate=="function")return n.toDate().getTime();const o=n instanceof Date?n:new Date(n);return Number.isNaN(o.getTime())?0:o.getTime()},C=e.computed(()=>{const n=i.value.trim().toLowerCase();return[...n?g.value.filter(p=>{const k=String(p?.title??"").toLowerCase(),S=String(p?.slug??"").toLowerCase();return k.includes(n)||S.includes(n)||p?.id===n}):g.value].sort((p,k)=>{const S=u(p?.updated?.at)||u(p?.updatedAt)||u(p?.createdAt);return(u(k?.updated?.at)||u(k?.updatedAt)||u(k?.createdAt))-S})}),w=e.computed(()=>{if(C.value.length<=m.value)return C.value;const n=(l.value-1)*m.value,o=n+m.value;return C.value.slice(n,o)});async function T(n){return(await N.find(r.config.contentCollection,{filters:[{field:"slug",operator:"==",value:n}]})).length>0}const h=()=>{t.value=w.value.map(n=>n.id)},$=async n=>{try{let o={...n},p=o.slug+"-copy",k=2;for(;await T(p);)p=o.slug+"-copy-"+k,k++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=p,o.status="draft",o.title=o.title+" (copy)";const S=await N.add(r.config.contentCollection,o);a(S.id),_.toast.success("Entry duplicated")}catch{_.toast.error("Failed to duplicate entry")}},M=async n=>{if(await E(`Are you sure you want to delete "${n.title}"?`))try{await N.remove(r.config.contentCollection,n.id),g.value=g.value.filter(p=>p.id!==n.id),t.value=[],_.toast.success("Entry deleted")}catch{_.toast.error("Failed to delete entry")}},d=async()=>{if(await E(`Are you sure you want to delete all selected ${s?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await N.remove(r.config.contentCollection,o)}),g.value=g.value.filter(o=>!t.value.includes(o.id)),t.value=[],_.toast.success("Entries deleted")}catch{_.toast.error("Failed to delete entries")}},f=e.ref({published:!0,draft:!0,archived:!1});e.watch(f,()=>{l.value=1});const A=n=>{n.target?.matches("input, textarea")||n.target?.isContentEditable||(n.key==="Escape"&&(t.value=[]),(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="a"&&(n.preventDefault(),h()))};return e.onMounted(()=>{y(),x(),window.addEventListener("keydown",A)}),e.onUnmounted(()=>{window.removeEventListener("keydown",A)}),e.provide("config",r.config),e.provide("filter",f),e.provide("entries",g),e.provide("selection",t),e.provide("collection",s),(n,o)=>{const p=e.resolveComponent("Button"),k=e.resolveComponent("Input"),S=e.resolveComponent("PaginationFirst"),F=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),U=e.resolveComponent("PaginationEllipsis"),j=e.resolveComponent("PaginationNext"),R=e.resolveComponent("PaginationLast"),q=e.resolveComponent("PaginationList"),K=e.resolveComponent("Pagination");return s.value?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",de,[e.createVNode(p,{onClick:o[0]||(o[0]=B=>e.unref(a)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createElementVNode("p",me,e.toDisplayString(C.value?.length)+" "+e.toDisplayString(s.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",fe,[e.createVNode(k,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>i.value="",["escape"])),modelValue:i.value,"onUpdate:modelValue":o[2]||(o[2]=B=>i.value=B)},null,8,["modelValue"]),e.createElementVNode("span",ve,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ge,[t.value.length>0?(e.openBlock(),e.createBlock(p,{key:0,variant:"destructive",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(b)()||e.unref(v)("create-entry")&&s.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(p,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(a)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(se)])],512),e.createElementVNode("div",xe,[e.createVNode(ie,{onSelectAll:h,onDuplicateEntry:$,onDeleteEntry:M,onDeleteSelection:d},{default:e.withCtx(()=>[e.createVNode(ee,{entries:w.value},null,8,["entries"])]),_:1})]),C.value?.length>m.value?(e.openBlock(),e.createBlock(K,{key:0,page:l.value,"onUpdate:page":o[4]||(o[4]=B=>l.value=B),"items-per-page":m.value,total:C.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(S),e.createVNode(F),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(L,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[L.type==="page"?(e.openBlock(),e.createBlock(I,{key:z,value:L.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(p,{class:"size-10 p-0",variant:L.value===l.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(L.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(U,{key:L.type,index:z},null,8,["index"]))],64))),256)),e.createVNode(j),e.createVNode(R)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=Ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),P=require("lucide-vue-next"),V=require("@oneclick.dev/cms-kit"),H=require("./interpolation-CsOrww73.js"),_=require("./index-ijdf0d9-.js"),O={class:"flex items-center gap-2"},W={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},G={key:0},Q={key:1},X={key:1,class:"bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"},J={key:2,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},Y=["href"],Z=["href"],ee=e.defineComponent({__name:"ListView",props:{entries:{type:Array,required:!0}},setup(D){const r=e.inject("selection"),v=e.inject("collection"),b=D,{config:c}=V.useModule(),{navigateTo:a,params:E}=V.useModuleRoute(),{hasPermission:N}=V.useModulePermissions(),s=(l,t)=>{l?r.value.push(t):r.value=r.value.filter(i=>i!==t)},g=l=>{if(!v.value)return"about:blank";let t=c.domain?.trim(),i=v.value.defaultLanguageRoutePattern?.trim();if(!t||!i)return"about:blank";t.endsWith("/")&&(t=t.slice(0,-1)),i.startsWith("/")||(i="/"+i);const m=l.liveByLocale.find(u=>u.locale===c.defaultLanguage)?.slug;return H.interpolateTemplateFromVariableContext(t+i,[{name:"slug",value:m},{name:"id",value:l.id},{name:"lang",value:c.defaultLanguage||"en"}])},y=l=>`${(window.location.origin+window.location.pathname).replace(/\/$/,"")}/${l.id}`,x=e.computed(()=>b.entries?.map(l=>({...l,status:l.archived?"archived":l.liveByLocale&&l.liveByLocale.length>0?"published":"draft",publishProgress:{completed:l.liveByLocale.length,total:c.supportedLanguages?.length||1}}))||[]);return(l,t)=>{const i=e.resolveComponent("TableHead"),m=e.resolveComponent("TableRow"),u=e.resolveComponent("TableHeader"),C=e.resolveComponent("Checkbox"),w=e.resolveComponent("TableCell"),T=e.resolveComponent("Button"),h=e.resolveComponent("TableBody"),$=e.resolveComponent("Table"),M=e.resolveComponent("Card");return e.openBlock(),e.createBlock(M,{class:"w-full py-4 px-4"},{default:e.withCtx(()=>[e.createVNode($,{class:"rounded overflow-hidden"},{default:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(m,null,{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createVNode(i,{class:"capitalize"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)?.contentEntryName||"entry"),1)]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("Last updated at",-1)])]),_:1}),e.createVNode(i,null,{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("Status",-1)])]),_:1}),e.createVNode(i,{class:"text-right"},{default:e.withCtx(()=>[...t[5]||(t[5]=[e.createTextVNode("Edit",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(h,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,d=>(e.openBlock(),e.createBlock(m,{key:d.id,onClick:f=>e.unref(a)("collections/"+e.unref(E).collectionId+"/"+d.id),class:"cursor-pointer"},{default:e.withCtx(()=>[e.unref(r)?.length>0?(e.openBlock(),e.createBlock(w,{key:0},{default:e.withCtx(()=>[e.createVNode(C,{"model-value":e.unref(r)?.includes(d.id),"onUpdate:modelValue":f=>s(f,d.id),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["prevent","stop"]))},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024)):e.createCommentVNode("",!0),e.createVNode(w,{class:"font-medium"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("span",null,e.toDisplayString(d.title),1)])]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.updated?.at?new Date(d.updated.at).toLocaleString():"N/A"),1)]),_:2},1024),e.createVNode(w,null,{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("span",W,[d.publishProgress.completed===d.publishProgress.total?(e.openBlock(),e.createElementBlock("span",G,"Published")):(e.openBlock(),e.createElementBlock("span",Q,"Partly Published ("+e.toDisplayString(d.publishProgress.completed)+"/"+e.toDisplayString(d.publishProgress.total)+")",1))])):d.status==="draft"?(e.openBlock(),e.createElementBlock("span",X,"Draft")):d.status==="archived"?(e.openBlock(),e.createElementBlock("span",J,"Archived")):e.createCommentVNode("",!0)]),_:2},1024),e.createVNode(w,{class:"text-right"},{default:e.withCtx(()=>[d.status==="published"?(e.openBlock(),e.createElementBlock("a",{key:0,href:g(d),target:"_blank",rel:"noreferrer",onClick:t[1]||(t[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Globe),{class:"size-4"})]),_:1})],8,Y)):e.createCommentVNode("",!0),e.createElementVNode("a",{href:y(d),rel:"noreferrer",onClick:t[2]||(t[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(T,{variant:"ghost",size:"icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Pencil),{class:"size-4"})]),_:1})],8,Z)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})}}}),te={class:"flex items-center space-x-2 mb-4"},oe={for:"chk_published_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},ne={class:"flex items-center space-x-2 mb-4"},le={for:"chk_draft_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},re={class:"flex items-center space-x-2 mb-4"},ae={for:"chk_archived_entries",class:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"},se=e.defineComponent({__name:"FilterPopover",setup(D){const r=e.inject("filter"),v=e.ref(""),b=()=>{r.value={published:!0,draft:!0,archived:!1}};return(c,a)=>{const E=e.resolveComponent("Button"),N=e.resolveComponent("PopoverTrigger"),s=e.resolveComponent("Checkbox"),g=e.resolveComponent("PopoverContent"),y=e.resolveComponent("Popover");return e.openBlock(),e.createBlock(y,null,{default:e.withCtx(()=>[e.createVNode(N,{asChild:""},{default:e.withCtx(()=>[e.createVNode(E,{variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Filter),{class:"size-4"}),a[3]||(a[3]=e.createTextVNode(" Filter ",-1))]),_:1})]),_:1}),e.createVNode(g,{class:"w-64"},{default:e.withCtx(()=>[a[5]||(a[5]=e.createElementVNode("p",{class:"text-sm font-medium text-muted-foreground mb-4"}," Filter by Status ",-1)),e.createElementVNode("div",te,[e.createVNode(s,{id:"chk_published_entries",modelValue:e.unref(r).published,"onUpdate:modelValue":a[0]||(a[0]=x=>e.unref(r).published=x)},null,8,["modelValue"]),e.createElementVNode("label",oe," Show published "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",ne,[e.createVNode(s,{id:"chk_draft_entries",modelValue:e.unref(r).draft,"onUpdate:modelValue":a[1]||(a[1]=x=>e.unref(r).draft=x)},null,8,["modelValue"]),e.createElementVNode("label",le," Show draft "+e.toDisplayString(v.value||"entries"),1)]),e.createElementVNode("div",re,[e.createVNode(s,{id:"chk_archived_entries",modelValue:e.unref(r).archived,"onUpdate:modelValue":a[2]||(a[2]=x=>e.unref(r).archived=x)},null,8,["modelValue"]),e.createElementVNode("label",ae," Show archived "+e.toDisplayString(v.value||"entries"),1)]),!e.unref(r).published||!e.unref(r).draft||e.unref(r).archived?(e.openBlock(),e.createBlock(E,{key:0,variant:"secondary",class:"ml-auto my-2",size:"sm",onClick:b},{default:e.withCtx(()=>[e.createVNode(e.unref(P.RotateCcw),{class:"size-3"}),a[4]||(a[4]=e.createElementVNode("span",{class:"ml-0.5 text-xs"},"Reset filters",-1))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})}}}),ie=e.defineComponent({__name:"ContentEntryContextMenu",emits:["selectAll","duplicateEntry","deleteEntry","deleteSelection"],setup(D,{emit:r}){const v=r,b=e.inject("entries"),c=e.inject("selection"),a=e.inject("config"),{hasPermission:E}=V.useModulePermissions(),{navigateTo:N}=V.useModuleRoute(),s=e.computed(()=>c.value?.length!==1?null:b.value?.find(l=>l.id===c.value[0])),g=l=>{let t=a.previewUrl;t=t.replace("{{ id","{{id"),t=t.replace("id }}","id}}"),t=t.replace("{{id}}",l.id),t=t.replace("{{ slug","{{slug"),t=t.replace("slug }}","slug}}"),t=t.replace("{{slug}}",l.slug),window.open(t,"_blank")},y=async(l,t)=>{try{if(!["draft","published","archived"].includes(t))return;await V.useFirebaseIntegration(a.project).update(a.contentCollection,l.id,{status:t}),l.status=t,_.toast.success("Entry status changed")}catch{_.toast.error("Failed to change entry status")}},x=async l=>{try{if(!["draft","published","archived"].includes(l))return;const t=V.useFirebaseIntegration(a.project),i=[];c.value.forEach(async m=>{i.push(t.update(a.contentCollection,m,{status:l}))}),_.toast.promise(Promise.all(i),{loading:`Changing status of ${c.value.length} entries...`,success:()=>{const m=c.value.length;return c.value.forEach(u=>{b.value.find(C=>C.id==u).status=l}),c.value=[],`Entry status changed for ${m} entries`},error:m=>"Failed to change entry status"})}catch{_.toast.error("Failed to change entry status")}};return(l,t)=>{const i=e.resolveComponent("ContextMenuTrigger"),m=e.resolveComponent("ContextMenuShortcut"),u=e.resolveComponent("ContextMenuItem"),C=e.resolveComponent("ContextMenuContent"),w=e.resolveComponent("ContextMenuSeparator"),T=e.resolveComponent("ContextMenuSubTrigger"),h=e.resolveComponent("ContextMenuCheckboxItem"),$=e.resolveComponent("ContextMenuSubContent"),M=e.resolveComponent("ContextMenuSub"),d=e.resolveComponent("ContextMenu");return e.openBlock(),e.createBlock(d,null,{default:e.withCtx(()=>[e.createVNode(i,{class:"flex flex-1"},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3}),e.unref(c).length===0?(e.openBlock(),e.createBlock(C,{key:0,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[0]||(t[0]=f=>v("selectAll"))},{default:e.withCtx(()=>[t[13]||(t[13]=e.createTextVNode(" Select all ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("⌘ + A",-1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length===1&&s.value?(e.openBlock(),e.createBlock(C,{key:1,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(u,{inset:"",onClick:t[1]||(t[1]=f=>e.unref(N)(s.value.id))},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Edit entry ",-1)])]),_:1}),e.createVNode(w),e.unref(a).previewUrl?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u,{inset:"",onClick:t[2]||(t[2]=f=>g(s.value))},{default:e.withCtx(()=>[t[15]||(t[15]=e.createTextVNode(" Preview entry ",-1)),e.createVNode(m,null,{default:e.withCtx(()=>[e.createVNode(e.unref(P.ExternalLink),{class:"size-4"})]),_:1})]),_:1}),e.createVNode(w)],64)):e.createCommentVNode("",!0),e.createVNode(u,{inset:"",onClick:t[3]||(t[3]=f=>v("duplicateEntry",s.value))},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Duplicate entry ",-1)])]),_:1}),e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Change status ",-1)])]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[4]||(t[4]=f=>y(s.value,"draft")),modelValue:s.value.status==="draft"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[5]||(t[5]=f=>y(s.value,"published")),modelValue:s.value.status==="published"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1},8,["modelValue"]),e.createVNode(h,{onClick:t[6]||(t[6]=f=>y(s.value,"archived")),modelValue:s.value.status==="archived"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[7]||(t[7]=f=>v("deleteEntry",s.value))},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode(" Delete entry ",-1)])]),_:1})]),_:1})):e.createCommentVNode("",!0),e.unref(c).length>1?(e.openBlock(),e.createBlock(C,{key:2,class:"w-64"},{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createVNode(T,{inset:""},{default:e.withCtx(()=>[e.createTextVNode(" Change status ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1}),e.createVNode($,{class:"w-48"},{default:e.withCtx(()=>[e.createVNode(h,{onClick:t[8]||(t[8]=f=>x("draft"))},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-blue-500"},null,-1),e.createTextVNode(" Draft ",-1)])]),_:1}),e.createVNode(h,{onClick:t[9]||(t[9]=f=>x("published"))},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-green-500"},null,-1),e.createTextVNode(" Published ",-1)])]),_:1}),e.createVNode(h,{onClick:t[10]||(t[10]=f=>x("archived"))},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createElementVNode("span",{class:"size-2 rounded-full bg-gray-300"},null,-1),e.createTextVNode(" Archived ",-1)])]),_:1})]),_:1})]),_:1}),e.createVNode(u,{inset:"",variant:"destructive",onClick:t[11]||(t[11]=f=>v("deleteSelection"))},{default:e.withCtx(()=>[e.createTextVNode(" Delete entries ("+e.toDisplayString(e.unref(c).length)+") ",1)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:3})}}}),ce={key:0,class:"relative flex flex-col flex-1"},de={class:"flex items-center justify-between gap-4 w-full my-4"},ue={ref:"container",class:"flex items-center justify-between gap-4 w-full mb-8"},pe={class:"flex items-center gap-4"},me={class:"text-lg whitespace-nowrap"},fe={class:"relative w-full max-w-sm items-center"},ve={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},ge={class:"flex items-center gap-4"},Ce={class:"capitalize"},xe={class:"flex mb-4"},Ve=e.defineComponent({__name:"Entries",props:{config:{type:Object,required:!0}},setup(D){const r=D,{hasPermission:v,isAdmin:b}=V.useModulePermissions(),{params:c,navigateTo:a}=V.useModuleRoute(),{confirm:E}=V.useConfirmation(),N=V.useFirebaseIntegration(r.config.project),s=e.ref(null),g=e.ref([]);V.useModuleBreadcrumbs(()=>[{text:s.value?.name??""}]);const y=async()=>{const n=await N.get(r.config.collectionsCollection,c.value.collectionId);n?s.value=n:(a("/"),_.toast.error("Collection not found"))},x=async()=>{const n=await N.find(r.config.contentCollection,{filters:[{field:"collectionId",operator:"==",value:c.value.collectionId}]});g.value=n||[]},l=e.ref(1),t=e.ref([]),i=e.ref(""),m=e.ref(10),u=n=>{if(!n)return 0;if(typeof n?.toDate=="function")return n.toDate().getTime();const o=n instanceof Date?n:new Date(n);return Number.isNaN(o.getTime())?0:o.getTime()},C=e.computed(()=>{const n=i.value.trim().toLowerCase();return[...n?g.value.filter(p=>{const k=String(p?.title??"").toLowerCase(),S=String(p?.slug??"").toLowerCase();return k.includes(n)||S.includes(n)||p?.id===n}):g.value].sort((p,k)=>{const S=u(p?.updated?.at)||u(p?.updatedAt)||u(p?.createdAt);return(u(k?.updated?.at)||u(k?.updatedAt)||u(k?.createdAt))-S})}),w=e.computed(()=>{if(C.value.length<=m.value)return C.value;const n=(l.value-1)*m.value,o=n+m.value;return C.value.slice(n,o)});async function T(n){return(await N.find(r.config.contentCollection,{filters:[{field:"slug",operator:"==",value:n}]})).length>0}const h=()=>{t.value=w.value.map(n=>n.id)},$=async n=>{try{let o={...n},p=o.slug+"-copy",k=2;for(;await T(p);)p=o.slug+"-copy-"+k,k++;o.id=void 0,o.createdAt=new Date,o.updatedAt=new Date,o.slug=p,o.status="draft",o.title=o.title+" (copy)";const S=await N.add(r.config.contentCollection,o);a(S.id),_.toast.success("Entry duplicated")}catch{_.toast.error("Failed to duplicate entry")}},M=async n=>{if(await E(`Are you sure you want to delete "${n.title}"?`))try{await N.remove(r.config.contentCollection,n.id),g.value=g.value.filter(p=>p.id!==n.id),t.value=[],_.toast.success("Entry deleted")}catch{_.toast.error("Failed to delete entry")}},d=async()=>{if(await E(`Are you sure you want to delete all selected ${s?.contentEntryNamePlural||"entries"} (${t.value.length})?`))try{t.value.forEach(async o=>{await N.remove(r.config.contentCollection,o)}),g.value=g.value.filter(o=>!t.value.includes(o.id)),t.value=[],_.toast.success("Entries deleted")}catch{_.toast.error("Failed to delete entries")}},f=e.ref({published:!0,draft:!0,archived:!1});e.watch(f,()=>{l.value=1});const A=n=>{n.target?.matches("input, textarea")||n.target?.isContentEditable||(n.key==="Escape"&&(t.value=[]),(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="a"&&(n.preventDefault(),h()))};return e.onMounted(()=>{y(),x(),window.addEventListener("keydown",A)}),e.onUnmounted(()=>{window.removeEventListener("keydown",A)}),e.provide("config",r.config),e.provide("filter",f),e.provide("entries",g),e.provide("selection",t),e.provide("collection",s),(n,o)=>{const p=e.resolveComponent("Button"),k=e.resolveComponent("Input"),S=e.resolveComponent("PaginationFirst"),F=e.resolveComponent("PaginationPrev"),I=e.resolveComponent("PaginationListItem"),U=e.resolveComponent("PaginationEllipsis"),j=e.resolveComponent("PaginationNext"),R=e.resolveComponent("PaginationLast"),q=e.resolveComponent("PaginationList"),K=e.resolveComponent("Pagination");return s.value?(e.openBlock(),e.createElementBlock("div",ce,[e.createElementVNode("div",de,[e.createVNode(p,{onClick:o[0]||(o[0]=B=>e.unref(a)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(P.ChevronLeft),{class:"size-4"}),o[5]||(o[5]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",pe,[e.createElementVNode("p",me,e.toDisplayString(C.value?.length)+" "+e.toDisplayString(s.value?.contentEntryNamePlural||"entries"),1),e.createElementVNode("div",fe,[e.createVNode(k,{id:"search",type:"text",placeholder:"Search...",class:"pl-8",onKeydown:o[1]||(o[1]=e.withKeys(B=>i.value="",["escape"])),modelValue:i.value,"onUpdate:modelValue":o[2]||(o[2]=B=>i.value=B)},null,8,["modelValue"]),e.createElementVNode("span",ve,[e.createVNode(e.unref(P.Search),{class:"size-4 text-muted-foreground"})])])]),e.createElementVNode("div",ge,[t.value.length>0?(e.openBlock(),e.createBlock(p,{key:0,variant:"destructive",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(" Delete Selection ("+e.toDisplayString(t.value.length)+") ",1)]),_:1})):e.createCommentVNode("",!0),e.unref(b)()||e.unref(v)("create-entry")&&s.value?.allowUserEntryManagement?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(c)?.collectionId?(e.openBlock(),e.createBlock(p,{key:0,variant:"outline",onClick:o[3]||(o[3]=B=>e.unref(a)(`collections/${e.unref(c).collectionId}/new`))},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Plus),{class:"size-4"}),e.createElementVNode("span",null,[o[6]||(o[6]=e.createTextVNode(" New ",-1)),e.createElementVNode("span",Ce,e.toDisplayString(s.value?.contentEntryName||"entry"),1)])]),_:1})):e.createCommentVNode("",!0),o[7]||(o[7]=e.createElementVNode("div",{class:"w-[1px] h-8 bg-border"},null,-1))],64)):e.createCommentVNode("",!0),e.createVNode(se)])],512),e.createElementVNode("div",xe,[e.createVNode(ie,{onSelectAll:h,onDuplicateEntry:$,onDeleteEntry:M,onDeleteSelection:d},{default:e.withCtx(()=>[e.createVNode(ee,{entries:w.value},null,8,["entries"])]),_:1})]),C.value?.length>m.value?(e.openBlock(),e.createBlock(K,{key:0,page:l.value,"onUpdate:page":o[4]||(o[4]=B=>l.value=B),"items-per-page":m.value,total:C.value?.length,"sibling-count":1,"show-edges":""},{default:e.withCtx(()=>[e.createVNode(q,{class:"flex items-center gap-1"},{default:e.withCtx(({items:B})=>[e.createVNode(S),e.createVNode(F),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B,(L,z)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[L.type==="page"?(e.openBlock(),e.createBlock(I,{key:z,value:L.value,"as-child":""},{default:e.withCtx(()=>[e.createVNode(p,{class:"size-10 p-0",variant:L.value===l.value?"default":"outline"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(L.value),1)]),_:2},1032,["variant"])]),_:2},1032,["value"])):(e.openBlock(),e.createBlock(U,{key:L.type,index:z},null,8,["index"]))],64))),256)),e.createVNode(j),e.createVNode(R)]),_:1})]),_:1},8,["page","items-per-page","total"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)}}});exports.default=Ve;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as Q, inject as H, computed as O, resolveComponent as a, openBlock as d, createBlock as x, withCtx as n, createVNode as t, unref as s, createCommentVNode as E, createTextVNode as m, toDisplayString as w, createElementBlock as S, Fragment as G, renderList as le, withModifiers as X, createElementVNode as u, ref as N, renderSlot as de, watch as ce, onMounted as pe, onUnmounted as fe, provide as W, withKeys as me } from "vue";
|
|
2
2
|
import { Globe as ge, Pencil as ve, Filter as _e, RotateCcw as be, ExternalLink as ye, ChevronLeft as Ce, Search as xe, Plus as we } from "lucide-vue-next";
|
|
3
3
|
import { useModule as he, useModuleRoute as Y, useModulePermissions as Z, useFirebaseIntegration as J, useConfirmation as ke, useModuleBreadcrumbs as Pe } from "@oneclick.dev/cms-kit";
|
|
4
|
-
import { i as Ee } from "./interpolation-
|
|
4
|
+
import { i as Ee } from "./interpolation-BBwG_ON6.mjs";
|
|
5
5
|
import { t as L } from "./index-RLz1QPrf.mjs";
|
|
6
6
|
const $e = { class: "flex items-center gap-2" }, Se = {
|
|
7
7
|
key: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-We8hT28L.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),l=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,l.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,l.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=o=>c.value=o)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=o=>m.value=o),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=o=>a.value=o)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=o=>p.value=o),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=o=>x.value=o),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=o=>V.value=o),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=o=>n.value=o),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=o=>l.value=o),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=o=>C.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=o=>E.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,o=>(e.openBlock(),e.createBlock(D,{key:o.id,value:o.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${o.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[o.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=o=>i.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=o=>d.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{await c.add(f.config.collectionsCollection,n)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const l=r.value.findIndex(i=>i.id===n.id);l!==-1&&(r.value[l]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async l=>{if(l)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,l)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[0]||(l[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),l[5]||(l[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[1]||(l[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[2]||(l[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),l[7]||(l[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:l[3]||(l[3]=d=>v.value=d),onEdit:l[4]||(l[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("lucide-vue-next"),N=require("@oneclick.dev/cms-kit"),re=require("./interpolation-CsOrww73.js"),P=require("./index-ijdf0d9-.js"),ie={class:"grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4"},ue={class:"relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3"},de={class:"self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]"},ce=["title"],me=["title"],pe={class:"absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100"},ve=e.defineComponent({__name:"CollectionsGridView",props:{collections:{type:Array,required:!0}},emits:["edit","delete"],setup(w,{emit:f}){const{navigateTo:y}=N.useModuleRoute(),k=f;return(S,u)=>{const b=e.resolveComponent("Button"),c=e.resolveComponent("DropdownMenuTrigger"),r=e.resolveComponent("DropdownMenuItem"),g=e.resolveComponent("DropdownMenuContent"),v=e.resolveComponent("DropdownMenu"),m=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.collections,a=>(e.openBlock(),e.createBlock(m,{key:a.id,class:"group hover:bg-input/50 cursor-pointer transition-colors duration-200",onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("div",{class:e.normalizeClass(`p-2 bg-${a.tint} rounded-md self-center mr-3`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[a.icon]),{class:"size-6 text-white"}))],2),e.createElementVNode("div",de,[e.createElementVNode("p",{class:"truncate",title:a.name||"Unnamed Entry Collection"},e.toDisplayString(a.name||"Unnamed Entry Collection"),9,ce),a.contentEntryName||a.contentEntryNamePlural?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-xs text-muted-foreground truncate",title:`Manage ${a.contentEntryNamePlural||a.contentEntryName} here`}," Manage "+e.toDisplayString(a.contentEntryNamePlural||a.contentEntryName)+" here ",9,me)):e.createCommentVNode("",!0)]),e.createElementVNode("div",pe,[e.createVNode(v,null,{default:e.withCtx(()=>[e.createVNode(c,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(b,{variant:"ghost",size:"icon",onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.EllipsisVertical),{class:"size-5"})]),_:1})]),_:1}),e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(r,{onClick:p=>e.unref(y)("collections/"+a.id)},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("Open Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("edit",a)},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("Edit Collection...",-1)])]),_:1},8,["onClick"]),e.createVNode(r,{onClick:p=>k("delete",a.id),variant:"destructive"},{default:e.withCtx(()=>[...u[3]||(u[3]=[e.createTextVNode("Delete Collection...",-1)])]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024)])])]),_:2},1032,["onClick"]))),128))])}}}),fe={class:"grid py-4"},ge={class:"flex gap-6 mb-6"},Ve={class:"w-1/3"},Ce={class:"w-1/3"},xe={class:"w-1/3"},Ne={class:"grid"},we={class:"flex gap-6 mb-6"},ye={class:"w-1/2"},ke={class:"w-1/2"},Ee={class:"flex items-center gap-2"},_e={class:"flex items-center gap-4"},be={class:"grid grid-cols-2 gap-4"},Te={class:"grid"},Be={class:"mb-6"},Se={class:"flex items-center justify-between gap-4 flex-wrap"},De={key:0,class:"text-xs italic text-muted-foreground mt-1"},Pe={class:"flex items-center justify-between gap-4 flex-wrap"},Me={key:0,class:"text-xs italic text-muted-foreground mt-1"},$e=e.defineComponent({__name:"CollectionDialog",props:{config:{type:Object,required:!0},components:{type:Array,required:!0}},emits:["add","edit","delete"],setup(w,{expose:f,emit:y}){const k=[{name:"id",type:"string"},{name:"slug",type:"string"},{name:"lang",type:"string"}],{confirm:S}=N.useConfirmation(),u=y,b=w,c=e.ref(!1),r=e.ref("create"),g=e.ref(""),v=e.ref(""),m=e.ref(""),a=e.ref(""),p=e.ref(""),x=e.ref(""),V=e.ref(!0),n=e.ref(!1),l=e.ref(null),i=e.ref("{{ slug }}"),d=e.ref("/{{ lang }}/{{ slug }}"),C=e.ref("all"),E=e.ref([]),U=e.computed(()=>R(i.value)),h=e.computed(()=>R(d.value));function R(s){if(!s)return"";let t=b.config.domain||"https://domain.com";return t.endsWith("/")&&(t=t.slice(0,-1)),s.startsWith("/")||(s="/"+s),re.interpolateTemplateFromVariableContext(t+s,[{name:"slug",value:"example-slug"},{name:"id",value:"12345"},{name:"lang",value:"en"}])}const j=s=>{s?(r.value="edit",g.value=s.id,v.value=s.name||"",m.value=s.tint||"",a.value=s.icon||"",p.value=s.contentEntryName||"",x.value=s.contentEntryNamePlural||"",V.value=s.allowUserEntryManagement??!0,n.value=!!s.customSettings,l.value=s.customSettings||null,i.value=s.defaultLanguageRoutePattern||"{{ slug }}",d.value=s.multilingualRoutePattern||"/{{ lang }}/{{ slug }}",C.value=s.componentAvailability||"all",E.value=s.selectedComponents||[]):(r.value="create",g.value="",v.value="",m.value="",a.value="",p.value="",x.value="",V.value=!0,n.value=!1,l.value=null,i.value="{{ slug }}",d.value="/{{ lang }}/{{ slug }}",C.value="all",E.value=[]),c.value=!0},G=()=>{u("add",{name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},W=()=>{u("edit",{id:g.value,name:v.value,tint:m.value,icon:a.value,contentEntryName:p.value,contentEntryNamePlural:x.value,allowUserEntryManagement:V.value,showCustomSettings:n.value,customSettings:n.value?l.value:null,defaultLanguageRoutePattern:i.value,multilingualRoutePattern:d.value,componentAvailability:C.value,selectedComponents:C.value==="all"?[]:E.value}),c.value=!1},H=async()=>{await S("Are you sure you want to delete this collection? This action cannot be undone.","Delete Collection","Delete")&&(u("delete",g.value),c.value=!1)};return f({openDialog:j}),(s,t)=>{const K=e.resolveComponent("DialogTitle"),J=e.resolveComponent("DialogDescription"),Q=e.resolveComponent("DialogHeader"),T=e.resolveComponent("TabsTrigger"),X=e.resolveComponent("TabsList"),M=e.resolveComponent("Input"),Y=e.resolveComponent("TailwindColorPicker"),Z=e.resolveComponent("LucideIconPicker"),B=e.resolveComponent("TabsContent"),ee=e.resolveComponent("Checkbox"),A=e.resolveComponent("Label"),te=e.resolveComponent("Switch"),oe=e.resolveComponent("FormBuilderSelect"),L=e.resolveComponent("SelectValue"),I=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),F=e.resolveComponent("SelectGroup"),q=e.resolveComponent("SelectContent"),z=e.resolveComponent("Select"),O=e.resolveComponent("Sandbox"),le=e.resolveComponent("Tabs"),$=e.resolveComponent("Button"),ne=e.resolveComponent("DialogFooter"),ae=e.resolveComponent("DialogScrollContent"),se=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(se,{open:c.value,"onUpdate:open":t[12]||(t[12]=o=>c.value=o)},{default:e.withCtx(()=>[e.createVNode(ae,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(Q,null,{default:e.withCtx(()=>[e.createVNode(K,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value==="create"?"Add New Collection":"Update Collection"),1)]),_:1}),e.createVNode(J,null,{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode(" Each collection has it's own set of entries, settings, ... ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",fe,[e.createVNode(le,{"default-value":"account",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(X,{class:"mb-6"},{default:e.withCtx(()=>[e.createVNode(T,{value:"collection"},{default:e.withCtx(()=>[...t[14]||(t[14]=[e.createTextVNode(" Collection ",-1)])]),_:1}),e.createVNode(T,{value:"entries"},{default:e.withCtx(()=>[...t[15]||(t[15]=[e.createTextVNode(" Entries ",-1)])]),_:1}),e.createVNode(T,{value:"components"},{default:e.withCtx(()=>[...t[16]||(t[16]=[e.createTextVNode(" Components ",-1)])]),_:1}),e.createVNode(T,{value:"styling"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(T,{value:"preview"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode(" Preview URL ",-1)])]),_:1})]),_:1}),e.createVNode(B,{value:"collection"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.createElementVNode("div",Ve,[t[19]||(t[19]=e.createElementVNode("label",{for:"collection-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Collection Name",-1)),e.createVNode(M,{modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o),id:"collection-dialog-display-name"},null,8,["modelValue"])]),e.createElementVNode("div",Ce,[t[20]||(t[20]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(Y,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=o=>m.value=o),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",xe,[t[21]||(t[21]=e.createElementVNode("label",{class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(Z,{modelValue:a.value,"onUpdate:modelValue":t[2]||(t[2]=o=>a.value=o)},null,8,["modelValue"])])])]),_:1}),e.createVNode(B,{value:"entries"},{default:e.withCtx(()=>[e.createElementVNode("div",Ne,[t[26]||(t[26]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entries ",-1)),e.createElementVNode("div",we,[e.createElementVNode("div",ye,[t[22]||(t[22]=e.createElementVNode("label",{for:"collection-dialog-entry-name",class:"text-sm mb-1 block font-medium"},"Entry name (singular)",-1)),e.createVNode(M,{modelValue:p.value,"onUpdate:modelValue":t[3]||(t[3]=o=>p.value=o),id:"collection-dialog-entry-name",placeholder:"Entry"},null,8,["modelValue"])]),e.createElementVNode("div",ke,[t[23]||(t[23]=e.createElementVNode("label",{for:"collection-dialog-entry-name-plural",class:"text-sm mb-1 block font-medium"},"Entry name (plural)",-1)),e.createVNode(M,{modelValue:x.value,"onUpdate:modelValue":t[4]||(t[4]=o=>x.value=o),id:"collection-dialog-entry-name-plural",placeholder:"Entries"},null,8,["modelValue"])])]),e.createElementVNode("div",Ee,[e.createVNode(ee,{modelValue:V.value,"onUpdate:modelValue":t[5]||(t[5]=o=>V.value=o),id:"collection-dialog-allow-user-entry-management"},null,8,["modelValue"]),e.createVNode(A,{for:"collection-dialog-allow-user-entry-management"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Allow users to create, edit and delete entries in this collection",-1)])]),_:1})]),t[27]||(t[27]=e.createElementVNode("hr",{class:"my-6"},null,-1)),t[28]||(t[28]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Entry Custom Settings ",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-xs mb-2 text-muted-foreground"}," Specific settings all entries in this collection can edit. ",-1)),e.createElementVNode("div",_e,[e.createVNode(te,{modelValue:n.value,"onUpdate:modelValue":t[6]||(t[6]=o=>n.value=o),id:"collection-dialog-component-settings-toggle",class:"mb-4"},null,8,["modelValue"]),e.createVNode(A,{class:"-mt-3.5",for:"collection-dialog-component-settings-toggle"},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Show settings form for this collection's entries. ",-1)])]),_:1})]),n.value?(e.openBlock(),e.createBlock(oe,{key:0,modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=o=>l.value=o),class:"w-1/2"},null,8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"components"},{default:e.withCtx(()=>[t[33]||(t[33]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Available Components ",-1)),e.createElementVNode("div",be,[e.createVNode(z,{modelValue:C.value,"onUpdate:modelValue":t[8]||(t[8]=o=>C.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L)]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(D,{value:"all"},{default:e.withCtx(()=>[...t[30]||(t[30]=[e.createTextVNode(" All ",-1)])]),_:1}),e.createVNode(D,{value:"all-except"},{default:e.withCtx(()=>[...t[31]||(t[31]=[e.createTextVNode(" All, except... ",-1)])]),_:1}),e.createVNode(D,{value:"only"},{default:e.withCtx(()=>[...t[32]||(t[32]=[e.createTextVNode(" Only... ",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"]),C.value!=="all"?(e.openBlock(),e.createBlock(z,{key:0,multiple:!0,modelValue:E.value,"onUpdate:modelValue":t[9]||(t[9]=o=>E.value=o)},{default:e.withCtx(()=>[e.createVNode(I,{class:"w-full"},{default:e.withCtx(()=>[e.createVNode(L,{placeholder:"Select components..."})]),_:1}),e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(F,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.components,o=>(e.openBlock(),e.createBlock(D,{key:o.id,value:o.id},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(`p-1 bg-${o.tint} rounded-md flex items-center justify-center`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_.icons)[o.icon]),{class:"size-4 text-white"}))],2),e.createTextVNode(" "+e.toDisplayString(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(B,{value:"styling"},{default:e.withCtx(()=>[...t[34]||(t[34]=[e.createTextVNode(" Styling ",-1)])]),_:1}),e.createVNode(B,{value:"preview"},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[t[37]||(t[37]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Preview URL ",-1)),e.createElementVNode("div",Be,[e.createElementVNode("div",Se,[t[35]||(t[35]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Default Language Route",-1)),e.createVNode(O,{modelValue:i.value,"onUpdate:modelValue":t[10]||(t[10]=o=>i.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),U.value?(e.openBlock(),e.createElementBlock("p",De,"Example: "+e.toDisplayString(U.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",null,[e.createElementVNode("div",Pe,[t[36]||(t[36]=e.createElementVNode("label",{class:"text-sm basis-[200px] block font-medium"},"Multilingual Route",-1)),e.createVNode(O,{modelValue:d.value,"onUpdate:modelValue":t[11]||(t[11]=o=>d.value=o),variables:k,class:"flex-1"},null,8,["modelValue"])]),h.value?(e.openBlock(),e.createElementBlock("p",Me,"Example: "+e.toDisplayString(h.value),1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1})]),e.createVNode(ne,null,{default:e.withCtx(()=>[r.value==="edit"?(e.openBlock(),e.createBlock($,{key:0,variant:"destructive",class:"mr-auto",onClick:H},{default:e.withCtx(()=>[...t[38]||(t[38]=[e.createTextVNode(" Delete Collection ",-1)])]),_:1})):e.createCommentVNode("",!0),r.value==="create"?(e.openBlock(),e.createBlock($,{key:1,type:"submit",onClick:G},{default:e.withCtx(()=>[...t[39]||(t[39]=[e.createTextVNode(" Add Collection ",-1)])]),_:1})):(e.openBlock(),e.createBlock($,{key:2,type:"submit",onClick:W},{default:e.withCtx(()=>[...t[40]||(t[40]=[e.createTextVNode(" Edit Collection ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ue={class:"relative flex flex-col flex-1"},he={class:"flex items-center justify-between gap-4 w-full my-4"},Re={class:"flex items-center gap-4"},Ae={key:0,class:"text-lg whitespace-nowrap"},Le={key:1,class:"text-lg whitespace-nowrap"},Ie={key:0,class:"flex items-center gap-4"},Fe=e.defineComponent({__name:"Overview",props:{config:{type:Object,required:!0}},setup(w){const f=w,{getModuleData:y}=N.useModuleStorage(),{hasPermission:k,isAdmin:S}=N.useModulePermissions(),{navigateTo:u}=N.useModuleRoute(),{confirm:b}=N.useConfirmation();N.useModuleBreadcrumbs(()=>[]);const c=N.useFirebaseIntegration(f.config.project),r=e.ref(null),g=e.ref([]),v=e.ref(null);e.computed(()=>r.value?.find(n=>n.id===v.value)||null);const m=e.useTemplateRef("collectionModal"),a=async()=>{const n=await c.find(f.config.collectionsCollection);r.value=n||[]},p=async n=>{await c.add(f.config.collectionsCollection,n)},x=async n=>{try{await c.update(f.config.collectionsCollection,n.id,n);const l=r.value.findIndex(i=>i.id===n.id);l!==-1&&(r.value[l]=n),P.toast.success("Collection updated")}catch{P.toast.error("Failed to update collection")}},V=n=>{b("Are you sure you want to delete this collection? This action cannot be undone.").then(async l=>{if(l)try{await c.remove(f.config.collectionsCollection,n),r.value=r.value.filter(i=>i.id!==n),P.toast.success("Collection deleted")}catch{P.toast.error("Failed to delete collection")}})};return e.onMounted(()=>{a(),y("components").then(n=>{g.value=n})}),(n,l)=>{const i=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",Ue,[e.createElementVNode("div",he,[e.createElementVNode("div",Re,[r.value!==null?(e.openBlock(),e.createElementBlock("p",Ae,e.toDisplayString(r.value.length)+" "+e.toDisplayString(r.value.length===1?"Collection":"Collections"),1)):(e.openBlock(),e.createElementBlock("p",Le,"Loading Collections..."))]),e.unref(S)()?(e.openBlock(),e.createElementBlock("div",Ie,[e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[0]||(l[0]=d=>e.unref(u)("global-styling"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Paintbrush),{class:"size-4"}),l[5]||(l[5]=e.createTextVNode(" Global Styling ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[1]||(l[1]=d=>e.unref(u)("components"))},{default:e.withCtx(()=>[e.createVNode(e.unref(_.ToyBrick),{class:"size-4"}),l[6]||(l[6]=e.createTextVNode(" Components ",-1))]),_:1}),e.createVNode(i,{variant:"outline",class:"text-primary hover:text-primary",onClick:l[2]||(l[2]=d=>m.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(_.Plus),{class:"size-4"}),l[7]||(l[7]=e.createTextVNode(" New Collection ",-1))]),_:1})])):e.createCommentVNode("",!0)]),e.createVNode(ve,{collections:r.value,onOpen:l[3]||(l[3]=d=>v.value=d),onEdit:l[4]||(l[4]=d=>m.value.openDialog(d)),onDelete:V},null,8,["collections"]),e.createVNode($e,{config:w.config,components:g.value,ref_key:"collectionModal",ref:m,onAdd:p,onEdit:x,onDelete:V},null,8,["config","components"])])}}});exports.default=Fe;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as G, resolveComponent as n, openBlock as c, createElementBlock as k, Fragment as te, renderList as le, createBlock as w, unref as C, withCtx as l, createElementVNode as o, normalizeClass as oe, resolveDynamicComponent as ne, toDisplayString as P, createCommentVNode as U, createVNode as t, withModifiers as Ee, createTextVNode as d, ref as v, computed as q, useTemplateRef as Se, onMounted as De } from "vue";
|
|
2
2
|
import { icons as ae, EllipsisVertical as Te, Paintbrush as Pe, ToyBrick as Me, Plus as Ue } from "lucide-vue-next";
|
|
3
3
|
import { useModuleRoute as se, useConfirmation as ie, useModuleStorage as $e, useModulePermissions as Ne, useModuleBreadcrumbs as Re, useFirebaseIntegration as Ae } from "@oneclick.dev/cms-kit";
|
|
4
|
-
import { i as Le } from "./interpolation-
|
|
4
|
+
import { i as Le } from "./interpolation-BBwG_ON6.mjs";
|
|
5
5
|
import { t as z } from "./index-RLz1QPrf.mjs";
|
|
6
6
|
const Be = { class: "grid @lg:grid-cols-2 @2xl:grid-cols-3 @4xl:grid-cols-4 @7xl:grid-cols-5 gap-4" }, Ie = { class: "relative flex pl-3 @5xl:pl-6 pr-1.5 @5xl:pr-3 gap-3" }, Fe = { class: "self-center overflow-hidden w-full group-hover:w-[calc(100%-6.5rem)]" }, ze = ["title"], Oe = ["title"], je = { class: "absolute -top-1 right-2 self-start opacity-0 group-hover:opacity-100" }, qe = /* @__PURE__ */ G({
|
|
7
7
|
__name: "CollectionsGridView",
|