1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[89215],{29741:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(57437),o=r(47783),l=r(22468),a=r(71976),s=r(37440);function i(e){let{diff:t,oldLabel:r,newLabel:i,compact:d=!1}=e;if(!t.hasAnyChanges)return(0,n.jsxs)("div",{className:(0,s.cn)("flex flex-col items-center justify-center text-center",d?"py-8":"py-16"),children:[(0,n.jsx)("div",{className:"w-12 h-12 rounded-xl bg-emerald-500/10 flex items-center justify-center mb-3",children:(0,n.jsx)(l.Z,{className:"w-6 h-6 text-emerald-500"})}),(0,n.jsx)("p",{className:"text-sm text-[rgb(var(--foreground))] font-medium",children:"No changes"}),(0,n.jsxs)("p",{className:"text-xs text-[rgb(var(--muted-foreground))] mt-1",children:["The content is identical between ",r," and ",i,"."]})]});let c=t.fields.filter(e=>e.hasChanges);return(0,n.jsxs)(o.E.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},className:(0,s.cn)(d?"space-y-4":"space-y-6"),children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[rgb(var(--muted-foreground))]",children:[(0,n.jsx)("span",{className:"px-2 py-1 rounded-md bg-red-500/10 text-red-600 dark:text-red-400 font-medium",children:r}),(0,n.jsx)(a.Z,{className:"w-3 h-3"}),(0,n.jsx)("span",{className:"px-2 py-1 rounded-md bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 font-medium",children:i})]}),c.map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-xs font-semibold text-[rgb(var(--muted-foreground))] uppercase tracking-wider mb-2 block",children:e.fieldName}),(0,n.jsx)("div",{className:"rounded-xl border border-[rgb(var(--border-subtle))] overflow-hidden bg-[rgb(var(--card))]",children:e.lines.map((e,t)=>(0,n.jsxs)("div",{className:(0,s.cn)("flex items-stretch text-sm font-mono","added"===e.type&&"bg-emerald-500/10","removed"===e.type&&"bg-red-500/10"),children:[(0,n.jsx)("div",{className:(0,s.cn)("w-8 flex-shrink-0 flex items-center justify-center text-xs select-none border-r border-[rgb(var(--border-subtle))]","added"===e.type&&"text-emerald-600 dark:text-emerald-400","removed"===e.type&&"text-red-600 dark:text-red-400","unchanged"===e.type&&"text-[rgb(var(--muted-foreground))]"),children:"added"===e.type?"+":"removed"===e.type?"-":" "}),(0,n.jsx)("div",{className:(0,s.cn)("flex-1 px-3 py-0.5 whitespace-pre-wrap break-all min-w-0","added"===e.type&&"text-emerald-700 dark:text-emerald-300","removed"===e.type&&"text-red-700 dark:text-red-300","unchanged"===e.type&&"text-[rgb(var(--foreground))]"),children:e.content||"\xa0"})]},t))})]},e.fieldName))]})}},89215:function(e,t,r){r.d(t,{Z:function(){return e9}});var n=r(57437),o=r(2265),l=r(37440),a=r(96264),s=r(38029),i=r(29741);function d(e,t,r){let[n,l]=(0,o.useState)(r),a=(0,o.useRef)(null);return(0,o.useEffect)(()=>{if(!e){l(r);return}let n=e.getText(t);a.current=n;let o=n.toString();o&&l(o);let s=()=>{l(n.toString())};return n.observe(s),()=>{n.unobserve(s),a.current=null}},[e,t,r]),[n,(0,o.useCallback)(e=>{var t;l(e);let r=a.current;r&&(null===(t=r.doc)||void 0===t||t.transact(()=>{r.delete(0,r.length),r.insert(0,e)}))},[])]}var c=r(60007),u=r(10171),g=r(87983),b=r(63725),m=r(26145),p=r(39119),x=r(38022),f=r(60174),v=r(22102),h=r(72231),y=r(38826),w=r(19296),j=r(53604),k=r(83724),N=r(62446),C=r(33687),E=r(43144),S=r(1117),D=r(50429),_=r(17433),O=r(54887),z=r(6346),T=r(49401),L=r(6569),Z=r(17846),B=r(27180),I=r(46292),R=r(88011),A=r(68109),M=r(42421),F=r(19322),P=r(21216),H=r(85637),U=r(42352),G=r(7746),X=r(24020),K=r(84809),J=r(9889),W=r(54348),q=r(76730);let Y=[{label:"Small",value:"13px"},{label:"Normal",value:"16px"},{label:"Large",value:"20px"},{label:"XL",value:"24px"}],Q=["#000000","#374151","#DC2626","#EA580C","#CA8A04","#16A34A","#2563EB","#7C3AED","#DB2777","#64748B"],$=[{label:"None",value:""},{label:"Yellow",value:"#FEF9C3"},{label:"Green",value:"#DCFCE7"},{label:"Blue",value:"#DBEAFE"},{label:"Pink",value:"#FCE7F3"},{label:"Purple",value:"#F3E8FF"},{label:"Orange",value:"#FFEDD5"},{label:"Gray",value:"#F1F5F9"}],V=[{label:"Text",value:"paragraph",icon:L.Z},{label:"Heading 1",value:"h1",icon:Z.Z},{label:"Heading 2",value:"h2",icon:B.Z},{label:"Heading 3",value:"h3",icon:I.Z},{label:"Quote",value:"quote",icon:R.Z},{label:"Code",value:"code",icon:A.Z}];function ee(e){let{active:t,onClick:r,children:o,title:a}=e;return(0,n.jsx)("button",{type:"button",onClick:r,title:a,onMouseDown:e=>e.preventDefault(),className:(0,l.cn)("p-1.5 rounded transition-colors",t?"bg-[rgb(var(--muted))] text-[rgb(var(--foreground))]":"text-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] hover:text-[rgb(var(--foreground))]"),children:o})}function et(){return(0,n.jsx)("div",{className:"w-px h-4 bg-[rgb(var(--border))] mx-0.5"})}function er(e){let{currentSize:t,onSelect:r}=e;return(0,n.jsx)("div",{className:"absolute top-full left-0 mt-1 bg-[rgb(var(--background))] rounded-lg shadow-xl border border-[rgb(var(--border))] py-1 min-w-[100px] z-[60]",children:Y.map(e=>(0,n.jsxs)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>r(e.value),className:(0,l.cn)("w-full text-left px-3 py-1.5 text-xs transition-colors",t===e.value?"text-[rgb(var(--foreground))] bg-[rgb(var(--muted))]":"text-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] hover:text-[rgb(var(--foreground))]"),children:[e.label,(0,n.jsx)("span",{className:"ml-2 text-[rgb(var(--muted-foreground))] opacity-60",children:e.value})]},e.value))})}
1function en(e){let{colors:t,currentColor:r,onSelect:o}=e;return(0,n.jsx)("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-1 bg-[rgb(var(--background))] rounded-lg shadow-xl border border-[rgb(var(--border))] p-2 z-[60]",children:(0,n.jsx)("div",{className:"grid grid-cols-5 gap-1.5",children:t.map(e=>(0,n.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>o(e),className:(0,l.cn)("w-5 h-5 rounded-full border-2 transition-transform hover:scale-110",r===e?"border-[rgb(var(--foreground))] scale-110":"border-transparent"),style:{backgroundColor:e},title:e},e))})})}function eo(e){let{currentBg:t,onSelect:r}=e;return(0,n.jsx)("div",{className:"absolute top-full right-0 mt-1 bg-[rgb(var(--background))] rounded-lg shadow-xl border border-[rgb(var(--border))] py-1 min-w-[110px] z-[60]",children:$.map(e=>(0,n.jsxs)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>r(e.value),className:(0,l.cn)("w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 transition-colors",t===e.value?"text-[rgb(var(--foreground))] bg-[rgb(var(--muted))]":"text-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] hover:text-[rgb(var(--foreground))]"),children:[e.value?(0,n.jsx)("span",{className:"w-3.5 h-3.5 rounded border border-[rgb(var(--border))]",style:{backgroundColor:e.value}}):(0,n.jsx)("span",{className:"w-3.5 h-3.5 rounded border border-[rgb(var(--border))] bg-transparent"}),e.label]},e.value||"none"))})}function el(e){let{currentType:t,onSelect:r}=e;return(0,n.jsx)("div",{className:"absolute top-full left-0 mt-1 bg-[rgb(var(--background))] rounded-lg shadow-xl border border-[rgb(var(--border))] py-1 min-w-[130px] z-[60]",children:V.map(e=>{let o=e.icon;return(0,n.jsxs)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>r(e.value),className:(0,l.cn)("w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 transition-colors",t===e.value?"text-[rgb(var(--foreground))] bg-[rgb(var(--muted))]":"text-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] hover:text-[rgb(var(--foreground))]"),children:[(0,n.jsx)(o,{size:13}),e.label]},e.value)})})}function ea(){let[e]=(0,_.g)(),t=(0,o.useRef)(null),[r,l]=(0,o.useState)(!1),[a,s]=(0,o.useState)({top:0,left:0}),[i,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),[g,b]=(0,o.useState)(!1),[m,p]=(0,o.useState)(!1),[x,f]=(0,o.useState)(!1),[v,h]=(0,o.useState)("paragraph"),[y,w]=(0,o.useState)("16px"),[j,E]=(0,o.useState)("#000000"),[S,Z]=(0,o.useState)(""),[B,I]=(0,o.useState)(null),R=(0,o.useCallback)(()=>{let e=(0,D.dL7)();if(!(0,D.OPZ)(e)||e.isCollapsed()){l(!1);return}d(e.hasFormat("bold")),u(e.hasFormat("italic")),b(e.hasFormat("underline")),p(e.hasFormat("strikethrough")),f(e.hasFormat("code"));let t=e.anchor.getNode(),r="root"===t.getKey()?t:t.getTopLevelElementOrThrow();if((0,k.rc)(r))h(r.getTag());else if((0,N.I3)(r)){var n;h((0,T.yD)(t,r.constructor)?(null===(n=r.getListType)||void 0===n?void 0:n.call(r))||"bullet":"paragraph")}else(0,C.Pe)(r)?h("code"):h(r.getType());w((0,z.ui)(e,"font-size","16px")),E((0,z.ui)(e,"color","#000000")),Z((0,z.ui)(e,"background-color",""));let o=window.getSelection();if(!o||0===o.rangeCount){l(!1);return}let a=o.getRangeAt(0).getBoundingClientRect();if(0===a.width&&0===a.height){l(!1);return}l(!0),s({top:a.top+window.scrollY-44-8,left:a.left+window.scrollX+a.width/2})},[]);(0,o.useEffect)(()=>e.registerCommand(D.ojF,()=>(e.getEditorState().read(R),!1),D.KB),[e,R]),(0,o.useEffect)(()=>e.registerUpdateListener(e=>{let{editorState:t}=e;t.read(R)}),[e,R]),(0,o.useEffect)(()=>{if(!B)return;let e=e=>{t.current&&!t.current.contains(e.target)&&I(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[B]);let A=t=>{e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&(v===t?(0,z.Hz)(e,()=>(0,D.BEw)()):(0,z.Hz)(e,()=>(0,k.V1)(t)))})},Y=()=>{e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&("code"===v?(0,z.Hz)(e,()=>(0,D.BEw)()):(0,z.Hz)(e,()=>(0,C.Ol)()))})},$=()=>{e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&("quote"===v?(0,z.Hz)(e,()=>(0,D.BEw)()):(0,z.Hz)(e,()=>(0,k.Z1)()))})},V=t=>{e.dispatchCommand(D.ROy,t)};return r?(0,O.createPortal)((0,n.jsxs)("div",{ref:t,className:"fixed z-50 flex items-center gap-0.5 px-1.5 py-1 rounded-lg bg-[rgb(var(--background))] shadow-xl border border-[rgb(var(--border))]",style:{to
1p:"".concat(a.top,"px"),left:"".concat(a.left,"px"),transform:"translateX(-50%)"},onMouseDown:e=>e.preventDefault(),children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(ee,{active:"turnInto"===B,onClick:()=>I("turnInto"===B?null:"turnInto"),title:"Turn into",children:(0,n.jsxs)("span",{className:"flex items-center gap-0.5 text-xs font-medium",children:[(0,n.jsx)(L.Z,{size:14}),(0,n.jsx)(M.Z,{size:10})]})}),"turnInto"===B&&(0,n.jsx)(el,{currentType:v,onSelect:t=>{switch(t){case"paragraph":e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&(0,z.Hz)(e,()=>(0,D.BEw)())});break;case"h1":case"h2":case"h3":A(t);break;case"quote":$();break;case"code":Y()}I(null)}})]}),(0,n.jsx)(et,{}),(0,n.jsx)(ee,{active:i,onClick:()=>e.dispatchCommand(D.Ewg,"bold"),title:"Bold",children:(0,n.jsx)(F.Z,{size:14,strokeWidth:2.5})}),(0,n.jsx)(ee,{active:c,onClick:()=>e.dispatchCommand(D.Ewg,"italic"),title:"Italic",children:(0,n.jsx)(P.Z,{size:14})}),(0,n.jsx)(ee,{active:g,onClick:()=>e.dispatchCommand(D.Ewg,"underline"),title:"Underline",children:(0,n.jsx)(H.Z,{size:14})}),(0,n.jsx)(ee,{active:m,onClick:()=>
1e.dispatchCommand(D.Ewg,"strikethrough"),title:"Strikethrough",children:(0,n.jsx)(U.Z,{size:14})}),(0,n.jsx)(ee,{active:x,onClick:()=>e.dispatchCommand(D.Ewg,"code"),title:"Inline code",children:(0,n.jsx)(G.Z,{size:14})}),(0,n.jsx)(et,{}),(0,n.jsx)(ee,{onClick:()=>V("left"),title:"Align left",children:(0,n.jsx)(X.Z,{size:14})}),(0,n.jsx)(ee,{onClick:()=>V("center"),title:"Align center",children:(0,n.jsx)(K.Z,{size:14})}),(0,n.jsx)(ee,{onClick:()=>V("right"),title:"Align right",children:(0,n.jsx)(J.Z,{size:14})}),(0,n.jsx)(et,{}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(ee,{active:"fontSize"===B,onClick:()=>I("fontSize"===B?null:"fontSize"),title:"Font size",children:(0,n.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,n.jsx)(L.Z,{size:14}),(0,n.jsx)(M.Z,{size:10})]})}),"fontSize"===B&&(0,n.jsx)(er,{currentSize:y,onSelect:t=>{e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&(0,z.yD)(e,{"font-size":"16px"===t?null:t})}),I(null)}})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(ee,{active:"color"===B,onClick:()=>I("color"===B?null:"color"),title:"Text color",children:(0,n.jsxs)("span",{className:"relative",children:[(0,n.jsx)(W.Z,{size:14}),(0,n.jsx)("span",{className:"absolute -bottom-0.5 left-0 right-0 h-[2px] rounded-full",style:{backgroundColor:"#000000"!==j?j:"transparent"}})]})}),"color"===B&&(0,n.jsx)(en,{colors:Q,currentColor:j,onSelect:t=>{e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&(0,z.yD)(e,{color:"#000000"===t?null:t})}),I(null)}})]}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(ee,{active:"highlight"===B||!!S,onClick:()=>I("highlight"===B?null:"highlight"),title:"Highlight",children:(0,n.jsx)(q.Z,{size:14})}),"highlight"===B&&(0,n.jsx)(eo,{currentBg:S,onSelect:t=>{e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&(0,z.yD)(e,{"background-color":t||null})}),I(null)}})]})]}),document.body):null}var es=r(89076),ei=r(15574),ed=r(703),ec=r(71995),eu=r(88002),eg=r(92222),eb=r(87592),em=r(30690),ep=r(1859),ex=r(13231),ef=r(71935);class ev extends D.HX${static getType(){return"callout"}static clone(e){return new ev(e.__calloutType,e.__key)}getCalloutType(){return this.__calloutType}setCalloutType(e){this.getWritable().__calloutType=e}createDOM(e){var t,r;let n=document.createElement("div");n.setAttribute("data-callout-type",this.__calloutType);let o=null===(r=e.theme)||void 0===r?void 0:null===(t=r.callout)||void 0===t?void 0:t[this.__calloutType];return o&&(n.className=o),n}updateDOM(e,t,r){if(e.__calloutType!==this.__calloutType){var n,o;t.setAttribute("data-callout-type",this.__calloutType);let e=null===(o=r.theme)||void 0===o?void 0:null===(n=o.callout)||void 0===n?void 0:n[this.__calloutType];e&&(t.className=e)}return!1}exportDOM(){let e=document.createElement("div");return e.setAttribute("data-callout-type",this.__calloutType),{element:e}}static importDOM(){return{div:e=>e.hasAttribute("data-callout-type")?{conversion:eh,priority:1}:null}}exportJSON(){return{...super.exportJSON(),calloutType:this.__calloutType,type:"callout",version:1}}static importJSON(e){return ey(e.calloutType)}canIndent(){return!1}constructor(e="info",t){super(t),this.__calloutType=e}}function eh(e){return{node:ey(e.getAttribute("data-callout-type")||"info")}}function ey(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"info";return(0,D.U2B)(new ev(e))}class ew extends D.HX${static getType(){return"collapsible-container"}static clone(e){return new ew(e.__open,e.__key)}getOpen(){return this.__open}setOpen(e){this.getWritable().__open=e}toggleOpen(){this.setOpen(!this.getOpen())}createDOM(e){var t,r;let n=document.createElement("details");n.open=this.__open;let o=null===(r=e.theme)||void 0===r?void 0:null===(t=r.collapsible)||void 0===t?void 0:t.container;return o&&(n.className=o),n.addEventListener("toggle",()=>{let t=n.open,r=e._editor;r&&r.update(()=>{this.getWritable().__open=t})}),n}updateDOM(e,t){return e.__open!==this.__open&&(t.open=this.__open),!1}exportDOM(){let e=document.createElement("details");return e.open=this.__open,{element:e}}static importDOM(){return{details:()=>({conversion:ej,priority:1})}}exportJSON(){return{...super.exportJSON(),open:this.__open,type:"collapsible-container",version:1}}static importJSON(e){return ek(e.open)}canIndent(){return!1}constructor(e=!0,t){super(t),this.__open=e}}function ej(){return{node:ek(!0)}}function ek(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return(0,D.U2B)(new ew(e))}class eN extends D.HX${static getType(){return"collapsible-title"}static clone(e){return new eN(e.__key)}createDOM(e){var t,r;let n=document.createElement("summary"),o=null===(r=e.theme)||void 0===r?void 0:null===(t=r.collapsible)||void 0===t?void 0:t.t
1itle;return o&&(n.className=o),n}updateDOM(){return!1}exportDOM(){return{element:document.createElement("summary")}}static importDOM(){return{summary:()=>({conversion:()=>({node:eC()}),priority:1})}}exportJSON(){return{...super.exportJSON(),type:"collapsible-title",version:1}}static importJSON(){return eC()}collapseAtStart(){return!0}}function eC(){return(0,D.U2B)(new eN)}class eE extends D.HX${static getType(){return"collapsible-content"}static clone(e){return new eE(e.__key)}createDOM(e){var t,r;let n=document.createElement("div"),o=null===(r=e.theme)||void 0===r?void 0:null===(t=r.collapsible)||void 0===t?void 0:t.content;return o&&(n.className=o),n}updateDOM(){return!1}exportDOM(){return{element:document.createElement("div")}}exportJSON(){return{...super.exportJSON(),type:"collapsible-content",version:1}}static importJSON(){return eS()}}function eS(){return(0,D.U2B)(new eE)}class eD extends es.n{constructor(e,t,r,n,o,l){super(e),this.title=e,this.description=t,this.icon=r,this.category=n,this.keywords=o,this.onSelect=l}}function e_(e,t){e.update(()=>{let e=(0,D.dL7)();(0,D.OPZ)(e)&&(0,z.Hz)(e,t)})}function eO(e,t){e.update(()=>{let e=(0,D.dL7)();if(!(0,D.OPZ)(e))return;let r=ey(t),n=(0,D.BEw)();r.append(n),e.insertNodes([r]),n.selectStart()})}function ez(e){e.update(()=>{let e=(0,D.dL7)();if(!(0,D.OPZ)(e))return;let t=ek(!0),r=eC(),n=eS(),o=(0,D.BEw)();o.append((0,D.MXo)("Toggle")),r.append(o);let l=(0,D.BEw)();n.append(l),t.append(r,n),e.insertNodes([t]),o.selectEnd()})}let eT=["Basic","Lists","Blocks","Advanced"];function eL(){let[e]=(0,_.g)(),[t,r]=(0,o.useState)(null),a=(0,es.wd)("/",{minLength:0}),s=(0,o.useMemo)(()=>[new eD("Text","Plain text paragraph",(0,n.jsx)(L.Z,{size:16}),"Basic",["paragraph","plain"],e=>e_(e,()=>(0,D.BEw)())),new eD("Heading 1","Large section heading",(0,n.jsx)(Z.Z,{size:16}),"Basic",["h1","title"],e=>e_(e,()=>(0,k.V1)("h1"))),new eD("Heading 2","Medium section heading",(0,n.jsx)(B.Z,{size:16}),"Basic",["h2","subtitle"],e=>e_(e,()=>(0,k.V1)("h2"))),new eD("Heading 3","Small section heading",(0,n.jsx)(I.Z,{size:16}),"Basic",["h3"],e=>e_(e,()=>(0,k.V1)("h3"))),new eD("Bullet List","Unordered list",(0,n.jsx)(ei.Z,{size:16}),"Lists",["ul","unordered","bullets"],e=>e.dispatchCommand(N.A3,void 0)),new eD("Numbered List","Ordered list",(0,n.jsx)(ed.Z,{size:16}),"Lists",["ol","ordered","numbers"],e=>e.dispatchCommand(N.B3,void 0)),new eD("Task List","Checklist with checkboxes",(0,n.jsx)(ec.Z,{size:16}),"Lists",["todo","checkbox","check","tasks"],e=>e.dispatchCommand(N.d1,void 0)),new eD("Quote","Block quote",(0,n.jsx)(R.Z,{size:16}),"Blocks",["blockquote","cite"],e=>e_(e,()=>(0,k.Z1)())),new eD("Code Block","Preformatted code",(0,n.jsx)(A.Z,{size:16}),"Blocks",["pre","code","snippet"],e=>e_(e,()=>(0,C.Ol)())),new eD("Divider","Horizontal separator",(0,n.jsx)(eu.Z,{size:16}),"Blocks",["hr","line","separator","rule"],e=>e.dispatchCommand(f.qL,void 0)),new eD("Table","Insert a table",(0,n.jsx)(eg.Z,{size:16}),"Blocks",["grid","spreadsheet","rows","columns"],e=>e.dispatchCommand(v.bF,{rows:"3",columns:"3",includeHeaders:!0})),new eD("Toggle","Collapsible section",(0,n.jsx)(eb.Z,{size:16}),"Blocks",["collapse","accordion","details","expand"],ez),new eD("Info Callout","Informational highlight box",(0,n.jsx)(em.Z,{size:16}),"Advanced",["note","tip","callout","info"],e=>eO(e,"info")),new eD("Warning Callout","Warning highlight box",(0,n.jsx)(ep.Z,{size:16}),"Advanced",["warn","caution","alert"],e=>eO(e,"warning")),new eD("Success Callout","Success highlight box",(0,n.jsx)(ex.Z,{size:16}),"Advanced",["done","complete","ok"],e=>eO(e,"success")),new eD("Error Callout","Error highlight box",(0,n.jsx)(ef.Z,{size:16}),"Advanced",["danger","fail","critical"],e=>eO(e,"error"))],[]),i=(0,o.useMemo)(()=>{if(null===t)return s;let e=t.toLowerCase();return s.filter(t=>t.title.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.keywords.some(t=>t.includes(e)))},[t,s]),d=(0,o.useCallback)((t,r,n)=>{e.update(()=>{r&&r.remove()}),t.onSelect(e),n()},[e]);return(0,n.jsx)(es.HQ,{onQueryChange:r,onSelectOption:d,triggerFn:a,options:i,menuRenderFn:(e,t)=>{let{selectedIndex:r,selectOptionAndCleanUp:o,setHighlightedIndex:a}=t;if(!e.current||0===i.length)return null;let s=function(e){let t=new Map;for(let r of e){let e=t.get(r.category)||[];e.push(r),t.set(r.category,e)}return eT.filter(e=>t.has(e)).map(e=>[e,t.get(e)])}(i),d=0;return(0,O.createPortal)((0,n.jsx)("div",{className:"bg-[rgb(var(--background))] border border-[rgb(var(--border))] rounded-lg shadow-xl py-1 min-w-[220px] max-h-[340px] overflow-y-auto z-[60]",children:s.map(e=>{let[t,s]=e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[rgb(var(--muted-foreground))] opacity-60",children:t}),s.map(e=>{let t=d++;return(0,n.jsxs)("button",{type:"button",className:(0,l.cn)("w-full text-left px-3 py-1.5 flex items-center gap-3 transition-colors text-sm",t===r?"bg-[rgb(var(--muted))] text-[rgb(var(--foreground))]":"text-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] hover:text-[rgb(var(--foreground))]"),onMouseEnter:()=>a(t),onClick:()=>o(e),ref:t=>{e.setRefElement(t)},children:[(0,n.jsx)("span",{className:"flex-shrink-0 text-[rgb(var(--muted-foreground))]",children:e.icon}),(0,n.jsxs)("span",{className:"flex flex-col",children:[(0,n.jsx)("span",{className:"font-medium text-[rgb(var(--foreground))]",children:e.title}),(0,n.jsx)("span",{className:"text-xs text-[rgb(var(--muted-foreground))]",children:e.description})]})]},e.key)})]},t)})}),e.current)}})}function eZ(e){let{onTitleExtracted:t}=e,[r]=(0,_.g)();return(0,o.useEffect)(()=>r.registerCommand(D.A1,e=>{var n,o;if(null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html"))return!1;let l=null===(o=e.clipboardData)||void 0===o?void 0:o.getData("text/plain");if(!l||!(/^#{1,6}\s/m.test(l)||/^\s*[-*+]\s/m.test(l)||/^\s*\d+\.\s/m.test(l)||/^\s*>\s/m.test(l)||/```/.test(l)||/\*\*[^*]+\*\*/.test(l)||/__[^_]+__/.test(l)||/\[.+?\]\(.+?\)/.test(l)))return!1;e.preventDefault();let a=l.split("\n"),s=a[0].match(/^#{1,6}\s+(.+)/);if(s&&t){t(s[1].trim());let e=a.slice(1).join("\n").trim();e&&r.update(()=>{(0,S.Os)(e,S.XC)})}else r.update(()=>{(0,S.Os)(l,S.XC)});return!0},D.Eot),[r,t]),null}function eB(e){let{onTitleExtracted:t}=e,[r]=(0,_.g)(),n=(0,o.useRef)(!1);return(0,o.useEffect)(()=>r.registerUpdateListener(e=>{let{editorState:t}=e;""===t.read(()=>(0,D.GvG)().getTextContent()).trim()&&(n.current=!1)}),[r]),(0,o.useEffect)(()=>r.registerCommand(D.iGI,e=>{if(!t||n.current||"Enter"!==e.key||""!==r.getEditorState().read(()=>(0,D.GvG)().getTextContent()).trim())return!1;let o=(0,D.dL7)();return o&&o.isCollapsed(),!1},D.KB),[r,t]),(0,o.useEffect)(()=>r.registerUpdateListener(e=>{let{editorState:r}=e;t&&!n.current&&r.read(()=>{let e=(0,D.GvG)().getFirstChild();if(!(0,D.Gg4)(e)&&(null==e?void 0:e.getType())!=="text")return;let r=((null==e?void 0:e.getTextContent())||"").match(/^(#{1,6})\s+(.+)/);if(r){let o=(0,D.dL7)();if(!o||!o.isCollapsed()||!(null==e?void 0:e.getKey()))return;n.current=!0,t(r[2].trim())}})}),[r,t]),null}function eI(){let[e]=(0,_.g)();return(0,o.useEffect)(()=>{let t="kavela-empty-hint";function r(){var r;let n=null===(r=e.getRootElement())||void 0===r?void 0:r.querySelectorAll(".".concat(t));
1null==n||n.forEach(e=>e.classList.remove(t))}function n(){r();let n=e.getRootElement();n&&n.contains(document.activeElement)&&e.getEditorState().read(()=>{let r=(0,D.dL7)();if(!(0,D.OPZ)(r)||!r.isCollapsed())return;let n=r.anchor.getNode(),o=n.getParent(),l=(0,D.Rlh)(n)?n:(0,D.Rlh)(o)?o:null;if(!l||""!==l.getTextContent()||(0,v.OQ)(l))return;let a=l.getKey(),s=e.getElementByKey(a);s&&s.classList.add(t)})}let o=e.registerUpdateListener(()=>n()),l=e.getRootElement(),a=()=>n(),s=()=>r();return null==l||l.addEventListener("focus",a,!0),null==l||l.addEventListener("blur",s,!0),()=>{o(),r(),null==l||l.removeEventListener("focus",a,!0),null==l||l.removeEventListener("blur",s,!0)}},[e]),null}var eR=r(63541),eA=r(55066),eM=r(10883),eF=r(95137),eP=r(71976),eH=r(83162),eU=r(92513);function eG(e){let{icon:t,label:r,onClick:o,danger:a=!1}=e;return(0,n.jsxs)("button",{type:"button",className:(0,l.cn)("w-full text-left px-3 py-1.5 flex items-center gap-2.5 text-sm transition-colors",a?"text-red-500 hover:bg-red-500/10":"text-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] hover:text-[rgb(var(--foreground))]"),onClick:o,children:[(0,n.jsx)("span",{className:"flex-shrink-0",children:t}),(0,n.jsx)("span",{children:r})]})}function eX(){return(0,n.jsx)("div",{className:"h-px bg-[rgb(var(--border))] my-1"})}function eK(e){let{editor:t,position:r,tableNodeKey:l,onClose:a}=e,s=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=e=>{s.current&&!s.current.contains(e.target)&&a()},t=e=>{"Escape"===e.key&&a()};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[a]),(0,o.useEffect)(()=>{if(!s.current)return;let e=s.current.getBoundingClientRect(),t=s.current;e.right>window.innerWidth&&(t.style.left="".concat(window.innerWidth-e.width-8,"px")),e.bottom>window.innerHeight&&(t.style.top="".concat(window.innerHeight-e.height-8,"px"))},[r]);let i=(0,o.useCallback)(e=>{a(),requestAnimationFrame(()=>{t.focus(),t.update(e)})},[t,a]);return(0,n.jsxs)("div",{ref:s,className:"fixed z-[80] bg-[rgb(var(--background))] border border-[rgb(var(--border))] rounded-lg shadow-xl py-1 min-w-[200px]",style:{top:r.y,left:r.x},children:[(0,n.jsx)("div",{className:"px-3 pt-1 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[rgb(var(--muted-foreground))] opacity-60",children:"Row"}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eR.Z,{size:14}),label:"Insert row above",onClick:()=>i(()=>(0,v.EX)(!1))}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eA.Z,{size:14}),label:"Insert row below",onClick:()=>i(()=>(0,v.EX)(!0))}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eM.Z,{size:14}),label:"Delete row",onClick:()=>i(()=>(0,v.kS)()),danger:!0}),(0,n.jsx)(eX,{}),(0,n.jsx)("div",{className:"px-3 pt-1 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[rgb(var(--muted-foreground))] opacity-60",children:"Column"}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eF.Z,{size:14}),label:"Insert column left",onClick:()=>i(()=>(0,v.rU)(!1))}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eP.Z,{size:14}),label:"Insert column right",onClick:()=>i(()=>(0,v.rU)(!0))}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eM.Z,{size:14}),label:"Delete column",onClick:()=>i(()=>(0,v.bk)()),danger:!0}),(0,n.jsx)(eX,{}),(0,n.jsx)(eG,{icon:(0,n.jsx)(eH.Z,{size:14}),label:"Delete table",onClick:()=>{a(),t.update(()=>{let e=(0,D.gID)(l);e&&(0,v.di)(e)&&e.remove()})},danger:!0})]})}function eJ(e){let{editor:t,tableNode:r}=e,[l,a]=(0,o.useState)(!1),[s,i]=(0,o.useState)(!1),[d,c]=(0,o.useState)(null);return((0,o.useEffect)(()=>{let e=r.getKey(),n=t.getElementByKey(e);if(!n)return;let o=e=>{let t=n.getBoundingClientRect(),r=e.clientX,o=e.clientY,l=r>=t.left-4&&r<=t.right+24,s=o>=t.top-4&&o<=t.bottom+24;if(!l||!s){i(!1),a(!1);return}c(t);let d=r-t.left,u=o-t.top;i(d>=t.width-40||r>t.right),a(u>=t.height-40||o>t.bottom)};return document.addEventListener("mousemove",o),()=>document.removeEventListener("mousemove",o)},[t,r]),d)?(0,n.jsxs)(n.Fragment,{children:[s&&(0,n.jsx)("button",{type:"button",title:"Add column",className:"fixed z-[60] flex items-center justify-center w-5 bg-[rgb(var(--muted))] hover:bg-[rgb(var(--accent-blue))] hover:text-white text-[rgb(var(--muted-foreground))] rounded-r-md transition-colors cursor-pointer text-xs font-bold",style:{to
1p:d.top,left:d.right+1,height:d.height},onClick:()=>{t.update(()=>{(0,v.rU)(!0)})},children:(0,n.jsx)(eU.Z,{size:12})}),l&&(0,n.jsx)("button",{type:"button",title:"Add row",className:"fixed z-[60] flex items-center justify-center h-5 bg-[rgb(var(--muted))] hover:bg-[rgb(var(--accent-blue))] hover:text-white text-[rgb(var(--muted-foreground))] rounded-b-md transition-colors cursor-pointer text-xs font-bold",style:{top:d.bottom+1,left:d.left,width:d.width},onClick:()=>{t.update(()=>{(0,v.EX)(!0)})},children:(0,n.jsx)(eU.Z,{size:12})})]}):null}function eW(){let[e]=(0,_.g)(),[t,r]=(0,o.useState)(null),[l,a]=(0,o.useState)(null);return(0,o.useEffect)(()=>e.registerUpdateListener(e=>{let{editorState:t}=e;t.read(()=>{let e=(0,D.dL7)();if((0,v.zO)(e)){let t=e.anchor.getNode(),n=(0,v.OQ)(t);if(n){let e=(0,v.C6)(n);if(e){r({cellNode:n,tableNode:e,tableNodeKey:e.getKey()});return}}}if((0,D.OPZ)(e)){let t=e.anchor.getNode(),n=(0,v.OQ)(t);if(n){let e=(0,v.C6)(n);if(e){r({cellNode:n,tableNode:e,tableNodeKey:e.getKey()});return}}}r(null)})}),[e]),(0,o.useEffect)(()=>{let t=e.getRootElement();if(!t)return;let r=e=>{let r=e.target.closest("td, th");r&&t.contains(r)&&(e.preventDefault(),e.stopPropagation(),a({x:e.clientX,y:e.clientY}))};return t.addEventListener("contextmenu",r),()=>t.removeEventListener("contextmenu",r)},[e]),(0,n.jsxs)(n.Fragment,{children:[t&&(0,O.createPortal)((0,n.jsx)(eJ,{editor:e,tableNode:t.tableNode}),document.body),l&&t&&(0,O.createPortal)((0,n.jsx)(eK,{editor:e,position:l,tableNodeKey:t.tableNodeKey,onClose:()=>a(null)}),document.body)]})}var eq=r(97589),eY=r(23787);function eQ(e){let{databaseId:t,databaseName:r}=e;return(0,n.jsxs)("a",{href:"/dashboard/databases/".concat(t),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-3 py-2 my-1 rounded-lg border border-[rgb(var(--border))] bg-[rgb(var(--card))] hover:border-[rgb(var(--muted-foreground))] hover:bg-[rgb(var(--muted))] transition-colors cursor-pointer no-underline",onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(eq.Z,{size:16,className:"text-[rgb(var(--accent-blue))] flex-shrink-0"}),(0,n.jsx)("span",{className:"text-sm font-medium text-[rgb(var(--foreground))]",children:r}),(0,n.jsx)(eY.Z,{size:12,className:"text-[rgb(var(--muted-foreground))] flex-shrink-0"})]})}class e$ extends D.Ijf{static getType(){return"database-embed"}static clone(e){return new e$(e.__databaseId,e.__databaseName,e.__key)}getDatabaseId(){return this.__databaseId}getDatabaseName(){return this.__databaseName}createDOM(e){let t=document.createElement("span");return t.style.display="inline",t}updateDOM(){return!1}exportDOM(){let e=document.createElement("span");return e.setAttribute("data-database-embed-id",String(this.__databaseId)),e.setAttribute("data-database-embed-name",this.__databaseName),e.textContent="[Database: ".concat(this.__databaseName,"]"),{element:e}}static importDOM(){return{span:e=>e.hasAttribute("data-database-embed-id")?{conversion:e=>({node:new e$(parseInt(e.getAttribute("data-database-embed-id")||"0"),e.getAttribute("data-database-embed-name")||"Untitled")}),priority:1}:null}}exportJSON(){return{type:"database-embed",version:1,databaseId:this.__databaseId,databaseName:this.__databaseName}}static importJSON(e){return new e$(e.databaseId,e.databaseName)}decorate(){return(0,n.jsx)(eQ,{databaseId:this.__databaseId,databaseName:this.__databaseName})}isInline(){return!1}constructor(e,t,r){super(r),this.__databaseId=e,this.__databaseName=t}}function eV(e){let{content:t,provider:r,doc:n}=e,[l]=(0,_.g)(),a=(0,o.useRef)(!1),[s,i]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(console.log("[DO] DeferredBootstrap: sync effect, provider.synced =",r.synced),r.synced){i(!0);return}let e=e=>{console.log("[DO] DeferredBootstrap: sync event, isSynced =",e),e&&i(!0)};return r.on("sync",e),()=>{r.off("sync",e)}},[r]),(0,o.useEffect)(()=>{var e;if(console.log("[DO] DeferredBootstrap: bootstrap effect",{hasContent:!!t,contentLen:null==t?void 0:t.length,synced:s,bootstrapped:a.current}),!t||!s||a.current)return;let r=n.get("root");if(console.log("[DO] DeferredBootstrap: Y.Doc root shared type",{exists:!!r,constructorName:null==r?void 0:null===(e=r.constructor)||void 0===e?void 0:e.name,length:null==r?void 0:r.length}),r&&r.length>0){console.log("[DO] DeferredBootstrap: SKIPPED â root already has content (length="+r.length+")"),a.current=!0;return}let o=l.getEditorState().read(()=>""===(0,D.GvG)().getTextContent().trim());console.log("[DO] DeferredBootstrap: rootEmpty =",o),o&&(console.log("[DO] DeferredBootstrap: BOOTSTRAPPING from REST content (length="+t.length+")"),a.current=!0,l.update(()=>{try{(0,S.Os)(t,S.XC)}catch(r){let e=(0,D.GvG)();for(let r of(e.clear(),t.split("\n"))){let t=(0,D.BEw)();r&&t.append((0,D.MXo)(r)),e.append(t)}}},{tag:"history-merge"}))},[t,s,l,n]),null}let e0=[k.c2,k.rT,N.NK,N.EG,C.wg,C.o0,E.GR,f.HY,v.Fh,v.g0,v.Cr,ev,ew,eN,eE,e$],e1={paragraph:"mb-1",heading:{h1:"text-2xl font-bold mt-6 mb-2",h2:"text-xl font-semibold mt-5 mb-2",h3:"text-lg font-medium mt
1-4 mb-1"},list:{ul:"list-disc ml-6 mb-2",ol:"list-decimal ml-6 mb-2",listitem:"mb-0.5",nested:{listitem:"ml-4"},checklist:"list-none ml-0 mb-2",listitemChecked:"relative pl-7 mb-0.5 line-through text-[rgb(var(--muted-foreground))] before:content-[''] before:absolute before:left-0 before:top-1 before:w-4 before:h-4 before:border before:border-[rgb(var(--brand))] before:rounded before:bg-[rgb(var(--brand))] after:content-[''] after:absolute after:left-[3px] after:top-[5px] after:w-2.5 after:h-1.5 after:border-l-2 after:border-b-2 after:border-white after:-rotate-45",listitemUnchecked:"relative pl-7 mb-0.5 before:content-[''] before:absolute before:left-0 before:top-1 before:w-4 before:h-4 before:border before:border-[rgb(var(--border))] before:rounded"},quote:"border-l-2 border-[rgb(var(--border))] pl-4 italic text-[rgb(var(--muted-foreground))] mb-2",code:"bg-[rgb(var(--muted))] rounded px-1.5 py-0.5 font-mono text-sm",codeHighlight:{atrule:"text-purple-500",attr:"text-blue-500",boolean:"text-orange-500",builtin:"text-cyan-500",cdata:"text-gray-500",char:"text-green-500",class:"text-yellow-500","class-name":"text-yellow-500",comment:"text-gray-400 italic",constant:"text-orange-500",deleted:"text-red-500",doctype:"text-gray-500",entity:"text-orange-500",function:"text-blue-400",important:"text-orange-500 font-bold",inserted:"text-green-500",keyword:"text-purple-500",namespace:"text-red-500",number:"text-orange-500",operator:"text-gray-600",prolog:"text-gray-500",property:"text-blue-500",punctuation:"text-gray-500",regex:"text-orange-500",selector:"text-green-500",string:"text-green-600",symbol:"text-orange-500",tag:"text-red-500",url:"text-blue-500 underline",variable:"text-red-500"},horizontalRule:"border-t border-[rgb(var(--border))] my-4 cursor-pointer",table:"kavela-table border-collapse w-full my-2",tableRow:"",tableCell:"kavela-table-cell border border-[rgb(var(--border))] px-3 py-2 text-sm align-top min-w-[75px] relative",tableCellHeader:"kavela-table-cell border border-[rgb(var(--border))] px-3 py-2 text-sm font-semibold bg-[rgb(var(--muted))] align-top relative",tableCellSelected:"kavela-table-cell-selected",tableSelection:"kavela-table-selection",tableScrollableWrapper:"overflow-x-auto my-2",callout:{info:"bg-blue-50 dark:bg-blue-950/30 border-l-4 border-blue-500 px-4 py-3 my-2 rounded-r",warning:"bg-amber-50 dark:bg-amber-950/30 border-l-4 border-amber-500 px-4 py-3 my-2 rounded-r",success:"bg-green-50 dark:bg-green-950/30 border-l-4 border-green-500 px-4 py-3 my-2 rounded-r",error:"bg-red-50 dark:bg-red-950/30 border-l-4 border-red-500 px-4 py-3 my-2 rounded-r"},collapsible:{container:"border border-[rgb(var(--border))] rounded-lg my-2",title:"px-4 py-2 font-medium cursor-pointer select-none hover:bg-[rgb(var(--muted))] rounded-t-lg list-none",content:"px-4 py-3 border-t border-[rgb(var(--border))]"},link:"text-brand-600 dark:text-brand-400 underline cursor-pointer",text:{bold:"font-bold",italic:"italic",strikethrough:"line-through",underline:"underline",code:"bg-[rgb(var(--muted))] rounded px-1 py-0.5 font-mono text-[13px]"}};function e5(e){let{readOnly:t}=e,[r]=(0,_.g)();return(0,o.useEffect)(()=>{r.setEditable(!t)},[r,t]),null}function e2(e){let{doc:t,provider:r,readOnly:l=!1,initialContent:a="",cursorsContainerRef:s,onTitleExtracted:i}=e;(0,o.useEffect)(()=>(console.log("[DO] LexicalEditor MOUNT, initialContent length =",a.length),()=>console.log("[DO] LexicalEditor UNMOUNT")),[]);let d=(0,o.useCallback)(()=>{if(console.log("[DO] initialEditorState CALLED by CollaborationPlugin, content length =",a.length),a)try{(0,S.Os)(a,S.XC)}catch(t){let e=(0,D.GvG)();for(let t of(e.clear(),a.split("\n"))){let r=(0,D.BEw)();t&&r.append((0,D.MXo)(t)),e.append(r)}}},[a]),f=(0,o.useRef)(t),v=(0,o.useRef)(r);f.current=t,v.current=r;let k=(0,o.useCallback)((e,t)=>{let r=f.current,n=v.current;return t.set(e,r),n},[]),N=(0,o.useMemo)(()=>({isCollabActive:!0,yjsDocMap:new Map,name:"",color:""}),[]);return(0,n.jsx)(c.R,{initialConfig:{namespace:"KavelaEditor",nodes:e0,editable:!l,theme:e1,editorState:null,onError:e=>{console.error("Lexical error:",e)}},children:(0,n.jsxs)(w.h4.Provider,{value:N,children:[(0,n.jsx)(e5,{readOnly:l}),!l&&(0,n.jsx)(ea,{}),(0,n.jsx)("div",{className:"relative",children:(0,n.jsx)(u.B,{contentEditable:(0,n.jsx)(g.f,{className:"outline-none min-h-[300px] text-base text-[rgb(var(--foreground))] leading-relaxed"}),placeholder:(0,n.jsx)("div",{className:"text-[rgb(var(--muted-foreground))] pointer-events-none absolute top-0 left-0 text-base opacity-50",children:"Start writing, or type / for commands..."}),ErrorBoundary:j.g})}),(0,n.jsx)(y.F,{id:"content",providerFactory:k,shouldBootstrap:!0,initialEditorState:d,cursorsContainerRef:s}),(0,n.jsx)(eV,{content:a,provider:r,doc:t}),(0,n.jsx)(b.B,{}),(0,n.jsx)(m.E,{}),(0,n.jsx)(p.f,{}),(0,n.jsx)(x.l,{hasHorizontalScroll:!0}),(0,n.jsx)(h.r,{transformers:S.XC}),!l&&(0,n.jsx)(eL,{}),!l&&(0,n.jsx)(eZ,{onTitleExtracted:i}),!l&&(0,n.jsx)(eB,{onTitleExtracted:i}),!l&&(0,n.jsx)(eI,{}),!l&&(0,n.jsx)(eW,{})]})})}function e4(e){var t;let{connection:r,skill:l,readOnly:a=!1,onRegisterWorkingCopy:s,username:i,cursorColor:c,avatarUrl:u,onTitleExtracted:g,hideDescription:b=!1,hideTitle:m=!1}=e,{doc:p,provider:x}=r,f=(0,o.useRef)(null);(0,o.useEffect)(()=>{console.log("[timing] CollaborativeEditor MOUNTED (CollaborationPlugin will call connect())")},[]),t=x.awareness,(0,o.useEffect)(()=>{let e=f.current;if(!e||!t||!p)return;let r="collab-cursor-blink 1.4s step-end infinite",n=new Set,o=new Map;function l(e){let r=t.getStates().get(e);if(!(null==r?void 0:r.color))return;let l=function(e){let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb(".concat(parseInt(t[1],16),", ").concat(parseInt(t[2],16),", ").concat(parseInt(t[3],16),")"):e}(r.color),s=o.get(l);s&&clearTimeout(s),n.add(l);let i=window.setTimeout(()=>{o.delete(l),n.delete(l),a()},1500);
1o.set(l,i)}function a(){if(e)for(let t of e.querySelectorAll("span")){if("10"!==t.style.zIndex||"1px"!==t.style.width)continue;let e=t.style.backgroundColor;if(!e)continue;let o=t.firstElementChild;o&&(o.dataset.styled||(o.dataset.styled="1",o.style.borderRadius="3px",o.style.padding="1px 6px",o.style.fontSize="11px",o.style.fontWeight="500",o.style.lineHeight="16px",o.style.letterSpacing="0.01em",o.style.whiteSpace="nowrap",o.style.pointerEvents="none",o.style.boxShadow="0 1px 3px rgba(0,0,0,0.15)")),n.has(e)?("none"!==t.style.animation&&(t.style.animation="none"),t.style.opacity="1",o&&"1"!==o.style.opacity&&(o.style.transition="none",o.style.opacity="1")):(t.style.animation!==r&&(t.style.animation=r),o&&"0"!==o.style.opacity&&(o.style.transition="opacity 0.5s ease-out",o.style.opacity="0"))}}function s(e){if(e.local)return;let r=e.afterState,n=e.beforeState,o=!1;for(let[e,t]of r)t>(n.get(e)||0)&&e!==p.clientID&&(l(e),o=!0);if(!o){let r=e.deleteSet;if(r&&r.clients.size>0)for(let[e]of t.getStates())e!==t.clientID&&(l(e),o=!0)}o&&a()}function i(e){let{added:r,updated:n}=e,o=t.clientID,s=!1;for(let e of[...r,...n])e!==o&&(l(e),s=!0);s&&a()}p.on("afterTransaction",s),t.on("change",i);let d=new MutationObserver(()=>{requestAnimationFrame(a)});return d.observe(e,{childList:!0,subtree:!0}),a(),()=>{for(let e of(p.off("afterTransaction",s),t.off("change",i),d.disconnect(),o.values()))clearTimeout(e)}},[f,t,p]);let[v,h]=d(p,"name",l.name),[y,w]=d(p,"description",l.description);(0,o.useEffect)(()=>{if(!x||!i){console.log("[DO] CollaborativeEditor: skipping awareness setup, provider=".concat(!!x,", username=").concat(i));return}let e=x.awareness,t=()=>{console.log('[DO] CollaborativeEditor: setLocalState name="'.concat(i,'", color="').concat(c,'", clientID=').concat(e.clientID)),e.setLocalStateField("name",i),e.setLocalStateField("color",c),e.setLocalStateField("awarenessData",u?{avatarUrl:u}:{})};t();let r=r=>{let{updated:n}=r;if(!n.includes(e.clientID))return;let o=e.getLocalState();o&&(o.name!==i||o.color!==c)&&(console.log('[DO] CollaborativeEditor: identity overwritten (name="'.concat(o.name,'"), re-applying')),t())};return e.on("change",r),()=>{e.off("change",r)}},[x,i,c,u]);let j=(0,o.useRef)(null);(0,o.useEffect)(()=>{let e=j.current;e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},[y]);let k=(0,o.useRef)(v),N=(0,o.useRef)(y);return k.current=v,N.current=y,(0,o.useEffect)(()=>{null==s||s(()=>({name:k.current,description:N.current,content:p.getXmlFragment("content").toString()}))},[s,p]),(0,n.jsxs)("div",{className:"relative",ref:f,children:[!m&&(0,n.jsx)("input",{type:"text",value:v.replace(/[\r\n]+/g," "),onChange:e=>!a&&h(e.target.value.replace(/[\r\n]+/g," ")),onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},readOnly:a,placeholder:"Untitled",className:"text-[28px] font-bold text-[rgb(var(--foreground))] leading-tight outline-none w-full bg-transparent"}),!b&&(0,n.jsx)("textarea",{ref:j,value:y,onChange:e=>!a&&w(e.target.value),readOnly:a,placeholder:"Add a description...",rows:1,className:"text-base text-[rgb(var(--muted-foreground))] leading-relaxed outline-none w-full mt-2 mb-6 bg-transparent resize-none overflow-hidden"}),(!m||!b)&&(0,n.jsx)("hr",{className:"border-[rgb(var(--border))] mb-6 ".concat(b?"mt-6":"")}),(0,n.jsx)(e2,{doc:p,provider:x,readOnly:a,initialContent:l.content,cursorsContainerRef:f,onTitleExtracted:g})]})}let e6=[k.c2,k.rT,N.NK,N.EG,C.wg,C.o0,E.GR],e3={paragraph:"mb-1",heading:{h1:"text-2xl font-bold mt-6 mb-2",h2:"text-xl font-semibold mt-5 mb-2",h3:"text-lg font-medium mt-4 mb-1"}
1,list:{ul:"list-disc ml-6 mb-2",ol:"list-decimal ml-6 mb-2",listitem:"mb-0.5",nested:{listitem:"ml-4"}},quote:"border-l-2 border-[rgb(var(--border))] pl-4 italic text-[rgb(var(--muted-foreground))] mb-2",code:"bg-[rgb(var(--muted))] rounded px-1.5 py-0.5 font-mono text-sm",codeHighlight:{atrule:"text-purple-500",attr:"text-blue-500",boolean:"text-orange-500",builtin:"text-cyan-500",cdata:"text-gray-500",char:"text-green-500",class:"text-yellow-500","class-name":"text-yellow-500",comment:"text-gray-400 italic",constant:"text-orange-500",deleted:"text-red-500",doctype:"text-gray-500",entity:"text-orange-500",function:"text-blue-400",important:"text-orange-500 font-bold",inserted:"text-green-500",keyword:"text-purple-500",namespace:"text-red-500",number:"text-orange-500",operator:"text-gray-600",prolog:"text-gray-500",property:"text-blue-500",punctuation:"text-gray-500",regex:"text-orange-500",selector:"text-green-500",string:"text-green-600",symbol:"text-orange-500",tag:"text-red-500",url:"text-blue-500 underline",variable:"text-red-500"},link:"text-brand-600 dark:text-brand-400 underline cursor-pointer",text:{bold:"font-bold",italic:"italic",strikethrough:"line-through",underline:"underline",code:"bg-[rgb(var(--muted))] rounded px-1 py-0.5 font-mono text-[13px]"}};function e7(e){let{content:t}=e;return(0,n.jsxs)(c.R,{initialConfig:{namespace:"KavelaPreview",nodes:e6,editable:!1,theme:e3,editorState:()=>{if(t)try{(0,S.Os)(t,S.XC)}catch(r){let e=(0,D.GvG)();for(let r of t.split("\n")){let t=(0,D.BEw)();r&&t.append((0,D.MXo)(r)),e.append(t)}}},onError:e=>{console.error("Preview error:",e)}},children:[(0,n.jsx)(u.B,{contentEditable:(0,n.jsx)(g.f,{className:"outline-none min-h-[300px] text-base text-[rgb(var(--foreground))] leading-relaxed"}),placeholder:null,ErrorBoundary:j.g}),(0,n.jsx)(b.B,{})]})}function e8(e){let{initialContent:t,onChange:r,className:l,readOnly:a=!1,placeholder:s}=e,i=(0,o.useRef)(null),d=(0,o.useRef)(""),[c,u]=(0,o.useState)(!t);(0,o.useEffect)(()=>{i.current&&t!==d.current&&(i.current.innerText=t,d.current=t,u(!t))},[t]);let g=(0,o.useCallback)(()=>{if(i.current){let e=i.current.innerText||"";r(e),u(!e.trim())}},[r]);return(0,n.jsxs)("div",{className:"relative",children:[s&&c&&(0,n.jsx)("div",{className:"absolute inset-0 pointer-events-none text-[rgb(var(--muted-foreground))]/50 italic select-none",children:s}),(0,n.jsx)("div",{ref:i,contentEditable:!a,suppressContentEditableWarning:!0,onInput:a?void 0:g,className:l})]})}function e9(e){let{skill:t,isDraft:r=!1,draft:d,onDraftSaved:c,diffMode:u=!1,diffResult:g,diffLabels:b,onExitDiffMode:m,onRegisterWorkingCopy:p,readOnly:x=!1,shareToken:f,shareOrgId:v,onSkillSaved:h,onAwarenessChange:y,connection:w=null,connectionId:j=0,isSynced:k=!1,permissionRevoked:N=!1,username:C="Anonymous",cursorColor:E="#4ECDC4",avatarUrl:S=null,hideDescription:D=!1,hideTitle:_=!1}=e,[O,z]=(0,o.useState)(!1),[T,L]=(0,o.useState)(null),[Z,B]=(0,o.useState)(!1);(0,o.useEffect)(()=>{B(!1)},[j]),(0,o.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>B(!0),400);return()=>clearTimeout(e)},[k]),(0,o.useEffect)(()=>{var e;let t=null!==(e=null==w?void 0:w.provider.awareness)&&void 0!==e?e:null;return console.log("[DO] EditorCanvas: passing awareness to TopBar, awareness=".concat(!!t,", clientID=").concat(null==t?void 0:t.clientID,", states=").concat(null==t?void 0:t.getStates().size)),null==y||y(t),()=>{console.log("[DO] EditorCanvas: cleanup â passing null awareness to TopBar"),null==y||y(null)}},[w,y]);let I=(0,o.useRef)(""),R=(0,o.useRef)(""),A=(0,o.useRef)(null),M=(0,o.useRef)(!1),F=(0,o.useRef)(null);(0,o.useEffect)(()=>{w||null==p||p(()=>({name:I.current,description:t.description,content:R.current}))},[p,w]);let P=(0,o.useCallback)(()=>{u||x||w||(M.current=!0,F.current&&clearTimeout(F.current),F.current=setTimeout(async()=>{if(r&&d){z(!0);try{await (0,s.DO)({...d,name:I.current,description:t.description,content:R.current,updated_at:new Date().toISOString()}),M.current=!1,L(new Date),null==c||c()}catch(e){console.error("Failed to save draft:",e)}finally{z(!1)}return}let e=A.current;if(e){z(!0);try{await (0,a.updateSkill)(e,{name:I.current,description:t.description,content:R.current},f?{shareToken:f,orgId:v}:void 0),M.current=!1,L(new Date),null==h||h(e,I.current,t.description,R.current)}catch(e){console.error("Failed to save:",e)}finally{z(!1)}}},1500))},[u,x,w,r,d,c,f,v,h]);(0,o.useEffect)(()=>
1{if(w)return;let e=A.current;null===e||e===t.id||!M.current||r||x||(0,a.updateSkill)(e,{name:I.current,description:t.description,content:R.current},f?{shareToken:f,orgId:v}:void 0).catch(console.error),F.current&&(clearTimeout(F.current),F.current=null),M.current=!1,I.current=t.name,R.current=t.content,A.current=t.id,L(null)},[t.id,t.updated_at,r,x,w]),(0,o.useEffect)(()=>()=>{F.current&&clearTimeout(F.current),M.current&&A.current&&!r&&!x&&(0,a.updateSkill)(A.current,{name:I.current,content:R.current},f?{shareToken:f,orgId:v}:void 0).catch(console.error)},[r,x]);let H=(0,o.useCallback)(e=>{I.current=e,P()},[P]),U=(0,o.useCallback)(e=>{R.current=e,P()},[P]);return console.log("[timing] EditorCanvas render: skill.id=".concat(t.id,", hasName=").concat(!!t.name,", hasContent=").concat(!!t.content,", connection=").concat(!!w,", isSynced=").concat(k)),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto bg-[rgb(var(--background))]",children:(0,n.jsxs)("div",{className:"max-w-[720px] mx-auto px-6 pt-20 pb-32",children:[N&&(0,n.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900 mb-6",children:[(0,n.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),(0,n.jsx)("span",{className:"text-xs text-red-700 dark:text-red-400",children:"Your editing permission has been revoked. You are now in read-only mode."})]}),u&&g?(0,n.jsx)(i.Z,{diff:g,oldLabel:(null==b?void 0:b.old)||"Old",newLabel:(null==b?void 0:b.new)||"New"}):w?(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(e4,{connection:w,skill:t,readOnly:x||N,onRegisterWorkingCopy:p,username:C,cursorColor:E,avatarUrl:S,onTitleExtracted:H,hideDescription:D,hideTitle:_},j),!Z&&(0,n.jsx)("div",{className:(0,l.cn)("absolute inset-0 bg-[rgb(var(--background))] pointer-events-none z-10 transition-opacity duration-300",k?"opacity-0":"opacity-100"),children:t.content?(0,n.jsxs)(n.Fragment,{children:[!_&&(0,n.jsx)("div",{className:"text-[28px] font-bold text-[rgb(var(--foreground))] leading-tight w-full",children:t.name||(0,n.jsx)("span",{className:"text-[rgb(var(--muted-foreground))] opacity-50",children:"Untitled"})}),!D&&(0,n.jsx)("div",{className:"text-base text-[rgb(var(--muted-foreground))] leading-relaxed w-full mt-2 mb-6",children:t.description||(0,n.jsx)("span",{className:"opacity-50",children:"Add a description..."})}),(!_||!D)&&(0,n.jsx)("hr",{className:"border-[rgb(var(--border))] mb-6 ".concat(D?"mt-6":"")}),(0,n.jsx)(e7,{content:t.content})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"h-8 w-64 rounded bg-[rgb(var(--muted))] animate-pulse mb-3"}),(0,n.jsx)("div",{className:"h-4 w-96 max-w-full rounded bg-[rgb(var(--muted))] animate-pulse mb-6"}),(0,n.jsx)("hr",{className:"border-[rgb(var(--border))] mb-6"}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("div",{className:"h-4 w-full rounded bg-[rgb(var(--muted))] animate-pulse"}),(0,n.jsx)("div",{className:"h-4 w-5/6 rounded bg-[rgb(var(--muted))] animate-pulse"}),(0,n.jsx)("div",{className:"h-4 w-4/6 rounded bg-[rgb(var(--muted))] animate-pulse"}),(0,n.jsx)("div",{className:"h-4 w-full rounded bg-[rgb(var(--muted))] animate-pulse"}),(0,n.jsx)("div",{className:"h-4 w-3/4 rounded bg-[rgb(var(--muted))] animate-pulse"})]})]})})]}):(0,n.jsxs)(n.Fragment,{children:[!_&&(0,n.jsx)(e8,{initialContent:t.name,onChange:H,readOnly:x,placeholder:"Untitled skill",className:"text-[28px] font-bold text-[rgb(var(--foreground))] leading-tight outline-none w-full mb-3"},"name-".concat(t.id,"-").concat(t.updated_at)),!_&&(0,n.jsx)("hr",{className:"border-[rgb(var(--border))] mb-6"}),(0,n.jsx)(e8,{initialContent:t.content,onChange:U,readOnly:x,className:"text-base text-[rgb(var(--foreground))] leading-relaxed outline-none w-full whitespace-pre-wrap min-h-[300px]"},"content-".concat(t.id,"-").concat(t.updated_at))]})]})})}},38029:function(e,t,r){r.d(t,{Cb:function(){return d},DO:function(){return l},R5:function(){return i},eJ:function(){return a},lK:function(){return c},mU:function(){return s}});let n="drafts";function o(){return new Promise((e,t)=>
1{let r=indexedDB.open("kavela-drafts",1);r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(n)||e.createObjectStore(n,{keyPath:"id"})},r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}async function l(e){let t=await o();return new Promise((r,o)=>{let l=t.transaction(n,"readwrite");l.objectStore(n).put(e),l.oncomplete=()=>r(),l.onerror=()=>o(l.error)})}async function a(e){let t=await o();return new Promise((r,o)=>{let l=t.transaction(n,"readonly").objectStore(n).get(e);l.onsuccess=()=>{var e;return r(null!==(e=l.result)&&void 0!==e?e:void 0)},l.onerror=()=>o(l.error)})}async function s(e){let t=await o();return new Promise((r,o)=>{let l=t.transaction(n,"readonly").objectStore(n).getAll();l.onsuccess=()=>{let t=l.result;r(e?t.filter(t=>t.orgId===e):t)},l.onerror=()=>o(l.error)})}async function i(e){let t=await o();return new Promise((r,o)=>{let l=t.transaction(n,"readwrite");l.objectStore(n).delete(e),l.oncomplete=()=>r(),l.onerror=()=>o(l.error)})}function d(e){return e.startsWith("draft_")}function c(e,t){let r=new Date().toISOString();return{id:"draft_".concat(Date.now()),orgId:e,agentId:t,name:"Untitled Skill",description:"",content:"",domain:"engineering",keywords:"",groups:[],workflow_status:"draft",created_at:r,updated_at:r}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.